equal
deleted
inserted
replaced
91 } |
91 } |
92 |
92 |
93 int GraphDisplayerCanvas::getActualTool() |
93 int GraphDisplayerCanvas::getActualTool() |
94 { |
94 { |
95 return actual_tool; |
95 return actual_tool; |
|
96 } |
|
97 |
|
98 bool GraphDisplayerCanvas::scrollEventHandler(GdkEvent* e) |
|
99 { |
|
100 bool handled=false; |
|
101 if(e->type==GDK_SCROLL) |
|
102 { |
|
103 |
|
104 //pointer shows this win point before zoom |
|
105 XY win_coord(((GdkEventScroll*)e)->x, ((GdkEventScroll*)e)->y); |
|
106 |
|
107 //the original scroll settings |
|
108 int scroll_offset_x, scroll_offset_y; |
|
109 get_scroll_offsets(scroll_offset_x, scroll_offset_y); |
|
110 |
|
111 //pointer shows this canvas point before zoom |
|
112 XY canvas_coord; |
|
113 window_to_world(win_coord.x, win_coord.y, canvas_coord.x, canvas_coord.y); |
|
114 |
|
115 if(((GdkEventScroll*)e)->direction) //IN |
|
116 { |
|
117 zoomIn(); |
|
118 } |
|
119 else |
|
120 { |
|
121 zoomOut(); |
|
122 } |
|
123 |
|
124 //pointer shows this window point after zoom |
|
125 XY post_win_coord; |
|
126 world_to_window(canvas_coord.x, canvas_coord.y, post_win_coord.x, post_win_coord.y); |
|
127 |
|
128 //we have to add the difference between new and old window point to original scroll offset |
|
129 scroll_to(scroll_offset_x+(int)(post_win_coord.x-win_coord.x),scroll_offset_y+(int)(post_win_coord.y-win_coord.y)); |
|
130 |
|
131 //no other eventhandler is needed |
|
132 handled=true; |
|
133 } |
|
134 return handled; |
96 } |
135 } |
97 |
136 |
98 bool GraphDisplayerCanvas::moveEventHandler(GdkEvent* e) |
137 bool GraphDisplayerCanvas::moveEventHandler(GdkEvent* e) |
99 { |
138 { |
100 static Gnome::Canvas::Text *coord_text = 0; |
139 static Gnome::Canvas::Text *coord_text = 0; |