diff options
Diffstat (limited to 'src/Toolbar.cc')
-rw-r--r-- | src/Toolbar.cc | 58 |
1 files changed, 28 insertions, 30 deletions
diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 1f1b2c4..79e8929 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc | |||
@@ -878,41 +878,39 @@ void Toolbar::setupMenus(bool skip_new_placement) { | |||
878 | 878 | ||
879 | // menu is 3 wide, 5 down | 879 | // menu is 3 wide, 5 down |
880 | if (!skip_new_placement) { | 880 | if (!skip_new_placement) { |
881 | typedef pair<FbTk::FbString, Toolbar::Placement> PlacementP; | 881 | struct PlacementP { |
882 | typedef list<PlacementP> Placements; | 882 | const FbTk::FbString label; |
883 | Placements place_menu; | 883 | Toolbar::Placement placement; |
884 | 884 | }; | |
885 | place_menu.push_back(PlacementP(_FB_XTEXT(Align, TopLeft, "Top Left", "Top Left"), Toolbar::TOPLEFT)); | 885 | |
886 | place_menu.push_back(PlacementP(_FB_XTEXT(Align, LeftTop, "Left Top", "Left Top"), Toolbar::LEFTTOP)); | 886 | static const PlacementP place_menu[] = { |
887 | place_menu.push_back(PlacementP(_FB_XTEXT(Align, LeftCenter, "Left Center", "Left Center"), Toolbar::LEFTCENTER)); | 887 | { _FB_XTEXT(Align, TopLeft, "Top Left", "Top Left"), Toolbar::TOPLEFT}, |
888 | place_menu.push_back(PlacementP(_FB_XTEXT(Align, LeftBottom, "Left Bottom", "Left Bottom"), Toolbar::LEFTBOTTOM)); | 888 | { _FB_XTEXT(Align, LeftTop, "Left Top", "Left Top"), Toolbar::LEFTTOP}, |
889 | place_menu.push_back(PlacementP(_FB_XTEXT(Align, BottomLeft, "Bottom Left", "Bottom Left"), Toolbar::BOTTOMLEFT)); | 889 | { _FB_XTEXT(Align, LeftCenter, "Left Center", "Left Center"), Toolbar::LEFTCENTER}, |
890 | place_menu.push_back(PlacementP(_FB_XTEXT(Align, TopCenter, "Top Center", "Top Center"), Toolbar::TOPCENTER)); | 890 | { _FB_XTEXT(Align, LeftBottom, "Left Bottom", "Left Bottom"), Toolbar::LEFTBOTTOM}, |
891 | place_menu.push_back(PlacementP("", Toolbar::TOPLEFT)); | 891 | { _FB_XTEXT(Align, BottomLeft, "Bottom Left", "Bottom Left"), Toolbar::BOTTOMLEFT}, |
892 | place_menu.push_back(PlacementP("", Toolbar::TOPLEFT)); | 892 | { _FB_XTEXT(Align, TopCenter, "Top Center", "Top Center"), Toolbar::TOPCENTER}, |
893 | place_menu.push_back(PlacementP("", Toolbar::TOPLEFT)); | 893 | { "", Toolbar::TOPLEFT}, |
894 | place_menu.push_back(PlacementP(_FB_XTEXT(Align, BottomCenter, "Bottom Center", "Bottom Center"), Toolbar::BOTTOMCENTER)); | 894 | { "", Toolbar::TOPLEFT}, |
895 | place_menu.push_back(PlacementP(_FB_XTEXT(Align, TopRight, "Top Right", "Top Right"), Toolbar::TOPRIGHT)); | 895 | { "", Toolbar::TOPLEFT}, |
896 | place_menu.push_back(PlacementP(_FB_XTEXT(Align, RightTop, "Right Top", "Right Top"), Toolbar::RIGHTTOP)); | 896 | { _FB_XTEXT(Align, BottomCenter, "Bottom Center", "Bottom Center"), Toolbar::BOTTOMCENTER}, |
897 | place_menu.push_back(PlacementP(_FB_XTEXT(Align, RightCenter, "Right Center", "Right Center"), Toolbar::RIGHTCENTER)); | 897 | { _FB_XTEXT(Align, TopRight, "Top Right", "Top Right"), Toolbar::TOPRIGHT}, |
898 | place_menu.push_back(PlacementP(_FB_XTEXT(Align, RightBottom, "Right Bottom", "Right Bottom"), Toolbar::RIGHTBOTTOM)); | 898 | { _FB_XTEXT(Align, RightTop, "Right Top", "Right Top"), Toolbar::RIGHTTOP}, |
899 | place_menu.push_back(PlacementP(_FB_XTEXT(Align, BottomRight, "Bottom Right", "Bottom Right"), Toolbar::BOTTOMRIGHT)); | 899 | { _FB_XTEXT(Align, RightCenter, "Right Center", "Right Center"), Toolbar::RIGHTCENTER}, |
900 | 900 | { _FB_XTEXT(Align, RightBottom, "Right Bottom", "Right Bottom"), Toolbar::RIGHTBOTTOM}, | |
901 | { _FB_XTEXT(Align, BottomRight, "Bottom Right", "Bottom Right"), Toolbar::BOTTOMRIGHT} | ||
902 | }; | ||
901 | 903 | ||
902 | placementMenu().setMinimumSublevels(3); | 904 | placementMenu().setMinimumSublevels(3); |
903 | // create items in sub menu | 905 | // create items in sub menu |
904 | for (size_t i=0; i<15; ++i) { | 906 | for (size_t i=0; i< sizeof(place_menu)/sizeof(PlacementP); ++i) { |
905 | FbTk::FbString &str = place_menu.front().first; | 907 | const PlacementP& p = place_menu[i]; |
906 | Toolbar::Placement placement = place_menu.front().second; | 908 | if (p.label == "") { |
907 | 909 | placementMenu().insert(p.label); | |
908 | if (str == "") { | ||
909 | placementMenu().insert(""); | ||
910 | placementMenu().setItemEnabled(i, false); | 910 | placementMenu().setItemEnabled(i, false); |
911 | } else | 911 | } else |
912 | placementMenu().insert(new PlaceToolbarMenuItem(str, *this, | 912 | placementMenu().insert(new PlaceToolbarMenuItem(p.label, *this, |
913 | placement)); | 913 | p.placement)); |
914 | |||
915 | place_menu.pop_front(); | ||
916 | } | 914 | } |
917 | } | 915 | } |
918 | 916 | ||