Commit 6a1ca26a authored by claes's avatar claes

Scroll events added

parent 2100c210
/*
* Proview $Id: ge_graph.cpp,v 1.35 2007-01-11 11:40:30 claes Exp $
* Proview $Id: ge_graph.cpp,v 1.36 2007-01-17 10:31:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -2396,6 +2396,16 @@ static int graph_grow_cb( GlowCtx *ctx, glow_tEvent event)
event->translate.new_text = new_text;
return sts;
}
case glow_eEvent_ScrollUp:
{
grow_Scroll( graph->grow->ctx, 0, 0.05);
break;
}
case glow_eEvent_ScrollDown:
{
grow_Scroll( graph->grow->ctx, 0, -0.05);
break;
}
default:
;
}
......@@ -2574,6 +2584,10 @@ void GraphGrow::grow_setup()
graph_grow_cb);
grow_EnableEvent( ctx, glow_eEvent_Key_Tab, glow_eEventType_CallBack,
graph_grow_cb);
grow_EnableEvent( ctx, glow_eEvent_ScrollUp, glow_eEventType_CallBack,
graph_grow_cb);
grow_EnableEvent( ctx, glow_eEvent_ScrollDown, glow_eEventType_CallBack,
graph_grow_cb);
grow_RegisterUserDataCallbacks( ctx, graph_userdata_save_cb, graph_userdata_open_cb,
graph_userdata_copy_cb);
......
/*
* Proview $Id: glow_ctx.cpp,v 1.12 2007-01-15 13:19:09 claes Exp $
* Proview $Id: glow_ctx.cpp,v 1.13 2007-01-17 10:31:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -1914,6 +1914,28 @@ void GlowCtx::change_scrollbar()
(scroll_callback)( &data);
}
void GlowCtx::scroll( double x, double y)
{
int delta_x = int( x * mw.window_width);
int delta_y = int( y * mw.window_height);
if ( delta_y < 0 && mw.offset_y + mw.window_height > y_high * mw.zoom_factor_y)
delta_y = 0;
else if ( delta_y > 0 && mw.offset_y < y_low * mw.zoom_factor_y)
delta_y = 0;
if ( delta_x < 0 && mw.offset_x + mw.window_width > x_right * mw.zoom_factor_x)
delta_x = 0;
else if ( delta_x > 0 && mw.offset_x < x_left * mw.zoom_factor_x)
delta_x = 0;
if ( delta_x == 0 && delta_y == 0)
return;
scroll( delta_x, delta_y);
change_scrollbar();
}
void GlowCtx::scroll( int delta_x, int delta_y)
{
mw.offset_x -= delta_x;
......
/*
* Proview $Id: glow_ctx.h,v 1.10 2007-01-04 07:57:38 claes Exp $
* Proview $Id: glow_ctx.h,v 1.11 2007-01-17 10:31:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -773,6 +773,13 @@ class GlowCtx {
int display_level; //!< Current display level.
//! Scroll the window the specified distance.
/*!
\param delta_x Scroll this factor in relation to window size in x direction.
\param delta_y Scroll this factor in relation to window size in y direction.
*/
void scroll( double x, double y);
//! Scroll the window the specified distance.
/*!
\param delta_x Scroll distance in x direction in pixel.
......
/*
* Proview $Id: glow_growapi.cpp,v 1.25 2007-01-04 07:57:38 claes Exp $
* Proview $Id: glow_growapi.cpp,v 1.26 2007-01-17 10:31:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -619,6 +619,11 @@ void grow_GetZoom( grow_tCtx ctx, double *zoom_factor)
*zoom_factor = ctx->mw.zoom_factor_x;
}
void grow_Scroll( grow_tCtx ctx, double x, double y)
{
ctx->scroll( x, y);;
}
void grow_SetAttributes( grow_tCtx ctx, grow_sAttributes *attr,
unsigned long mask)
{
......
/*
* Proview $Id: glow_growapi.h,v 1.22 2007-01-04 07:57:38 claes Exp $
* Proview $Id: glow_growapi.h,v 1.23 2007-01-17 10:31:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -670,6 +670,14 @@ extern "C" {
*/
void grow_GetZoom( grow_tCtx ctx, double *zoom_factor);
//! Scroll window.
/*!
\param ctx Grow context.
\param x Scrollfactor of window size in x direction.
\param y Scrollfactor of window size in y direction.
*/
void grow_Scroll( grow_tCtx ctx, double x, double y);
//! Set attributes of the grow context.
/*!
\param ctx Grow context.
......
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