changeset 1945:b24a5b73ff10

Made the status bar visible and operative. The Bug Meter needs some work due to differences with FLTK2
author Jorge Arellano Cid <jcid@dillo.org>
date Sun, 13 Mar 2011 09:50:30 -0400
parents 3d6b3abb3b68
children 217ce29096c3 821e6262ead9
files dw/fltkviewport.cc src/ui.cc src/ui.hh src/uicmd.cc
diffstat 4 files changed, 46 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/dw/fltkviewport.cc	Thu Mar 10 13:41:12 2011 -0300
+++ b/dw/fltkviewport.cc	Sun Mar 13 09:50:30 2011 -0400
@@ -180,7 +180,8 @@
 
    if (d & FL_DAMAGE_SCROLL) {
       clear_damage (FL_DAMAGE_SCROLL);
-      fl_scroll(x(), y(), w () - hdiff, h () - vdiff, -scrollDX, -scrollDY, draw_area, this);
+      fl_scroll(x(), y(), w() - hdiff, h() - vdiff,
+                -scrollDX, -scrollDY, draw_area, this);
       clear_damage (d & ~FL_DAMAGE_SCROLL);
    }
 
--- a/src/ui.cc	Thu Mar 10 13:41:12 2011 -0300
+++ b/src/ui.cc	Sun Mar 13 09:50:30 2011 -0400
@@ -561,7 +561,7 @@
       else
          bw = 45, bh = 45, fh = 24, lh = 28, lbl = 1;
    }
