diff options
author | rathnor <rathnor> | 2004-06-07 11:46:05 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2004-06-07 11:46:05 (GMT) |
commit | fff4456dee29e675d7f2ed3490db39bcb7e10e53 (patch) | |
tree | 2d2dbf386551773cbdc8231b2a93b493187bd733 /src/Toolbar.cc | |
parent | 073065ac56b388db1169108d44f37d32f1d19c67 (diff) | |
download | fluxbox-fff4456dee29e675d7f2ed3490db39bcb7e10e53.zip fluxbox-fff4456dee29e675d7f2ed3490db39bcb7e10e53.tar.bz2 |
update NLS string handling...
Diffstat (limited to 'src/Toolbar.cc')
-rw-r--r-- | src/Toolbar.cc | 116 |
1 files changed, 56 insertions, 60 deletions
diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 15efb99..5d74b3c 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Toolbar.cc,v 1.139 2004/04/26 15:04:37 rathnor Exp $ | 25 | // $Id: Toolbar.cc,v 1.140 2004/06/07 11:46:04 rathnor Exp $ |
26 | 26 | ||
27 | #include "Toolbar.hh" | 27 | #include "Toolbar.hh" |
28 | 28 | ||
@@ -32,7 +32,7 @@ | |||
32 | // themes | 32 | // themes |
33 | #include "ToolbarTheme.hh" | 33 | #include "ToolbarTheme.hh" |
34 | 34 | ||
35 | #include "I18n.hh" | 35 | #include "FbTk/I18n.hh" |
36 | #include "fluxbox.hh" | 36 | #include "fluxbox.hh" |
37 | #include "Screen.hh" | 37 | #include "Screen.hh" |
38 | #include "IntResMenuItem.hh" | 38 | #include "IntResMenuItem.hh" |
@@ -225,7 +225,7 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, size_t width): | |||
225 | scrn.name() + ".toolbar.tools", scrn.altName() + ".Toolbar.Tools"), | 225 | scrn.name() + ".toolbar.tools", scrn.altName() + ".Toolbar.Tools"), |
226 | m_shape(new Shape(frame.window, 0)), | 226 | m_shape(new Shape(frame.window, 0)), |
227 | m_resize_lock(false) { | 227 | m_resize_lock(false) { |
228 | 228 | _FB_USES_NLS; | |
229 | // we need to get notified when the theme is reloaded | 229 | // we need to get notified when the theme is reloaded |
230 | m_theme.reconfigSig().attach(this); | 230 | m_theme.reconfigSig().attach(this); |
231 | // listen to screen size changes | 231 | // listen to screen size changes |
@@ -234,15 +234,14 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, size_t width): | |||
234 | 234 | ||
235 | moveToLayer((*m_rc_layernum).getNum()); | 235 | moveToLayer((*m_rc_layernum).getNum()); |
236 | 236 | ||
237 | // TODO: nls | 237 | m_layermenu.setLabel(_FBTEXT(Toolbar, Layer, "Toolbar Layer", "Title of toolbar layer menu")); |
238 | m_layermenu.setLabel("Toolbar Layer"); | 238 | m_placementmenu.setLabel(_FBTEXT(Toolbar, Placement, "Toolbar Placement", "Title of toolbar placement menu")); |
239 | m_placementmenu.setLabel("Toolbar Placement"); | ||
240 | 239 | ||
241 | m_layermenu.setInternalMenu(); | 240 | m_layermenu.setInternalMenu(); |
242 | m_placementmenu.setInternalMenu(); | 241 | m_placementmenu.setInternalMenu(); |
243 | setupMenus(); | 242 | setupMenus(); |
244 | // add menu to screen | 243 | // add menu to screen |
245 | screen().addConfigMenu("Toolbar", menu()); | 244 | screen().addConfigMenu(_FBTEXT(Toolbar, Toolbar, "Toolbar", "title of toolbar menu item"), menu()); |
246 | 245 | ||
247 | // geometry settings | 246 | // geometry settings |
248 | frame.width = width; | 247 | frame.width = width; |
@@ -751,8 +750,7 @@ void Toolbar::moveToLayer(int layernum) { | |||
751 | } | 750 | } |
752 | 751 | ||
753 | void Toolbar::setupMenus() { | 752 | void Toolbar::setupMenus() { |
754 | const I18n &i18n = *I18n::instance(); | 753 | _FB_USES_NLS; |
755 | using namespace FBNLS; | ||
756 | using namespace FbTk; | 754 | using namespace FbTk; |
757 | 755 | ||
758 | typedef RefCount<Command> RefCommand; | 756 | typedef RefCount<Command> RefCommand; |
@@ -762,14 +760,14 @@ void Toolbar::setupMenus() { | |||
762 | 760 | ||
763 | 761 | ||
764 | RefCommand start_edit(CommandParser::instance().parseLine("setworkspacenamedialog")); | 762 | RefCommand start_edit(CommandParser::instance().parseLine("setworkspacenamedialog")); |
765 | menu().insert(i18n.getMessage(FBNLS::ToolbarSet, FBNLS::ToolbarEditWkspcName, | 763 | menu().insert(_FBTEXT(Toolbar, EditWkspcName, |
766 | "Edit current workspace name"), | 764 | "Edit current workspace name", "Edit current workspace name"), |
767 | start_edit); | 765 | start_edit); |
768 | 766 | ||
769 | menu().setLabel(i18n.getMessage(FBNLS::ToolbarSet, FBNLS::ToolbarToolbarTitle, | 767 | menu().setLabel(_FBTEXT(Toolbar, ToolbarTitle, |
770 | "Toolbar")); | 768 | "Toolbar", "Title of Toolbar menu")); |
771 | 769 | ||
772 | MenuItem *toolbar_menuitem = new IntResMenuItem("Toolbar width percent", | 770 | MenuItem *toolbar_menuitem = new IntResMenuItem(_FBTEXT(Toolbar, WidthPercent, "Toolbar width percent", "Percentage of screen width taken by toolbar"), |
773 | m_rc_width_percent, | 771 | m_rc_width_percent, |
774 | 0, 100); // min/max value | 772 | 0, 100); // min/max value |
775 | 773 | ||
@@ -785,8 +783,8 @@ void Toolbar::setupMenus() { | |||
785 | 783 | ||
786 | menu().insert(toolbar_menuitem); | 784 | menu().insert(toolbar_menuitem); |
787 | 785 | ||
788 | menu().insert(new BoolMenuItem(i18n.getMessage(FBNLS::CommonSet, FBNLS::CommonAutoHide, | 786 | menu().insert(new BoolMenuItem(_FBTEXT(Common, AutoHide, |
789 | "Auto hide"), | 787 | "Auto hide", "Toggle auto hide of toolbar"), |
790 | *m_rc_auto_hide, | 788 | *m_rc_auto_hide, |
791 | reconfig_toolbar_and_save_resource)); | 789 | reconfig_toolbar_and_save_resource)); |
792 | 790 | ||
@@ -795,66 +793,64 @@ void Toolbar::setupMenus() { | |||
795 | visible_macro->add(toggle_visible); | 793 | visible_macro->add(toggle_visible); |
796 | visible_macro->add(save_resources); | 794 | visible_macro->add(save_resources); |
797 | RefCommand toggle_visible_cmd(visible_macro); | 795 | RefCommand toggle_visible_cmd(visible_macro); |
798 | menu().insert(new BoolMenuItem("Visible", *m_rc_visible, toggle_visible_cmd)); | 796 | menu().insert(new BoolMenuItem(_FBTEXT(Common, Visible, "Visible", "Whether this item is visible"), |
797 | *m_rc_visible, toggle_visible_cmd)); | ||
799 | 798 | ||
800 | menu().insert(new BoolMenuItem("Maximize Over", *m_rc_maximize_over, | 799 | menu().insert(new BoolMenuItem(_FBTEXT(Common, MaximizeOver,"Maximize Over", "Maximize over this thing when maximizing"), |
800 | *m_rc_maximize_over, | ||
801 | reconfig_toolbar_and_save_resource)); | 801 | reconfig_toolbar_and_save_resource)); |
802 | menu().insert("Layer...", &layermenu()); | 802 | menu().insert(_FBTEXT(Menu, Layer, "Layer...", "Title of Layer menu"), &layermenu()); |
803 | 803 | ||
804 | 804 | ||
805 | 805 | ||
806 | if (screen().hasXinerama()) { | 806 | if (screen().hasXinerama()) { |
807 | // TODO: nls (main label plus menu heading | 807 | menu().insert(_FBTEXT(Menu, OnHead, "On Head...", "Title of On Head menu"), |
808 | menu().insert("On Head...", new XineramaHeadMenu<Toolbar>(screen().menuTheme(), | 808 | new XineramaHeadMenu<Toolbar>(screen().menuTheme(), |
809 | screen(), | 809 | screen(), |
810 | screen().imageControl(), | 810 | screen().imageControl(), |
811 | *screen().layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), | 811 | *screen().layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), |
812 | *this, | 812 | *this, |
813 | "Toolbar on Head")); | 813 | _FBTEXT(Toolbar, OnHead, "Toolbar on Head", "Title of toolbar on head menu"))); |
814 | } | 814 | } |
815 | 815 | ||
816 | // setup items in placement menu | 816 | typedef list<pair<const char *, Toolbar::Placement> > Placements; |
817 | struct { | 817 | Placements place_menu; |
818 | int set; | 818 | |
819 | int base; | 819 | // menu is 3 wide, 5 down |
820 | const char *default_str; | 820 | place_menu.push_back(make_pair(_FBTEXT(Align, TopLeft, "Top Left", "Top Left"), Toolbar::TOPLEFT)); |
821 | Toolbar::Placement placement; | 821 | place_menu.push_back(make_pair(_FBTEXT(Align, LeftTop, "Left Top", "Left Top"), Toolbar::LEFTTOP)); |
822 | } place_menu[] = { | 822 | place_menu.push_back(make_pair(_FBTEXT(Align, LeftCenter, "Left Center", "Left Center"), Toolbar::LEFTCENTER)); |
823 | {0, 0, "Top Left", Toolbar::TOPLEFT}, | 823 | place_menu.push_back(make_pair(_FBTEXT(Align, LeftBottom, "Left Bottom", "Left Bottom"), Toolbar::LEFTBOTTOM)); |
824 | 824 | place_menu.push_back(make_pair(_FBTEXT(Align, BottomLeft, "Bottom Left", "Bottom Left"), Toolbar::BOTTOMLEFT)); | |
825 | {0, 0, "Left Top", Toolbar::LEFTTOP}, | 825 | place_menu.push_back(make_pair(_FBTEXT(Align, TopCenter, "Top Center", "Top Center"), Toolbar::TOPCENTER)); |
826 | {0, 0, "Left Center", Toolbar::LEFTCENTER}, | 826 | place_menu.push_back(make_pair((const char *)0, Toolbar::TOPLEFT)); |
827 | {0, 0, "Left Bottom", Toolbar::LEFTBOTTOM}, | 827 | place_menu.push_back(make_pair((const char *)0, Toolbar::TOPLEFT)); |
828 | 828 | place_menu.push_back(make_pair((const char *)0, Toolbar::TOPLEFT)); | |
829 | {0, 0, "Bottom Left", Toolbar::BOTTOMLEFT}, | 829 | place_menu.push_back(make_pair(_FBTEXT(Align, BottomCenter, "Bottom Center", "Bottom Center"), Toolbar::BOTTOMCENTER)); |
830 | {0, 0, "Top Center", Toolbar::TOPCENTER}, | 830 | place_menu.push_back(make_pair(_FBTEXT(Align, TopRight, "Top Right", "Top Right"), Toolbar::TOPRIGHT)); |
831 | {0, 0, 0, Toolbar::TOPCENTER}, | 831 | place_menu.push_back(make_pair(_FBTEXT(Align, RightTop, "Right Top", "Right Top"), Toolbar::RIGHTTOP)); |
832 | {0, 0, 0, Toolbar::BOTTOMCENTER}, | 832 | place_menu.push_back(make_pair(_FBTEXT(Align, RightCenter, "Right Center", "Right Center"), Toolbar::RIGHTCENTER)); |
833 | {0, 0, 0, Toolbar::BOTTOMCENTER}, | 833 | place_menu.push_back(make_pair(_FBTEXT(Align, RightBottom, "Right Bottom", "Right Bottom"), Toolbar::RIGHTBOTTOM)); |
834 | {0, 0, "Bottom Center", Toolbar::BOTTOMCENTER}, | 834 | place_menu.push_back(make_pair(_FBTEXT(Align, BottomRight, "Bottom Right", "Bottom Right"), Toolbar::BOTTOMRIGHT)); |
835 | {0, 0, "Top Right", Toolbar::TOPRIGHT}, | 835 | |
836 | 836 | ||
837 | {0, 0, "Right Top", Toolbar::RIGHTTOP}, | ||
838 | {0, 0, "Right Center", Toolbar::RIGHTCENTER}, | ||
839 | {0, 0, "Right Bottom", Toolbar::RIGHTBOTTOM}, | ||
840 | |||
841 | {0, 0, "Bottom Right", Toolbar::BOTTOMRIGHT} | ||
842 | }; | ||
843 | placementMenu().setMinimumSublevels(3); | 837 | placementMenu().setMinimumSublevels(3); |
844 | // create items in sub menu | 838 | // create items in sub menu |
845 | for (size_t i=0; i<15; ++i) { | 839 | for (size_t i=0; i<15; ++i) { |
846 | if (place_menu[i].default_str == 0) { | 840 | const char *str = place_menu.front().first; |
841 | Toolbar::Placement placement = place_menu.front().second; | ||
842 | |||
843 | if (str == 0) { | ||
847 | placementMenu().insert(""); | 844 | placementMenu().insert(""); |
845 | placementMenu().setItemEnabled(i, false); | ||
848 | } else { | 846 | } else { |
849 | const char *i18n_str = i18n.getMessage(place_menu[i].set, | 847 | RefCommand setplace(new SetToolbarPlacementCmd(*this, placement)); |
850 | place_menu[i].base, | 848 | placementMenu().insert(str, setplace); |
851 | place_menu[i].default_str); | ||
852 | RefCommand setplace(new SetToolbarPlacementCmd(*this, place_menu[i].placement)); | ||
853 | placementMenu().insert(i18n_str, setplace); | ||
854 | 849 | ||
855 | } | 850 | } |
851 | place_menu.pop_front(); | ||
856 | } | 852 | } |
857 | menu().insert("Placement", &placementMenu()); | 853 | menu().insert(_FBTEXT(Menu, Placement, "Placement", "Title of Placement menu"), &placementMenu()); |
858 | placementMenu().update(); | 854 | placementMenu().update(); |
859 | menu().update(); | 855 | menu().update(); |
860 | } | 856 | } |