Mercurial > hg > octave-lyh
changeset 9802:9b4a301d88ed
fix for fltk zoom box problems
author | Shai Ayal <shaiay@users.sourceforge.net> |
---|---|
date | Wed, 11 Nov 2009 10:46:36 -0500 |
parents | 13868ea67c71 |
children | f5126ea721e2 |
files | src/ChangeLog src/DLD-FUNCTIONS/fltk_backend.cc |
diffstat | 2 files changed, 39 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,15 @@ +2009-11-11 Shai Ayal <shaiay@users.sourceforge.net> + + * DLD-FUNCTIONS/fltk_backend.cc (Fl_Gl_Window::draw): + If zooming, call overlay. + (Fl_Gl_Window::overlay): Rename from draw_overlay. + Don't return early if zooming. Don't call valid and conditionally + call setup_veiwport. Set overlay color and draw line around zoom + box. + (Fl_Gl_Window::zoom_box_vertex): New function. + (Fl_Gl_Window::pixel2status): Call canvas->redraw, not + canvas->redraw_overlay. + 2009-11-10 Shai Ayal <shaiay@users.sourceforge.net> * gl2ps-renderer.cc, gl2ps-renderer.h, gl2ps.c, gl2ps.h:
--- a/src/DLD-FUNCTIONS/fltk_backend.cc +++ b/src/DLD-FUNCTIONS/fltk_backend.cc @@ -142,6 +142,9 @@ else { renderer.draw (gh_manager::lookup (number)); + + if (zoom ()) + overlay (); } } @@ -152,17 +155,17 @@ redraw (); } - void draw_overlay (void) + void zoom_box_vertex (void) { - if (! in_zoom) - return; - - if (! valid ()) - { - valid (1); - setup_viewport (w (), h ()); - } - + glVertex2d (zoom_box(0), h () - zoom_box(1)); + glVertex2d (zoom_box(0), h () - zoom_box(3)); + glVertex2d (zoom_box(2), h () - zoom_box(3)); + glVertex2d (zoom_box(2), h () - zoom_box(1)); + glVertex2d (zoom_box(0), h () - zoom_box(1)); + } + + void overlay (void) + { glPushMatrix (); glMatrixMode (GL_MODELVIEW); @@ -175,14 +178,15 @@ glPushAttrib (GL_DEPTH_BUFFER_BIT | GL_CURRENT_BIT); glDisable (GL_DEPTH_TEST); - glLineWidth (1); + glBegin (GL_POLYGON); + glColor4f (0.45, 0.62, 0.81, 0.1); + zoom_box_vertex (); + glEnd (); + glBegin (GL_LINE_STRIP); - gl_color(0); - glVertex2d (zoom_box(0), h () - zoom_box(1)); - glVertex2d (zoom_box(0), h () - zoom_box(3)); - glVertex2d (zoom_box(2), h () - zoom_box(3)); - glVertex2d (zoom_box(2), h () - zoom_box(1)); - glVertex2d (zoom_box(0), h () - zoom_box(1)); + glLineWidth (1.5); + glColor4f (0.45, 0.62, 0.81, 0.9); + zoom_box_vertex (); glEnd (); glPopAttrib (); @@ -403,13 +407,14 @@ return fp.get_currentaxes (); } - void pixel2status - (graphics_handle ax, int px0, int py0, int px1 = -1, int py1 = -1) + void pixel2status (graphics_handle ax, int px0, int py0, + int px1 = -1, int py1 = -1) { pixel2status (gh_manager::get_object (ax), px0, py0, px1, py1); } - void pixel2status - (graphics_object ax, int px0, int py0, int px1 = -1, int py1 = -1) + + void pixel2status (graphics_object ax, int px0, int py0, + int px1 = -1, int py1 = -1) { double x0, y0, x1, y1; std::stringstream cbuf; @@ -520,7 +525,7 @@ zoom_box (3) = Fl::event_y (); canvas->set_zoom_box (zoom_box); canvas->zoom (true); - canvas->redraw_overlay (); + canvas->redraw (); } break;