Commit 3feac8d9 authored by Claes Sjofors's avatar Claes Sjofors

Xtt collect graph updated, and added to collect menu

parent 0ec860ce
......@@ -451,6 +451,27 @@ void XttGtk::activate_collect_clear( GtkWidget *w, gpointer data)
xtt->xnav->collect_clear();
}
void XttGtk::activate_collect_opengraph( GtkWidget *w, gpointer data)
{
Xtt *xtt = (Xtt *)data;
pwr_tCmd cmd = "open graph /collect";
if ( !xtt->xnav->is_authorized())
return;
int showed = 0;
if ( xtt->xnav->brow->ctx != xtt->xnav->collect_brow->ctx) {
xtt->xnav->collect_show();
showed = 1;
}
xtt->xnav->command( cmd);
if ( showed)
// Hide
xtt->xnav->collect_show();
}
void XttGtk::activate_collect_window( GtkWidget *w, gpointer data)
{
Xtt *xtt = (Xtt *)data;
......@@ -868,6 +889,10 @@ XttGtk::XttGtk( int argc, char *argv[], int *return_sts) :
g_signal_connect( functions_collect_clear, "activate",
G_CALLBACK(XttGtk::activate_collect_clear), this);
GtkWidget *functions_collect_opengraph = gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("O_pen Graph"));
g_signal_connect( functions_collect_opengraph, "activate",
G_CALLBACK(XttGtk::activate_collect_opengraph), this);
GtkWidget *functions_collect_window = gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_Copy to Window"));
g_signal_connect( functions_collect_window, "activate",
G_CALLBACK(XttGtk::activate_collect_window), this);
......@@ -901,6 +926,7 @@ XttGtk::XttGtk( int argc, char *argv[], int *return_sts) :
gtk_menu_shell_append(GTK_MENU_SHELL(functions_collect_menu), functions_collect_show);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_collect_menu), functions_collect_remove);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_collect_menu), functions_collect_clear);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_collect_menu), functions_collect_opengraph);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_collect_menu), functions_collect_window);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_collect_menu), functions_collect_new_window);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_collect_menu), functions_collect_signals);
......
......@@ -108,6 +108,7 @@ class XttGtk : public Xtt {
static void activate_collect_show( GtkWidget *w, gpointer data);
static void activate_collect_remove( GtkWidget *w, gpointer data);
static void activate_collect_clear( GtkWidget *w, gpointer data);
static void activate_collect_opengraph( GtkWidget *w, gpointer data);
static void activate_collect_window( GtkWidget *w, gpointer data);
static void activate_collect_new_window( GtkWidget *w, gpointer data);
static void activate_collect_signals( GtkWidget *w, gpointer data);
......
......@@ -659,6 +659,14 @@ void GeDyn::open( ifstream& fp)
}
}
void GeDyn::update_dyntype( grow_tObject object)
{
total_dyn_type1 = get_dyntype1( object);
total_dyn_type2 = get_dyntype2( object);
total_action_type1 = get_actiontype1( object);
total_action_type2 = get_actiontype2( object);
}
ge_mDynType1 GeDyn::get_dyntype1( grow_tObject object)
{
if ( object && dyn_type1 & ge_mDynType1_Inherit) {
......
......@@ -869,6 +869,7 @@ class GeDyn {
//! Execute action after confirm.
int confirmed_action( grow_tObject object, glow_tEvent event);
int change_value( grow_tObject object, char *text);
void update_dyntype( grow_tObject object);
ge_mDynType1 get_dyntype1( grow_tObject object);
ge_mDynType2 get_dyntype2( grow_tObject object);
ge_mActionType1 get_actiontype1( grow_tObject object);
......
This diff is collapsed.
......@@ -751,6 +751,10 @@ void grow_SetAttributes( grow_tCtx ctx, grow_sAttributes *attr,
ctx->initial_position = attr->initial_position;
if ( mask & grow_eAttr_environment)
ctx->environment = attr->environment;
if ( mask & grow_eAttr_tooltip_text_size)
ctx->tiptext_size = attr->tooltip_text_size;
if ( mask & grow_eAttr_color_theme)
strncpy( ctx->color_theme, attr->color_theme, sizeof(ctx->color_theme));
}
void grow_GetAttributes( grow_tCtx ctx, grow_sAttributes *attr,
......@@ -4530,6 +4534,12 @@ void grow_SetLayout( grow_tCtx ctx, double x0, double y0, double x1,
ctx->set_layout( x0, y0, x1, y1);
}
void grow_GetLayout( grow_tCtx ctx, double *x0, double *y0, double *x1,
double *y1)
{
ctx->get_layout( x0, y0, x1, y1);
}
void grow_SetPath( grow_tCtx ctx, int path_cnt, const char *path)
{
ctx->set_path( path_cnt, path);
......
......@@ -120,6 +120,8 @@ extern "C" {
glow_eHotMode hot_mode;
glow_eDirection initial_position;
glow_eEnv environment;
int tooltip_text_size;
char color_theme[40];
} grow_sAttributes;
typedef enum {
......@@ -144,7 +146,9 @@ extern "C" {
grow_eAttr_double_buffer_on = 1 << 18,
grow_eAttr_hot_mode = 1 << 19,
grow_eAttr_initial_position = 1 << 20,
grow_eAttr_environment = 1 << 21
grow_eAttr_environment = 1 << 21,
grow_eAttr_tooltip_text_size = 1 << 22,
grow_eAttr_color_theme = 1 << 23
} grow_eAttribute;
......@@ -1907,6 +1911,17 @@ extern "C" {
void grow_SetLayout( grow_tCtx ctx, double x0, double y0, double x1,
double y1);
//! Get layout.
/*!
\param ctx Grow context.
\param x0 x coordinate for left border.
\param y0 y coordinate for low border.
\param x1 x coordinate for right border.
\param y1 y coordinate for high border.
*/
void grow_GetLayout( grow_tCtx ctx, double *x0, double *y0, double *x1,
double *y1);
//! Set search path for subgraphs and images.
/*!
\param ctx Grow context.
......
......@@ -4698,6 +4698,9 @@ int GrowCtx::read_customcolor_file( char *name)
if ( environment == glow_eEnv_Runtime && strcmp( color_theme, "$default") != 0)
return 0;
if ( name == 0 && strcmp( default_color_theme, "") != 0)
name = default_color_theme;
if ( customcolors) {
sts = customcolors->read_colorfile( this, name);
if ( ODD(sts)) {
......
......@@ -758,6 +758,16 @@ class GrowCtx : public GlowCtx {
void set_layout( double nx0, double ny0, double nx1, double ny1)
{ x0 = nx0; y0 = ny0; x1 = nx1; y1= ny1; };
//! Get layout
/*!
\param nx0 x coordinate for left border.
\param ny0 y coordinate for low border.
\param nx1 x coordinate for right border.
\param ny1 y coordinate for high border.
*/
void get_layout( double *nx0, double *ny0, double *nx1, double *ny1)
{ *nx0 = x0; *ny0 = y0; *nx1 = x1; *ny1= y1; };
//! Group the selected objects.
/*!
\param group Created group.
......
......@@ -491,6 +491,27 @@ XttGeGtk::XttGeGtk( GtkWidget *xg_parent_wid, void *xg_parent_ctx, const char *x
if ( borders)
((Graph *)graph)->set_borders( borders);
if ( strcmp( filename, "_none_") == 0 && xg_width == 0 && xg_height == 0) {
// Set size from current layout
double x0, y0, x1, y1, zoom;
float rd = 0.05;
grow_GetLayout( graph->grow->ctx, &x0, &y0, &x1, &y1);
grow_GetZoom( graph->grow->ctx, &zoom);
window_width = zoom * ( x1 - x0);
window_height = zoom * ( y1 - y0);
if ( window_width < 300 || window_height < 300)
rd = 0.2;
geometry.min_aspect = gdouble(window_width)/window_height * (1.0 - rd);
geometry.max_aspect = gdouble(window_width)/window_height * (1.0 + rd);
gtk_window_set_geometry_hints( GTK_WINDOW(toplevel), GTK_WIDGET(toplevel),
&geometry, GDK_HINT_ASPECT);
gtk_widget_set_size_request( toplevel, window_width, window_height);
}
}
static gint confirm_delete_event( GtkWidget *w, GdkEvent *event, gpointer ge)
......
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