Commit cb40f7dc authored by claes's avatar claes

Only one active write session allowed

parent 6f437b4a
...@@ -95,10 +95,19 @@ struct s_widgets ...@@ -95,10 +95,19 @@ struct s_widgets
Widget plcattribute; Widget plcattribute;
Widget winddelete; Widget winddelete;
Widget quit; Widget quit;
Widget cut;
Widget copy;
Widget paste;
Widget undelete;
Widget unselect;
Widget connect;
Widget del;
Widget changetext;
Widget expand;
Widget compress;
Widget edit_entry; /* entry of the menu */ Widget edit_entry; /* entry of the menu */
Widget search_entry; /* entry of the menu */ Widget search_entry; /* entry of the menu */
Widget customize_entry; /* entry of the menu */ Widget customize_entry; /* entry of the menu */
Widget function_entry; /* entry of the menu */
Widget trace_togg; /* togg under the function Widget trace_togg; /* togg under the function
entry of the menu */ entry of the menu */
Widget simulate_togg; /* togg under the function entry Widget simulate_togg; /* togg under the function entry
...@@ -126,6 +135,7 @@ struct s_foe_ctx ...@@ -126,6 +135,7 @@ struct s_foe_ctx
wb_eUtility ctx_type; wb_eUtility ctx_type;
t_commonpart cp; t_commonpart cp;
char name[80];
pal_tCtx node_palctx; pal_tCtx node_palctx;
pal_tCtx con_palctx; pal_tCtx con_palctx;
nav_tCtx navctx; nav_tCtx navctx;
......
...@@ -2336,9 +2336,9 @@ XmToggleButtonCallbackStruct *data; ...@@ -2336,9 +2336,9 @@ XmToggleButtonCallbackStruct *data;
} }
if ( data->set == 1 ) if ( data->set == 1 )
{
sts = foe_change_mode( foectx, SIMULATE); sts = foe_change_mode( foectx, SIMULATE);
} else
sts = foe_change_mode( foectx, TRACE);
} }
...@@ -2439,10 +2439,10 @@ XmToggleButtonCallbackStruct *data; ...@@ -2439,10 +2439,10 @@ XmToggleButtonCallbackStruct *data;
return; return;
} }
if ( data->set == 1 ) if ( data->set == 1 )
{
sts = foe_change_mode( foectx, EDIT); sts = foe_change_mode( foectx, EDIT);
} else
sts = foe_change_mode( foectx, VIEW);
} }
...@@ -2465,58 +2465,6 @@ XmToggleButtonCallbackStruct *data; ...@@ -2465,58 +2465,6 @@ XmToggleButtonCallbackStruct *data;
* *
**************************************************************************/ **************************************************************************/
static void foe_create_save
( Widget w , foe_ctx foectx, XmAnyCallbackStruct *data)
{ foectx->widgets.save= w ; }
static void foe_create_exit
( Widget w , foe_ctx foectx, XmAnyCallbackStruct *data)
{ foectx->widgets.exit= w ; }
static void foe_create_print
( Widget w , foe_ctx foectx, XmAnyCallbackStruct *data)
{ foectx->widgets.print= w ; }
static void foe_create_printselect
( Widget w , foe_ctx foectx, XmAnyCallbackStruct *data)
{ }
static void foe_create_printoverv
( Widget w , foe_ctx foectx, XmAnyCallbackStruct *data)
{ }
static void foe_create_syntax
( Widget w , foe_ctx foectx, XmAnyCallbackStruct *data)
{ foectx->widgets.syntax= w ; }
static void foe_create_compile
( Widget w , foe_ctx foectx, XmAnyCallbackStruct *data)
{ foectx->widgets.compile= w ; }
static void foe_create_redraw
( Widget w , foe_ctx foectx, XmAnyCallbackStruct *data)
{ foectx->widgets.redraw= w ; }
static void foe_create_plcattribute
( Widget w , foe_ctx foectx, XmAnyCallbackStruct *data)
{ foectx->widgets.plcattribute= w ; }
static void foe_create_winddelete
( Widget w , foe_ctx foectx, XmAnyCallbackStruct *data)
{ foectx->widgets.winddelete= w ; }
static void foe_create_savetrace
( Widget w , foe_ctx foectx, XmAnyCallbackStruct *data)
{ foectx->widgets.savetrace= w ; }
static void foe_create_restoretrace
( Widget w , foe_ctx foectx, XmAnyCallbackStruct *data)
{ foectx->widgets.restoretrace= w ; }
static void foe_create_quit
( Widget w , foe_ctx foectx, XmAnyCallbackStruct *data)
{ foectx->widgets.quit= w ; }
static void foe_create_label static void foe_create_label
( Widget w , foe_ctx foectx, XmAnyCallbackStruct *data) ( Widget w , foe_ctx foectx, XmAnyCallbackStruct *data)
{ foectx->widgets.label= w ; } { foectx->widgets.label= w ; }
...@@ -2525,85 +2473,101 @@ static void foe_create_textinput ...@@ -2525,85 +2473,101 @@ static void foe_create_textinput
( Widget w , foe_ctx foectx, XmAnyCallbackStruct *data) ( Widget w , foe_ctx foectx, XmAnyCallbackStruct *data)
{ foectx->widgets.textinput = w ; } { foectx->widgets.textinput = w ; }
static void foe_create_file_entry ( w , foectx, data) static void foe_create_widget_cb( Widget w, foe_ctx foectx, XmAnyCallbackStruct *data)
Widget w; {
foe_ctx foectx; int key;
XmAnyCallbackStruct *data;
{ XtVaGetValues (w, XmNuserData, &key, NULL);
/* save the identity of the created widget */
foectx->widgets.file_entry = w ; switch ( key) {
} case 1:
foectx->widgets.file_entry = w;
static void foe_create_edit_entry ( w , foectx, data) break;
Widget w; case 2:
foe_ctx foectx; foectx->widgets.save = w;
XmAnyCallbackStruct *data; break;
{ case 3:
/* save the identity of the created widget */ foectx->widgets.print = w;
foectx->widgets.edit_entry = w ; break;
} case 6:
foectx->widgets.syntax = w;
static void foe_create_search_entry ( w , foectx, data) break;
Widget w; case 7:
foe_ctx foectx; foectx->widgets.compile = w;
XmAnyCallbackStruct *data; break;
{ case 8:
/* save the identity of the created widget */ foectx->widgets.plcattribute = w;
foectx->widgets.search_entry = w ; break;
} case 9:
foectx->widgets.winddelete = w;
static void foe_create_customize_entry ( w , foectx, data) break;
Widget w; case 10:
foe_ctx foectx; foectx->widgets.savetrace = w;
XmAnyCallbackStruct *data; break;
{ case 11:
/* save the identity of the created widget */ foectx->widgets.restoretrace = w;
foectx->widgets.customize_entry = w ; break;
} case 12:
foectx->widgets.quit = w;
static void foe_create_function_entry ( w , foectx, data) break;
Widget w; case 13:
foe_ctx foectx; foectx->widgets.exit = w;
XmAnyCallbackStruct *data; break;
{ case 14:
/* save the identity of the created widget */ foectx->widgets.edit_entry = w;
foectx->widgets.function_entry = w ; break;
} case 15:
foectx->widgets.cut = w;
static void foe_create_trace_togg ( w , foectx, data) break;
Widget w; case 16:
foe_ctx foectx; foectx->widgets.copy = w;
XmAnyCallbackStruct *data; break;
{ case 17:
/* save the identity of the created widget */ foectx->widgets.paste = w;
foectx->widgets.trace_togg = w ; break;
} case 18:
foectx->widgets.undelete = w;
static void foe_create_simulate_togg ( w , foectx, data) break;
Widget w; case 19:
foe_ctx foectx; foectx->widgets.unselect = w;
XmAnyCallbackStruct *data; break;
{ case 20:
/* save the identity of the created widget */ foectx->widgets.connect = w;
foectx->widgets.simulate_togg = w ; break;
} case 21:
foectx->widgets.del = w;
static void foe_create_view_togg ( w , foectx, data) break;
Widget w; case 22:
foe_ctx foectx; foectx->widgets.changetext = w;
XmAnyCallbackStruct *data; break;
{ case 23:
/* save the identity of the created widget */ foectx->widgets.expand = w;
foectx->widgets.view_togg = w ; break;
} case 24:
foectx->widgets.compress = w;
static void foe_create_edit_togg ( w , foectx, data) break;
Widget w; case 25:
foe_ctx foectx; foectx->widgets.search_entry = w;
XmAnyCallbackStruct *data; break;
{ case 26:
/* save the identity of the created widget */ foectx->widgets.customize_entry = w;
foectx->widgets.edit_togg = w ; break;
case 28:
foectx->widgets.redraw = w;
break;
case 30:
foectx->widgets.view_togg = w;
break;
case 31:
foectx->widgets.edit_togg = w;
break;
case 32:
foectx->widgets.trace_togg = w;
break;
case 33:
foectx->widgets.simulate_togg = w;
break;
}
} }
static void foe_create_adb ( w , foectx, data) static void foe_create_adb ( w , foectx, data)
...@@ -2989,28 +2953,7 @@ int foe_register_callbacks ( ...@@ -2989,28 +2953,7 @@ int foe_register_callbacks (
{"foe_activate_view_togg",(XtPointer)foe_activate_view_togg}, {"foe_activate_view_togg",(XtPointer)foe_activate_view_togg},
{"foe_activate_edit_togg",(XtPointer)foe_activate_edit_togg}, {"foe_activate_edit_togg",(XtPointer)foe_activate_edit_togg},
{"foe_create_adb",(XtPointer)foe_create_adb}, /* SG 24.02.91 */ {"foe_create_adb",(XtPointer)foe_create_adb}, /* SG 24.02.91 */
{"foe_create_file_entry",(XtPointer)foe_create_file_entry}, {"foe_create_widget_cb",(XtPointer)foe_create_widget_cb},
{"foe_create_edit_entry",(XtPointer)foe_create_edit_entry},
{"foe_create_search_entry",(XtPointer)foe_create_search_entry},
{"foe_create_customize_entry",(XtPointer)foe_create_customize_entry},
{"foe_create_function_entry",(XtPointer)foe_create_function_entry},
{"foe_create_trace_togg",(XtPointer)foe_create_trace_togg},
{"foe_create_simulate_togg",(XtPointer)foe_create_simulate_togg},
{"foe_create_view_togg",(XtPointer)foe_create_view_togg},
{"foe_create_edit_togg",(XtPointer)foe_create_edit_togg},
{"foe_create_save",(XtPointer)foe_create_save},
{"foe_create_exit",(XtPointer)foe_create_exit},
{"foe_create_print",(XtPointer)foe_create_print},
{"foe_create_printselect",(XtPointer)foe_create_printselect},
{"foe_create_printoverv",(XtPointer)foe_create_printoverv},
{"foe_create_syntax",(XtPointer)foe_create_syntax},
{"foe_create_compile",(XtPointer)foe_create_compile},
{"foe_create_redraw",(XtPointer)foe_create_redraw},
{"foe_create_plcattribute",(XtPointer)foe_create_plcattribute},
{"foe_create_winddelete",(XtPointer)foe_create_winddelete},
{"foe_create_savetrace",(XtPointer)foe_create_savetrace},
{"foe_create_restoretrace",(XtPointer)foe_create_restoretrace},
{"foe_create_quit",(XtPointer)foe_create_quit},
{"foe_create_label",(XtPointer)foe_create_label}, {"foe_create_label",(XtPointer)foe_create_label},
{"foe_create_textinput",(XtPointer)foe_create_textinput}, {"foe_create_textinput",(XtPointer)foe_create_textinput},
{"foe_create_edit_form",(XtPointer)foe_create_edit_form}, {"foe_create_edit_form",(XtPointer)foe_create_edit_form},
......
...@@ -761,7 +761,7 @@ static int foe_child_delete ( ...@@ -761,7 +761,7 @@ static int foe_child_delete (
plc = subwind->hw.plcobject_pointer; plc = subwind->hw.plcobject_pointer;
sts = ldh_OpenSession(&ldhsession, sts = ldh_OpenSession(&ldhsession,
ldh_SessionToVol( plc->hp.ldhsesctx), ldh_SessionToVol( plc->hp.ldhsesctx),
ldh_eAccess_ReadWrite, ldh_eUtility_PlcEditor); ldh_eAccess_SharedReadWrite, ldh_eUtility_PlcEditor);
if( EVEN(sts)) return sts; if( EVEN(sts)) return sts;
sts = ldh_GetObjectBuffer( ldhsession, sts = ldh_GetObjectBuffer( ldhsession,
subwind->lw.parent_node_did, "DevBody", "PlcNode", subwind->lw.parent_node_did, "DevBody", "PlcNode",
...@@ -921,6 +921,29 @@ void foe_exit( ...@@ -921,6 +921,29 @@ void foe_exit(
/* Destroy the widget and controlled modules */ /* Destroy the widget and controlled modules */
foe_destroy( foectx); foe_destroy( foectx);
} }
void foe_set_title( foe_ctx foectx)
{
Arg args[2];
if ( foectx->function == EDIT) {
char new_title[80];
strcpy( new_title, "*** ");
strcat( new_title, foectx->name);
XtSetArg(args[0],XmNtitle, new_title);
XtSetValues( foectx->cp.parent_wid, args, 1);
}
else if ( foectx->function == VIEW) {
char new_title[80];
strcpy( new_title, foectx->name);
XtSetArg(args[0],XmNtitle, new_title);
XtSetValues( foectx->cp.parent_wid, args, 1);
}
}
/************************************************************************* /*************************************************************************
* *
...@@ -947,6 +970,10 @@ void foe_delete( ...@@ -947,6 +970,10 @@ void foe_delete(
/* Tell my parent that his child is deleted, if parent is a node */ /* Tell my parent that his child is deleted, if parent is a node */
wind = foectx->grectx->window_object; wind = foectx->grectx->window_object;
sts = ldh_SaveSession( wind->hw.ldhsession);
if ( EVEN(sts)) return;
if ( wind->hw.parent_node_pointer != 0 ) if ( wind->hw.parent_node_pointer != 0 )
{ {
sts = foe_child_delete ( foectx->cp.parent_ctx, sts = foe_child_delete ( foectx->cp.parent_ctx,
...@@ -1613,7 +1640,6 @@ int foe_new_local( ...@@ -1613,7 +1640,6 @@ int foe_new_local(
return LOGIN__USERNOTAU; return LOGIN__USERNOTAU;
} }
access = ldh_eAccess_ReadWrite; access = ldh_eAccess_ReadWrite;
sts = vldh_plc_create( plcprogram, ldhwbctx, ldhsesctx, sts = vldh_plc_create( plcprogram, ldhwbctx, ldhsesctx,
&plcobject); &plcobject);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
...@@ -1649,7 +1675,6 @@ int foe_new_local( ...@@ -1649,7 +1675,6 @@ int foe_new_local(
sts = foe_init_window( foectx); sts = foe_init_window( foectx);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
} }
} }
} }
...@@ -1681,6 +1706,8 @@ int foe_new_local( ...@@ -1681,6 +1706,8 @@ int foe_new_local(
/* A subwindow can not be created */ /* A subwindow can not be created */
return FOE__WINDNOTFOUND; return FOE__WINDNOTFOUND;
access = ldh_eAccess_SharedReadWrite;
/* Create the foe module */ /* Create the foe module */
old_foectx = parent_ctx ; old_foectx = parent_ctx ;
function = old_foectx->function; function = old_foectx->function;
...@@ -1691,6 +1718,9 @@ int foe_new_local( ...@@ -1691,6 +1718,9 @@ int foe_new_local(
if ( function == SIMULATE) if ( function == SIMULATE)
function = TRACE; function = TRACE;
} }
else
function = VIEW;
/* Create window object in vldh */ /* Create window object in vldh */
sts = vldh_wind_create( sts = vldh_wind_create(
(nodeobject->hn.window_pointer)->hw.plcobject_pointer, (nodeobject->hn.window_pointer)->hw.plcobject_pointer,
...@@ -1720,6 +1750,9 @@ int foe_new_local( ...@@ -1720,6 +1750,9 @@ int foe_new_local(
sts = foe_init_window( foectx); sts = foe_init_window( foectx);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
sts = ldh_SetSession( windowobject->hw.ldhsession, ldh_eAccess_ReadOnly);
if ( EVEN(sts)) return sts;
} }
else else
{ {
...@@ -1729,6 +1762,8 @@ int foe_new_local( ...@@ -1729,6 +1762,8 @@ int foe_new_local(
/* No, create new foe window and load the window */ /* No, create new foe window and load the window */
old_foectx = parent_ctx ; old_foectx = parent_ctx ;
access = ldh_eAccess_ReadOnly;
sts = vldh_get_wind_objdid( sts = vldh_get_wind_objdid(
nodeobject->ln.subwind_objdid[windowindex], &windowobject); nodeobject->ln.subwind_objdid[windowindex], &windowobject);
if ( sts == VLDH__OBJNOTFOUND ) if ( sts == VLDH__OBJNOTFOUND )
...@@ -1753,6 +1788,9 @@ int foe_new_local( ...@@ -1753,6 +1788,9 @@ int foe_new_local(
if ( function == SIMULATE) if ( function == SIMULATE)
function = TRACE; function = TRACE;
} }
else
function = VIEW;
foectx = foe_create_window(parent_ctx, parent_wid, foectx = foe_create_window(parent_ctx, parent_wid,
subwind_name, subwind_name,
windgraphbody->x, windgraphbody->y, windgraphbody->x, windgraphbody->y,
...@@ -1990,7 +2028,7 @@ static foe_ctx foe_create_window( ...@@ -1990,7 +2028,7 @@ static foe_ctx foe_create_window(
foectx->ctx_type = wb_eUtility_PlcEditor; foectx->ctx_type = wb_eUtility_PlcEditor;
foectx->function = function ; foectx->function = function ;
foectx->cp.parent_ctx = parent_ctx; foectx->cp.parent_ctx = parent_ctx;
foectx->cp.name = XtNewString( name ); strncpy( foectx->name, name, sizeof(foectx->name));
foectx->popupmenu_mask = ~0; foectx->popupmenu_mask = ~0;
foectx->advanced_user = 1; foectx->advanced_user = 1;
...@@ -2728,9 +2766,10 @@ static int foe_edit_set_entries ( ...@@ -2728,9 +2766,10 @@ static int foe_edit_set_entries (
foe_ctx foectx foe_ctx foectx
) )
{ {
Arg sensitive[1]; Arg sensitive[1];
Arg insensitive[1]; Arg insensitive[1];
foe_set_title( foectx);
XtSetArg(sensitive[0],XmNsensitive, 1); XtSetArg(sensitive[0],XmNsensitive, 1);
XtSetArg(insensitive[0],XmNsensitive, 0); XtSetArg(insensitive[0],XmNsensitive, 0);
...@@ -2746,6 +2785,16 @@ static int foe_edit_set_entries ( ...@@ -2746,6 +2785,16 @@ static int foe_edit_set_entries (
XtSetValues( foectx->widgets.plcattribute,sensitive,1); XtSetValues( foectx->widgets.plcattribute,sensitive,1);
XtSetValues( foectx->widgets.winddelete,sensitive,1); XtSetValues( foectx->widgets.winddelete,sensitive,1);
XtSetValues( foectx->widgets.edit_entry,sensitive,1); XtSetValues( foectx->widgets.edit_entry,sensitive,1);
XtSetValues( foectx->widgets.cut,sensitive,1);
XtSetValues( foectx->widgets.copy,sensitive,1);
XtSetValues( foectx->widgets.paste,sensitive,1);
XtSetValues( foectx->widgets.undelete,sensitive,1);
XtSetValues( foectx->widgets.unselect,sensitive,1);
XtSetValues( foectx->widgets.connect,sensitive,1);
XtSetValues( foectx->widgets.del,sensitive,1);
XtSetValues( foectx->widgets.changetext,sensitive,1);
XtSetValues( foectx->widgets.expand,sensitive,1);
XtSetValues( foectx->widgets.compress,sensitive,1);
} }
else { else {
XtSetValues( foectx->widgets.save,sensitive,1); XtSetValues( foectx->widgets.save,sensitive,1);
...@@ -2758,6 +2807,16 @@ static int foe_edit_set_entries ( ...@@ -2758,6 +2807,16 @@ static int foe_edit_set_entries (
XtSetValues( foectx->widgets.plcattribute,sensitive,1); XtSetValues( foectx->widgets.plcattribute,sensitive,1);
XtSetValues( foectx->widgets.winddelete,sensitive,1); XtSetValues( foectx->widgets.winddelete,sensitive,1);
XtSetValues( foectx->widgets.edit_entry,sensitive,1); XtSetValues( foectx->widgets.edit_entry,sensitive,1);
XtSetValues( foectx->widgets.cut,sensitive,1);
XtSetValues( foectx->widgets.copy,sensitive,1);
XtSetValues( foectx->widgets.paste,sensitive,1);
XtSetValues( foectx->widgets.undelete,sensitive,1);
XtSetValues( foectx->widgets.unselect,sensitive,1);
XtSetValues( foectx->widgets.connect,sensitive,1);
XtSetValues( foectx->widgets.del,sensitive,1);
XtSetValues( foectx->widgets.changetext,sensitive,1);
XtSetValues( foectx->widgets.expand,sensitive,1);
XtSetValues( foectx->widgets.compress,sensitive,1);
} }
return FOE__SUCCESS ; return FOE__SUCCESS ;
...@@ -2784,27 +2843,31 @@ static int foe_edit_set_entries ( ...@@ -2784,27 +2843,31 @@ static int foe_edit_set_entries (
static int foe_view_set_entries ( static int foe_view_set_entries (
foe_ctx foectx foe_ctx foectx
) )
{ {
Arg args[20]; Arg args[20];
int i;
i=0;
XtSetArg(args[i],XmNsensitive,0 ); i++;
XtSetValues( foectx->widgets.save,args,i); foe_set_title( foectx);
XtSetValues( foectx->widgets.exit,args,i);
XtSetValues( foectx->widgets.syntax,args,i); XtSetArg(args[0],XmNsensitive,0 );
XtSetValues( foectx->widgets.compile,args,i);
XtSetValues( foectx->widgets.redraw,args,i); XtSetValues( foectx->widgets.save,args,1);
XtSetValues( foectx->widgets.plcattribute,args,i); XtSetValues( foectx->widgets.exit,args,1);
XtSetValues( foectx->widgets.winddelete,args,i); XtSetValues( foectx->widgets.syntax,args,1);
XtSetValues( foectx->widgets.edit_entry,args,i); XtSetValues( foectx->widgets.compile,args,1);
XtSetValues( foectx->widgets.redraw,args,1);
XtSetValues( foectx->widgets.plcattribute,args,1);
XtSetValues( foectx->widgets.winddelete,args,1);
XtSetValues( foectx->widgets.cut,args,1);
XtSetValues( foectx->widgets.paste,args,1);
XtSetValues( foectx->widgets.undelete,args,1);
XtSetValues( foectx->widgets.unselect,args,1);
XtSetValues( foectx->widgets.connect,args,1);
XtSetValues( foectx->widgets.del,args,1);
XtSetValues( foectx->widgets.changetext,args,1);
XtSetValues( foectx->widgets.expand,args,1);
XtSetValues( foectx->widgets.compress,args,1);
return FOE__SUCCESS ; return FOE__SUCCESS ;
/* XtSetValues( foectx->widgets.print,args,i); */
} }
......
...@@ -2191,7 +2191,7 @@ int gcg_wind_comp_all( ...@@ -2191,7 +2191,7 @@ int gcg_wind_comp_all(
if ( i == ( parent_count - 2)) { if ( i == ( parent_count - 2)) {
/* This is the child to the plc */ /* This is the child to the plc */
sts = vldh_wind_load( plc, 0, *(parentlist + i), 0, 0, &wind, sts = vldh_wind_load( plc, 0, *(parentlist + i), 0, 0, &wind,
ldh_eAccess_ReadWrite); ldh_eAccess_SharedReadWrite);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
plc->hp.windowobject = wind; plc->hp.windowobject = wind;
} }
...@@ -2202,7 +2202,7 @@ int gcg_wind_comp_all( ...@@ -2202,7 +2202,7 @@ int gcg_wind_comp_all(
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
sts = vldh_wind_load( plc, node, *(parentlist + i), 0, 0, sts = vldh_wind_load( plc, node, *(parentlist + i), 0, 0,
&wind, ldh_eAccess_ReadWrite); &wind, ldh_eAccess_SharedReadWrite);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
} }
sts = vldh_wind_load_all( wind); sts = vldh_wind_load_all( wind);
...@@ -2230,7 +2230,7 @@ int gcg_wind_comp_all( ...@@ -2230,7 +2230,7 @@ int gcg_wind_comp_all(
{ {
/* This is the child to the plc */ /* This is the child to the plc */
sts = vldh_wind_load( plc, 0, *windlist_ptr, 0, 0, &wind, sts = vldh_wind_load( plc, 0, *windlist_ptr, 0, 0, &wind,
ldh_eAccess_ReadWrite); ldh_eAccess_SharedReadWrite);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
plc->hp.windowobject = wind; plc->hp.windowobject = wind;
} }
...@@ -2242,7 +2242,7 @@ int gcg_wind_comp_all( ...@@ -2242,7 +2242,7 @@ int gcg_wind_comp_all(
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
sts = vldh_wind_load( plc, node, *windlist_ptr, 0, 0, &wind, sts = vldh_wind_load( plc, node, *windlist_ptr, 0, 0, &wind,
ldh_eAccess_ReadWrite); ldh_eAccess_SharedReadWrite);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
} }
sts = vldh_wind_load_all( wind); sts = vldh_wind_load_all( wind);
......
...@@ -74,6 +74,7 @@ typedef enum { ...@@ -74,6 +74,7 @@ typedef enum {
ldh_eAccess__ = 0, ldh_eAccess__ = 0,
ldh_eAccess_ReadOnly, ldh_eAccess_ReadOnly,
ldh_eAccess_ReadWrite, ldh_eAccess_ReadWrite,
ldh_eAccess_SharedReadWrite,
ldh_eAccess_ ldh_eAccess_
} ldh_eAccess; } ldh_eAccess;
......
...@@ -58,12 +58,34 @@ ldh_eAccess wb_srep::access(pwr_tStatus *sts) const ...@@ -58,12 +58,34 @@ ldh_eAccess wb_srep::access(pwr_tStatus *sts) const
bool wb_srep::access(pwr_tStatus *sts, ldh_eAccess access) // Fix bool wb_srep::access(pwr_tStatus *sts, ldh_eAccess access) // Fix
{ {
pwr_tStatus lsts;
if ( ldh_eAccess__ < access && access < ldh_eAccess_) { if ( ldh_eAccess__ < access && access < ldh_eAccess_) {
if ( !m_vrep->accessSupported( access)) { if ( !m_vrep->accessSupported( access)) {
*sts = LDH__ACCESS; *sts = LDH__ACCESS;
return false; return false;
} }
if ( access == ldh_eAccess_ReadWrite) {
// Check that no other session is ReadWrite
for ( wb_srep *srep = m_vrep->srep(&lsts); srep; srep = m_vrep->nextSrep( &lsts, srep)) {
if ( srep != this && srep->access(&lsts) == ldh_eAccess_ReadWrite) {
*sts = LDH__OTHERSESS;
return false;
}
}
}
else if ( access == ldh_eAccess_SharedReadWrite) {
// Check that any ReadWrite session is empty
for ( wb_srep *srep = m_vrep->srep(&lsts); srep; srep = m_vrep->nextSrep( &lsts, srep)) {
if ( srep != this && srep->access(&lsts) == ldh_eAccess_ReadWrite) {
if ( !srep->isEmpty( &lsts)) {
*sts = LDH__SESSNOTEMPTY;
return false;
}
}
}
}
m_access = access; m_access = access;
*sts = LDH__SUCCESS; *sts = LDH__SUCCESS;
return true; return true;
......
...@@ -1304,26 +1304,23 @@ int vldh_wind_save ( ...@@ -1304,26 +1304,23 @@ int vldh_wind_save (
/* Save the plc in its own session */ /* Save the plc in its own session */
/* Plc session may well be readonly, set readwrite */ /* Plc session may well be readonly, set readwrite */
sts = ldh_SetSession( plc->hp.ldhsesctx, // sts = ldh_SetSession( plc->hp.ldhsesctx,
ldh_eAccess_ReadWrite); // ldh_eAccess_ReadWrite);
if ( EVEN(sts)) return sts; // if ( EVEN(sts)) return sts;
sts = ldh_SetObjectBuffer( sts = ldh_SetObjectBuffer( wind->hw.ldhsession,
plc->hp.ldhsesctx, plc->lp.objdid, "DevBody", "PlcProgram",
plc->lp.objdid, (char *)&(plc->lp));
"DevBody",
"PlcProgram",
(char *)&(plc->lp));
if( sts == LDH__NOSUCHOBJ ) return VLDH__PLCNOTSAVED; if( sts == LDH__NOSUCHOBJ ) return VLDH__PLCNOTSAVED;
if( EVEN(sts)) return sts; if( EVEN(sts)) return sts;
/* Save the plc session */ /* Save the plc session */
sts = ldh_SaveSession( plc->hp.ldhsesctx); // sts = ldh_SaveSession( plc->hp.ldhsesctx);
if( EVEN(sts)) return sts; // if( EVEN(sts)) return sts;
sts = ldh_SetSession( plc->hp.ldhsesctx, // sts = ldh_SetSession( plc->hp.ldhsesctx,
ldh_eAccess_ReadOnly); // ldh_eAccess_ReadOnly);
if ( EVEN(sts)) return sts; // if ( EVEN(sts)) return sts;
/* If window is created, save the subwindowmark in the parent node */ /* If window is created, save the subwindowmark in the parent node */
if ( wind->hw.parent_node_pointer != 0) if ( wind->hw.parent_node_pointer != 0)
......
...@@ -648,6 +648,8 @@ ldh_sRefInfo *wb_volume::refinfo( wb_object o, ldh_sRefInfo *rp) ...@@ -648,6 +648,8 @@ ldh_sRefInfo *wb_volume::refinfo( wb_object o, ldh_sRefInfo *rp)
wb_cdef cd = cdef( o); wb_cdef cd = cdef( o);
wb_bdef bd = cd.bdef( pwr_eBix_rt); wb_bdef bd = cd.bdef( pwr_eBix_rt);
if (!bd) return rp;
wb_attribute body = wb_attribute( bd.sts(), (wb_orep *)o, bd.name()); wb_attribute body = wb_attribute( bd.sts(), (wb_orep *)o, bd.name());
char *bp = (char *)body.value(0); char *bp = (char *)body.value(0);
pwr_tOid oid; pwr_tOid oid;
......
...@@ -817,11 +817,21 @@ wb_orep *wb_vrepmem::copyObject(pwr_tStatus *sts, const wb_orep *orep, wb_destin ...@@ -817,11 +817,21 @@ wb_orep *wb_vrepmem::copyObject(pwr_tStatus *sts, const wb_orep *orep, wb_destin
} }
} }
pwr_tOix oix = nextOix(); pwr_tOix oix;
if ( name.evenSts()) if ( !m_classeditor) {
strcpy( name_str, orep->name()); oix = nextOix();
else if ( name.evenSts())
strcpy( name_str, name.object()); strcpy( name_str, orep->name());
else
strcpy( name_str, name.object());
}
else {
if ( !classeditorCheck( code, dest, orep->cid(), &oix, name_str, sts, false))
return 0;
if ( name.oddSts())
strcpy( name_str, name.object());
}
mem_object *memo = new mem_object(); mem_object *memo = new mem_object();
strcpy( memo->m_name, name_str); strcpy( memo->m_name, name_str);
......
...@@ -909,6 +909,8 @@ static int wccm_attribute_func ( ...@@ -909,6 +909,8 @@ static int wccm_attribute_func (
break; break;
} }
case pwr_eType_UInt32: case pwr_eType_UInt32:
case pwr_eType_Enum:
case pwr_eType_Mask:
case pwr_eType_ClassId: case pwr_eType_ClassId:
case pwr_eType_TypeId: case pwr_eType_TypeId:
case pwr_eType_VolumeId: case pwr_eType_VolumeId:
......
...@@ -633,7 +633,7 @@ int WItemMenu::open_children( WNav *wnav, double x, double y) ...@@ -633,7 +633,7 @@ int WItemMenu::open_children( WNav *wnav, double x, double y)
case wnav_eItemType_Command: case wnav_eItemType_Command:
item = (WItem *) new WItemCommand( wnav, menu->title, node, item = (WItem *) new WItemCommand( wnav, menu->title, node,
flow_eDest_IntoLast, menu->command, 0, flow_eDest_IntoLast, menu->command, 0,
wnav->brow->pixmap_map); wnav->brow->pixmap_graph);
break; break;
default: default:
; ;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment