From 6d0857186ee342a5195c3ccf6983a30c0f8ab5c6 Mon Sep 17 00:00:00 2001 From: mfloryan Date: Thu, 28 Feb 2008 16:09:48 +0000 Subject: [PATCH] Reworked swatches context menu slightly to make it more compact and a bit clearer. Added some strings. --- src/ui/widget/panel.cpp | 136 +++++++++++++++++++++++----------------- 1 file changed, 78 insertions(+), 58 deletions(-) diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index 45705b991..fa33dca78 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -115,93 +115,113 @@ void Panel::_init() } _menu = new Gtk::Menu(); + + { + Gtk::RadioMenuItem::Group group; + Glib::ustring one_label(_("List")); + Glib::ustring two_label(_("Grid")); + Gtk::RadioMenuItem *one = manage(new Gtk::RadioMenuItem(group, one_label)); + Gtk::RadioMenuItem *two = manage(new Gtk::RadioMenuItem(group, two_label)); + + if (panel_mode == 0) { + one->set_active(true); + } else if (panel_mode == 1) { + two->set_active(true); + } + + _menu->append(*one); + _non_horizontal.push_back(one); + _menu->append(*two); + _non_horizontal.push_back(two); + Gtk::MenuItem* sep = manage(new Gtk::SeparatorMenuItem()); + _menu->append(*sep); + _non_horizontal.push_back(sep); + one->signal_activate().connect(sigc::bind(sigc::mem_fun(*this, &Panel::_bounceCall), PANEL_SETTING_MODE, 0)); + two->signal_activate().connect(sigc::bind(sigc::mem_fun(*this, &Panel::_bounceCall), PANEL_SETTING_MODE, 1)); + } + { - const char *things[] = { + Glib::ustring heightItemLabel(Q_("swatches|Size")); + + //TRANSLATORS: Indicates size of colour swatches + const gchar *heightLabels[] = { N_("tiny"), N_("small"), - N_("swatches|medium"), + //TRANSLATORS: Translate only the word "medium". Indicates size of colour swatches + N_("swatchesHeight|medium"), N_("large"), N_("huge") }; - Gtk::RadioMenuItem::Group groupOne; - for (unsigned int i = 0; i < G_N_ELEMENTS(things); i++) { - Glib::ustring foo(Q_(things[i])); - Gtk::RadioMenuItem* single = manage(new Gtk::RadioMenuItem(groupOne, foo)); - _menu->append(*single); + + Gtk::MenuItem *sizeItem = manage(new Gtk::MenuItem(heightItemLabel)); + Gtk::Menu *sizeMenu = manage(new Gtk::Menu()); + sizeItem->set_submenu(*sizeMenu); + + Gtk::RadioMenuItem::Group heightGroup; + for (unsigned int i = 0; i < G_N_ELEMENTS(heightLabels); i++) { + Glib::ustring _label(Q_(heightLabels[i])); + Gtk::RadioMenuItem* _item = manage(new Gtk::RadioMenuItem(heightGroup, _label)); + sizeMenu->append(*_item); if (i == panel_size) { - single->set_active(true); + _item->set_active(true); } - single->signal_activate().connect(sigc::bind(sigc::mem_fun(*this, &Panel::_bounceCall), PANEL_SETTING_SIZE, i)); + _item->signal_activate().connect(sigc::bind(sigc::mem_fun(*this, &Panel::_bounceCall), PANEL_SETTING_SIZE, i)); } + + _menu->append(*sizeItem); } - _menu->append(*manage(new Gtk::SeparatorMenuItem())); - Gtk::RadioMenuItem::Group group; - Glib::ustring one_label(_("List")); - Glib::ustring two_label(_("Grid")); - Gtk::RadioMenuItem *one = manage(new Gtk::RadioMenuItem(group, one_label)); - Gtk::RadioMenuItem *two = manage(new Gtk::RadioMenuItem(group, two_label)); - - if (panel_mode == 0) { - one->set_active(true); - } else if (panel_mode == 1) { - two->set_active(true); - } - - _menu->append(*one); - _non_horizontal.push_back(one); - _menu->append(*two); - _non_horizontal.push_back(two); - Gtk::MenuItem* sep = manage(new Gtk::SeparatorMenuItem()); - _menu->append(*sep); - _non_horizontal.push_back(sep); - one->signal_activate().connect(sigc::bind(sigc::mem_fun(*this, &Panel::_bounceCall), PANEL_SETTING_MODE, 0)); - two->signal_activate().connect(sigc::bind(sigc::mem_fun(*this, &Panel::_bounceCall), PANEL_SETTING_MODE, 1)); - + { - Glib::ustring wrap_label(_("Wrap")); - Gtk::CheckMenuItem *check = manage(new Gtk::CheckMenuItem(wrap_label)); - check->set_active(panel_wrap); - _menu->append(*check); - _non_vertical.push_back(check); - - check->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &Panel::_wrapToggled), check)); - } - - { - Glib::ustring type_label(_("Shape")); - - Glib::ustring ellipsis(_("...")); - Glib::ustring shape_1_label(_("Tall")); - Glib::ustring shape_2_label(_("Square")); - Glib::ustring shape_3_label(_("Wide")); + Glib::ustring widthItemLabel(Q_("swatches|Width")); + + //TRANSLATORS: Indicates width of colour swatches + const gchar *widthLabels[] = { + N_("narrower"), + N_("narrow"), + //TRANSLATORS: Translate only the word "medium". Indicates width of colour swatches + N_("swatchesWidth|medium"), + N_("wide"), + N_("wider") + }; - Gtk::MenuItem *item = manage( new Gtk::MenuItem(type_label)); + Gtk::MenuItem *item = manage( new Gtk::MenuItem(widthItemLabel)); Gtk::Menu *type_menu = manage(new Gtk::Menu()); item->set_submenu(*type_menu); _menu->append(*item); - Gtk::RadioMenuItem::Group shapeGroup; + Gtk::RadioMenuItem::Group widthGroup; - - Glib::ustring* labels[] = {&ellipsis, &shape_1_label, &ellipsis, &shape_2_label, &ellipsis, &shape_3_label}; guint values[] = {0, 25, 50, 100, 200, 400}; guint hot_index = 3; - for ( guint i = 0; i < G_N_ELEMENTS(labels); ++i ) { + for ( guint i = 0; i < G_N_ELEMENTS(widthLabels); ++i ) { // Assume all values are in increasing order if ( values[i] <= panel_ratio ) { hot_index = i; } } - for ( guint i = 0; i < G_N_ELEMENTS(labels); ++i ) { - Gtk::RadioMenuItem *single = manage(new Gtk::RadioMenuItem(shapeGroup, *(labels[i]))); - type_menu->append(*single); + for ( guint i = 0; i < G_N_ELEMENTS(widthLabels); ++i ) { + Glib::ustring _label(Q_(widthLabels[i])); + Gtk::RadioMenuItem *_item = manage(new Gtk::RadioMenuItem(widthGroup, _label)); + type_menu->append(*_item); if ( i <= hot_index ) { - single->set_active(true); + _item->set_active(true); } - single->signal_activate().connect(sigc::bind(sigc::mem_fun(*this, &Panel::_bounceCall), PANEL_SETTING_SHAPE, values[i])); + _item->signal_activate().connect(sigc::bind(sigc::mem_fun(*this, &Panel::_bounceCall), PANEL_SETTING_SHAPE, values[i])); } } + { + //TRANSLATORS: Translate only the word "Wrap". Indicates how colour swatches are displayed + Glib::ustring wrap_label(Q_("swatches|Wrap")); + Gtk::CheckMenuItem *check = manage(new Gtk::CheckMenuItem(wrap_label)); + check->set_active(panel_wrap); + _menu->append(*check); + _non_vertical.push_back(check); + + check->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &Panel::_wrapToggled), check)); + } + + Gtk::SeparatorMenuItem *sep; sep = manage(new Gtk::SeparatorMenuItem()); _menu->append(*sep); -- 2.30.2