Commit e00bd934 authored by claes's avatar claes

View plant added

parent c0244252
/* /*
* Proview $Id: ge_gtk.cpp,v 1.2 2007-01-05 07:54:20 claes Exp $ * Proview $Id: ge_gtk.cpp,v 1.3 2007-01-05 10:36:11 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
#include "ge_msg.h" #include "ge_msg.h"
#include "wb_wnav_selformat.h" #include "wb_wnav_selformat.h"
#include "co_wow_gtk.h" #include "co_wow_gtk.h"
#include "wb_nav.h" #include "wb_nav_gtk.h"
...@@ -255,7 +255,7 @@ void GeGtk::change_value_cb( void *ge_ctx, void *value_object, char *text) ...@@ -255,7 +255,7 @@ void GeGtk::change_value_cb( void *ge_ctx, void *value_object, char *text)
int GeGtk::get_plant_select( char *select_name) int GeGtk::get_plant_select( char *select_name)
{ {
#if LDH #ifdef LDH
pwr_sAttrRef attrref; pwr_sAttrRef attrref;
int is_attrref; int is_attrref;
int sts; int sts;
...@@ -948,6 +948,33 @@ void GeGtk::activate_zoom_reset(GtkWidget *w, gpointer gectx) ...@@ -948,6 +948,33 @@ void GeGtk::activate_zoom_reset(GtkWidget *w, gpointer gectx)
((Ge *)gectx)->activate_zoom_reset(); ((Ge *)gectx)->activate_zoom_reset();
} }
void GeGtk::activate_view_plant(GtkWidget *w, gpointer data)
{
#ifdef LDH
Ge *ge = (Ge *)data;
if ( !ge->ldhses)
return;
int set = (int) gtk_check_menu_item_get_active( GTK_CHECK_MENU_ITEM( ((GeGtk *)ge)->view_plant_w));
if ( set) {
g_object_set( ((GeGtk *)ge)->plant_widget, "visible", TRUE, NULL);
g_object_set( ((GeGtk *)ge)->subpalette_widget, "visible", FALSE, NULL);
ge->plant_mapped = 1;
ge->subpalette_mapped = 0;
}
else {
g_object_set( ((GeGtk *)ge)->plant_widget, "visible", FALSE, NULL);
g_object_set( ((GeGtk *)ge)->subpalette_widget, "visible", TRUE, NULL);
ge->plant_mapped = 0;
ge->subpalette_mapped = 1;
}
ge->set_focus(0);
#endif
}
void GeGtk::activate_concorner_right(GtkWidget *w, gpointer gectx) void GeGtk::activate_concorner_right(GtkWidget *w, gpointer gectx)
{ {
((Ge *)gectx)->activate_concorner_right(); ((Ge *)gectx)->activate_concorner_right();
...@@ -1105,28 +1132,28 @@ void GeGtk::valchanged_cmd_input( GtkWidget *w, gpointer data) ...@@ -1105,28 +1132,28 @@ void GeGtk::valchanged_cmd_input( GtkWidget *w, gpointer data)
g_object_set( w, "visible", FALSE, NULL); g_object_set( w, "visible", FALSE, NULL);
gectx->set_prompt( ""); gectx->set_prompt( "");
gectx->text_input_open = 0; gectx->text_input_open = 0;
gectx->subpalette->set_inputfocus(1); gectx->set_focus(0);
} }
else if ( gectx->name_input_open) { else if ( gectx->name_input_open) {
gectx->graph->change_name( gectx->current_text_object, text); gectx->graph->change_name( gectx->current_text_object, text);
g_object_set( w, "visible", FALSE, NULL); g_object_set( w, "visible", FALSE, NULL);
gectx->set_prompt( ""); gectx->set_prompt( "");
gectx->name_input_open = 0; gectx->name_input_open = 0;
gectx->subpalette->set_inputfocus(1); gectx->set_focus(0);
} }
else if ( gectx->value_input_open) { else if ( gectx->value_input_open) {
gectx->graph->change_value( gectx->current_value_object, text); gectx->graph->change_value( gectx->current_value_object, text);
g_object_set( w, "visible", FALSE, NULL); g_object_set( w, "visible", FALSE, NULL);
gectx->set_prompt( ""); gectx->set_prompt( "");
gectx->value_input_open = 0; gectx->value_input_open = 0;
gectx->subpalette->set_inputfocus(1); gectx->set_focus(0);
} }
else if ( gectx->command_open) { else if ( gectx->command_open) {
sts = gectx->graph->command( text); sts = gectx->graph->command( text);
g_object_set( w, "visible", FALSE, NULL); g_object_set( w, "visible", FALSE, NULL);
gectx->set_prompt( ""); gectx->set_prompt( "");
gectx->command_open = 0; gectx->command_open = 0;
gectx->subpalette->set_inputfocus(1); gectx->set_focus(0);
} }
g_free(text); g_free(text);
} }
...@@ -1198,7 +1225,7 @@ gboolean GeGtk::ge_action_inputfocus( GtkWidget *w, GdkEvent *event, gpointer da ...@@ -1198,7 +1225,7 @@ gboolean GeGtk::ge_action_inputfocus( GtkWidget *w, GdkEvent *event, gpointer da
gectx->text_input_open || gectx->command_open) gectx->text_input_open || gectx->command_open)
gtk_widget_grab_focus( gectx->cmd_input); gtk_widget_grab_focus( gectx->cmd_input);
else else
gectx->subpalette->set_inputfocus(1); gectx->set_focus(0);
} }
return FALSE; return FALSE;
} }
...@@ -1710,12 +1737,19 @@ GeGtk::GeGtk( void *x_parent_ctx, ...@@ -1710,12 +1737,19 @@ GeGtk::GeGtk( void *x_parent_ctx,
GtkWidget *view_zoom_reset = gtk_image_menu_item_new_from_stock(GTK_STOCK_ZOOM_100, NULL); GtkWidget *view_zoom_reset = gtk_image_menu_item_new_from_stock(GTK_STOCK_ZOOM_100, NULL);
g_signal_connect(view_zoom_reset, "activate", G_CALLBACK(GeGtk::activate_zoom_reset), this); g_signal_connect(view_zoom_reset, "activate", G_CALLBACK(GeGtk::activate_zoom_reset), this);
view_plant_w = gtk_check_menu_item_new_with_mnemonic( "Vi_ew Plant");
g_signal_connect( view_plant_w, "activate",
G_CALLBACK(GeGtk::activate_view_plant), this);
gtk_widget_add_accelerator( view_plant_w, "activate", accel_g,
'p', GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
GtkMenu *view_menu = (GtkMenu *) g_object_new( GTK_TYPE_MENU, NULL); GtkMenu *view_menu = (GtkMenu *) g_object_new( GTK_TYPE_MENU, NULL);
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_preview_start); gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_preview_start);
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_preview_stop); gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_preview_stop);
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_zoom_in); gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_zoom_in);
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_zoom_out); gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_zoom_out);
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_zoom_reset); gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_zoom_reset);
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_plant_w);
GtkWidget *view = gtk_menu_item_new_with_mnemonic("_View"); GtkWidget *view = gtk_menu_item_new_with_mnemonic("_View");
gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), view); gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), view);
...@@ -2191,22 +2225,37 @@ GeGtk::GeGtk( void *x_parent_ctx, ...@@ -2191,22 +2225,37 @@ GeGtk::GeGtk( void *x_parent_ctx,
GtkWidget *vpaned1 = gtk_vpaned_new(); GtkWidget *vpaned1 = gtk_vpaned_new();
GtkWidget *vpaned2 = gtk_vpaned_new(); GtkWidget *vpaned2 = gtk_vpaned_new();
GtkWidget *palbox = gtk_hbox_new( FALSE, 0);
// SubGraphs palette // SubGraphs palette
subpalette = new SubPaletteGtk( this, vpaned1, "SubGraphs", subpalette = new SubPaletteGtk( this, palbox, "SubGraphs",
&subpalette_widget, &sts); &subpalette_widget, &sts);
subpalette->message_cb = &Ge::message_cb; subpalette->message_cb = &Ge::message_cb;
subpalette->set_focus_cb = &Ge::set_focus_cb; subpalette->set_focus_cb = &Ge::set_focus_cb;
subpalette->traverse_focus_cb = &Ge::traverse_focus; subpalette->traverse_focus_cb = &Ge::traverse_focus;
gtk_paned_add1( GTK_PANED(vpaned1), subpalette_widget); gtk_box_pack_start( GTK_BOX(palbox), subpalette_widget, TRUE, TRUE, 0);
gtk_widget_show( subpalette_widget); gtk_widget_show( subpalette_widget);
subpalette_mapped = 1;
// Color palette // Color palette
colpal_main_widget = scrolledcolpalwidgetgtk_new( colpal_main_widget = scrolledcolpalwidgetgtk_new(
Ge::init_colorpalette_cb, this, Ge::init_colorpalette_cb, this,
&colorpalette_widget); &colorpalette_widget);
gtk_paned_add2( GTK_PANED(vpaned1), colpal_main_widget);
gtk_widget_show( colpal_main_widget); gtk_widget_show( colpal_main_widget);
#ifdef LDH
if ( ldhses) {
plantctx = new NavGtk( this, palbox, "Plant",
ldhses, "NavigatorW1",
&plant_widget, &sts);
((NavGtk *)plantctx)->get_plant_select_cb = Ge::get_plant_select_cb;
gtk_box_pack_start( GTK_BOX(palbox), plant_widget, TRUE, TRUE, 0);
}
#endif
gtk_paned_add1( GTK_PANED(vpaned1), palbox);
gtk_paned_add2( GTK_PANED(vpaned1), colpal_main_widget);
((GraphGtk *)graph)->create_navigator( vpaned1); ((GraphGtk *)graph)->create_navigator( vpaned1);
gtk_paned_add1( GTK_PANED(vpaned2), vpaned1); gtk_paned_add1( GTK_PANED(vpaned2), vpaned1);
gtk_paned_add2( GTK_PANED(vpaned2), ((GraphGtk *)graph)->nav_widget); gtk_paned_add2( GTK_PANED(vpaned2), ((GraphGtk *)graph)->nav_widget);
...@@ -2236,6 +2285,10 @@ GeGtk::GeGtk( void *x_parent_ctx, ...@@ -2236,6 +2285,10 @@ GeGtk::GeGtk( void *x_parent_ctx,
gtk_paned_set_position( GTK_PANED(vpaned2), window_height * 2 / 3); gtk_paned_set_position( GTK_PANED(vpaned2), window_height * 2 / 3);
gtk_paned_set_position( GTK_PANED(vpaned1), window_height / 3); gtk_paned_set_position( GTK_PANED(vpaned1), window_height / 3);
#ifdef LDH
if ( ldhses)
g_object_set( plant_widget, "visible", FALSE, NULL);
#endif
g_object_set( cmd_prompt, "visible", FALSE, NULL); g_object_set( cmd_prompt, "visible", FALSE, NULL);
g_object_set( cmd_input, "visible", FALSE, NULL); g_object_set( cmd_input, "visible", FALSE, NULL);
......
/* /*
* Proview $Id: ge_gtk.h,v 1.1 2007-01-04 08:21:58 claes Exp $ * Proview $Id: ge_gtk.h,v 1.2 2007-01-05 10:36:25 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -59,6 +59,7 @@ class GeGtk : public Ge { ...@@ -59,6 +59,7 @@ class GeGtk : public Ge {
GtkWidget *grid_size_02_w; GtkWidget *grid_size_02_w;
GtkWidget *grid_size_01_w; GtkWidget *grid_size_01_w;
GtkWidget *show_grid_w; GtkWidget *show_grid_w;
GtkWidget *view_plant_w;
GdkAtom graph_atom; GdkAtom graph_atom;
CoWowRecall *text_recall; CoWowRecall *text_recall;
CoWowRecall *name_recall; CoWowRecall *name_recall;
...@@ -209,6 +210,7 @@ class GeGtk : public Ge { ...@@ -209,6 +210,7 @@ class GeGtk : public Ge {
static void activate_zoom_in( GtkWidget *w, gpointer gectx); static void activate_zoom_in( GtkWidget *w, gpointer gectx);
static void activate_zoom_out( GtkWidget *w, gpointer gectx); static void activate_zoom_out( GtkWidget *w, gpointer gectx);
static void activate_zoom_reset( GtkWidget *w, gpointer gectx); static void activate_zoom_reset( GtkWidget *w, gpointer gectx);
static void activate_view_plant( GtkWidget *w, gpointer gectx);
static void activate_concorner_right( GtkWidget *w, gpointer gectx); static void activate_concorner_right( GtkWidget *w, gpointer gectx);
static void activate_concorner_rounded( GtkWidget *w, gpointer gectx); static void activate_concorner_rounded( GtkWidget *w, gpointer gectx);
static void activate_round_amount_1( GtkWidget *w, gpointer gectx); static void activate_round_amount_1( GtkWidget *w, gpointer gectx);
......
/* /*
* Proview $Id: ge_motif.cpp,v 1.1 2007-01-04 08:22:16 claes Exp $ * Proview $Id: ge_motif.cpp,v 1.2 2007-01-05 10:36:37 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -1556,6 +1556,7 @@ GeMotif::GeMotif( void *x_parent_ctx, ...@@ -1556,6 +1556,7 @@ GeMotif::GeMotif( void *x_parent_ctx,
subpalette->message_cb = &Ge::message_cb; subpalette->message_cb = &Ge::message_cb;
subpalette->set_focus_cb = &Ge::set_focus_cb; subpalette->set_focus_cb = &Ge::set_focus_cb;
subpalette->traverse_focus_cb = &Ge::traverse_focus; subpalette->traverse_focus_cb = &Ge::traverse_focus;
subpalette_mapped = 1;
colpal_main_widget = ScrolledColPalCreate( palette_pane, colpal_main_widget = ScrolledColPalCreate( palette_pane,
"Colors", NULL, "Colors", NULL,
...@@ -1569,6 +1570,7 @@ GeMotif::GeMotif( void *x_parent_ctx, ...@@ -1569,6 +1570,7 @@ GeMotif::GeMotif( void *x_parent_ctx,
ldhses, "NavigatorW1", ldhses, "NavigatorW1",
&plant_widget, &sts); &plant_widget, &sts);
((NavMotif *)plantctx)->get_plant_select_cb = Ge::get_plant_select_cb; ((NavMotif *)plantctx)->get_plant_select_cb = Ge::get_plant_select_cb;
plant_mapped = 1;
// XtUnmanageChild( plant_widget); // XtUnmanageChild( plant_widget);
} }
#endif #endif
......
/* /*
* Proview $Id: ge.cpp,v 1.23 2007-01-04 08:18:34 claes Exp $ * Proview $Id: ge.cpp,v 1.24 2007-01-05 10:39:06 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
#include "ge_util.h" #include "ge_util.h"
#include "ge_msg.h" #include "ge_msg.h"
#include "wb_wnav_selformat.h" #include "wb_wnav_selformat.h"
#include "wb_nav.h"
void Ge::set_title() void Ge::set_title()
...@@ -1812,11 +1813,17 @@ int Ge::traverse_focus( void *ctx, void *component) ...@@ -1812,11 +1813,17 @@ int Ge::traverse_focus( void *ctx, void *component)
Ge *gectx = (Ge *) ctx; Ge *gectx = (Ge *) ctx;
if ( component == (void *) gectx->graph) { if ( component == (void *) gectx->graph) {
gectx->set_focus( gectx->subpalette); if ( gectx->subpalette_mapped)
gectx->set_focus( gectx->subpalette);
else if ( gectx->plant_mapped)
gectx->set_focus( gectx->plantctx);
} }
else if ( component == (void *) gectx->subpalette) { else if ( component == (void *) gectx->subpalette) {
gectx->set_focus( gectx->graph); gectx->set_focus( gectx->graph);
} }
else if ( component == (void *) gectx->plantctx) {
gectx->set_focus( gectx->graph);
}
else else
return 0; return 0;
return 1; return 1;
...@@ -1831,14 +1838,37 @@ int Ge::set_focus( void *component) ...@@ -1831,14 +1838,37 @@ int Ge::set_focus( void *component)
{ {
if ( component == (void *)graph) { if ( component == (void *)graph) {
graph->set_inputfocus( 1); graph->set_inputfocus( 1);
subpalette->set_inputfocus( 0); if ( subpalette_mapped)
subpalette->set_inputfocus( 0);
if ( plant_mapped)
plantctx->set_inputfocus(0);
focused_component = component; focused_component = component;
} }
else if ( component == (void *)subpalette) { else if ( component == (void *)subpalette) {
graph->set_inputfocus( 0); if ( subpalette_mapped) {
subpalette->set_inputfocus( 1); graph->set_inputfocus( 0);
focused_component = component; subpalette->set_inputfocus( 1);
focused_component = component;
if ( plant_mapped)
plantctx->set_inputfocus(0);
}
} }
else if ( component == (void *)plantctx) {
if ( plant_mapped) {
if ( subpalette_mapped)
subpalette->set_inputfocus(0);
graph->set_inputfocus( 0);
plantctx->set_inputfocus( 1);
focused_component = component;
}
}
else if ( component == 0) {
if ( subpalette_mapped)
set_focus( subpalette);
else if ( plant_mapped)
set_focus( plantctx);
}
return 1; return 1;
} }
...@@ -1879,7 +1909,7 @@ Ge::Ge( void *x_parent_ctx, ...@@ -1879,7 +1909,7 @@ Ge::Ge( void *x_parent_ctx,
yesnodia_yes_cb(0), yesnodia_no_cb(0), india_ok_cb(0), current_text_object(0), yesnodia_yes_cb(0), yesnodia_no_cb(0), india_ok_cb(0), current_text_object(0),
current_value_object(0), current_confirm_object(0), ldhses(0), plantctx(0), current_value_object(0), current_confirm_object(0), ldhses(0), plantctx(0),
exit_when_close(x_exit_when_close), prev_count(0), focused_component(0), exit_when_close(x_exit_when_close), prev_count(0), focused_component(0),
recover_object(0) recover_object(0), plant_mapped(0), subpalette_mapped(0)
{ {
strcpy( name, "PwR Ge"); strcpy( name, "PwR Ge");
......
/* /*
* Proview $Id: ge.h,v 1.5 2007-01-04 08:18:34 claes Exp $ * Proview $Id: ge.h,v 1.6 2007-01-05 10:39:13 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -58,6 +58,7 @@ typedef struct { ...@@ -58,6 +58,7 @@ typedef struct {
class ColPalCtx; class ColPalCtx;
class Graph; class Graph;
class Nav;
class Ge { class Ge {
public: public:
...@@ -80,13 +81,15 @@ class Ge { ...@@ -80,13 +81,15 @@ class Ge {
void *current_value_object; void *current_value_object;
void *current_confirm_object; void *current_confirm_object;
ldh_tSesContext ldhses; ldh_tSesContext ldhses;
void *plantctx; Nav *plantctx;
int exit_when_close; int exit_when_close;
ge_tPrevPage prev_table[40]; ge_tPrevPage prev_table[40];
int prev_count; int prev_count;
void *focused_component; void *focused_component;
grow_tObject recover_object; grow_tObject recover_object;
char recover_name[80]; char recover_name[80];
int plant_mapped;
int subpalette_mapped;
Ge( void *parent_ctx, Ge( void *parent_ctx,
ldh_tSesContext ldhses, int exit_when_close); ldh_tSesContext ldhses, int exit_when_close);
......
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