Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
46f87c73
Commit
46f87c73
authored
Feb 17, 2005
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Project palette-file generated from class editor
parent
2599efa3
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
592 additions
and
323 deletions
+592
-323
wb/lib/wb/src/wb_nav.cpp
wb/lib/wb/src/wb_nav.cpp
+4
-4
wb/lib/wb/src/wb_nav.h
wb/lib/wb/src/wb_nav.h
+1
-1
wb/lib/wb/src/wb_pal.cpp
wb/lib/wb/src/wb_pal.cpp
+8
-268
wb/lib/wb/src/wb_pal.h
wb/lib/wb/src/wb_pal.h
+12
-40
wb/lib/wb/src/wb_palfile.cpp
wb/lib/wb/src/wb_palfile.cpp
+364
-0
wb/lib/wb/src/wb_palfile.h
wb/lib/wb/src/wb_palfile.h
+73
-0
wb/lib/wb/src/wb_vrepmem.cpp
wb/lib/wb/src/wb_vrepmem.cpp
+123
-4
wb/lib/wb/src/wb_vrepmem.h
wb/lib/wb/src/wb_vrepmem.h
+1
-0
wb/lib/wb/src/wb_wnav.cpp
wb/lib/wb/src/wb_wnav.cpp
+1
-1
wb/lib/wb/src/wb_wnav.h
wb/lib/wb/src/wb_wnav.h
+1
-1
wb/lib/wb/src/wb_wnav_command.cpp
wb/lib/wb/src/wb_wnav_command.cpp
+4
-4
No files found.
wb/lib/wb/src/wb_nav.cpp
View file @
46f87c73
...
...
@@ -1301,7 +1301,7 @@ static int nav_init_brow_cb( FlowCtx *fctx, void *client_data)
#endif
if
(
!
nav
->
menu
)
{
nav
->
menu
=
Pal
::
config_tree_build
(
nav
->
ldhses
,
pal_cPaletteFile
,
nav
->
menu
=
Pal
File
::
config_tree_build
(
nav
->
ldhses
,
pal_cPaletteFile
,
pal_eNameType_TopObjects
,
nav
->
root_name
,
NULL
);
if
(
!
nav
->
menu
)
{
printf
(
...
...
@@ -1309,7 +1309,7 @@ static int nav_init_brow_cb( FlowCtx *fctx, void *client_data)
nav
->
root_name
);
return
0
;
}
Pal
::
config_tree_build
(
nav
->
ldhses
,
pal_cLocalPaletteFile
,
Pal
File
::
config_tree_build
(
nav
->
ldhses
,
pal_cLocalPaletteFile
,
pal_eNameType_TopObjects
,
nav
->
root_name
,
nav
->
menu
);
}
...
...
@@ -1364,7 +1364,7 @@ Nav::Nav(
//
Nav
::~
Nav
()
{
Pal
::
config_tree_free
(
menu
);
Pal
File
::
config_tree_free
(
menu
);
free_pixmaps
();
XtDestroyWidget
(
form_widget
);
}
...
...
@@ -1556,7 +1556,7 @@ int Nav::open_top()
pwr_tObjid
root
;
pwr_tClassId
classid
;
Item
*
item
;
pal_sMenu
*
menu_p
;
PalFileMenu
*
menu_p
;
if
(
!
menu
)
return
0
;
...
...
wb/lib/wb/src/wb_nav.h
View file @
46f87c73
...
...
@@ -67,7 +67,7 @@ class Nav {
int
(
*
set_focus_cb
)(
void
*
,
void
*
);
int
(
*
traverse_focus_cb
)(
void
*
,
void
*
);
int
displayed
;
pal_sMenu
*
menu
;
PalFileMenu
*
menu
;
void
zoom
(
double
zoom_factor
);
void
unzoom
();
...
...
wb/lib/wb/src/wb_pal.cpp
View file @
46f87c73
...
...
@@ -200,10 +200,10 @@ class PalItemObject : public PalItem {
class
PalItemMenu
:
public
PalItem
{
public:
PalItemMenu
(
Pal
*
pal
,
char
*
item_name
,
brow_tNode
dest
,
flow_eDest
dest_code
,
pal_s
Menu
**
item_child_list
,
brow_tNode
dest
,
flow_eDest
dest_code
,
PalFile
Menu
**
item_child_list
,
int
item_is_root
);
char
name
[
120
];
pal_s
Menu
**
child_list
;
PalFile
Menu
**
child_list
;
int
open
(
Pal
*
pal
,
double
x
,
double
y
);
int
close
(
Pal
*
pal
,
double
x
,
double
y
);
};
...
...
@@ -431,6 +431,7 @@ PalItemClass::PalItemClass( Pal *pal, char *item_name,
pixmap
=
pal
->
pixmap_arithm
;
break
;
case
1
:
case
10
:
pixmap
=
pal
->
pixmap_logic2_
;
break
;
case
2
:
...
...
@@ -496,7 +497,7 @@ PalItemObject::PalItemObject( Pal *pal, pwr_tObjid item_objid,
}
PalItemMenu
::
PalItemMenu
(
Pal
*
pal
,
char
*
item_name
,
brow_tNode
dest
,
flow_eDest
dest_code
,
pal_s
Menu
**
item_child_list
,
brow_tNode
dest
,
flow_eDest
dest_code
,
PalFile
Menu
**
item_child_list
,
int
item_is_root
)
:
PalItem
(
pwr_cNObjid
,
item_is_root
),
child_list
(
item_child_list
)
...
...
@@ -534,7 +535,7 @@ int PalItemMenu::open( Pal *pal, double x, double y)
// Display childlist
double
node_x
,
node_y
;
PalItem
*
item
;
pal_s
Menu
*
menu
;
PalFile
Menu
*
menu
;
if
(
!
is_root
)
brow_GetNodePosition
(
node
,
&
node_x
,
&
node_y
);
...
...
@@ -1519,14 +1520,14 @@ int Pal::session_opened( ldh_tSesContext pal_ldhses, char *pal_root_name)
wbctx
=
ldh_SessionToWB
(
ldhses
);
if
(
!
menu
)
{
menu
=
config_tree_build
(
ldhses
,
pal_cPaletteFile
,
menu
=
PalFile
::
config_tree_build
(
ldhses
,
pal_cPaletteFile
,
pal_eNameType_Palette
,
root_name
,
NULL
);
if
(
!
menu
)
{
printf
(
"** Pal: palette entry
\"
%s
\"
not found in configuration file
\n
"
,
root_name
);
return
0
;
}
config_tree_build
(
ldhses
,
pal_cLocalPaletteFile
,
PalFile
::
config_tree_build
(
ldhses
,
pal_cLocalPaletteFile
,
pal_eNameType_Palette
,
root_name
,
menu
);
}
...
...
@@ -1607,7 +1608,7 @@ Pal::~Pal()
if
(
avoid_deadlock
)
XtRemoveTimeOut
(
deadlock_timerid
);
config_tree_free
(
menu
);
PalFile
::
config_tree_free
(
menu
);
free_pixmaps
();
XtDestroyWidget
(
form_widget
);
}
...
...
@@ -1809,267 +1810,6 @@ int Pal::get_select( pwr_tClassId *classid)
pal_sMenu
*
Pal
::
config_tree_build
(
ldh_tSession
ldhses
,
char
*
filename
,
pal_eNameType
keytype
,
char
*
keyname
,
pal_sMenu
*
menu
)
{
ifstream
fp
;
int
line_cnt
=
0
;
char
line
[
140
];
char
type
[
120
];
char
name
[
120
];
int
nr
;
pal_sMenu
*
menu_tree
=
NULL
;
pal_sMenu
*
menu_p
;
char
fname
[
120
];
dcli_translate_filename
(
fname
,
filename
);
if
(
!
check_file
(
fname
))
return
menu_tree
;
fp
.
open
(
fname
);
#ifndef OS_VMS
if
(
!
fp
)
return
menu_tree
;
#endif
line_cnt
=
0
;
while
(
1
)
{
if
(
!
fp
.
getline
(
line
,
sizeof
(
line
)))
break
;
dcli_remove_blank
(
line
,
line
);
line_cnt
++
;
if
(
line
[
0
]
==
0
)
continue
;
if
(
line
[
0
]
==
'!'
||
line
[
0
]
==
'#'
)
continue
;
nr
=
sscanf
(
line
,
"%s %s"
,
type
,
name
);
if
(
nr
<
1
)
printf
(
"** Syntax error in file %s, line %d
\n
"
,
filename
,
line_cnt
);
if
(
(
keytype
==
pal_eNameType_TopObjects
&&
cdh_NoCaseStrcmp
(
type
,
"topobjects"
)
==
0
&&
cdh_NoCaseStrcmp
(
name
,
keyname
)
==
0
)
||
(
keytype
==
pal_eNameType_Palette
&&
cdh_NoCaseStrcmp
(
type
,
"palette"
)
==
0
&&
cdh_NoCaseStrcmp
(
name
,
keyname
)
==
0
))
{
if
(
nr
!=
2
)
printf
(
"** Syntax error in file %s, line %d
\n
"
,
filename
,
line_cnt
);
if
(
!
menu
)
{
menu_tree
=
(
pal_sMenu
*
)
calloc
(
1
,
sizeof
(
pal_sMenu
));
menu_tree
->
parent
=
NULL
;
menu_tree
->
item_type
=
pal_eMenuType_Menu
;
strcpy
(
menu_tree
->
title
,
name
);
}
else
menu_tree
=
menu
;
if
(
!
fp
.
getline
(
line
,
sizeof
(
line
)))
break
;
line_cnt
++
;
if
(
strcmp
(
line
,
"{"
)
!=
0
)
printf
(
"** Syntax error in file %s, line %d
\n
"
,
filename
,
line_cnt
);
menu_p
=
config_tree_build_children
(
ldhses
,
&
fp
,
&
line_cnt
,
filename
,
menu_tree
);
if
(
!
menu_tree
->
child_list
)
menu_tree
->
child_list
=
menu_p
;
break
;
}
}
fp
.
close
();
return
menu_tree
;
}
pal_sMenu
*
Pal
::
config_tree_build_children
(
ldh_tSession
ldhses
,
ifstream
*
fp
,
int
*
line_cnt
,
char
*
filename
,
pal_sMenu
*
parent
)
{
pal_sMenu
*
menu_p
,
*
prev
,
*
mp
;
pal_sMenu
*
return_menu
=
NULL
;
int
first
=
1
;
int
nr
;
char
line
[
140
];
char
type
[
120
];
char
name
[
120
];
char
p1
[
120
];
char
p2
[
120
];
int
found
;
int
hide_children
=
0
;
// Children might already exist
if
(
parent
)
{
for
(
menu_p
=
parent
->
child_list
;
menu_p
;
menu_p
=
menu_p
->
next
)
{
prev
=
menu_p
;
first
=
0
;
}
}
menu_p
=
0
;
while
(
1
)
{
if
(
!
fp
->
getline
(
line
,
sizeof
(
line
)))
break
;
dcli_remove_blank
(
line
,
line
);
(
*
line_cnt
)
++
;
if
(
line
[
0
]
==
0
)
continue
;
if
(
line
[
0
]
==
'!'
||
line
[
0
]
==
'#'
)
continue
;
nr
=
sscanf
(
line
,
"%s %s %s %s"
,
type
,
name
,
p1
,
p2
);
if
(
nr
<
1
)
printf
(
"** Syntax error in file %s, line %d
\n
"
,
filename
,
*
line_cnt
);
if
(
strcmp
(
type
,
"{"
)
==
0
)
{
if
(
!
hide_children
)
{
if
(
nr
!=
1
||
!
menu_p
)
printf
(
"** Syntax error in file %s, line %d
\n
"
,
filename
,
*
line_cnt
);
else
mp
=
config_tree_build_children
(
ldhses
,
fp
,
line_cnt
,
filename
,
menu_p
);
if
(
!
menu_p
->
child_list
)
menu_p
->
child_list
=
mp
;
}
else
hide_children
=
0
;
}
else
if
(
strcmp
(
type
,
"}"
)
==
0
)
{
if
(
nr
!=
1
)
printf
(
"** Syntax error in file %s, line %d
\n
"
,
filename
,
*
line_cnt
);
return
return_menu
;
}
else
if
(
cdh_NoCaseStrcmp
(
type
,
"menu"
)
==
0
)
{
if
(
!
(
nr
==
2
||
nr
==
3
))
printf
(
"** Syntax error in file %s, line %d
\n
"
,
filename
,
*
line_cnt
);
if
(
nr
==
3
&&
!
check_volume
(
ldhses
,
p1
))
{
hide_children
=
1
;
break
;
}
// Check if it already exist
found
=
0
;
for
(
menu_p
=
parent
->
child_list
;
menu_p
;
menu_p
=
menu_p
->
next
)
{
if
(
strcmp
(
menu_p
->
title
,
name
)
==
0
)
{
found
=
1
;
break
;
}
}
if
(
!
found
)
{
menu_p
=
(
pal_sMenu
*
)
calloc
(
1
,
sizeof
(
pal_sMenu
));
menu_p
->
parent
=
parent
;
menu_p
->
item_type
=
pal_eMenuType_Menu
;
strcpy
(
menu_p
->
title
,
name
);
if
(
first
)
{
return_menu
=
menu_p
;
first
=
0
;
}
else
prev
->
next
=
menu_p
;
prev
=
menu_p
;
}
}
else
if
(
cdh_NoCaseStrcmp
(
type
,
"class"
)
==
0
)
{
if
(
!
(
nr
==
2
||
nr
==
3
))
printf
(
"** Syntax error in file %s, line %d
\n
"
,
filename
,
*
line_cnt
);
if
(
nr
==
2
||
(
nr
==
3
&&
check_volume
(
ldhses
,
p1
)))
{
menu_p
=
(
pal_sMenu
*
)
calloc
(
1
,
sizeof
(
pal_sMenu
));
menu_p
->
parent
=
parent
;
menu_p
->
item_type
=
pal_eMenuType_Class
;
strcpy
(
menu_p
->
title
,
name
);
if
(
first
)
{
return_menu
=
menu_p
;
first
=
0
;
}
else
prev
->
next
=
menu_p
;
prev
=
menu_p
;
}
}
else
if
(
cdh_NoCaseStrcmp
(
type
,
"classvolume"
)
==
0
)
{
if
(
!
(
nr
==
2
||
nr
==
3
))
printf
(
"** Syntax error in file %s, line %d
\n
"
,
filename
,
*
line_cnt
);
if
(
nr
==
2
||
(
nr
==
3
&&
check_volume
(
ldhses
,
p1
)))
{
menu_p
=
(
pal_sMenu
*
)
calloc
(
1
,
sizeof
(
pal_sMenu
));
menu_p
->
parent
=
parent
;
menu_p
->
item_type
=
pal_eMenuType_ClassVolume
;
strcpy
(
menu_p
->
title
,
name
);
if
(
first
)
{
return_menu
=
menu_p
;
first
=
0
;
}
else
prev
->
next
=
menu_p
;
prev
=
menu_p
;
}
}
}
return
return_menu
;
}
int
Pal
::
check_volume
(
ldh_tSession
ldhses
,
char
*
name
)
{
pwr_tClassId
classid
;
pwr_tVolumeId
volume
;
int
sts
;
int
size
;
char
volume_name
[
80
];
// Find a class volume with this name
sts
=
ldh_GetVolumeList
(
ldh_SessionToWB
(
ldhses
),
&
volume
);
while
(
ODD
(
sts
))
{
sts
=
ldh_GetVolumeClass
(
ldh_SessionToWB
(
ldhses
),
volume
,
&
classid
);
if
(
EVEN
(
sts
))
return
0
;
if
(
classid
==
pwr_eClass_ClassVolume
)
{
sts
=
ldh_VolumeIdToName
(
ldh_SessionToWB
(
ldhses
),
volume
,
volume_name
,
sizeof
(
volume_name
),
&
size
);
if
(
EVEN
(
sts
))
return
0
;
if
(
!
cdh_NoCaseStrcmp
(
volume_name
,
name
))
return
1
;
}
sts
=
ldh_GetNextVolume
(
ldh_SessionToWB
(
ldhses
),
volume
,
&
volume
);
}
return
0
;
}
void
Pal
::
config_tree_free
(
pal_sMenu
*
menu_tree
)
{
if
(
menu_tree
)
config_tree_free_children
(
menu_tree
);
}
void
Pal
::
config_tree_free_children
(
pal_sMenu
*
first_child
)
{
pal_sMenu
*
menu_p
,
*
next
;
menu_p
=
first_child
;
while
(
menu_p
)
{
next
=
menu_p
->
next
;
if
(
menu_p
->
child_list
)
config_tree_free_children
(
menu_p
->
child_list
);
free
(
(
char
*
)
menu_p
);
menu_p
=
next
;
}
}
static
void
pal_reset_avoid_deadlock
(
Pal
*
pal
)
{
pal
->
avoid_deadlock
=
0
;
...
...
wb/lib/wb/src/wb_pal.h
View file @
46f87c73
...
...
@@ -23,29 +23,9 @@ extern "C" {
#include "flow_browapi.h"
#endif
#define pal_cPaletteFile "$pwr_exe/pwr_wb_palette.cnf"
#define pal_cLocalPaletteFile "$pwrp_login/pwrp_wb_palette.cnf"
typedef
enum
{
pal_eNameType_TopObjects
,
pal_eNameType_Palette
}
pal_eNameType
;
typedef
enum
{
pal_eMenuType_Menu
,
pal_eMenuType_Class
,
pal_eMenuType_ClassVolume
}
pal_eMenuType
;
typedef
struct
pal_s_Menu
{
char
title
[
80
];
int
item_type
;
char
file
[
120
];
int
pixmap
;
struct
pal_s_Menu
*
child_list
;
struct
pal_s_Menu
*
parent
;
struct
pal_s_Menu
*
next
;
}
pal_sMenu
;
#ifndef wb_palfile_h
#include "wb_palfile.h"
#endif
class
Pal
{
...
...
@@ -72,16 +52,16 @@ class Pal {
ldh_tWBContext
wbctx
;
ldh_tSesContext
ldhses
;
pwr_tObjid
root_objid
;
void
*
root_item
;
brow_tObject
last_selected
;
int
selection_owner
;
int
(
*
set_focus_cb
)(
void
*
,
void
*
);
int
(
*
traverse_focus_cb
)(
void
*
,
void
*
);
void
(
*
create_popup_menu_cb
)(
void
*
,
pwr_tCid
,
int
,
int
);
void
*
root_item
;
brow_tObject
last_selected
;
int
selection_owner
;
int
(
*
set_focus_cb
)(
void
*
,
void
*
);
int
(
*
traverse_focus_cb
)(
void
*
,
void
*
);
void
(
*
create_popup_menu_cb
)(
void
*
,
pwr_tCid
,
int
,
int
);
int
displayed
;
pal_sMenu
*
menu
;
int
avoid_deadlock
;
XtIntervalId
deadlock_timerid
;
PalFileMenu
*
menu
;
int
avoid_deadlock
;
XtIntervalId
deadlock_timerid
;
brow_tNodeClass
nc
;
flow_sAnnotPixmap
*
pixmap_leaf
;
...
...
@@ -140,14 +120,6 @@ class Pal {
void
set_selection_owner
();
int
session_opened
(
ldh_tSesContext
pal_ldhses
,
char
*
pal_root_name
);
int
session_closed
();
static
pal_sMenu
*
config_tree_build
(
ldh_tSession
ldhses
,
char
*
filename
,
pal_eNameType
keytype
,
char
*
keyname
,
pal_sMenu
*
menu
);
static
pal_sMenu
*
config_tree_build_children
(
ldh_tSession
ldhses
,
ifstream
*
fp
,
int
*
line_cnt
,
char
*
filename
,
pal_sMenu
*
parent
);
static
void
config_tree_free
(
pal_sMenu
*
menu_tree
);
static
void
config_tree_free_children
(
pal_sMenu
*
first_child
);
static
int
check_volume
(
ldh_tSession
ldhses
,
char
*
name
);
};
#if defined __cplusplus
...
...
wb/lib/wb/src/wb_palfile.cpp
0 → 100644
View file @
46f87c73
/* wb_palfile.cpp -- Palette of configurator or plc-editor
PROVIEW/R
Copyright (C) 1996 by Comator Process AB.
<Description>. */
#if defined OS_VMS && defined __ALPHA
# pragma message disable (NOSIMPINT,EXTROUENCUNNOBJ)
#endif
#if defined OS_VMS && !defined __ALPHA
# pragma message disable (LONGEXTERN)
#endif
#include <stdio.h>
#include <stdlib.h>
#include <iostream.h>
#include <fstream.h>
#include "wb_palfile.h"
extern
"C"
{
#include "wb_ldh.h"
#include "co_cdh.h"
#include "co_dcli.h"
#include "pwr_baseclasses.h"
}
PalFileMenu
*
PalFile
::
config_tree_build
(
ldh_tSession
ldhses
,
char
*
filename
,
pal_eNameType
keytype
,
char
*
keyname
,
PalFileMenu
*
menu
)
{
ifstream
fp
;
int
line_cnt
=
0
;
char
line
[
140
];
char
type
[
120
];
char
name
[
120
];
int
nr
;
PalFileMenu
*
menu_tree
=
NULL
;
PalFileMenu
*
menu_p
,
*
mp
;
char
fname
[
120
];
dcli_translate_filename
(
fname
,
filename
);
fp
.
open
(
fname
);
#ifndef OS_VMS
if
(
!
fp
)
return
menu_tree
;
#endif
line_cnt
=
0
;
while
(
1
)
{
if
(
!
fp
.
getline
(
line
,
sizeof
(
line
)))
break
;
dcli_remove_blank
(
line
,
line
);
line_cnt
++
;
if
(
line
[
0
]
==
0
)
continue
;
if
(
line
[
0
]
==
'!'
||
line
[
0
]
==
'#'
)
continue
;
nr
=
sscanf
(
line
,
"%s %s"
,
type
,
name
);
if
(
nr
<
1
)
printf
(
"** Syntax error in file %s, line %d
\n
"
,
filename
,
line_cnt
);
if
(
keytype
!=
pal_eNameType_All
)
{
if
(
(
keytype
==
pal_eNameType_TopObjects
&&
cdh_NoCaseStrcmp
(
type
,
"topobjects"
)
==
0
&&
cdh_NoCaseStrcmp
(
name
,
keyname
)
==
0
)
||
(
keytype
==
pal_eNameType_Palette
&&
cdh_NoCaseStrcmp
(
type
,
"palette"
)
==
0
&&
cdh_NoCaseStrcmp
(
name
,
keyname
)
==
0
))
{
if
(
nr
!=
2
)
printf
(
"** Syntax error in file %s, line %d
\n
"
,
filename
,
line_cnt
);
if
(
!
menu
)
menu_tree
=
new
PalFileMenu
(
name
,
pal_eMenuType_Menu
,
NULL
);
else
menu_tree
=
menu
;
if
(
!
fp
.
getline
(
line
,
sizeof
(
line
)))
break
;
line_cnt
++
;
if
(
strcmp
(
line
,
"{"
)
!=
0
)
printf
(
"** Syntax error in file %s, line %d
\n
"
,
filename
,
line_cnt
);
menu_p
=
config_tree_build_children
(
ldhses
,
&
fp
,
&
line_cnt
,
filename
,
menu_tree
);
if
(
!
menu_tree
->
child_list
)
menu_tree
->
child_list
=
menu_p
;
break
;
}
}
else
{
if
(
nr
!=
2
)
printf
(
"** Syntax error in file %s, line %d
\n
"
,
filename
,
line_cnt
);
if
(
cdh_NoCaseStrcmp
(
type
,
"topobjects"
)
==
0
)
menu_p
=
new
PalFileMenu
(
name
,
pal_eMenuType_TopObjects
,
NULL
);
else
if
(
cdh_NoCaseStrcmp
(
type
,
"palette"
)
==
0
)
menu_p
=
new
PalFileMenu
(
name
,
pal_eMenuType_Palette
,
NULL
);
if
(
!
menu_tree
)
menu_tree
=
menu_p
;
else
{
for
(
mp
=
menu_tree
;
mp
->
next
;
mp
=
mp
->
next
)
;
mp
->
next
=
menu_p
;
}
if
(
!
fp
.
getline
(
line
,
sizeof
(
line
)))
break
;
line_cnt
++
;
if
(
strcmp
(
line
,
"{"
)
!=
0
)
printf
(
"** Syntax error in file %s, line %d
\n
"
,
filename
,
line_cnt
);
menu_p
->
child_list
=
config_tree_build_children
(
ldhses
,
&
fp
,
&
line_cnt
,
filename
,
menu_p
);
}
}
fp
.
close
();
return
menu_tree
;
}
PalFileMenu
*
PalFile
::
config_tree_build_children
(
ldh_tSession
ldhses
,
ifstream
*
fp
,
int
*
line_cnt
,
char
*
filename
,
PalFileMenu
*
parent
)
{
PalFileMenu
*
menu_p
,
*
prev
,
*
mp
;
PalFileMenu
*
return_menu
=
NULL
;
int
first
=
1
;
int
nr
;
char
line
[
140
];
char
type
[
120
];
char
name
[
120
];
char
p1
[
120
];
char
p2
[
120
];
int
found
;
int
hide_children
=
0
;
// Children might already exist
if
(
parent
)
{
for
(
menu_p
=
parent
->
child_list
;
menu_p
;
menu_p
=
menu_p
->
next
)
{
prev
=
menu_p
;
first
=
0
;
}
}
menu_p
=
0
;
while
(
1
)
{
if
(
!
fp
->
getline
(
line
,
sizeof
(
line
)))
break
;
dcli_remove_blank
(
line
,
line
);
(
*
line_cnt
)
++
;
if
(
line
[
0
]
==
0
)
continue
;
if
(
line
[
0
]
==
'!'
||
line
[
0
]
==
'#'
)
continue
;
nr
=
sscanf
(
line
,
"%s %s %s %s"
,
type
,
name
,
p1
,
p2
);
if
(
nr
<
1
)
printf
(
"** Syntax error in file %s, line %d
\n
"
,
filename
,
*
line_cnt
);
if
(
strcmp
(
type
,
"{"
)
==
0
)
{
if
(
!
hide_children
)
{
if
(
nr
!=
1
||
!
menu_p
)
printf
(
"** Syntax error in file %s, line %d
\n
"
,
filename
,
*
line_cnt
);
else
mp
=
config_tree_build_children
(
ldhses
,
fp
,
line_cnt
,
filename
,
menu_p
);
if
(
!
menu_p
->
child_list
)
menu_p
->
child_list
=
mp
;
}
else
hide_children
=
0
;
}
else
if
(
strcmp
(
type
,
"}"
)
==
0
)
{
if
(
nr
!=
1
)
printf
(
"** Syntax error in file %s, line %d
\n
"
,
filename
,
*
line_cnt
);
return
return_menu
;
}
else
if
(
cdh_NoCaseStrcmp
(
type
,
"menu"
)
==
0
)
{
if
(
!
(
nr
==
2
||
nr
==
3
))
printf
(
"** Syntax error in file %s, line %d
\n
"
,
filename
,
*
line_cnt
);
if
(
nr
==
3
&&
(
ldhses
&&
!
check_volume
(
ldhses
,
p1
)))
{
hide_children
=
1
;
break
;
}
// Check if it already exist
found
=
0
;
for
(
menu_p
=
parent
->
child_list
;
menu_p
;
menu_p
=
menu_p
->
next
)
{
if
(
strcmp
(
menu_p
->
title
,
name
)
==
0
)
{
found
=
1
;
break
;
}
}
if
(
!
found
)
{
menu_p
=
new
PalFileMenu
(
name
,
pal_eMenuType_Menu
,
parent
);
if
(
first
)
{
return_menu
=
menu_p
;
first
=
0
;
}
else
prev
->
next
=
menu_p
;
prev
=
menu_p
;
}
}
else
if
(
cdh_NoCaseStrcmp
(
type
,
"class"
)
==
0
)
{
if
(
!
(
nr
==
2
||
nr
==
3
))
printf
(
"** Syntax error in file %s, line %d
\n
"
,
filename
,
*
line_cnt
);
if
(
nr
==
2
||
(
nr
==
3
&&
(
!
ldhses
||
check_volume
(
ldhses
,
p1
))))
{
menu_p
=
new
PalFileMenu
(
name
,
pal_eMenuType_Class
,
parent
);
if
(
first
)
{
return_menu
=
menu_p
;
first
=
0
;
}
else
prev
->
next
=
menu_p
;
prev
=
menu_p
;
}
}
else
if
(
cdh_NoCaseStrcmp
(
type
,
"classvolume"
)
==
0
)
{
if
(
!
(
nr
==
2
||
nr
==
3
))
printf
(
"** Syntax error in file %s, line %d
\n
"
,
filename
,
*
line_cnt
);
if
(
nr
==
2
||
(
nr
==
3
&&
(
!
ldhses
||
check_volume
(
ldhses
,
p1
))))
{
menu_p
=
new
PalFileMenu
(
name
,
pal_eMenuType_ClassVolume
,
parent
);
if
(
first
)
{
return_menu
=
menu_p
;
first
=
0
;
}
else
prev
->
next
=
menu_p
;
prev
=
menu_p
;
}
}
}
return
return_menu
;
}
int
PalFile
::
check_volume
(
ldh_tSession
ldhses
,
char
*
name
)
{
pwr_tClassId
classid
;
pwr_tVolumeId
volume
;
int
sts
;
int
size
;
char
volume_name
[
80
];
// Find a class volume with this name
sts
=
ldh_GetVolumeList
(
ldh_SessionToWB
(
ldhses
),
&
volume
);
while
(
ODD
(
sts
))
{
sts
=
ldh_GetVolumeClass
(
ldh_SessionToWB
(
ldhses
),
volume
,
&
classid
);
if
(
EVEN
(
sts
))
return
0
;
if
(
classid
==
pwr_eClass_ClassVolume
)
{
sts
=
ldh_VolumeIdToName
(
ldh_SessionToWB
(
ldhses
),
volume
,
volume_name
,
sizeof
(
volume_name
),
&
size
);
if
(
EVEN
(
sts
))
return
0
;
if
(
!
cdh_NoCaseStrcmp
(
volume_name
,
name
))
return
1
;
}
sts
=
ldh_GetNextVolume
(
ldh_SessionToWB
(
ldhses
),
volume
,
&
volume
);
}
return
0
;
}
void
PalFile
::
config_tree_free
(
PalFileMenu
*
menu_tree
)
{
if
(
menu_tree
)
config_tree_free_children
(
menu_tree
);
}
void
PalFile
::
config_tree_free_children
(
PalFileMenu
*
first_child
)
{
PalFileMenu
*
menu_p
,
*
next
;
menu_p
=
first_child
;
while
(
menu_p
)
{
next
=
menu_p
->
next
;
if
(
menu_p
->
child_list
)
config_tree_free_children
(
menu_p
->
child_list
);
delete
menu_p
;
menu_p
=
next
;
}
}
void
PalFile
::
config_tree_print
(
char
*
filename
,
PalFileMenu
*
menu_tree
,
pwr_tStatus
*
sts
)
{
pwr_tFileName
fname
;
ofstream
fp
;
PalFileMenu
*
menu_p
;
*
sts
=
1
;
dcli_translate_filename
(
fname
,
filename
);
fp
.
open
(
fname
);
#ifndef OS_VMS
if
(
!
fp
)
{
*
sts
=
0
;
return
;
}
#endif
for
(
menu_p
=
menu_tree
;
menu_p
;
menu_p
=
menu_p
->
next
)
config_tree_print_item
(
menu_p
,
fp
,
0
);
fp
.
close
();
}
void
PalFile
::
config_tree_print_item
(
PalFileMenu
*
item
,
ofstream
&
fp
,
int
level
)
{
PalFileMenu
*
menu_p
;
char
ind_str
[
80
]
=
""
;
for
(
int
i
=
0
;
i
<
level
;
i
++
)
strcat
(
ind_str
,
" "
);
switch
(
item
->
item_type
)
{
case
pal_eMenuType_TopObjects
:
fp
<<
"topobjects "
<<
item
->
title
<<
endl
<<
"{"
<<
endl
;
break
;
case
pal_eMenuType_Palette
:
fp
<<
"palette "
<<
item
->
title
<<
endl
<<
"{"
<<
endl
;
break
;
case
pal_eMenuType_Menu
:
fp
<<
ind_str
<<
"menu "
<<
item
->
title
<<
endl
<<
ind_str
<<
"{"
<<
endl
;
break
;
case
pal_eMenuType_Class
:
fp
<<
ind_str
<<
"class "
<<
item
->
title
<<
endl
;
break
;
case
pal_eMenuType_ClassVolume
:
fp
<<
ind_str
<<
"classvolume "
<<
item
->
title
<<
endl
;
break
;
}
for
(
menu_p
=
item
->
child_list
;
menu_p
;
menu_p
=
menu_p
->
next
)
{
config_tree_print_item
(
menu_p
,
fp
,
level
+
1
);
}
switch
(
item
->
item_type
)
{
case
pal_eMenuType_TopObjects
:
case
pal_eMenuType_Palette
:
case
pal_eMenuType_Menu
:
fp
<<
ind_str
<<
"}"
<<
endl
;
break
;
default:
;
}
}
wb/lib/wb/src/wb_palfile.h
0 → 100644
View file @
46f87c73
#ifndef wb_palfile_h
#define wb_palfile_h
/* wb_palfile.h -- Palette configuration file
PROVIEW/R
Copyright (C) 1996 by Comator Process AB.
<Description>. */
#if defined __cplusplus
extern
"C"
{
#endif
#ifndef pwr_h
# include "pwr.h"
#endif
#ifndef wb_ldh_h
# include "wb_ldh.h"
#endif
#define pal_cPaletteFile "$pwr_exe/pwr_wb_palette.cnf"
#define pal_cLocalPaletteFile "$pwrp_db/pwrp_cnf_palette.dat"
typedef
enum
{
pal_eNameType_TopObjects
,
pal_eNameType_Palette
,
pal_eNameType_All
}
pal_eNameType
;
typedef
enum
{
pal_eMenuType_Menu
,
pal_eMenuType_Class
,
pal_eMenuType_ClassVolume
,
pal_eMenuType_TopObjects
,
pal_eMenuType_Palette
}
pal_eMenuType
;
class
PalFileMenu
{
public:
PalFileMenu
(
char
*
menu_title
,
int
menu_item_type
,
PalFileMenu
*
menu_parent
)
:
item_type
(
menu_item_type
),
pixmap
(
0
),
child_list
(
0
),
parent
(
menu_parent
),
next
(
0
)
{
strcpy
(
title
,
menu_title
);}
char
title
[
80
];
int
item_type
;
char
file
[
120
];
int
pixmap
;
PalFileMenu
*
child_list
;
PalFileMenu
*
parent
;
PalFileMenu
*
next
;
};
class
PalFile
{
public:
static
PalFileMenu
*
config_tree_build
(
ldh_tSession
ldhses
,
char
*
filename
,
pal_eNameType
keytype
,
char
*
keyname
,
PalFileMenu
*
menu
);
static
PalFileMenu
*
config_tree_build_children
(
ldh_tSession
ldhses
,
ifstream
*
fp
,
int
*
line_cnt
,
char
*
filename
,
PalFileMenu
*
parent
);
static
void
config_tree_free
(
PalFileMenu
*
menu_tree
);
static
void
config_tree_free_children
(
PalFileMenu
*
first_child
);
static
int
check_volume
(
ldh_tSession
ldhses
,
char
*
name
);
static
void
config_tree_print
(
char
*
filename
,
PalFileMenu
*
menu_tree
,
pwr_tStatus
*
sts
);
static
void
config_tree_print_item
(
PalFileMenu
*
item
,
ofstream
&
fp
,
int
level
);
};
#if defined __cplusplus
}
#endif
#endif
wb/lib/wb/src/wb_vrepmem.cpp
View file @
46f87c73
...
...
@@ -19,6 +19,7 @@
#include "wb_vrepref.h"
#include "wb_print_wbl.h"
#include "wb_volume.h"
#include "wb_palfile.h"
#include "pwr_baseclasses.h"
extern
"C"
{
...
...
@@ -56,6 +57,10 @@ wb_vrepmem::~wb_vrepmem()
void
wb_vrepmem
::
loadWbl
(
char
*
filename
,
pwr_tStatus
*
sts
)
{
if
(
m_erep
->
refMerepOccupied
())
{
*
sts
=
LDH__OTHERSESS
;
return
;
}
wb_vrepwbl
*
vrep
=
new
wb_vrepwbl
(
m_erep
);
*
sts
=
vrep
->
load
(
filename
);
if
(
vrep
->
vid
()
==
0
)
{
...
...
@@ -797,6 +802,7 @@ bool wb_vrepmem::createVolumeObject( char *name)
}
volume_object
=
memo
;
strcpy
(
volume_name
,
name
);
registerObject
(
memo
->
m_oid
.
oix
,
memo
);
return
true
;
}
...
...
@@ -1706,6 +1712,7 @@ bool wb_vrepmem::importHead(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid,
if
(
oid
.
oix
==
pwr_cNOix
)
{
// this is the volume object
volume_object
=
memo
;
strcpy
(
volume_name
,
name
);
m_cid
=
cid
;
}
registerObject
(
memo
->
m_oid
.
oix
,
memo
);
...
...
@@ -1762,6 +1769,12 @@ bool wb_vrepmem::importDocBlock(pwr_tOid oid, size_t size, char *block)
bool
wb_vrepmem
::
commit
(
pwr_tStatus
*
sts
)
{
pwr_tCmd
cmd
;
// Play safe and save the previous file...
sprintf
(
cmd
,
"pwrp_env.sh save file %s"
,
m_filename
);
system
(
cmd
);
ofstream
fp
(
m_filename
);
if
(
!
fp
)
{
*
sts
=
LDH__FILEOPEN
;
...
...
@@ -1779,6 +1792,8 @@ bool wb_vrepmem::commit(pwr_tStatus *sts)
return
false
;
}
printPaletteFile
();
// Reload to get new template objects
clear
();
loadWbl
(
m_filename
,
sts
);
...
...
@@ -2073,10 +2088,114 @@ bool wb_vrepmem::classeditorCheckMove( mem_object *memo, ldh_eDest dest_code,
return
true
;
}
void
wb_vrepmem
::
printPaletteFile
()
{
// Print new palette file
pwr_tStatus
psts
;
int
menu_found
=
0
;
int
allclasses_found
=
0
;
int
palette_found
=
0
;
PalFileMenu
*
menu
=
PalFile
::
config_tree_build
(
0
,
pal_cLocalPaletteFile
,
pal_eNameType_All
,
""
,
0
);
PalFileMenu
*
mp
,
*
mp2
,
*
mp3
,
*
mp4
;
mem_object
*
memch
,
*
memcd
,
*
memgn
;
// Add menu "NavigatorPalette-AllClasses-'volumename' if not found
for
(
mp
=
menu
;
mp
;
mp
=
mp
->
next
)
{
if
(
mp
->
item_type
==
pal_eMenuType_Palette
&&
cdh_NoCaseStrcmp
(
mp
->
title
,
"NavigatorPalette"
)
==
0
)
{
for
(
mp2
=
mp
->
child_list
;
mp2
;
mp2
=
mp2
->
next
)
{
if
(
mp2
->
item_type
==
pal_eMenuType_Menu
&&
cdh_NoCaseStrcmp
(
mp2
->
title
,
"AllClasses"
)
==
0
)
{
for
(
mp3
=
mp2
->
child_list
;
mp3
;
mp3
=
mp3
->
next
)
{
if
(
mp3
->
item_type
==
pal_eMenuType_ClassVolume
&&
cdh_NoCaseStrcmp
(
mp3
->
title
,
volume_name
)
==
0
)
{
menu_found
=
1
;
break
;
}
}
allclasses_found
=
1
;
break
;
}
}
palette_found
=
1
;
break
;
}
}
if
(
!
palette_found
)
{
// Create palette
mp
=
new
PalFileMenu
(
"NavigatorPalette"
,
pal_eMenuType_Palette
,
0
);
mp
->
next
=
menu
;
menu
=
mp
;
}
if
(
!
allclasses_found
)
{
// Create volume menu
mp2
=
new
PalFileMenu
(
"AllClasses"
,
pal_eMenuType_Menu
,
mp
);
mp2
->
next
=
mp
->
child_list
;
mp
->
child_list
=
mp2
;
}
if
(
!
menu_found
)
{
// Create volume menu
mp3
=
new
PalFileMenu
(
volume_name
,
pal_eMenuType_ClassVolume
,
mp2
);
mp3
->
next
=
mp2
->
child_list
;
mp2
->
child_list
=
mp3
;
}
// Replace menu "PlcEditorPalette-'volumename'-* with function object classes
menu_found
=
0
;
palette_found
=
0
;
for
(
mp
=
menu
;
mp
;
mp
=
mp
->
next
)
{
if
(
mp
->
item_type
==
pal_eMenuType_Palette
&&
cdh_NoCaseStrcmp
(
mp
->
title
,
"PlcEditorPalette"
)
==
0
)
{
for
(
mp2
=
mp
->
child_list
;
mp2
;
mp2
=
mp2
->
next
)
{
if
(
mp2
->
item_type
==
pal_eMenuType_Menu
&&
cdh_NoCaseStrcmp
(
mp2
->
title
,
volume_name
)
==
0
)
{
// Remove
PalFile
::
config_tree_free
(
mp2
->
child_list
);
mp2
->
child_list
=
0
;
menu_found
=
1
;
break
;
}
}
palette_found
=
1
;
break
;
}
}
if
(
!
palette_found
)
{
// Create palette
mp
=
new
PalFileMenu
(
"PlcEditorPalette"
,
pal_eMenuType_Palette
,
0
);
mp
->
next
=
menu
;
menu
=
mp
;
}
if
(
!
menu_found
)
{
// Create volume menu
mp2
=
new
PalFileMenu
(
volume_name
,
pal_eMenuType_Menu
,
mp
);
mp2
->
next
=
mp
->
child_list
;
mp
->
child_list
=
mp2
;
}
for
(
memch
=
root_object
;
memch
;
memch
=
memch
->
fws
)
{
if
(
memch
->
m_cid
==
pwr_eClass_ClassHier
)
{
for
(
memcd
=
memch
->
fch
;
memcd
;
memcd
=
memcd
->
fws
)
{
for
(
memgn
=
memcd
->
fch
;
memgn
;
memgn
=
memgn
->
fws
)
{
if
(
memgn
->
m_cid
==
pwr_eClass_GraphPlcNode
)
{
// Add to menu
mp4
=
mp3
;
mp3
=
new
PalFileMenu
(
memcd
->
m_name
,
pal_eMenuType_Class
,
mp2
);
if
(
!
mp2
->
child_list
)
mp2
->
child_list
=
mp3
;
else
mp4
->
next
=
mp3
;
break
;
}
}
}
break
;
}
}
PalFile
::
config_tree_print
(
pal_cLocalPaletteFile
,
menu
,
&
psts
);
}
wb/lib/wb/src/wb_vrepmem.h
View file @
46f87c73
...
...
@@ -346,6 +346,7 @@ public:
bool
nameCheck
(
mem_object
*
memo
);
bool
nameCheck
(
mem_object
*
parent
,
char
*
name
,
ldh_eDest
code
);
void
deleteChildren
(
mem_object
*
memo
);
void
printPaletteFile
();
};
...
...
wb/lib/wb/src/wb_wnav.cpp
View file @
46f87c73
...
...
@@ -630,7 +630,7 @@ WNav::~WNav()
XtRemoveTimeOut
(
deadlock_timerid
);
menu_tree_free
();
Pal
::
config_tree_free
(
menu
);
Pal
File
::
config_tree_free
(
menu
);
for
(
int
i
=
1
;
i
<
brow_cnt
;
i
++
)
{
brow_DeleteSecondaryCtx
(
brow_stack
[
brow_cnt
]
->
ctx
);
...
...
wb/lib/wb/src/wb_wnav.h
View file @
46f87c73
...
...
@@ -268,7 +268,7 @@ class WNav {
int
dialog_height
;
int
dialog_x
;
int
dialog_y
;
pal_sMenu
*
menu
;
PalFileMenu
*
menu
;
int
init_help
;
int
avoid_deadlock
;
XtIntervalId
deadlock_timerid
;
...
...
wb/lib/wb/src/wb_wnav_command.cpp
View file @
46f87c73
...
...
@@ -4149,7 +4149,7 @@ int WNav::get_rootlist()
pwr_tClassId
valid_class
[
100
];
int
i
;
pwr_tClassId
classid
;
pal_s
Menu
*
menu_p
;
PalFile
Menu
*
menu_p
;
if
(
gbl
.
all_toplevel
||
strcmp
(
layout
,
""
)
==
0
)
{
...
...
@@ -4165,7 +4165,7 @@ int WNav::get_rootlist()
{
// Get valid toplevel classes from config file
if
(
!
menu
)
{
menu
=
Pal
::
config_tree_build
(
ldhses
,
pal_cPaletteFile
,
menu
=
Pal
File
::
config_tree_build
(
ldhses
,
pal_cPaletteFile
,
pal_eNameType_TopObjects
,
layout
,
NULL
);
if
(
!
menu
)
{
printf
(
...
...
@@ -4173,7 +4173,7 @@ int WNav::get_rootlist()
layout
);
return
0
;
}
Pal
::
config_tree_build
(
ldhses
,
pal_cLocalPaletteFile
,
Pal
File
::
config_tree_build
(
ldhses
,
pal_cLocalPaletteFile
,
pal_eNameType_TopObjects
,
layout
,
menu
);
}
...
...
@@ -5063,7 +5063,7 @@ int WNav::search_root( char *search_str, pwr_tObjid *found_objid, int next)
pwr_tClassId
valid_class
[
100
];
int
i
;
pwr_tClassId
classid
;
pal_s
Menu
*
menu_p
;
PalFile
Menu
*
menu_p
;
search_sts
=
0
;
if
(
gbl
.
all_toplevel
||
strcmp
(
layout
,
""
)
==
0
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment