diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2020-05-01 14:28:05 -0600 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2020-05-01 14:33:47 -0600 |
commit | b258ad792e535a7587f2d055ec519ceb3f861f4d (patch) | |
tree | 74e23cf2bb4849ba0229663de8ba0ca207d1de98 | |
parent | 51795d2e117cd05d6951b70dcda57faa757d56b4 (diff) |
force provision of "menu-name" for all WindowProxy objects, and thus Tabbables
Actions for hide/show/attach/detach tabbables use hard-coded names which are not
translated. Using Tabbable/WindowProxy::name() to lookup the action will fail,
since the name can be translated. This changes just removes the option to not
provide a menu-name when creating these objects, and uses the name menu-name
when looking up an action by name
-rw-r--r-- | gtk2_ardour/ardour_ui_dialogs.cc | 42 | ||||
-rw-r--r-- | gtk2_ardour/mixer_ui.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/public_editor.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/rc_option_editor.cc | 2 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/window_proxy.h | 1 | ||||
-rw-r--r-- | libs/gtkmm2ext/window_proxy.cc | 13 | ||||
-rw-r--r-- | libs/widgets/tabbable.cc | 4 | ||||
-rw-r--r-- | libs/widgets/widgets/tabbable.h | 2 |
8 files changed, 27 insertions, 41 deletions
diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc index 143d9bc4c9..f8b35c6e94 100644 --- a/gtk2_ardour/ardour_ui_dialogs.cc +++ b/gtk2_ardour/ardour_ui_dialogs.cc @@ -698,7 +698,7 @@ ARDOUR_UI::tabbable_state_change (Tabbable& t) std::vector<std::string> active_action_names; std::vector<std::string> inactive_action_names; Glib::RefPtr<Action> action; - std::string downcased_name = downcase (t.name()); + enum ViewState { Tabbed, Windowed, @@ -708,31 +708,31 @@ ARDOUR_UI::tabbable_state_change (Tabbable& t) if (t.tabbed()) { - insensitive_action_names.push_back (string_compose ("attach-%1", downcased_name)); - sensitive_action_names.push_back (string_compose ("show-%1", downcased_name)); - sensitive_action_names.push_back (string_compose ("detach-%1", downcased_name)); - sensitive_action_names.push_back (string_compose ("hide-%1", downcased_name)); + insensitive_action_names.push_back (string_compose ("attach-%1", t.menu_name())); + sensitive_action_names.push_back (string_compose ("show-%1", t.menu_name())); + sensitive_action_names.push_back (string_compose ("detach-%1", t.menu_name())); + sensitive_action_names.push_back (string_compose ("hide-%1", t.menu_name())); vs = Tabbed; } else if (t.tabbed_by_default ()) { - insensitive_action_names.push_back (string_compose ("attach-%1", downcased_name)); - insensitive_action_names.push_back (string_compose ("hide-%1", downcased_name)); - sensitive_action_names.push_back (string_compose ("show-%1", downcased_name)); - sensitive_action_names.push_back (string_compose ("detach-%1", downcased_name)); + insensitive_action_names.push_back (string_compose ("attach-%1", t.menu_name())); + insensitive_action_names.push_back (string_compose ("hide-%1", t.menu_name())); + sensitive_action_names.push_back (string_compose ("show-%1", t.menu_name())); + sensitive_action_names.push_back (string_compose ("detach-%1", t.menu_name())); vs = Hidden; } else if (t.window_visible()) { - insensitive_action_names.push_back (string_compose ("detach-%1", downcased_name)); - sensitive_action_names.push_back (string_compose ("show-%1", downcased_name)); - sensitive_action_names.push_back (string_compose ("attach-%1", downcased_name)); - sensitive_action_names.push_back (string_compose ("hide-%1", downcased_name)); + insensitive_action_names.push_back (string_compose ("detach-%1", t.menu_name())); + sensitive_action_names.push_back (string_compose ("show-%1", t.menu_name())); + sensitive_action_names.push_back (string_compose ("attach-%1", t.menu_name())); + sensitive_action_names.push_back (string_compose ("hide-%1", t.menu_name())); - active_action_names.push_back (string_compose ("show-%1", downcased_name)); - inactive_action_names.push_back (string_compose ("hide-%1", downcased_name)); + active_action_names.push_back (string_compose ("show-%1", t.menu_name())); + inactive_action_names.push_back (string_compose ("hide-%1", t.menu_name())); vs = Windowed; @@ -742,13 +742,13 @@ ARDOUR_UI::tabbable_state_change (Tabbable& t) * it visible. */ - insensitive_action_names.push_back (string_compose ("detach-%1", downcased_name)); - insensitive_action_names.push_back (string_compose ("hide-%1", downcased_name)); - sensitive_action_names.push_back (string_compose ("show-%1", downcased_name)); - sensitive_action_names.push_back (string_compose ("attach-%1", downcased_name)); + insensitive_action_names.push_back (string_compose ("detach-%1", t.menu_name())); + insensitive_action_names.push_back (string_compose ("hide-%1", t.menu_name())); + sensitive_action_names.push_back (string_compose ("show-%1", t.menu_name())); + sensitive_action_names.push_back (string_compose ("attach-%1", t.menu_name())); - active_action_names.push_back (string_compose ("hide-%1", downcased_name)); - inactive_action_names.push_back (string_compose ("show-%1", downcased_name)); + active_action_names.push_back (string_compose ("hide-%1", t.menu_name())); + inactive_action_names.push_back (string_compose ("show-%1", t.menu_name())); vs = Hidden; } diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index 20dadf672f..5db4e18c65 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -112,7 +112,7 @@ Mixer_UI::instance () } Mixer_UI::Mixer_UI () - : Tabbable (_content, _("Mixer")) + : Tabbable (_content, _("Mixer"), X_("mixer")) , no_track_list_redisplay (false) , in_group_row_change (false) , track_menu (0) diff --git a/gtk2_ardour/public_editor.cc b/gtk2_ardour/public_editor.cc index 1e5d304ab2..4ca046726f 100644 --- a/gtk2_ardour/public_editor.cc +++ b/gtk2_ardour/public_editor.cc @@ -32,7 +32,7 @@ const int PublicEditor::horizontal_spacing = 6; sigc::signal<void> PublicEditor::DropDownKeys; PublicEditor::PublicEditor (Gtk::Widget& content) - : Tabbable (content, _("Editor")) + : Tabbable (content, _("Editor"), X_("editor")) , _suspend_route_redisplay_counter (0) { } diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index 1e7b565128..b323c1c0e6 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -2294,7 +2294,7 @@ MidiPortOptions::pretty_name_edit (std::string const & path, string const & new_ RCOptionEditor::RCOptionEditor () : OptionEditorContainer (Config, string_compose (_("%1 Preferences"), PROGRAM_NAME)) /* pack self-as-vbox into tabbable */ - , Tabbable (*this, _("Preferences"), /* detached by default */ false) + , Tabbable (*this, _("Preferences"), _("preferences"), /* detached by default */ false) , _rc_config (Config) , _mixer_strip_visibility ("mixer-element-visibility") { diff --git a/libs/gtkmm2ext/gtkmm2ext/window_proxy.h b/libs/gtkmm2ext/gtkmm2ext/window_proxy.h index 13d3d1530f..04dd248353 100644 --- a/libs/gtkmm2ext/gtkmm2ext/window_proxy.h +++ b/libs/gtkmm2ext/gtkmm2ext/window_proxy.h @@ -40,7 +40,6 @@ class VisibilityTracker; class LIBGTKMM2EXT_API WindowProxy : public PBD::StatefulDestructible, public virtual sigc::trackable { public: - WindowProxy (const std::string& name); WindowProxy (const std::string& name, const std::string& menu_name); WindowProxy (const std::string& name, const std::string& menu_name, const XMLNode&); virtual ~WindowProxy(); diff --git a/libs/gtkmm2ext/window_proxy.cc b/libs/gtkmm2ext/window_proxy.cc index 1635f033e1..6e3191abd8 100644 --- a/libs/gtkmm2ext/window_proxy.cc +++ b/libs/gtkmm2ext/window_proxy.cc @@ -31,19 +31,6 @@ using namespace Gtk; using namespace Gtkmm2ext; using namespace PBD; -WindowProxy::WindowProxy (const std::string& name) - : _name (name) - , _window (0) - , _visible (false) - , _x_off (-1) - , _y_off (-1) - , _width (-1) - , _height (-1) - , vistracker (0) - , _state_mask (StateMask (Position|Size)) -{ -} - WindowProxy::WindowProxy (const std::string& name, const std::string& menu_name) : _name (name) , _menu_name (menu_name) diff --git a/libs/widgets/tabbable.cc b/libs/widgets/tabbable.cc index 537751d315..fee22bd435 100644 --- a/libs/widgets/tabbable.cc +++ b/libs/widgets/tabbable.cc @@ -37,8 +37,8 @@ using namespace Gtk; using namespace Gtkmm2ext; using namespace ArdourWidgets; -Tabbable::Tabbable (Widget& w, const string& name, bool tabbed_by_default) - : WindowProxy (name) +Tabbable::Tabbable (Widget& w, const string& visible_name, string const & nontranslatable_name, bool tabbed_by_default) + : WindowProxy (visible_name, nontranslatable_name) , _contents (w) , _parent_notebook (0) , tab_requested_by_state (tabbed_by_default) diff --git a/libs/widgets/widgets/tabbable.h b/libs/widgets/widgets/tabbable.h index f194485517..af2ced6e27 100644 --- a/libs/widgets/widgets/tabbable.h +++ b/libs/widgets/widgets/tabbable.h @@ -44,7 +44,7 @@ namespace ArdourWidgets { class LIBWIDGETS_API Tabbable : public Gtkmm2ext::WindowProxy { public: - Tabbable (Gtk::Widget&, const std::string&, bool tabbed_by_default = true); + Tabbable (Gtk::Widget&, const std::string& user_visible_name, std::string const & untranslated_name, bool tabbed_by_default = true); ~Tabbable (); void add_to_notebook (Gtk::Notebook& notebook, const std::string& tab_title); |