Commit 5612936f authored by Claes Sjofors's avatar Claes Sjofors

Plc editor: toolbar buttons to create texts and documents and to redraw

parent c2a31fe7
...@@ -523,6 +523,41 @@ void WFoeGtk::activate_confeedback( GtkWidget *w, gpointer data) ...@@ -523,6 +523,41 @@ void WFoeGtk::activate_confeedback( GtkWidget *w, gpointer data)
((WFoe *)foe)->activate_confeedback( set); ((WFoe *)foe)->activate_confeedback( set);
} }
void WFoeGtk::activate_singlelinetext( GtkWidget *w, gpointer data)
{
WFoe *foe = (WFoe *)data;
foe->activate_createobject_cid( pwr_cClass_Text, 0);
}
void WFoeGtk::activate_bodytext( GtkWidget *w, gpointer data)
{
WFoe *foe = (WFoe *)data;
foe->activate_createobject_cid( pwr_cClass_BodyText, 0);
}
void WFoeGtk::activate_textheader( GtkWidget *w, gpointer data)
{
WFoe *foe = (WFoe *)data;
foe->activate_createobject_cid( pwr_cClass_Head, 0);
}
void WFoeGtk::activate_document( GtkWidget *w, gpointer data)
{
WFoe *foe = (WFoe *)data;
foe->activate_createobject_cid( pwr_cClass_Document, 0);
}
void WFoeGtk::activate_document_landscape( GtkWidget *w, gpointer data)
{
WFoe *foe = (WFoe *)data;
foe->activate_createobject_cid( pwr_cClass_Document, 1);
}
// //
// Callback from the menu. // Callback from the menu.
// Display or hide the connection palette. // Display or hide the connection palette.
...@@ -1666,7 +1701,10 @@ pwr_tStatus WFoeGtk::create_window( int x_top, ...@@ -1666,7 +1701,10 @@ pwr_tStatus WFoeGtk::create_window( int x_top,
g_signal_connect( view_showexeord, "activate", g_signal_connect( view_showexeord, "activate",
G_CALLBACK(WFoeGtk::activate_showexeord), this); G_CALLBACK(WFoeGtk::activate_showexeord), this);
widgets.redraw = gtk_menu_item_new_with_mnemonic( "R_edraw"); widgets.redraw = gtk_image_menu_item_new_with_mnemonic( "R_edraw");
dcli_translate_filename( fname, "$pwr_exe/foe_redraw.png");
gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM(widgets.redraw),
gtk_image_new_from_file( fname));
g_signal_connect( widgets.redraw, "activate", g_signal_connect( widgets.redraw, "activate",
G_CALLBACK(WFoeGtk::activate_redraw), this); G_CALLBACK(WFoeGtk::activate_redraw), this);
...@@ -1762,6 +1800,13 @@ pwr_tStatus WFoeGtk::create_window( int x_top, ...@@ -1762,6 +1800,13 @@ pwr_tStatus WFoeGtk::create_window( int x_top,
g_object_set( widgets.tools_save, "can-focus", FALSE, NULL); g_object_set( widgets.tools_save, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, widgets.tools_save, "Save", ""); gtk_toolbar_append_widget( tools, widgets.tools_save, "Save", "");
GtkWidget *tools_print = gtk_button_new();
gtk_container_add( GTK_CONTAINER( tools_print),
gtk_image_new_from_stock( "gtk-print", GTK_ICON_SIZE_SMALL_TOOLBAR));
g_signal_connect(tools_print, "clicked", G_CALLBACK(WFoeGtk::activate_print), this);
g_object_set( tools_print, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, tools_print, "Print documents", "");
GtkWidget *tools_edit = gtk_button_new(); GtkWidget *tools_edit = gtk_button_new();
dcli_translate_filename( fname, "$pwr_exe/foe_edit.png"); dcli_translate_filename( fname, "$pwr_exe/foe_edit.png");
gtk_container_add( GTK_CONTAINER( tools_edit), gtk_container_add( GTK_CONTAINER( tools_edit),
...@@ -1833,14 +1878,68 @@ pwr_tStatus WFoeGtk::create_window( int x_top, ...@@ -1833,14 +1878,68 @@ pwr_tStatus WFoeGtk::create_window( int x_top,
g_object_set( tools_plantpalette, "can-focus", FALSE, NULL); g_object_set( tools_plantpalette, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, tools_plantpalette, "Show Plant Hierarchy", ""); gtk_toolbar_append_widget( tools, tools_plantpalette, "Show Plant Hierarchy", "");
// Redraw pushbutton
widgets.tools_redraw = gtk_button_new();
dcli_translate_filename( fname, "$pwr_exe/foe_redraw.png");
gtk_container_add( GTK_CONTAINER( widgets.tools_redraw),
gtk_image_new_from_file( fname));
g_signal_connect(widgets.tools_redraw, "clicked", G_CALLBACK(WFoeGtk::activate_redraw), this);
g_object_set( widgets.tools_redraw, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, widgets.tools_redraw, "Redraw", "");
// Feedback connection checkbutton // Feedback connection checkbutton
GtkWidget *tools_confeedback = gtk_toggle_button_new(); widgets.tools_confeedback = gtk_toggle_button_new();
dcli_translate_filename( fname, "$pwr_exe/foe_confeedback.png"); dcli_translate_filename( fname, "$pwr_exe/foe_confeedback.png");
gtk_container_add( GTK_CONTAINER(tools_confeedback), gtk_container_add( GTK_CONTAINER(widgets.tools_confeedback),
gtk_image_new_from_file( fname));
g_signal_connect(widgets.tools_confeedback, "clicked", G_CALLBACK(activate_confeedback), this);
g_object_set( widgets.tools_confeedback, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, widgets.tools_confeedback, "Feedback connection", "");
// Singlelinetext button
widgets.tools_singlelinetext = gtk_button_new();
dcli_translate_filename( fname, "$pwr_exe/foe_singlelinetext.png");
gtk_container_add( GTK_CONTAINER( widgets.tools_singlelinetext),
gtk_image_new_from_file( fname));
g_signal_connect(widgets.tools_singlelinetext, "clicked", G_CALLBACK(WFoeGtk::activate_singlelinetext), this);
g_object_set( widgets.tools_singlelinetext, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, widgets.tools_singlelinetext, "Single line text", "");
// Bodytext button
widgets.tools_bodytext = gtk_button_new();
dcli_translate_filename( fname, "$pwr_exe/foe_bodytext.png");
gtk_container_add( GTK_CONTAINER( widgets.tools_bodytext),
gtk_image_new_from_file( fname));
g_signal_connect(widgets.tools_bodytext, "clicked", G_CALLBACK(WFoeGtk::activate_bodytext), this);
g_object_set( widgets.tools_bodytext, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, widgets.tools_bodytext, "Multi line text", "");
// Textheader button
widgets.tools_textheader = gtk_button_new();
dcli_translate_filename( fname, "$pwr_exe/foe_textheader.png");
gtk_container_add( GTK_CONTAINER( widgets.tools_textheader),
gtk_image_new_from_file( fname));
g_signal_connect(widgets.tools_textheader, "clicked", G_CALLBACK(WFoeGtk::activate_textheader), this);
g_object_set( widgets.tools_textheader, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, widgets.tools_textheader, "Text header", "");
// Document button
widgets.tools_document = gtk_button_new();
dcli_translate_filename( fname, "$pwr_exe/foe_document.png");
gtk_container_add( GTK_CONTAINER( widgets.tools_document),
gtk_image_new_from_file( fname));
g_signal_connect(widgets.tools_document, "clicked", G_CALLBACK(WFoeGtk::activate_document), this);
g_object_set( widgets.tools_document, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, widgets.tools_document, "Document portrait", "");
// Document_Landscape button
widgets.tools_document_landscape = gtk_button_new();
dcli_translate_filename( fname, "$pwr_exe/foe_document_landscape.png");
gtk_container_add( GTK_CONTAINER( widgets.tools_document_landscape),
gtk_image_new_from_file( fname)); gtk_image_new_from_file( fname));
g_signal_connect(tools_confeedback, "clicked", G_CALLBACK(activate_confeedback), this); g_signal_connect(widgets.tools_document_landscape, "clicked", G_CALLBACK(WFoeGtk::activate_document_landscape), this);
g_object_set( tools_confeedback, "can-focus", FALSE, NULL); g_object_set( widgets.tools_document_landscape, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, tools_confeedback, "Feedback connection", ""); gtk_toolbar_append_widget( tools, widgets.tools_document_landscape, "Document landscape", "");
// Statusbar and cmd input // Statusbar and cmd input
GtkWidget *statusbar = gtk_hbox_new( FALSE, 0); GtkWidget *statusbar = gtk_hbox_new( FALSE, 0);
...@@ -2208,6 +2307,13 @@ int WFoeGtk::edit_set_entries() ...@@ -2208,6 +2307,13 @@ int WFoeGtk::edit_set_entries()
gtk_widget_set_sensitive( widgets.compress,TRUE); gtk_widget_set_sensitive( widgets.compress,TRUE);
gtk_widget_set_sensitive( widgets.tools_save,TRUE); gtk_widget_set_sensitive( widgets.tools_save,TRUE);
gtk_widget_set_sensitive( widgets.tools_build,TRUE); gtk_widget_set_sensitive( widgets.tools_build,TRUE);
gtk_widget_set_sensitive( widgets.tools_redraw,TRUE);
gtk_widget_set_sensitive( widgets.tools_confeedback,TRUE);
gtk_widget_set_sensitive( widgets.tools_singlelinetext,TRUE);
gtk_widget_set_sensitive( widgets.tools_bodytext,TRUE);
gtk_widget_set_sensitive( widgets.tools_textheader,TRUE);
gtk_widget_set_sensitive( widgets.tools_document,TRUE);
gtk_widget_set_sensitive( widgets.tools_document_landscape,TRUE);
gtk_widget_set_sensitive( widgets.select_addnextright,TRUE); gtk_widget_set_sensitive( widgets.select_addnextright,TRUE);
gtk_widget_set_sensitive( widgets.select_addnextleft,TRUE); gtk_widget_set_sensitive( widgets.select_addnextleft,TRUE);
gtk_widget_set_sensitive( widgets.select_addnextup,TRUE); gtk_widget_set_sensitive( widgets.select_addnextup,TRUE);
...@@ -2247,6 +2353,13 @@ int WFoeGtk::edit_set_entries() ...@@ -2247,6 +2353,13 @@ int WFoeGtk::edit_set_entries()
gtk_widget_set_sensitive( widgets.compress,TRUE); gtk_widget_set_sensitive( widgets.compress,TRUE);
gtk_widget_set_sensitive( widgets.tools_save,TRUE); gtk_widget_set_sensitive( widgets.tools_save,TRUE);
gtk_widget_set_sensitive( widgets.tools_build,FALSE); gtk_widget_set_sensitive( widgets.tools_build,FALSE);
gtk_widget_set_sensitive( widgets.tools_redraw,TRUE);
gtk_widget_set_sensitive( widgets.tools_confeedback,TRUE);
gtk_widget_set_sensitive( widgets.tools_singlelinetext,TRUE);
gtk_widget_set_sensitive( widgets.tools_bodytext,TRUE);
gtk_widget_set_sensitive( widgets.tools_textheader,TRUE);
gtk_widget_set_sensitive( widgets.tools_document,TRUE);
gtk_widget_set_sensitive( widgets.tools_document_landscape,TRUE);
gtk_widget_set_sensitive( widgets.select_addnextright,TRUE); gtk_widget_set_sensitive( widgets.select_addnextright,TRUE);
gtk_widget_set_sensitive( widgets.select_addnextleft,TRUE); gtk_widget_set_sensitive( widgets.select_addnextleft,TRUE);
gtk_widget_set_sensitive( widgets.select_addnextup,TRUE); gtk_widget_set_sensitive( widgets.select_addnextup,TRUE);
...@@ -2291,6 +2404,13 @@ int WFoeGtk::view_set_entries() ...@@ -2291,6 +2404,13 @@ int WFoeGtk::view_set_entries()
gtk_widget_set_sensitive( widgets.expand,FALSE); gtk_widget_set_sensitive( widgets.expand,FALSE);
gtk_widget_set_sensitive( widgets.compress,FALSE); gtk_widget_set_sensitive( widgets.compress,FALSE);
gtk_widget_set_sensitive( widgets.tools_save,FALSE); gtk_widget_set_sensitive( widgets.tools_save,FALSE);
gtk_widget_set_sensitive( widgets.tools_redraw,FALSE);
gtk_widget_set_sensitive( widgets.tools_confeedback,FALSE);
gtk_widget_set_sensitive( widgets.tools_singlelinetext,FALSE);
gtk_widget_set_sensitive( widgets.tools_bodytext,FALSE);
gtk_widget_set_sensitive( widgets.tools_textheader,FALSE);
gtk_widget_set_sensitive( widgets.tools_document,FALSE);
gtk_widget_set_sensitive( widgets.tools_document_landscape,FALSE);
gtk_widget_set_sensitive( widgets.tools_build,FALSE); gtk_widget_set_sensitive( widgets.tools_build,FALSE);
gtk_widget_set_sensitive( widgets.select_addnextright,FALSE); gtk_widget_set_sensitive( widgets.select_addnextright,FALSE);
gtk_widget_set_sensitive( widgets.select_addnextleft,FALSE); gtk_widget_set_sensitive( widgets.select_addnextleft,FALSE);
......
...@@ -81,6 +81,13 @@ struct s_widgets { ...@@ -81,6 +81,13 @@ struct s_widgets {
GtkWidget *view_plantpal; GtkWidget *view_plantpal;
GtkWidget *tools_save; GtkWidget *tools_save;
GtkWidget *tools_build; GtkWidget *tools_build;
GtkWidget *tools_redraw;
GtkWidget *tools_singlelinetext;
GtkWidget *tools_bodytext;
GtkWidget *tools_textheader;
GtkWidget *tools_document;
GtkWidget *tools_document_landscape;
GtkWidget *tools_confeedback;
GtkWidget *lockconpoint; GtkWidget *lockconpoint;
GtkWidget *move_right; GtkWidget *move_right;
GtkWidget *move_left; GtkWidget *move_left;
...@@ -240,6 +247,11 @@ class WFoeGtk : public WFoe { ...@@ -240,6 +247,11 @@ class WFoeGtk : public WFoe {
static void activate_palette_object( GtkWidget *w, gpointer data); static void activate_palette_object( GtkWidget *w, gpointer data);
static void activate_palette_plant( GtkWidget *w, gpointer data); static void activate_palette_plant( GtkWidget *w, gpointer data);
static void activate_confeedback( GtkWidget *w, gpointer data); static void activate_confeedback( GtkWidget *w, gpointer data);
static void activate_singlelinetext( GtkWidget *w, gpointer data);
static void activate_bodytext( GtkWidget *w, gpointer data);
static void activate_textheader( GtkWidget *w, gpointer data);
static void activate_document( GtkWidget *w, gpointer data);
static void activate_document_landscape( GtkWidget *w, gpointer data);
static void activate_refcon( GtkWidget *w, gpointer data); static void activate_refcon( GtkWidget *w, gpointer data);
static void activate_showexeord( GtkWidget *w, gpointer data); static void activate_showexeord( GtkWidget *w, gpointer data);
static void activate_plcattribute( GtkWidget *w, gpointer data); static void activate_plcattribute( GtkWidget *w, gpointer data);
......
...@@ -303,6 +303,12 @@ void WAttGtk::change_value_close() ...@@ -303,6 +303,12 @@ void WAttGtk::change_value_close()
wattnav->set_inputfocus(); wattnav->set_inputfocus();
} }
if ( pending_close) {
if ( close_cb)
(close_cb)( this);
else
delete this;
}
} }
} }
...@@ -330,6 +336,13 @@ void WAttGtk::activate_cmd_input( GtkWidget *w, gpointer data) ...@@ -330,6 +336,13 @@ void WAttGtk::activate_cmd_input( GtkWidget *w, gpointer data)
(watt->redraw_cb)( watt); (watt->redraw_cb)( watt);
} }
g_free( text); g_free( text);
if ( watt->pending_close) {
if ( watt->close_cb)
(watt->close_cb)( watt);
else
delete watt;
}
} }
void WAttGtk::activate_cmd_scrolled_ok( GtkWidget *w, gpointer data) void WAttGtk::activate_cmd_scrolled_ok( GtkWidget *w, gpointer data)
...@@ -368,6 +381,13 @@ void WAttGtk::activate_cmd_scrolled_ok( GtkWidget *w, gpointer data) ...@@ -368,6 +381,13 @@ void WAttGtk::activate_cmd_scrolled_ok( GtkWidget *w, gpointer data)
((WAttNav *)watt->wattnav)->redraw(); ((WAttNav *)watt->wattnav)->redraw();
((WAttNav *)watt->wattnav)->set_inputfocus(); ((WAttNav *)watt->wattnav)->set_inputfocus();
g_free( text); g_free( text);
if ( watt->pending_close) {
if ( watt->close_cb)
(watt->close_cb)( watt);
else
delete watt;
}
} }
} }
......
...@@ -676,6 +676,60 @@ void WFoe::activate_createobject( float x, float y) ...@@ -676,6 +676,60 @@ void WFoe::activate_createobject( float x, float y)
gre_node_created( gre, 0, x, y); gre_node_created( gre, 0, x, y);
} }
void WFoe::activate_createobject_cid( pwr_tCid cid, int option)
{
vldh_t_node node;
pwr_tStatus sts;
ldh_tSesContext ldhses;
if ( function != EDIT)
return;
gre->pending_paste_stop();
disable_ldh_cb();
sts = gre->create_node_floating( cid, 0, 0, &node);
enable_ldh_cb();
if ( EVEN(sts)) {
error_msg( sts);
return;
}
ldhses = (node->hn.wind)->hw.ldhses;
switch ( cid) {
case pwr_cClass_Document: {
pwr_tEnum doc_size = pwr_eDocumentSizeEnum_A3;
pwr_tEnum doc_orient = pwr_eDocumentOrientEnum_Landscape;
disable_ldh_cb();
sts = ldh_SetObjectPar( ldhses, node->ln.oid, "DevBody",
"DocumentSize", (char *) &doc_size, sizeof(doc_size));
if ( option == 1)
sts = ldh_SetObjectPar( ldhses, node->ln.oid, "DevBody",
"DocumentOrientation", (char *) &doc_orient, sizeof(doc_orient));
enable_ldh_cb();
sts = gre->node_update_floating( node);
break;
}
case pwr_cClass_Text: {
pwr_tEnum text_attr = pwr_eTextAttrEnum_Small;
pwr_tEnum frame_attr = pwr_eFrameAttrEnum_No;
disable_ldh_cb();
sts = ldh_SetObjectPar( ldhses, node->ln.oid, "DevBody",
"TextAttribute", (char *) &text_attr, sizeof(text_attr));
sts = ldh_SetObjectPar( ldhses, node->ln.oid, "DevBody",
"FrameAttribute", (char *) &frame_attr, sizeof(frame_attr));
enable_ldh_cb();
sts = gre->node_update_floating( node);
break;
}
default: ;
}
}
// //
// Callback from the menu. // Callback from the menu.
// Deletes the selected nodes and connections. // Deletes the selected nodes and connections.
...@@ -1493,7 +1547,30 @@ void WFoe::gre_node_created( WGre *gre, unsigned long current_node_type, ...@@ -1493,7 +1547,30 @@ void WFoe::gre_node_created( WGre *gre, unsigned long current_node_type,
((WFoe *)gre->parent_ctx)->attr_create(node); ((WFoe *)gre->parent_ctx)->attr_create(node);
sts = attrlist_get_by_node( node, (void **)&watt); sts = attrlist_get_by_node( node, (void **)&watt);
if ( EVEN(sts)) return; if ( EVEN(sts)) return;
sts = watt->open_changevalue( "Text"); sts = watt->open_changevalue( "Text", 1);
break;
default:
;
}
}
void WFoe::gre_node_floating_created( WGre *gre, vldh_t_node node)
{
WFoe *foe;
WAtt *watt;
int sts;
foe = (WFoe *)gre->parent_ctx;
switch ( node->ln.cid) {
case pwr_cClass_Text:
case pwr_cClass_BodyText:
case pwr_cClass_Head:
case pwr_cClass_Title:
((WFoe *)gre->parent_ctx)->attr_create(node);
sts = attrlist_get_by_node( node, (void **)&watt);
if ( EVEN(sts)) return;
sts = watt->open_changevalue( "Text", 1);
break; break;
default: default:
; ;
...@@ -2964,6 +3041,7 @@ int WFoe::view_setup() ...@@ -2964,6 +3041,7 @@ int WFoe::view_setup()
sts = gre->setup_backcalls( gre_setup_window, sts = gre->setup_backcalls( gre_setup_window,
gre_node_created, gre_node_created,
gre_node_floating_created,
gre_con_created, gre_con_created,
gre_node_moved, gre_node_moved,
gre_delete, gre_delete,
...@@ -3002,6 +3080,7 @@ int WFoe::edit_setup() ...@@ -3002,6 +3080,7 @@ int WFoe::edit_setup()
/* setup the backcalls from gre */ /* setup the backcalls from gre */
sts = gre->setup_backcalls( gre_setup_window, sts = gre->setup_backcalls( gre_setup_window,
gre_node_created, gre_node_created,
gre_node_floating_created,
gre_con_created, gre_con_created,
gre_node_moved, gre_node_moved,
gre_delete, gre_delete,
......
...@@ -210,6 +210,7 @@ class WFoe : public WUtility { ...@@ -210,6 +210,7 @@ class WFoe : public WUtility {
void activate_delete(); void activate_delete();
void activate_delete_confirm(); void activate_delete_confirm();
void activate_createobject( float x, float y); void activate_createobject( float x, float y);
void activate_createobject_cid( pwr_tCid cid, int option);
void activate_changetext(); void activate_changetext();
void activate_cut(); void activate_cut();
void activate_copy(); void activate_copy();
...@@ -309,6 +310,7 @@ class WFoe : public WUtility { ...@@ -309,6 +310,7 @@ class WFoe : public WUtility {
static void gre_setup_window( WGre *gre); static void gre_setup_window( WGre *gre);
static void gre_node_created( WGre *gre, unsigned long current_node_type, static void gre_node_created( WGre *gre, unsigned long current_node_type,
float x, float y); float x, float y);
static void gre_node_floating_created( WGre *gre, vldh_t_node node);
static void gre_node_moved( WGre *gre); static void gre_node_moved( WGre *gre);
static void gre_node_selected( WGre *gre); static void gre_node_selected( WGre *gre);
static void gre_con_selected( WGre *gre); static void gre_con_selected( WGre *gre);
......
...@@ -1442,6 +1442,12 @@ int WGre::flow_cb( FlowCtx *ctx, flow_tEvent event) ...@@ -1442,6 +1442,12 @@ int WGre::flow_cb( FlowCtx *ctx, flow_tEvent event)
vldh_nodemodified( vnode); vldh_nodemodified( vnode);
(gre->gre_node_moved) (gre); (gre->gre_node_moved) (gre);
if ( gre->floating_node && vnode == gre->floating_node) {
if ( gre->gre_node_floating_created)
(gre->gre_node_floating_created) ( gre, vnode);
gre->floating_node = 0;
}
break; break;
case flow_eObjectType_Con: case flow_eObjectType_Con:
flow_GetUserData( event->object.object, (void **) &vcon); flow_GetUserData( event->object.object, (void **) &vcon);
...@@ -1679,7 +1685,8 @@ WGre::WGre( void *wg_parent_ctx, ...@@ -1679,7 +1685,8 @@ WGre::WGre( void *wg_parent_ctx,
conref_nodetypeid(0), display_nodetypeid(0), conref_nodetypeid(0), display_nodetypeid(0),
sel_node_count(0), del_node_count(0), del_con_count(0), searchrect_node_id(0), popupmenu_mode(0), sel_node_count(0), del_node_count(0), del_con_count(0), searchrect_node_id(0), popupmenu_mode(0),
trace_started(0), trace_analyse_nc(0), trace_con_cc(0), trace_started(0), trace_analyse_nc(0), trace_con_cc(0),
trace_changenode(0), conpoint_locked(0), last_selected(0), last_cp_selected(0), last_cp_selected_num(0) trace_changenode(0), conpoint_locked(0), last_selected(0), last_cp_selected(0), last_cp_selected_num(0),
floating_node(0)
{ {
} }
...@@ -2035,6 +2042,7 @@ int WGre::view_setup() ...@@ -2035,6 +2042,7 @@ int WGre::view_setup()
int WGre::setup_backcalls ( int WGre::setup_backcalls (
void (*setup_window_bc)(WGre *), void (*setup_window_bc)(WGre *),
void (*node_created_bc)(WGre *, unsigned long, float, float), void (*node_created_bc)(WGre *, unsigned long, float, float),
void (*node_floating_created_bc)(WGre *, vldh_t_node),
void (*con_created_bc)(WGre *, double, double, vldh_t_node, unsigned long, vldh_t_node, unsigned long, int, int *), void (*con_created_bc)(WGre *, double, double, vldh_t_node, unsigned long, vldh_t_node, unsigned long, int, int *),
void (*node_moved_bc)(WGre *), void (*node_moved_bc)(WGre *),
void (*delete_bc)(WGre *, void *, unsigned long), void (*delete_bc)(WGre *, void *, unsigned long),
...@@ -2056,6 +2064,7 @@ int WGre::setup_backcalls ( ...@@ -2056,6 +2064,7 @@ int WGre::setup_backcalls (
/* Fill in callback addresses */ /* Fill in callback addresses */
gre_setup_window = setup_window_bc; gre_setup_window = setup_window_bc;
gre_node_created = node_created_bc; gre_node_created = node_created_bc;
gre_node_floating_created = node_floating_created_bc;
gre_con_created = con_created_bc; gre_con_created = con_created_bc;
gre_node_moved = node_moved_bc; gre_node_moved = node_moved_bc;
gre_delete = delete_bc; gre_delete = delete_bc;
...@@ -2190,6 +2199,8 @@ int WGre::create_node_floating( pwr_tClassId cid, float x, float y, vldh_t_node ...@@ -2190,6 +2199,8 @@ int WGre::create_node_floating( pwr_tClassId cid, float x, float y, vldh_t_node
if ( flow_FindSelectedObject( flow_ctx, node_object->hn.node_id)) if ( flow_FindSelectedObject( flow_ctx, node_object->hn.node_id))
visible = 1; visible = 1;
floating_node = node_object;
if ( !visible) if ( !visible)
flow_SetNodraw( flow_ctx); flow_SetNodraw( flow_ctx);
sts = node_annotations_draw( node_object, 0); sts = node_annotations_draw( node_object, 0);
...@@ -2571,6 +2582,19 @@ pwr_tStatus WGre::node_update_points( vldh_t_node node, ...@@ -2571,6 +2582,19 @@ pwr_tStatus WGre::node_update_points( vldh_t_node node,
// - the inversemask i changed, inputs are inverted or reinverted. // - the inversemask i changed, inputs are inverted or reinverted.
// - data affekting the annotaions is changed. // - data affekting the annotaions is changed.
// //
int WGre::node_update_floating( vldh_t_node object)
{
int sts;
flow_SetNodraw( flow_ctx);
flow_PasteRemove( flow_ctx, object->hn.node_id);
sts = node_update( object);
flow_PasteInsert( flow_ctx, object->hn.node_id);
flow_ResetNodraw( flow_ctx);
return sts;
}
int WGre::node_update( vldh_t_node object) int WGre::node_update( vldh_t_node object)
{ {
flow_tNodeClass node_class = 0; flow_tNodeClass node_class = 0;
......
...@@ -116,10 +116,12 @@ class WGre { ...@@ -116,10 +116,12 @@ class WGre {
vldh_t_node last_selected; vldh_t_node last_selected;
vldh_t_node last_cp_selected; vldh_t_node last_cp_selected;
int last_cp_selected_num; int last_cp_selected_num;
vldh_t_node floating_node;
/* Callbacks */ /* Callbacks */
void (*gre_setup_window)(WGre *); void (*gre_setup_window)(WGre *);
void (*gre_node_created)(WGre *, unsigned long, float, float); void (*gre_node_created)(WGre *, unsigned long, float, float);
void (*gre_node_floating_created)(WGre *, vldh_t_node);
void (*gre_con_created)(WGre *, double, double, vldh_t_node, unsigned long, vldh_t_node, unsigned long, int, int *); void (*gre_con_created)(WGre *, double, double, vldh_t_node, unsigned long, vldh_t_node, unsigned long, int, int *);
void (*gre_node_moved)(WGre *); void (*gre_node_moved)(WGre *);
void (*gre_delete)(WGre *, void *, unsigned long); void (*gre_delete)(WGre *, void *, unsigned long);
...@@ -179,6 +181,7 @@ class WGre { ...@@ -179,6 +181,7 @@ class WGre {
int setup_backcalls ( int setup_backcalls (
void (*setup_window_bc)(WGre *), void (*setup_window_bc)(WGre *),
void (*node_created_bc)(WGre *, unsigned long, float, float), void (*node_created_bc)(WGre *, unsigned long, float, float),
void (*node_floating_created_bc)(WGre *, vldh_t_node),
void (*con_created_bc)(WGre *, double, double, vldh_t_node, unsigned long, vldh_t_node, unsigned long, int, int *), void (*con_created_bc)(WGre *, double, double, vldh_t_node, unsigned long, vldh_t_node, unsigned long, int, int *),
void (*node_moved_bc)(WGre *), void (*node_moved_bc)(WGre *),
void (*delete_bc)(WGre *, void *, unsigned long), void (*delete_bc)(WGre *, void *, unsigned long),
...@@ -217,6 +220,7 @@ class WGre { ...@@ -217,6 +220,7 @@ class WGre {
unsigned long new_output_mask, unsigned long new_output_mask,
int *point_array, int *point_count); int *point_array, int *point_count);
int node_update( vldh_t_node object); int node_update( vldh_t_node object);
int node_update_floating( vldh_t_node object);
void zoom( float zoom); void zoom( float zoom);
void unzoom(); void unzoom();
int zoom_absolute( float absolute_zoom, int expand, float *realized_zoom); int zoom_absolute( float absolute_zoom, int expand, float *realized_zoom);
......
...@@ -54,10 +54,12 @@ void WAtt::set_editmode( int editmode, ldh_tSesContext ldhses) ...@@ -54,10 +54,12 @@ void WAtt::set_editmode( int editmode, ldh_tSesContext ldhses)
((WAttNav *)wattnav)->set_editmode( editmode, ldhses); ((WAttNav *)wattnav)->set_editmode( editmode, ldhses);
} }
int WAtt::open_changevalue( const char *name) int WAtt::open_changevalue( const char *name, int close)
{ {
int sts; int sts;
pending_close = close;
sts = ((WAttNav*)wattnav)->select_by_name( name); sts = ((WAttNav*)wattnav)->select_by_name( name);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
...@@ -79,7 +81,7 @@ WAtt::WAtt( ...@@ -79,7 +81,7 @@ WAtt::WAtt(
parent_ctx(wa_parent_ctx), parent_ctx(wa_parent_ctx),
ldhses(wa_ldhses), aref(wa_aref), editmode(wa_editmode), ldhses(wa_ldhses), aref(wa_aref), editmode(wa_editmode),
input_open(0), input_multiline(0), input_open(0), input_multiline(0),
close_cb(0), redraw_cb(0), client_data(0) close_cb(0), redraw_cb(0), client_data(0), pending_close(0)
{ {
} }
......
...@@ -66,6 +66,7 @@ class WAtt { ...@@ -66,6 +66,7 @@ class WAtt {
brow_tObject input_node; brow_tObject input_node;
char input_name[80]; char input_name[80];
wb_eUtility utility; wb_eUtility utility;
int pending_close;
virtual void message( char severity, const char *message) {} virtual void message( char severity, const char *message) {}
virtual void set_prompt( const char *prompt) {} virtual void set_prompt( const char *prompt) {}
...@@ -74,7 +75,7 @@ class WAtt { ...@@ -74,7 +75,7 @@ class WAtt {
virtual void pop() {} virtual void pop() {}
void set_editmode( int editmode, ldh_tSesContext ldhses); void set_editmode( int editmode, ldh_tSesContext ldhses);
int open_changevalue( const char *name); int open_changevalue( const char *name, int close = 0);
static void message_cb( void *watt, char severity, const char *message); static void message_cb( void *watt, char severity, const char *message);
static void change_value_cb( void *watt); static void change_value_cb( void *watt);
......
...@@ -128,6 +128,16 @@ void flow_SelectClear( flow_tCtx ctx) ...@@ -128,6 +128,16 @@ void flow_SelectClear( flow_tCtx ctx)
ctx->select_clear(); ctx->select_clear();
} }
void flow_PasteInsert( flow_tCtx ctx, flow_tObject object)
{
ctx->paste_insert( (FlowArrayElem *)object);
}
void flow_PasteRemove( flow_tCtx ctx, flow_tObject object)
{
ctx->paste_remove( (FlowArrayElem *)object);
}
void flow_ConPointSelectInsert( flow_tCtx ctx, flow_tObject object, int num) void flow_ConPointSelectInsert( flow_tCtx ctx, flow_tObject object, int num)
{ {
ctx->conpoint_select( (FlowArrayElem *)object, num); ctx->conpoint_select( (FlowArrayElem *)object, num);
......
...@@ -98,6 +98,8 @@ void flow_ResetSelectInverse( flow_tCtx ctx); ...@@ -98,6 +98,8 @@ void flow_ResetSelectInverse( flow_tCtx ctx);
void flow_SelectInsert( flow_tCtx ctx, flow_tObject object); void flow_SelectInsert( flow_tCtx ctx, flow_tObject object);
void flow_SelectRemove( flow_tCtx ctx, flow_tObject object); void flow_SelectRemove( flow_tCtx ctx, flow_tObject object);
void flow_SelectClear( flow_tCtx ctx); void flow_SelectClear( flow_tCtx ctx);
void flow_PasteInsert( flow_tCtx ctx, flow_tObject object);
void flow_PasteRemove( flow_tCtx ctx, flow_tObject object);
void flow_ConPointSelectInsert( flow_tCtx ctx, flow_tObject object, int num); void flow_ConPointSelectInsert( flow_tCtx ctx, flow_tObject object, int num);
void flow_ConPointSelectClear( flow_tCtx ctx); void flow_ConPointSelectClear( flow_tCtx ctx);
void flow_GetSelectedNodes( flow_tCtx ctx, flow_tNode **nodes, int *num); void flow_GetSelectedNodes( flow_tCtx ctx, flow_tNode **nodes, int *num);
......
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