Commit 7b8ab516 authored by claes's avatar claes

Event ScrollUp and ScrollDown added

parent 2591f944
/*
* Proview $Id: rt_trace.cpp,v 1.1 2007-01-04 07:52:31 claes Exp $
* Proview $Id: rt_trace.cpp,v 1.2 2007-01-17 06:22:47 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -800,6 +800,12 @@ int RtTrace::flow_cb( FlowCtx *ctx, flow_tEvent event)
case flow_eEvent_SelectClear:
flow_ResetSelectInverse( ctx);
break;
case flow_eEvent_ScrollDown:
flow_Scroll( ctx, 0, -0.05);
break;
case flow_eEvent_ScrollUp:
flow_Scroll( ctx, 0, 0.05);
break;
default:
;
}
......@@ -887,6 +893,10 @@ pwr_tStatus RtTrace::viewsetup()
flow_cb);
flow_EnableEvent( ctx, flow_eEvent_SelectClear, flow_eEventType_CallBack,
flow_cb);
flow_EnableEvent( ctx, flow_eEvent_ScrollDown, flow_eEventType_CallBack,
flow_cb);
flow_EnableEvent( ctx, flow_eEvent_ScrollUp, flow_eEventType_CallBack,
flow_cb);
return 1;
}
......@@ -918,6 +928,10 @@ pwr_tStatus RtTrace::simsetup()
flow_cb);
flow_EnableEvent( ctx, flow_eEvent_SelectClear, flow_eEventType_CallBack,
flow_cb);
flow_EnableEvent( ctx, flow_eEvent_ScrollDown, flow_eEventType_CallBack,
flow_cb);
flow_EnableEvent( ctx, flow_eEvent_ScrollUp, flow_eEventType_CallBack,
flow_cb);
return 1;
}
......@@ -944,6 +958,10 @@ pwr_tStatus RtTrace::trasetup()
flow_cb);
flow_EnableEvent( ctx, flow_eEvent_SelectClear, flow_eEventType_CallBack,
flow_cb);
flow_EnableEvent( ctx, flow_eEvent_ScrollDown, flow_eEventType_CallBack,
flow_cb);
flow_EnableEvent( ctx, flow_eEvent_ScrollUp, flow_eEventType_CallBack,
flow_cb);
return 1;
}
......
/*
* Proview $Id: wb_gre.cpp,v 1.1 2007-01-04 07:29:03 claes Exp $
* Proview $Id: wb_gre.cpp,v 1.2 2007-01-17 06:21:33 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -1589,6 +1589,12 @@ int WGre::flow_cb( FlowCtx *ctx, flow_tEvent event)
case flow_eEvent_SelectClear:
flow_ResetSelectHighlight( ctx);
break;
case flow_eEvent_ScrollDown:
flow_Scroll( ctx, 0, -0.05);
break;
case flow_eEvent_ScrollUp:
flow_Scroll( ctx, 0, 0.05);
break;
default:
;
}
......@@ -1738,6 +1744,10 @@ int WGre::edit_setup()
flow_cb);
flow_EnableEvent( ctx, flow_eEvent_ObjectMoved, flow_eEventType_CallBack,
flow_cb);
flow_EnableEvent( ctx, flow_eEvent_ScrollUp, flow_eEventType_CallBack,
flow_cb);
flow_EnableEvent( ctx, flow_eEvent_ScrollDown, flow_eEventType_CallBack,
flow_cb);
return 1;
}
......@@ -1768,6 +1778,10 @@ int WGre::view_setup()
flow_cb);
flow_EnableEvent( ctx, flow_eEvent_SelectClear, flow_eEventType_CallBack,
flow_cb);
flow_EnableEvent( ctx, flow_eEvent_ScrollUp, flow_eEventType_CallBack,
flow_cb);
flow_EnableEvent( ctx, flow_eEvent_ScrollDown, flow_eEventType_CallBack,
flow_cb);
return 1;
}
......
/*
* Proview $Id: flow_api.cpp,v 1.6 2007-01-04 07:53:34 claes Exp $
* Proview $Id: flow_api.cpp,v 1.7 2007-01-17 06:19:26 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -505,6 +505,11 @@ void flow_ZoomAbsolute( flow_tCtx ctx, double zoom_factor)
ctx->zoom_absolute( zoom_factor);
}
void flow_Scroll( flow_tCtx ctx, double x, double y)
{
ctx->scroll( x, y);
}
void flow_SetAttributes( flow_tCtx ctx, flow_sAttributes *attr,
unsigned long mask)
{
......
/*
* Proview $Id: flow_api.h,v 1.6 2007-01-04 07:53:34 claes Exp $
* Proview $Id: flow_api.h,v 1.7 2007-01-17 06:19:26 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -201,6 +201,7 @@ void flow_TraceScan( flow_tCtx ctx);
void flow_RemoveTraceObjects( flow_tCtx ctx);
void flow_Zoom( flow_tCtx ctx, double zoom_factor);
void flow_ZoomAbsolute( flow_tCtx ctx, double zoom_factor);
void flow_Scroll( flow_tCtx ctx, double x, double y);
void flow_SetAttributes( flow_tCtx ctx, flow_sAttributes *attr,
unsigned long mask);
void flow_GetAttributes( flow_tCtx ctx, flow_sAttributes *attr);
......
/*
* Proview $Id: flow_ctx.cpp,v 1.6 2007-01-04 07:53:35 claes Exp $
* Proview $Id: flow_ctx.cpp,v 1.7 2007-01-17 06:19:26 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -1669,6 +1669,27 @@ void FlowCtx::change_scrollbar()
(scroll_callback)( &data);
}
void FlowCtx::scroll( double x, double y)
{
int delta_x = int( x * window_width);
int delta_y = int( y * window_height);
if ( delta_y < 0 && offset_y + window_height > y_high * zoom_factor)
delta_y = 0;
else if ( delta_y > 0 && offset_y < y_low * zoom_factor)
delta_y = 0;
if ( delta_x < 0 && offset_x + window_width > x_right * zoom_factor)
delta_x = 0;
else if ( delta_x > 0 && offset_x < x_left * zoom_factor)
delta_x = 0;
if ( delta_x == 0 && delta_y == 0)
return;
scroll( delta_x, delta_y);
}
void FlowCtx::scroll( int delta_x, int delta_y)
{
offset_x -= delta_x;
......
/*
* Proview $Id: flow_ctx.h,v 1.3 2007-01-04 07:53:35 claes Exp $
* Proview $Id: flow_ctx.h,v 1.4 2007-01-17 06:19:26 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -307,6 +307,7 @@ class FlowCtx {
void move_widgets( int x, int y) { if ( widget_cnt) a.move_widgets( x, y);};
int display_level;
void scroll( int delta_x, int delta_y);
void scroll( double delta_x, double delta_y);
double scroll_size;
void (*scroll_callback)( flow_sScroll *);
void *scroll_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