# HG changeset patch # User Konstantinos Poulios # Date 1298821924 -3600 # Node ID 9c831d357e6f31b789c69359f1ae7fb87212753d # Parent 7a5aacf65f81af8dd7364ff50706d7ec8e51340c fix initial canvas size issue diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,4 +1,11 @@ -2010-02-26 Rik +2011-02-26 Konstantinos Poulios + + * DLD-FUNCTIONS/__init_fltk__.cc (plot_window::plot_window): + Move canvas allocation after the configuration of the menubar. + (plot_window::show_menubar, plot_window::hide_menubar): + Simplify source code. + +2011-02-26 Rik * DLD-FUNCTIONS/besselj.cc, DLD-FUNCTIONS/cellfun.cc, DLD-FUNCTIONS/filter.cc, DLD-FUNCTIONS/matrix_type.cc, diff --git a/src/DLD-FUNCTIONS/__init_fltk__.cc b/src/DLD-FUNCTIONS/__init_fltk__.cc --- a/src/DLD-FUNCTIONS/__init_fltk__.cc +++ b/src/DLD-FUNCTIONS/__init_fltk__.cc @@ -720,17 +720,6 @@ status->textfont (FL_COURIER); status->textsize (10); status->box (FL_ENGRAVED_BOX); - - // This allows us to have a valid OpenGL context right away. - canvas->mode (FL_DEPTH | FL_DOUBLE ); - if (fp.is_visible ()) - { - show (); - if (fp.get_currentaxes ().ok()) - show_canvas (); - else - hide_canvas (); - } } end (); @@ -748,6 +737,21 @@ show_menubar (); else hide_menubar (); + + begin (); + { + // This allows us to have a valid OpenGL context right away. + canvas->mode (FL_DEPTH | FL_DOUBLE ); + if (fp.is_visible ()) + { + show (); + if (fp.get_currentaxes ().ok()) + show_canvas (); + else + hide_canvas (); + } + } + end (); } ~plot_window (void) @@ -776,28 +780,28 @@ void show_menubar (void) { - int dm = menu_h; - if (uimenu->is_visible ()) - dm = 0; - canvas->resize (canvas->x (), - canvas->y () + dm, - canvas->w (), - canvas->h () - dm); - uimenu->show (); - mark_modified (); + if (!uimenu->is_visible ()) + { + canvas->resize (canvas->x (), + canvas->y () + menu_h, + canvas->w (), + canvas->h () - menu_h); + uimenu->show (); + mark_modified (); + } } void hide_menubar (void) { - int dm = menu_h; - if (!uimenu->is_visible ()) - dm = 0; - canvas->resize (canvas->x (), - canvas->y () - dm, - canvas->w (), - canvas->h () + dm); - uimenu->hide (); - mark_modified (); + if (uimenu->is_visible ()) + { + canvas->resize (canvas->x (), + canvas->y () - menu_h, + canvas->w (), + canvas->h () + menu_h); + uimenu->hide (); + mark_modified (); + } } void uimenu_update(graphics_handle gh, int id)