aboutsummaryrefslogtreecommitdiff
path: root/src/ui.cc
diff options
context:
space:
mode:
authorJorge Arellano Cid <jcid@dillo.org>2011-08-04 13:48:47 -0400
committerJorge Arellano Cid <jcid@dillo.org>2011-08-04 13:48:47 -0400
commit97763814b874f3347e107a5013a529e571a23525 (patch)
treeb034a340e0023ab4dc25d3f2ae15069859e8bf05 /src/ui.cc
parentdc8319cfc909090b7f53992080efc84d4fcce4fb (diff)
FindBar cleanup: use the same size(0,0) trick we use for Panels
Diffstat (limited to 'src/ui.cc')
-rw-r--r--src/ui.cc28
1 files changed, 8 insertions, 20 deletions
diff --git a/src/ui.cc b/src/ui.cc
index b81146d2..8c75002a 100644
--- a/src/ui.cc
+++ b/src/ui.cc
@@ -670,7 +670,6 @@ UI::UI(int x, int y, int ui_w, int ui_h, const char* label, const UI *cur_ui) :
MainIdx = TopGroup->find(Main);
// Find text bar
- FindBarSpace = 1;
FindBar = new Findbar(ui_w, fh);
TopGroup->add(FindBar);
@@ -694,9 +693,6 @@ UI::~UI()
{
_MSG("UI::~UI()\n");
dFree(TabTooltip);
-
- if (!FindBarSpace)
- delete FindBar;
}
/*
@@ -752,7 +748,7 @@ int UI::handle(int event)
ret = 1;
} else if (cmd == KEYS_HIDE_PANELS) {
/* Hide findbar if present, hide panels if not */
- (FindBarSpace) ? findbar_toggle(0) : panels_toggle();
+ (FindBar->visible()) ? findbar_toggle(0) : panels_toggle();
temporaryPanels(false);
ret = 1;
} else if (cmd == KEYS_OPEN) {
@@ -1046,27 +1042,19 @@ void UI::findbar_toggle(bool add)
{
/* WORKAROUND:
* This is tricky: As fltk-1.3 resizes hidden widgets (which it
- * doesn't resize when visible!). We need to go through hoops to
+ * doesn't resize when visible!). We need to set the size to (0,0) to
* get the desired behaviour.
* (STR#2639 in FLTK bug tracker).
*/
if (add) {
- if (!FindBarSpace) {
- // show
- Main->size(Main->w(), Main->h()-FindBar->h());
- insert(*FindBar, StatusBar);
- FindBar->show();
- FindBarSpace = 1;
- } else {
- // select text
- FindBar->show();
- }
- } else if (!add && FindBarSpace) {
+ if (!FindBar->visible())
+ FindBar->size(w(), fh);
+ FindBar->show();
+ } else {
// hide
- Main->size(Main->w(), Main->h()+FindBar->h());
- remove(FindBar);
- FindBarSpace = 0;
+ FindBar->size(0,0);
+ FindBar->hide();
// reset state
a_UIcmd_findtext_reset(a_UIcmd_get_bw_by_widget(this));
// focus main area