From cc58f614807915323c4b97be2fcba5e954b62bce Mon Sep 17 00:00:00 2001 From: Markus Gans Date: Wed, 16 Dec 2015 23:57:14 +0100 Subject: [PATCH] Avoid to show menus outside of the screen --- ChangeLog | 3 ++ src/fcharmap.h | 2 +- src/fenum.h | 3 +- src/fmenu.cpp | 106 ++++++++++++++++++++++++++----------- src/fmenu.h | 3 ++ src/fmenubar.cpp | 47 +++++++++++++--- src/fmenubar.h | 3 +- src/fonts/8x16graph.bdf | 2 +- src/fonts/8x16graph.pcf.gz | Bin 5128 -> 5129 bytes src/fradiobutton.cpp | 2 +- src/fstatusbar.cpp | 20 +++++++ src/fstatusbar.h | 8 ++- src/fwidget.cpp | 4 +- src/fwidget.h | 4 +- test/menu.cpp | 7 ++- 15 files changed, 156 insertions(+), 58 deletions(-) diff --git a/ChangeLog b/ChangeLog index 56d48858..d6d2d66e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2015-12-16 Markus Gans + * Avoid to show menus outside of the screen + 2015-12-12 Markus Gans * Improve sub-sub-menu handling diff --git a/src/fcharmap.h b/src/fcharmap.h index 2a9110d6..664866ae 100644 --- a/src/fcharmap.h +++ b/src/fcharmap.h @@ -32,7 +32,7 @@ static uInt character[][fc::NUM_OF_ENCODINGS] = {0x02e3, '~', 0xfc, '~'}, // ˣ - Modifier letter small x {0x00b0, 'f', 0xb0, 'o'}, // ° - Degree {0x2022, '`', 0x04, '*'}, // • - Bullet - {0x00b7, '`', 0xf9, '*'}, // · - small Bullet + {0x00b7, '`', 0xf9, '.'}, // · - small Bullet {0x25c6, '`', 0x04, '*'}, // ◆ - BlackDiamond {0x2424, 'h', ' ', ' '}, // ␤ - SymbolForNewline {0x240b, 'i', ' ', ' '}, // ␋ - SymbolForVerticalTab diff --git a/src/fenum.h b/src/fenum.h index cb2760cf..28b97c02 100644 --- a/src/fenum.h +++ b/src/fenum.h @@ -168,8 +168,7 @@ class fc NF_shadow_box_right = 0x1af5, // ] NF_Bullet = 0x1af9, // ● NF_check_mark = 0x1afb, // ✓ - SquareRoot = 0x221a, // √ - BlackCircle = 0x25CF // ● + SquareRoot = 0x221a // √ }; // keyboard - single keys diff --git a/src/fmenu.cpp b/src/fmenu.cpp index 463973a8..512deead 100644 --- a/src/fmenu.cpp +++ b/src/fmenu.cpp @@ -137,7 +137,7 @@ void FMenu::init(FWidget* parent) //---------------------------------------------------------------------- void FMenu::menu_dimension() { - int item_X, item_Y; + int item_X, item_Y, adjust_X; std::vector::const_iterator iter, end; iter = itemlist.begin(); end = itemlist.end(); @@ -169,8 +169,10 @@ void FMenu::menu_dimension() ++iter; } + adjust_X = adjustX(xpos); + // set widget geometry - setGeometry (xpos, ypos, int(maxItemWidth + 2), int(count() + 2)); + setGeometry (adjust_X, ypos, int(maxItemWidth + 2), int(count() + 2)); // set geometry of all items iter = itemlist.begin(); @@ -182,8 +184,8 @@ void FMenu::menu_dimension() (*iter)->setGeometry (item_X, item_Y, int(maxItemWidth), 1); if ( (*iter)->hasMenu() ) - {//(*iter)->setText( FString().setNumber(itemlist.size()) ); - int menu_X = (*iter)->getGlobalX() + int(maxItemWidth); + { + int menu_X = getGlobalX() + int(maxItemWidth) + 1; int menu_Y = (*iter)->getGlobalY() - 2; // set sub-menu position (*iter)->getMenu()->setPos (menu_X, menu_Y, false); @@ -194,6 +196,59 @@ void FMenu::menu_dimension() } } +//---------------------------------------------------------------------- +void FMenu::adjustItems() +{ + std::vector::const_iterator end, iter; + iter = itemlist.begin(); + end = itemlist.end(); + + while ( iter != end ) + { + if ( (*iter)->hasMenu() ) + { + int menu_X, menu_Y; + FMenu* menu = (*iter)->getMenu(); + + menu_X = getGlobalX() + int(maxItemWidth) + 1; + menu_X = menu->adjustX(menu_X); + menu_Y = (*iter)->getGlobalY() - 2; + + // set sub-menu position + menu->move (menu_X, menu_Y); + + // call sub-menu adjustItems() + if ( menu->count() > 0 ) + menu->adjustItems(); + } + ++iter; + } +} + +//---------------------------------------------------------------------- +int FMenu::adjustX (int x_pos) +{ + // Is menu outside on the right of the screen? + if ( x_pos+int(maxItemWidth)+2 > getColumnNumber() ) + { + x_pos = getColumnNumber() - int(maxItemWidth + 1); + // Menu to large for the screen + if ( x_pos < 1 ) + x_pos = 1; + } + return x_pos; +} + +//---------------------------------------------------------------------- +void FMenu::adjustSize() +{ + //int adjust_X = adjustX(xpos); + + FWidget::adjustSize(); + + //move (adjust_X, ypos); +} + //---------------------------------------------------------------------- bool FMenu::isMenuBar (FWidget* w) const { @@ -643,22 +698,25 @@ void FMenu::drawItems() if ( is_radio_btn ) { if ( isNewFont() ) - print (fc::NF_Bullet); + print (fc::NF_Bullet); // NF_Bullet ● else - print (fc::BlackCircle); // BlackCircle ● + print (fc::Bullet); // Bullet ● } else { if ( isNewFont() ) - print (fc::NF_check_mark); + print (fc::NF_check_mark); // NF_check_mark ✓ else - print (fc::SquareRoot); // SquareRoot √ + print (fc::SquareRoot); // SquareRoot √ } } else { setColor (wc.menu_inactive_fg, backgroundColor); - print ('-'); + if ( getEncoding() == "ASCII" ) + print ('-'); + else + print (fc::SmallBullet); setColor (foregroundColor, backgroundColor); } } @@ -1043,28 +1101,14 @@ void FMenu::onMouseUp (FMouseEvent* ev) openSubMenu (sub_menu); else if ( open_sub_menu ) { - /*if ( open_sub_menu->hasSelectedItem() ) - { - FMenuItem* sel_item = getSelectedItem(); - hideSubMenus(); - sel_item->setFocus(); - redraw(); - if ( statusBar() ) - statusBar()->drawMessage(); - updateTerminal(); - flush_out(); - } - else*/ - { - open_sub_menu->selectFirstItem(); - if ( open_sub_menu->hasSelectedItem() ) - open_sub_menu->getSelectedItem()->setFocus(); - open_sub_menu->redraw(); - if ( statusBar() ) - statusBar()->drawMessage(); - updateTerminal(); - flush_out(); - } + open_sub_menu->selectFirstItem(); + if ( open_sub_menu->hasSelectedItem() ) + open_sub_menu->getSelectedItem()->setFocus(); + open_sub_menu->redraw(); + if ( statusBar() ) + statusBar()->drawMessage(); + updateTerminal(); + flush_out(); } return; } diff --git a/src/fmenu.h b/src/fmenu.h index 3075ea84..e5398b3b 100644 --- a/src/fmenu.h +++ b/src/fmenu.h @@ -58,6 +58,9 @@ class FMenu : public FWindow, public FMenuList FMenu& operator = (const FMenu&); void init(FWidget*); void menu_dimension(); + void adjustItems(); + int adjustX(int); + void adjustSize(); bool isMenuBar (FWidget*) const; bool isMenu (FWidget*) const; bool isRadioMenuItem (FWidget*) const; diff --git a/src/fmenubar.cpp b/src/fmenubar.cpp index d1890387..6c2be1c9 100644 --- a/src/fmenubar.cpp +++ b/src/fmenubar.cpp @@ -432,14 +432,33 @@ void FMenuBar::drawItems() } //---------------------------------------------------------------------- -void FMenuBar::adjustSize() +void FMenuBar::adjustItems() { - xmin = ymin = 1; - height = 1; - xpos = 1; - width = getColumnNumber(); - ypos = 1; - FWidget::adjustSize(); + int item_X = 1; + int item_Y = 1; + std::vector::const_iterator end, iter; + iter = itemlist.begin(); + end = itemlist.end(); + + while ( iter != end ) + { + // get item width + int item_width = (*iter)->getWidth(); + + if ( (*iter)->hasMenu() ) + { + FMenu* menu = (*iter)->getMenu(); + + // set menu position + menu->move (menu->adjustX(item_X), item_Y); + + // call menu adjustItems() + menu->adjustItems(); + } + item_X += item_width; + + ++iter; + } } //---------------------------------------------------------------------- @@ -767,7 +786,8 @@ void FMenuBar::onMouseMove (FMouseEvent* ev) FMenu* menu = getSelectedItem()->getMenu(); const FRect& menu_geometry = menu->getGeometryGlobal(); - if ( menu_geometry.contains(ev->getGlobalPos()) ) + if ( menu->count() > 0 + && menu_geometry.contains(ev->getGlobalPos()) ) { const FPoint& g = ev->getGlobalPos(); const FPoint& p = menu->globalToLocalPos(g); @@ -830,6 +850,17 @@ void FMenuBar::resetMenu() drop_down = false; } +//---------------------------------------------------------------------- +void FMenuBar::adjustSize() +{ + xmin = ymin = 1; + height = 1; + xpos = 1; + width = getColumnNumber(); + ypos = 1; + adjustItems(); +} + //---------------------------------------------------------------------- void FMenuBar::setGeometry (int xx, int yy, int ww, int hh, bool adjust) { diff --git a/src/fmenubar.h b/src/fmenubar.h index 42284cd0..73699cb4 100644 --- a/src/fmenubar.h +++ b/src/fmenubar.h @@ -60,7 +60,7 @@ class FMenuBar : public FWindow, public FMenuList int getHotkeyPos (wchar_t*&, wchar_t*&, uInt); void draw(); void drawItems(); - void adjustSize(); + void adjustItems(); void leaveMenuBar(); public: @@ -75,6 +75,7 @@ class FMenuBar : public FWindow, public FMenuList void onAccel (FAccelEvent*); void hide(); void resetMenu(); + void adjustSize(); // make every setGeometry from FWidget available using FWidget::setGeometry; void setGeometry (int, int, int, int, bool = true); diff --git a/src/fonts/8x16graph.bdf b/src/fonts/8x16graph.bdf index 70288fdb..1baf5923 100644 --- a/src/fonts/8x16graph.bdf +++ b/src/fonts/8x16graph.bdf @@ -1,5 +1,5 @@ STARTFONT 2.1 -FONT -misc-8x16graph-medium-r-normal--16-160-75-75-C-80-iso8859-1 +FONT -misc-8x16graph-medium-r-normal--17-160-75-75-C-80-iso8859-1 SIZE 16 75 75 FONTBOUNDINGBOX 8 16 0 -4 STARTPROPERTIES 6 diff --git a/src/fonts/8x16graph.pcf.gz b/src/fonts/8x16graph.pcf.gz index e85766f97f5df5cdfc058fea3f9cd5cdf0974397..d7c534dba423c80d2855c5cfcf0d2a6a495b6408 100644 GIT binary patch delta 4682 zcmbuBXHe5wyoTvPg9xG|(ju!AX%UnnNJ0@2kzxTP2oVG^ARR&r{E;ZQOH)`xrMVPo zLQr}OWI<7o7Qj#hvb4|%5FkX7T=%;7&fS?ib3fd9=6B|K-*e8V^W{8I{#6+SOAr=z zn+bRa0(b$_^2SC)>u=a~2D1JwM4P3z8>6kZrVLK3IOyhVR!HVR4MhXEjjDDDC? zjJ`pgAt}Y!@Z|C!cyYflFVcUdN|2OBTM*1sbPH-4NeOQwlq-S|#2sWFrJpuCFZ|*l z;uuaPEXnW)FX0EdLWn~+Ddsu)B6W~dgtr0Z@*?pDJYSBHY-EA3oI0!9D zl)(uy57LiORofh52?FQ?#3Rj;KfxVissMC5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%cNg*|8=;O;4bRb4FPL)=M3XW|0L&s6kIoS-f)xTVuyNwyZE2b z_P17678c<0^1LsSTz-}E_H}kPJQAX-`*$0M%X{KYBDwhbI-fTTc>@a3HL9zu`q3us zuRDIuP=@4^@gMc?{U_Y41PUMF@_zF^MsjiV?LKFy9-{kk>OkGi%0kDGDi7a~0&k6~ ze<|F0E{+a&-ohWU3CyztcfUd1q@1r`*B#~L(Nmn?pIGb+ceko%-kkgV8C7Uz80G!_ z3-9PiS!UIA`pP?ZDR?L`&}gJil+$>%ONBm~9su~gjmoxG4h~07`n?6D;L${FIDG^&Zbrg-@&bMJ7Z!>Q<_ zfP}0V@#}s|O_8n)YO1`ZLb}80o1V*ETb2eQS((&kc}=zSgAUQb61g%&qK>8YnTk+1 zucXg123=X7)~>}ME^C5Ry0WUK9VVSBT)MXIg_iEv{%iDetESCIhIci)f6KE7tC2js zRC^oR$f@~jf#vnq5^^+GuGTG1CmcERahmlrXa7rUe3JK$&-|~W9~UmxisActivated(); } -//---------------------------------------------------------------------- -inline void FStatusBar::setMessage (FString mgs) -{ text = mgs; } - //---------------------------------------------------------------------- inline FString FStatusBar::getMessage() const { return text; } diff --git a/src/fwidget.cpp b/src/fwidget.cpp index 755c1049..971961cf 100644 --- a/src/fwidget.cpp +++ b/src/fwidget.cpp @@ -1224,6 +1224,7 @@ void FWidget::resize() menubar->setGeometry(1, 1, width, 1, false); if ( vmenubar ) resizeArea(vmenubar); + menubar->adjustSize(); } if ( statusbar ) { @@ -1239,8 +1240,7 @@ void FWidget::resize() while ( iter != end ) { - if ( (*iter)->isVisible() ) - (*iter)->adjustSize(); + (*iter)->adjustSize(); ++iter; } } diff --git a/src/fwidget.h b/src/fwidget.h index fd932f42..1156f6c4 100644 --- a/src/fwidget.h +++ b/src/fwidget.h @@ -422,8 +422,8 @@ class FWidget : public FObject, public FTerm void setBackgroundColor (int); void setX (int, bool = true); void setY (int, bool = true); - void setPos (const FPoint&, bool = true); - void setPos (int, int, bool = true); + virtual void setPos (const FPoint&, bool = true); + virtual void setPos (int, int, bool = true); void setWidth (int, bool = true); void setHeight (int, bool = true); void setTopPadding (int, bool = true); diff --git a/test/menu.cpp b/test/menu.cpp index 29726ee1..272ed72b 100644 --- a/test/menu.cpp +++ b/test/menu.cpp @@ -2,8 +2,6 @@ #include "final.h" -// You have chosen "Cola". - //---------------------------------------------------------------------- // class Menu //---------------------------------------------------------------------- @@ -154,6 +152,7 @@ Menu::Menu (FWidget* parent) "clicked", _METHOD_CALLBACK (this, &Menu::cb_message) ); + Quit->addCallback ( "clicked", @@ -232,8 +231,8 @@ void Menu::onClose (FCloseEvent* ev) //---------------------------------------------------------------------- void Menu::cb_message (FWidget* widget, void*) { - FButton* button = static_cast(widget); - FString text = button->getText(); + FMenuItem* menuitem = static_cast(widget); + FString text = menuitem->getText(); text = text.replace('&', ""); FMessageBox::info (this, "Info", "You have chosen \"" + text + "\""); }