From e2bc57bc0fef16faba89f996e354445c31aebedd Mon Sep 17 00:00:00 2001 From: simonb Date: Tue, 25 Apr 2006 03:11:31 +0000 Subject: Fix occasional highlighting of menu nops+separators, sf.net patch #1475268 (thanks Scott Kuhl; skuhl AT cs utah edu) --- ChangeLog | 3 +++ src/FbTk/Menu.cc | 2 +- src/FbTk/MenuSeparator.cc | 6 ++++-- src/FbTk/MenuSeparator.hh | 1 + src/MenuCreator.cc | 3 ++- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 86ee946..13e866e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ (Format: Year/Month/Day) Changes for 0.9.16: *06/04/25: + * Fix occasional highlighting of menu nops+separators, sf.net patch + #1475268 (thanks Scott Kuhl; skuhl AT cs utah edu) + FbTk/MenuSeparator.hh/cc FbTk/Menu.cc MenuCreator.cc * fbrun: Move the cursor to the end when tab completing (Simon + thanks Jonas Koelker), sf.net rfe #1333003, patch #1475578 util/fbrun/FbRun.hh/cc diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc index b08bfe9..d99c9ba 100644 --- a/src/FbTk/Menu.cc +++ b/src/FbTk/Menu.cc @@ -1182,7 +1182,7 @@ void Menu::openSubmenu() { return; int item = m_which_sbl * menu.persub + m_which_press; - if (!validIndex(item)) + if (!validIndex(item) || !menuitems[item]->isEnabled()) return; clearItem(item); diff --git a/src/FbTk/MenuSeparator.cc b/src/FbTk/MenuSeparator.cc index 34c97fe..be43a87 100644 --- a/src/FbTk/MenuSeparator.cc +++ b/src/FbTk/MenuSeparator.cc @@ -38,8 +38,10 @@ void MenuSeparator::draw(FbDrawable &drawable, if (draw_background) { const GContext &tgc = - (highlight ? theme.hiliteTextGC() : - (isEnabled() ? theme.frameTextGC() : theme.disableTextGC() ) ); +// its a separator, it shouldn't be highlighted! or shown as disabled +// (highlight ? theme.hiliteTextGC() : +// (isEnabled() ? theme.frameTextGC() : theme.disableTextGC() ) ); + theme.frameTextGC(); drawable.drawRectangle(tgc.gc(), x + theme.bevelWidth() + height + 1, y + height / 2, diff --git a/src/FbTk/MenuSeparator.hh b/src/FbTk/MenuSeparator.hh index c35efc4..38f15d3 100644 --- a/src/FbTk/MenuSeparator.hh +++ b/src/FbTk/MenuSeparator.hh @@ -36,6 +36,7 @@ public: bool highlight, bool draw_foreground, bool draw_background, int x, int y, unsigned int width, unsigned int height) const; + virtual inline bool isEnabled() const { return false; } }; diff --git a/src/MenuCreator.cc b/src/MenuCreator.cc index c97d51d..f920321 100644 --- a/src/MenuCreator.cc +++ b/src/MenuCreator.cc @@ -186,7 +186,8 @@ static void translateMenuItem(Parser &parse, ParseItem &pitem) { if (str_key == "end") { return; } else if (str_key == "nop") { - menu.insert(str_label.c_str()); + int menuSize = menu.insert(str_label.c_str()); + menu.setItemEnabled(menuSize-1, false); } else if (str_key == "icons") { FbTk::Menu *submenu = MenuCreator::createMenuType("iconmenu", menu.screenNumber()); if (submenu == 0) -- cgit v0.11.2