Commit 8ef3e74c authored by Claes Sjofors's avatar Claes Sjofors

Plc editor, opened object editors follows view/edit mode

parent c0e86849
...@@ -2288,6 +2288,20 @@ int WFoe::attr_delete() ...@@ -2288,6 +2288,20 @@ int WFoe::attr_delete()
return FOE__SUCCESS; return FOE__SUCCESS;
} }
//
// Delete all attribute editors and remove them from the
// attribute list.
//
void WFoe::attr_set_editmode( int mode)
{
int i;
for ( i = 0; i < attr_count; i++ ) {
if ( this == (attr_pointer + i)->foe)
((WAtt *)(attr_pointer + i)->a_ctx)->set_editmode( mode, 0);
}
}
// //
// Tell all the subwindows on the screen that I am quitting now // Tell all the subwindows on the screen that I am quitting now
// by setting the parentctx in foe zero. // by setting the parentctx in foe zero.
...@@ -3633,6 +3647,7 @@ int WFoe::change_mode( int new_mode) ...@@ -3633,6 +3647,7 @@ int WFoe::change_mode( int new_mode)
ldh_eAccess_ReadOnly); ldh_eAccess_ReadOnly);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
access = ldh_eAccess_ReadOnly; access = ldh_eAccess_ReadOnly;
attr_set_editmode(0);
} }
break; break;
case TRACE: case TRACE:
...@@ -3693,6 +3708,7 @@ int WFoe::change_mode( int new_mode) ...@@ -3693,6 +3708,7 @@ int WFoe::change_mode( int new_mode)
gre->disable_button_events(); gre->disable_button_events();
edit_setup(); edit_setup();
set_mode_button_state( VIEW, 0); set_mode_button_state( VIEW, 0);
attr_set_editmode(1);
break; break;
case EDIT: case EDIT:
/* Mode unchanged */ /* Mode unchanged */
...@@ -3961,6 +3977,7 @@ void WFoe::edit_exit_save( WFoe *foe) ...@@ -3961,6 +3977,7 @@ void WFoe::edit_exit_save( WFoe *foe)
foe->set_mode_button_state( EDIT, 0); foe->set_mode_button_state( EDIT, 0);
foe->set_mode_button_state( SIMULATE, 1); foe->set_mode_button_state( SIMULATE, 1);
foe->function = SIMULATE; foe->function = SIMULATE;
foe->attr_set_editmode(0);
break; break;
case TRACE: case TRACE:
foe->gre->disable_button_events(); foe->gre->disable_button_events();
...@@ -3973,6 +3990,7 @@ void WFoe::edit_exit_save( WFoe *foe) ...@@ -3973,6 +3990,7 @@ void WFoe::edit_exit_save( WFoe *foe)
foe->set_mode_button_state( EDIT, 0); foe->set_mode_button_state( EDIT, 0);
foe->set_mode_button_state( TRACE, 1); foe->set_mode_button_state( TRACE, 1);
foe->function = TRACE; foe->function = TRACE;
foe->attr_set_editmode(0);
break; break;
case VIEW: case VIEW:
foe->set_mode_button_state( EDIT, 0); foe->set_mode_button_state( EDIT, 0);
...@@ -3984,6 +4002,7 @@ void WFoe::edit_exit_save( WFoe *foe) ...@@ -3984,6 +4002,7 @@ void WFoe::edit_exit_save( WFoe *foe)
ldh_eAccess_ReadOnly); ldh_eAccess_ReadOnly);
foe->error_msg(sts); foe->error_msg(sts);
foe->access = ldh_eAccess_ReadOnly; foe->access = ldh_eAccess_ReadOnly;
foe->attr_set_editmode(0);
break; break;
} }
} }
......
...@@ -274,6 +274,7 @@ class WFoe : public WUtility { ...@@ -274,6 +274,7 @@ class WFoe : public WUtility {
void disable_ldh_cb(); void disable_ldh_cb();
int attr_create( vldh_t_node node); int attr_create( vldh_t_node node);
int attr_delete(); int attr_delete();
void attr_set_editmode( int mode);
int parent_quit(); int parent_quit();
int child_quit( vldh_t_node node, unsigned long windowindex); int child_quit( vldh_t_node node, unsigned long windowindex);
int child_delete( vldh_t_node node, vldh_t_wind subwind); int child_delete( vldh_t_node node, vldh_t_wind subwind);
......
...@@ -80,7 +80,8 @@ void WAtt::activate_print() ...@@ -80,7 +80,8 @@ void WAtt::activate_print()
void WAtt::set_editmode( int editmode, ldh_tSesContext ldhses) void WAtt::set_editmode( int editmode, ldh_tSesContext ldhses)
{ {
this->ldhses = ldhses; if ( ldhses != 0)
this->ldhses = ldhses;
this->editmode = editmode; this->editmode = editmode;
((WAttNav *)wattnav)->set_editmode( editmode, ldhses); ((WAttNav *)wattnav)->set_editmode( editmode, ldhses);
} }
......
...@@ -113,7 +113,7 @@ class WAttNav { ...@@ -113,7 +113,7 @@ class WAttNav {
void redraw(); void redraw();
void enable_events(); void enable_events();
void set_editmode( int editmode, ldh_tSesContext ldhses) void set_editmode( int editmode, ldh_tSesContext ldhses)
{ this->editmode = editmode; this->ldhses = ldhses;}; { this->editmode = editmode; if( ldhses != 0) this->ldhses = ldhses;};
int select_by_name( const char *name); int select_by_name( const char *name);
static int init_brow_cb( FlowCtx *fctx, void *client_data); static int init_brow_cb( FlowCtx *fctx, void *client_data);
......
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