Mercurial > octave-antonio
diff libinterp/dldfcn/__init_fltk__.cc @ 18968:0257a936dc4a
Fix FLTK redraw and event issue
* __init_fltk__.cc: Move axis auto code in own function (again).
Fix event issue where windowbuttondownfcn was called before
set_currentpoint and execute event only if it's defined.
* __add_default_menu__.m: Add drawnow () for grid and axis callback
author | Andreas Weber <andy.weber.aw@gmail.com> |
---|---|
date | Tue, 29 Jul 2014 21:13:03 +0200 |
parents | b2db129c664d |
children | f84361735a40 |
line wrap: on
line diff
--- a/libinterp/dldfcn/__init_fltk__.cc Tue Jul 29 10:18:05 2014 +0200 +++ b/libinterp/dldfcn/__init_fltk__.cc Tue Jul 29 21:13:03 2014 +0200 @@ -946,12 +946,7 @@ void button_press (Fl_Widget* widg, void*) { if (widg == autoscale) - { - set_on_ax_obj ("xlimmode", "auto"); - set_on_ax_obj ("ylimmode", "auto"); - set_on_ax_obj ("zlimmode", "auto"); - mark_modified (); - } + axis_auto (); else if (widg == togglegrid) toggle_grid (); else if (widg == panzoom) @@ -995,6 +990,19 @@ int pos_x; int pos_y; + + void axis_auto (void) + { + octave_value_list args; + if (fp.get_currentaxes ().ok ()) + { + args(0) = fp.get_currentaxes ().as_octave_value (); + args(1) = "auto"; + feval ("axis", args); + mark_modified (); + } + } + void toggle_grid (void) { octave_value_list args; @@ -1198,7 +1206,6 @@ if (event == FL_FOCUS) return 1; - Fl_Window::handle (event); graphics_handle gh; if (!fp.is_beingdeleted ()) @@ -1224,10 +1231,7 @@ { case 'a': case 'A': - set_on_ax_obj ("xlimmode", "auto"); - set_on_ax_obj ("ylimmode", "auto"); - set_on_ax_obj ("zlimmode", "auto"); - mark_modified (); + axis_auto (); return 1; case 'g': @@ -1278,13 +1282,14 @@ return 1; case FL_PUSH: - fp.execute_windowbuttondownfcn (Fl::event_button()); - pos_x = Fl::event_x (); pos_y = Fl::event_y () - menu_dy (); set_currentpoint (pos_x, pos_y); + if (fp.get_windowbuttonupfcn ().is_defined ()) + fp.execute_windowbuttondownfcn (Fl::event_button()); + gh = pixel2axes_or_ca (pos_x, pos_y); if (gh.ok ())