From 0869aa0f6c045bea9ae3b1a030570f27faa90358 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 28 Dec 2016 13:38:35 +0100 Subject: Add Locale config preferences and rearrange UI prefs --- gtk2_ardour/option_editor.cc | 6 ++++ gtk2_ardour/option_editor.h | 2 +- gtk2_ardour/rc_option_editor.cc | 62 +++++++++++++++++++++++++---------------- gtk2_ardour/rc_option_editor.h | 1 + 4 files changed, 46 insertions(+), 25 deletions(-) diff --git a/gtk2_ardour/option_editor.cc b/gtk2_ardour/option_editor.cc index f34bab1b2b..1317d166c4 100644 --- a/gtk2_ardour/option_editor.cc +++ b/gtk2_ardour/option_editor.cc @@ -103,9 +103,15 @@ OptionEditorHeading::add_to_page (OptionEditorPage* p) { int const n = p->table.property_n_rows(); p->table.resize (n + 2, 3); + if (!_note.empty ()) { + p->table.resize (n + 3, 3); + } else { + p->table.resize (n + 2, 3); + } p->table.attach (*manage (new Label ("")), 0, 3, n, n + 1, FILL | EXPAND); p->table.attach (*_label, 0, 3, n + 1, n + 2, FILL | EXPAND); + maybe_add_note (p, n + 2); } void diff --git a/gtk2_ardour/option_editor.h b/gtk2_ardour/option_editor.h index b5d44d577c..e32c489f27 100644 --- a/gtk2_ardour/option_editor.h +++ b/gtk2_ardour/option_editor.h @@ -79,7 +79,7 @@ public: virtual Gtk::Widget& tip_widget() = 0; -private: +protected: void maybe_add_note (OptionEditorPage *, int); std::string _note; diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index db6699e9ad..574933738f 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -3116,30 +3116,6 @@ if (!ARDOUR::Profile->get_mixbus()) { add_option (_("MIDI"), audition_synth); - /* USER INTERACTION */ - - if ( -#ifdef PLATFORM_WINDOWS - true -#else - getenv ("ARDOUR_BUNDLED") -#endif - ) - { - add_option (_("User interaction"), - new BoolOption ( - "enable-translation", - string_compose (_("Use translations of %1 messages\n" - " (requires a restart of %1 to take effect)\n" - " (if available for your language preferences)"), PROGRAM_NAME), - sigc::ptr_fun (ARDOUR::translations_are_enabled), - sigc::ptr_fun (ARDOUR::set_translations_enabled))); - } - - add_option (_("User interaction"), new OptionEditorHeading (_("Keyboard"))); - - add_option (_("User interaction"), new KeyboardOptions); - /* Control Surfaces */ add_option (_("Control Surfaces"), new ControlSurfacesOptions); @@ -3479,6 +3455,40 @@ if (!ARDOUR::Profile->get_mixbus()) { sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_default_narrow_ms) )); +#ifdef ENABLE_NLS + OptionEditorHeading* i18n_head = new OptionEditorHeading (_("Internationalization")); + i18n_head->set_note (string_compose (_("These settings will only take effect after %1 is restarted (if available for your language preferences)."), PROGRAM_NAME)); + + add_option (_("GUI/Translation"), i18n_head); + + bo = new BoolOption ( + "enable-translation", + _("Use translations"), + sigc::ptr_fun (ARDOUR::translations_are_enabled), + sigc::ptr_fun (ARDOUR::set_translations_enabled) + ); + + add_option (_("GUI/Translation"), bo); + + _l10n = new ComboOption ( + "locale-mode", + _("Localization"), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_locale_mode), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_locale_mode) + ); + + _l10n->add (ARDOUR::SET_LC_ALL, _("Set complete locale")); + _l10n->add (ARDOUR::SET_LC_MESSAGES, _("Enable only message translation")); + _l10n->add (ARDOUR::SET_LC_MESSAGES_AND_LC_NUMERIC, _("Translate messages and format numeric format")); + _l10n->set_note (_("This setting is provided for plugin compatibility. e.g. some plugins on some systems expect the decimal point to be a dot.")); + + add_option (_("GUI/Translation"), _l10n); + parameter_changed ("enable-translation"); +#endif // ENABLE_NLS + + add_option (_("GUI/Keyboard"), new OptionEditorHeading (_("Keyboard"))); + add_option (_("GUI/Keyboard"), new KeyboardOptions); + add_option (_("GUI/Toolbar"), new OptionEditorHeading (_("Main Transport Items"))); add_option (_("GUI/Toolbar"), @@ -3763,6 +3773,10 @@ RCOptionEditor::parameter_changed (string const & p) } else if (p == "open-gui-after-adding-plugin" || p == "show-inline-display-by-default") { #if (defined LV2_SUPPORT && defined LV2_EXTENDED) _plugin_prefer_inline->set_sensitive (UIConfiguration::instance().get_open_gui_after_adding_plugin() && UIConfiguration::instance().get_show_inline_display_by_default()); +#endif +#ifdef ENABLE_NLS + } else if (p == "enable-translation") { + _l10n->set_sensitive (ARDOUR::translations_are_enabled ()); #endif } } diff --git a/gtk2_ardour/rc_option_editor.h b/gtk2_ardour/rc_option_editor.h index d6c5bed4a7..e0d0116c36 100644 --- a/gtk2_ardour/rc_option_editor.h +++ b/gtk2_ardour/rc_option_editor.h @@ -60,6 +60,7 @@ private: Gtk::Adjustment* _ltc_volume_adjustment; BoolOption* _ltc_send_continuously; BoolOption* _plugin_prefer_inline; + ComboOption* _l10n; PBD::ScopedConnection parameter_change_connection; PBD::ScopedConnection engine_started_connection; -- cgit v1.2.3