Commit 3d413080 authored by claes's avatar claes

GeCurve: scroll and zoom with arrow keys and mouse wheel

parent c6784b67
......@@ -23,3 +23,4 @@
070112 cs xtt Font size in alarmtexts in operator window can be changed.
070112 cs xtt Nodename displayed i Xtt title.
070112 cs xtt New syntax for function key definition file (gtk version).
070115 cs curve Scroll and zoom with arrow keys and mouse wheel. Scroll buttons in tools.
\ No newline at end of file
/*
* Proview $Id: ge_curve_gtk.cpp,v 1.1 2007-01-04 08:21:58 claes Exp $
* Proview $Id: ge_curve_gtk.cpp,v 1.2 2007-01-15 13:19:09 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -87,6 +87,38 @@ void GeCurveGtk::activate_zoomout( GtkWidget *w, gpointer data)
void GeCurveGtk::activate_zoomreset( GtkWidget *w, gpointer data)
{
GeCurve *curve = (GeCurve *)data;
curve_Unzoom( curve->growcurve_ctx);
}
void GeCurveGtk::activate_page_right( GtkWidget *w, gpointer data)
{
GeCurve *curve = (GeCurve *)data;
curve_Scroll( curve->growcurve_ctx, -0.9);
}
void GeCurveGtk::activate_page_left( GtkWidget *w, gpointer data)
{
GeCurve *curve = (GeCurve *)data;
curve_Scroll( curve->growcurve_ctx, 0.9);
}
void GeCurveGtk::activate_scroll_right( GtkWidget *w, gpointer data)
{
GeCurve *curve = (GeCurve *)data;
curve_Scroll( curve->growcurve_ctx, -0.1);
}
void GeCurveGtk::activate_scroll_left( GtkWidget *w, gpointer data)
{
GeCurve *curve = (GeCurve *)data;
curve_Scroll( curve->growcurve_ctx, 0.1);
curve->set_inputfocus();
}
void GeCurveGtk::activate_background( GtkWidget *w, gpointer data)
......@@ -205,6 +237,11 @@ void GeCurveGtk::open_minmax( int idx)
minmax_idx = idx;
}
void GeCurveGtk::set_inputfocus()
{
gtk_widget_grab_focus( growcurve_main_widget);
}
GeCurveGtk::~GeCurveGtk()
{
delete wow;
......@@ -224,6 +261,19 @@ static void destroy_event( GtkWidget *w, gpointer data)
{
}
gboolean GeCurveGtk::action_inputfocus( GtkWidget *w, GdkEvent *event, gpointer data)
{
GeCurveGtk *curve = (GeCurveGtk *)data;
if ( curve->focustimer.disabled())
return TRUE;
curve->set_inputfocus();
curve->focustimer.disable( 400);
return FALSE;
}
GeCurveGtk::GeCurveGtk( void *gc_parent_ctx,
GtkWidget *parent_widget,
char *curve_name,
......@@ -250,6 +300,7 @@ GeCurveGtk::GeCurveGtk( void *gc_parent_ctx,
g_signal_connect( toplevel, "delete_event", G_CALLBACK(delete_event), this);
g_signal_connect( toplevel, "destroy", G_CALLBACK(destroy_event), this);
g_signal_connect( toplevel, "focus-in-event", G_CALLBACK(action_inputfocus), this);
CoWowGtk::SetWindowIcon( toplevel);
......@@ -356,26 +407,61 @@ GeCurveGtk::GeCurveGtk( void *gc_parent_ctx,
GtkToolbar *tools = (GtkToolbar *) g_object_new(GTK_TYPE_TOOLBAR, NULL);
GtkWidget *tools_zoom_in = gtk_button_new();
dcli_translate_filename( fname, "$pwr_exe/ge_zoom_in.png");
dcli_translate_filename( fname, "$pwr_exe/xtt_zoom_in.png");
gtk_container_add( GTK_CONTAINER(tools_zoom_in),
gtk_image_new_from_file( fname));
g_signal_connect(tools_zoom_in, "clicked", G_CALLBACK(activate_zoomin), this);
g_object_set( tools_zoom_in, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, tools_zoom_in, CoWowGtk::translate_utf8("Zoom in"), "");
GtkWidget *tools_zoom_out = gtk_button_new();
dcli_translate_filename( fname, "$pwr_exe/ge_zoom_out.png");
dcli_translate_filename( fname, "$pwr_exe/xtt_zoom_out.png");
gtk_container_add( GTK_CONTAINER(tools_zoom_out),
gtk_image_new_from_file( fname));
g_signal_connect(tools_zoom_out, "clicked", G_CALLBACK(activate_zoomout), this);
g_object_set( tools_zoom_out, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, tools_zoom_out, CoWowGtk::translate_utf8("Zoom out"), "");
GtkWidget *tools_zoom_reset = gtk_button_new();
dcli_translate_filename( fname, "$pwr_exe/ge_zoom_reset.png");
dcli_translate_filename( fname, "$pwr_exe/xtt_zoom_reset.png");
gtk_container_add( GTK_CONTAINER(tools_zoom_reset),
gtk_image_new_from_file( fname));
g_signal_connect(tools_zoom_reset, "clicked", G_CALLBACK(activate_zoomreset), this);
g_object_set( tools_zoom_reset, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, tools_zoom_reset, CoWowGtk::translate_utf8("Zoom reset"), "");
GtkWidget *tools_page_left = gtk_button_new();
dcli_translate_filename( fname, "$pwr_exe/ge_page_left.png");
gtk_container_add( GTK_CONTAINER(tools_page_left),
gtk_image_new_from_file( fname));
g_signal_connect(tools_page_left, "clicked", G_CALLBACK(activate_page_left), this);
g_object_set( tools_page_left, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, tools_page_left, CoWowGtk::translate_utf8("Page left"), "");
GtkWidget *tools_scroll_left = gtk_button_new();
dcli_translate_filename( fname, "$pwr_exe/ge_scroll_left.png");
gtk_container_add( GTK_CONTAINER(tools_scroll_left),
gtk_image_new_from_file( fname));
g_signal_connect(tools_scroll_left, "clicked", G_CALLBACK(activate_scroll_left), this);
g_object_set( tools_scroll_left, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, tools_scroll_left, CoWowGtk::translate_utf8("Scroll left"), "");
GtkWidget *tools_scroll_right = gtk_button_new();
dcli_translate_filename( fname, "$pwr_exe/ge_scroll_right.png");
gtk_container_add( GTK_CONTAINER(tools_scroll_right),
gtk_image_new_from_file( fname));
g_signal_connect(tools_scroll_right, "clicked", G_CALLBACK(activate_scroll_right), this);
g_object_set( tools_scroll_right, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, tools_scroll_right, CoWowGtk::translate_utf8("Scroll right"), "");
GtkWidget *tools_page_right = gtk_button_new();
dcli_translate_filename( fname, "$pwr_exe/ge_page_right.png");
gtk_container_add( GTK_CONTAINER(tools_page_right),
gtk_image_new_from_file( fname));
g_signal_connect(tools_page_right, "clicked", G_CALLBACK(activate_page_right), this);
g_object_set( tools_page_right, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, tools_page_right, CoWowGtk::translate_utf8("Page right"), "");
GtkWidget *w;
grownames_main_widget = scrolledgrowwidgetgtk_new( init_grownames_cb, this, &w);
......@@ -441,6 +527,8 @@ void GeCurveGtk::create_minmax_dialog()
GtkWidget *min_label = gtk_label_new(CoWowGtk::translate_utf8("MinValue"));
gtk_widget_set_size_request( min_label, 100, -1);
minmax_textmax_widget = gtk_entry_new();
g_signal_connect( minmax_textmax_widget, "activate",
G_CALLBACK(activate_minmax_ok), this);
GtkWidget *max_label = gtk_label_new(CoWowGtk::translate_utf8("MaxValue"));
gtk_widget_set_size_request( max_label, 100, -1);
......
/*
* Proview $Id: ge_curve_gtk.h,v 1.1 2007-01-04 08:21:58 claes Exp $
* Proview $Id: ge_curve_gtk.h,v 1.2 2007-01-15 13:19:09 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -26,6 +26,8 @@
#include "ge_curve.h"
#endif
#include "co_wow_gtk.h"
class GeCurveGtk : public GeCurve {
public:
GeCurveGtk( void *gc_parent_ctx, GtkWidget *parent_widget, char *curve_name,
......@@ -45,6 +47,7 @@ class GeCurveGtk : public GeCurve {
GtkWidget *minmax_widget;
GtkWidget *minmax_textmin_widget;
GtkWidget *minmax_textmax_widget;
CoWowFocusTimerGtk focustimer;
void pop();
void write_title( char *str);
......@@ -52,6 +55,7 @@ class GeCurveGtk : public GeCurve {
void open_minmax( int idx);
void axis_set_width( int width);
void create_minmax_dialog();
void set_inputfocus();
~GeCurveGtk();
......@@ -61,6 +65,10 @@ class GeCurveGtk : public GeCurve {
static void activate_zoomin( GtkWidget *w, gpointer data);
static void activate_zoomout( GtkWidget *w, gpointer data);
static void activate_zoomreset( GtkWidget *w, gpointer data);
static void activate_page_left( GtkWidget *w, gpointer data);
static void activate_page_right( GtkWidget *w, gpointer data);
static void activate_scroll_left( GtkWidget *w, gpointer data);
static void activate_scroll_right( GtkWidget *w, gpointer data);
static void activate_background( GtkWidget *w, gpointer data);
static void activate_showname( GtkWidget *w, gpointer data);
static void activate_filledcurves( GtkWidget *w, gpointer data);
......@@ -68,6 +76,7 @@ class GeCurveGtk : public GeCurve {
static void activate_help( GtkWidget *w, gpointer data);
static void activate_minmax_ok( GtkWidget *w, gpointer data);
static void activate_minmax_cancel( GtkWidget *w, gpointer data);
static gboolean action_inputfocus( GtkWidget *w, GdkEvent *event, gpointer data);
};
#endif
......
/*
* Proview $Id: ge_curve.cpp,v 1.15 2007-01-04 08:18:35 claes Exp $
* Proview $Id: ge_curve.cpp,v 1.16 2007-01-15 13:19:09 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -290,6 +290,24 @@ int GeCurve::growcurve_cb( GlowCtx *ctx, glow_tEvent event)
grow_SetAnnotation( curve->cursor_annot[0], 0, str, strlen(str));
break;
}
case glow_eEvent_Key_Left:
curve_Scroll( curve->growcurve_ctx, 0.1);
break;
case glow_eEvent_Key_Right:
curve_Scroll( curve->growcurve_ctx, -0.1);
break;
case glow_eEvent_Key_Up:
curve_Zoom( curve->growcurve_ctx, 1.5);
break;
case glow_eEvent_Key_Down:
curve_Zoom( curve->growcurve_ctx, 0.75);
break;
case glow_eEvent_ScrollUp:
curve_Scroll( curve->growcurve_ctx, 0.05);
break;
case glow_eEvent_ScrollDown:
curve_Scroll( curve->growcurve_ctx, -0.05);
break;
default:
;
}
......@@ -331,6 +349,18 @@ int GeCurve::init_growcurve_cb( GlowCtx *fctx, void *client_data)
glow_eEventType_CallBack, growcurve_cb);
grow_EnableEvent( (GrowCtx *)curve->growcurve_ctx, glow_eEvent_MB1Press,
glow_eEventType_MoveNode, growcurve_cb);
grow_EnableEvent( (GrowCtx *)curve->growcurve_ctx, glow_eEvent_Key_Left,
glow_eEventType_CallBack, growcurve_cb);
grow_EnableEvent( (GrowCtx *)curve->growcurve_ctx, glow_eEvent_Key_Right,
glow_eEventType_CallBack, growcurve_cb);
grow_EnableEvent( (GrowCtx *)curve->growcurve_ctx, glow_eEvent_Key_Up,
glow_eEventType_CallBack, growcurve_cb);
grow_EnableEvent( (GrowCtx *)curve->growcurve_ctx, glow_eEvent_Key_Down,
glow_eEventType_CallBack, growcurve_cb);
grow_EnableEvent( (GrowCtx *)curve->growcurve_ctx, glow_eEvent_ScrollUp,
glow_eEventType_CallBack, growcurve_cb);
grow_EnableEvent( (GrowCtx *)curve->growcurve_ctx, glow_eEvent_ScrollDown,
glow_eEventType_CallBack, growcurve_cb);
grow_CreateGrowCurve( curve->growcurve_ctx, "curve", NULL, 0, 0, 200, 30,
curve->curve_border, 2, glow_mDisplayLevel_1, 1, 1,
......@@ -666,6 +696,11 @@ int GeCurve::init_grownames_cb( GlowCtx *fctx, void *client_data)
return 1;
}
void GeCurve::scroll( double value)
{
curve_Scroll( growcurve_ctx, value);
}
void GeCurve::print( char *filename)
{
double x;
......
/*
* Proview $Id: ge_curve.h,v 1.9 2007-01-04 08:18:35 claes Exp $
* Proview $Id: ge_curve.h,v 1.10 2007-01-15 13:19:09 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -135,6 +135,7 @@ class GeCurve {
virtual void resize() {}
virtual void open_minmax( int idx) {}
virtual void axis_set_width( int width) {}
void set_inputfocus() {}
int read_file( char *filename);
int configure_curves();
......@@ -143,6 +144,7 @@ class GeCurve {
void set_title( char *str);
void set_time( pwr_tTime time);
void print( char *filename);
void scroll( double value);
void activate_exit();
void activate_configure();
void activate_print();
......
/*
* Proview $Id: glow_curvewidget_gtk.cpp,v 1.1 2007-01-04 08:07:43 claes Exp $
* Proview $Id: glow_curvewidget_gtk.cpp,v 1.2 2007-01-15 13:19:09 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -210,6 +210,14 @@ static gboolean curvewidgetgtk_expose( GtkWidget *glow, GdkEventExpose *event)
return TRUE;
}
static void curvewidgetgtk_grab_focus( GtkWidget *glow)
{
if ( !glow->window)
return;
GTK_WIDGET_CLASS( curvewidgetgtk_parent_class)->grab_focus( glow);
gdk_window_focus( glow->window, GDK_CURRENT_TIME);
}
static gboolean curvewidgetgtk_event( GtkWidget *glow, GdkEvent *event)
{
if ( !((CurveWidgetGtk *)glow)->curve_ctx)
......@@ -310,6 +318,7 @@ static void curvewidgetgtk_class_init( CurveWidgetGtkClass *klass)
widget_class->realize = curvewidgetgtk_realize;
widget_class->expose_event = curvewidgetgtk_expose;
widget_class->event = curvewidgetgtk_event;
widget_class->grab_focus = curvewidgetgtk_grab_focus;
}
static void curvewidgetgtk_init( CurveWidgetGtk *glow)
......
/*
* Proview $Id: glow_draw_gtk.cpp,v 1.2 2007-01-11 11:40:30 claes Exp $
* Proview $Id: glow_draw_gtk.cpp,v 1.3 2007-01-15 13:19:09 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -949,31 +949,27 @@ int GlowDrawGtk::event_handler( GdkEvent event)
ctx->event_handler( glow_eEvent_CursorMotion, (int)event.button.x, (int)event.button.y, 0, 0);
break;
case GDK_ENTER_NOTIFY:
// printf( "-- Enter event: (%d,%d)\n", event.crossing.x,
// event.crossing.y);
ctx->event_handler( glow_eEvent_Enter, (int)event.crossing.x, (int)event.crossing.y, 0, 0);
break;
case GDK_LEAVE_NOTIFY:
// printf( "-- Leave event: (%d,%d)\n", event.crossing.x,
// event.button.y);
ctx->event_handler( glow_eEvent_Leave, (int)event.crossing.x, (int)event.crossing.y, 0, 0);
break;
case GDK_MAP:
// printf( "-- Enter event: (%d,%d)\n", event.button.x,
// event.button.y);
ctx->event_handler( glow_eEvent_Map, 0, 0, 0, 0);
break;
case GDK_UNMAP:
// printf( "-- Enter event: (%d,%d)\n", event.button.x,
// event.button.y);
ctx->event_handler( glow_eEvent_Unmap, 0, 0, 0, 0);
break;
case GDK_FOCUS_CHANGE:
// printf( "-- Focus in event\n");
break;
case GDK_SCROLL:
if ( event.scroll.direction == GDK_SCROLL_UP)
ctx->event_handler( glow_eEvent_ScrollUp, 0, 0, 0, 0);
else if ( event.scroll.direction == GDK_SCROLL_DOWN)
ctx->event_handler( glow_eEvent_ScrollDown, 0, 0, 0, 0);
break;
default:
// printf("-- Other event: %d \n", event.type);
break;
}
}
......@@ -1848,11 +1844,11 @@ void GlowDrawGtk::copy_area( GlowWind *wind, int x, int y)
if ( x)
gdk_draw_rectangle( w->buffer,
get_gc( this, glow_eDrawType_LineErase, 0), 1,
window_width+x, 0, window_width, window_height);
window_width+x, 0, -x, window_height);
if ( y)
gdk_draw_rectangle( w->buffer,
get_gc( this, glow_eDrawType_LineErase, 0), 1,
0, window_height+y, window_width+x, window_height);
0, window_height+y, window_width+x, -y);
}
}
else if ( x <= 0 && y >= 0)
......@@ -1873,14 +1869,14 @@ void GlowDrawGtk::copy_area( GlowWind *wind, int x, int y)
if ( x)
gdk_draw_rectangle( w->buffer,
get_gc( this, glow_eDrawType_LineErase, 0), 1,
window_width+x, 0, window_width, window_height);
window_width+x, 0, -x, window_height);
if ( y)
gdk_draw_rectangle( w->buffer,
get_gc( this, glow_eDrawType_LineErase, 0), 1,
0, 0, window_width+x, y);
}
}
else
else // x > 0 && y < 0
{
gdk_draw_drawable( w->window, gc, w->window,
0, -y, x, 0, window_width-x, window_height+y);
......@@ -1902,7 +1898,7 @@ void GlowDrawGtk::copy_area( GlowWind *wind, int x, int y)
if ( y)
gdk_draw_rectangle( w->buffer,
get_gc( this, glow_eDrawType_LineErase, 0), 1,
x, window_height+y, window_width, window_height);
x, window_height+y, window_width - x, -y);
}
}
}
......@@ -2386,7 +2382,7 @@ int GlowDrawGtk::print( char *filename, double x0, double x1, int end)
if ( new_file) {
ps->fp <<
"%!PS-Adobe-2.0 EPSF-1.2" << endl <<
"%%Creator: Proview $Id: glow_draw_gtk.cpp,v 1.2 2007-01-11 11:40:30 claes Exp $ Glow" << endl <<
"%%Creator: Proview $Id: glow_draw_gtk.cpp,v 1.3 2007-01-15 13:19:09 claes Exp $ Glow" << endl <<
"%%EndComments" << endl << endl;
}
else
......
/*
* Proview $Id: glow.h,v 1.16 2007-01-04 07:57:38 claes Exp $
* Proview $Id: glow.h,v 1.17 2007-01-15 13:19:09 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -907,6 +907,8 @@ typedef enum {
glow_eEvent_MenuActivated, //!< Menu is activated.
glow_eEvent_MenuCreate, //!< Create pulldown menu.
glow_eEvent_MenuDelete, //!< Delete pulldown menu.
glow_eEvent_ScrollUp, //!< Scroll up.
glow_eEvent_ScrollDown, //!< Scroll down.
glow_eEvent__
} glow_eEvent;
......
/*
* Proview $Id: glow_ctx.cpp,v 1.11 2007-01-04 07:57:38 claes Exp $
* Proview $Id: glow_ctx.cpp,v 1.12 2007-01-15 13:19:09 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -563,7 +563,7 @@ void GlowCtx::draw( GlowWind *w, int ll_x, int ll_y, int ur_x, int ur_y)
{
int i;
if ( ctx_type == glow_eCtxType_Grow) {
if ( ctx_type == glow_eCtxType_Grow || ctx_type == glow_eCtxType_Curve) {
((GrowCtx *)this)->draw( w, ll_x, ll_y, ur_x, ur_y);
return;
}
......
/*
* Proview $Id: glow_curveapi.cpp,v 1.2 2005-09-01 14:57:53 claes Exp $
* Proview $Id: glow_curveapi.cpp,v 1.3 2007-01-15 13:19:09 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -33,6 +33,11 @@ void curve_Zoom( CurveCtx *ctx, double factor)
ctx->zoom( factor);
}
void curve_Unzoom( CurveCtx *ctx)
{
ctx->unzoom();
}
void curve_GetZoom( CurveCtx *ctx, double *factor_x, double *factor_y)
{
ctx->get_zoom( factor_x, factor_y);
......@@ -43,7 +48,10 @@ void curve_GetPreferedZoomY( CurveCtx *ctx, int height, double *factor_y)
ctx->get_prefered_zoom_y( height, factor_y);
}
void curve_Scroll( CurveCtx *ctx, double value)
{
ctx->scroll( value);
}
......
/*
* Proview $Id: glow_curveapi.h,v 1.3 2007-01-04 07:57:38 claes Exp $
* Proview $Id: glow_curveapi.h,v 1.4 2007-01-15 13:19:09 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -37,8 +37,10 @@ typedef void *GlowCtx;
typedef CurveCtx *curve_tCtx;
void curve_Zoom( CurveCtx *ctx, double factor);
void curve_Unzoom( CurveCtx *ctx);
void curve_GetZoom( CurveCtx *ctx, double *factor_x, double *factor_y);
void curve_GetPreferedZoomY( CurveCtx *ctx, int height, double *factor_y);
void curve_Scroll( CurveCtx *ctx, double value);
#if defined __cplusplus
}
......
/*
* Proview $Id: glow_curvectx.cpp,v 1.3 2007-01-04 07:57:38 claes Exp $
* Proview $Id: glow_curvectx.cpp,v 1.4 2007-01-15 13:19:09 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -77,14 +77,8 @@ void CurveCtx::zoom( double factor)
if ( fabs(factor) < DBL_EPSILON)
return;
// cout << "Before zoom zoom factor : " << zoom_factor_x << ", offset : " <<
// offset_x << "," << offset_y << endl;
mw.zoom_factor_x *= factor;
// zoom_factor_y *= factor;
mw.offset_x = int( (mw.offset_x - mw.window_width / 2.0 * ( 1.0/factor - 1)) * factor);
// offset_y = int( (offset_y - window_height / 2.0 * ( 1.0/factor - 1)) * factor);
// cout << "After zoom zoom factor : " << zoom_factor_x << ", offset : " <<
// offset_x << "," << offset_y << endl;
a.zoom();
clear( &mw);
draw( &mw, 0, 0, mw.window_width, mw.window_height);
......@@ -139,6 +133,19 @@ void CurveCtx::get_prefered_zoom_y( int height, double *factor_y)
*factor_y = height / (y_high - y_low);
}
void CurveCtx::scroll( double value)
{
int x_pix;
if ( value < 0 && mw.offset_x + mw.window_width >= int( x_right * mw.zoom_factor_x))
return;
else if ( value > 0 && mw.offset_x <= int( x_left * mw.zoom_factor_x))
return;
x_pix = int( mw.window_width * value);
((GlowCtx *)this)->scroll( x_pix, 0);
}
int CurveCtx::event_handler_nav( glow_eEvent event, int x, int y)
{
GlowCtx *ctx;
......@@ -308,7 +315,7 @@ void curve_scroll_horizontal( CurveCtx *ctx, int value, int bottom)
x_pix = int( - value * ctx->scroll_size * ctx->mw.zoom_factor_x +
(ctx->mw.offset_x - ctx->x_left * ctx->mw.zoom_factor_x));
ctx->scroll( x_pix, 0);
((GlowCtx *)ctx)->scroll( x_pix, 0);
}
void curve_scroll_vertical( CurveCtx *ctx, int value, int bottom)
......@@ -323,7 +330,7 @@ void curve_scroll_vertical( CurveCtx *ctx, int value, int bottom)
// window_height >= (y_high - y_low) * zoom_factor_y)
y_pix = int( ctx->mw.window_height + ctx->mw.offset_y -
ctx->y_high * ctx->mw.zoom_factor_y);
ctx->scroll( 0, y_pix);
((GlowCtx *)ctx)->scroll( 0, y_pix);
}
......
/*
* Proview $Id: glow_curvectx.h,v 1.2 2005-09-01 14:57:53 claes Exp $
* Proview $Id: glow_curvectx.h,v 1.3 2007-01-15 13:19:09 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -34,10 +34,12 @@ class CurveCtx : public GrowCtx {
int layout_adjusted;
void configure();
void zoom( double factor);
void unzoom() { zoom( mw.base_zoom_factor / mw.zoom_factor_x);};
void nav_zoom();
void get_zoom( double *factor_x, double *factor_y);
void get_prefered_zoom_y( int height, double *factor_y);
void adjust_layout();
void scroll( double value);
int event_handler_nav( glow_eEvent event, int x, int y);
~CurveCtx() {};
};
......
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