Commit a3601a33 authored by Claes Sjofors's avatar Claes Sjofors

Ge, scalable toolbar, and invisible dynamic added to axis

parent fb48718c
...@@ -5310,6 +5310,11 @@ void grow_ToolbarConfigure( grow_tObject object, char *tools1, char *tools2, int ...@@ -5310,6 +5310,11 @@ void grow_ToolbarConfigure( grow_tObject object, char *tools1, char *tools2, int
show_mask1, show_mask2, insensitive_mask1, insensitive_mask2); show_mask1, show_mask2, insensitive_mask1, insensitive_mask2);
} }
void grow_ToolbarScale( grow_tObject object)
{
((GrowToolbar *)object)->scale();
}
void grow_SetEditSetMode( grow_tCtx ctx, glow_eEditSetMode mode) void grow_SetEditSetMode( grow_tCtx ctx, glow_eEditSetMode mode)
{ {
ctx->set_edit_set_mode( mode); ctx->set_edit_set_mode( mode);
......
...@@ -3077,6 +3077,7 @@ void grow_GetObjectClassDynType( grow_tObject object, int *dyn_type1, int *dyn_t ...@@ -3077,6 +3077,7 @@ void grow_GetObjectClassDynType( grow_tObject object, int *dyn_type1, int *dyn_t
void grow_ToolbarConfigure( grow_tObject object, char *tools1, char *tools2, int tools1_cnt, int tools2_cnt, void grow_ToolbarConfigure( grow_tObject object, char *tools1, char *tools2, int tools1_cnt, int tools2_cnt,
unsigned int show_mask1, unsigned int show_mask2, unsigned int show_mask1, unsigned int show_mask2,
unsigned int insensitive_mask1, unsigned int insensitive_mask2); unsigned int insensitive_mask1, unsigned int insensitive_mask2);
void grow_ToolbarScale( grow_tObject object);
void grow_SetEditSetMode( grow_tCtx ctx, glow_eEditSetMode mode); void grow_SetEditSetMode( grow_tCtx ctx, glow_eEditSetMode mode);
/*@}*/ /*@}*/
......
...@@ -280,6 +280,9 @@ void GrowAxis::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, void ...@@ -280,6 +280,9 @@ void GrowAxis::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, void
idx = int( w->zoom_factor_y / w->base_zoom_factor * line_width - 1); idx = int( w->zoom_factor_y / w->base_zoom_factor * line_width - 1);
idx += hot; idx += hot;
} }
if ( (node && ((GrowNode *)node)->invisible) || invisible)
return;
idx = max( 0, idx); idx = max( 0, idx);
idx = min( idx, DRAW_TYPE_SIZE-1); idx = min( idx, DRAW_TYPE_SIZE-1);
int x1, y1, x2, y2, ll_x, ll_y, ur_x, ur_y; int x1, y1, x2, y2, ll_x, ll_y, ur_x, ur_y;
...@@ -1017,6 +1020,32 @@ void GrowAxis::convert( glow_eConvert version) ...@@ -1017,6 +1020,32 @@ void GrowAxis::convert( glow_eConvert version)
} }
} }
glow_eVis GrowAxis::get_visibility()
{
if ( invisible)
return glow_eVis_Invisible;
return glow_eVis_Visible;
}
void GrowAxis::set_visibility( glow_eVis visibility)
{
switch( visibility) {
case glow_eVis_Visible:
if ( invisible == 0)
return;
invisible = 0;
break;
case glow_eVis_Invisible:
if ( invisible)
return;
invisible = 1;
erase( &ctx->mw);
break;
case glow_eVis_Dimmed:
break;
}
draw();
}
......
...@@ -260,6 +260,9 @@ class GrowAxis : public GrowRect { ...@@ -260,6 +260,9 @@ class GrowAxis : public GrowRect {
\param value Value to format. \param value Value to format.
*/ */
void format_text( char *text, char *fmt, double value); void format_text( char *text, char *fmt, double value);
glow_eVis get_visibility();
void set_visibility( glow_eVis visibility);
}; };
......
...@@ -524,6 +524,7 @@ void GrowToolbar::configure( char *tools1, char *tools2, int tools1_cnt, int too ...@@ -524,6 +524,7 @@ void GrowToolbar::configure( char *tools1, char *tools2, int tools1_cnt, int too
} }
get_node_borders(); get_node_borders();
scale();
// Move the nc to after the methodbuttons nodeclasses, or they will be deleted in the wrong order // Move the nc to after the methodbuttons nodeclasses, or they will be deleted in the wrong order
// when when deleted // when when deleted
...@@ -553,3 +554,19 @@ int GrowToolbar::get_mask_index( int idx, int *category, int *mask_idx) ...@@ -553,3 +554,19 @@ int GrowToolbar::get_mask_index( int idx, int *category, int *mask_idx)
} }
return 0; return 0;
} }
void GrowToolbar::scale()
{
double scale;
if ( ctx->mw.window_width == 0)
return;
if ( x_right * ctx->mw.zoom_factor_x - ctx->mw.offset_x > ctx->mw.window_width) {
scale = (ctx->mw.window_width - ( x_left * ctx->mw.zoom_factor_x - ctx->mw.offset_x) - 10) /
(( x_right - x_left) * ctx->mw.zoom_factor_x);
trf.scale( scale, 1, x_left, y_low);
get_node_borders();
}
}
...@@ -156,6 +156,7 @@ class GrowToolbar : public GrowNode { ...@@ -156,6 +156,7 @@ class GrowToolbar : public GrowNode {
unsigned int show_mask1, unsigned int show_mask2, unsigned int show_mask1, unsigned int show_mask2,
unsigned int insensitive_mask1, unsigned int insensitive_mask2); unsigned int insensitive_mask1, unsigned int insensitive_mask2);
int get_mask_index( int idx, int *category, int *mask_idx); int get_mask_index( int idx, int *category, int *mask_idx);
void scale();
}; };
/*@}*/ /*@}*/
......
...@@ -71,17 +71,17 @@ void XttGe::graph_init_cb( void *client_data) ...@@ -71,17 +71,17 @@ void XttGe::graph_init_cb( void *client_data)
strcat( fname, ".pwg"); strcat( fname, ".pwg");
ge->graph->open( fname); ge->graph->open( fname);
ge->graph->init_trace();
if ( ge->width == 0 || ge->height == 0) { if ( ge->width == 0 || ge->height == 0) {
sts = ge->graph->get_default_size( &default_width, &default_height); sts = ge->graph->get_default_size( &default_width, &default_height);
if ( ODD(sts)) { if ( ODD(sts)) {
ge->set_size( default_width, default_height); ge->set_size( default_width, default_height);
} }
} }
ge->graph->set_default_layout(); ge->graph->set_default_layout();
ge->graph->init_trace();
} }
int XttGe::graph_close_cb( void *client_data) int XttGe::graph_close_cb( 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