diff --git a/libs/ardour/ardour/rc_configuration.h b/libs/ardour/ardour/rc_configuration.h index 2de06db887..688905fbf0 100644 --- a/libs/ardour/ardour/rc_configuration.h +++ b/libs/ardour/ardour/rc_configuration.h @@ -46,7 +46,7 @@ class LIBARDOUR_API RCConfiguration : public PBD::Configuration void map_parameters (boost::function&); int set_state (XMLNode const &, int version); XMLNode& get_state () const; - XMLNode& get_variables () const; + XMLNode& get_variables (std::string const & nodename) const; void set_variables (XMLNode const &); int load_state (); diff --git a/libs/ardour/ardour/session_configuration.h b/libs/ardour/ardour/session_configuration.h index f62495ef2b..0b0742e47d 100644 --- a/libs/ardour/ardour/session_configuration.h +++ b/libs/ardour/ardour/session_configuration.h @@ -33,7 +33,7 @@ public: void map_parameters (boost::function&); int set_state (XMLNode const &, int version); XMLNode& get_state () const; - XMLNode& get_variables () const; + XMLNode& get_variables (std::string const & nodename) const; void set_variables (XMLNode const &); bool load_state (); diff --git a/libs/ardour/rc_configuration.cc b/libs/ardour/rc_configuration.cc index 7cc6301f10..089a1f76d8 100644 --- a/libs/ardour/rc_configuration.cc +++ b/libs/ardour/rc_configuration.cc @@ -27,6 +27,7 @@ #include "pbd/gstdio_compat.h" #include +#include "pbd/convert.h" #include "pbd/xml++.h" #include "pbd/file_utils.h" #include "pbd/replace_all.h" @@ -206,7 +207,7 @@ RCConfiguration::get_state () const root = new XMLNode("Ardour"); - root->add_child_nocopy (get_variables ()); + root->add_child_nocopy (get_variables (X_("Config"))); root->add_child_nocopy (SessionMetadata::Metadata()->get_user_state()); @@ -224,11 +225,11 @@ RCConfiguration::get_state () const } XMLNode& -RCConfiguration::get_variables () const +RCConfiguration::get_variables (std::string const & node_name) const { XMLNode* node; - node = new XMLNode ("Config"); + node = new XMLNode (node_name); #undef CONFIG_VARIABLE #undef CONFIG_VARIABLE_SPECIAL @@ -312,508 +313,510 @@ RCConfiguration::map_parameters (boost::function& functor) void RCConfiguration::build_metadata () { -#define VAR_META(name,...) { char const * _x[] { __VA_ARGS__ }; all_metadata.insert (std::make_pair ((name), PBD::internationalize (PACKAGE, _x))); } + using namespace PBD; + +#define VAR_META(name,...) { char const * _x[] { __VA_ARGS__ }; Configuration::all_metadata.insert (std::make_pair ((name), internationalize_and_upcase (PACKAGE, _x))); } VAR_META (X_("afl-position"), - "foo", "bar" + NULL ); VAR_META (X_("all-safe"), - "" + NULL ); VAR_META (X_("allow-special-bus-removal"), - "" + NULL ); VAR_META (X_("ask-replace-instrument"), - "" + NULL ); VAR_META (X_("ask-setup-instrument"), - "" + NULL ); VAR_META (X_("auditioner-output-left"), - "" + NULL ); VAR_META (X_("auditioner-output-right"), - "" + NULL ); VAR_META (X_("auto-analyse-audio"), - "" + NULL ); VAR_META (X_("auto-connect-standard-busses"), - "" + NULL ); VAR_META (X_("auto-input-does-talkback"), - "" + NULL ); VAR_META (X_("auto-return-after-rewind-ffwd"), - "" + NULL ); VAR_META (X_("auto-return-target-list"), - "" + NULL ); VAR_META (X_("automation-follows-regions"), - "" + NULL ); VAR_META (X_("automation-interval-msecs"), - "" + NULL ); VAR_META (X_("automation-thinning-factor"), - "" + NULL ); VAR_META (X_("buffering-preset"), - "" + NULL ); VAR_META (X_("capture-buffer-seconds"), - "" + NULL ); VAR_META (X_("click-emphasis-sound"), - "" + NULL ); VAR_META (X_("click-gain"), - "" + NULL ); VAR_META (X_("click-record-only"), - "" + NULL ); VAR_META (X_("click-sound"), - "" + NULL ); VAR_META (X_("clicking"), - "" + NULL ); VAR_META (X_("clip-library-dir"), - "" + NULL ); VAR_META (X_("conceal-lv1-if-lv2-exists"), - "" + NULL ); VAR_META (X_("conceal-vst2-if-vst3-exists"), - "" + NULL ); VAR_META (X_("copy-demo-sessions"), - "" + NULL ); VAR_META (X_("cpu-dma-latency"), - "" + NULL ); VAR_META (X_("create-xrun-marker"), - "" + NULL ); VAR_META (X_("default-automation-time-domain"), - "" + NULL ); VAR_META (X_("default-fade-shape"), - "" + NULL ); VAR_META (X_("default-session-parent-dir"), - "" + NULL ); VAR_META (X_("default-trigger-input-port"), - "" + NULL ); VAR_META (X_("denormal-model"), - "" + NULL ); VAR_META (X_("denormal-protection"), - "" + NULL ); VAR_META (X_("deprecated-hiding-groups-deactivates-groups"), - "" + NULL ); VAR_META (X_("disable-disarm-during-roll"), - "" + NULL ); VAR_META (X_("discover-plugins-on-start"), - "" + NULL ); VAR_META (X_("disk-choice-space-threshold"), - "" + NULL ); VAR_META (X_("display-first-midi-bank-as-zero"), - "" + NULL ); VAR_META (X_("donate-url"), - "" + NULL ); VAR_META (X_("edit-mode"), - "" + NULL ); VAR_META (X_("exclusive-solo"), - "" + NULL ); VAR_META (X_("export-preroll"), - "" + NULL ); VAR_META (X_("export-silence-threshold"), - "" + NULL ); VAR_META (X_("feedback-interval-ms"), - "" + NULL ); VAR_META (X_("group-override-inverts"), - "" + NULL ); VAR_META (X_("hide-dummy-backend"), - "" + NULL ); VAR_META (X_("history-depth"), - "" + NULL ); VAR_META (X_("initial-program-change"), - "" + NULL ); VAR_META (X_("input-auto-connect"), - "" + NULL ); VAR_META (X_("inter-scene-gap-samples"), - "" + NULL ); VAR_META (X_("interview-editing"), - "" + NULL ); VAR_META (X_("latched-record-enable"), - "" + NULL ); VAR_META (X_("layer-model"), - "" + NULL ); VAR_META (X_("limit-n-automatables"), - "" + NULL ); VAR_META (X_("link-send-and-route-panner"), - "" + NULL ); VAR_META (X_("listen-position"), - "" + NULL ); VAR_META (X_("locate-while-waiting-for-sync"), - "" + NULL ); VAR_META (X_("loop-fade-choice"), - "" + NULL ); VAR_META (X_("loop-is-mode"), - "" + NULL ); VAR_META (X_("ltc-output-port"), - "" + NULL ); VAR_META (X_("ltc-output-volume"), - "" + NULL ); VAR_META (X_("ltc-send-continuously"), - "" + NULL ); VAR_META (X_("max-gain"), - "" + NULL ); VAR_META (X_("max-recent-sessions"), - "" + NULL ); VAR_META (X_("max-recent-templates"), - "" + NULL ); VAR_META (X_("max-transport-speed"), - "" + NULL ); VAR_META (X_("meter-falloff"), - "" + NULL ); VAR_META (X_("meter-type-bus"), - "" + NULL ); VAR_META (X_("meter-type-master"), - "" + NULL ); VAR_META (X_("meter-type-track"), - "" + NULL ); VAR_META (X_("midi-audition-synth-uri"), - "" + NULL ); VAR_META (X_("midi-clock-sets-tempo"), - "" + NULL ); VAR_META (X_("midi-feedback"), - "" + NULL ); VAR_META (X_("midi-input-follows-selection"), - "" + NULL ); VAR_META (X_("midi-track-buffer-seconds"), - "" + NULL ); VAR_META (X_("minimum-disk-read-bytes"), - "" + NULL ); VAR_META (X_("minimum-disk-write-bytes"), - "" + NULL ); VAR_META (X_("mmc-control"), - "" + NULL ); VAR_META (X_("mmc-receive-device-id"), - "" + NULL ); VAR_META (X_("mmc-send-device-id"), - "" + NULL ); VAR_META (X_("monitor-bus-preferred-bundle"), - "" + NULL ); VAR_META (X_("monitoring-model"), - "" + NULL ); VAR_META (X_("mtc-qf-speed-tolerance"), - "" + NULL ); VAR_META (X_("mute-affects-control-outs"), - "" + NULL ); VAR_META (X_("mute-affects-main-outs"), - "" + NULL ); VAR_META (X_("mute-affects-post-fader"), - "" + NULL ); VAR_META (X_("mute-affects-pre-fader"), - "" + NULL ); VAR_META (X_("new-plugins-active"), - "" + NULL ); VAR_META (X_("osc-port"), - "" + NULL ); VAR_META (X_("output-auto-connect"), - "" + NULL ); VAR_META (X_("periodic-safety-backup-interval"), - "" + NULL ); VAR_META (X_("periodic-safety-backups"), - "" + NULL ); VAR_META (X_("pfl-position"), - "" + NULL ); VAR_META (X_("pingback-url"), - "" + NULL ); VAR_META (X_("playback-buffer-seconds"), - "" + NULL ); VAR_META (X_("plugin-cache-version"), - "" + NULL ); VAR_META (X_("plugin-path-lxvst"), - "" + NULL ); VAR_META (X_("plugin-path-vst"), - "" + NULL ); VAR_META (X_("plugin-path-vst3"), - "" + NULL ); VAR_META (X_("plugin-scan-timeout"), - "" + NULL ); VAR_META (X_("plugins-stop-with-transport"), - "" + NULL ); VAR_META (X_("port-resampler-quality"), - "" + NULL ); VAR_META (X_("preroll-seconds"), - "" + NULL ); VAR_META (X_("processor-usage"), - "" + NULL ); VAR_META (X_("quieten-at-speed"), - "" + NULL ); VAR_META (X_("range-location-minimum"), - "" + NULL ); VAR_META (X_("range-selection-after-split"), - "" + NULL ); VAR_META (X_("recording-resets-xrun-count"), - "" + NULL ); VAR_META (X_("reference-manual-url"), - "" + NULL ); VAR_META (X_("region-boundaries-from-onscreen_tracks"), - "" + NULL ); VAR_META (X_("region-boundaries-from-selected-tracks"), - "" + NULL ); VAR_META (X_("region-equivalency"), - "" + NULL ); VAR_META (X_("region-selection-after-split"), - "" + NULL ); VAR_META (X_("replicate-missing-region-channels"), - "" + NULL ); VAR_META (X_("reset-default-speed-on-stop"), - "" + NULL ); VAR_META (X_("resource-index-url"), - "" + NULL ); VAR_META (X_("rewind-ffwd-like-tape-decks"), - "" + NULL ); VAR_META (X_("ripple-mode"), - "" + NULL ); VAR_META (X_("run-all-transport-masters-always"), - "" + NULL ); VAR_META (X_("sample-lib-path"), - "" + NULL ); VAR_META (X_("save-history"), - "" + NULL ); VAR_META (X_("save-history-depth"), - "" + NULL ); VAR_META (X_("send-ltc"), - "" + NULL ); VAR_META (X_("send-midi-clock"), - "" + NULL ); VAR_META (X_("send-mmc"), - "" + NULL ); VAR_META (X_("send-mtc"), - "" + NULL ); VAR_META (X_("show-solo-mutes"), - "" + NULL ); VAR_META (X_("show-video-server-dialog"), - "" + NULL ); VAR_META (X_("show-vst3-micro-edit-inline"), - "" + NULL ); VAR_META (X_("shuttle-max-speed"), - "" + NULL ); VAR_META (X_("shuttle-speed-factor"), - "" + NULL ); VAR_META (X_("shuttle-speed-threshold"), - "" + NULL ); VAR_META (X_("shuttle-units"), - "" + NULL ); VAR_META (X_("skip-playback"), - "" + NULL ); VAR_META (X_("solo-control-is-listen-control"), - "" + NULL ); VAR_META (X_("solo-mute-gain"), - "" + NULL ); VAR_META (X_("solo-mute-override"), - "" + NULL ); VAR_META (X_("stop-at-session-end"), - "" + NULL ); VAR_META (X_("stop-recording-on-xrun"), - "" + NULL ); VAR_META (X_("strict-io"), - "" + NULL ); VAR_META (X_("timecode-sync-frame-rate"), - "" + NULL ); VAR_META (X_("trace-midi-input"), - "" + NULL ); VAR_META (X_("trace-midi-output"), - "" + NULL ); VAR_META (X_("tracks-auto-naming"), - "" + NULL ); VAR_META (X_("transient-sensitivity"), - "" + NULL ); VAR_META (X_("transport-masters-just-roll-when-sync-lost"), - "" + NULL ); VAR_META (X_("try-autostart-engine"), - "" + NULL ); VAR_META (X_("tutorial-manual-url"), - "" + NULL ); VAR_META (X_("updates-url"), - "" + NULL ); VAR_META (X_("use-audio-units"), - "" + NULL ); VAR_META (X_("use-click-emphasis"), - "" + NULL ); VAR_META (X_("use-lxvst"), - "" + NULL ); VAR_META (X_("use-macvst"), - "" + NULL ); VAR_META (X_("use-master-volume"), - "" + NULL ); VAR_META (X_("use-monitor-bus"), - "" + NULL ); VAR_META (X_("use-osc"), - "" + NULL ); VAR_META (X_("use-plugin-own-gui"), - "" + NULL ); VAR_META (X_("use-tranzport"), - "" + NULL ); VAR_META (X_("use-vst3"), - "" + NULL ); VAR_META (X_("use-windows-vst"), - "" + NULL ); VAR_META (X_("verbose-plugin-scan"), - "" + NULL ); VAR_META (X_("verify-remove-last-capture"), - "" + NULL ); VAR_META (X_("video-advanced-setup"), - "" + NULL ); VAR_META (X_("video-server-docroot"), - "" + NULL ); VAR_META (X_("video-server-url"), - "" + NULL ); VAR_META (X_("work-around-jack-no-copy-optimization"), - "" + NULL ); - VAR_META (X_("xjadeo-binary"), ""); + VAR_META (X_("xjadeo-binary"), NULL); } diff --git a/libs/ardour/session_configuration.cc b/libs/ardour/session_configuration.cc index 9ef899d927..0452b6e713 100644 --- a/libs/ardour/session_configuration.cc +++ b/libs/ardour/session_configuration.cc @@ -59,18 +59,18 @@ SessionConfiguration::get_state () const XMLNode* root; root = new XMLNode ("Ardour"); - root->add_child_nocopy (get_variables ()); + root->add_child_nocopy (get_variables (X_("Config"))); return *root; } XMLNode& -SessionConfiguration::get_variables () const +SessionConfiguration::get_variables (std::string const & node_name) const { XMLNode* node; - node = new XMLNode ("Config"); + node = new XMLNode (node_name); #undef CONFIG_VARIABLE #undef CONFIG_VARIABLE_SPECIAL @@ -186,7 +186,7 @@ SessionConfiguration::save_state () XMLTree tree; XMLNode* root = new XMLNode(X_("SessionDefaults")); - root->add_child_nocopy (get_variables ()); + root->add_child_nocopy (get_variables (X_("Config"))); tree.set_root (root); if (!tree.write (rcfile.c_str())) { diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index d3079b7757..d9c02a921c 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -1279,7 +1279,7 @@ Session::state (bool save_template, snapshot_t snapshot_type, bool for_archive, node->add_child_nocopy (*midi_port_stuff); } - XMLNode& cfgxml (config.get_variables ()); + XMLNode& cfgxml (config.get_variables (X_("Config"))); if (save_template) { /* exclude search-paths from template */ cfgxml.remove_nodes_and_delete ("name", "audio-search-path"); diff --git a/libs/pbd/configuration_variable.cc b/libs/pbd/configuration_variable.cc index 6981d20071..60d7de2a6f 100644 --- a/libs/pbd/configuration_variable.cc +++ b/libs/pbd/configuration_variable.cc @@ -111,9 +111,10 @@ ConfigVariableBase::miss () // is set but to the same value as it already has } +std::map Configuration::all_metadata; Configuration::Metadata const * -Configuration::get_metadata (std::string const & name) const +Configuration::get_metadata (std::string const & name) { auto i = all_metadata.find (name); if (i != all_metadata.end()) { diff --git a/libs/pbd/convert.cc b/libs/pbd/convert.cc index 129c6f53f6..727c41ad4f 100644 --- a/libs/pbd/convert.cc +++ b/libs/pbd/convert.cc @@ -174,6 +174,20 @@ internationalize (const char *package_name, const char **array) return v; } +vector +internationalize_and_upcase (const char *package_name, const char **array) +{ + vector v; + + for (uint32_t i = 0; array[i]; ++i) { + string s (dgettext(package_name, array[i])); + std::transform (s.begin(), s.end(), s.begin(), ::toupper); + v.push_back (s); + } + + return v; +} + static int32_t int_from_hex (char hic, char loc) { diff --git a/libs/pbd/pbd/configuration.h b/libs/pbd/pbd/configuration.h index c4d310739f..2441808d52 100644 --- a/libs/pbd/pbd/configuration.h +++ b/libs/pbd/pbd/configuration.h @@ -42,16 +42,15 @@ class Configuration : public PBD::Stateful virtual void map_parameters (boost::function&) = 0; virtual int set_state (XMLNode const &, int) = 0; virtual XMLNode & get_state () const = 0; - virtual XMLNode & get_variables () const = 0; + virtual XMLNode & get_variables (std::string const & nodename) const = 0; virtual void set_variables (XMLNode const &) = 0; PBD::Signal1 ParameterChanged; typedef std::vector Metadata; - Metadata const * get_metadata (std::string const &) const; - protected: - std::map all_metadata; + static Metadata const * get_metadata (std::string const &); + static std::map all_metadata; }; } // namespace PBD diff --git a/libs/pbd/pbd/convert.h b/libs/pbd/pbd/convert.h index 96b3d8aa47..beb1d83db7 100644 --- a/libs/pbd/pbd/convert.h +++ b/libs/pbd/pbd/convert.h @@ -48,6 +48,7 @@ LIBPBD_API const char* downcase (const char*); LIBPBD_API std::string length2string (const int64_t samples, const double sample_rate); LIBPBD_API std::vector internationalize (const char *, const char **); +LIBPBD_API std::vector internationalize_and_upcase (const char *, const char **); LIBPBD_API bool strings_equal_ignore_case (const std::string& a, const std::string& b); LIBPBD_API const char* sgettext (const char *, const char *);