From 6b019a495359909a3d1a778ca10cd7df7cc302cc Mon Sep 17 00:00:00 2001 From: Tim Mayberry Date: Fri, 2 Jan 2015 21:44:54 +0700 Subject: [PATCH] Move UIConfiguration Singleton into UIConfiguration header This removes the direct dependence on ardour_ui.h from 39 files --- gtk2_ardour/actions.cc | 7 +- gtk2_ardour/ardour_button.cc | 37 +++--- gtk2_ardour/ardour_knob.cc | 15 +-- gtk2_ardour/ardour_ui.cc | 41 ++++--- gtk2_ardour/ardour_ui.h | 9 +- gtk2_ardour/ardour_ui2.cc | 6 +- gtk2_ardour/ardour_ui_dependents.cc | 1 + gtk2_ardour/ardour_ui_dialogs.cc | 9 +- gtk2_ardour/ardour_ui_ed.cc | 3 +- gtk2_ardour/ardour_ui_options.cc | 18 +-- gtk2_ardour/ardour_window.cc | 3 +- gtk2_ardour/audio_clock.cc | 22 ++-- gtk2_ardour/audio_region_view.cc | 94 +++++++------- gtk2_ardour/audio_streamview.cc | 12 +- gtk2_ardour/automation_line.cc | 4 +- gtk2_ardour/automation_region_view.cc | 10 +- gtk2_ardour/automation_streamview.cc | 8 +- gtk2_ardour/automation_time_axis.cc | 7 +- gtk2_ardour/button_joiner.cc | 11 +- gtk2_ardour/control_point.cc | 16 +-- gtk2_ardour/crossfade_edit.cc | 42 +++---- gtk2_ardour/editor.cc | 31 ++--- gtk2_ardour/editor_actions.cc | 11 +- gtk2_ardour/editor_audiotrack.cc | 4 +- gtk2_ardour/editor_canvas.cc | 81 +++++++------ gtk2_ardour/editor_canvas_events.cc | 4 +- gtk2_ardour/editor_drag.cc | 19 +-- gtk2_ardour/editor_group_tabs.cc | 4 +- gtk2_ardour/editor_mixer.cc | 1 + gtk2_ardour/editor_mouse.cc | 14 +-- gtk2_ardour/editor_ops.cc | 10 +- gtk2_ardour/editor_regions.cc | 9 +- gtk2_ardour/editor_rulers.cc | 3 +- gtk2_ardour/editor_summary.cc | 6 +- gtk2_ardour/editor_tempodisplay.cc | 8 +- gtk2_ardour/gain_meter.cc | 13 +- gtk2_ardour/generic_pluginui.cc | 5 +- gtk2_ardour/ghostregion.cc | 22 ++-- gtk2_ardour/group_tabs.cc | 2 +- gtk2_ardour/level_meter.cc | 72 +++++------ gtk2_ardour/location_ui.cc | 3 +- gtk2_ardour/logmeter.h | 2 + gtk2_ardour/main.cc | 6 +- gtk2_ardour/main_clock.cc | 15 +-- gtk2_ardour/marker.cc | 16 ++- gtk2_ardour/meter_patterns.cc | 30 ++--- gtk2_ardour/meter_patterns.h | 5 + gtk2_ardour/meter_strip.cc | 19 +-- gtk2_ardour/meterbridge.cc | 4 +- gtk2_ardour/midi_list_editor.cc | 4 +- gtk2_ardour/midi_region_view.cc | 24 ++-- gtk2_ardour/midi_streamview.cc | 16 +-- gtk2_ardour/mixer_group_tabs.cc | 4 +- gtk2_ardour/mixer_strip.cc | 9 +- gtk2_ardour/mixer_ui.cc | 7 +- gtk2_ardour/monitor_section.cc | 2 +- gtk2_ardour/mono_panner.cc | 28 ++--- gtk2_ardour/note_base.cc | 10 +- gtk2_ardour/note_base.h | 13 +- gtk2_ardour/panner2d.cc | 8 +- gtk2_ardour/panner_ui.cc | 2 +- gtk2_ardour/patch_change.cc | 8 +- gtk2_ardour/plugin_eq_gui.cc | 1 + gtk2_ardour/processor_box.cc | 12 +- gtk2_ardour/rc_option_editor.cc | 168 ++++++++++++-------------- gtk2_ardour/rc_option_editor.h | 1 - gtk2_ardour/region_view.cc | 13 +- gtk2_ardour/route_time_axis.cc | 15 +-- gtk2_ardour/route_ui.cc | 9 +- gtk2_ardour/sfdb_ui.cc | 5 +- gtk2_ardour/shuttle_control.cc | 8 +- gtk2_ardour/stereo_panner.cc | 44 +++---- gtk2_ardour/streamview.cc | 8 +- gtk2_ardour/sys_ex.cc | 6 +- gtk2_ardour/tempo_dialog.cc | 6 +- gtk2_ardour/tempo_lines.cc | 10 +- gtk2_ardour/tempo_lines.h | 8 +- gtk2_ardour/theme_manager.cc | 76 ++++++------ gtk2_ardour/time_axis_view.cc | 31 ++--- gtk2_ardour/time_axis_view_item.cc | 58 ++++----- gtk2_ardour/ui_config.cc | 12 +- gtk2_ardour/ui_config.h | 11 +- gtk2_ardour/utils.cc | 2 +- gtk2_ardour/verbose_cursor.cc | 9 +- 84 files changed, 728 insertions(+), 714 deletions(-) diff --git a/gtk2_ardour/actions.cc b/gtk2_ardour/actions.cc index 7f11d053e8..ea6cc4b8aa 100644 --- a/gtk2_ardour/actions.cc +++ b/gtk2_ardour/actions.cc @@ -36,7 +36,6 @@ #include "gtkmm2ext/actions.h" -#include "ardour_ui.h" #include "actions.h" #include "i18n.h" @@ -138,10 +137,10 @@ ActionManager::toggle_config_state (const char* group, const char* action, bool Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); if (tact) { - bool x = (ARDOUR_UI::config()->*get)(); + bool x = (UIConfiguration::instance().*get)(); if (x != tact->get_active()) { - (ARDOUR_UI::config()->*set) (!x); + (UIConfiguration::instance().*set) (!x); } } } @@ -203,7 +202,7 @@ ActionManager::map_some_state (const char* group, const char* action, bool (UICo if (tact) { - bool x = (ARDOUR_UI::config()->*get)(); + bool x = (UIConfiguration::instance().*get)(); if (tact->get_active() != x) { tact->set_active (x); diff --git a/gtk2_ardour/ardour_button.cc b/gtk2_ardour/ardour_button.cc index 69229f6332..7fbc0f0d48 100644 --- a/gtk2_ardour/ardour_button.cc +++ b/gtk2_ardour/ardour_button.cc @@ -31,13 +31,12 @@ #include "gtkmm2ext/rgb_macros.h" #include "gtkmm2ext/gui_thread.h" -#include "ardour/rc_configuration.h" // for widget prelight preference - #include "canvas/utils.h" #include "canvas/colors.h" #include "ardour_button.h" #include "ardour_ui.h" +#include "ui_config.h" #include "i18n.h" @@ -95,7 +94,7 @@ ArdourButton::ArdourButton (Element e) , _update_colors (true) , _pattern_height (0) { - UIConfiguration::ColorsChanged.connect (sigc::mem_fun (*this, &ArdourButton::color_handler)); + UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &ArdourButton::color_handler)); } ArdourButton::ArdourButton (const std::string& str, Element e) @@ -134,8 +133,8 @@ ArdourButton::ArdourButton (const std::string& str, Element e) , _pattern_height (0) { set_text (str); - UIConfiguration::ColorsChanged.connect (sigc::mem_fun (*this, &ArdourButton::color_handler)); - UIConfiguration::DPIReset.connect (sigc::mem_fun (*this, &ArdourButton::on_name_changed)); + UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &ArdourButton::color_handler)); + UIConfiguration::instance().DPIReset.connect (sigc::mem_fun (*this, &ArdourButton::on_name_changed)); } ArdourButton::~ArdourButton() @@ -208,7 +207,7 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *) uint32_t text_color; uint32_t led_color; - const float corner_radius = std::max(2.f, _corner_radius * ARDOUR_UI::config()->get_ui_scale()); + const float corner_radius = std::max(2.f, _corner_radius * UIConfiguration::instance().get_ui_scale()); if (_update_colors) { set_colors (); @@ -440,12 +439,12 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *) //black ring cairo_set_source_rgb (cr, 0, 0, 0); - cairo_arc (cr, 0, 0, _diameter * .5 - 1 * ARDOUR_UI::config()->get_ui_scale(), 0, 2 * M_PI); + cairo_arc (cr, 0, 0, _diameter * .5 - 1 * UIConfiguration::instance().get_ui_scale(), 0, 2 * M_PI); cairo_fill(cr); //led color ArdourCanvas::set_source_rgba (cr, led_color); - cairo_arc (cr, 0, 0, _diameter * .5 - 3 * ARDOUR_UI::config()->get_ui_scale(), 0, 2 * M_PI); + cairo_arc (cr, 0, 0, _diameter * .5 - 3 * UIConfiguration::instance().get_ui_scale(), 0, 2 * M_PI); cairo_fill(cr); cairo_restore (cr); @@ -454,13 +453,13 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *) // a transparent overlay to indicate insensitivity if ((visual_state() & Gtkmm2ext::Insensitive)) { rounded_function (cr, 0, 0, get_width(), get_height(), corner_radius); - uint32_t ins_color = ARDOUR_UI::config()->color ("gtk_background"); + uint32_t ins_color = UIConfiguration::instance().color ("gtk_background"); ArdourCanvas::set_source_rgb_a (cr, ins_color, 0.6); cairo_fill (cr); } // if requested, show hovering - if (ARDOUR_UI::config()->get_widget_prelight() + if (UIConfiguration::instance().get_widget_prelight() && !((visual_state() & Gtkmm2ext::Insensitive))) { if (_hovering) { rounded_function (cr, 1, 1, get_width() - 2, get_height() - 2, corner_radius); @@ -527,7 +526,7 @@ ArdourButton::on_size_request (Gtk::Requisition* req) CairoWidget::on_size_request (req); if (_diameter == 0) { - const float newdia = rintf (11.f * ARDOUR_UI::config()->get_ui_scale()); + const float newdia = rintf (11.f * UIConfiguration::instance().get_ui_scale()); if (_diameter != newdia) { _pattern_height = 0; _diameter = newdia; @@ -606,21 +605,21 @@ ArdourButton::set_colors () std::string name = get_name(); bool failed = false; - fill_active_color = ARDOUR_UI::config()->color (string_compose ("%1: fill active", name), &failed); + fill_active_color = UIConfiguration::instance().color (string_compose ("%1: fill active", name), &failed); if (failed) { - fill_active_color = ARDOUR_UI::config()->color ("generic button: fill active"); + fill_active_color = UIConfiguration::instance().color ("generic button: fill active"); } - fill_inactive_color = ARDOUR_UI::config()->color (string_compose ("%1: fill", name), &failed); + fill_inactive_color = UIConfiguration::instance().color (string_compose ("%1: fill", name), &failed); if (failed) { - fill_inactive_color = ARDOUR_UI::config()->color ("generic button: fill"); + fill_inactive_color = UIConfiguration::instance().color ("generic button: fill"); } text_active_color = ArdourCanvas::contrasting_text_color (fill_active_color); text_inactive_color = ArdourCanvas::contrasting_text_color (fill_inactive_color); - led_active_color = ARDOUR_UI::config()->color (string_compose ("%1: led active", name), &failed); + led_active_color = UIConfiguration::instance().color (string_compose ("%1: led active", name), &failed); if (failed) { - led_active_color = ARDOUR_UI::config()->color ("generic button: led active"); + led_active_color = UIConfiguration::instance().color ("generic button: led active"); } /* The inactive color for the LED is just a fairly dark version of the @@ -984,7 +983,7 @@ ArdourButton::on_enter_notify_event (GdkEventCrossing* ev) { _hovering = (_elements & Inactive) ? false : true; - if (ARDOUR_UI::config()->get_widget_prelight()) { + if (UIConfiguration::instance().get_widget_prelight()) { CairoWidget::set_dirty (); } @@ -996,7 +995,7 @@ ArdourButton::on_leave_notify_event (GdkEventCrossing* ev) { _hovering = false; - if (ARDOUR_UI::config()->get_widget_prelight()) { + if (UIConfiguration::instance().get_widget_prelight()) { CairoWidget::set_dirty (); } diff --git a/gtk2_ardour/ardour_knob.cc b/gtk2_ardour/ardour_knob.cc index bca5e28661..99890ad2e7 100644 --- a/gtk2_ardour/ardour_knob.cc +++ b/gtk2_ardour/ardour_knob.cc @@ -24,6 +24,7 @@ #include #include "pbd/compose.h" +#include "pbd/controllable.h" #include "pbd/error.h" #include "pbd/stacktrace.h" @@ -35,8 +36,8 @@ #include "ardour/rc_configuration.h" // for widget prelight preference #include "ardour_knob.h" -#include "ardour_ui.h" #include "timers.h" +#include "ui_config.h" #include "canvas/colors.h" #include "canvas/utils.h" @@ -65,7 +66,7 @@ ArdourKnob::ArdourKnob (Element e, Flags flags) , _flags (flags) , _tooltip (this) { - UIConfiguration::ColorsChanged.connect (sigc::mem_fun (*this, &ArdourKnob::color_handler)); + UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &ArdourKnob::color_handler)); // watch automation :( Timers::rapid_connect (sigc::mem_fun (*this, &ArdourKnob::controllable_changed)); @@ -106,7 +107,7 @@ ArdourKnob::render (cairo_t* cr, cairo_rectangle_t *) cairo_translate (cr, xc, yc); //after this, everything is based on the center of the knob //get the knob color from the theme - ArdourCanvas::Color knob_color = ARDOUR_UI::config()->color (string_compose ("%1", get_name())); + ArdourCanvas::Color knob_color = UIConfiguration::instance().color (string_compose ("%1", get_name())); float center_radius = 0.48*scale; float border_width = 0.8; @@ -131,10 +132,10 @@ ArdourKnob::render (cairo_t* cr, cairo_rectangle_t *) //look up the arc colors from the config double red_start, green_start, blue_start, unused; - ArdourCanvas::Color arc_start_color = ARDOUR_UI::config()->color ( string_compose ("%1: arc start", get_name())); + ArdourCanvas::Color arc_start_color = UIConfiguration::instance().color ( string_compose ("%1: arc start", get_name())); ArdourCanvas::color_to_rgba( arc_start_color, red_start, green_start, blue_start, unused ); double red_end, green_end, blue_end; - ArdourCanvas::Color arc_end_color = ARDOUR_UI::config()->color ( string_compose ("%1: arc end", get_name()) ); + ArdourCanvas::Color arc_end_color = UIConfiguration::instance().color ( string_compose ("%1: arc end", get_name()) ); ArdourCanvas::color_to_rgba( arc_end_color, red_end, green_end, blue_end, unused ); //vary the arc color over the travel of the knob @@ -263,7 +264,7 @@ ArdourKnob::render (cairo_t* cr, cairo_rectangle_t *) cairo_stroke (cr); //highlight if grabbed or if mouse is hovering over me - if (_tooltip.dragging() || (_hovering && ARDOUR_UI::config()->get_widget_prelight() ) ) { + if (_tooltip.dragging() || (_hovering && UIConfiguration::instance().get_widget_prelight() ) ) { cairo_set_source_rgba (cr, 1,1,1, 0.12 ); cairo_arc (cr, 0, 0, center_radius, 0, 2.0*G_PI); cairo_fill (cr); @@ -330,7 +331,7 @@ ArdourKnob::on_motion_notify_event (GdkEventMotion *ev) //scale the adjustment based on keyboard modifiers & GUI size - const float ui_scale = max (1.f, ARDOUR_UI::config()->get_ui_scale()); + const float ui_scale = max (1.f, UIConfiguration::instance().get_ui_scale()); float scale = 0.0025 / ui_scale; if (ev->state & Keyboard::GainFineScaleModifier) { diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 6b0d8a3c2f..e08b92b881 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -221,10 +221,9 @@ libxml_structured_error_func (void* /* parsing_context*/, } -ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir, UIConfiguration* uic) +ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir) : Gtkmm2ext::UI (PROGRAM_NAME, argcp, argvp) - , ui_config (uic->post_gui_init ()) , session_loaded (false) , gui_object_state (new GUIObjectState) , primary_clock (new MainClock (X_("primary"), X_("transport"), true )) @@ -287,6 +286,8 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir, UIConfi { Gtkmm2ext::init (localedir); + UIConfiguration::instance().post_gui_init (); + if (ARDOUR::handle_old_configuration_files (boost::bind (ask_about_configuration_copy, _1, _2, _3))) { MessageDialog msg (string_compose (_("Your configuration files were copied. You can now restart %1."), PROGRAM_NAME), true); msg.run (); @@ -302,10 +303,10 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir, UIConfi xmlSetGenericErrorFunc (this, libxml_generic_error_func); xmlSetStructuredErrorFunc (this, libxml_structured_error_func); - - ui_config->ParameterChanged.connect (sigc::mem_fun (*this, &ARDOUR_UI::parameter_changed)); + + UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &ARDOUR_UI::parameter_changed)); boost::function pc (boost::bind (&ARDOUR_UI::parameter_changed, this, _1)); - ui_config->map_parameters (pc); + UIConfiguration::instance().map_parameters (pc); roll_button.set_controllable (roll_controllable); stop_button.set_controllable (stop_controllable); @@ -390,7 +391,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir, UIConfi /* we don't like certain modifiers */ Bindings::set_ignored_state (GDK_LOCK_MASK|GDK_MOD2_MASK|GDK_MOD3_MASK); - ARDOUR_UI::config()->reset_dpi (); + UIConfiguration::instance().reset_dpi (); TimeAxisViewItem::set_constant_heights (); @@ -437,12 +438,12 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir, UIConfi /* Trigger setting up the color scheme and loading the GTK RC file */ - ARDOUR_UI::config()->load_rc_file (false); - + UIConfiguration::instance().load_rc_file (false); + _process_thread = new ProcessThread (); _process_thread->init (); - UIConfiguration::DPIReset.connect (sigc::mem_fun (*this, &ARDOUR_UI::resize_text_widgets)); + UIConfiguration::instance().DPIReset.connect (sigc::mem_fun (*this, &ARDOUR_UI::resize_text_widgets)); attach_to_engine (); } @@ -623,13 +624,13 @@ ARDOUR_UI::post_engine () boost::function pc (boost::bind (&ARDOUR_UI::parameter_changed, this, _1)); Config->map_parameters (pc); - ui_config->map_parameters (pc); + UIConfiguration::instance().map_parameters (pc); } } ARDOUR_UI::~ARDOUR_UI () { - ui_config->save_state(); + UIConfiguration::instance().save_state(); stop_video_server(); @@ -1288,10 +1289,10 @@ ARDOUR_UI::every_point_zero_something_seconds () { // august 2007: actual update frequency: 25Hz (40ms), not 100Hz - if (editor_meter && ARDOUR_UI::config()->get_show_editor_meter()) { + if (editor_meter && UIConfiguration::instance().get_show_editor_meter()) { float mpeak = editor_meter->update_meters(); if (mpeak > editor_meter_max_peak) { - if (mpeak >= ARDOUR_UI::config()->get_meter_peak()) { + if (mpeak >= UIConfiguration::instance().get_meter_peak()) { editor_meter_peak_display.set_active_state ( Gtkmm2ext::ExplicitActive ); } } @@ -2100,7 +2101,7 @@ ARDOUR_UI::toggle_roll (bool with_abort, bool roll_out_of_bounded_mode) if (rolling) { _session->request_stop (with_abort, true); } else { - if (ARDOUR_UI::config()->get_follow_edits() && ( editor->get_selection().time.front().start == _session->transport_frame() ) ) { //if playhead is exactly at the start of a range, we can assume it was placed there by follow_edits + if (UIConfiguration::instance().get_follow_edits() && ( editor->get_selection().time.front().start == _session->transport_frame() ) ) { //if playhead is exactly at the start of a range, we can assume it was placed there by follow_edits _session->request_play_range (&editor->get_selection().time, true); _session->set_requested_return_frame( editor->get_selection().time.front().start ); //force an auto-return here } @@ -2277,7 +2278,7 @@ ARDOUR_UI::map_transport_state () auto_loop_button.set_active (false); } - if (ARDOUR_UI::config()->get_follow_edits()) { + if (UIConfiguration::instance().get_follow_edits()) { /* light up both roll and play-selection if they are joined */ roll_button.set_active (true); play_selection_button.set_active (true); @@ -2323,7 +2324,7 @@ ARDOUR_UI::update_clocks () void ARDOUR_UI::start_clocking () { - if (ui_config->get_super_rapid_clock_update()) { + if (UIConfiguration::instance().get_super_rapid_clock_update()) { clock_signal_connection = Timers::fps_connect (sigc::mem_fun(*this, &ARDOUR_UI::update_clocks)); } else { clock_signal_connection = Timers::rapid_connect (sigc::mem_fun(*this, &ARDOUR_UI::update_clocks)); @@ -4237,7 +4238,7 @@ ARDOUR_UI::plugin_scan_dialog (std::string type, std::string plugin, bool can_ca } const bool cancelled = PluginManager::instance().cancelled(); - if (type != X_("closeme") && (!ui_config->get_show_plugin_scan_window()) && !_initial_verbose_plugin_scan) { + if (type != X_("closeme") && (!UIConfiguration::instance().get_show_plugin_scan_window()) && !_initial_verbose_plugin_scan) { if (cancelled && scan_dlg->is_mapped()) { scan_dlg->hide(); gui_idle_handler(); @@ -4469,13 +4470,13 @@ ARDOUR_UI::use_config () void ARDOUR_UI::update_transport_clocks (framepos_t pos) { - if (ui_config->get_primary_clock_delta_edit_cursor()) { + if (UIConfiguration::instance().get_primary_clock_delta_edit_cursor()) { primary_clock->set (pos, false, editor->get_preferred_edit_position (EDIT_IGNORE_PHEAD)); } else { primary_clock->set (pos); } - if (ui_config->get_secondary_clock_delta_edit_cursor()) { + if (UIConfiguration::instance().get_secondary_clock_delta_edit_cursor()) { secondary_clock->set (pos, false, editor->get_preferred_edit_position (EDIT_IGNORE_PHEAD)); } else { secondary_clock->set (pos); @@ -4834,7 +4835,7 @@ ARDOUR_UI::transport_numpad_event (int num) void ARDOUR_UI::set_flat_buttons () { - CairoWidget::set_flat_buttons( config()->get_flat_buttons() ); + CairoWidget::set_flat_buttons( UIConfiguration::instance().get_flat_buttons() ); } void diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index f2ad1bb0d6..c174723ef4 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -133,14 +133,8 @@ namespace Gtk { class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr { - private: - /* This must be the first data element because constructor ordering - relies on it. - */ - UIConfiguration* ui_config; - public: - ARDOUR_UI (int *argcp, char **argvp[], const char* localedir, UIConfiguration*); + ARDOUR_UI (int *argcp, char **argvp[], const char* localedir); ~ARDOUR_UI(); bool run_startup (bool should_be_new, std::string load_template); @@ -185,7 +179,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr void save_state (const std::string & state_name = "", bool switch_to_it = false); static ARDOUR_UI *instance () { return theArdourUI; } - static UIConfiguration *config () { return theArdourUI->ui_config; } PublicEditor& the_editor() { return *editor;} Mixer_UI* the_mixer() { return mixer; } diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index 6a15ec8ea0..116cfc95a3 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -216,7 +216,7 @@ ARDOUR_UI::tearoff_settings (const char* name) const return 0; } -#define PX_SCALE(px) std::max((float)px, rintf((float)px * ARDOUR_UI::config()->get_ui_scale())) +#define PX_SCALE(px) std::max((float)px, rintf((float)px * UIConfiguration::instance().get_ui_scale())) void ARDOUR_UI::setup_transport () @@ -678,7 +678,7 @@ ARDOUR_UI::editor_realized () boost::function pc (boost::bind (&ARDOUR_UI::parameter_changed, this, _1)); Config->map_parameters (pc); - ARDOUR_UI::config()->reset_dpi (); + UIConfiguration::instance().reset_dpi (); } void @@ -743,7 +743,7 @@ ARDOUR_UI::toggle_follow_edits () RefPtr tact = RefPtr::cast_dynamic (act); assert (tact); - ui_config->set_follow_edits (tact->get_active ()); + UIConfiguration::instance().set_follow_edits (tact->get_active ()); } diff --git a/gtk2_ardour/ardour_ui_dependents.cc b/gtk2_ardour/ardour_ui_dependents.cc index c27ade9fed..7227d4f87f 100644 --- a/gtk2_ardour/ardour_ui_dependents.cc +++ b/gtk2_ardour/ardour_ui_dependents.cc @@ -34,6 +34,7 @@ #include "actions.h" #include "ardour_ui.h" #include "public_editor.h" +#include "meterbridge.h" #include "mixer_ui.h" #include "keyboard.h" #include "splash.h" diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc index 7de91bc5ae..5e88f149ee 100644 --- a/gtk2_ardour/ardour_ui_dialogs.cc +++ b/gtk2_ardour/ardour_ui_dialogs.cc @@ -42,6 +42,7 @@ #include "keyeditor.h" #include "location_ui.h" #include "main_clock.h" +#include "meterbridge.h" #include "meter_patterns.h" #include "midi_tracer.h" #include "mixer_ui.h" @@ -223,13 +224,13 @@ ARDOUR_UI::set_session (Session *s) editor_meter_peak_display.set_name ("meterbridge peakindicator"); editor_meter_peak_display.unset_flags (Gtk::CAN_FOCUS); - editor_meter_peak_display.set_size_request (std::max(9.f, rintf(8.f * ARDOUR_UI::config()->get_ui_scale())), -1); + editor_meter_peak_display.set_size_request (std::max(9.f, rintf(8.f * UIConfiguration::instance().get_ui_scale())), -1); editor_meter_peak_display.set_corner_radius (3.0); editor_meter_max_peak = -INFINITY; editor_meter_peak_display.signal_button_release_event().connect (sigc::mem_fun(*this, &ARDOUR_UI::editor_meter_peak_button_release), false); - if (ARDOUR_UI::config()->get_show_editor_meter() && !ARDOUR::Profile->get_trx()) { + if (UIConfiguration::instance().get_show_editor_meter() && !ARDOUR::Profile->get_trx()) { transport_tearoff_hbox.pack_start (meter_box, false, false); transport_tearoff_hbox.pack_start (editor_meter_peak_display, false, false); meter_box.show(); @@ -336,7 +337,7 @@ ARDOUR_UI::goto_editor_window () editor->show_window (); editor->present (); /* mixer should now be on top */ - if (ARDOUR_UI::config()->get_transients_follow_front()) { + if (UIConfiguration::instance().get_transients_follow_front()) { WM::Manager::instance().set_transient_for (editor); } _mixer_on_top = false; @@ -367,7 +368,7 @@ ARDOUR_UI::goto_mixer_window () mixer->show_window (); mixer->present (); /* mixer should now be on top */ - if (ARDOUR_UI::config()->get_transients_follow_front()) { + if (UIConfiguration::instance().get_transients_follow_front()) { WM::Manager::instance().set_transient_for (mixer); } _mixer_on_top = true; diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index e332528503..a290814de7 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -49,6 +49,7 @@ #include "engine_dialog.h" #include "editor.h" #include "actions.h" +#include "meterbridge.h" #include "mixer_ui.h" #include "startup.h" #include "window_manager.h" @@ -644,7 +645,7 @@ ARDOUR_UI::save_ardour_state () Config->save_state(); - ui_config->save_state (); + UIConfiguration::instance().save_state (); XMLNode& enode (static_cast(editor)->get_state()); XMLNode& mnode (mixer->get_state()); diff --git a/gtk2_ardour/ardour_ui_options.cc b/gtk2_ardour/ardour_ui_options.cc index a4fcd89b59..1463d0f801 100644 --- a/gtk2_ardour/ardour_ui_options.cc +++ b/gtk2_ardour/ardour_ui_options.cc @@ -372,7 +372,7 @@ ARDOUR_UI::parameter_changed (std::string p) } else if (p == "show-track-meters") { if (editor) editor->toggle_meter_updating(); } else if (p == "primary-clock-delta-edit-cursor") { - if (ARDOUR_UI::config()->get_primary_clock_delta_edit_cursor()) { + if (UIConfiguration::instance().get_primary_clock_delta_edit_cursor()) { primary_clock->set_is_duration (true); primary_clock->set_editable (false); primary_clock->set_widget_name ("transport delta"); @@ -382,7 +382,7 @@ ARDOUR_UI::parameter_changed (std::string p) primary_clock->set_widget_name ("transport"); } } else if (p == "secondary-clock-delta-edit-cursor") { - if (ARDOUR_UI::config()->get_secondary_clock_delta_edit_cursor()) { + if (UIConfiguration::instance().get_secondary_clock_delta_edit_cursor()) { secondary_clock->set_is_duration (true); secondary_clock->set_editable (false); secondary_clock->set_widget_name ("secondary delta"); @@ -397,9 +397,9 @@ ARDOUR_UI::parameter_changed (std::string p) start_clocking (); } } else if (p == "waveform-gradient-depth") { - ArdourCanvas::WaveView::set_global_gradient_depth (config()->get_waveform_gradient_depth()); + ArdourCanvas::WaveView::set_global_gradient_depth (UIConfiguration::instance().get_waveform_gradient_depth()); } else if (p == "show-editor-meter") { - bool show = ARDOUR_UI::config()->get_show_editor_meter(); + bool show = UIConfiguration::instance().get_show_editor_meter(); if (editor_meter) { if (meter_box.get_parent()) { @@ -415,17 +415,17 @@ ARDOUR_UI::parameter_changed (std::string p) } } } else if (p == "waveform-scale") { - ArdourCanvas::WaveView::set_global_logscaled (ARDOUR_UI::config()->get_waveform_scale() == Logarithmic); + ArdourCanvas::WaveView::set_global_logscaled (UIConfiguration::instance().get_waveform_scale() == Logarithmic); } else if (p == "widget-prelight") { - CairoWidget::set_widget_prelight( config()->get_widget_prelight() ); + CairoWidget::set_widget_prelight (UIConfiguration::instance().get_widget_prelight()); } else if (p == "waveform-shape") { - ArdourCanvas::WaveView::set_global_shape (ARDOUR_UI::config()->get_waveform_shape() == Rectified + ArdourCanvas::WaveView::set_global_shape (UIConfiguration::instance().get_waveform_shape() == Rectified ? ArdourCanvas::WaveView::Rectified : ArdourCanvas::WaveView::Normal); } else if (p == "show-waveform-clipping") { - ArdourCanvas::WaveView::set_global_show_waveform_clipping (ARDOUR_UI::config()->get_show_waveform_clipping()); + ArdourCanvas::WaveView::set_global_show_waveform_clipping (UIConfiguration::instance().get_show_waveform_clipping()); } else if (p == "waveform-cache-size") { /* GUI option has units of megabytes; image cache uses units of bytes */ - ArdourCanvas::WaveView::set_image_cache_size (ARDOUR_UI::config()->get_waveform_cache_size() * 1048576); + ArdourCanvas::WaveView::set_image_cache_size (UIConfiguration::instance().get_waveform_cache_size() * 1048576); } } diff --git a/gtk2_ardour/ardour_window.cc b/gtk2_ardour/ardour_window.cc index f6ced5fb49..3183c3d9e0 100644 --- a/gtk2_ardour/ardour_window.cc +++ b/gtk2_ardour/ardour_window.cc @@ -24,6 +24,7 @@ #include "ardour_window.h" #include "ardour_ui.h" +#include "ui_config.h" #include "keyboard.h" #include "utils.h" @@ -114,7 +115,7 @@ ArdourWindow::init () vice versa. */ - if (ARDOUR_UI::config()->get_all_floating_windows_are_dialogs()) { + if (UIConfiguration::instance().get_all_floating_windows_are_dialogs()) { set_type_hint (Gdk::WINDOW_TYPE_HINT_DIALOG); } else { set_type_hint (Gdk::WINDOW_TYPE_HINT_UTILITY); diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc index 528d917894..df74ec789b 100644 --- a/gtk2_ardour/audio_clock.cc +++ b/gtk2_ardour/audio_clock.cc @@ -37,11 +37,11 @@ #include "ardour/tempo.h" #include "ardour/types.h" -#include "ardour_ui.h" #include "audio_clock.h" #include "utils.h" #include "keyboard.h" #include "gui_thread.h" +#include "ui_config.h" #include "i18n.h" using namespace ARDOUR; @@ -120,8 +120,8 @@ AudioClock::AudioClock (const string& clock_name, bool transient, const string& clocks.push_back (this); } - UIConfiguration::ColorsChanged.connect (sigc::mem_fun (*this, &AudioClock::set_colors)); - UIConfiguration::DPIReset.connect (sigc::mem_fun (*this, &AudioClock::dpi_reset)); + UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &AudioClock::set_colors)); + UIConfiguration::instance().DPIReset.connect (sigc::mem_fun (*this, &AudioClock::dpi_reset)); } AudioClock::~AudioClock () @@ -220,15 +220,15 @@ AudioClock::set_colors () uint32_t cursor_color; if (active_state()) { - bg_color = ARDOUR_UI::config()->color (string_compose ("%1 active: background", get_name())); - text_color = ARDOUR_UI::config()->color (string_compose ("%1 active: text", get_name())); - editing_color = ARDOUR_UI::config()->color (string_compose ("%1 active: edited text", get_name())); - cursor_color = ARDOUR_UI::config()->color (string_compose ("%1 active: cursor", get_name())); + bg_color = UIConfiguration::instance().color (string_compose ("%1 active: background", get_name())); + text_color = UIConfiguration::instance().color (string_compose ("%1 active: text", get_name())); + editing_color = UIConfiguration::instance().color (string_compose ("%1 active: edited text", get_name())); + cursor_color = UIConfiguration::instance().color (string_compose ("%1 active: cursor", get_name())); } else { - bg_color = ARDOUR_UI::config()->color (string_compose ("%1: background", get_name())); - text_color = ARDOUR_UI::config()->color (string_compose ("%1: text", get_name())); - editing_color = ARDOUR_UI::config()->color (string_compose ("%1: edited text", get_name())); - cursor_color = ARDOUR_UI::config()->color (string_compose ("%1: cursor", get_name())); + bg_color = UIConfiguration::instance().color (string_compose ("%1: background", get_name())); + text_color = UIConfiguration::instance().color (string_compose ("%1: text", get_name())); + editing_color = UIConfiguration::instance().color (string_compose ("%1: edited text", get_name())); + cursor_color = UIConfiguration::instance().color (string_compose ("%1: cursor", get_name())); } /* store for bg and cursor in render() */ diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc index 18d17af380..9af2cb044d 100644 --- a/gtk2_ardour/audio_region_view.cc +++ b/gtk2_ardour/audio_region_view.cc @@ -60,7 +60,7 @@ #include "audio_time_axis.h" #include "rgb_macros.h" #include "gui_thread.h" -#include "ardour_ui.h" +#include "ui_config.h" #include "i18n.h" @@ -123,7 +123,7 @@ AudioRegionView::AudioRegionView (ArdourCanvas::Container *parent, RouteTimeAxis , trim_fade_in_drag_active(false) , trim_fade_out_drag_active(false) { - ARDOUR_UI::config()->ParameterChanged.connect (sigc::mem_fun (*this, &AudioRegionView::parameter_changed)); + UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &AudioRegionView::parameter_changed)); } AudioRegionView::AudioRegionView (ArdourCanvas::Container *parent, RouteTimeAxisView &tv, boost::shared_ptr r, double spu, @@ -145,7 +145,7 @@ AudioRegionView::AudioRegionView (ArdourCanvas::Container *parent, RouteTimeAxis , trim_fade_in_drag_active(false) , trim_fade_out_drag_active(false) { - ARDOUR_UI::config()->ParameterChanged.connect (sigc::mem_fun (*this, &AudioRegionView::parameter_changed)); + UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &AudioRegionView::parameter_changed)); } AudioRegionView::AudioRegionView (const AudioRegionView& other, boost::shared_ptr other_region) @@ -167,7 +167,7 @@ AudioRegionView::AudioRegionView (const AudioRegionView& other, boost::shared_pt { init (true); - ARDOUR_UI::config()->ParameterChanged.connect (sigc::mem_fun (*this, &AudioRegionView::parameter_changed)); + UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &AudioRegionView::parameter_changed)); } void @@ -198,28 +198,28 @@ AudioRegionView::init (bool wfd) fade_in_handle = new ArdourCanvas::Rectangle (group); CANVAS_DEBUG_NAME (fade_in_handle, string_compose ("fade in handle for %1", region()->name())); fade_in_handle->set_outline_color (ArdourCanvas::rgba_to_color (0, 0, 0, 1.0)); - fade_in_handle->set_fill_color (ARDOUR_UI::config()->color ("inactive fade handle")); + fade_in_handle->set_fill_color (UIConfiguration::instance().color ("inactive fade handle")); fade_in_handle->set_data ("regionview", this); fade_in_handle->hide (); fade_out_handle = new ArdourCanvas::Rectangle (group); CANVAS_DEBUG_NAME (fade_out_handle, string_compose ("fade out handle for %1", region()->name())); fade_out_handle->set_outline_color (ArdourCanvas::rgba_to_color (0, 0, 0, 1.0)); - fade_out_handle->set_fill_color (ARDOUR_UI::config()->color ("inactive fade handle")); + fade_out_handle->set_fill_color (UIConfiguration::instance().color ("inactive fade handle")); fade_out_handle->set_data ("regionview", this); fade_out_handle->hide (); fade_in_trim_handle = new ArdourCanvas::Rectangle (group); CANVAS_DEBUG_NAME (fade_in_handle, string_compose ("fade in trim handle for %1", region()->name())); fade_in_trim_handle->set_outline_color (ArdourCanvas::rgba_to_color (0, 0, 0, 1.0)); - fade_in_trim_handle->set_fill_color (ARDOUR_UI::config()->color ("inactive fade handle")); + fade_in_trim_handle->set_fill_color (UIConfiguration::instance().color ("inactive fade handle")); fade_in_trim_handle->set_data ("regionview", this); fade_in_trim_handle->hide (); fade_out_trim_handle = new ArdourCanvas::Rectangle (group); CANVAS_DEBUG_NAME (fade_out_handle, string_compose ("fade out trim handle for %1", region()->name())); fade_out_trim_handle->set_outline_color (ArdourCanvas::rgba_to_color (0, 0, 0, 1.0)); - fade_out_trim_handle->set_fill_color (ARDOUR_UI::config()->color ("inactive fade handle")); + fade_out_trim_handle->set_fill_color (UIConfiguration::instance().color ("inactive fade handle")); fade_out_trim_handle->set_data ("regionview", this); fade_out_trim_handle->hide (); } @@ -363,7 +363,7 @@ AudioRegionView::fade_in_active_changed () if (audio_region()->fade_in_active()) { start_xfade_rect->set_fill (false); } else { - start_xfade_rect->set_fill_color (ARDOUR_UI::config()->color_mod ("inactive crossfade", "inactive crossfade")); + start_xfade_rect->set_fill_color (UIConfiguration::instance().color_mod ("inactive crossfade", "inactive crossfade")); start_xfade_rect->set_fill (true); } } @@ -376,7 +376,7 @@ AudioRegionView::fade_out_active_changed () if (audio_region()->fade_out_active()) { end_xfade_rect->set_fill (false); } else { - end_xfade_rect->set_fill_color (ARDOUR_UI::config()->color_mod ("inactive crossfade", "inactive crossfade")); + end_xfade_rect->set_fill_color (UIConfiguration::instance().color_mod ("inactive crossfade", "inactive crossfade")); end_xfade_rect->set_fill (true); } } @@ -532,7 +532,7 @@ AudioRegionView::set_height (gdouble height) gdouble ht; - if (!ARDOUR_UI::config()->get_show_name_highlight() || (height < NAME_HIGHLIGHT_THRESH)) { + if (!UIConfiguration::instance().get_show_name_highlight() || (height < NAME_HIGHLIGHT_THRESH)) { ht = height / (double) wcnt; } else { ht = (height - NAME_HIGHLIGHT_SIZE) / (double) wcnt; @@ -726,7 +726,7 @@ AudioRegionView::reset_fade_out_shape_width (boost::shared_ptr ar, effective_height = _height; - if (ARDOUR_UI::config()->get_show_name_highlight() && effective_height >= NAME_HIGHLIGHT_THRESH) { + if (UIConfiguration::instance().get_show_name_highlight() && effective_height >= NAME_HIGHLIGHT_THRESH) { effective_height -= NAME_HIGHLIGHT_SIZE; } @@ -792,14 +792,14 @@ AudioRegionView::redraw_start_xfade_to (boost::shared_ptr ar, frame if (!start_xfade_curve) { start_xfade_curve = new ArdourCanvas::XFadeCurve (group, ArdourCanvas::XFadeCurve::Start); CANVAS_DEBUG_NAME (start_xfade_curve, string_compose ("xfade start out line for %1", region()->name())); - start_xfade_curve->set_fill_color (ARDOUR_UI::config()->color_mod ("active crossfade", "crossfade alpha")); - start_xfade_curve->set_outline_color (ARDOUR_UI::config()->color ("crossfade line")); + start_xfade_curve->set_fill_color (UIConfiguration::instance().color_mod ("active crossfade", "crossfade alpha")); + start_xfade_curve->set_outline_color (UIConfiguration::instance().color ("crossfade line")); start_xfade_curve->set_ignore_events (true); } if (!start_xfade_rect) { start_xfade_rect = new ArdourCanvas::Rectangle (group); CANVAS_DEBUG_NAME (start_xfade_rect, string_compose ("xfade start rect for %1", region()->name())); - start_xfade_rect->set_outline_color (ARDOUR_UI::config()->color ("crossfade line")); + start_xfade_rect->set_outline_color (UIConfiguration::instance().color ("crossfade line")); start_xfade_rect->set_fill (false); start_xfade_rect->set_outline (false); start_xfade_rect->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_start_xfade_event), start_xfade_rect, this)); @@ -881,15 +881,15 @@ AudioRegionView::redraw_end_xfade_to (boost::shared_ptr ar, framecn if (!end_xfade_curve) { end_xfade_curve = new ArdourCanvas::XFadeCurve (group, ArdourCanvas::XFadeCurve::End); CANVAS_DEBUG_NAME (end_xfade_curve, string_compose ("xfade end out line for %1", region()->name())); - end_xfade_curve->set_fill_color (ARDOUR_UI::config()->color_mod ("active crossfade", "crossfade alpha")); - end_xfade_curve->set_outline_color (ARDOUR_UI::config()->color ("crossfade line")); + end_xfade_curve->set_fill_color (UIConfiguration::instance().color_mod ("active crossfade", "crossfade alpha")); + end_xfade_curve->set_outline_color (UIConfiguration::instance().color ("crossfade line")); end_xfade_curve->set_ignore_events (true); } if (!end_xfade_rect) { end_xfade_rect = new ArdourCanvas::Rectangle (group); CANVAS_DEBUG_NAME (end_xfade_rect, string_compose ("xfade end rect for %1", region()->name())); - end_xfade_rect->set_outline_color (ARDOUR_UI::config()->color ("crossfade line")); + end_xfade_rect->set_outline_color (UIConfiguration::instance().color ("crossfade line")); end_xfade_rect->set_fill (false); end_xfade_rect->set_outline (false); end_xfade_rect->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_end_xfade_event), end_xfade_rect, this)); @@ -1013,7 +1013,7 @@ AudioRegionView::set_samples_per_pixel (gdouble fpp) { RegionView::set_samples_per_pixel (fpp); - if (ARDOUR_UI::config()->get_show_waveforms ()) { + if (UIConfiguration::instance().get_show_waveforms ()) { for (uint32_t n = 0; n < waves.size(); ++n) { waves[n]->set_samples_per_pixel (fpp); } @@ -1041,33 +1041,33 @@ AudioRegionView::set_colors () if (gain_line) { gain_line->set_line_color (audio_region()->envelope_active() ? - ARDOUR_UI::config()->color ("gain line") : - ARDOUR_UI::config()->color_mod ("gain line inactive", "gain line inactive")); + UIConfiguration::instance().color ("gain line") : + UIConfiguration::instance().color_mod ("gain line inactive", "gain line inactive")); } set_waveform_colors (); if (start_xfade_curve) { - start_xfade_curve->set_fill_color (ARDOUR_UI::config()->color_mod ("active crossfade", "crossfade alpha")); - start_xfade_curve->set_outline_color (ARDOUR_UI::config()->color ("crossfade line")); + start_xfade_curve->set_fill_color (UIConfiguration::instance().color_mod ("active crossfade", "crossfade alpha")); + start_xfade_curve->set_outline_color (UIConfiguration::instance().color ("crossfade line")); } if (end_xfade_curve) { - end_xfade_curve->set_fill_color (ARDOUR_UI::config()->color_mod ("active crossfade", "crossfade alpha")); - end_xfade_curve->set_outline_color (ARDOUR_UI::config()->color ("crossfade line")); + end_xfade_curve->set_fill_color (UIConfiguration::instance().color_mod ("active crossfade", "crossfade alpha")); + end_xfade_curve->set_outline_color (UIConfiguration::instance().color ("crossfade line")); } if (start_xfade_rect) { - start_xfade_rect->set_outline_color (ARDOUR_UI::config()->color ("crossfade line")); + start_xfade_rect->set_outline_color (UIConfiguration::instance().color ("crossfade line")); } if (end_xfade_rect) { - end_xfade_rect->set_outline_color (ARDOUR_UI::config()->color ("crossfade line")); + end_xfade_rect->set_outline_color (UIConfiguration::instance().color ("crossfade line")); } } void AudioRegionView::setup_waveform_visibility () { - if (ARDOUR_UI::config()->get_show_waveforms ()) { + if (UIConfiguration::instance().get_show_waveforms ()) { for (uint32_t n = 0; n < waves.size(); ++n) { /* make sure the zoom level is correct, since we don't update this when waveforms are hidden. @@ -1107,7 +1107,7 @@ AudioRegionView::update_envelope_visibility () if (trackview.editor().current_mouse_mode() == Editing::MouseDraw || trackview.editor().current_mouse_mode() == Editing::MouseContent ) { gain_line->set_visibility (AutomationLine::VisibleAspects(AutomationLine::ControlPoints|AutomationLine::Line)); gain_line->canvas_group().raise_to_top (); - } else if (ARDOUR_UI::config()->get_show_region_gain() || trackview.editor().current_mouse_mode() == Editing::MouseRange ) { + } else if (UIConfiguration::instance().get_show_region_gain() || trackview.editor().current_mouse_mode() == Editing::MouseRange ) { gain_line->set_visibility (AutomationLine::VisibleAspects(AutomationLine::Line)); gain_line->canvas_group().raise_to_top (); } else { @@ -1228,12 +1228,12 @@ AudioRegionView::create_one_wave (uint32_t which, bool /*direct*/) wave->set_height (ht); wave->set_samples_per_pixel (samples_per_pixel); wave->set_show_zero_line (true); - wave->set_clip_level (ARDOUR_UI::config()->get_waveform_clip_level ()); + wave->set_clip_level (UIConfiguration::instance().get_waveform_clip_level ()); wave->set_start_shift (1.0); wave->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_wave_view_event), wave, this)); - switch (ARDOUR_UI::config()->get_waveform_shape()) { + switch (UIConfiguration::instance().get_waveform_shape()) { case Rectified: wave->set_shape (WaveView::Rectified); break; @@ -1241,13 +1241,13 @@ AudioRegionView::create_one_wave (uint32_t which, bool /*direct*/) wave->set_shape (WaveView::Normal); } - wave->set_logscaled (ARDOUR_UI::config()->get_waveform_scale() == Logarithmic); + wave->set_logscaled (UIConfiguration::instance().get_waveform_scale() == Logarithmic); vector v; v.push_back (wave); set_some_waveform_colors (v); - if (!ARDOUR_UI::config()->get_show_waveforms ()) { + if (!UIConfiguration::instance().get_show_waveforms ()) { wave->hide(); } @@ -1464,8 +1464,8 @@ AudioRegionView::envelope_active_changed () { if (gain_line) { gain_line->set_line_color (audio_region()->envelope_active() ? - ARDOUR_UI::config()->color ("gain line") : - ARDOUR_UI::config()->color_mod ("gain line inactive", "gain line inactive")); + UIConfiguration::instance().color ("gain line") : + UIConfiguration::instance().color_mod ("gain line inactive", "gain line inactive")); update_envelope_visibility (); } } @@ -1496,30 +1496,30 @@ AudioRegionView::set_some_waveform_colors (vector& wave { ArdourCanvas::Color fill; ArdourCanvas::Color outline; - ArdourCanvas::Color clip = ARDOUR_UI::config()->color ("clipped waveform"); - ArdourCanvas::Color zero = ARDOUR_UI::config()->color ("zero line"); + ArdourCanvas::Color clip = UIConfiguration::instance().color ("clipped waveform"); + ArdourCanvas::Color zero = UIConfiguration::instance().color ("zero line"); if (_selected) { if (_region->muted()) { /* hide outline with zero alpha */ - outline = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->color ("selected waveform outline"), 0); - fill = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->color ("selected waveform fill"), MUTED_ALPHA); + outline = UINT_RGBA_CHANGE_A(UIConfiguration::instance().color ("selected waveform outline"), 0); + fill = UINT_RGBA_CHANGE_A(UIConfiguration::instance().color ("selected waveform fill"), MUTED_ALPHA); } else { - outline = ARDOUR_UI::config()->color ("selected waveform outline"); - fill = ARDOUR_UI::config()->color ("selected waveform fill"); + outline = UIConfiguration::instance().color ("selected waveform outline"); + fill = UIConfiguration::instance().color ("selected waveform fill"); } } else { if (_recregion) { - outline = ARDOUR_UI::config()->color ("recording waveform outline"); - fill = ARDOUR_UI::config()->color ("recording waveform fill"); + outline = UIConfiguration::instance().color ("recording waveform outline"); + fill = UIConfiguration::instance().color ("recording waveform fill"); } else { if (_region->muted()) { /* hide outline with zero alpha */ - outline = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->color ("waveform outline"), 0); - fill = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->color ("waveform fill"), MUTED_ALPHA); + outline = UINT_RGBA_CHANGE_A(UIConfiguration::instance().color ("waveform outline"), 0); + fill = UINT_RGBA_CHANGE_A(UIConfiguration::instance().color ("waveform fill"), MUTED_ALPHA); } else { - outline = ARDOUR_UI::config()->color ("waveform outline"); - fill = ARDOUR_UI::config()->color ("waveform fill"); + outline = UIConfiguration::instance().color ("waveform outline"); + fill = UIConfiguration::instance().color ("waveform fill"); } } } diff --git a/gtk2_ardour/audio_streamview.cc b/gtk2_ardour/audio_streamview.cc index ed7bfc238d..91a9ee4cf6 100644 --- a/gtk2_ardour/audio_streamview.cc +++ b/gtk2_ardour/audio_streamview.cc @@ -44,9 +44,9 @@ #include "region_gain_line.h" #include "selection.h" #include "public_editor.h" -#include "ardour_ui.h" #include "rgb_macros.h" #include "gui_thread.h" +#include "ui_config.h" #include "i18n.h" @@ -187,7 +187,7 @@ AudioStreamView::setup_rec_box () if (!rec_active && _trackview.session()->record_status() == Session::Recording && _trackview.track()->record_enabled()) { - if (_trackview.audio_track()->mode() == Normal && ARDOUR_UI::config()->get_show_waveforms_while_recording() && rec_regions.size() == rec_rects.size()) { + if (_trackview.audio_track()->mode() == Normal && UIConfiguration::instance().get_show_waveforms_while_recording() && rec_regions.size() == rec_rects.size()) { /* add a new region, but don't bother if they set show-waveforms-while-recording mid-record */ @@ -315,7 +315,7 @@ AudioStreamView::rec_peak_range_ready (framepos_t start, framecnt_t cnt, boost:: void AudioStreamView::update_rec_regions (framepos_t start, framecnt_t cnt) { - if (!ARDOUR_UI::config()->get_show_waveforms_while_recording ()) { + if (!UIConfiguration::instance().get_show_waveforms_while_recording ()) { return; } @@ -460,15 +460,15 @@ AudioStreamView::color_handler () { //case cAudioTrackBase: if (_trackview.is_track()) { - canvas_rect->set_fill_color (ARDOUR_UI::config()->color_mod ("audio track base", "audio track base")); + canvas_rect->set_fill_color (UIConfiguration::instance().color_mod ("audio track base", "audio track base")); } //case cAudioBusBase: if (!_trackview.is_track()) { if (Profile->get_sae() && _trackview.route()->is_master()) { - canvas_rect->set_fill_color (ARDOUR_UI::config()->color ("audio master bus base")); + canvas_rect->set_fill_color (UIConfiguration::instance().color ("audio master bus base")); } else { - canvas_rect->set_fill_color (ARDOUR_UI::config()->color_mod ("audio bus base", "audio bus base")); + canvas_rect->set_fill_color (UIConfiguration::instance().color_mod ("audio bus base", "audio bus base")); } } } diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index 7ea3ff027c..6aed613ac8 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -53,12 +53,12 @@ #include "control_point.h" #include "gui_thread.h" #include "rgb_macros.h" -#include "ardour_ui.h" #include "public_editor.h" #include "selection.h" #include "time_axis_view.h" #include "point_selection.h" #include "automation_time_axis.h" +#include "ui_config.h" #include "ardour/event_type_map.h" #include "ardour/session.h" @@ -950,7 +950,7 @@ AutomationLine::set_selected_points (PointSelection const & points) void AutomationLine::set_colors () { - set_line_color (ARDOUR_UI::config()->color ("automation line")); + set_line_color (UIConfiguration::instance().color ("automation line")); for (vector::iterator i = control_points.begin(); i != control_points.end(); ++i) { (*i)->set_color (); } diff --git a/gtk2_ardour/automation_region_view.cc b/gtk2_ardour/automation_region_view.cc index b418d096f2..5450815329 100644 --- a/gtk2_ardour/automation_region_view.cc +++ b/gtk2_ardour/automation_region_view.cc @@ -29,7 +29,6 @@ #include "gtkmm2ext/keyboard.h" -#include "ardour_ui.h" #include "automation_region_view.h" #include "editing.h" #include "editor.h" @@ -37,6 +36,7 @@ #include "gui_thread.h" #include "midi_automation_line.h" #include "public_editor.h" +#include "ui_config.h" #include "i18n.h" @@ -109,11 +109,11 @@ AutomationRegionView::get_fill_color() const trackview.editor().internal_editing() ? "editable region" : "midi frame base"); if (_selected) { - return ARDOUR_UI::config()->color_mod ("selected region base", mod_name); - } else if (high_enough_for_name || !ARDOUR_UI::config()->get_color_regions_using_track_color()) { - return ARDOUR_UI::config()->color_mod ("midi frame base", mod_name); + return UIConfiguration::instance().color_mod ("selected region base", mod_name); + } else if (high_enough_for_name || !UIConfiguration::instance().get_color_regions_using_track_color()) { + return UIConfiguration::instance().color_mod ("midi frame base", mod_name); } - return ARDOUR_UI::config()->color_mod (fill_color, mod_name); + return UIConfiguration::instance().color_mod (fill_color, mod_name); } void diff --git a/gtk2_ardour/automation_streamview.cc b/gtk2_ardour/automation_streamview.cc index fc53054bce..be72459980 100644 --- a/gtk2_ardour/automation_streamview.cc +++ b/gtk2_ardour/automation_streamview.cc @@ -30,7 +30,6 @@ #include "ardour/midi_region.h" #include "ardour/midi_source.h" -#include "ardour_ui.h" #include "automation_region_view.h" #include "automation_streamview.h" #include "automation_time_axis.h" @@ -40,6 +39,7 @@ #include "region_view.h" #include "rgb_macros.h" #include "selection.h" +#include "ui_config.h" #include "i18n.h" @@ -60,7 +60,7 @@ AutomationStreamView::AutomationStreamView (AutomationTimeAxisView& tv) color_handler (); - UIConfiguration::ColorsChanged.connect(sigc::mem_fun(*this, &AutomationStreamView::color_handler)); + UIConfiguration::instance().ColorsChanged.connect(sigc::mem_fun(*this, &AutomationStreamView::color_handler)); } AutomationStreamView::~AutomationStreamView () @@ -202,9 +202,9 @@ void AutomationStreamView::color_handler () { if (_trackview.is_midi_track()) { - canvas_rect->set_fill_color (ARDOUR_UI::config()->color_mod ("midi track base", "midi track base")); + canvas_rect->set_fill_color (UIConfiguration::instance().color_mod ("midi track base", "midi track base")); } else { - canvas_rect->set_fill_color (ARDOUR_UI::config()->color ("midi bus base")); + canvas_rect->set_fill_color (UIConfiguration::instance().color ("midi bus base")); } } diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index 197775ef79..032ffc3b11 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -50,6 +50,7 @@ #include "control_point.h" #include "utils.h" #include "item_counts.h" +#include "ui_config.h" #include "i18n.h" @@ -141,7 +142,7 @@ AutomationTimeAxisView::AutomationTimeAxisView ( CANVAS_DEBUG_NAME (_base_rect, string_compose ("base rect for %1", _name)); _base_rect->set_x1 (ArdourCanvas::COORD_MAX); _base_rect->set_outline (false); - _base_rect->set_fill_color (ARDOUR_UI::config()->color_mod (fill_color_name, "automation track fill")); + _base_rect->set_fill_color (UIConfiguration::instance().color_mod (fill_color_name, "automation track fill")); _base_rect->set_data ("trackview", this); _base_rect->Event.connect (sigc::bind (sigc::mem_fun (_editor, &PublicEditor::canvas_automation_track_event), _base_rect, this)); if (!a) { @@ -267,7 +268,7 @@ AutomationTimeAxisView::AutomationTimeAxisView ( ) ); - line->set_line_color (ARDOUR_UI::config()->color ("processor automation line")); + line->set_line_color (UIConfiguration::instance().color ("processor automation line")); line->queue_reset (); add_line (line); } @@ -275,7 +276,7 @@ AutomationTimeAxisView::AutomationTimeAxisView ( /* make sure labels etc. are correct */ automation_state_changed (); - UIConfiguration::ColorsChanged.connect (sigc::mem_fun (*this, &AutomationTimeAxisView::color_handler)); + UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &AutomationTimeAxisView::color_handler)); _route->DropReferences.connect ( _route_connections, invalidator (*this), boost::bind (&AutomationTimeAxisView::route_going_away, this), gui_context () diff --git a/gtk2_ardour/button_joiner.cc b/gtk2_ardour/button_joiner.cc index da9ae45847..88f79c25a2 100644 --- a/gtk2_ardour/button_joiner.cc +++ b/gtk2_ardour/button_joiner.cc @@ -29,6 +29,7 @@ #include "ardour_ui.h" #include "button_joiner.h" +#include "ui_config.h" using namespace Gtk; @@ -74,7 +75,7 @@ ButtonJoiner::ButtonJoiner (const std::string& str, Gtk::Widget& lw, Gtk::Widget uint32_t border_color; uint32_t r, g, b, a; - border_color = ARDOUR_UI::config()->color (string_compose ("%1: border end", name)); + border_color = UIConfiguration::instance().color (string_compose ("%1: border end", name)); UINT_TO_RGBA (border_color, &r, &g, &b, &a); border_r = r/255.0; @@ -256,15 +257,15 @@ ButtonJoiner::set_colors () active_fill_pattern = cairo_pattern_create_linear (0.0, 0.0, 0.0, get_height()); inactive_fill_pattern = cairo_pattern_create_linear (0.0, 0.0, 0.0, get_height()); - start_color = ARDOUR_UI::config()->color (string_compose ("%1: fill start", name)); - end_color = ARDOUR_UI::config()->color (string_compose ("%1: fill end", name)); + start_color = UIConfiguration::instance().color (string_compose ("%1: fill start", name)); + end_color = UIConfiguration::instance().color (string_compose ("%1: fill end", name)); UINT_TO_RGBA (start_color, &r, &g, &b, &a); cairo_pattern_add_color_stop_rgba (inactive_fill_pattern, 0, r/255.0,g/255.0,b/255.0, a/255.0); UINT_TO_RGBA (end_color, &r, &g, &b, &a); cairo_pattern_add_color_stop_rgba (inactive_fill_pattern, 1, r/255.0,g/255.0,b/255.0, a/255.0); - start_color = ARDOUR_UI::config()->color (string_compose ("%1: fill start active", name)); - end_color = ARDOUR_UI::config()->color (string_compose ("%1: fill end active", name)); + start_color = UIConfiguration::instance().color (string_compose ("%1: fill start active", name)); + end_color = UIConfiguration::instance().color (string_compose ("%1: fill end active", name)); UINT_TO_RGBA (start_color, &r, &g, &b, &a); cairo_pattern_add_color_stop_rgba (active_fill_pattern, 0, r/255.0,g/255.0,b/255.0, a/255.0); UINT_TO_RGBA (end_color, &r, &g, &b, &a); diff --git a/gtk2_ardour/control_point.cc b/gtk2_ardour/control_point.cc index 4963b2589d..01b92ea66f 100644 --- a/gtk2_ardour/control_point.cc +++ b/gtk2_ardour/control_point.cc @@ -19,8 +19,8 @@ #include "control_point.h" #include "automation_line.h" -#include "ardour_ui.h" #include "public_editor.h" +#include "ui_config.h" #include "canvas/rectangle.h" @@ -45,8 +45,8 @@ ControlPoint::ControlPoint (AutomationLine& al) _item = new ArdourCanvas::Rectangle (&_line.canvas_group()); _item->set_fill (true); - _item->set_fill_color (ARDOUR_UI::config()->color ("control point fill")); - _item->set_outline_color (ARDOUR_UI::config()->color ("control point outline")); + _item->set_fill_color (UIConfiguration::instance().color ("control point fill")); + _item->set_outline_color (UIConfiguration::instance().color ("control point outline")); _item->set_data ("control_point", this); _item->Event.connect (sigc::mem_fun (this, &ControlPoint::event_handler)); @@ -70,7 +70,7 @@ ControlPoint::ControlPoint (const ControlPoint& other, bool /*dummy_arg_to_force _item = new ArdourCanvas::Rectangle (&_line.canvas_group()); _item->set_fill (true); - _item->set_outline_color (ARDOUR_UI::config()->color ("control point outline")); + _item->set_outline_color (UIConfiguration::instance().color ("control point outline")); /* NOTE: no event handling in copied ControlPoints */ @@ -120,11 +120,11 @@ void ControlPoint::set_color () { if (_selected) { - _item->set_outline_color(ARDOUR_UI::config()->color ("control point selected outline"));; - _item->set_fill_color(ARDOUR_UI::config()->color ("control point selected fill")); + _item->set_outline_color(UIConfiguration::instance().color ("control point selected outline"));; + _item->set_fill_color(UIConfiguration::instance().color ("control point selected fill")); } else { - _item->set_outline_color(ARDOUR_UI::config()->color ("control point outline")); - _item->set_fill_color(ARDOUR_UI::config()->color ("control point fill")); + _item->set_outline_color(UIConfiguration::instance().color ("control point outline")); + _item->set_fill_color(UIConfiguration::instance().color ("control point fill")); } } diff --git a/gtk2_ardour/crossfade_edit.cc b/gtk2_ardour/crossfade_edit.cc index 2f77df527c..367beceb24 100644 --- a/gtk2_ardour/crossfade_edit.cc +++ b/gtk2_ardour/crossfade_edit.cc @@ -135,21 +135,21 @@ CrossfadeEditor::CrossfadeEditor (Session* s, boost::shared_ptr xf, d toplevel = new ArdourCanvas::Rectangle (canvas->root()); toplevel->set (ArdourCanvas::Rect (0, 0, 10, 10)); toplevel->set_fill (true); - toplevel->set_fill_color (ARDOUR_UI::config()->get_CrossfadeEditorBase()); + toplevel->set_fill_color (UIConfiguration::instance().get_CrossfadeEditorBase()); toplevel->set_outline (false); toplevel->Event.connect (sigc::mem_fun (*this, &CrossfadeEditor::canvas_event)); fade[Out].line = new ArdourCanvas::PolyLine (canvas->root()); - fade[Out].line->set_outline_color (ARDOUR_UI::config()->get_CrossfadeEditorLine()); + fade[Out].line->set_outline_color (UIConfiguration::instance().get_CrossfadeEditorLine()); fade[Out].shading = new ArdourCanvas::Polygon (canvas->root()); - fade[Out].shading->set_fill_color (ARDOUR_UI::config()->get_CrossfadeEditorLineShading()); + fade[Out].shading->set_fill_color (UIConfiguration::instance().get_CrossfadeEditorLineShading()); fade[In].line = new ArdourCanvas::PolyLine (canvas->root()); - fade[In].line->set_outline_color (ARDOUR_UI::config()->get_CrossfadeEditorLine()); + fade[In].line->set_outline_color (UIConfiguration::instance().get_CrossfadeEditorLine()); fade[In].shading = new ArdourCanvas::Polygon (canvas->root()); - fade[In].shading->set_fill_color (ARDOUR_UI::config()->get_CrossfadeEditorLineShading()); + fade[In].shading->set_fill_color (UIConfiguration::instance().get_CrossfadeEditorLineShading()); fade[In].shading->Event.connect (sigc::mem_fun (*this, &CrossfadeEditor::canvas_event)); fade[In].line->Event.connect (sigc::mem_fun (*this, &CrossfadeEditor::curve_event)); @@ -463,8 +463,8 @@ CrossfadeEditor::make_point () p->box = new ArdourCanvas::Rectangle (canvas->root()); p->box->set_fill (true); - p->box->set_fill_color (ARDOUR_UI::config()->get_CrossfadeEditorPointFill()); - p->box->set_outline_color (ARDOUR_UI::config()->get_CrossfadeEditorPointOutline()); + p->box->set_fill_color (UIConfiguration::instance().get_CrossfadeEditorPointFill()); + p->box->set_outline_color (UIConfiguration::instance().get_CrossfadeEditorPointOutline()); p->curve = fade[current].line; @@ -1063,17 +1063,17 @@ CrossfadeEditor::curve_select_clicked (WhichFade wf) if (wf == In) { for (vector::iterator i = fade[In].waves.begin(); i != fade[In].waves.end(); ++i) { - (*i)->set_outline_color (ARDOUR_UI::config()->get_SelectedCrossfadeEditorWave()); - (*i)->set_fill_color (ARDOUR_UI::config()->get_SelectedCrossfadeEditorWave()); + (*i)->set_outline_color (UIConfiguration::instance().get_SelectedCrossfadeEditorWave()); + (*i)->set_fill_color (UIConfiguration::instance().get_SelectedCrossfadeEditorWave()); } for (vector::iterator i = fade[Out].waves.begin(); i != fade[Out].waves.end(); ++i) { - (*i)->set_outline_color (ARDOUR_UI::config()->get_CrossfadeEditorWave()); - (*i)->set_fill_color (ARDOUR_UI::config()->get_CrossfadeEditorWave()); + (*i)->set_outline_color (UIConfiguration::instance().get_CrossfadeEditorWave()); + (*i)->set_fill_color (UIConfiguration::instance().get_CrossfadeEditorWave()); } - fade[In].line->set_outline_color (ARDOUR_UI::config()->get_SelectedCrossfadeEditorLine()); - fade[Out].line->set_outline_color (ARDOUR_UI::config()->get_CrossfadeEditorLine()); + fade[In].line->set_outline_color (UIConfiguration::instance().get_SelectedCrossfadeEditorLine()); + fade[Out].line->set_outline_color (UIConfiguration::instance().get_CrossfadeEditorLine()); fade[Out].shading->hide(); fade[In].shading->show(); @@ -1088,17 +1088,17 @@ CrossfadeEditor::curve_select_clicked (WhichFade wf) } else { for (vector::iterator i = fade[In].waves.begin(); i != fade[In].waves.end(); ++i) { - (*i)->set_outline_color (ARDOUR_UI::config()->get_CrossfadeEditorWave()); - (*i)->set_fill_color (ARDOUR_UI::config()->get_CrossfadeEditorWave()); + (*i)->set_outline_color (UIConfiguration::instance().get_CrossfadeEditorWave()); + (*i)->set_fill_color (UIConfiguration::instance().get_CrossfadeEditorWave()); } for (vector::iterator i = fade[Out].waves.begin(); i != fade[Out].waves.end(); ++i) { - (*i)->set_outline_color (ARDOUR_UI::config()->get_SelectedCrossfadeEditorWave()); - (*i)->set_fill_color (ARDOUR_UI::config()->get_SelectedCrossfadeEditorWave()); + (*i)->set_outline_color (UIConfiguration::instance().get_SelectedCrossfadeEditorWave()); + (*i)->set_fill_color (UIConfiguration::instance().get_SelectedCrossfadeEditorWave()); } - fade[Out].line->set_outline_color (ARDOUR_UI::config()->get_SelectedCrossfadeEditorLine()); - fade[In].line->set_outline_color (ARDOUR_UI::config()->get_CrossfadeEditorLine()); + fade[Out].line->set_outline_color (UIConfiguration::instance().get_SelectedCrossfadeEditorLine()); + fade[In].line->set_outline_color (UIConfiguration::instance().get_CrossfadeEditorLine()); fade[In].shading->hide(); fade[Out].shading->show(); @@ -1140,9 +1140,9 @@ CrossfadeEditor::make_waves (boost::shared_ptr region, WhichFade wh double spu; if (which == In) { - color = ARDOUR_UI::config()->get_SelectedCrossfadeEditorWave(); + color = UIConfiguration::instance().get_SelectedCrossfadeEditorWave(); } else { - color = ARDOUR_UI::config()->get_CrossfadeEditorWave(); + color = UIConfiguration::instance().get_CrossfadeEditorWave(); } ht = canvas->get_allocation().get_height() / (double) nchans; diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 0a51b0ee09..2f6a52cab9 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -124,6 +124,7 @@ #include "tempo_lines.h" #include "time_axis_view.h" #include "timers.h" +#include "ui_config.h" #include "utils.h" #include "verbose_cursor.h" @@ -402,11 +403,11 @@ Editor::Editor () sfbrowser = 0; - location_marker_color = ARDOUR_UI::config()->color ("location marker"); - location_range_color = ARDOUR_UI::config()->color ("location range"); - location_cd_marker_color = ARDOUR_UI::config()->color ("location cd marker"); - location_loop_color = ARDOUR_UI::config()->color ("location loop"); - location_punch_color = ARDOUR_UI::config()->color ("location punch"); + location_marker_color = UIConfiguration::instance().color ("location marker"); + location_range_color = UIConfiguration::instance().color ("location range"); + location_cd_marker_color = UIConfiguration::instance().color ("location cd marker"); + location_loop_color = UIConfiguration::instance().color ("location loop"); + location_punch_color = UIConfiguration::instance().color ("location punch"); zoom_focus = ZoomFocusPlayhead; _edit_point = EditAtMouse; @@ -414,7 +415,7 @@ Editor::Editor () samples_per_pixel = 2048; /* too early to use reset_zoom () */ - timebar_height = std::max(12., ceil (15. * ARDOUR_UI::config()->get_ui_scale())); + timebar_height = std::max(12., ceil (15. * UIConfiguration::instance().get_ui_scale())); TimeAxisView::setup_sizes (); ArdourMarker::setup_sizes (timebar_height); @@ -530,8 +531,8 @@ Editor::Editor () controls_layout.signal_scroll_event().connect (sigc::mem_fun(*this, &Editor::control_layout_scroll), false); _cursors = new MouseCursors; - _cursors->set_cursor_set (ARDOUR_UI::config()->get_icon_set()); - cerr << "Set cursor set to " << ARDOUR_UI::config()->get_icon_set() << endl; + _cursors->set_cursor_set (UIConfiguration::instance().get_icon_set()); + cerr << "Set cursor set to " << UIConfiguration::instance().get_icon_set() << endl; /* Push default cursor to ever-present bottom of cursor stack. */ push_canvas_cursor(_cursors->grabber); @@ -771,7 +772,7 @@ Editor::Editor () Session::AskAboutPlaylistDeletion.connect_same_thread (*this, boost::bind (&Editor::playlist_deletion_dialog, this, _1)); Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&Editor::parameter_changed, this, _1), gui_context()); - ARDOUR_UI::config()->ParameterChanged.connect (sigc::mem_fun (*this, &Editor::ui_parameter_changed)); + UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &Editor::ui_parameter_changed)); TimeAxisView::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&Editor::timeaxisview_deleted, this, _1), gui_context()); @@ -798,7 +799,7 @@ Editor::Editor () /* grab current parameter state */ boost::function pc (boost::bind (&Editor::ui_parameter_changed, this, _1)); - ARDOUR_UI::config()->map_parameters (pc); + UIConfiguration::instance().map_parameters (pc); setup_fade_images (); @@ -1156,7 +1157,7 @@ Editor::on_realize () Window::on_realize (); Realized (); - if (ARDOUR_UI::config()->get_lock_gui_after_seconds()) { + if (UIConfiguration::instance().get_lock_gui_after_seconds()) { start_lock_event_timing (); } @@ -1216,7 +1217,7 @@ Editor::lock_timeout_callback () timersub (&now, &last_event_time, &delta); - if (delta.tv_sec > (time_t) ARDOUR_UI::config()->get_lock_gui_after_seconds()) { + if (delta.tv_sec > (time_t) UIConfiguration::instance().get_lock_gui_after_seconds()) { lock (); /* don't call again. Returning false will effectively disconnect us from the timer callback. @@ -4247,7 +4248,7 @@ Editor::session_state_saved (string) void Editor::update_tearoff_visibility() { - bool visible = ARDOUR_UI::config()->get_keep_tearoffs(); + bool visible = UIConfiguration::instance().get_keep_tearoffs(); _mouse_mode_tearoff->set_visible (visible); _tools_tearoff->set_visible (visible); if (_zoom_tearoff) { @@ -5982,11 +5983,11 @@ Editor::ui_parameter_changed (string parameter) while (!_cursor_stack.empty()) { _cursor_stack.pop_back(); } - _cursors->set_cursor_set (ARDOUR_UI::config()->get_icon_set()); + _cursors->set_cursor_set (UIConfiguration::instance().get_icon_set()); _cursor_stack.push_back(_cursors->grabber); } else if (parameter == "draggable-playhead") { if (_verbose_cursor) { - playhead_cursor->set_sensitive (ARDOUR_UI::config()->get_draggable_playhead()); + playhead_cursor->set_sensitive (UIConfiguration::instance().get_draggable_playhead()); } } } diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 1a40ba99b7..50b5480458 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -39,6 +39,7 @@ #include "editor.h" #include "gui_thread.h" #include "time_axis_view.h" +#include "ui_config.h" #include "utils.h" #include "i18n.h" #include "audio_time_axis.h" @@ -1633,10 +1634,10 @@ Editor::toggle_sound_midi_notes () Glib::RefPtr act = ActionManager::get_action (X_("Editor"), X_("sound-midi-notes")); if (act) { - bool s = ARDOUR_UI::config()->get_sound_midi_notes(); + bool s = UIConfiguration::instance().get_sound_midi_notes(); Glib::RefPtr tact = Glib::RefPtr::cast_dynamic (act); if (tact->get_active () != s) { - ARDOUR_UI::config()->set_sound_midi_notes (tact->get_active()); + UIConfiguration::instance().set_sound_midi_notes (tact->get_active()); } } } @@ -1716,13 +1717,13 @@ Editor::parameter_changed (std::string p) update_just_timecode (); } else if (p == "show-zoom-tools") { if (_zoom_tearoff) { - _zoom_tearoff->set_visible (ARDOUR_UI::config()->get_show_zoom_tools(), true); + _zoom_tearoff->set_visible (UIConfiguration::instance().get_show_zoom_tools(), true); } } else if (p == "sound-midi-notes") { Glib::RefPtr act = ActionManager::get_action (X_("Editor"), X_("sound-midi-notes")); if (act) { - bool s = ARDOUR_UI::config()->get_sound_midi_notes(); + bool s = UIConfiguration::instance().get_sound_midi_notes(); Glib::RefPtr tact = Glib::RefPtr::cast_dynamic (act); if (tact->get_active () != s) { tact->set_active (s); @@ -1738,7 +1739,7 @@ Editor::parameter_changed (std::string p) /* this doesn't really belong here but it has to go somewhere */ - if (ARDOUR_UI::config()->get_use_tooltips()) { + if (UIConfiguration::instance().get_use_tooltips()) { Gtkmm2ext::enable_tooltips (); } else { Gtkmm2ext::disable_tooltips (); diff --git a/gtk2_ardour/editor_audiotrack.cc b/gtk2_ardour/editor_audiotrack.cc index 54a944fda1..b569037ccc 100644 --- a/gtk2_ardour/editor_audiotrack.cc +++ b/gtk2_ardour/editor_audiotrack.cc @@ -21,13 +21,13 @@ #include "canvas/canvas.h" -#include "ardour_ui.h" #include "editor.h" #include "editing.h" #include "audio_time_axis.h" #include "route_time_axis.h" #include "audio_region_view.h" #include "selection.h" +#include "ui_config.h" #include "i18n.h" @@ -70,7 +70,7 @@ void Editor::toggle_meter_updating() { DisplaySuspender ds; - if (ARDOUR_UI::config()->get_show_track_meters()) { + if (UIConfiguration::instance().get_show_track_meters()) { start_updating_meters (); } else { stop_updating_meters (); diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index f33dbe2684..3439edb43e 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -51,6 +51,7 @@ #include "keyboard.h" #include "editor_cursors.h" #include "mouse_cursors.h" +#include "ui_config.h" #include "verbose_cursor.h" #include "i18n.h" @@ -70,7 +71,7 @@ Editor::initialize_canvas () _track_canvas_viewport = new ArdourCanvas::GtkCanvasViewport (horizontal_adjustment, vertical_adjustment); _track_canvas = _track_canvas_viewport->canvas (); - _track_canvas->set_background_color (ARDOUR_UI::config()->color ("arrange base")); + _track_canvas->set_background_color (UIConfiguration::instance().color ("arrange base")); /* scroll group for items that should not automatically scroll * (e.g verbose cursor). It shares the canvas coordinate space. @@ -272,7 +273,7 @@ Editor::initialize_canvas () initialize_rulers (); - UIConfiguration::ColorsChanged.connect (sigc::mem_fun (*this, &Editor::color_handler)); + UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &Editor::color_handler)); color_handler(); } @@ -427,7 +428,7 @@ Editor::drop_paths_part_two (const vector& paths, framepos_t frame, doub InstrumentSelector is; // instantiation builds instrument-list and sets default. do_import (midi_paths, Editing::ImportDistinctFiles, ImportAsTrack, SrcBest, frame, is.selected_instrument()); - if (Profile->get_sae() || ARDOUR_UI::config()->get_only_copy_imported_files() || copy) { + if (Profile->get_sae() || UIConfiguration::instance().get_only_copy_imported_files() || copy) { do_import (audio_paths, Editing::ImportDistinctFiles, Editing::ImportAsTrack, SrcBest, frame); } else { do_embed (audio_paths, Editing::ImportDistinctFiles, ImportAsTrack, frame); @@ -443,7 +444,7 @@ Editor::drop_paths_part_two (const vector& paths, framepos_t frame, doub do_import (midi_paths, Editing::ImportSerializeFiles, ImportToTrack, SrcBest, frame); - if (Profile->get_sae() || ARDOUR_UI::config()->get_only_copy_imported_files() || copy) { + if (Profile->get_sae() || UIConfiguration::instance().get_only_copy_imported_files() || copy) { do_import (audio_paths, Editing::ImportSerializeFiles, Editing::ImportToTrack, SrcBest, frame); } else { do_embed (audio_paths, Editing::ImportSerializeFiles, ImportToTrack, frame); @@ -499,7 +500,7 @@ Editor::drop_paths (const RefPtr& context, void Editor::maybe_autoscroll (bool allow_horiz, bool allow_vert, bool from_headers) { - if (!ARDOUR_UI::config()->get_autoscroll_editor () || autoscroll_active ()) { + if (!UIConfiguration::instance().get_autoscroll_editor () || autoscroll_active ()) { return; } @@ -884,8 +885,8 @@ Editor::set_horizontal_position (double p) void Editor::color_handler() { - ArdourCanvas::Color base = ARDOUR_UI::config()->color ("ruler base"); - ArdourCanvas::Color text = ARDOUR_UI::config()->color ("ruler text"); + ArdourCanvas::Color base = UIConfiguration::instance().color ("ruler base"); + ArdourCanvas::Color text = UIConfiguration::instance().color ("ruler text"); timecode_ruler->set_fill_color (base); timecode_ruler->set_outline_color (text); minsec_ruler->set_fill_color (base); @@ -895,57 +896,57 @@ Editor::color_handler() bbt_ruler->set_fill_color (base); bbt_ruler->set_outline_color (text); - playhead_cursor->set_color (ARDOUR_UI::config()->color ("play head")); + playhead_cursor->set_color (UIConfiguration::instance().color ("play head")); - meter_bar->set_fill_color (ARDOUR_UI::config()->color_mod ("meter bar", "marker bar")); - meter_bar->set_outline_color (ARDOUR_UI::config()->color ("marker bar separator")); + meter_bar->set_fill_color (UIConfiguration::instance().color_mod ("meter bar", "marker bar")); + meter_bar->set_outline_color (UIConfiguration::instance().color ("marker bar separator")); - tempo_bar->set_fill_color (ARDOUR_UI::config()->color_mod ("tempo bar", "marker bar")); - tempo_bar->set_outline_color (ARDOUR_UI::config()->color ("marker bar separator")); + tempo_bar->set_fill_color (UIConfiguration::instance().color_mod ("tempo bar", "marker bar")); + tempo_bar->set_outline_color (UIConfiguration::instance().color ("marker bar separator")); - marker_bar->set_fill_color (ARDOUR_UI::config()->color_mod ("marker bar", "marker bar")); - marker_bar->set_outline_color (ARDOUR_UI::config()->color ("marker bar separator")); + marker_bar->set_fill_color (UIConfiguration::instance().color_mod ("marker bar", "marker bar")); + marker_bar->set_outline_color (UIConfiguration::instance().color ("marker bar separator")); - cd_marker_bar->set_fill_color (ARDOUR_UI::config()->color_mod ("cd marker bar", "marker bar")); - cd_marker_bar->set_outline_color (ARDOUR_UI::config()->color ("marker bar separator")); + cd_marker_bar->set_fill_color (UIConfiguration::instance().color_mod ("cd marker bar", "marker bar")); + cd_marker_bar->set_outline_color (UIConfiguration::instance().color ("marker bar separator")); - range_marker_bar->set_fill_color (ARDOUR_UI::config()->color_mod ("range marker bar", "marker bar")); - range_marker_bar->set_outline_color (ARDOUR_UI::config()->color ("marker bar separator")); + range_marker_bar->set_fill_color (UIConfiguration::instance().color_mod ("range marker bar", "marker bar")); + range_marker_bar->set_outline_color (UIConfiguration::instance().color ("marker bar separator")); - transport_marker_bar->set_fill_color (ARDOUR_UI::config()->color_mod ("transport marker bar", "marker bar")); - transport_marker_bar->set_outline_color (ARDOUR_UI::config()->color ("marker bar separator")); + transport_marker_bar->set_fill_color (UIConfiguration::instance().color_mod ("transport marker bar", "marker bar")); + transport_marker_bar->set_outline_color (UIConfiguration::instance().color ("marker bar separator")); - cd_marker_bar_drag_rect->set_fill_color (ARDOUR_UI::config()->color ("range drag bar rect")); - cd_marker_bar_drag_rect->set_outline_color (ARDOUR_UI::config()->color ("range drag bar rect")); + cd_marker_bar_drag_rect->set_fill_color (UIConfiguration::instance().color ("range drag bar rect")); + cd_marker_bar_drag_rect->set_outline_color (UIConfiguration::instance().color ("range drag bar rect")); - range_bar_drag_rect->set_fill_color (ARDOUR_UI::config()->color ("range drag bar rect")); - range_bar_drag_rect->set_outline_color (ARDOUR_UI::config()->color ("range drag bar rect")); + range_bar_drag_rect->set_fill_color (UIConfiguration::instance().color ("range drag bar rect")); + range_bar_drag_rect->set_outline_color (UIConfiguration::instance().color ("range drag bar rect")); - transport_bar_drag_rect->set_fill_color (ARDOUR_UI::config()->color ("transport drag rect")); - transport_bar_drag_rect->set_outline_color (ARDOUR_UI::config()->color ("transport drag rect")); + transport_bar_drag_rect->set_fill_color (UIConfiguration::instance().color ("transport drag rect")); + transport_bar_drag_rect->set_outline_color (UIConfiguration::instance().color ("transport drag rect")); - transport_loop_range_rect->set_fill_color (ARDOUR_UI::config()->color_mod ("transport loop rect", "loop rectangle")); - transport_loop_range_rect->set_outline_color (ARDOUR_UI::config()->color ("transport loop rect")); + transport_loop_range_rect->set_fill_color (UIConfiguration::instance().color_mod ("transport loop rect", "loop rectangle")); + transport_loop_range_rect->set_outline_color (UIConfiguration::instance().color ("transport loop rect")); - transport_punch_range_rect->set_fill_color (ARDOUR_UI::config()->color ("transport punch rect")); - transport_punch_range_rect->set_outline_color (ARDOUR_UI::config()->color ("transport punch rect")); + transport_punch_range_rect->set_fill_color (UIConfiguration::instance().color ("transport punch rect")); + transport_punch_range_rect->set_outline_color (UIConfiguration::instance().color ("transport punch rect")); - transport_punchin_line->set_outline_color (ARDOUR_UI::config()->color ("punch line")); - transport_punchout_line->set_outline_color (ARDOUR_UI::config()->color ("punch line")); + transport_punchin_line->set_outline_color (UIConfiguration::instance().color ("punch line")); + transport_punchout_line->set_outline_color (UIConfiguration::instance().color ("punch line")); - rubberband_rect->set_outline_color (ARDOUR_UI::config()->color ("rubber band rect")); - rubberband_rect->set_fill_color (ARDOUR_UI::config()->color_mod ("rubber band rect", "selection rect")); + rubberband_rect->set_outline_color (UIConfiguration::instance().color ("rubber band rect")); + rubberband_rect->set_fill_color (UIConfiguration::instance().color_mod ("rubber band rect", "selection rect")); - location_marker_color = ARDOUR_UI::config()->color ("location marker"); - location_range_color = ARDOUR_UI::config()->color ("location range"); - location_cd_marker_color = ARDOUR_UI::config()->color ("location cd marker"); - location_loop_color = ARDOUR_UI::config()->color ("location loop"); - location_punch_color = ARDOUR_UI::config()->color ("location punch"); + location_marker_color = UIConfiguration::instance().color ("location marker"); + location_range_color = UIConfiguration::instance().color ("location range"); + location_cd_marker_color = UIConfiguration::instance().color ("location cd marker"); + location_loop_color = UIConfiguration::instance().color ("location loop"); + location_punch_color = UIConfiguration::instance().color ("location punch"); refresh_location_display (); /* redraw the whole thing */ - _track_canvas->set_background_color (ARDOUR_UI::config()->color ("arrange base")); + _track_canvas->set_background_color (UIConfiguration::instance().color ("arrange base")); _track_canvas->queue_draw (); /* diff --git a/gtk2_ardour/editor_canvas_events.cc b/gtk2_ardour/editor_canvas_events.cc index ea54cb4098..94c2945333 100644 --- a/gtk2_ardour/editor_canvas_events.cc +++ b/gtk2_ardour/editor_canvas_events.cc @@ -37,7 +37,6 @@ #include "editor.h" #include "keyboard.h" #include "public_editor.h" -#include "ardour_ui.h" #include "audio_region_view.h" #include "audio_streamview.h" #include "audio_time_axis.h" @@ -49,6 +48,7 @@ #include "editor_drag.h" #include "midi_time_axis.h" #include "editor_regions.h" +#include "ui_config.h" #include "verbose_cursor.h" #include "i18n.h" @@ -1247,7 +1247,7 @@ Editor::track_canvas_drag_motion (Glib::RefPtr const& context, * TODO: check if file is audio/midi, allow drops on same track-type only, * currently: if audio is dropped on a midi-track, it is only added to the region-list */ - if (Profile->get_sae() || ARDOUR_UI::config()->get_only_copy_imported_files()) { + if (Profile->get_sae() || UIConfiguration::instance().get_only_copy_imported_files()) { context->drag_status(Gdk::ACTION_COPY, time); } else { if ((context->get_actions() & (Gdk::ACTION_COPY | Gdk::ACTION_LINK | Gdk::ACTION_MOVE)) == Gdk::ACTION_COPY) { diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 726a279a7e..ffb6856423 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -64,6 +64,7 @@ #include "mouse_cursors.h" #include "note_base.h" #include "patch_change.h" +#include "ui_config.h" #include "verbose_cursor.h" using namespace std; @@ -3091,7 +3092,7 @@ MeterMarkerDrag::motion (GdkEvent* event, bool first_move) _marker = new MeterMarker ( *_editor, *_editor->meter_group, - ARDOUR_UI::config()->color ("meter marker"), + UIConfiguration::instance().color ("meter marker"), name, *new MeterSection (_marker->meter()) ); @@ -3222,7 +3223,7 @@ TempoMarkerDrag::motion (GdkEvent* event, bool first_move) _marker = new TempoMarker ( *_editor, *_editor->tempo_group, - ARDOUR_UI::config()->color ("tempo marker"), + UIConfiguration::instance().color ("tempo marker"), name, *new TempoSection (_marker->tempo()) ); @@ -4396,7 +4397,7 @@ void RubberbandSelectDrag::start_grab (GdkEvent* event, Gdk::Cursor *) { Drag::start_grab (event); - show_verbose_cursor_time (adjusted_current_frame (event, ARDOUR_UI::config()->get_rubberbanding_snaps_to_grid())); + show_verbose_cursor_time (adjusted_current_frame (event, UIConfiguration::instance().get_rubberbanding_snaps_to_grid())); } void @@ -4407,10 +4408,10 @@ RubberbandSelectDrag::motion (GdkEvent* event, bool) double y1; double y2; - framepos_t const pf = adjusted_current_frame (event, ARDOUR_UI::config()->get_rubberbanding_snaps_to_grid()); + framepos_t const pf = adjusted_current_frame (event, UIConfiguration::instance().get_rubberbanding_snaps_to_grid()); framepos_t grab = grab_frame (); - if (ARDOUR_UI::config()->get_rubberbanding_snaps_to_grid ()) { + if (UIConfiguration::instance().get_rubberbanding_snaps_to_grid ()) { _editor->snap_to_with_modifier (grab, event); } else { grab = raw_grab_frame (); @@ -4487,7 +4488,7 @@ RubberbandSelectDrag::do_select_things (GdkEvent* event, bool drag_in_progress) framepos_t grab = grab_frame (); framepos_t lpf = last_pointer_frame (); - if (!ARDOUR_UI::config()->get_rubberbanding_snaps_to_grid ()) { + if (!UIConfiguration::instance().get_rubberbanding_snaps_to_grid ()) { grab = raw_grab_frame (); lpf = _editor->pixel_to_sample_from_event (last_pointer_x()); } @@ -4954,7 +4955,7 @@ SelectionDrag::finished (GdkEvent* event, bool movement_occurred) if (s->get_play_range() && s->transport_rolling()) { s->request_play_range (&_editor->selection->time, true); } else { - if (ARDOUR_UI::config()->get_follow_edits() && !s->transport_rolling()) { + if (UIConfiguration::instance().get_follow_edits() && !s->transport_rolling()) { if (_operation == SelectionEndTrim) _editor->maybe_locate_with_edit_preroll( _editor->get_selection().time.end_frame()); else @@ -5025,8 +5026,8 @@ RangeMarkerBarDrag::RangeMarkerBarDrag (Editor* e, ArdourCanvas::Item* i, Operat physical_screen_height (_editor->get_window()))); _drag_rect->hide (); - _drag_rect->set_fill_color (ARDOUR_UI::config()->color ("range drag rect")); - _drag_rect->set_outline_color (ARDOUR_UI::config()->color ("range drag rect")); + _drag_rect->set_fill_color (UIConfiguration::instance().color ("range drag rect")); + _drag_rect->set_outline_color (UIConfiguration::instance().color ("range drag rect")); } RangeMarkerBarDrag::~RangeMarkerBarDrag() diff --git a/gtk2_ardour/editor_group_tabs.cc b/gtk2_ardour/editor_group_tabs.cc index aa58ed2f12..a4043b7a19 100644 --- a/gtk2_ardour/editor_group_tabs.cc +++ b/gtk2_ardour/editor_group_tabs.cc @@ -23,13 +23,13 @@ #include "canvas/colors.h" -#include "ardour_ui.h" #include "editor.h" #include "editor_group_tabs.h" #include "editor_route_groups.h" #include "editor_routes.h" #include "rgb_macros.h" #include "route_time_axis.h" +#include "ui_config.h" #include "utils.h" #include "i18n.h" @@ -95,7 +95,7 @@ EditorGroupTabs::draw_tab (cairo_t* cr, Tab const & tab) const if (tab.group && tab.group->is_active()) { ArdourCanvas::color_to_rgba (tab.color, r, g, b, a); } else { - ArdourCanvas::color_to_rgba (ARDOUR_UI::config()->color ("inactive group tab"), r, g, b, a); + ArdourCanvas::color_to_rgba (UIConfiguration::instance().color ("inactive group tab"), r, g, b, a); } a = 1.0; diff --git a/gtk2_ardour/editor_mixer.cc b/gtk2_ardour/editor_mixer.cc index 071dca9793..5871b5709a 100644 --- a/gtk2_ardour/editor_mixer.cc +++ b/gtk2_ardour/editor_mixer.cc @@ -42,6 +42,7 @@ #include "mixer_strip.h" #include "mixer_ui.h" #include "selection.h" +#include "ui_config.h" #include "i18n.h" diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index 5597c5b06e..d4f570b36c 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -1139,7 +1139,7 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp } //not rolling, range mode click + join_play_range : locate the PH here - if ( !_drags->active () && _session && !_session->transport_rolling() && ( effective_mouse_mode() == MouseRange ) && ARDOUR_UI::config()->get_follow_edits() ) { + if ( !_drags->active () && _session && !_session->transport_rolling() && ( effective_mouse_mode() == MouseRange ) && UIConfiguration::instance().get_follow_edits() ) { framepos_t where = canvas_event_sample (event); snap_to(where); _session->request_locate (where, false); @@ -1606,7 +1606,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_ if (mouse_mode == MouseDraw) { ArdourCanvas::Line *line = dynamic_cast (item); if (line) { - line->set_outline_color (ARDOUR_UI::config()->color ("entered gain line")); + line->set_outline_color (UIConfiguration::instance().color ("entered gain line")); } } break; @@ -1615,7 +1615,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_ if (mouse_mode == MouseDraw || mouse_mode == MouseObject) { ArdourCanvas::Line *line = dynamic_cast (item); if (line) { - line->set_outline_color (ARDOUR_UI::config()->color ("entered automation line")); + line->set_outline_color (UIConfiguration::instance().color ("entered automation line")); } } break; @@ -1633,7 +1633,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_ break; } entered_marker = marker; - marker->set_color_rgba (ARDOUR_UI::config()->color ("entered marker")); + marker->set_color_rgba (UIConfiguration::instance().color ("entered marker")); // fall through case MeterMarkerItem: case TempoMarkerItem: @@ -1755,7 +1755,7 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent*, ItemType item_type) { ArdourCanvas::Rectangle *rect = dynamic_cast (item); if (rect) { - rect->set_fill_color (ARDOUR_UI::config()->color ("inactive fade handle")); + rect->set_fill_color (UIConfiguration::instance().color ("inactive fade handle")); } } break; @@ -1766,7 +1766,7 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent*, ItemType item_type) case FeatureLineItem: { ArdourCanvas::Line *line = dynamic_cast (item); - line->set_outline_color (ARDOUR_UI::config()->color ("zero line")); + line->set_outline_color (UIConfiguration::instance().color ("zero line")); } break; @@ -2396,7 +2396,7 @@ Editor::update_join_object_range_location (double y) entered_route_view->canvas_display()->canvas_to_item (cx, cy); double track_height = entered_route_view->view()->child_height(); - if (ARDOUR_UI::config()->get_show_name_highlight()) { + if (UIConfiguration::instance().get_show_name_highlight()) { track_height -= TimeAxisViewItem::NAME_HIGHLIGHT_SIZE; } double const c = cy / track_height; diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 3cdeff7c6d..d536bf94d5 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -61,7 +61,6 @@ #include "canvas/canvas.h" #include "actions.h" -#include "ardour_ui.h" #include "audio_region_view.h" #include "audio_streamview.h" #include "audio_time_axis.h" @@ -98,6 +97,7 @@ #include "time_axis_view.h" #include "transpose_dialog.h" #include "transform_dialog.h" +#include "ui_config.h" #include "i18n.h" @@ -2045,7 +2045,7 @@ Editor::temporal_zoom_to_frame (bool coarser, framepos_t frame) bool Editor::choose_new_marker_name(string &name) { - if (!ARDOUR_UI::config()->get_name_new_markers()) { + if (!UIConfiguration::instance().get_name_new_markers()) { /* don't prompt user for a new name */ return true; } @@ -2537,7 +2537,7 @@ Editor::get_preroll () void Editor::maybe_locate_with_edit_preroll ( framepos_t location ) { - if ( _session->transport_rolling() || !ARDOUR_UI::config()->get_follow_edits() || _ignore_follow_edits ) + if ( _session->transport_rolling() || !UIConfiguration::instance().get_follow_edits() || _ignore_follow_edits ) return; location -= get_preroll(); @@ -6115,7 +6115,7 @@ Editor::set_playhead_cursor () } } - if (ARDOUR_UI::config()->get_follow_edits()) { + if (UIConfiguration::instance().get_follow_edits()) { cancel_time_selection(); } } @@ -7889,7 +7889,7 @@ Editor::unlock () delete _main_menu_disabler; - if (ARDOUR_UI::config()->get_lock_gui_after_seconds()) { + if (UIConfiguration::instance().get_lock_gui_after_seconds()) { start_lock_event_timing (); } } diff --git a/gtk2_ardour/editor_regions.cc b/gtk2_ardour/editor_regions.cc index d029e3fc74..ef6adb844a 100644 --- a/gtk2_ardour/editor_regions.cc +++ b/gtk2_ardour/editor_regions.cc @@ -48,6 +48,7 @@ #include "editor_regions.h" #include "editor_drag.h" #include "main_clock.h" +#include "ui_config.h" #include "i18n.h" @@ -342,14 +343,14 @@ EditorRegions::add_region (boost::shared_ptr region) if (missing_source) { // c.set_rgb(65535,0,0); // FIXME: error color from style - set_color_from_rgba (c, ARDOUR_UI::config()->color ("region list missing source")); + set_color_from_rgba (c, UIConfiguration::instance().color ("region list missing source")); } else if (region->automatic()){ // c.set_rgb(0,65535,0); // FIXME: error color from style - set_color_from_rgba (c, ARDOUR_UI::config()->color ("region list automatic")); + set_color_from_rgba (c, UIConfiguration::instance().color ("region list automatic")); } else { - set_color_from_rgba (c, ARDOUR_UI::config()->color ("region list whole file")); + set_color_from_rgba (c, UIConfiguration::instance().color ("region list whole file")); } row[_columns.color_] = c; @@ -1245,7 +1246,7 @@ EditorRegions::drag_data_received (const RefPtr& context, framepos_t pos = 0; bool copy = ((context->get_actions() & (Gdk::ACTION_COPY | Gdk::ACTION_LINK | Gdk::ACTION_MOVE)) == Gdk::ACTION_COPY); - if (Profile->get_sae() || ARDOUR_UI::config()->get_only_copy_imported_files() || copy) { + if (Profile->get_sae() || UIConfiguration::instance().get_only_copy_imported_files() || copy) { _editor->do_import (paths, Editing::ImportDistinctFiles, Editing::ImportAsRegion, SrcBest, pos); } else { _editor->do_embed (paths, Editing::ImportDistinctFiles, ImportAsRegion, pos); diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc index a5b5a625f4..8afc9b7ac3 100644 --- a/gtk2_ardour/editor_rulers.cc +++ b/gtk2_ardour/editor_rulers.cc @@ -51,6 +51,7 @@ #include "time_axis_view.h" #include "editor_drag.h" #include "editor_cursors.h" +#include "ui_config.h" #include "i18n.h" @@ -123,7 +124,7 @@ Editor::initialize_rulers () { ruler_grabbed_widget = 0; - Pango::FontDescription font (ARDOUR_UI::config()->get_SmallerFont()); + Pango::FontDescription font (UIConfiguration::instance().get_SmallerFont()); _timecode_metric = new TimecodeMetric (this); _bbt_metric = new BBTMetric (this); diff --git a/gtk2_ardour/editor_summary.cc b/gtk2_ardour/editor_summary.cc index b570cf4e1a..129bb1dd05 100644 --- a/gtk2_ardour/editor_summary.cc +++ b/gtk2_ardour/editor_summary.cc @@ -21,7 +21,6 @@ #include "canvas/debug.h" -#include "ardour_ui.h" #include "time_axis_view.h" #include "streamview.h" #include "editor_summary.h" @@ -34,6 +33,7 @@ #include "editor_cursors.h" #include "mouse_cursors.h" #include "route_time_axis.h" +#include "ui_config.h" using namespace std; using namespace ARDOUR; @@ -62,7 +62,7 @@ EditorSummary::EditorSummary (Editor* e) add_events (Gdk::POINTER_MOTION_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK); set_flags (get_flags() | Gtk::CAN_FOCUS); - ARDOUR_UI::config()->ParameterChanged.connect (sigc::mem_fun (*this, &EditorSummary::parameter_changed)); + UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &EditorSummary::parameter_changed)); } EditorSummary::~EditorSummary () @@ -474,7 +474,7 @@ EditorSummary::on_button_press_event (GdkEventButton* ev) bool EditorSummary::suspending_editor_updates () const { - return (!ARDOUR_UI::config()->get_update_editor_during_summary_drag () && (_zoom_dragging || _move_dragging)); + return (!UIConfiguration::instance().get_update_editor_during_summary_drag () && (_zoom_dragging || _move_dragging)); } /** Fill in x and y with the editor's current viewable area in summary coordinates */ diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc index dea576a16c..90c64d2b1b 100644 --- a/gtk2_ardour/editor_tempodisplay.cc +++ b/gtk2_ardour/editor_tempodisplay.cc @@ -48,8 +48,8 @@ #include "rgb_macros.h" #include "gui_thread.h" #include "time_axis_view.h" -#include "ardour_ui.h" #include "tempo_lines.h" +#include "ui_config.h" #include "i18n.h" @@ -85,15 +85,15 @@ Editor::draw_metric_marks (const Metrics& metrics) if ((ms = dynamic_cast(*i)) != 0) { snprintf (buf, sizeof(buf), "%g/%g", ms->divisions_per_bar(), ms->note_divisor ()); - metric_marks.push_back (new MeterMarker (*this, *meter_group, ARDOUR_UI::config()->color ("meter marker"), buf, + metric_marks.push_back (new MeterMarker (*this, *meter_group, UIConfiguration::instance().color ("meter marker"), buf, *(const_cast(ms)))); } else if ((ts = dynamic_cast(*i)) != 0) { - if (ARDOUR_UI::config()->get_allow_non_quarter_pulse()) { + if (UIConfiguration::instance().get_allow_non_quarter_pulse()) { snprintf (buf, sizeof (buf), "%.2f/%.0f", ts->beats_per_minute(), ts->note_type()); } else { snprintf (buf, sizeof (buf), "%.2f", ts->beats_per_minute()); } - metric_marks.push_back (new TempoMarker (*this, *tempo_group, ARDOUR_UI::config()->color ("tempo marker"), buf, + metric_marks.push_back (new TempoMarker (*this, *tempo_group, UIConfiguration::instance().color ("tempo marker"), buf, *(const_cast(ts)))); } diff --git a/gtk2_ardour/gain_meter.cc b/gtk2_ardour/gain_meter.cc index 956b25b6df..8f1f516119 100644 --- a/gtk2_ardour/gain_meter.cc +++ b/gtk2_ardour/gain_meter.cc @@ -43,6 +43,7 @@ #include "utils.h" #include "meter_patterns.h" #include "timers.h" +#include "ui_config.h" #include "ardour/session.h" #include "ardour/route.h" @@ -100,8 +101,8 @@ GainMeterBase::GainMeterBase (Session* s, bool horizontal, int fader_length, int next_release_selects = false; _width = Wide; - fader_length = rint (fader_length * ARDOUR_UI::config()->get_ui_scale()); - fader_girth = rint (fader_girth * ARDOUR_UI::config()->get_ui_scale()); + fader_length = rint (fader_length * UIConfiguration::instance().get_ui_scale()); + fader_girth = rint (fader_girth * UIConfiguration::instance().get_ui_scale()); if (horizontal) { gain_slider = manage (new HSliderController (&gain_adjustment, boost::shared_ptr(), fader_length, fader_girth)); @@ -170,8 +171,8 @@ GainMeterBase::GainMeterBase (Session* s, bool horizontal, int fader_length, int RedrawMetrics.connect (sigc::mem_fun(*this, &GainMeterBase::redraw_metrics)); UI::instance()->theme_changed.connect (sigc::mem_fun(*this, &GainMeterBase::on_theme_changed)); - UIConfiguration::ColorsChanged.connect (sigc::bind(sigc::mem_fun (*this, &GainMeterBase::color_handler), false)); - UIConfiguration::DPIReset.connect (sigc::bind(sigc::mem_fun (*this, &GainMeterBase::color_handler), true)); + UIConfiguration::instance().ColorsChanged.connect (sigc::bind(sigc::mem_fun (*this, &GainMeterBase::color_handler), false)); + UIConfiguration::instance().DPIReset.connect (sigc::bind(sigc::mem_fun (*this, &GainMeterBase::color_handler), true)); } GainMeterBase::~GainMeterBase () @@ -900,7 +901,7 @@ GainMeterBase::update_meters() peak_display.set_text (buf); } } - if (mpeak >= ARDOUR_UI::config()->get_meter_peak()) { + if (mpeak >= UIConfiguration::instance().get_meter_peak()) { peak_display.set_name ("MixerStripPeakDisplayPeak"); } } @@ -935,7 +936,7 @@ GainMeterBase::redraw_metrics() meter_ticks2_area.queue_draw (); } -#define PX_SCALE(pxmin, dflt) rint(std::max((double)pxmin, (double)dflt * ARDOUR_UI::config()->get_ui_scale())) +#define PX_SCALE(pxmin, dflt) rint(std::max((double)pxmin, (double)dflt * UIConfiguration::instance().get_ui_scale())) GainMeter::GainMeter (Session* s, int fader_length) : GainMeterBase (s, false, fader_length, 24) diff --git a/gtk2_ardour/generic_pluginui.cc b/gtk2_ardour/generic_pluginui.cc index 69a8f0b2a5..8abefa7fc8 100644 --- a/gtk2_ardour/generic_pluginui.cc +++ b/gtk2_ardour/generic_pluginui.cc @@ -49,6 +49,7 @@ #include "gui_thread.h" #include "automation_controller.h" #include "timers.h" +#include "ui_config.h" #include "i18n.h" @@ -763,8 +764,8 @@ GenericPluginUI::build_control_ui (const Evoral::Parameter& param, 0xcccc00ff, 0xcccc00ff, 0xffaa00ff, 0xffaa00ff, 0xff0000ff, - ARDOUR_UI::config()->color ("meter background bottom"), - ARDOUR_UI::config()->color ("meter background top") + UIConfiguration::instance().color ("meter background bottom"), + UIConfiguration::instance().color ("meter background top") ); info->min_unbound = desc.min_unbound; diff --git a/gtk2_ardour/ghostregion.cc b/gtk2_ardour/ghostregion.cc index 6f4b56eed9..7c697a1b0f 100644 --- a/gtk2_ardour/ghostregion.cc +++ b/gtk2_ardour/ghostregion.cc @@ -17,6 +17,8 @@ */ +#include "ardour/parameter_descriptor.h" + #include "evoral/Note.hpp" #include "canvas/container.h" #include "canvas/polygon.h" @@ -24,7 +26,6 @@ #include "canvas/wave_view.h" #include "canvas/debug.h" -#include "ardour_ui.h" #include "automation_time_axis.h" #include "ghostregion.h" #include "midi_streamview.h" @@ -32,6 +33,7 @@ #include "rgb_macros.h" #include "note.h" #include "hit.h" +#include "ui_config.h" using namespace std; using namespace Editing; @@ -89,7 +91,7 @@ void GhostRegion::set_colors () { if (is_automation_ghost()) { - base_rect->set_fill_color (ARDOUR_UI::config()->color_mod ("ghost track base", "ghost track base")); + base_rect->set_fill_color (UIConfiguration::instance().color_mod ("ghost track base", "ghost track base")); } } @@ -143,17 +145,17 @@ AudioGhostRegion::set_colors () guint fill_color; if (is_automation_ghost()) { - fill_color = ARDOUR_UI::config()->color ("ghost track wave fill"); + fill_color = UIConfiguration::instance().color ("ghost track wave fill"); } else { fill_color = source_track_color(200); } for (uint32_t n=0; n < waves.size(); ++n) { - waves[n]->set_outline_color (ARDOUR_UI::config()->color ("ghost track wave")); + waves[n]->set_outline_color (UIConfiguration::instance().color ("ghost track wave")); waves[n]->set_fill_color (fill_color); - waves[n]->set_clip_color (ARDOUR_UI::config()->color ("ghost track wave clip")); - waves[n]->set_zero_color (ARDOUR_UI::config()->color ("ghost track zero line")); + waves[n]->set_clip_color (UIConfiguration::instance().color ("ghost track wave clip")); + waves[n]->set_zero_color (UIConfiguration::instance().color ("ghost track zero line")); } } @@ -245,8 +247,8 @@ MidiGhostRegion::set_colors() GhostRegion::set_colors(); for (EventList::iterator it = events.begin(); it != events.end(); ++it) { - (*it)->item->set_fill_color (ARDOUR_UI::config()->color_mod((*it)->event->base_color(), "ghost track midi fill")); - (*it)->item->set_outline_color (ARDOUR_UI::config()->color ("ghost track midi outline")); + (*it)->item->set_fill_color (UIConfiguration::instance().color_mod((*it)->event->base_color(), "ghost track midi fill")); + (*it)->item->set_outline_color (UIConfiguration::instance().color ("ghost track midi outline")); } } @@ -309,8 +311,8 @@ MidiGhostRegion::add_note (NoteBase* n) GhostEvent* event = new GhostEvent (n, group); events.push_back (event); - event->item->set_fill_color (ARDOUR_UI::config()->color_mod(n->base_color(), "ghost track midi fill")); - event->item->set_outline_color (ARDOUR_UI::config()->color ("ghost track midi outline")); + event->item->set_fill_color (UIConfiguration::instance().color_mod(n->base_color(), "ghost track midi fill")); + event->item->set_outline_color (UIConfiguration::instance().color ("ghost track midi outline")); MidiStreamView* mv = midi_view(); diff --git a/gtk2_ardour/group_tabs.cc b/gtk2_ardour/group_tabs.cc index cf4e758cd7..0f6ddd852a 100644 --- a/gtk2_ardour/group_tabs.cc +++ b/gtk2_ardour/group_tabs.cc @@ -45,7 +45,7 @@ GroupTabs::GroupTabs () , _dragging_new_tab (0) { add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::POINTER_MOTION_MASK); - UIConfiguration::ColorsChanged.connect (sigc::mem_fun (*this, &GroupTabs::queue_draw)); + UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &GroupTabs::queue_draw)); } GroupTabs::~GroupTabs () diff --git a/gtk2_ardour/level_meter.cc b/gtk2_ardour/level_meter.cc index 4b06675d46..81ec474f61 100644 --- a/gtk2_ardour/level_meter.cc +++ b/gtk2_ardour/level_meter.cc @@ -24,13 +24,13 @@ #include #include "pbd/fastlog.h" -#include "ardour_ui.h" #include "level_meter.h" #include "utils.h" #include "logmeter.h" #include "gui_thread.h" #include "keyboard.h" #include "public_editor.h" +#include "ui_config.h" #include "i18n.h" @@ -57,8 +57,8 @@ LevelMeterBase::LevelMeterBase (Session* s, PBD::EventLoop::InvalidationRecord* set_session (s); Config->ParameterChanged.connect (_parameter_connection, parent_invalidator, boost::bind (&LevelMeterBase::parameter_changed, this, _1), gui_context()); - ARDOUR_UI::config()->ParameterChanged.connect (sigc::mem_fun(*this, &LevelMeterBase::parameter_changed)); - UIConfiguration::ColorsChanged.connect (sigc::mem_fun (*this, &LevelMeterBase::color_handler)); + UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun(*this, &LevelMeterBase::parameter_changed)); + UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &LevelMeterBase::color_handler)); } LevelMeterBase::~LevelMeterBase () @@ -104,12 +104,12 @@ static float meter_lineup_cfg(MeterLineUp lul, float offset) { } static float meter_lineup(float offset) { - return meter_lineup_cfg (ARDOUR_UI::config()->get_meter_line_up_level(), offset); + return meter_lineup_cfg (UIConfiguration::instance().get_meter_line_up_level(), offset); } static float vu_standard() { // note - default meter config is +2dB (france) - switch (ARDOUR_UI::config()->get_meter_vu_standard()) { + switch (UIConfiguration::instance().get_meter_vu_standard()) { default: case MeteringVUfrench: // 0VU = -2dBu return 0; @@ -139,7 +139,7 @@ LevelMeterBase::update_meters () const float mpeak = _meter->meter_level(n, MeterMaxPeak); if (mpeak > (*i).max_peak) { (*i).max_peak = mpeak; - (*i).meter->set_highlight(mpeak >= ARDOUR_UI::config()->get_meter_peak()); + (*i).meter->set_highlight(mpeak >= UIConfiguration::instance().get_meter_peak()); } if (mpeak > max_peak) { max_peak = mpeak; @@ -156,7 +156,7 @@ LevelMeterBase::update_meters () } else if (meter_type == MeterIEC1NOR) { (*i).meter->set (meter_deflect_nordic (peak + meter_lineup(0))); } else if (meter_type == MeterIEC1DIN) { - (*i).meter->set (meter_deflect_din (peak + meter_lineup_cfg(ARDOUR_UI::config()->get_meter_line_up_din(), 3.0))); + (*i).meter->set (meter_deflect_din (peak + meter_lineup_cfg(UIConfiguration::instance().get_meter_line_up_din(), 3.0))); } else if (meter_type == MeterIEC2BBC || meter_type == MeterIEC2EBU) { (*i).meter->set (meter_deflect_ppm (peak + meter_lineup(0))); } else if (meter_type == MeterVU) { @@ -186,7 +186,7 @@ LevelMeterBase::parameter_changed (string p) uint32_t n; for (n = 0, i = meters.begin(); i != meters.end(); ++i, ++n) { - (*i).meter->set_hold_count ((uint32_t) floor(ARDOUR_UI::config()->get_meter_hold())); + (*i).meter->set_hold_count ((uint32_t) floor(UIConfiguration::instance().get_meter_hold())); } } else if (p == "meter-line-up-level") { @@ -260,7 +260,7 @@ LevelMeterBase::setup_meters (int len, int initial_width, int thin_width) width = thin_meter_width; } - width = rint (width * ARDOUR_UI::config()->get_ui_scale()); + width = rint (width * UIConfiguration::instance().get_ui_scale()); if ( meters.size() > 0 && nmeters == visible_meter_count @@ -293,37 +293,37 @@ LevelMeterBase::setup_meters (int len, int initial_width, int thin_width) uint32_t c[10]; uint32_t b[4]; float stp[4]; - int styleflags = ARDOUR_UI::config()->get_meter_style_led() ? 3 : 1; - b[0] = ARDOUR_UI::config()->color ("meter background bottom"); - b[1] = ARDOUR_UI::config()->color ("meter background top"); + int styleflags = UIConfiguration::instance().get_meter_style_led() ? 3 : 1; + b[0] = UIConfiguration::instance().color ("meter background bottom"); + b[1] = UIConfiguration::instance().color ("meter background top"); b[2] = 0x991122ff; // red highlight gradient Bot b[3] = 0x551111ff; // red highlight gradient Top if (n < nmidi) { - c[0] = ARDOUR_UI::config()->color ("midi meter color0"); - c[1] = ARDOUR_UI::config()->color ("midi meter color1"); - c[2] = ARDOUR_UI::config()->color ("midi meter color2"); - c[3] = ARDOUR_UI::config()->color ("midi meter color3"); - c[4] = ARDOUR_UI::config()->color ("midi meter color4"); - c[5] = ARDOUR_UI::config()->color ("midi meter color5"); - c[6] = ARDOUR_UI::config()->color ("midi meter color6"); - c[7] = ARDOUR_UI::config()->color ("midi meter color7"); - c[8] = ARDOUR_UI::config()->color ("midi meter color8"); - c[9] = ARDOUR_UI::config()->color ("midi meter color9"); + c[0] = UIConfiguration::instance().color ("midi meter color0"); + c[1] = UIConfiguration::instance().color ("midi meter color1"); + c[2] = UIConfiguration::instance().color ("midi meter color2"); + c[3] = UIConfiguration::instance().color ("midi meter color3"); + c[4] = UIConfiguration::instance().color ("midi meter color4"); + c[5] = UIConfiguration::instance().color ("midi meter color5"); + c[6] = UIConfiguration::instance().color ("midi meter color6"); + c[7] = UIConfiguration::instance().color ("midi meter color7"); + c[8] = UIConfiguration::instance().color ("midi meter color8"); + c[9] = UIConfiguration::instance().color ("midi meter color9"); stp[0] = 115.0 * 32.0 / 128.0; stp[1] = 115.0 * 64.0 / 128.0; stp[2] = 115.0 * 100.0 / 128.0; stp[3] = 115.0 * 112.0 / 128.0; } else { - c[0] = ARDOUR_UI::config()->color ("meter color0"); - c[1] = ARDOUR_UI::config()->color ("meter color1"); - c[2] = ARDOUR_UI::config()->color ("meter color2"); - c[3] = ARDOUR_UI::config()->color ("meter color3"); - c[4] = ARDOUR_UI::config()->color ("meter color4"); - c[5] = ARDOUR_UI::config()->color ("meter color5"); - c[6] = ARDOUR_UI::config()->color ("meter color6"); - c[7] = ARDOUR_UI::config()->color ("meter color7"); - c[8] = ARDOUR_UI::config()->color ("meter color8"); - c[9] = ARDOUR_UI::config()->color ("meter color9"); + c[0] = UIConfiguration::instance().color ("meter color0"); + c[1] = UIConfiguration::instance().color ("meter color1"); + c[2] = UIConfiguration::instance().color ("meter color2"); + c[3] = UIConfiguration::instance().color ("meter color3"); + c[4] = UIConfiguration::instance().color ("meter color4"); + c[5] = UIConfiguration::instance().color ("meter color5"); + c[6] = UIConfiguration::instance().color ("meter color6"); + c[7] = UIConfiguration::instance().color ("meter color7"); + c[8] = UIConfiguration::instance().color ("meter color8"); + c[9] = UIConfiguration::instance().color ("meter color9"); switch (meter_type) { case MeterK20: @@ -361,7 +361,7 @@ LevelMeterBase::setup_meters (int len, int initial_width, int thin_width) break; case MeterIEC2BBC: c[0] = c[1] = c[2] = c[3] = c[4] = c[5] = c[6] = c[7] = c[8] = c[9] = - ARDOUR_UI::config()->color ("meter color BBC"); + UIConfiguration::instance().color ("meter color BBC"); stp[0] = stp[1] = stp[2] = stp[3] = 115.0; break; case MeterIEC2EBU: @@ -401,7 +401,7 @@ LevelMeterBase::setup_meters (int len, int initial_width, int thin_width) stp[1] = 89.125; // 115.0 * log_meter0dB(-9); stp[2] = 106.375; // 115.0 * log_meter0dB(-3); stp[3] = 115.0; // 115.0 * log_meter0dB(0); - switch (ARDOUR_UI::config()->get_meter_line_up_level()) { + switch (UIConfiguration::instance().get_meter_line_up_level()) { case MeteringLineUp24: stp[0] = 115.0 * log_meter0dB(-24); break; @@ -420,7 +420,7 @@ LevelMeterBase::setup_meters (int len, int initial_width, int thin_width) stp[1] = 77.5; // 115 * log_meter(-9) stp[2] = 92.5; // 115 * log_meter(-3) stp[3] = 100.0; // 115 * log_meter(0) - switch (ARDOUR_UI::config()->get_meter_line_up_level()) { + switch (UIConfiguration::instance().get_meter_line_up_level()) { case MeteringLineUp24: stp[0] = 42.0; break; @@ -441,7 +441,7 @@ LevelMeterBase::setup_meters (int len, int initial_width, int thin_width) bool hl = meters[n].meter ? meters[n].meter->get_highlight() : false; meters[n].packed = false; delete meters[n].meter; - meters[n].meter = new FastMeter ((uint32_t) floor (ARDOUR_UI::config()->get_meter_hold()), width, _meter_orientation, len, + meters[n].meter = new FastMeter ((uint32_t) floor (UIConfiguration::instance().get_meter_hold()), width, _meter_orientation, len, c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], b[0], b[1], b[2], b[3], diff --git a/gtk2_ardour/location_ui.cc b/gtk2_ardour/location_ui.cc index f56006e5ce..832dfee4ab 100644 --- a/gtk2_ardour/location_ui.cc +++ b/gtk2_ardour/location_ui.cc @@ -34,6 +34,7 @@ #include "prompter.h" #include "utils.h" #include "public_editor.h" +#include "ui_config.h" #include "i18n.h" @@ -1017,7 +1018,7 @@ LocationUI::add_new_location() framepos_t where = _session->audible_frame(); _session->locations()->next_available_name(markername,"mark"); Location *location = new Location (*_session, where, where, markername, Location::IsMark); - if (ARDOUR_UI::config()->get_name_new_markers()) { + if (UIConfiguration::instance().get_name_new_markers()) { newest_location = location; } PublicEditor::instance().begin_reversible_command (_("add marker")); diff --git a/gtk2_ardour/logmeter.h b/gtk2_ardour/logmeter.h index ff0520a63b..9ff60db0c5 100644 --- a/gtk2_ardour/logmeter.h +++ b/gtk2_ardour/logmeter.h @@ -20,6 +20,8 @@ #ifndef __ardour_gtk_log_meter_h__ #define __ardour_gtk_log_meter_h__ +#include "ardour/dB.h" + #if 1 static inline float _log_meter (float power, double lower_db, double upper_db, double non_linearity) diff --git a/gtk2_ardour/main.cc b/gtk2_ardour/main.cc index 441b2dc929..ad16ae148c 100644 --- a/gtk2_ardour/main.cc +++ b/gtk2_ardour/main.cc @@ -367,15 +367,13 @@ int main (int argc, char *argv[]) } #endif - UIConfiguration* ui_config = new UIConfiguration; - - if (ui_config->pre_gui_init ()) { + if (UIConfiguration::instance().pre_gui_init ()) { error << _("Could not complete pre-GUI initialization") << endmsg; exit (1); } try { - ui = new ARDOUR_UI (&argc, &argv, localedir.c_str(), ui_config); + ui = new ARDOUR_UI (&argc, &argv, localedir.c_str()); } catch (failed_constructor& err) { error << string_compose (_("could not create %1 GUI"), PROGRAM_NAME) << endmsg; exit (1); diff --git a/gtk2_ardour/main_clock.cc b/gtk2_ardour/main_clock.cc index c7cb4102a8..1f217ef8a3 100644 --- a/gtk2_ardour/main_clock.cc +++ b/gtk2_ardour/main_clock.cc @@ -17,10 +17,11 @@ */ -#include "ardour_ui.h" #include "main_clock.h" #include "public_editor.h" +#include "ui_config.h" + #include "i18n.h" #include "ardour/tempo.h" @@ -50,13 +51,13 @@ MainClock::build_ops_menu () ops_items.push_back (CheckMenuElem (_("Display delta to edit cursor"), sigc::mem_fun (*this, &MainClock::display_delta_to_edit_cursor))); Gtk::CheckMenuItem* c = dynamic_cast (&ops_items.back()); if (_primary) { - if (ARDOUR_UI::config()->get_primary_clock_delta_edit_cursor ()) { - ARDOUR_UI::config()->set_primary_clock_delta_edit_cursor (false); + if (UIConfiguration::instance().get_primary_clock_delta_edit_cursor ()) { + UIConfiguration::instance().set_primary_clock_delta_edit_cursor (false); c->set_active (true); } } else { - if (ARDOUR_UI::config()->get_secondary_clock_delta_edit_cursor ()) { - ARDOUR_UI::config()->set_secondary_clock_delta_edit_cursor (false); + if (UIConfiguration::instance().get_secondary_clock_delta_edit_cursor ()) { + UIConfiguration::instance().set_secondary_clock_delta_edit_cursor (false); c->set_active (true); } } @@ -83,9 +84,9 @@ void MainClock::display_delta_to_edit_cursor () { if (_primary) { - ARDOUR_UI::config()->set_primary_clock_delta_edit_cursor (!ARDOUR_UI::config()->get_primary_clock_delta_edit_cursor ()); + UIConfiguration::instance().set_primary_clock_delta_edit_cursor (!UIConfiguration::instance().get_primary_clock_delta_edit_cursor ()); } else { - ARDOUR_UI::config()->set_secondary_clock_delta_edit_cursor (!ARDOUR_UI::config()->get_secondary_clock_delta_edit_cursor ()); + UIConfiguration::instance().set_secondary_clock_delta_edit_cursor (!UIConfiguration::instance().get_secondary_clock_delta_edit_cursor ()); } } diff --git a/gtk2_ardour/marker.cc b/gtk2_ardour/marker.cc index 49b4f2c1b0..30be8fd786 100644 --- a/gtk2_ardour/marker.cc +++ b/gtk2_ardour/marker.cc @@ -29,11 +29,15 @@ #include "canvas/scroll_group.h" #include "canvas/debug.h" -#include "ardour_ui.h" +#include "ui_config.h" /* * ardour_ui.h include was moved to the top of the list * due to a conflicting definition of 'Rect' between * Apple's MacTypes.h and GTK. + * + * Now that we are including ui_config.h and not ardour_ui.h + * the above comment may no longer apply and this comment + * can be removed and ui_config.h inclusion moved. */ #include "marker.h" @@ -77,8 +81,8 @@ ArdourMarker::ArdourMarker (PublicEditor& ed, ArdourCanvas::Container& parent, g { const double MH = marker_height - 1; - const double M3 = std::max(1.f, rintf(3.f * ARDOUR_UI::config()->get_ui_scale())); - const double M6 = std::max(2.f, rintf(6.f * ARDOUR_UI::config()->get_ui_scale())); + const double M3 = std::max(1.f, rintf(3.f * UIConfiguration::instance().get_ui_scale())); + const double M6 = std::max(2.f, rintf(6.f * UIConfiguration::instance().get_ui_scale())); /* Shapes we use: * @@ -342,7 +346,7 @@ ArdourMarker::setup_line () if (_track_canvas_line == 0) { _track_canvas_line = new ArdourCanvas::Line (editor.get_hscroll_group()); - _track_canvas_line->set_outline_color (ARDOUR_UI::config()->color ("edit point")); + _track_canvas_line->set_outline_color (UIConfiguration::instance().color ("edit point")); _track_canvas_line->Event.connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_marker_event), group, this)); } @@ -353,7 +357,7 @@ ArdourMarker::setup_line () _track_canvas_line->set_x1 (d.x); _track_canvas_line->set_y0 (d.y); _track_canvas_line->set_y1 (ArdourCanvas::COORD_MAX); - _track_canvas_line->set_outline_color (_selected ? ARDOUR_UI::config()->color ("edit point") : _color); + _track_canvas_line->set_outline_color (_selected ? UIConfiguration::instance().color ("edit point") : _color); _track_canvas_line->raise_to_top (); _track_canvas_line->show (); @@ -403,7 +407,7 @@ ArdourMarker::setup_name_display () limit = _right_label_limit; } - const float padding = std::max(2.f, rintf(2.f * ARDOUR_UI::config()->get_ui_scale())); + const float padding = std::max(2.f, rintf(2.f * UIConfiguration::instance().get_ui_scale())); /* Work out how wide the name can be */ int name_width = min ((double) pixel_width (_name, name_font) + padding, limit); diff --git a/gtk2_ardour/meter_patterns.cc b/gtk2_ardour/meter_patterns.cc index 4cf184987a..1b582a96b0 100644 --- a/gtk2_ardour/meter_patterns.cc +++ b/gtk2_ardour/meter_patterns.cc @@ -17,16 +17,18 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include + #include #include #include #include #include -#include "ardour_ui.h" #include "utils.h" #include "logmeter.h" #include "meter_patterns.h" +#include "ui_config.h" #include "i18n.h" @@ -245,18 +247,18 @@ static void set_bg_color (Gtk::Widget& w, cairo_t* cr, MeterType type) { double r,g,b,a; switch(type) { case MeterVU: - ArdourCanvas::color_to_rgba (ARDOUR_UI::config()->color ("meterstrip vu bg"), r, g, b, a); + ArdourCanvas::color_to_rgba (UIConfiguration::instance().color ("meterstrip vu bg"), r, g, b, a); break; case MeterIEC1DIN: case MeterIEC1NOR: case MeterIEC2BBC: case MeterIEC2EBU: - ArdourCanvas::color_to_rgba (ARDOUR_UI::config()->color ("meterstrip ppm bg"), r, g, b, a); + ArdourCanvas::color_to_rgba (UIConfiguration::instance().color ("meterstrip ppm bg"), r, g, b, a); break; case MeterK12: case MeterK14: case MeterK20: - ArdourCanvas::color_to_rgba (ARDOUR_UI::config()->color ("meterstrip dpm bg"), r, g, b, a); + ArdourCanvas::color_to_rgba (UIConfiguration::instance().color ("meterstrip dpm bg"), r, g, b, a); break; default: { @@ -274,16 +276,16 @@ static void set_fg_color(Gtk::Widget&, MeterType type, Gdk::Color * c) { double r,g,b,a; switch(type) { case MeterVU: - ArdourCanvas::color_to_rgba (ARDOUR_UI::config()->color ("meterstrip vu fg"), r, g, b, a); + ArdourCanvas::color_to_rgba (UIConfiguration::instance().color ("meterstrip vu fg"), r, g, b, a); break; case MeterIEC1DIN: case MeterIEC1NOR: case MeterIEC2BBC: case MeterIEC2EBU: - ArdourCanvas::color_to_rgba (ARDOUR_UI::config()->color ("meterstrip ppm fg"), r, g, b, a); + ArdourCanvas::color_to_rgba (UIConfiguration::instance().color ("meterstrip ppm fg"), r, g, b, a); break; default: - ArdourCanvas::color_to_rgba (ARDOUR_UI::config()->color ("meterstrip dpm fg"), r, g, b, a); + ArdourCanvas::color_to_rgba (UIConfiguration::instance().color ("meterstrip dpm fg"), r, g, b, a); break; } c->set_rgb_p (r, g, b); @@ -304,7 +306,7 @@ meter_render_ticks (Gtk::Widget& w, MeterType type, vector typ float box_l=0; float box_w=0; -#define PX_SCALE(pxmin, dflt) rint(std::max((double)pxmin, (double)dflt * ARDOUR_UI::config()->get_ui_scale())) +#define PX_SCALE(pxmin, dflt) rint(std::max((double)pxmin, (double)dflt * UIConfiguration::instance().get_ui_scale())) if (tickleft) { if (w.get_name().substr(0, 3) == "Bar") { box_w = PX_SCALE(2, 2); @@ -343,7 +345,7 @@ meter_render_ticks (Gtk::Widget& w, MeterType type, vector typ cairo_fill (cr); height = min(max_pattern_metric_size, height); - uint32_t peakcolor = ARDOUR_UI::config()->color ("meterbridge peaklabel"); + uint32_t peakcolor = UIConfiguration::instance().color ("meterbridge peaklabel"); for (vector::const_iterator i = types.begin(); i != types.end(); ++i) { @@ -518,7 +520,7 @@ meter_render_ticks (Gtk::Widget& w, MeterType type, vector typ points.insert (std::pair(-50, 1.0)); points.insert (std::pair(-40, 1.0)); points.insert (std::pair(-30, 1.0)); - if (ARDOUR_UI::config()->get_meter_line_up_level() == MeteringLineUp24) { + if (UIConfiguration::instance().get_meter_line_up_level() == MeteringLineUp24) { points.insert (std::pair(-24, 1.0)); } else { points.insert (std::pair(-25, 1.0)); @@ -636,12 +638,12 @@ meter_render_metrics (Gtk::Widget& w, MeterType type, vector types) Pango::AttrFontDesc* font_attr; Pango::FontDescription font; - font = Pango::FontDescription (ARDOUR_UI::config()->get_SmallMonospaceFont()); + font = Pango::FontDescription (UIConfiguration::instance().get_SmallMonospaceFont()); #ifdef __APPLE__ const double fixfontsize = 1.0; #else // counter-act global font-scaling. - const double fixfontsize = std::min(1.0, 0.9 / sqrtf(ARDOUR_UI::config()->get_ui_scale())); + const double fixfontsize = std::min(1.0, 0.9 / sqrtf(UIConfiguration::instance().get_ui_scale())); #endif font.set_weight (Pango::WEIGHT_NORMAL); @@ -677,7 +679,7 @@ meter_render_metrics (Gtk::Widget& w, MeterType type, vector types) cairo_set_line_width (cr, 1.0); height = min(max_pattern_metric_size, height); - uint32_t peakcolor = ARDOUR_UI::config()->color ("meterbridge peaklabel"); + uint32_t peakcolor = UIConfiguration::instance().color ("meterbridge peaklabel"); Gdk::Color c; // default text color for (vector::const_iterator i = types.begin(); i != types.end(); ++i) { @@ -758,7 +760,7 @@ meter_render_metrics (Gtk::Widget& w, MeterType type, vector types) points.insert (std::pair(-30.0f, "-30")); points.insert (std::pair(-20.0f, "-20")); if (types.size() == 1) { - if (ARDOUR_UI::config()->get_meter_line_up_level() == MeteringLineUp24) { + if (UIConfiguration::instance().get_meter_line_up_level() == MeteringLineUp24) { points.insert (std::pair(-24.0f, "-24")); } else { points.insert (std::pair(-25.0f, "-25")); diff --git a/gtk2_ardour/meter_patterns.h b/gtk2_ardour/meter_patterns.h index f505ba37c7..a0685bb50d 100644 --- a/gtk2_ardour/meter_patterns.h +++ b/gtk2_ardour/meter_patterns.h @@ -28,6 +28,11 @@ #include +namespace ARDOUR { + class Route; + class RouteGroup; +} + namespace ArdourMeter { extern sigc::signal ResetAllPeakDisplays; diff --git a/gtk2_ardour/meter_strip.cc b/gtk2_ardour/meter_strip.cc index 3279bd64e1..b1199811ef 100644 --- a/gtk2_ardour/meter_strip.cc +++ b/gtk2_ardour/meter_strip.cc @@ -38,6 +38,7 @@ #include "logmeter.h" #include "gui_thread.h" #include "ardour_window.h" +#include "ui_config.h" #include "utils.h" #include "meterbridge.h" @@ -58,7 +59,7 @@ PBD::Signal1 MeterStrip::CatchDeletion; PBD::Signal0 MeterStrip::MetricChanged; PBD::Signal0 MeterStrip::ConfigurationChanged; -#define PX_SCALE(pxmin, dflt) rint(std::max((double)pxmin, (double)dflt * ARDOUR_UI::config()->get_ui_scale())) +#define PX_SCALE(pxmin, dflt) rint(std::max((double)pxmin, (double)dflt * UIConfiguration::instance().get_ui_scale())) MeterStrip::MeterStrip (int metricmode, MeterType mt) : AxisView(0) @@ -111,8 +112,8 @@ MeterStrip::MeterStrip (int metricmode, MeterType mt) nfo_vbox.show(); UI::instance()->theme_changed.connect (sigc::mem_fun(*this, &MeterStrip::on_theme_changed)); - UIConfiguration::ColorsChanged.connect (sigc::mem_fun (*this, &MeterStrip::on_theme_changed)); - UIConfiguration::DPIReset.connect (sigc::mem_fun (*this, &MeterStrip::on_theme_changed)); + UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &MeterStrip::on_theme_changed)); + UIConfiguration::instance().DPIReset.connect (sigc::mem_fun (*this, &MeterStrip::on_theme_changed)); } MeterStrip::MeterStrip (Session* sess, boost::shared_ptr rt) @@ -299,8 +300,8 @@ MeterStrip::MeterStrip (Session* sess, boost::shared_ptr rt) name_label.signal_button_release_event().connect (sigc::mem_fun(*this, &MeterStrip::name_label_button_release), false); UI::instance()->theme_changed.connect (sigc::mem_fun(*this, &MeterStrip::on_theme_changed)); - UIConfiguration::ColorsChanged.connect (sigc::mem_fun (*this, &MeterStrip::on_theme_changed)); - UIConfiguration::DPIReset.connect (sigc::mem_fun (*this, &MeterStrip::on_theme_changed)); + UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &MeterStrip::on_theme_changed)); + UIConfiguration::instance().DPIReset.connect (sigc::mem_fun (*this, &MeterStrip::on_theme_changed)); Config->ParameterChanged.connect (*this, invalidator (*this), ui_bind (&MeterStrip::parameter_changed, this, _1), gui_context()); sess->config.ParameterChanged.connect (*this, invalidator (*this), ui_bind (&MeterStrip::parameter_changed, this, _1), gui_context()); @@ -414,7 +415,7 @@ MeterStrip::fast_update () float mpeak = level_meter->update_meters(); if (mpeak > max_peak) { max_peak = mpeak; - if (mpeak >= ARDOUR_UI::config()->get_meter_peak()) { + if (mpeak >= UIConfiguration::instance().get_meter_peak()) { peak_display.set_active_state ( Gtkmm2ext::ExplicitActive ); } } @@ -544,8 +545,8 @@ MeterStrip::on_size_allocate (Gtk::Allocation& a) tnh = 4 + std::max(2u, _session->track_number_decimals()) * 8; // TODO 8 = max_with_of_digit_0_to_9() } - nh *= ARDOUR_UI::config()->get_ui_scale(); - tnh *= ARDOUR_UI::config()->get_ui_scale(); + nh *= UIConfiguration::instance().get_ui_scale(); + tnh *= UIConfiguration::instance().get_ui_scale(); int prev_height, ignored; bool need_relayout = false; @@ -810,7 +811,7 @@ MeterStrip::name_changed () { } const int tnh = 4 + std::max(2u, _session->track_number_decimals()) * 8; // TODO 8 = max_width_of_digit_0_to_9() // NB numbers are rotated 90deg. on the meterbridge -> use height - number_label.set_size_request(PX_SCALE(18, 18), tnh * ARDOUR_UI::config()->get_ui_scale()); + number_label.set_size_request(PX_SCALE(18, 18), tnh * UIConfiguration::instance().get_ui_scale()); } else { number_label.hide(); } diff --git a/gtk2_ardour/meterbridge.cc b/gtk2_ardour/meterbridge.cc index bdbee7f830..1a320fa6c2 100644 --- a/gtk2_ardour/meterbridge.cc +++ b/gtk2_ardour/meterbridge.cc @@ -173,8 +173,8 @@ Meterbridge::Meterbridge () viewport->set_border_width(0); UI::instance()->theme_changed.connect (sigc::mem_fun(*this, &Meterbridge::on_theme_changed)); - UIConfiguration::ColorsChanged.connect (sigc::mem_fun (*this, &Meterbridge::on_theme_changed)); - UIConfiguration::DPIReset.connect (sigc::mem_fun (*this, &Meterbridge::on_theme_changed)); + UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &Meterbridge::on_theme_changed)); + UIConfiguration::instance().DPIReset.connect (sigc::mem_fun (*this, &Meterbridge::on_theme_changed)); } Meterbridge::~Meterbridge () diff --git a/gtk2_ardour/midi_list_editor.cc b/gtk2_ardour/midi_list_editor.cc index 047dcf27a7..9fa1e0881a 100644 --- a/gtk2_ardour/midi_list_editor.cc +++ b/gtk2_ardour/midi_list_editor.cc @@ -35,9 +35,9 @@ #include "gtkmm2ext/keyboard.h" #include "gtkmm2ext/actions.h" -#include "ardour_ui.h" #include "midi_list_editor.h" #include "note_player.h" +#include "ui_config.h" #include "i18n.h" @@ -798,7 +798,7 @@ MidiListEditor::redisplay_model () void MidiListEditor::selection_changed () { - if (!ARDOUR_UI::config()->get_sound_midi_notes()) { + if (!UIConfiguration::instance().get_sound_midi_notes()) { return; } diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 67be181937..ec7548dc62 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -76,11 +76,11 @@ #include "streamview.h" #include "patch_change_dialog.h" #include "verbose_cursor.h" -#include "ardour_ui.h" #include "note.h" #include "hit.h" #include "patch_change.h" #include "sys_ex.h" +#include "ui_config.h" #include "i18n.h" @@ -1298,7 +1298,7 @@ MidiRegionView::display_sysexes() bool have_periodic_system_messages = false; bool display_periodic_messages = true; - if (!ARDOUR_UI::config()->get_never_display_periodic_midi()) { + if (!UIConfiguration::instance().get_never_display_periodic_midi()) { for (MidiModel::SysExes::const_iterator i = _model->sysexes().begin(); i != _model->sysexes().end(); ++i) { const boost::shared_ptr > mev = @@ -1629,7 +1629,7 @@ MidiRegionView::extend_active_notes() void MidiRegionView::play_midi_note(boost::shared_ptr note) { - if (_no_sound_notes || !ARDOUR_UI::config()->get_sound_midi_notes()) { + if (_no_sound_notes || !UIConfiguration::instance().get_sound_midi_notes()) { return; } @@ -1656,7 +1656,7 @@ MidiRegionView::start_playing_midi_note(boost::shared_ptr note) void MidiRegionView::start_playing_midi_chord (vector > notes) { - if (_no_sound_notes || !ARDOUR_UI::config()->get_sound_midi_notes()) { + if (_no_sound_notes || !UIConfiguration::instance().get_sound_midi_notes()) { return; } @@ -2537,7 +2537,7 @@ MidiRegionView::move_selection(double dx, double dy, double cumulative_dy) (*i)->move_event(dx, dy); } - if (dy && !_selection.empty() && !_no_sound_notes && ARDOUR_UI::config()->get_sound_midi_notes()) { + if (dy && !_selection.empty() && !_no_sound_notes && UIConfiguration::instance().get_sound_midi_notes()) { if (to_play.size() > 1) { @@ -2719,7 +2719,7 @@ MidiRegionView::begin_resizing (bool /*at_front*/) // calculate the colors: get the color settings uint32_t fill_color = UINT_RGBA_CHANGE_A( - ARDOUR_UI::config()->color ("midi note selected"), + UIConfiguration::instance().color ("midi note selected"), 128); // make the resize preview notes more transparent and bright @@ -2732,7 +2732,7 @@ MidiRegionView::begin_resizing (bool /*at_front*/) 0.85)); resize_rect->set_outline_color (NoteBase::calculate_outline ( - ARDOUR_UI::config()->color ("midi note selected"))); + UIConfiguration::instance().color ("midi note selected"))); resize_data->resize_rect = resize_rect; _resize_data.push_back(resize_data); @@ -3406,12 +3406,12 @@ MidiRegionView::get_fill_color() const trackview.editor().internal_editing() ? "editable region" : "midi frame base"); if (_selected) { - return ARDOUR_UI::config()->color_mod ("selected region base", mod_name); - } else if ((!ARDOUR_UI::config()->get_show_name_highlight() || high_enough_for_name) && - !ARDOUR_UI::config()->get_color_regions_using_track_color()) { - return ARDOUR_UI::config()->color_mod ("midi frame base", mod_name); + return UIConfiguration::instance().color_mod ("selected region base", mod_name); + } else if ((!UIConfiguration::instance().get_show_name_highlight() || high_enough_for_name) && + !UIConfiguration::instance().get_color_regions_using_track_color()) { + return UIConfiguration::instance().color_mod ("midi frame base", mod_name); } - return ARDOUR_UI::config()->color_mod (fill_color, mod_name); + return UIConfiguration::instance().color_mod (fill_color, mod_name); } void diff --git a/gtk2_ardour/midi_streamview.cc b/gtk2_ardour/midi_streamview.cc index 9c54c2912e..d1a479d28c 100644 --- a/gtk2_ardour/midi_streamview.cc +++ b/gtk2_ardour/midi_streamview.cc @@ -34,7 +34,6 @@ #include "ardour/session.h" #include "ardour/smf_source.h" -#include "ardour_ui.h" #include "gui_thread.h" #include "midi_region_view.h" #include "midi_streamview.h" @@ -45,6 +44,7 @@ #include "region_view.h" #include "rgb_macros.h" #include "selection.h" +#include "ui_config.h" #include "utils.h" #include "i18n.h" @@ -85,7 +85,7 @@ MidiStreamView::MidiStreamView (MidiTimeAxisView& tv) color_handler (); - UIConfiguration::ColorsChanged.connect(sigc::mem_fun(*this, &MidiStreamView::color_handler)); + UIConfiguration::instance().ColorsChanged.connect(sigc::mem_fun(*this, &MidiStreamView::color_handler)); note_range_adjustment.set_page_size(_highest_note - _lowest_note); note_range_adjustment.set_value(_lowest_note); @@ -323,7 +323,7 @@ MidiStreamView::draw_note_lines() */ if (i <= highest_note()) { - _note_lines->add (y, 1.0, ARDOUR_UI::config()->color ("piano roll black outline")); + _note_lines->add (y, 1.0, UIConfiguration::instance().color ("piano roll black outline")); } /* now add a thicker line/bar which covers the entire vertical @@ -336,10 +336,10 @@ MidiStreamView::draw_note_lines() case 6: case 8: case 10: - color = ARDOUR_UI::config()->color_mod ("piano roll black", "piano roll black"); + color = UIConfiguration::instance().color_mod ("piano roll black", "piano roll black"); break; default: - color = ARDOUR_UI::config()->color_mod ("piano roll white", "piano roll white"); + color = UIConfiguration::instance().color_mod ("piano roll white", "piano roll white"); break; } @@ -442,7 +442,7 @@ MidiStreamView::setup_rec_box () _trackview.session()->record_status() == Session::Recording && _trackview.track()->record_enabled()) { - if (ARDOUR_UI::config()->get_show_waveforms_while_recording() && rec_regions.size() == rec_rects.size()) { + if (UIConfiguration::instance().get_show_waveforms_while_recording() && rec_regions.size() == rec_rects.size()) { /* add a new region, but don't bother if they set show-waveforms-while-recording mid-record */ @@ -565,9 +565,9 @@ MidiStreamView::color_handler () draw_note_lines (); if (_trackview.is_midi_track()) { - canvas_rect->set_fill_color (ARDOUR_UI::config()->color_mod ("midi track base", "midi track base")); + canvas_rect->set_fill_color (UIConfiguration::instance().color_mod ("midi track base", "midi track base")); } else { - canvas_rect->set_fill_color (ARDOUR_UI::config()->color ("midi bus base")); + canvas_rect->set_fill_color (UIConfiguration::instance().color ("midi bus base")); } } diff --git a/gtk2_ardour/mixer_group_tabs.cc b/gtk2_ardour/mixer_group_tabs.cc index 4b33f1e346..7d8bb99b48 100644 --- a/gtk2_ardour/mixer_group_tabs.cc +++ b/gtk2_ardour/mixer_group_tabs.cc @@ -25,12 +25,12 @@ #include "canvas/colors.h" -#include "ardour_ui.h" #include "mixer_group_tabs.h" #include "mixer_strip.h" #include "mixer_ui.h" #include "rgb_macros.h" #include "route_group_dialog.h" +#include "ui_config.h" #include "utils.h" #include "i18n.h" @@ -103,7 +103,7 @@ MixerGroupTabs::draw_tab (cairo_t* cr, Tab const & tab) const if (tab.group && tab.group->is_active()) { ArdourCanvas::color_to_rgba (tab.color, r, g, b, a); } else { - ArdourCanvas::color_to_rgba (ARDOUR_UI::config()->color ("inactive group tab"), r, g, b, a); + ArdourCanvas::color_to_rgba (UIConfiguration::instance().color ("inactive group tab"), r, g, b, a); } a = 1.0; diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 64f4a64c31..0a0c44447c 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -66,6 +66,7 @@ #include "gui_thread.h" #include "route_group_menu.h" #include "meter_patterns.h" +#include "ui_config.h" #include "i18n.h" @@ -257,7 +258,7 @@ MixerStrip::init () _comment_button.signal_clicked.connect (sigc::mem_fun (*this, &RouteUI::toggle_comment_editor)); // TODO implement ArdourKnob::on_size_request properly -#define PX_SCALE(px) std::max((float)px, rintf((float)px * ARDOUR_UI::config()->get_ui_scale())) +#define PX_SCALE(px) std::max((float)px, rintf((float)px * UIConfiguration::instance().get_ui_scale())) trim_control.set_size_request (PX_SCALE(19), PX_SCALE(19)); #undef PX_SCALE trim_control.set_tooltip_prefix (_("Trim: ")); @@ -384,7 +385,7 @@ MixerStrip::init () _visibility.add (&_comment_button, X_("Comments"), _("Comments"), false); parameter_changed (X_("mixer-element-visibility")); - ARDOUR_UI::config()->ParameterChanged.connect (sigc::mem_fun (*this, &MixerStrip::parameter_changed)); + UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &MixerStrip::parameter_changed)); Config->ParameterChanged.connect (_config_connection, MISSING_INVALIDATOR, boost::bind (&MixerStrip::parameter_changed, this, _1), gui_context()); _session->config.ParameterChanged.connect (_config_connection, MISSING_INVALIDATOR, boost::bind (&MixerStrip::parameter_changed, this, _1), gui_context()); @@ -703,7 +704,7 @@ MixerStrip::set_width_enum (Width w, void* owner) set_button_names (); - const float scale = std::max(1.f, ARDOUR_UI::config()->get_ui_scale()); + const float scale = std::max(1.f, UIConfiguration::instance().get_ui_scale()); switch (w) { case Wide: @@ -2186,7 +2187,7 @@ MixerStrip::parameter_changed (string p) /* The user has made changes to the mixer strip visibility, so get our VisibilityGroup to reflect these changes in our widgets. */ - _visibility.set_state (ARDOUR_UI::config()->get_mixer_strip_visibility ()); + _visibility.set_state (UIConfiguration::instance().get_mixer_strip_visibility ()); } else if (p == "track-name-number") { name_changed (); diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index de7af6965a..6a768f9e49 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -58,6 +58,7 @@ #include "gui_thread.h" #include "mixer_group_tabs.h" #include "timers.h" +#include "ui_config.h" #include "i18n.h" @@ -93,7 +94,7 @@ Mixer_UI::Mixer_UI () , track_menu (0) , _monitor_section (0) , _plugin_selector (0) - , _strip_width (ARDOUR_UI::config()->get_default_narrow_ms() ? Narrow : Wide) + , _strip_width (UIConfiguration::instance().get_default_narrow_ms() ? Narrow : Wide) , ignore_reorder (false) , _in_group_rebuild_or_clear (false) , _route_deletion_in_progress (false) @@ -372,7 +373,7 @@ Mixer_UI::add_strips (RouteList& routes) strip = new MixerStrip (*this, _session, route); strips.push_back (strip); - ARDOUR_UI::config()->get_default_narrow_ms() ? _strip_width = Narrow : _strip_width = Wide; + UIConfiguration::instance().get_default_narrow_ms() ? _strip_width = Narrow : _strip_width = Wide; if (strip->width_owner() != strip) { strip->set_width_enum (_strip_width, this); @@ -1842,7 +1843,7 @@ Mixer_UI::parameter_changed (string const & p) _group_tabs->hide (); } } else if (p == "default-narrow_ms") { - bool const s = ARDOUR_UI::config()->get_default_narrow_ms (); + bool const s = UIConfiguration::instance().get_default_narrow_ms (); for (list::iterator i = strips.begin(); i != strips.end(); ++i) { (*i)->set_width_enum (s ? Narrow : Wide, this); } diff --git a/gtk2_ardour/monitor_section.cc b/gtk2_ardour/monitor_section.cc index 9ee8a87541..79461a58a1 100644 --- a/gtk2_ardour/monitor_section.cc +++ b/gtk2_ardour/monitor_section.cc @@ -55,7 +55,7 @@ using namespace std; Glib::RefPtr MonitorSection::monitor_actions; -#define PX_SCALE(px) std::max((float)px, rintf((float)px * ARDOUR_UI::config()->get_ui_scale())) +#define PX_SCALE(px) std::max((float)px, rintf((float)px * UIConfiguration::instance().get_ui_scale())) MonitorSection::MonitorSection (Session* s) : AxisView (s) diff --git a/gtk2_ardour/mono_panner.cc b/gtk2_ardour/mono_panner.cc index 991481a0c6..f5bba63446 100644 --- a/gtk2_ardour/mono_panner.cc +++ b/gtk2_ardour/mono_panner.cc @@ -38,10 +38,10 @@ #include "ardour/panner.h" #include "ardour/panner_shell.h" -#include "ardour_ui.h" #include "mono_panner.h" #include "mono_panner_editor.h" #include "rgb_macros.h" +#include "ui_config.h" #include "utils.h" #include "i18n.h" @@ -75,7 +75,7 @@ MonoPanner::MonoPanner (boost::shared_ptr p) if (!have_font) { Pango::FontDescription font; Pango::AttrFontDesc* font_attr; - font = Pango::FontDescription (ARDOUR_UI::config()->get_SmallBoldMonospaceFont()); + font = Pango::FontDescription (UIConfiguration::instance().get_SmallBoldMonospaceFont()); font_attr = new Pango::AttrFontDesc (Pango::Attribute::create_attr_font_desc (font)); panner_font_attributes.change(*font_attr); delete font_attr; @@ -86,7 +86,7 @@ MonoPanner::MonoPanner (boost::shared_ptr p) _panner_shell->Changed.connect (panshell_connections, invalidator (*this), boost::bind (&MonoPanner::bypass_handler, this), gui_context()); _panner_shell->PannableChanged.connect (panshell_connections, invalidator (*this), boost::bind (&MonoPanner::pannable_handler, this), gui_context()); - UIConfiguration::ColorsChanged.connect (sigc::mem_fun (*this, &MonoPanner::color_handler)); + UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &MonoPanner::color_handler)); set_tooltip (); } @@ -138,7 +138,7 @@ MonoPanner::on_expose_event (GdkEventExpose*) const int lr_box_size = height - 2 * step_down; const int pos_box_size = (int)(rint(step_down * .8)) | 1; const int top_step = step_down - pos_box_size; - const double corner_radius = 5 * ARDOUR_UI::config()->get_ui_scale(); + const double corner_radius = 5 * UIConfiguration::instance().get_ui_scale(); o = colors.outline; f = colors.fill; @@ -157,7 +157,7 @@ MonoPanner::on_expose_event (GdkEventExpose*) } if (_send_mode) { - b = ARDOUR_UI::config()->color ("send bg"); + b = UIConfiguration::instance().color ("send bg"); } /* background */ context->set_source_rgba (UINT_RGBA_R_FLT(b), UINT_RGBA_G_FLT(b), UINT_RGBA_B_FLT(b), UINT_RGBA_A_FLT(b)); @@ -253,8 +253,8 @@ MonoPanner::on_expose_event (GdkEventExpose*) context->set_line_width (2.0); context->move_to (spos + (pos_box_size/2.0), top_step); /* top right */ context->rel_line_to (0.0, pos_box_size); /* lower right */ - context->rel_line_to (-pos_box_size/2.0, 4.0 * ARDOUR_UI::config()->get_ui_scale()); /* bottom point */ - context->rel_line_to (-pos_box_size/2.0, -4.0 * ARDOUR_UI::config()->get_ui_scale()); /* lower left */ + context->rel_line_to (-pos_box_size/2.0, 4.0 * UIConfiguration::instance().get_ui_scale()); /* bottom point */ + context->rel_line_to (-pos_box_size/2.0, -4.0 * UIConfiguration::instance().get_ui_scale()); /* lower left */ context->rel_line_to (0.0, -pos_box_size); /* upper left */ context->close_path (); @@ -266,7 +266,7 @@ MonoPanner::on_expose_event (GdkEventExpose*) /* marker line */ context->set_line_width (1.0); - context->move_to (spos, 1 + top_step + pos_box_size + 4.0 * ARDOUR_UI::config()->get_ui_scale()); + context->move_to (spos, 1 + top_step + pos_box_size + 4.0 * UIConfiguration::instance().get_ui_scale()); context->line_to (spos, half_lr_box + step_down + lr_box_size - 1); context->set_source_rgba (UINT_RGBA_R_FLT(po), UINT_RGBA_G_FLT(po), UINT_RGBA_B_FLT(po), UINT_RGBA_A_FLT(po)); context->stroke (); @@ -485,12 +485,12 @@ MonoPanner::on_key_press_event (GdkEventKey* ev) void MonoPanner::set_colors () { - colors.fill = ARDOUR_UI::config()->color_mod ("mono panner fill", "panner fill"); - colors.outline = ARDOUR_UI::config()->color ("mono panner outline"); - colors.text = ARDOUR_UI::config()->color ("mono panner text"); - colors.background = ARDOUR_UI::config()->color ("mono panner bg"); - colors.pos_outline = ARDOUR_UI::config()->color ("mono panner position outline"); - colors.pos_fill = ARDOUR_UI::config()->color_mod ("mono panner position fill", "mono panner position fill"); + colors.fill = UIConfiguration::instance().color_mod ("mono panner fill", "panner fill"); + colors.outline = UIConfiguration::instance().color ("mono panner outline"); + colors.text = UIConfiguration::instance().color ("mono panner text"); + colors.background = UIConfiguration::instance().color ("mono panner bg"); + colors.pos_outline = UIConfiguration::instance().color ("mono panner position outline"); + colors.pos_fill = UIConfiguration::instance().color_mod ("mono panner position fill", "mono panner position fill"); } void diff --git a/gtk2_ardour/note_base.cc b/gtk2_ardour/note_base.cc index 56ce3bc9d1..bd4847be4e 100644 --- a/gtk2_ardour/note_base.cc +++ b/gtk2_ardour/note_base.cc @@ -96,7 +96,7 @@ NoteBase::show_velocity() if (!_text) { _text = new Text (_item->parent ()); _text->set_ignore_events (true); - _text->set_color (ARDOUR_UI::config()->color_mod ("midi note velocity text", "midi note velocity text")); + _text->set_color (UIConfiguration::instance().color_mod ("midi note velocity text", "midi note velocity text")); _text->set_alignment (Pango::ALIGN_CENTER); } @@ -121,8 +121,8 @@ NoteBase::on_channel_selection_change(uint16_t selection) { // make note change its color if its channel is not marked active if ( (selection & (1 << _note->channel())) == 0 ) { - set_fill_color(ARDOUR_UI::config()->color ("midi note inactive channel")); - set_outline_color(calculate_outline(ARDOUR_UI::config()->color ("midi note inactive channel"), + set_fill_color(UIConfiguration::instance().color ("midi note inactive channel")); + set_outline_color(calculate_outline(UIConfiguration::instance().color ("midi note inactive channel"), _selected)); } else { // set the color according to the notes selection state @@ -170,13 +170,13 @@ NoteBase::base_color() { uint32_t color = _region.midi_stream_view()->get_region_color(); return UINT_INTERPOLATE (UINT_RGBA_CHANGE_A (color, opacity), - ARDOUR_UI::config()->color ("midi note selected"), + UIConfiguration::instance().color ("midi note selected"), 0.5); } case ChannelColors: return UINT_INTERPOLATE (UINT_RGBA_CHANGE_A (NoteBase::midi_channel_colors[_note->channel()], opacity), - ARDOUR_UI::config()->color ("midi note selected"), 0.5); + UIConfiguration::instance().color ("midi note selected"), 0.5); default: return meter_style_fill_color(_note->velocity(), selected()); diff --git a/gtk2_ardour/note_base.h b/gtk2_ardour/note_base.h index 01c85b07f0..cdb8fed0b4 100644 --- a/gtk2_ardour/note_base.h +++ b/gtk2_ardour/note_base.h @@ -26,7 +26,6 @@ #include "evoral/types.hpp" #include "rgb_macros.h" -#include "ardour_ui.h" #include "ui_config.h" class Editor; @@ -105,16 +104,16 @@ class NoteBase : public sigc::trackable inline static uint32_t meter_style_fill_color(uint8_t vel, bool selected) { if (selected) { - return ARDOUR_UI::config()->color_mod ("midi note selected", "midi note"); + return UIConfiguration::instance().color_mod ("midi note selected", "midi note"); } else if (vel < 64) { return UINT_INTERPOLATE( - ARDOUR_UI::config()->color_mod ("midi note min", "midi note"), - ARDOUR_UI::config()->color_mod ("midi note mid", "midi note"), + UIConfiguration::instance().color_mod ("midi note min", "midi note"), + UIConfiguration::instance().color_mod ("midi note mid", "midi note"), (vel / (double)63.0)); } else { return UINT_INTERPOLATE( - ARDOUR_UI::config()->color_mod ("midi note mid", "midi note"), - ARDOUR_UI::config()->color_mod ("midi note max", "midi note"), + UIConfiguration::instance().color_mod ("midi note mid", "midi note"), + UIConfiguration::instance().color_mod ("midi note max", "midi note"), ((vel-64) / (double)63.0)); } } @@ -122,7 +121,7 @@ class NoteBase : public sigc::trackable /// calculate outline colors from fill colors of notes inline static uint32_t calculate_outline(uint32_t color, bool selected=false) { if (selected) { - return ARDOUR_UI::config()->color ("midi note selected outline"); + return UIConfiguration::instance().color ("midi note selected outline"); } else { return UINT_INTERPOLATE(color, 0x000000ff, 0.5); } diff --git a/gtk2_ardour/panner2d.cc b/gtk2_ardour/panner2d.cc index a5c0830fc7..7b9918b40f 100644 --- a/gtk2_ardour/panner2d.cc +++ b/gtk2_ardour/panner2d.cc @@ -35,13 +35,13 @@ #include "canvas/colors.h" -#include "ardour_ui.h" #include "panner2d.h" #include "keyboard.h" #include "gui_thread.h" #include "rgb_macros.h" #include "utils.h" #include "public_editor.h" +#include "ui_config.h" #include "i18n.h" @@ -90,7 +90,7 @@ Panner2d::Panner2d (boost::shared_ptr p, int32_t h) have_colors = true; } - UIConfiguration::ColorsChanged.connect (sigc::mem_fun (*this, &Panner2d::color_handler)); + UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &Panner2d::color_handler)); panner_shell->Changed.connect (panshell_connections, invalidator (*this), boost::bind (&Panner2d::handle_state_change, this), gui_context()); @@ -114,7 +114,7 @@ void Panner2d::set_colors () { // TODO get all colors from theme, resolve dups - colors.background = ARDOUR_UI::config()->color ("mono panner bg"); + colors.background = UIConfiguration::instance().color ("mono panner bg"); colors.crosshairs = 0x4884a9ff; // 0.282, 0.517, 0.662, 1.0 colors.signalcircle_border = 0x84c5e1ff; // 0.517, 0.772, 0.882, 1.0 colors.signalcircle = 0x4884a9ff; // 0.282, 0.517, 0.662, 1.0 // also used with a = 0.9 @@ -470,7 +470,7 @@ Panner2d::on_expose_event (GdkEventExpose *event) uint32_t bg = colors.background; if (_send_mode) { - bg = ARDOUR_UI::config()->color ("send bg"); + bg = UIConfiguration::instance().color ("send bg"); } if (!panner_shell->bypassed()) { diff --git a/gtk2_ardour/panner_ui.cc b/gtk2_ardour/panner_ui.cc index 4130559204..8c25fcf515 100644 --- a/gtk2_ardour/panner_ui.cc +++ b/gtk2_ardour/panner_ui.cc @@ -240,7 +240,7 @@ PannerUI::setup_pan () return; } - const float scale = std::max (1.f, ARDOUR_UI::config()->get_ui_scale()); + const float scale = std::max (1.f, UIConfiguration::instance().get_ui_scale()); if (_current_uri == "http://ardour.org/plugin/panner_2in2out#ui") { diff --git a/gtk2_ardour/patch_change.cc b/gtk2_ardour/patch_change.cc index 1bcf8d940e..96cd2f5ebc 100644 --- a/gtk2_ardour/patch_change.cc +++ b/gtk2_ardour/patch_change.cc @@ -30,11 +30,11 @@ #include "canvas/debug.h" -#include "ardour_ui.h" #include "editor.h" #include "editor_drag.h" #include "midi_region_view.h" #include "patch_change.h" +#include "ui_config.h" using namespace MIDI::Name; using namespace std; @@ -58,15 +58,15 @@ PatchChange::PatchChange(MidiRegionView& region, _flag = new ArdourCanvas::Flag ( parent, height, - ARDOUR_UI::config()->color ("midi patch change outline"), - ARDOUR_UI::config()->color_mod ("midi patch change fill", "midi patch change fill"), + UIConfiguration::instance().color ("midi patch change outline"), + UIConfiguration::instance().color_mod ("midi patch change fill", "midi patch change fill"), ArdourCanvas::Duple (x, y), true); CANVAS_DEBUG_NAME (_flag, text); _flag->Event.connect (sigc::mem_fun (*this, &PatchChange::event_handler)); - _flag->set_font_description (ARDOUR_UI::config()->get_SmallFont()); + _flag->set_font_description (UIConfiguration::instance().get_SmallFont()); _flag->set_text(text); } diff --git a/gtk2_ardour/plugin_eq_gui.cc b/gtk2_ardour/plugin_eq_gui.cc index 09e72acb92..35ba31eeb2 100644 --- a/gtk2_ardour/plugin_eq_gui.cc +++ b/gtk2_ardour/plugin_eq_gui.cc @@ -38,6 +38,7 @@ #include "ardour/audio_buffer.h" #include "ardour/data_type.h" #include "ardour/chan_mapping.h" +#include "ardour/plugin_insert.h" #include "ardour/session.h" #include "plugin_eq_gui.h" diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index 6ceda3b8d8..a1e066797f 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -510,7 +510,7 @@ ProcessorEntry::toggle_panner_link () ProcessorEntry::Control::Control (boost::shared_ptr c, string const & n) : _control (c) , _adjustment (gain_to_slider_position_with_max (1.0, Config->get_max_gain()), 0, 1, 0.01, 0.1) - , _slider (&_adjustment, boost::shared_ptr(), 0, max(13.f, rintf(13.f * ARDOUR_UI::config()->get_ui_scale()))) + , _slider (&_adjustment, boost::shared_ptr(), 0, max(13.f, rintf(13.f * UIConfiguration::instance().get_ui_scale()))) , _slider_persistant_tooltip (&_slider) , _button (ArdourButton::led_default_elements) , _ignore_ui_adjustment (false) @@ -792,7 +792,7 @@ PluginInsertProcessorEntry::plugin_insert_splitting_changed () if (_plugin_insert->splitting () || in != sinks) { - _routing_icon.set_size_request (-1, std::max (7.f, rintf(7.f * ARDOUR_UI::config()->get_ui_scale()))); + _routing_icon.set_size_request (-1, std::max (7.f, rintf(7.f * UIConfiguration::instance().get_ui_scale()))); _routing_icon.set_visible(true); _input_icon.show(); } else { @@ -817,7 +817,7 @@ PluginInsertProcessorEntry::hide_things () ProcessorEntry::PortIcon::PortIcon(bool input) { _input = input; _ports = ARDOUR::ChanCount(ARDOUR::DataType::AUDIO, 1); - set_size_request (-1, std::max (2.f, rintf(2.f * ARDOUR_UI::config()->get_ui_scale()))); + set_size_request (-1, std::max (2.f, rintf(2.f * UIConfiguration::instance().get_ui_scale()))); } bool @@ -838,7 +838,7 @@ ProcessorEntry::PortIcon::on_expose_event (GdkEventExpose* ev) cairo_rectangle (cr, 0, 0, width, height); cairo_fill (cr); - const double dx = rint(max(2., 2. * ARDOUR_UI::config()->get_ui_scale())); + const double dx = rint(max(2., 2. * UIConfiguration::instance().get_ui_scale())); if (_ports.n_total() > 1) { for (uint32_t i = 0; i < _ports.n_total(); ++i) { if (i < _ports.n_midi()) { @@ -886,7 +886,7 @@ ProcessorEntry::RoutingIcon::on_expose_event (GdkEventExpose* ev) cairo_rectangle (cr, ev->area.x, ev->area.y, ev->area.width, ev->area.height); cairo_clip (cr); - cairo_set_line_width (cr, max (1.f, ARDOUR_UI::config()->get_ui_scale())); + cairo_set_line_width (cr, max (1.f, UIConfiguration::instance().get_ui_scale())); cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND); Gtk::Allocation a = get_allocation(); @@ -936,7 +936,7 @@ ProcessorEntry::RoutingIcon::on_expose_event (GdkEventExpose* ev) cairo_curve_to (cr, si_x, 0, si_x0, height, si_x0, 0); cairo_stroke (cr); } else if (midi_sources == 0 && midi_sinks == 1) { - const double dx = 1 + rint(max(2., 2. * ARDOUR_UI::config()->get_ui_scale())); + const double dx = 1 + rint(max(2., 2. * UIConfiguration::instance().get_ui_scale())); // draw "T" // TODO connect back to track-input of last midi-out if any, otherwise draw "X" const float si_x = rintf(width * .2f) + .5f; diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index 199aca3fef..ed586497b2 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -50,7 +50,6 @@ #include "canvas/wave_view.h" -#include "ardour_ui.h" #include "ardour_window.h" #include "ardour_dialog.h" #include "gui_thread.h" @@ -952,12 +951,11 @@ private: class FontScalingOptions : public OptionEditorBox { public: - FontScalingOptions (UIConfiguration* uic) : - _ui_config (uic), + FontScalingOptions () : _dpi_adjustment (100, 50, 250, 1, 5), _dpi_slider (_dpi_adjustment) { - _dpi_adjustment.set_value (_ui_config->get_font_scale() / 1024.); + _dpi_adjustment.set_value (UIConfiguration::instance().get_font_scale() / 1024.); Label* l = manage (new Label (_("GUI and Font scaling:"))); l->set_name ("OptionsLabel"); @@ -996,7 +994,7 @@ public: void parameter_changed (string const & p) { if (p == "font-scale") { - _dpi_adjustment.set_value (_ui_config->get_font_scale() / 1024.); + _dpi_adjustment.set_value (UIConfiguration::instance().get_font_scale() / 1024.); } } @@ -1009,12 +1007,11 @@ private: void dpi_changed () { - _ui_config->set_font_scale ((long) floor (_dpi_adjustment.get_value() * 1024.)); + UIConfiguration::instance().set_font_scale ((long) floor (_dpi_adjustment.get_value() * 1024.)); /* XXX: should be triggered from the parameter changed signal */ - _ui_config->reset_dpi (); + UIConfiguration::instance().reset_dpi (); } - UIConfiguration* _ui_config; Adjustment _dpi_adjustment; HScale _dpi_slider; }; @@ -1022,12 +1019,11 @@ private: class ClipLevelOptions : public OptionEditorBox { public: - ClipLevelOptions (UIConfiguration* c) - : _ui_config (c) - , _clip_level_adjustment (-.5, -50.0, 0.0, 0.1, 1.0) /* units of dB */ + ClipLevelOptions () + : _clip_level_adjustment (-.5, -50.0, 0.0, 0.1, 1.0) /* units of dB */ , _clip_level_slider (_clip_level_adjustment) { - _clip_level_adjustment.set_value (_ui_config->get_waveform_clip_level ()); + _clip_level_adjustment.set_value (UIConfiguration::instance().get_waveform_clip_level ()); Label* l = manage (new Label (_("Waveform Clip Level (dBFS):"))); l->set_name ("OptionsLabel"); @@ -1046,7 +1042,7 @@ public: void parameter_changed (string const & p) { if (p == "waveform-clip-level") { - _clip_level_adjustment.set_value (_ui_config->get_waveform_clip_level()); + _clip_level_adjustment.set_value (UIConfiguration::instance().get_waveform_clip_level()); } } @@ -1059,12 +1055,11 @@ private: void clip_level_changed () { - _ui_config->set_waveform_clip_level (_clip_level_adjustment.get_value()); + UIConfiguration::instance().set_waveform_clip_level (_clip_level_adjustment.get_value()); /* XXX: should be triggered from the parameter changed signal */ ArdourCanvas::WaveView::set_clip_level (_clip_level_adjustment.get_value()); } - UIConfiguration* _ui_config; Adjustment _clip_level_adjustment; HScale _clip_level_slider; }; @@ -1507,9 +1502,8 @@ private: class PluginOptions : public OptionEditorBox { public: - PluginOptions (RCConfiguration* c, UIConfiguration* uic) + PluginOptions (RCConfiguration* c) : _rc_config (c) - , _ui_config (uic) , _display_plugin_scan_progress (_("Always Display Plugin Scan Progress")) , _discover_vst_on_start (_("Scan for [new] VST Plugins on Application Start")) , _discover_au_on_start (_("Scan for AudioUnit Plugins on Application Start")) @@ -1624,7 +1618,7 @@ public: void parameter_changed (string const & p) { if (p == "show-plugin-scan-window") { - bool const x = _ui_config->get_show_plugin_scan_window(); + bool const x = UIConfiguration::instance().get_show_plugin_scan_window(); _display_plugin_scan_progress.set_active (x); } else if (p == "discover-vst-on-start") { @@ -1655,7 +1649,6 @@ public: private: RCConfiguration* _rc_config; - UIConfiguration* _ui_config; CheckButton _display_plugin_scan_progress; CheckButton _discover_vst_on_start; CheckButton _discover_au_on_start; @@ -1665,7 +1658,7 @@ private: void display_plugin_scan_progress_toggled () { bool const x = _display_plugin_scan_progress.get_active(); - _ui_config->set_show_plugin_scan_window(x); + UIConfiguration::instance().set_show_plugin_scan_window(x); } void discover_vst_on_start_toggled () { @@ -1805,7 +1798,6 @@ private: RCOptionEditor::RCOptionEditor () : OptionEditor (Config, string_compose (_("%1 Preferences"), PROGRAM_NAME)) , _rc_config (Config) - , _ui_config (ARDOUR_UI::config()) , _mixer_strip_visibility ("mixer-element-visibility") { /* MISC */ @@ -1862,8 +1854,8 @@ RCOptionEditor::RCOptionEditor () new BoolOption ( "only-copy-imported-files", _("Always copy imported files"), - sigc::mem_fun (*_ui_config, &UIConfiguration::get_only_copy_imported_files), - sigc::mem_fun (*_ui_config, &UIConfiguration::set_only_copy_imported_files) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_only_copy_imported_files), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_only_copy_imported_files) )); add_option (_("Misc"), new DirectoryOption ( @@ -2131,8 +2123,8 @@ RCOptionEditor::RCOptionEditor () new BoolOption ( "draggable-playhead", _("Allow dragging of playhead"), - sigc::mem_fun (*ARDOUR_UI::config(), &UIConfiguration::get_draggable_playhead), - sigc::mem_fun (*ARDOUR_UI::config(), &UIConfiguration::set_draggable_playhead) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_draggable_playhead), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_draggable_playhead) )); add_option (_("Editor"), @@ -2147,16 +2139,16 @@ RCOptionEditor::RCOptionEditor () new BoolOption ( "show-track-meters", _("Show meters on tracks in the editor"), - sigc::mem_fun (*_ui_config, &UIConfiguration::get_show_track_meters), - sigc::mem_fun (*_ui_config, &UIConfiguration::set_show_track_meters) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_show_track_meters), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_show_track_meters) )); add_option (_("Editor"), new BoolOption ( "show-editor-meter", _("Display master-meter in the toolbar"), - sigc::mem_fun (*_ui_config, &UIConfiguration::get_show_editor_meter), - sigc::mem_fun (*_ui_config, &UIConfiguration::set_show_editor_meter) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_show_editor_meter), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_show_editor_meter) )); ComboOption* fadeshape = new ComboOption ( @@ -2204,16 +2196,16 @@ RCOptionEditor::RCOptionEditor () new BoolOption ( "rubberbanding-snaps-to-grid", _("Make rubberband selection rectangle snap to the grid"), - sigc::mem_fun (*_ui_config, &UIConfiguration::get_rubberbanding_snaps_to_grid), - sigc::mem_fun (*_ui_config, &UIConfiguration::set_rubberbanding_snaps_to_grid) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_rubberbanding_snaps_to_grid), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_rubberbanding_snaps_to_grid) )); add_option (_("Editor"), new BoolOption ( "show-waveforms", _("Show waveforms in regions"), - sigc::mem_fun (*_ui_config, &UIConfiguration::get_show_waveforms), - sigc::mem_fun (*_ui_config, &UIConfiguration::set_show_waveforms) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_show_waveforms), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_show_waveforms) )); add_option (_("Editor"), @@ -2222,15 +2214,15 @@ RCOptionEditor::RCOptionEditor () _("Show gain envelopes in audio regions"), _("in all modes"), _("only in Draw and Internal Edit modes"), - sigc::mem_fun (*_ui_config, &UIConfiguration::get_show_region_gain), - sigc::mem_fun (*_ui_config, &UIConfiguration::set_show_region_gain) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_show_region_gain), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_show_region_gain) )); ComboOption* wfs = new ComboOption ( "waveform-scale", _("Waveform scale"), - sigc::mem_fun (*_ui_config, &UIConfiguration::get_waveform_scale), - sigc::mem_fun (*_ui_config, &UIConfiguration::set_waveform_scale) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_waveform_scale), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_waveform_scale) ); wfs->add (Linear, _("linear")); @@ -2241,8 +2233,8 @@ RCOptionEditor::RCOptionEditor () ComboOption* wfsh = new ComboOption ( "waveform-shape", _("Waveform shape"), - sigc::mem_fun (*_ui_config, &UIConfiguration::get_waveform_shape), - sigc::mem_fun (*_ui_config, &UIConfiguration::set_waveform_shape) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_waveform_shape), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_waveform_shape) ); wfsh->add (Traditional, _("traditional")); @@ -2250,37 +2242,37 @@ RCOptionEditor::RCOptionEditor () add_option (_("Editor"), wfsh); - add_option (_("Editor"), new ClipLevelOptions (_ui_config)); + add_option (_("Editor"), new ClipLevelOptions ()); add_option (_("Editor"), new BoolOption ( "show-waveforms-while-recording", _("Show waveforms for audio while it is being recorded"), - sigc::mem_fun (*_ui_config, &UIConfiguration::get_show_waveforms_while_recording), - sigc::mem_fun (*_ui_config, &UIConfiguration::set_show_waveforms_while_recording) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_show_waveforms_while_recording), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_show_waveforms_while_recording) )); add_option (_("Editor"), new BoolOption ( "show-zoom-tools", _("Show zoom toolbar"), - sigc::mem_fun (*_ui_config, &UIConfiguration::get_show_zoom_tools), - sigc::mem_fun (*_ui_config, &UIConfiguration::set_show_zoom_tools) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_show_zoom_tools), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_show_zoom_tools) )); add_option (_("Editor"), new BoolOption ( "update-editor-during-summary-drag", _("Update editor window during drags of the summary"), - sigc::mem_fun (*_ui_config, &UIConfiguration::get_update_editor_during_summary_drag), - sigc::mem_fun (*_ui_config, &UIConfiguration::set_update_editor_during_summary_drag) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_update_editor_during_summary_drag), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_update_editor_during_summary_drag) )); bo = new BoolOption ( "name-new-markers", _("Name new markers"), - sigc::mem_fun (*_ui_config, &UIConfiguration::get_name_new_markers), - sigc::mem_fun (*_ui_config, &UIConfiguration::set_name_new_markers) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_name_new_markers), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_name_new_markers) ); add_option (_("Editor"), bo); @@ -2291,8 +2283,8 @@ RCOptionEditor::RCOptionEditor () new BoolOption ( "autoscroll-editor", _("Auto-scroll editor window when dragging near its edges"), - sigc::mem_fun (*_ui_config, &UIConfiguration::get_autoscroll_editor), - sigc::mem_fun (*_ui_config, &UIConfiguration::set_autoscroll_editor) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_autoscroll_editor), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_autoscroll_editor) )); ComboOption *rsas = new ComboOption ( @@ -2693,16 +2685,16 @@ RCOptionEditor::RCOptionEditor () new BoolOption ( "never-display-periodic-midi", _("Never display periodic MIDI messages (MTC, MIDI Clock)"), - sigc::mem_fun (*_ui_config, &UIConfiguration::get_never_display_periodic_midi), - sigc::mem_fun (*_ui_config, &UIConfiguration::set_never_display_periodic_midi) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_never_display_periodic_midi), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_never_display_periodic_midi) )); add_option (_("MIDI"), new BoolOption ( "sound-midi-notes", _("Sound MIDI notes as they are selected"), - sigc::mem_fun (*_ui_config, &UIConfiguration::get_sound_midi_notes), - sigc::mem_fun (*_ui_config, &UIConfiguration::set_sound_midi_notes) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_sound_midi_notes), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_sound_midi_notes) )); add_option (_("MIDI"), new OptionEditorHeading (_("Midi Audition"))); @@ -2775,7 +2767,7 @@ RCOptionEditor::RCOptionEditor () #if (defined WINDOWS_VST_SUPPORT || defined LXVST_SUPPORT || defined AUDIOUNIT_SUPPORT) /* Plugin options (currrently VST only) */ - add_option (_("Plugins"), new PluginOptions (_rc_config, _ui_config)); + add_option (_("Plugins"), new PluginOptions (_rc_config)); #endif /* INTERFACE */ @@ -2784,8 +2776,8 @@ RCOptionEditor::RCOptionEditor () BoolOption* bgc = new BoolOption ( "cairo-image-surface", _("Disable Graphics Hardware Acceleration (requires restart)"), - sigc::mem_fun (*_ui_config, &UIConfiguration::get_cairo_image_surface), - sigc::mem_fun (*_ui_config, &UIConfiguration::set_cairo_image_surface) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_cairo_image_surface), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_cairo_image_surface) ); Gtkmm2ext::UI::instance()->set_tip (bgc->tip_widget(), string_compose ( @@ -2797,8 +2789,8 @@ RCOptionEditor::RCOptionEditor () BoolOption* bgo = new BoolOption ( "buggy-gradients", _("Possibly improve slow graphical performance (requires restart)"), - sigc::mem_fun (*_ui_config, &UIConfiguration::get_buggy_gradients), - sigc::mem_fun (*_ui_config, &UIConfiguration::set_buggy_gradients) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_buggy_gradients), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_buggy_gradients) ); Gtkmm2ext::UI::instance()->set_tip (bgo->tip_widget(), string_compose (_("Disables hardware gradient rendering on buggy video drivers (\"buggy gradients patch\").\nThis requires restarting %1 before having an effect"), PROGRAM_NAME)); @@ -2809,8 +2801,8 @@ RCOptionEditor::RCOptionEditor () new BoolOption ( "widget-prelight", _("Graphically indicate mouse pointer hovering over various widgets"), - sigc::mem_fun (*_ui_config, &UIConfiguration::get_widget_prelight), - sigc::mem_fun (*_ui_config, &UIConfiguration::set_widget_prelight) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_widget_prelight), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_widget_prelight) )); #ifdef TOOLTIPS_GOT_FIXED @@ -2818,8 +2810,8 @@ RCOptionEditor::RCOptionEditor () new BoolOption ( "use-tooltips", _("Show tooltips if mouse hovers over a control"), - sigc::mem_fun (*_ui_config, &UIConfiguration::get_use_tooltips), - sigc::mem_fun (*_ui_config, &UIConfiguration::set_use_tooltips) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_use_tooltips), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_use_tooltips) )); #endif @@ -2827,21 +2819,21 @@ RCOptionEditor::RCOptionEditor () new BoolOption ( "show-name-highlight", _("Use name highlight bars in region displays (requires a restart)"), - sigc::mem_fun (*_ui_config, &UIConfiguration::get_show_name_highlight), - sigc::mem_fun (*_ui_config, &UIConfiguration::set_show_name_highlight) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_show_name_highlight), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_show_name_highlight) )); #ifndef GTKOSX /* font scaling does nothing with GDK/Quartz */ - add_option (S_("Preferences|GUI"), new FontScalingOptions (_ui_config)); + add_option (S_("Preferences|GUI"), new FontScalingOptions ()); #endif add_option (S_("GUI"), new BoolOption ( "super-rapid-clock-update", _("update transport clock display at FPS instead of every 100ms"), - sigc::mem_fun (*_ui_config, &UIConfiguration::get_super_rapid_clock_update), - sigc::mem_fun (*_ui_config, &UIConfiguration::set_super_rapid_clock_update) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_super_rapid_clock_update), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_super_rapid_clock_update) )); @@ -2851,8 +2843,8 @@ RCOptionEditor::RCOptionEditor () HSliderOption *sics = new HSliderOption("waveform-cache-size", _("Waveform image cache size (megabytes)"), ics, - sigc::mem_fun (*ARDOUR_UI::config(), &UIConfiguration::get_waveform_cache_size), - sigc::mem_fun (*ARDOUR_UI::config(), &UIConfiguration::set_waveform_cache_size) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_waveform_cache_size), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_waveform_cache_size) ); sics->scale().set_digits (0); Gtkmm2ext::UI::instance()->set_tip @@ -2866,8 +2858,8 @@ RCOptionEditor::RCOptionEditor () HSliderOption *slts = new HSliderOption("lock-gui-after-seconds", _("Lock timeout (seconds)"), lts, - sigc::mem_fun (*ARDOUR_UI::config(), &UIConfiguration::get_lock_gui_after_seconds), - sigc::mem_fun (*ARDOUR_UI::config(), &UIConfiguration::set_lock_gui_after_seconds) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_lock_gui_after_seconds), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_lock_gui_after_seconds) ); slts->scale().set_digits (0); Gtkmm2ext::UI::instance()->set_tip @@ -2890,8 +2882,8 @@ RCOptionEditor::RCOptionEditor () new VisibilityOption ( _("Mixer Strip"), &_mixer_strip_visibility, - sigc::mem_fun (*_ui_config, &UIConfiguration::get_mixer_strip_visibility), - sigc::mem_fun (*_ui_config, &UIConfiguration::set_mixer_strip_visibility) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_mixer_strip_visibility), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_mixer_strip_visibility) ) ); @@ -2899,8 +2891,8 @@ RCOptionEditor::RCOptionEditor () new BoolOption ( "default-narrow_ms", _("Use narrow strips in the mixer by default"), - sigc::mem_fun (*_ui_config, &UIConfiguration::get_default_narrow_ms), - sigc::mem_fun (*_ui_config, &UIConfiguration::set_default_narrow_ms) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_default_narrow_ms), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_default_narrow_ms) )); add_option (S_("Preferences|Metering"), new OptionEditorHeading (_("Metering"))); @@ -2908,8 +2900,8 @@ RCOptionEditor::RCOptionEditor () ComboOption* mht = new ComboOption ( "meter-hold", _("Peak hold time"), - sigc::mem_fun (*_ui_config, &UIConfiguration::get_meter_hold), - sigc::mem_fun (*_ui_config, &UIConfiguration::set_meter_hold) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_meter_hold), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_meter_hold) ); mht->add (MeterHoldOff, _("off")); @@ -2939,8 +2931,8 @@ RCOptionEditor::RCOptionEditor () ComboOption* mlu = new ComboOption ( "meter-line-up-level", _("Meter line-up level; 0dBu"), - sigc::mem_fun (*_ui_config, &UIConfiguration::get_meter_line_up_level), - sigc::mem_fun (*_ui_config, &UIConfiguration::set_meter_line_up_level) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_meter_line_up_level), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_meter_line_up_level) ); mlu->add (MeteringLineUp24, _("-24dBFS (SMPTE US: 4dBu = -20dBFS)")); @@ -2955,8 +2947,8 @@ RCOptionEditor::RCOptionEditor () ComboOption* mld = new ComboOption ( "meter-line-up-din", _("IEC1/DIN Meter line-up level; 0dBu"), - sigc::mem_fun (*_ui_config, &UIConfiguration::get_meter_line_up_din), - sigc::mem_fun (*_ui_config, &UIConfiguration::set_meter_line_up_din) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_meter_line_up_din), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_meter_line_up_din) ); mld->add (MeteringLineUp24, _("-24dBFS (SMPTE US: 4dBu = -20dBFS)")); @@ -2971,8 +2963,8 @@ RCOptionEditor::RCOptionEditor () ComboOption* mvu = new ComboOption ( "meter-vu-standard", _("VU Meter standard"), - sigc::mem_fun (*_ui_config, &UIConfiguration::get_meter_vu_standard), - sigc::mem_fun (*_ui_config, &UIConfiguration::set_meter_vu_standard) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_meter_vu_standard), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_meter_vu_standard) ); mvu->add (MeteringVUfrench, _("0VU = -2dBu (France)")); @@ -2986,8 +2978,8 @@ RCOptionEditor::RCOptionEditor () HSliderOption *mpks = new HSliderOption("meter-peak", _("Peak threshold [dBFS]"), mpk, - sigc::mem_fun (*_ui_config, &UIConfiguration::get_meter_peak), - sigc::mem_fun (*_ui_config, &UIConfiguration::set_meter_peak) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_meter_peak), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_meter_peak) ); @@ -3048,8 +3040,8 @@ RCOptionEditor::RCOptionEditor () new BoolOption ( "meter-style-led", _("LED meter style"), - sigc::mem_fun (*_ui_config, &UIConfiguration::get_meter_style_led), - sigc::mem_fun (*_ui_config, &UIConfiguration::set_meter_style_led) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_meter_style_led), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_meter_style_led) )); /* and now the theme manager */ diff --git a/gtk2_ardour/rc_option_editor.h b/gtk2_ardour/rc_option_editor.h index b565889abe..95adee2115 100644 --- a/gtk2_ardour/rc_option_editor.h +++ b/gtk2_ardour/rc_option_editor.h @@ -43,7 +43,6 @@ private: void parameter_changed (std::string const &); void ltc_generator_volume_changed (); ARDOUR::RCConfiguration* _rc_config; - UIConfiguration* _ui_config; BoolOption* _solo_control_is_listen_control; ComboOption* _listen_position; VisibilityGroup _mixer_strip_visibility; diff --git a/gtk2_ardour/region_view.cc b/gtk2_ardour/region_view.cc index 394edc120a..aeede86bb6 100644 --- a/gtk2_ardour/region_view.cc +++ b/gtk2_ardour/region_view.cc @@ -35,7 +35,6 @@ #include "canvas/utils.h" #include "canvas/colors.h" -#include "ardour_ui.h" #include "streamview.h" #include "region_view.h" #include "automation_region_view.h" @@ -190,7 +189,7 @@ RegionView::init (bool wfd) set_colors (); - UIConfiguration::ColorsChanged.connect (sigc::mem_fun (*this, &RegionView::color_handler)); + UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &RegionView::color_handler)); /* XXX sync mark drag? */ } @@ -233,7 +232,7 @@ RegionView::set_silent_frames (const AudioIntervalResult& silences, double /*thr return; } - uint32_t const color = ARDOUR_UI::config()->color_mod ("silence", "silence"); + uint32_t const color = UIConfiguration::instance().color_mod ("silence", "silence"); for (AudioIntervalResult::const_iterator i = silences.begin(); i != silences.end(); ++i) { @@ -274,7 +273,7 @@ RegionView::set_silent_frames (const AudioIntervalResult& silences, double /*thr _silence_text = new ArdourCanvas::Text (group); _silence_text->set_ignore_events (true); _silence_text->set_font_description (get_font_for_style (N_("SilenceText"))); - _silence_text->set_color (ARDOUR_UI::config()->color ("silence text")); + _silence_text->set_color (UIConfiguration::instance().color ("silence text")); /* both positions are relative to the region start offset in source */ @@ -520,7 +519,7 @@ void RegionView::set_sync_mark_color () { if (sync_mark) { - ArdourCanvas::Color c = ARDOUR_UI::config()->color ("sync mark"); + ArdourCanvas::Color c = UIConfiguration::instance().color ("sync mark"); sync_mark->set_fill_color (c); sync_mark->set_outline_color (c); sync_line->set_outline_color (c); @@ -539,7 +538,7 @@ RegionView::get_fill_color () const modname = "transparent region base"; } - return HSV(f).mod (ARDOUR_UI::config()->modifier (modname)).color (); + return HSV(f).mod (UIConfiguration::instance().modifier (modname)).color (); } void @@ -783,7 +782,7 @@ RegionView::update_coverage_frames (LayerDisplay d) bool me = false; /* the color that will be used to show parts of regions that will not be heard */ - uint32_t const non_playing_color = ARDOUR_UI::config()->color_mod ("covered region", "covered region base"); + uint32_t const non_playing_color = UIConfiguration::instance().color_mod ("covered region", "covered region base"); while (t < end) { diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index f7c21fa734..224ff3fd1c 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -76,6 +76,7 @@ #include "rgb_macros.h" #include "selection.h" #include "streamview.h" +#include "ui_config.h" #include "utils.h" #include "route_group_menu.h" @@ -307,7 +308,7 @@ RouteTimeAxisView::set_route (boost::shared_ptr rt) } _editor.ZoomChanged.connect (sigc::mem_fun(*this, &RouteTimeAxisView::reset_samples_per_pixel)); - UIConfiguration::ColorsChanged.connect (sigc::mem_fun (*this, &RouteTimeAxisView::color_handler)); + UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &RouteTimeAxisView::color_handler)); PropertyList* plist = new PropertyList(); @@ -921,8 +922,8 @@ RouteTimeAxisView::show_timestretch (framepos_t start, framepos_t end, int layer if (timestretch_rect == 0) { timestretch_rect = new ArdourCanvas::Rectangle (canvas_display ()); - timestretch_rect->set_fill_color (ArdourCanvas::HSV (ARDOUR_UI::config()->color ("time stretch fill")).mod (ARDOUR_UI::config()->modifier ("time stretch fill")).color()); - timestretch_rect->set_outline_color (ARDOUR_UI::config()->color ("time stretch outline")); + timestretch_rect->set_fill_color (ArdourCanvas::HSV (UIConfiguration::instance().color ("time stretch fill")).mod (UIConfiguration::instance().modifier ("time stretch fill")).color()); + timestretch_rect->set_outline_color (UIConfiguration::instance().color ("time stretch outline")); } timestretch_rect->show (); @@ -1833,11 +1834,11 @@ RouteTimeAxisView::color_handler () { //case cTimeStretchOutline: if (timestretch_rect) { - timestretch_rect->set_outline_color (ARDOUR_UI::config()->color ("time stretch outline")); + timestretch_rect->set_outline_color (UIConfiguration::instance().color ("time stretch outline")); } //case cTimeStretchFill: if (timestretch_rect) { - timestretch_rect->set_fill_color (ARDOUR_UI::config()->color ("time stretch fill")); + timestretch_rect->set_fill_color (UIConfiguration::instance().color ("time stretch fill")); } reset_meter(); @@ -2560,7 +2561,7 @@ RouteTimeAxisView::show_meter () void RouteTimeAxisView::reset_meter () { - if (ARDOUR_UI::config()->get_show_track_meters()) { + if (UIConfiguration::instance().get_show_track_meters()) { int meter_width = 3; if (_route && _route->shared_peak_meter()->input_streams().n_total() == 1) { meter_width = 6; @@ -2582,7 +2583,7 @@ RouteTimeAxisView::meter_changed () { ENSURE_GUI_THREAD (*this, &RouteTimeAxisView::meter_changed) reset_meter(); - if (_route && !no_redraw && ARDOUR_UI::config()->get_show_track_meters()) { + if (_route && !no_redraw && UIConfiguration::instance().get_show_track_meters()) { request_redraw (); } // reset peak when meter point changes diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index 8f99874ed0..1a5bd073ce 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -47,6 +47,7 @@ #include "route_time_axis.h" #include "group_tabs.h" #include "timers.h" +#include "ui_config.h" #include "ardour/audio_track.h" #include "ardour/audioengine.h" @@ -151,7 +152,7 @@ RouteUI::init () rec_enable_button->set_icon (ArdourIcon::RecButton); UI::instance()->set_tip (rec_enable_button, _("Enable recording on this track"), ""); - if (ARDOUR_UI::config()->get_blink_rec_arm()) { + if (UIConfiguration::instance().get_blink_rec_arm()) { rec_blink_connection = Timers::blink_connect (sigc::mem_fun (*this, &RouteUI::blink_rec_display)); } @@ -313,7 +314,7 @@ RouteUI::set_route (boost::shared_ptr rp) update_mute_display (); update_solo_display (); - if (!ARDOUR_UI::config()->get_blink_rec_arm()) { + if (!UIConfiguration::instance().get_blink_rec_arm()) { blink_rec_display(true); // set initial rec-en button state } @@ -1264,7 +1265,7 @@ RouteUI::blink_rec_display (bool blinkOn) case Session::Disabled: case Session::Enabled: - if ( ARDOUR_UI::config()->get_blink_rec_arm() ) + if ( UIConfiguration::instance().get_blink_rec_arm() ) rec_enable_button->set_active_state ( blinkOn ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off ); else rec_enable_button->set_active_state ( ImplicitActive ); @@ -1865,7 +1866,7 @@ RouteUI::parameter_changed (string const & p) } else if (p == "auto-input") { update_monitoring_display (); } else if (p == "blink-rec-arm") { - if (ARDOUR_UI::config()->get_blink_rec_arm()) { + if (UIConfiguration::instance().get_blink_rec_arm()) { rec_blink_connection.disconnect (); rec_blink_connection = Timers::blink_connect (sigc::mem_fun (*this, &RouteUI::blink_rec_display)); } else { diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc index ed1cfd44ca..f8f3003bc8 100644 --- a/gtk2_ardour/sfdb_ui.cc +++ b/gtk2_ardour/sfdb_ui.cc @@ -68,6 +68,7 @@ #include "main_clock.h" #include "public_editor.h" #include "timers.h" +#include "ui_config.h" #include "sfdb_freesound_mootcher.h" @@ -1315,7 +1316,7 @@ SoundFileOmega::reset_options () to do embedding (or if we are importing a MIDI file). */ - if (ARDOUR_UI::config()->get_only_copy_imported_files()) { + if (UIConfiguration::instance().get_only_copy_imported_files()) { copy_files_btn.set_sensitive (false); } else { copy_files_btn.set_sensitive (false); @@ -1489,7 +1490,7 @@ SoundFileOmega::reset_options () * or any file if we are under nsm control */ bool const must_copy = _session->get_nsm_state() || have_a_midi_file || notebook.get_current_page() == 2; - if (ARDOUR_UI::config()->get_only_copy_imported_files()) { + if (UIConfiguration::instance().get_only_copy_imported_files()) { if (selection_can_be_embedded_with_links && !must_copy) { copy_files_btn.set_sensitive (true); diff --git a/gtk2_ardour/shuttle_control.cc b/gtk2_ardour/shuttle_control.cc index 2aca6b3ae6..06afd6c39c 100644 --- a/gtk2_ardour/shuttle_control.cc +++ b/gtk2_ardour/shuttle_control.cc @@ -122,7 +122,7 @@ ShuttleControl::on_size_allocate (Gtk::Allocation& alloc) //background pattern = cairo_pattern_create_linear (0, 0, 0, alloc.get_height()); - uint32_t col = ARDOUR_UI::config()->color ("shuttle"); + uint32_t col = UIConfiguration::instance().color ("shuttle"); int r,b,g,a; UINT_TO_RGBA(col, &r, &g, &b, &a); cairo_pattern_add_color_stop_rgb (pattern, 0.0, r/400.0, g/400.0, b/400.0); @@ -640,7 +640,7 @@ ShuttleControl::render (cairo_t* cr, cairo_rectangle_t*) cairo_move_to (cr, get_width() - (fabs(extents.x_advance) + 5), text_ypos); cairo_show_text (cr, buf); - if (ARDOUR_UI::config()->get_widget_prelight()) { + if (UIConfiguration::instance().get_widget_prelight()) { if (_hovering) { rounded_rectangle (cr, 1, 1, get_width()-2, get_height()-2, 4.0); cairo_set_source_rgba (cr, 1, 1, 1, 0.2); @@ -729,7 +729,7 @@ ShuttleControl::on_enter_notify_event (GdkEventCrossing* ev) { _hovering = true; - if (ARDOUR_UI::config()->get_widget_prelight()) { + if (UIConfiguration::instance().get_widget_prelight()) { queue_draw (); } @@ -741,7 +741,7 @@ ShuttleControl::on_leave_notify_event (GdkEventCrossing* ev) { _hovering = false; - if (ARDOUR_UI::config()->get_widget_prelight()) { + if (UIConfiguration::instance().get_widget_prelight()) { queue_draw (); } diff --git a/gtk2_ardour/stereo_panner.cc b/gtk2_ardour/stereo_panner.cc index 6fa8241eb1..0736a426c1 100644 --- a/gtk2_ardour/stereo_panner.cc +++ b/gtk2_ardour/stereo_panner.cc @@ -39,11 +39,11 @@ #include "canvas/colors.h" -#include "ardour_ui.h" #include "stereo_panner.h" #include "stereo_panner_editor.h" #include "rgb_macros.h" #include "utils.h" +#include "ui_config.h" #include "i18n.h" @@ -83,7 +83,7 @@ StereoPanner::StereoPanner (boost::shared_ptr p) if (!have_font) { Pango::FontDescription font; Pango::AttrFontDesc* font_attr; - font = Pango::FontDescription (ARDOUR_UI::config()->get_SmallBoldMonospaceFont()); + font = Pango::FontDescription (UIConfiguration::instance().get_SmallBoldMonospaceFont()); font_attr = new Pango::AttrFontDesc (Pango::Attribute::create_attr_font_desc (font)); panner_font_attributes.change(*font_attr); delete font_attr; @@ -96,7 +96,7 @@ StereoPanner::StereoPanner (boost::shared_ptr p) _panner_shell->Changed.connect (panshell_connections, invalidator (*this), boost::bind (&StereoPanner::bypass_handler, this), gui_context()); _panner_shell->PannableChanged.connect (panshell_connections, invalidator (*this), boost::bind (&StereoPanner::pannable_handler, this), gui_context()); - UIConfiguration::ColorsChanged.connect (sigc::mem_fun (*this, &StereoPanner::color_handler)); + UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &StereoPanner::color_handler)); set_tooltip (); } @@ -151,7 +151,7 @@ StereoPanner::on_expose_event (GdkEventExpose*) height = get_height (); const int step_down = rint(height / 3.5); - const double corner_radius = 5.0 * ARDOUR_UI::config()->get_ui_scale(); + const double corner_radius = 5.0 * UIConfiguration::instance().get_ui_scale(); const int lr_box_size = height - 2 * step_down; const int pos_box_size = (int)(rint(step_down * .8)) | 1; const int top_step = step_down - pos_box_size; @@ -179,7 +179,7 @@ StereoPanner::on_expose_event (GdkEventExpose*) } if (_send_mode) { - b = ARDOUR_UI::config()->color ("send bg"); + b = UIConfiguration::instance().color ("send bg"); // b = rgba_from_style("SendStripBase", // UINT_RGBA_R(b), UINT_RGBA_G(b), UINT_RGBA_B(b), 255, // "fg"); @@ -671,24 +671,24 @@ StereoPanner::on_key_press_event (GdkEventKey* ev) void StereoPanner::set_colors () { - colors[Normal].fill = ARDOUR_UI::config()->color_mod ("stereo panner fill", "panner fill"); - // colors[Normal].outline = ARDOUR_UI::config()->color ("stereo panner outline"); + colors[Normal].fill = UIConfiguration::instance().color_mod ("stereo panner fill", "panner fill"); + // colors[Normal].outline = UIConfiguration::instance().color ("stereo panner outline"); colors[Normal].outline = ArdourCanvas::HSV (colors[Normal].fill).outline().color (); - colors[Normal].text = ARDOUR_UI::config()->color ("stereo panner text"); - colors[Normal].background = ARDOUR_UI::config()->color ("stereo panner bg"); - colors[Normal].rule = ARDOUR_UI::config()->color ("stereo panner rule"); - - colors[Mono].fill = ARDOUR_UI::config()->color ("stereo panner mono fill"); - colors[Mono].outline = ARDOUR_UI::config()->color ("stereo panner mono outline"); - colors[Mono].text = ARDOUR_UI::config()->color ("stereo panner mono text"); - colors[Mono].background = ARDOUR_UI::config()->color ("stereo panner mono bg"); - colors[Mono].rule = ARDOUR_UI::config()->color ("stereo panner rule"); - - colors[Inverted].fill = ARDOUR_UI::config()->color_mod ("stereo panner inverted fill", "stereo panner inverted"); - colors[Inverted].outline = ARDOUR_UI::config()->color ("stereo panner inverted outline"); - colors[Inverted].text = ARDOUR_UI::config()->color ("stereo panner inverted text"); - colors[Inverted].background = ARDOUR_UI::config()->color_mod ("stereo panner inverted bg", "stereo panner inverted bg"); - colors[Inverted].rule = ARDOUR_UI::config()->color ("stereo panner rule"); + colors[Normal].text = UIConfiguration::instance().color ("stereo panner text"); + colors[Normal].background = UIConfiguration::instance().color ("stereo panner bg"); + colors[Normal].rule = UIConfiguration::instance().color ("stereo panner rule"); + + colors[Mono].fill = UIConfiguration::instance().color ("stereo panner mono fill"); + colors[Mono].outline = UIConfiguration::instance().color ("stereo panner mono outline"); + colors[Mono].text = UIConfiguration::instance().color ("stereo panner mono text"); + colors[Mono].background = UIConfiguration::instance().color ("stereo panner mono bg"); + colors[Mono].rule = UIConfiguration::instance().color ("stereo panner rule"); + + colors[Inverted].fill = UIConfiguration::instance().color_mod ("stereo panner inverted fill", "stereo panner inverted"); + colors[Inverted].outline = UIConfiguration::instance().color ("stereo panner inverted outline"); + colors[Inverted].text = UIConfiguration::instance().color ("stereo panner inverted text"); + colors[Inverted].background = UIConfiguration::instance().color_mod ("stereo panner inverted bg", "stereo panner inverted bg"); + colors[Inverted].rule = UIConfiguration::instance().color ("stereo panner rule"); } void diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc index 4a9ed0efe8..5f50b7e8cb 100644 --- a/gtk2_ardour/streamview.cc +++ b/gtk2_ardour/streamview.cc @@ -39,10 +39,10 @@ #include "region_selection.h" #include "selection.h" #include "public_editor.h" -#include "ardour_ui.h" #include "timers.h" #include "rgb_macros.h" #include "gui_thread.h" +#include "ui_config.h" #include "utils.h" #include "i18n.h" @@ -85,7 +85,7 @@ StreamView::StreamView (RouteTimeAxisView& tv, ArdourCanvas::Container* canvas_g _trackview.session()->RecordStateChanged.connect (*this, invalidator (*this), boost::bind (&StreamView::sess_rec_enable_changed, this), gui_context()); } - UIConfiguration::ColorsChanged.connect (sigc::mem_fun (*this, &StreamView::color_handler)); + UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &StreamView::color_handler)); } StreamView::~StreamView () @@ -409,7 +409,7 @@ StreamView::create_rec_box(framepos_t frame_pos, double width) { const double xstart = _trackview.editor().sample_to_pixel(frame_pos); const double xend = xstart + width; - const uint32_t fill_color = ARDOUR_UI::config()->color_mod("recording rect", "recording_rect"); + const uint32_t fill_color = UIConfiguration::instance().color_mod("recording rect", "recording_rect"); ArdourCanvas::Rectangle* rec_rect = new ArdourCanvas::Rectangle(_canvas_group); rec_rect->set_x0(xstart); @@ -417,7 +417,7 @@ StreamView::create_rec_box(framepos_t frame_pos, double width) rec_rect->set_x1(xend); rec_rect->set_y1(child_height ()); rec_rect->set_outline_what(ArdourCanvas::Rectangle::What(0)); - rec_rect->set_outline_color(ARDOUR_UI::config()->color("recording rect")); + rec_rect->set_outline_color(UIConfiguration::instance().color("recording rect")); rec_rect->set_fill_color(fill_color); rec_rect->lower_to_bottom(); diff --git a/gtk2_ardour/sys_ex.cc b/gtk2_ardour/sys_ex.cc index eb824842ba..d35c454845 100644 --- a/gtk2_ardour/sys_ex.cc +++ b/gtk2_ardour/sys_ex.cc @@ -19,8 +19,8 @@ #include #include "canvas/flag.h" -#include "ardour_ui.h" #include "sys_ex.h" +#include "ui_config.h" using namespace std; @@ -35,8 +35,8 @@ SysEx::SysEx ( _flag = new ArdourCanvas::Flag ( parent, height, - ARDOUR_UI::config()->color ("midi sysex outline"), - ARDOUR_UI::config()->color_mod ("midi sysex fill", "midi sysex fill"), + UIConfiguration::instance().color ("midi sysex outline"), + UIConfiguration::instance().color_mod ("midi sysex fill", "midi sysex fill"), ArdourCanvas::Duple (x, y) ); diff --git a/gtk2_ardour/tempo_dialog.cc b/gtk2_ardour/tempo_dialog.cc index a458c4220a..37771eff76 100644 --- a/gtk2_ardour/tempo_dialog.cc +++ b/gtk2_ardour/tempo_dialog.cc @@ -23,8 +23,8 @@ #include "gtkmm2ext/utils.h" -#include "ardour_ui.h" #include "tempo_dialog.h" +#include "ui_config.h" #include "i18n.h" @@ -108,7 +108,7 @@ TempoDialog::init (const Timecode::BBT_Time& when, double bpm, double note_type, Table* table; - if (ARDOUR_UI::config()->get_allow_non_quarter_pulse()) { + if (UIConfiguration::instance().get_allow_non_quarter_pulse()) { table = manage (new Table (5, 5)); } else { table = manage (new Table (5, 4)); @@ -122,7 +122,7 @@ TempoDialog::init (const Timecode::BBT_Time& when, double bpm, double note_type, table->attach (*bpm_label, 0, 1, 0, 1); table->attach (bpm_spinner, 1, 5, 0, 1); - if (ARDOUR_UI::config()->get_allow_non_quarter_pulse()) { + if (UIConfiguration::instance().get_allow_non_quarter_pulse()) { table->attach (pulse_selector_label, 0, 1, 1, 2); table->attach (pulse_selector, 1, 5, 1, 2); row = 2; diff --git a/gtk2_ardour/tempo_lines.cc b/gtk2_ardour/tempo_lines.cc index 5d8b7be86a..3c24ee0501 100644 --- a/gtk2_ardour/tempo_lines.cc +++ b/gtk2_ardour/tempo_lines.cc @@ -22,10 +22,10 @@ #include "canvas/canvas.h" #include "canvas/debug.h" -#include "ardour_ui.h" +#include "tempo_lines.h" #include "public_editor.h" #include "rgb_macros.h" -#include "tempo_lines.h" +#include "ui_config.h" using namespace std; @@ -60,7 +60,7 @@ TempoLines::draw_ticks (const ARDOUR::TempoMap::BBTPointList::const_iterator& b, framecnt_t frame_rate) { const double fpb = b->tempo->frames_per_beat(frame_rate); - const uint32_t base = ARDOUR_UI::config()->color_mod("measure line beat", "measure line beat"); + const uint32_t base = UIConfiguration::instance().color_mod("measure line beat", "measure line beat"); for (unsigned l = 1; l < divisions; ++l) { /* find the coarsest division level this tick falls on */ @@ -127,12 +127,12 @@ TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin, for (i = begin; i != end; ++i) { if ((*i).is_bar()) { - color = ARDOUR_UI::config()->color ("measure line bar"); + color = UIConfiguration::instance().color ("measure line bar"); } else { if (beat_density > 0.3) { continue; /* only draw beat lines if the gaps between beats are large. */ } - color = ARDOUR_UI::config()->color_mod ("measure line beat", "measure line beat"); + color = UIConfiguration::instance().color_mod ("measure line beat", "measure line beat"); } ArdourCanvas::Coord xpos = PublicEditor::instance().sample_to_pixel_unrounded ((*i).frame); diff --git a/gtk2_ardour/tempo_lines.h b/gtk2_ardour/tempo_lines.h index 048c56fd7e..b8f0b3c322 100644 --- a/gtk2_ardour/tempo_lines.h +++ b/gtk2_ardour/tempo_lines.h @@ -32,8 +32,8 @@ public: void draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin, const ARDOUR::TempoMap::BBTPointList::const_iterator& end, unsigned divisions, - framecnt_t leftmost_frame, - framecnt_t frame_rate); + ARDOUR::framecnt_t leftmost_frame, + ARDOUR::framecnt_t frame_rate); void show(); void hide(); @@ -41,8 +41,8 @@ public: private: void draw_ticks (const ARDOUR::TempoMap::BBTPointList::const_iterator& b, unsigned divisions, - framecnt_t leftmost_frame, - framecnt_t frame_rate); + ARDOUR::framecnt_t leftmost_frame, + ARDOUR::framecnt_t frame_rate); ArdourCanvas::LineSet lines; }; diff --git a/gtk2_ardour/theme_manager.cc b/gtk2_ardour/theme_manager.cc index 9e28990290..db0aebb143 100644 --- a/gtk2_ardour/theme_manager.cc +++ b/gtk2_ardour/theme_manager.cc @@ -47,7 +47,7 @@ #include "ardour_dialog.h" #include "theme_manager.h" #include "rgb_macros.h" -#include "ardour_ui.h" +#include "ui_config.h" #include "utils.h" #include "i18n.h" @@ -128,7 +128,7 @@ ThemeManager::ThemeManager() if (icon_sets.size() > 1) { Gtkmm2ext::set_popdown_strings (icon_set_dropdown, icon_sets); - icon_set_dropdown.set_active_text (ARDOUR_UI::config()->get_icon_set()); + icon_set_dropdown.set_active_text (UIConfiguration::instance().get_icon_set()); hbox = Gtk::manage (new Gtk::HBox()); hbox->set_spacing (6); @@ -201,7 +201,7 @@ ThemeManager::ThemeManager() setup_aliases (); setup_modifiers (); - UIConfiguration::ColorsChanged.connect (sigc::mem_fun (*this, &ThemeManager::colors_changed)); + UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &ThemeManager::colors_changed)); } ThemeManager::~ThemeManager() @@ -211,7 +211,7 @@ ThemeManager::~ThemeManager() void ThemeManager::setup_modifiers () { - UIConfiguration* uic (ARDOUR_UI::config()); + UIConfiguration* uic (&UIConfiguration::instance()); UIConfiguration::Modifiers& modifiers (uic->modifiers); Gtk::HBox* mod_hbox; Gtk::Label* mod_label; @@ -249,7 +249,7 @@ ThemeManager::modifier_edited (Gtk::Range* range, string name) double alpha = range->get_value(); SVAModifier svam (SVAModifier::Assign, -1.0, -1.0, alpha); - ARDOUR_UI::config()->set_modifier (name, svam); + UIConfiguration::instance().set_modifier (name, svam); } void @@ -269,7 +269,7 @@ ThemeManager::save (string /*path*/) void ThemeManager::on_flat_buttons_toggled () { - ARDOUR_UI::config()->set_flat_buttons (flat_buttons.get_active()); + UIConfiguration::instance().set_flat_buttons (flat_buttons.get_active()); ArdourButton::set_flat_buttons (flat_buttons.get_active()); /* force a redraw */ gtk_rc_reset_styles (gtk_settings_get_default()); @@ -278,34 +278,34 @@ ThemeManager::on_flat_buttons_toggled () void ThemeManager::on_blink_rec_arm_toggled () { - ARDOUR_UI::config()->set_blink_rec_arm (blink_rec_button.get_active()); - ARDOUR::Config->ParameterChanged("blink-rec-arm"); + UIConfiguration::instance().set_blink_rec_arm (blink_rec_button.get_active()); + UIConfiguration::instance().ParameterChanged("blink-rec-arm"); } void ThemeManager::on_region_color_toggled () { - ARDOUR_UI::config()->set_color_regions_using_track_color (region_color_button.get_active()); + UIConfiguration::instance().set_color_regions_using_track_color (region_color_button.get_active()); } void ThemeManager::on_show_clip_toggled () { - ARDOUR_UI::config()->set_show_waveform_clipping (show_clipping_button.get_active()); + UIConfiguration::instance().set_show_waveform_clipping (show_clipping_button.get_active()); // "show-waveform-clipping" was a session config key - ArdourCanvas::WaveView::set_global_show_waveform_clipping (ARDOUR_UI::config()->get_show_waveform_clipping()); + ArdourCanvas::WaveView::set_global_show_waveform_clipping (UIConfiguration::instance().get_show_waveform_clipping()); } void ThemeManager::on_all_dialogs_toggled () { - ARDOUR_UI::config()->set_all_floating_windows_are_dialogs (all_dialogs.get_active()); + UIConfiguration::instance().set_all_floating_windows_are_dialogs (all_dialogs.get_active()); } void ThemeManager::on_transients_follow_front_toggled () { - ARDOUR_UI::config()->set_transients_follow_front (transients_follow_front.get_active()); + UIConfiguration::instance().set_transients_follow_front (transients_follow_front.get_active()); } void @@ -313,7 +313,7 @@ ThemeManager::on_waveform_gradient_depth_change () { double v = waveform_gradient_depth.get_value(); - ARDOUR_UI::config()->set_waveform_gradient_depth (v); + UIConfiguration::instance().set_waveform_gradient_depth (v); ArdourCanvas::WaveView::set_global_gradient_depth (v); } @@ -322,14 +322,14 @@ ThemeManager::on_timeline_item_gradient_depth_change () { double v = timeline_item_gradient_depth.get_value(); - ARDOUR_UI::config()->set_timeline_item_gradient_depth (v); + UIConfiguration::instance().set_timeline_item_gradient_depth (v); } void ThemeManager::on_icon_set_changed () { string new_set = icon_set_dropdown.get_active_text(); - ARDOUR_UI::config()->set_icon_set (new_set); + UIConfiguration::instance().set_icon_set (new_set); } void @@ -337,7 +337,7 @@ ThemeManager::on_dark_theme_button_toggled() { if (!dark_button.get_active()) return; - UIConfiguration* uic (ARDOUR_UI::config()); + UIConfiguration* uic (&UIConfiguration::instance()); uic->set_color_file("dark"); } @@ -347,7 +347,7 @@ ThemeManager::on_light_theme_button_toggled() { if (!light_button.get_active()) return; - UIConfiguration* uic (ARDOUR_UI::config()); + UIConfiguration* uic (&UIConfiguration::instance()); uic->set_color_file("light"); } @@ -360,7 +360,7 @@ ThemeManager::set_ui_to_state() * hence a common combined update function suffices */ - if (ARDOUR_UI::config()->get_color_file() == "light") { + if (UIConfiguration::instance().get_color_file() == "light") { light_button.set_active(true); } else { dark_button.set_active(true); @@ -369,14 +369,14 @@ ThemeManager::set_ui_to_state() /* there is no need to block signal handlers, here, * all elements check if the value has changed and ignore NOOPs */ - all_dialogs.set_active (ARDOUR_UI::config()->get_all_floating_windows_are_dialogs()); - transients_follow_front.set_active (ARDOUR_UI::config()->get_transients_follow_front()); - flat_buttons.set_active (ARDOUR_UI::config()->get_flat_buttons()); - blink_rec_button.set_active (ARDOUR_UI::config()->get_blink_rec_arm()); - region_color_button.set_active (ARDOUR_UI::config()->get_color_regions_using_track_color()); - show_clipping_button.set_active (ARDOUR_UI::config()->get_show_waveform_clipping()); - waveform_gradient_depth.set_value(ARDOUR_UI::config()->get_waveform_gradient_depth()); - timeline_item_gradient_depth.set_value(ARDOUR_UI::config()->get_timeline_item_gradient_depth()); + all_dialogs.set_active (UIConfiguration::instance().get_all_floating_windows_are_dialogs()); + transients_follow_front.set_active (UIConfiguration::instance().get_transients_follow_front()); + flat_buttons.set_active (UIConfiguration::instance().get_flat_buttons()); + blink_rec_button.set_active (UIConfiguration::instance().get_blink_rec_arm()); + region_color_button.set_active (UIConfiguration::instance().get_color_regions_using_track_color()); + show_clipping_button.set_active (UIConfiguration::instance().get_show_waveform_clipping()); + waveform_gradient_depth.set_value(UIConfiguration::instance().get_waveform_gradient_depth()); + timeline_item_gradient_depth.set_value(UIConfiguration::instance().get_timeline_item_gradient_depth()); } void @@ -386,7 +386,7 @@ ThemeManager::reset_canvas_colors() string basename; basename = "my-"; - basename += ARDOUR_UI::config()->get_color_file(); + basename += UIConfiguration::instance().get_color_file(); basename += ".colors"; if (find_file (ardour_config_search_path(), basename, cfile)) { @@ -395,8 +395,8 @@ ThemeManager::reset_canvas_colors() /* don't really care if it fails */ } - ARDOUR_UI::config()->load_defaults(); - ARDOUR_UI::config()->save_state (); + UIConfiguration::instance().load_defaults(); + UIConfiguration::instance().save_state (); set_ui_to_state(); } @@ -452,7 +452,7 @@ ThemeManager::build_palette_canvas (ArdourCanvas::Canvas& canvas, ArdourCanvas:: /* we want the colors sorted by hue, with their name */ - UIConfiguration::Colors& colors (ARDOUR_UI::config()->colors); + UIConfiguration::Colors& colors (UIConfiguration::instance().colors); vector nc; for (UIConfiguration::Colors::const_iterator x = colors.begin(); x != colors.end(); ++x) { nc.push_back (NamedColor (x->first, HSV (x->second))); @@ -493,7 +493,7 @@ ThemeManager::build_palette_canvas (ArdourCanvas::Canvas& canvas, ArdourCanvas:: void ThemeManager::palette_size_request (Gtk::Requisition* req) { - uint32_t ncolors = ARDOUR_UI::config()->colors.size(); + uint32_t ncolors = UIConfiguration::instance().colors.size(); const int box_size = 20; double c = sqrt ((double)ncolors); @@ -531,7 +531,7 @@ ThemeManager::edit_palette_color (std::string name) { using namespace ArdourCanvas; double r,g, b, a; - UIConfiguration* uic (ARDOUR_UI::config()); + UIConfiguration* uic (&UIConfiguration::instance()); ArdourCanvas::Color c = uic->color (name); Gdk::Color gdkcolor; @@ -555,7 +555,7 @@ ThemeManager::palette_color_response (int result, std::string name) color_dialog_connection.disconnect (); - UIConfiguration* uic (ARDOUR_UI::config()); + UIConfiguration* uic (&UIConfiguration::instance()); Gdk::Color gdkcolor; double r,g, b, a; @@ -583,7 +583,7 @@ ThemeManager::alias_palette_event (GdkEvent* ev, string new_alias, string target { switch (ev->type) { case GDK_BUTTON_RELEASE: - ARDOUR_UI::config()->set_alias (target_name, new_alias); + UIConfiguration::instance().set_alias (target_name, new_alias); return true; break; default: @@ -604,7 +604,7 @@ ThemeManager::alias_palette_response (int response, std::string target_name, std case GTK_RESPONSE_REJECT: /* revert choice */ - ARDOUR_UI::config()->set_alias (target_name, old_alias); + UIConfiguration::instance().set_alias (target_name, old_alias); break; default: @@ -618,7 +618,7 @@ ThemeManager::alias_palette_response (int response, std::string target_name, std void ThemeManager::choose_color_from_palette (string const & name) { - UIConfiguration* uic (ARDOUR_UI::config()); + UIConfiguration* uic (&UIConfiguration::instance()); UIConfiguration::ColorAliases::iterator i = uic->color_aliases.find (name); if (i == uic->color_aliases.end()) { @@ -652,7 +652,7 @@ ThemeManager::setup_aliases () { using namespace ArdourCanvas; - UIConfiguration* uic (ARDOUR_UI::config()); + UIConfiguration* uic (&UIConfiguration::instance()); UIConfiguration::ColorAliases& aliases (uic->color_aliases); alias_list->clear (); diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc index 41c41ae4c3..e7d43f4ae9 100644 --- a/gtk2_ardour/time_axis_view.cc +++ b/gtk2_ardour/time_axis_view.cc @@ -55,6 +55,7 @@ #include "streamview.h" #include "editor_drag.h" #include "editor.h" +#include "ui_config.h" #include "i18n.h" @@ -82,7 +83,7 @@ Glib::RefPtr TimeAxisView::midi_scroomer_size_group = Glib::RefP void TimeAxisView::setup_sizes() { - name_width_px = ceilf (100.f * ARDOUR_UI::config()->get_ui_scale()); + name_width_px = ceilf (100.f * UIConfiguration::instance().get_ui_scale()); } TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisView* rent, Canvas& /*canvas*/) @@ -219,7 +220,7 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie time_axis_hbox.show(); top_hbox.pack_start (scroomer_placeholder, false, false); // OR pack_end to move after meters ? - UIConfiguration::ColorsChanged.connect (sigc::mem_fun (*this, &TimeAxisView::color_handler)); + UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &TimeAxisView::color_handler)); GhostRegion::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&TimeAxisView::erase_ghost, this, _1), gui_context()); } @@ -1055,7 +1056,7 @@ TimeAxisView::get_selection_rect (uint32_t id) rect->rect = new ArdourCanvas::Rectangle (selection_group); CANVAS_DEBUG_NAME (rect->rect, "selection rect"); rect->rect->set_outline (false); - rect->rect->set_fill_color (ARDOUR_UI::config()->color_mod ("selection rect", "selection rect")); + rect->rect->set_fill_color (UIConfiguration::instance().color_mod ("selection rect", "selection rect")); rect->start_trim = new ArdourCanvas::Rectangle (selection_group); CANVAS_DEBUG_NAME (rect->start_trim, "selection rect start trim"); @@ -1220,26 +1221,26 @@ TimeAxisView::color_handler () for (list::iterator i = used_selection_rects.begin(); i != used_selection_rects.end(); ++i) { - (*i)->rect->set_fill_color (ARDOUR_UI::config()->color_mod ("selection rect", "selection rect")); - (*i)->rect->set_outline_color (ARDOUR_UI::config()->color ("selection")); + (*i)->rect->set_fill_color (UIConfiguration::instance().color_mod ("selection rect", "selection rect")); + (*i)->rect->set_outline_color (UIConfiguration::instance().color ("selection")); - (*i)->start_trim->set_fill_color (ARDOUR_UI::config()->color ("selection")); - (*i)->start_trim->set_outline_color (ARDOUR_UI::config()->color ("selection")); + (*i)->start_trim->set_fill_color (UIConfiguration::instance().color ("selection")); + (*i)->start_trim->set_outline_color (UIConfiguration::instance().color ("selection")); - (*i)->end_trim->set_fill_color (ARDOUR_UI::config()->color ("selection")); - (*i)->end_trim->set_outline_color (ARDOUR_UI::config()->color ("selection")); + (*i)->end_trim->set_fill_color (UIConfiguration::instance().color ("selection")); + (*i)->end_trim->set_outline_color (UIConfiguration::instance().color ("selection")); } for (list::iterator i = free_selection_rects.begin(); i != free_selection_rects.end(); ++i) { - (*i)->rect->set_fill_color (ARDOUR_UI::config()->color_mod ("selection rect", "selection rect")); - (*i)->rect->set_outline_color (ARDOUR_UI::config()->color ("selection")); + (*i)->rect->set_fill_color (UIConfiguration::instance().color_mod ("selection rect", "selection rect")); + (*i)->rect->set_outline_color (UIConfiguration::instance().color ("selection")); - (*i)->start_trim->set_fill_color (ARDOUR_UI::config()->color ("selection")); - (*i)->start_trim->set_outline_color (ARDOUR_UI::config()->color ("selection")); + (*i)->start_trim->set_fill_color (UIConfiguration::instance().color ("selection")); + (*i)->start_trim->set_outline_color (UIConfiguration::instance().color ("selection")); - (*i)->end_trim->set_fill_color (ARDOUR_UI::config()->color ("selection")); - (*i)->end_trim->set_outline_color (ARDOUR_UI::config()->color ("selection")); + (*i)->end_trim->set_fill_color (UIConfiguration::instance().color ("selection")); + (*i)->end_trim->set_outline_color (UIConfiguration::instance().color ("selection")); } } diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc index d9e7a22b86..ec9b7263c8 100644 --- a/gtk2_ardour/time_axis_view_item.cc +++ b/gtk2_ardour/time_axis_view_item.cc @@ -36,16 +36,10 @@ #include "ardour/profile.h" -#include "ardour_ui.h" -/* - * ardour_ui.h was moved up in the include list - * due to a conflicting definition of 'Rect' between - * Apple's MacTypes.h file and GTK - */ - #include "public_editor.h" #include "time_axis_view_item.h" #include "time_axis_view.h" +#include "ui_config.h" #include "utils.h" #include "rgb_macros.h" @@ -72,7 +66,7 @@ double TimeAxisViewItem::NAME_HIGHLIGHT_THRESH; void TimeAxisViewItem::set_constant_heights () { - NAME_FONT = Pango::FontDescription (ARDOUR_UI::config()->get_SmallFont()); + NAME_FONT = Pango::FontDescription (UIConfiguration::instance().get_SmallFont()); Gtk::Window win; Gtk::Label foo; @@ -95,7 +89,7 @@ TimeAxisViewItem::set_constant_heights () Y_OFFSET is measured from the top of the time axis view item. */ - if (ARDOUR_UI::config()->get_show_name_highlight()) { + if (UIConfiguration::instance().get_show_name_highlight()) { NAME_Y_OFFSET = height + 1; NAME_HIGHLIGHT_SIZE = height + 2; } else { @@ -201,13 +195,13 @@ TimeAxisViewItem::init (ArdourCanvas::Item* parent, double fpp, uint32_t base_co CANVAS_DEBUG_NAME (frame, string_compose ("frame for %1", get_item_name())); if (_recregion) { - frame->set_outline_color (ARDOUR_UI::config()->color ("recording rect")); + frame->set_outline_color (UIConfiguration::instance().color ("recording rect")); } else { - frame->set_outline_color (ARDOUR_UI::config()->color ("time axis frame")); + frame->set_outline_color (UIConfiguration::instance().color ("time axis frame")); } } - if (ARDOUR_UI::config()->get_show_name_highlight() && (visibility & ShowNameHighlight)) { + if (UIConfiguration::instance().get_show_name_highlight() && (visibility & ShowNameHighlight)) { /* rectangle size will be set in ::manage_name_highlight() */ name_highlight = new ArdourCanvas::Rectangle (group); @@ -223,7 +217,7 @@ TimeAxisViewItem::init (ArdourCanvas::Item* parent, double fpp, uint32_t base_co if (visibility & ShowNameText) { name_text = new ArdourCanvas::Text (group); CANVAS_DEBUG_NAME (name_text, string_compose ("name text for %1", get_item_name())); - if (ARDOUR_UI::config()->get_show_name_highlight()) { + if (UIConfiguration::instance().get_show_name_highlight()) { name_text->set_position (ArdourCanvas::Duple (NAME_X_OFFSET, trackview.current_height() - NAME_Y_OFFSET)); } else { name_text->set_position (ArdourCanvas::Duple (NAME_X_OFFSET, NAME_Y_OFFSET)); @@ -260,7 +254,7 @@ TimeAxisViewItem::init (ArdourCanvas::Item* parent, double fpp, uint32_t base_co set_position (start, this); Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&TimeAxisViewItem::parameter_changed, this, _1), gui_context ()); - ARDOUR_UI::config()->ParameterChanged.connect (sigc::mem_fun (*this, &TimeAxisViewItem::parameter_changed)); + UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &TimeAxisViewItem::parameter_changed)); } TimeAxisViewItem::~TimeAxisViewItem() @@ -503,7 +497,7 @@ TimeAxisViewItem::set_selected(bool yn) if (!selection_frame) { selection_frame = new ArdourCanvas::Rectangle (group); selection_frame->set_fill (false); - selection_frame->set_outline_color (ARDOUR_UI::config()->color ("selected time axis frame")); + selection_frame->set_outline_color (UIConfiguration::instance().color ("selected time axis frame")); selection_frame->set_ignore_events (true); } selection_frame->set (frame->get().shrink (1.0)); @@ -555,7 +549,7 @@ TimeAxisViewItem::set_height (double height) manage_name_highlight (); if (visibility & ShowNameText) { - if (ARDOUR_UI::config()->get_show_name_highlight()) { + if (UIConfiguration::instance().get_show_name_highlight()) { name_text->set_y_position (height - NAME_Y_OFFSET); } else { name_text->set_y_position (NAME_Y_OFFSET); @@ -668,7 +662,7 @@ TimeAxisViewItem::set_name_text_color () uint32_t f; - if (ARDOUR_UI::config()->get_show_name_highlight()) { + if (UIConfiguration::instance().get_show_name_highlight()) { /* name text will always be on top of name highlight, which will always use our fill color. */ @@ -689,14 +683,14 @@ TimeAxisViewItem::get_fill_color () const const std::string mod_name = (_dragging ? "dragging region" : fill_color_name); if (_selected) { - return ARDOUR_UI::config()->color_mod ("selected region base", mod_name); + return UIConfiguration::instance().color_mod ("selected region base", mod_name); } else if (_recregion) { - return ARDOUR_UI::config()->color ("recording rect"); - } else if ((!ARDOUR_UI::config()->get_show_name_highlight() || high_enough_for_name) && - !ARDOUR_UI::config()->get_color_regions_using_track_color()) { - return ARDOUR_UI::config()->color_mod (fill_color_name, mod_name); + return UIConfiguration::instance().color ("recording rect"); + } else if ((!UIConfiguration::instance().get_show_name_highlight() || high_enough_for_name) && + !UIConfiguration::instance().get_color_regions_using_track_color()) { + return UIConfiguration::instance().color_mod (fill_color_name, mod_name); } - return ARDOUR_UI::config()->color_mod (fill_color, mod_name); + return UIConfiguration::instance().color_mod (fill_color, mod_name); } /** @@ -713,14 +707,14 @@ TimeAxisViewItem::set_frame_color() set_frame_gradient (); if (!_recregion) { - frame->set_outline_color (ARDOUR_UI::config()->color ("time axis frame")); + frame->set_outline_color (UIConfiguration::instance().color ("time axis frame")); } } void TimeAxisViewItem::set_frame_gradient () { - if (ARDOUR_UI::config()->get_timeline_item_gradient_depth() == 0.0) { + if (UIConfiguration::instance().get_timeline_item_gradient_depth() == 0.0) { frame->set_gradient (ArdourCanvas::Fill::StopList (), 0); return; } @@ -739,7 +733,7 @@ TimeAxisViewItem::set_frame_gradient () ArdourCanvas::color_to_hsv (f, h, s, v); - v = min (1.0, v * (1.0 - ARDOUR_UI::config()->get_timeline_item_gradient_depth())); + v = min (1.0, v * (1.0 - UIConfiguration::instance().get_timeline_item_gradient_depth())); ArdourCanvas::Color darker = ArdourCanvas::hsva_to_color (h, s, v, a); stops.push_back (std::make_pair (1.0, darker)); @@ -762,11 +756,11 @@ TimeAxisViewItem::set_trim_handle_colors() #else if (frame_handle_start) { if (position_locked) { - frame_handle_start->set_fill_color (ARDOUR_UI::config()->get_TrimHandleLocked()); - frame_handle_end->set_fill_color (ARDOUR_UI::config()->get_TrimHandleLocked()); + frame_handle_start->set_fill_color (UIConfiguration::instance().get_TrimHandleLocked()); + frame_handle_end->set_fill_color (UIConfiguration::instance().get_TrimHandleLocked()); } else { - frame_handle_start->set_fill_color (ARDOUR_UI::config()->get_TrimHandle()); - frame_handle_end->set_fill_color (ARDOUR_UI::config()->get_TrimHandle()); + frame_handle_start->set_fill_color (UIConfiguration::instance().get_TrimHandle()); + frame_handle_end->set_fill_color (UIConfiguration::instance().get_TrimHandle()); } } #endif @@ -834,8 +828,8 @@ TimeAxisViewItem::reset_width_dependent_items (double pixel_width) if (!vestigial_frame) { vestigial_frame = new ArdourCanvas::Rectangle (group, ArdourCanvas::Rect (0.0, 0.0, 2.0, trackview.current_height())); CANVAS_DEBUG_NAME (vestigial_frame, string_compose ("vestigial frame for %1", get_item_name())); - vestigial_frame->set_outline_color (ARDOUR_UI::config()->color ("vestigial frame")); - vestigial_frame->set_fill_color (ARDOUR_UI::config()->color ("vestigial frame")); + vestigial_frame->set_outline_color (UIConfiguration::instance().color ("vestigial frame")); + vestigial_frame->set_fill_color (UIConfiguration::instance().color ("vestigial frame")); vestigial_frame->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::LEFT|ArdourCanvas::Rectangle::RIGHT)); } diff --git a/gtk2_ardour/ui_config.cc b/gtk2_ardour/ui_config.cc index cc8a737cd9..83c2fd0540 100644 --- a/gtk2_ardour/ui_config.cc +++ b/gtk2_ardour/ui_config.cc @@ -62,13 +62,15 @@ using namespace ArdourCanvas; static const char* ui_config_file_name = "ui_config"; static const char* default_ui_config_file_name = "default_ui_config"; -UIConfiguration* UIConfiguration::_instance = 0; static const double hue_width = 18.0; -sigc::signal UIConfiguration::ColorsChanged; - -sigc::signal UIConfiguration::DPIReset; +UIConfiguration& +UIConfiguration::instance () +{ + static UIConfiguration s_instance; + return s_instance; +} UIConfiguration::UIConfiguration () : @@ -86,8 +88,6 @@ UIConfiguration::UIConfiguration () modifiers_modified (false), block_save (0) { - _instance = this; - load_state(); ColorsChanged.connect (boost::bind (&UIConfiguration::colors_changed, this)); diff --git a/gtk2_ardour/ui_config.h b/gtk2_ardour/ui_config.h index 0a6e7cda5d..c869dfb420 100644 --- a/gtk2_ardour/ui_config.h +++ b/gtk2_ardour/ui_config.h @@ -37,11 +37,12 @@ class UIConfiguration : public PBD::Stateful { - public: +private: UIConfiguration(); ~UIConfiguration(); - static UIConfiguration* instance() { return _instance; } + public: + static UIConfiguration& instance(); void load_rc_file (bool themechange, bool allow_own = true); @@ -76,14 +77,14 @@ class UIConfiguration : public PBD::Stateful ArdourCanvas::HSV color_hsv (const std::string&) const; ArdourCanvas::SVAModifier modifier (const std::string&) const; - static sigc::signal ColorsChanged; + sigc::signal ColorsChanged; void reset_dpi (); void set_pango_fontsize (); float get_ui_scale (); - static sigc::signal DPIReset; + sigc::signal DPIReset; sigc::signal ParameterChanged; void map_parameters (boost::function&); @@ -130,8 +131,6 @@ class UIConfiguration : public PBD::Stateful bool colors_modified; bool modifiers_modified; - static UIConfiguration* _instance; - int store_color_theme (); void load_color_aliases (XMLNode const &); void load_colors (XMLNode const &); diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index 66c6fb6371..032dd794b8 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -46,7 +46,6 @@ #include "canvas/item.h" #include "canvas/utils.h" -#include "ardour_ui.h" #include "debug.h" #include "public_editor.h" #include "keyboard.h" @@ -54,6 +53,7 @@ #include "i18n.h" #include "rgb_macros.h" #include "gui_thread.h" +#include "ui_config.h" using namespace std; using namespace Gtk; diff --git a/gtk2_ardour/verbose_cursor.cc b/gtk2_ardour/verbose_cursor.cc index ff0f7429f9..84d75d2451 100644 --- a/gtk2_ardour/verbose_cursor.cc +++ b/gtk2_ardour/verbose_cursor.cc @@ -26,12 +26,13 @@ #include "canvas/scroll_group.h" #include "canvas/tracking_text.h" -#include "ardour_ui.h" #include "audio_clock.h" #include "editor.h" #include "editor_drag.h" #include "main_clock.h" #include "verbose_cursor.h" +#include "ardour_ui.h" +#include "ui_config.h" #include "i18n.h" @@ -43,16 +44,16 @@ VerboseCursor::VerboseCursor (Editor* editor) { _canvas_item = new ArdourCanvas::TrackingText (_editor->get_noscroll_group()); CANVAS_DEBUG_NAME (_canvas_item, "verbose canvas cursor"); - _canvas_item->set_font_description (Pango::FontDescription (ARDOUR_UI::config()->get_LargerBoldFont())); + _canvas_item->set_font_description (Pango::FontDescription (UIConfiguration::instance().get_LargerBoldFont())); color_handler (); - UIConfiguration::ColorsChanged.connect (sigc::mem_fun (*this, &VerboseCursor::color_handler)); + UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &VerboseCursor::color_handler)); } void VerboseCursor::color_handler () { - _canvas_item->set_color (ARDOUR_UI::config()->color_mod ("verbose canvas cursor", "verbose canvas cursor")); + _canvas_item->set_color (UIConfiguration::instance().color_mod ("verbose canvas cursor", "verbose canvas cursor")); } ArdourCanvas::Item * -- 2.30.2