changeset 1967:fa525b466aef

Fixed offset bugs with panel tiny and large (also fullscreen mode for large)
author Jorge Arellano Cid <jcid@dillo.org>
date Sat, 16 Apr 2011 16:43:27 -0300
parents f2b37c93764b
children d80adb974879 7bfc11c78869
files src/ui.cc src/ui.hh
diffstat 2 files changed, 17 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/ui.cc	Sat Apr 16 14:11:16 2011 +0000
+++ b/src/ui.cc	Sat Apr 16 16:43:27 2011 -0300
@@ -528,9 +528,8 @@
    padding = w;
    btn->copy_label(PanelSize == P_tiny ? "&F" : "&File");
    btn->measure_label(w,h);
-   if (PanelSize == P_large)
-      h = mh;
-   btn->size(w+padding,PanelSize == P_tiny ? bh : lh);
+   h = (PanelSize == P_large) ? mh : (PanelSize == P_tiny) ? bh : lh;
+   btn->size(w+padding, h);
    p_xpos += btn->w();
    _MSG("UI::make_filemenu_button w=%d h=%d padding=%d\n", w, h, padding);
    btn->box(PanelSize == P_large ? FL_THIN_UP_BOX : FL_THIN_UP_BOX);
@@ -587,7 +586,7 @@
    nh = bh, fh = 28; sh = 20;
 
    if (PanelSize == P_tiny) {
-      NavBar = new CustGroup(0,0,ww,bh);
+      NavBar = new CustGroup(0,0,ww,nh);
       NavBar->begin();
        make_toolbar(ww,bh);
        make_filemenu_button();
@@ -599,12 +598,12 @@
    } else {
        // File menu
        if (PanelSize == P_large) {
-          Fl_Group *g3 = new Fl_Group(0,0,ww,lh);
-          g3->begin();
-           g3->box(FL_THIN_UP_BOX);
+          MenuBar = new CustGroup(0,0,ww,mh);
+          MenuBar->begin();
+           MenuBar->box(FL_THIN_UP_BOX);
            Fl_Widget *bn = make_filemenu_button();
-           g3->add_resizable(*new Fl_Box(bn->w(),0,ww - bn->w(),lh));
-          g3->end();
+           MenuBar->add_resizable(*new Fl_Box(bn->w(),0,ww - bn->w(),mh));
+          MenuBar->end();
 
           p_xpos = 0;
           LocBar = new CustGroup(0,0,ww,lh);
@@ -676,7 +675,7 @@
 {
    PointerOnLink = FALSE;
 
-   LocBar = NavBar = StatusBar = NULL;
+   MenuBar = LocBar = NavBar = StatusBar = NULL;
 
    Tabs = NULL;
    TabTooltip = NULL;
@@ -708,8 +707,8 @@
     make_panel(ui_w);
  
     // Render area
-    int mh = ui_h - (lh+bh+fh+sh);
-    Main = new Fl_Group(0,0,0,mh,"Welcome...");
+    int main_h = ui_h - (mh+(LocBar?lh:0)+nh+fh+sh);
+    Main = new Fl_Group(0,0,0,main_h,"Welcome...");
     Main->end();
     Main->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
     Main->box(FL_FLAT_BOX);
@@ -1163,6 +1162,11 @@
 
    // hide/show panels
    init_sizes();
+   if (MenuBar) {
+      dh += mh;
+      hide ? MenuBar->size(0,0) : MenuBar->size(w(),mh);
+      hide ? MenuBar->hide() : MenuBar->show();
+   }
    if (LocBar) {
       dh += lh;
       hide ? LocBar->size(0,0) : LocBar->size(w(),lh);
--- a/src/ui.hh	Sat Apr 16 14:11:16 2011 +0000
+++ b/src/ui.hh	Sat Apr 16 16:43:27 2011 -0300
@@ -121,7 +121,7 @@
    Fl_Group *TopGroup;
    Fl_Button *Back, *Forw, *Home, *Reload, *Save, *Stop, *Bookmarks, *Tools,
           *Clear, *Search, *Help, *FullScreen, *BugMeter, *FileButton;
-   CustGroup *LocBar, *NavBar, *StatusBar;
+   CustGroup *MenuBar, *LocBar, *NavBar, *StatusBar;
    Fl_Input  *Location;
    Fl_Pack *ProgBox;
    CustProgressBox *PProg, *IProg;