diff options
author | corvid <corvid@lavabit.com> | 2009-10-03 15:29:57 +0000 |
---|---|---|
committer | corvid <corvid@lavabit.com> | 2009-10-03 15:29:57 +0000 |
commit | 241f20d9187569eedeb974f2edbf2cbf09be2409 (patch) | |
tree | 62a118fc04aeb2c854b3d9b90de2c43e7643034f | |
parent | b959c77c50c1496c815fe179cb38805a422ad0cc (diff) |
only set tooltips for UI if prefs.show_tooltip set
-rw-r--r-- | dillorc | 2 | ||||
-rw-r--r-- | src/findbar.cc | 13 | ||||
-rw-r--r-- | src/ui.cc | 32 | ||||
-rw-r--r-- | src/uicmd.cc | 29 |
4 files changed, 44 insertions, 32 deletions
@@ -61,7 +61,7 @@ # Minimum font size in pixels #font_min_size=6 -# Show tooltip popup for title attributes +# Show tooltip popups for UI and for HTML title attributes #show_tooltip=YES # Set this to YES if you want to limit the word wrap width to the viewport diff --git a/src/findbar.cc b/src/findbar.cc index 2045d2a0..d35719d6 100644 --- a/src/findbar.cc +++ b/src/findbar.cc @@ -122,7 +122,6 @@ Findbar::Findbar(int width, int height) : hide_btn = new HighlightButton(x, border, 16, height, 0); hideImg = new xpmImage(new_s_xpm); hide_btn->image(hideImg); - hide_btn->tooltip("Hide"); x += 16 + gap; hide_btn->callback(hide_cb, this); hide_btn->clear_tab_to_focus(); @@ -138,16 +137,12 @@ Findbar::Findbar(int width, int height) : next_btn = new HighlightButton(x, border, button_width, height, "Next"); x += button_width + gap; - next_btn->tooltip("Find next occurrence of the search phrase\n" - "shortcut: Enter"); next_btn->add_shortcut(ReturnKey); next_btn->add_shortcut(KeypadEnter); next_btn->callback(search_cb, this); next_btn->clear_tab_to_focus(); prev_btn= new HighlightButton(x, border, button_width, height, "Previous"); - prev_btn->tooltip("Find previous occurrence of the search phrase\n" - "shortcut: Shift+Enter"); prev_btn->add_shortcut(SHIFT+ReturnKey); prev_btn->callback(searchBackwards_cb, this); prev_btn->clear_tab_to_focus(); @@ -159,6 +154,14 @@ Findbar::Findbar(int width, int height) : x += 2 * button_width + gap; end(); + + if (prefs.show_tooltip) { + hide_btn->tooltip("Hide"); + next_btn->tooltip("Find next occurrence of the search phrase\n" + "shortcut: Enter"); + prev_btn->tooltip("Find previous occurrence of the search phrase\n" + "shortcut: Shift+Enter"); + } } Findbar::~Findbar() @@ -376,56 +376,58 @@ PackedGroup *UI::make_toolbar(int tw, int th) p1->begin(); Back = b = new HighlightButton(xpos, 0, bw, bh, (lbl) ? "Back" : 0); b->image(icons->ImgLeftMulti); - b->tooltip("Previous page"); b->callback(b1_cb, (void *)UI_BACK); b->clear_tab_to_focus(); HighlightButton::default_style->highlight_color(CuteColor); Forw = b = new HighlightButton(xpos, 0, bw, bh, (lbl) ? "Forw" : 0); b->image(icons->ImgRightMulti); - b->tooltip("Next page"); b->callback(b1_cb, (void *)UI_FORW); b->clear_tab_to_focus(); Home = b = new HighlightButton(xpos, 0, bw, bh, (lbl) ? "Home" : 0); b->image(icons->ImgHome); - b->tooltip("Go to the Home page"); b->callback(b1_cb, (void *)UI_HOME); b->clear_tab_to_focus(); Reload = b = new HighlightButton(xpos, 0, bw, bh, (lbl) ? "Reload" : 0); b->image(icons->ImgReload); - b->tooltip("Reload"); b->callback(b1_cb, (void *)UI_RELOAD); b->clear_tab_to_focus(); Save = b = new HighlightButton(xpos, 0, bw, bh, (lbl) ? "Save" : 0); b->image(icons->ImgSave); - b->tooltip("Save this page"); b->callback(b1_cb, (void *)UI_SAVE); b->clear_tab_to_focus(); Stop = b = new HighlightButton(xpos, 0, bw, bh, (lbl) ? "Stop" : 0); b->image(icons->ImgStopMulti); - b->tooltip("Stop loading"); b->callback(b1_cb, (void *)UI_STOP); b->clear_tab_to_focus(); Bookmarks = b = new HighlightButton(xpos, 0, bw, bh, (lbl) ? "Book" : 0); b->image(icons->ImgBook); - b->tooltip("View bookmarks"); b->callback(b1_cb, (void *)UI_BOOK); b->clear_tab_to_focus(); Tools = b = new HighlightButton(xpos, 0, bw, bh, (lbl) ? "Tools" : 0); b->image(icons->ImgTools); - b->tooltip("Settings"); b->callback(b1_cb, (void *)UI_TOOLS); b->clear_tab_to_focus(); p1->type(PackedGroup::ALL_CHILDREN_VERTICAL); p1->end(); + if (prefs.show_tooltip) { + Back->tooltip("Previous page"); + Forw->tooltip("Next page"); + Home->tooltip("Go to the Home page"); + Reload->tooltip("Reload"); + Save->tooltip("Save this page"); + Stop->tooltip("Stop loading"); + Bookmarks->tooltip("View bookmarks"); + Tools->tooltip("Settings"); + } return p1; } @@ -439,12 +441,10 @@ PackedGroup *UI::make_location() pg->begin(); Clear = b = new CustHighlightButton(2,2,16,22,0); b->image(icons->ImgClear); - b->tooltip("Clear the URL box.\nMiddle-click to paste a URL."); b->callback(clear_cb, this); b->clear_tab_to_focus(); Input *i = Location = new CustInput(0,0,0,0,0); - i->tooltip("Location"); i->color(CuteColor); i->when(WHEN_ENTER_KEY); i->callback(location_cb, this); @@ -452,7 +452,6 @@ PackedGroup *UI::make_location() Search = b = new HighlightButton(0,0,16,22,0); b->image(icons->ImgSearch); - b->tooltip("Search the Web"); b->callback(search_cb, this); b->clear_tab_to_focus(); @@ -460,6 +459,11 @@ PackedGroup *UI::make_location() pg->resizable(i); pg->end(); + if (prefs.show_tooltip) { + Clear->tooltip("Clear the URL box.\nMiddle-click to paste a URL."); + Location->tooltip("Location"); + Search->tooltip("Search the Web"); + } return pg; } @@ -506,7 +510,8 @@ Widget *UI::make_filemenu_button() _MSG("UI::make_filemenu_button w=%d h=%d padding=%d\n", w, h, padding); btn->box(PanelSize == P_large ? FLAT_BOX : THIN_UP_BOX); btn->callback(filemenu_cb, this); - btn->tooltip("File menu"); + if (prefs.show_tooltip) + btn->tooltip("File menu"); btn->clear_tab_to_focus(); if (!prefs.show_filemenu && PanelSize != P_large) btn->hide(); @@ -648,7 +653,8 @@ Group *UI::make_status_panel(int ww) BugMeter->image(icons->ImgMeterOK); BugMeter->box(THIN_DOWN_BOX); BugMeter->align(ALIGN_INSIDE|ALIGN_CLIP|ALIGN_LEFT); - BugMeter->tooltip("Show HTML bugs\n(right-click for menu)"); + if (prefs.show_tooltip) + BugMeter->tooltip("Show HTML bugs\n(right-click for menu)"); BugMeter->callback(bugmeter_cb, this); BugMeter->clear_tab_to_focus(); g->add(BugMeter); diff --git a/src/uicmd.cc b/src/uicmd.cc index 7ea523d0..5308ffb3 100644 --- a/src/uicmd.cc +++ b/src/uicmd.cc @@ -273,23 +273,26 @@ public: if (event_inside(r) && children() > 1) { /* We're inside the button area */ cstp->btn_highlight(true); - /* Prepare the tooltip for pop-up */ - tooltipEnabled = true; - /* We use parent() if available because we are returning 0. - * Returning without having TabGroup processing makes the - * popup event never reach 'this', but it reaches parent() */ - toolTip->enter(parent() ? parent() : this, r, "Close current Tab"); - + if (prefs.show_tooltip) { + /* Prepare the tooltip for pop-up */ + tooltipEnabled = true; + /* We use parent() if available because we are returning 0. + * Returning without having TabGroup processing makes the + * popup event never reach 'this', but it reaches parent() */ + toolTip->enter(parent() ?parent():this, r, "Close current Tab"); + } return 0; // Change focus } else { cstp->btn_highlight(false); - /* Hide the tooltip or enable it again.*/ - if (tooltipEnabled) { - tooltipEnabled = false; - toolTip->exit(); - } else { - toolTip->enable(); + if (prefs.show_tooltip) { + /* Hide the tooltip or enable it again.*/ + if (tooltipEnabled) { + tooltipEnabled = false; + toolTip->exit(); + } else { + toolTip->enable(); + } } } } else if (e == PUSH && event_inside(r) && |