-   nh = bh, sh = 24;
+   nh = bh, sh = 20;
 
    if (PanelSize == P_tiny) {
       NavBar = new CustGroup(0,0,ww,bh);
@@ -618,30 +618,33 @@
 /*
  * Create the status panel
  */
-void UI::make_status_panel(int ww)
+void UI::make_status_panel(int ww, int wh)
 {
-   const int s_h = 20, bm_w = 16;
-   // HACK: we need a defined StatusOutput
-   StatusPanel = new Fl_Group(0, 400, 1, 1, 0);
-   StatusPanel->end();
+   const int bm_w = 20;
+   StatusPanel = new CustGroup(0, wh-sh, ww, sh);
 
-   // Status box
-   StatusOutput = new Fl_Output(0, 0, ww-bm_w, s_h, 0);
-   StatusOutput->value("");
-   StatusOutput->box(FL_THIN_DOWN_BOX);
-   StatusOutput->clear_visible_focus();
-   StatusOutput->color(FL_GRAY_RAMP + 18);
-   //StatusOutput->throw_focus();
+    // Status box
+    StatusOutput = new Fl_Output(0, wh-sh, ww-bm_w, sh);
+    StatusOutput->value("hola!");
+    StatusOutput->labelsize(8);
+    StatusOutput->box(FL_THIN_DOWN_BOX);
+    StatusOutput->clear_visible_focus();
+    StatusOutput->color(FL_GRAY_RAMP + 18);
+    //StatusOutput->throw_focus();
 
-   // Bug Meter
-   BugMeter = new Fl_Button(ww-bm_w,0,bm_w,s_h,0);
-   BugMeter->image(icons->ImgMeterOK);
-   BugMeter->box(FL_THIN_DOWN_BOX);
-   BugMeter->align(FL_ALIGN_INSIDE|FL_ALIGN_CLIP|FL_ALIGN_LEFT);
-   if (prefs.show_tooltip)
-      BugMeter->tooltip("Show HTML bugs\n(right-click for menu)");
-   BugMeter->callback(bugmeter_cb, this);
-   BugMeter->clear_visible_focus();
+    // Bug Meter
+    // TODO: fltk1.3 places label on top or bottom (no left right)
+    BugMeter = new Fl_Button(ww-bm_w,wh-sh,bm_w,sh);
+    BugMeter->image(icons->ImgMeterOK);
+    BugMeter->box(FL_THIN_UP_BOX);
+    BugMeter->align(FL_ALIGN_INSIDE|FL_ALIGN_LEFT);
+    if (prefs.show_tooltip)
+       BugMeter->tooltip("Show HTML bugs\n(right-click for menu)");
+    BugMeter->callback(bugmeter_cb, this);
+    BugMeter->clear_visible_focus();
+
+   StatusPanel->end();
+   StatusPanel->resizable(StatusOutput);
 }
 
 /*
@@ -684,6 +687,7 @@
     // Render area
     int mh = ui_h - (lh+bh+sh);
     Main = new Fl_Group(0,0,0,mh,"Welcome...");
+    Main->end();
     Main->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
     Main->box(FL_FLAT_BOX);
     Main->color(FL_GRAY_RAMP + 3);
@@ -695,12 +699,11 @@
     MainIdx = TopGroup->find(Main);
  
     // Find text bar
-    findbar = new Findbar(ui_w, 28);
+    //findbar = new Findbar(ui_w, 28);
     //TopGroup->add(findbar);
  
     // Status Panel
-    make_status_panel(ui_w);
-    //TopGroup->add(StatusPanel);
+    make_status_panel(ui_w, ui_h);
 
    TopGroup->end();
 
@@ -715,7 +718,7 @@
 
    if (Panelmode) {
       //Panel->hide();
-      StatusPanel->hide();
+      //StatusPanel->hide();
    }
 }
 
@@ -948,9 +951,9 @@
       BugMeter->redraw_label();
       new_w = strlen(str)*8 + 20;
    }
-   StatusOutput->resize(0,0,StatusPanel->w()-new_w,StatusOutput->h());
-   BugMeter->resize(StatusPanel->w()-new_w, 0, new_w, BugMeter->h());
-   StatusPanel->init_sizes();
+// StatusOutput->resize(0,0,StatusPanel->w()-new_w,StatusOutput->h());
+// BugMeter->resize(StatusPanel->w()-new_w, 0, new_w, BugMeter->h());
+// StatusPanel->init_sizes();
 }
 
 /*
@@ -1060,15 +1063,16 @@
 /*
  * Set 'nw' as the main render area widget
  */
-void UI::set_render_layout(Fl_Group &nw)
+void UI::set_render_layout(Fl_Group *nw)
 {
-   TopGroup->remove(MainIdx);
+   // Resize layout widget to current height
+   nw->resize(0,0,0,Main->h());
+
+   TopGroup->insert(*nw, Main);
+   remove(Main);
    delete(Main);
-   TopGroup->insert(nw, MainIdx);
-   Main = &nw;
+   Main = nw;
    TopGroup->resizable(Main);
-   //TopGroup->box(FL_DOWN_BOX);
-   //TopGroup->box(FL_BORDER_FRAME);
 }
 
 /*
--- a/src/ui.hh	Thu Mar 10 13:41:12 2011 -0300
+++ b/src/ui.hh	Sun Mar 13 09:50:30 2011 -0400
@@ -144,7 +144,7 @@
    void make_menubar(int x, int y, int w, int h);
    Fl_Widget *make_filemenu_button();
    void make_panel(int ww);
-   void make_status_panel(int ww);
+   void make_status_panel(int ww, int wh);
 
 public:
 
@@ -162,7 +162,7 @@
    void set_page_prog(size_t nbytes, int cmd);
    void set_img_prog(int n_img, int t_img, int cmd);
    void set_bug_prog(int n_bug);
-   void set_render_layout(Fl_Group &nw);
+   void set_render_layout(Fl_Group *nw);
    void customize(int flags);
    void button_set_sens(UIButton btn, int sens);
    void paste_url();
--- a/src/uicmd.cc	Thu Mar 10 13:41:12 2011 -0300
+++ b/src/uicmd.cc	Sun Mar 13 09:50:30 2011 -0400
@@ -420,10 +420,11 @@
    style::Color *bgColor = style::Color::create (layout, prefs.bg_color);
    layout->setBgColor (bgColor);
 
-   FltkViewport *viewport = new FltkViewport (0, 0, 1, 1);
+   // set_render_layout() sets the proper viewport size
+   FltkViewport *viewport = new FltkViewport (0, 0, 0, 1);
    viewport->setBufferedDrawing (prefs.buffered_drawing ? true : false);
    layout->attachView (viewport);
-   new_ui->set_render_layout(*viewport);
+   new_ui->set_render_layout(viewport);
    viewport->setScrollStep((int) rint(14.0 * prefs.font_factor));
 
    // Now, create a new browser window structure