From 83f385d26336f58c1b2e3ce49c609fe86878b56d Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 2 Jun 2011 17:50:37 +0000 Subject: [PATCH] audio clock switchover part2: remove most egregious include-time dependency on audio_clock.h, and alter API for a few utilities along the way git-svn-id: svn://localhost/ardour2/branches/3.0@9673 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/ardour3_ui_dark.rc.in | 10 +++- gtk2_ardour/ardour_ui.cc | 92 ++++++++++++++--------------- gtk2_ardour/ardour_ui.h | 11 ++-- gtk2_ardour/ardour_ui2.cc | 18 +++--- gtk2_ardour/ardour_ui_dialogs.cc | 10 ++-- gtk2_ardour/ardour_ui_ed.cc | 10 ++-- gtk2_ardour/ardour_ui_options.cc | 13 ++-- gtk2_ardour/automation_time_axis.cc | 6 +- gtk2_ardour/automation_time_axis.h | 2 +- gtk2_ardour/editor.cc | 35 +++++------ gtk2_ardour/editor.h | 6 +- gtk2_ardour/editor_regions.cc | 5 +- gtk2_ardour/marker.cc | 4 +- gtk2_ardour/marker.h | 2 +- gtk2_ardour/region_view.cc | 2 +- gtk2_ardour/sfdb_ui.cc | 2 +- gtk2_ardour/strip_silence_dialog.cc | 30 ++++++---- gtk2_ardour/strip_silence_dialog.h | 5 +- gtk2_ardour/time_axis_view_item.cc | 6 +- gtk2_ardour/time_axis_view_item.h | 2 +- gtk2_ardour/utils.cc | 6 +- gtk2_ardour/utils.h | 2 +- gtk2_ardour/verbose_cursor.cc | 22 ++++--- libs/gtkmm2ext/gtkmm2ext/utils.h | 2 +- libs/gtkmm2ext/utils.cc | 6 +- 25 files changed, 161 insertions(+), 148 deletions(-) diff --git a/gtk2_ardour/ardour3_ui_dark.rc.in b/gtk2_ardour/ardour3_ui_dark.rc.in index a3fd394136..128e8828cd 100644 --- a/gtk2_ardour/ardour3_ui_dark.rc.in +++ b/gtk2_ardour/ardour3_ui_dark.rc.in @@ -944,12 +944,14 @@ style "transport_clock_display" { font_name = "@FONT_BOLD_BIGGER@" - fg[NORMAL] = darker (@@COLPREFIX@_contrasting_indicator) fg[ACTIVE] = darker(@@COLPREFIX@_bright_indicator) fg[SELECTED] = darker(@@COLPREFIX@_bright_indicator) fg[PRELIGHT] = darker(@@COLPREFIX@_bright_indicator) fg[INSENSITIVE] = darker(@@COLPREFIX@_bright_indicator) + text[NORMAL] = darker (@@COLPREFIX@_contrasting_indicator) + text[ACTIVE] = darker (@@COLPREFIX@_bright_indicator) + base[NORMAL] = @@COLPREFIX@_darkest base[ACTIVE] = @@COLPREFIX@_darkest bg[NORMAL] = @@COLPREFIX@_darkest @@ -963,6 +965,8 @@ style "transport_clock_display_delta" = "transport_clock_display" style "tempo_meter_clock_display" = "very_small_text" { + text[NORMAL] = @@COLPREFIX@_fg + text[ACTIVE] = @@COLPREFIX@_somewhat_bright_indicator fg[NORMAL] = @@COLPREFIX@_fg fg[ACTIVE] = @@COLPREFIX@_somewhat_bright_indicator fg[SELECTED] = @@COLPREFIX@_bright_indicator @@ -974,6 +978,8 @@ style "tempo_meter_clock_display" = "very_small_text" style "default_clock_display" = "medium_text" { + text[NORMAL] = @@COLPREFIX@_contrasting_indicator + text[ACTIVE] = @@COLPREFIX@_bright_indicator fg[NORMAL] = @@COLPREFIX@_contrasting_indicator fg[ACTIVE] = @@COLPREFIX@_bright_indicator fg[SELECTED] = @@COLPREFIX@_bright_indicator @@ -986,6 +992,8 @@ style "default_clock_display" = "medium_text" style "white_on_black_clock_display" = "medium_text" { + text[NORMAL] = @@COLPREFIX@_fg + text[ACTIVE] = @@COLPREFIX@_bright_indicator fg[NORMAL] = @@COLPREFIX@_fg fg[ACTIVE] = @@COLPREFIX@_bright_indicator fg[SELECTED] = @@COLPREFIX@_bright_indicator diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 1a22db660a..1fa4b21b56 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -131,52 +131,52 @@ bool could_be_a_valid_path (const string& path); ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[]) - : Gtkmm2ext::UI (PROGRAM_NAME, argcp, argvp), + : Gtkmm2ext::UI (PROGRAM_NAME, argcp, argvp) - primary_clock (X_("primary"), false, X_("TransportClockDisplay"), true, true, false, true), - secondary_clock (X_("secondary"), false, X_("SecondaryClockDisplay"), true, true, false, true), - preroll_clock (X_("preroll"), false, X_("PreRollClock"), true, false, true), - postroll_clock (X_("postroll"), false, X_("PostRollClock"), true, false, true), + , primary_clock (new AudioClock (X_("primary"), false, X_("TransportClockDisplay"), true, true, false, true)) + , secondary_clock (new AudioClock (X_("secondary"), false, X_("SecondaryClockDisplay"), true, true, false, true)) + , preroll_clock (new AudioClock (X_("preroll"), false, X_("PreRollClock"), true, false, true)) + , postroll_clock (new AudioClock (X_("postroll"), false, X_("PostRollClock"), true, false, true)) /* preroll stuff */ - preroll_button (_("pre\nroll")), - postroll_button (_("post\nroll")), + , preroll_button (_("pre\nroll")) + , postroll_button (_("post\nroll")) /* big clock */ - big_clock (X_("bigclock"), false, "BigClockNonRecording", true, true, false, false), + , big_clock (new AudioClock (X_("bigclock"), false, "BigClockNonRecording", true, true, false, false)) /* transport */ - roll_controllable (new TransportControllable ("transport roll", *this, TransportControllable::Roll)), - stop_controllable (new TransportControllable ("transport stop", *this, TransportControllable::Stop)), - goto_start_controllable (new TransportControllable ("transport goto start", *this, TransportControllable::GotoStart)), - goto_end_controllable (new TransportControllable ("transport goto end", *this, TransportControllable::GotoEnd)), - auto_loop_controllable (new TransportControllable ("transport auto loop", *this, TransportControllable::AutoLoop)), - play_selection_controllable (new TransportControllable ("transport play selection", *this, TransportControllable::PlaySelection)), - rec_controllable (new TransportControllable ("transport rec-enable", *this, TransportControllable::RecordEnable)), + , roll_controllable (new TransportControllable ("transport roll", *this, TransportControllable::Roll)) + , stop_controllable (new TransportControllable ("transport stop", *this, TransportControllable::Stop)) + , goto_start_controllable (new TransportControllable ("transport goto start", *this, TransportControllable::GotoStart)) + , goto_end_controllable (new TransportControllable ("transport goto end", *this, TransportControllable::GotoEnd)) + , auto_loop_controllable (new TransportControllable ("transport auto loop", *this, TransportControllable::AutoLoop)) + , play_selection_controllable (new TransportControllable ("transport play selection", *this, TransportControllable::PlaySelection)) + , rec_controllable (new TransportControllable ("transport rec-enable", *this, TransportControllable::RecordEnable)) - roll_button (roll_controllable), - stop_button (stop_controllable), - goto_start_button (goto_start_controllable), - goto_end_button (goto_end_controllable), - auto_loop_button (auto_loop_controllable), - play_selection_button (play_selection_controllable), - rec_button (rec_controllable), + , roll_button (roll_controllable) + , stop_button (stop_controllable) + , goto_start_button (goto_start_controllable) + , goto_end_button (goto_end_controllable) + , auto_loop_button (auto_loop_controllable) + , play_selection_button (play_selection_controllable) + , rec_button (rec_controllable) - punch_in_button (_("Punch In")), - punch_out_button (_("Punch Out")), - auto_return_button (_("Auto Return")), - auto_play_button (_("Auto Play")), - auto_input_button (_("Auto Input")), - click_button (_("Click")), - time_master_button (_("time\nmaster")), + , punch_in_button (_("Punch In")) + , punch_out_button (_("Punch Out")) + , auto_return_button (_("Auto Return")) + , auto_play_button (_("Auto Play")) + , auto_input_button (_("Auto Input")) + , click_button (_("Click")) + , time_master_button (_("time\nmaster")) - auditioning_alert_button (_("AUDITION")), - solo_alert_button (_("SOLO")), + , auditioning_alert_button (_("AUDITION")) + , solo_alert_button (_("SOLO")) - error_log_button (_("Errors")) + , error_log_button (_("Errors")) { using namespace Gtk::Menu_Helpers; @@ -442,11 +442,11 @@ ARDOUR_UI::post_engine () /* set default clock modes */ if (Profile->get_sae()) { - primary_clock.set_mode (AudioClock::BBT); - secondary_clock.set_mode (AudioClock::MinSec); + primary_clock->set_mode (AudioClock::BBT); + secondary_clock->set_mode (AudioClock::MinSec); } else { - primary_clock.set_mode (AudioClock::Timecode); - secondary_clock.set_mode (AudioClock::BBT); + primary_clock->set_mode (AudioClock::Timecode); + secondary_clock->set_mode (AudioClock::BBT); } /* start the time-of-day-clock */ @@ -2178,7 +2178,7 @@ void ARDOUR_UI::primary_clock_value_changed () { if (_session) { - _session->request_locate (primary_clock.current_time ()); + _session->request_locate (primary_clock->current_time ()); } } @@ -2186,7 +2186,7 @@ void ARDOUR_UI::big_clock_value_changed () { if (_session) { - _session->request_locate (big_clock.current_time ()); + _session->request_locate (big_clock->current_time ()); } } @@ -2194,7 +2194,7 @@ void ARDOUR_UI::secondary_clock_value_changed () { if (_session) { - _session->request_locate (secondary_clock.current_time ()); + _session->request_locate (secondary_clock->current_time ()); } } @@ -3409,19 +3409,19 @@ void ARDOUR_UI::update_transport_clocks (framepos_t pos) { if (Config->get_primary_clock_delta_edit_cursor()) { - primary_clock.set (pos, false, editor->get_preferred_edit_position(), 1); + primary_clock->set (pos, false, editor->get_preferred_edit_position(), 1); } else { - primary_clock.set (pos, 0, true); + primary_clock->set (pos, 0, true); } if (Config->get_secondary_clock_delta_edit_cursor()) { - secondary_clock.set (pos, false, editor->get_preferred_edit_position(), 2); + secondary_clock->set (pos, false, editor->get_preferred_edit_position(), 2); } else { - secondary_clock.set (pos); + secondary_clock->set (pos); } if (big_clock_window->get()) { - big_clock.set (pos); + big_clock->set (pos); } } @@ -3455,9 +3455,9 @@ ARDOUR_UI::record_state_changed () bool const h = _session->have_rec_enabled_track (); if (r == Session::Recording && h) { - big_clock.set_widget_name ("BigClockRecording"); + big_clock->set_widget_name ("BigClockRecording"); } else { - big_clock.set_widget_name ("BigClockNonRecording"); + big_clock->set_widget_name ("BigClockNonRecording"); } } diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 423189c3ed..6d96827971 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -63,7 +63,6 @@ #include "ardour/utils.h" #include "ardour/session_handle.h" -#include "audio_clock.h" #include "ardour_dialog.h" #include "editing.h" #include "ui_config.h" @@ -193,10 +192,10 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr void xrun_handler (framepos_t); void create_xrun_marker (framepos_t); - AudioClock primary_clock; - AudioClock secondary_clock; - AudioClock preroll_clock; - AudioClock postroll_clock; + AudioClock* primary_clock; + AudioClock* secondary_clock; + AudioClock* preroll_clock; + AudioClock* postroll_clock; void store_clock_modes (); void restore_clock_modes (); @@ -337,7 +336,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr void manage_window (Gtk::Window&); - AudioClock big_clock; + AudioClock* big_clock; ActionWindowProxy* big_clock_window; int original_big_clock_width; int original_big_clock_height; diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index 2cbd70ed37..80ef975b91 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -318,9 +318,9 @@ ARDOUR_UI::setup_transport () ARDOUR_UI::Clock.connect (sigc::bind (sigc::mem_fun (primary_clock, &AudioClock::set), 'p')); ARDOUR_UI::Clock.connect (sigc::bind (sigc::mem_fun (secondary_clock, &AudioClock::set), 's')); - primary_clock.ValueChanged.connect (sigc::mem_fun(*this, &ARDOUR_UI::primary_clock_value_changed)); - secondary_clock.ValueChanged.connect (sigc::mem_fun(*this, &ARDOUR_UI::secondary_clock_value_changed)); - big_clock.ValueChanged.connect (sigc::mem_fun(*this, &ARDOUR_UI::big_clock_value_changed)); + primary_clock->ValueChanged.connect (sigc::mem_fun(*this, &ARDOUR_UI::primary_clock_value_changed)); + secondary_clock->ValueChanged.connect (sigc::mem_fun(*this, &ARDOUR_UI::secondary_clock_value_changed)); + big_clock->ValueChanged.connect (sigc::mem_fun(*this, &ARDOUR_UI::big_clock_value_changed)); ActionManager::get_action ("Transport", "ToggleAutoReturn")->connect_proxy (auto_return_button); ActionManager::get_action ("Transport", "ToggleAutoPlay")->connect_proxy (auto_play_button); @@ -334,10 +334,10 @@ ARDOUR_UI::setup_transport () preroll_button.set_name ("TransportButton"); postroll_button.set_name ("TransportButton"); - preroll_clock.set_mode (AudioClock::MinSec); - preroll_clock.set_name ("TransportClockDisplay"); - postroll_clock.set_mode (AudioClock::MinSec); - postroll_clock.set_name ("TransportClockDisplay"); + preroll_clock->set_mode (AudioClock::MinSec); + preroll_clock->set_name ("TransportClockDisplay"); + postroll_clock->set_mode (AudioClock::MinSec); + postroll_clock->set_name ("TransportClockDisplay"); /* alerts */ @@ -385,9 +385,9 @@ ARDOUR_UI::setup_transport () transport_hbox->pack_start (rec_button, false, false, 6); HBox* clock_box = manage (new HBox); - clock_box->pack_start (primary_clock, false, false); + clock_box->pack_start (*primary_clock, false, false); if (!ARDOUR::Profile->get_small_screen()) { - clock_box->pack_start (secondary_clock, false, false); + clock_box->pack_start (*secondary_clock, false, false); } if (!Profile->get_sae()) { diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc index 712c3da99b..903df41336 100644 --- a/gtk2_ardour/ardour_ui_dialogs.cc +++ b/gtk2_ardour/ardour_ui_dialogs.cc @@ -92,11 +92,11 @@ ARDOUR_UI::set_session (Session *s) } } - primary_clock.set_session (s); - secondary_clock.set_session (s); - big_clock.set_session (s); - preroll_clock.set_session (s); - postroll_clock.set_session (s); + primary_clock->set_session (s); + secondary_clock->set_session (s); + big_clock->set_session (s); + preroll_clock->set_session (s); + postroll_clock->set_session (s); /* sensitize menu bar options that are now valid */ diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index b762348f1d..a7cbb22dfd 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -591,7 +591,7 @@ ARDOUR_UI::setup_clock () big_clock_window->get()->set_keep_above (true); big_clock_window->get()->set_border_width (0); - big_clock_window->get()->add (big_clock); + big_clock_window->get()->add (*big_clock); big_clock_window->get()->set_title (_("Big Clock")); big_clock_window->get()->set_type_hint (Gdk::WINDOW_TYPE_HINT_UTILITY); @@ -614,7 +614,7 @@ ARDOUR_UI::big_clock_realized () original_big_clock_height = big_clock_height; original_big_clock_width = w; - Pango::FontDescription fd (big_clock.get_style()->get_font()); + Pango::FontDescription fd (big_clock->get_style()->get_font()); original_big_clock_font_size = fd.get_size (); if (!fd.get_size_is_absolute ()) { @@ -651,7 +651,7 @@ ARDOUR_UI::idle_big_clock_text_resizer (int, int) big_clock_resize_in_progress = false; Glib::RefPtr win = big_clock_window->get()->get_window(); - Pango::FontDescription fd (big_clock.get_style()->get_font()); + Pango::FontDescription fd (big_clock->get_style()->get_font()); int current_size = fd.get_size (); int x, y, w, h, d; @@ -674,9 +674,9 @@ ARDOUR_UI::idle_big_clock_text_resizer (int, int) try { Pango::FontDescription fd (buf); - Glib::RefPtr rcstyle = big_clock.get_modifier_style (); + Glib::RefPtr rcstyle = big_clock->get_modifier_style (); rcstyle->set_font (fd); - big_clock.modify_style (rcstyle); + big_clock->modify_style (rcstyle); } catch (...) { diff --git a/gtk2_ardour/ardour_ui_options.cc b/gtk2_ardour/ardour_ui_options.cc index 5bcecfaef5..bde57f4385 100644 --- a/gtk2_ardour/ardour_ui_options.cc +++ b/gtk2_ardour/ardour_ui_options.cc @@ -35,6 +35,7 @@ #include "ardour/osc.h" #endif +#include "audio_clock.h" #include "ardour_ui.h" #include "actions.h" #include "gui_thread.h" @@ -395,9 +396,9 @@ ARDOUR_UI::parameter_changed (std::string p) } else if (p == "show-track-meters") { editor->toggle_meter_updating(); } else if (p == "primary-clock-delta-edit-cursor") { - primary_clock.set_is_duration (Config->get_primary_clock_delta_edit_cursor()); + primary_clock->set_is_duration (Config->get_primary_clock_delta_edit_cursor()); } else if (p == "secondary-clock-delta-edit-cursor") { - secondary_clock.set_is_duration (Config->get_secondary_clock_delta_edit_cursor()); + secondary_clock->set_is_duration (Config->get_secondary_clock_delta_edit_cursor()); } } @@ -407,11 +408,11 @@ ARDOUR_UI::reset_main_clocks () ENSURE_GUI_THREAD (*this, &ARDOUR_UI::reset_main_clocks) if (_session) { - primary_clock.set (_session->audible_frame(), true); - secondary_clock.set (_session->audible_frame(), true); + primary_clock->set (_session->audible_frame(), true); + secondary_clock->set (_session->audible_frame(), true); } else { - primary_clock.set (0, true); - secondary_clock.set (0, true); + primary_clock->set (0, true); + secondary_clock->set (0, true); } } diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index 43eae4e031..bd882719be 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -49,7 +49,7 @@ using namespace Gtk; using namespace Gtkmm2ext; using namespace Editing; -Pango::FontDescription* AutomationTimeAxisView::name_font = 0; +Pango::FontDescription AutomationTimeAxisView::name_font; bool AutomationTimeAxisView::have_name_font = false; const string AutomationTimeAxisView::state_node_name = "AutomationChild"; @@ -153,7 +153,7 @@ AutomationTimeAxisView::AutomationTimeAxisView ( bool shortened = false; int ignore_width; - shortpname = fit_to_pixels (_name, 60, *name_font, ignore_width, true); + shortpname = fit_to_pixels (_name, 60, name_font, ignore_width, true); if (shortpname != _name ){ shortened = true; @@ -167,7 +167,7 @@ AutomationTimeAxisView::AutomationTimeAxisView ( /* limit the plug name string */ - string pname = fit_to_pixels (nomparent, 60, *name_font, ignore_width, true); + string pname = fit_to_pixels (nomparent, 60, name_font, ignore_width, true); if (pname != nomparent) { shortened = true; } diff --git a/gtk2_ardour/automation_time_axis.h b/gtk2_ardour/automation_time_axis.h index d1a465238a..47d1d70d73 100644 --- a/gtk2_ardour/automation_time_axis.h +++ b/gtk2_ardour/automation_time_axis.h @@ -189,7 +189,7 @@ class AutomationTimeAxisView : public TimeAxisView { //void set_colors (); void color_handler (); - static Pango::FontDescription* name_font; + static Pango::FontDescription name_font; static bool have_name_font; private: diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index dcf97ffaa8..3e5a172468 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -77,6 +77,7 @@ #include "control_protocol/control_protocol.h" +#include "audio_clock.h" #include "editor.h" #include "debug.h" #include "keyboard.h" @@ -260,7 +261,7 @@ Editor::Editor () /* tool bar related */ - , zoom_range_clock (X_("zoomrange"), false, X_("ZoomRangeClock"), true, false, true) + , zoom_range_clock (new AudioClock (X_("zoomrange"), false, X_("ZoomRangeClock"), true, false, true)) , toolbar_selection_clock_table (2,3) @@ -276,7 +277,7 @@ Editor::Editor () /* nudge */ - , nudge_clock (X_("nudge"), false, X_("NudgeClock"), true, false, true) + , nudge_clock (new AudioClock (X_("nudge"), false, X_("NudgeClock"), true, false, true)) , meters_running(false) , _pending_locate_request (false) , _pending_initial_locate (false) @@ -387,7 +388,7 @@ Editor::Editor () zoom_focus = ZoomFocusLeft; set_zoom_focus (ZoomFocusLeft); - zoom_range_clock.ValueChanged.connect (sigc::mem_fun(*this, &Editor::zoom_adjustment_changed)); + zoom_range_clock->ValueChanged.connect (sigc::mem_fun(*this, &Editor::zoom_adjustment_changed)); bbt_label.set_name ("EditorTimeButton"); bbt_label.set_size_request (-1, (int)timebar_height); @@ -896,14 +897,14 @@ Editor::zoom_adjustment_changed () return; } - double fpu = zoom_range_clock.current_duration() / _canvas_width; + double fpu = zoom_range_clock->current_duration() / _canvas_width; if (fpu < 1.0) { fpu = 1.0; - zoom_range_clock.set ((framepos_t) floor (fpu * _canvas_width)); + zoom_range_clock->set ((framepos_t) floor (fpu * _canvas_width)); } else if (fpu > _session->current_end_frame() / _canvas_width) { fpu = _session->current_end_frame() / _canvas_width; - zoom_range_clock.set ((framepos_t) floor (fpu * _canvas_width)); + zoom_range_clock->set ((framepos_t) floor (fpu * _canvas_width)); } temporal_zoom (fpu); @@ -1084,9 +1085,9 @@ Editor::set_session (Session *t) return; } - zoom_range_clock.set_session (_session); + zoom_range_clock->set_session (_session); _playlist_selector->set_session (_session); - nudge_clock.set_session (_session); + nudge_clock->set_session (_session); _summary->set_session (_session); _group_tabs->set_session (_session); _route_groups->set_session (_session); @@ -1145,11 +1146,11 @@ Editor::set_session (Session *t) bbt.beats = 0; bbt.ticks = 120; framepos_t pos = _session->tempo_map().bbt_duration_at (0, bbt, 1); - nudge_clock.set_mode(AudioClock::BBT); - nudge_clock.set (pos, true, 0, AudioClock::BBT); + nudge_clock->set_mode(AudioClock::BBT); + nudge_clock->set (pos, true, 0, AudioClock::BBT); } else { - nudge_clock.set (_session->frame_rate() * 5, true, 0, AudioClock::Timecode); // default of 5 seconds + nudge_clock->set (_session->frame_rate() * 5, true, 0, AudioClock::Timecode); // default of 5 seconds } playhead_cursor->canvas_item.show (); @@ -2907,7 +2908,7 @@ Editor::setup_toolbar () nudge_box->pack_start (nudge_backward_button, false, false); nudge_box->pack_start (nudge_forward_button, false, false); - nudge_box->pack_start (nudge_clock, false, false); + nudge_box->pack_start (*nudge_clock, false, false); /* Pack everything in... */ @@ -3821,7 +3822,7 @@ Editor::get_nudge_distance (framepos_t pos, framecnt_t& next) { framecnt_t ret; - ret = nudge_clock.current_duration (pos); + ret = nudge_clock->current_duration (pos); next = ret + 1; /* XXXX fix me */ return ret; @@ -4254,8 +4255,8 @@ Editor::post_zoom () framepos_t frames = (framepos_t) floor (frames_per_unit * _canvas_width); - if (frames_per_unit != zoom_range_clock.current_duration()) { - zoom_range_clock.set (frames); + if (frames_per_unit != zoom_range_clock->current_duration()) { + zoom_range_clock->set (frames); } if (mouse_mode == MouseRange && selection->time.start () != selection->time.end_frame ()) { @@ -5349,8 +5350,8 @@ Editor::session_going_away () } track_views.clear (); - zoom_range_clock.set_session (0); - nudge_clock.set_session (0); + zoom_range_clock->set_session (0); + nudge_clock->set_session (0); editor_list_button.set_active(false); editor_list_button.set_sensitive(false); diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index e0fc037054..d38238acbf 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -51,7 +51,6 @@ #include "ardour/location.h" #include "ardour/types.h" -#include "audio_clock.h" #include "gtk-custom-ruler.h" #include "ardour_dialog.h" #include "public_editor.h" @@ -95,6 +94,7 @@ namespace LADSPA { } class AnalysisWindow; +class AudioClock; class AudioRegionView; class AudioStreamView; class AudioTimeAxisView; @@ -1501,7 +1501,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void editor_mixer_button_toggled (); void editor_list_button_toggled (); - AudioClock zoom_range_clock; + AudioClock* zoom_range_clock; Gtk::Button zoom_in_button; Gtk::Button zoom_out_button; Gtk::Button zoom_out_full_button; @@ -1887,7 +1887,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD Gtk::Button nudge_backward_button; Gtk::HBox nudge_hbox; Gtk::VBox nudge_vbox; - AudioClock nudge_clock; + AudioClock* nudge_clock; bool nudge_forward_release (GdkEventButton*); bool nudge_backward_release (GdkEventButton*); diff --git a/gtk2_ardour/editor_regions.cc b/gtk2_ardour/editor_regions.cc index 7f3e8142dc..b2de5c6383 100644 --- a/gtk2_ardour/editor_regions.cc +++ b/gtk2_ardour/editor_regions.cc @@ -37,6 +37,7 @@ #include "gtkmm2ext/choice.h" #include "gtkmm2ext/treeutils.h" +#include "audio_clock.h" #include "editor.h" #include "editing.h" #include "keyboard.h" @@ -174,7 +175,7 @@ EditorRegions::EditorRegions (Editor* e) // _display.signal_popup_menu().connect (sigc::bind (sigc::mem_fun (*this, &Editor::show__display_context_menu), 1, 0)); //ARDOUR_UI::instance()->secondary_clock.mode_changed.connect (sigc::mem_fun(*this, &Editor::redisplay_regions)); - ARDOUR_UI::instance()->secondary_clock.mode_changed.connect (sigc::mem_fun(*this, &EditorRegions::update_all_rows)); + ARDOUR_UI::instance()->secondary_clock->mode_changed.connect (sigc::mem_fun(*this, &EditorRegions::update_all_rows)); ARDOUR::Region::RegionPropertyChanged.connect (region_property_connection, MISSING_INVALIDATOR, ui_bind (&EditorRegions::region_changed, this, _1, _2), gui_context()); ARDOUR::RegionFactory::CheckNewRegion.connect (check_new_region_connection, MISSING_INVALIDATOR, ui_bind (&EditorRegions::add_region, this, _1), gui_context()); @@ -660,7 +661,7 @@ EditorRegions::format_position (framepos_t pos, char* buf, size_t bufsize) Timecode::BBT_Time bbt; Timecode::Time timecode; - switch (ARDOUR_UI::instance()->secondary_clock.mode ()) { + switch (ARDOUR_UI::instance()->secondary_clock->mode ()) { case AudioClock::BBT: _session->tempo_map().bbt_time (pos, bbt); snprintf (buf, bufsize, "%03d|%02d|%04d" , bbt.bars, bbt.beats, bbt.ticks); diff --git a/gtk2_ardour/marker.cc b/gtk2_ardour/marker.cc index 5b7ae840fd..351267af54 100644 --- a/gtk2_ardour/marker.cc +++ b/gtk2_ardour/marker.cc @@ -255,7 +255,7 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con Glib::RefPtr layout = foo.create_pango_layout (X_("Hg")); /* ascender + descender */ int width; - layout->set_font_description (*name_font); + layout->set_font_description (name_font); Gtkmm2ext::get_ink_pixel_size (layout, width, name_height); name_pixbuf = new ArdourCanvas::Pixbuf(*group); @@ -380,7 +380,7 @@ Marker::setup_name_display () } /* Work out how wide the name can be */ - int name_width = min ((double) pixel_width (_name, *name_font) + 2, limit); + int name_width = min ((double) pixel_width (_name, name_font) + 2, limit); if (name_width == 0) { name_width = 1; } diff --git a/gtk2_ardour/marker.h b/gtk2_ardour/marker.h index 5ac3f19240..6bf6d08f51 100644 --- a/gtk2_ardour/marker.h +++ b/gtk2_ardour/marker.h @@ -96,7 +96,7 @@ class Marker : public sigc::trackable protected: PublicEditor& editor; - Pango::FontDescription* name_font; + Pango::FontDescription name_font; ArdourCanvas::Group* _parent; ArdourCanvas::Group *group; diff --git a/gtk2_ardour/region_view.cc b/gtk2_ardour/region_view.cc index 093848c84d..0302e8f345 100644 --- a/gtk2_ardour/region_view.cc +++ b/gtk2_ardour/region_view.cc @@ -269,7 +269,7 @@ RegionView::set_silent_frames (const AudioIntervalResult& silences, double thres } _silence_text = new ArdourCanvas::NoEventText (*group); - _silence_text->property_font_desc() = *(get_font_for_style (N_("SilenceText"))); + _silence_text->property_font_desc() = get_font_for_style (N_("SilenceText")); _silence_text->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SilenceText.get(); _silence_text->property_anchor() = ANCHOR_NW; diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc index 39c8c2510d..3d1677b0b9 100644 --- a/gtk2_ardour/sfdb_ui.cc +++ b/gtk2_ardour/sfdb_ui.cc @@ -171,7 +171,7 @@ SoundFileBox::SoundFileBox (bool persistent) table.attach (length_clock, 1, 2, 4, 5, FILL, FILL); table.attach (timecode_clock, 1, 2, 5, 6, FILL, FILL); - length_clock.set_mode (ARDOUR_UI::instance()->secondary_clock.mode()); + length_clock.set_mode (ARDOUR_UI::instance()->secondary_clock->mode()); timecode_clock.set_mode (AudioClock::Timecode); main_box.pack_start (table, false, false); diff --git a/gtk2_ardour/strip_silence_dialog.cc b/gtk2_ardour/strip_silence_dialog.cc index 5863d7cde5..5f9dc6441d 100644 --- a/gtk2_ardour/strip_silence_dialog.cc +++ b/gtk2_ardour/strip_silence_dialog.cc @@ -29,6 +29,7 @@ #include "ardour_ui.h" #include "ardour/session.h" +#include "audio_clock.h" #include "gui_thread.h" #include "strip_silence_dialog.h" #include "canvas_impl.h" @@ -48,8 +49,8 @@ using namespace ArdourCanvas; StripSilenceDialog::StripSilenceDialog (Session* s, list const & v) : ArdourDialog (_("Strip Silence")) , ProgressReporter () - , _minimum_length (X_("silence duration"), true, "SilenceDurationClock", true, false, true, false) - , _fade_length (X_("silence duration"), true, "SilenceDurationClock", true, false, true, false) + , _minimum_length (new AudioClock (X_("silence duration"), true, "SilenceDurationClock", true, false, true, false)) + , _fade_length (new AudioClock (X_("silence duration"), true, "SilenceDurationClock", true, false, true, false)) , _peaks_ready_connection (0) , _destroying (false) { @@ -77,20 +78,20 @@ StripSilenceDialog::StripSilenceDialog (Session* s, list const & v) _threshold.set_value (-60); table->attach (*Gtk::manage (new Gtk::Label (_("Minimum length"), 1, 0.5)), 0, 1, n, n + 1, Gtk::FILL); - table->attach (_minimum_length, 1, 2, n, n + 1, Gtk::FILL); + table->attach (*_minimum_length, 1, 2, n, n + 1, Gtk::FILL); ++n; - _minimum_length.set_session (s); - _minimum_length.set_mode (AudioClock::Frames); - _minimum_length.set (1000, true); + _minimum_length->set_session (s); + _minimum_length->set_mode (AudioClock::Frames); + _minimum_length->set (1000, true); table->attach (*Gtk::manage (new Gtk::Label (_("Fade length"), 1, 0.5)), 0, 1, n, n + 1, Gtk::FILL); - table->attach (_fade_length, 1, 2, n, n + 1, Gtk::FILL); + table->attach (*_fade_length, 1, 2, n, n + 1, Gtk::FILL); ++n; - _fade_length.set_session (s); - _fade_length.set_mode (AudioClock::Frames); - _fade_length.set (64, true); + _fade_length->set_session (s); + _fade_length->set_mode (AudioClock::Frames); + _fade_length->set (64, true); hbox->pack_start (*table); @@ -104,7 +105,7 @@ StripSilenceDialog::StripSilenceDialog (Session* s, list const & v) show_all (); _threshold.get_adjustment()->signal_value_changed().connect (sigc::mem_fun (*this, &StripSilenceDialog::threshold_changed)); - _minimum_length.ValueChanged.connect (sigc::mem_fun (*this, &StripSilenceDialog::restart_thread)); + _minimum_length->ValueChanged.connect (sigc::mem_fun (*this, &StripSilenceDialog::restart_thread)); update_silence_rects (); update_threshold_line (); @@ -130,6 +131,9 @@ StripSilenceDialog::~StripSilenceDialog () _run_cond.signal (); pthread_join (_thread, 0); + delete _minimum_length; + delete _fade_length; + delete _peaks_ready_connection; } @@ -273,13 +277,13 @@ StripSilenceDialog::threshold_changed () framecnt_t StripSilenceDialog::minimum_length () const { - return _minimum_length.current_duration (views.front().view->region()->position()); + return _minimum_length->current_duration (views.front().view->region()->position()); } framecnt_t StripSilenceDialog::fade_length () const { - return _fade_length.current_duration (views.front().view->region()->position()); + return _fade_length->current_duration (views.front().view->region()->position()); } void diff --git a/gtk2_ardour/strip_silence_dialog.h b/gtk2_ardour/strip_silence_dialog.h index 1264525ff2..18313941c1 100644 --- a/gtk2_ardour/strip_silence_dialog.h +++ b/gtk2_ardour/strip_silence_dialog.h @@ -29,6 +29,7 @@ namespace ARDOUR { class Session; } +class AudioClock; class RegionView; /// Dialog box to set options for the `strip silence' filter @@ -63,8 +64,8 @@ private: void restart_thread (); Gtk::SpinButton _threshold; - AudioClock _minimum_length; - AudioClock _fade_length; + AudioClock* _minimum_length; + AudioClock* _fade_length; Gtk::ProgressBar _progress_bar; struct ViewInterval { diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc index 9ddfb30fd4..ce2e6c1485 100644 --- a/gtk2_ardour/time_axis_view_item.cc +++ b/gtk2_ardour/time_axis_view_item.cc @@ -50,7 +50,7 @@ using namespace PBD; using namespace ARDOUR; using namespace Gtkmm2ext; -Pango::FontDescription* TimeAxisViewItem::NAME_FONT = 0; +Pango::FontDescription TimeAxisViewItem::NAME_FONT; const double TimeAxisViewItem::NAME_X_OFFSET = 15.0; const double TimeAxisViewItem::GRAB_HANDLE_LENGTH = 6; @@ -72,7 +72,7 @@ TimeAxisViewItem::set_constant_heights () int width = 0; int height = 0; - layout->set_font_description (*NAME_FONT); + layout->set_font_description (NAME_FONT); Gtkmm2ext::get_ink_pixel_size (layout, width, height); NAME_HEIGHT = height; @@ -508,7 +508,7 @@ TimeAxisViewItem::set_name_text(const string& new_name) } last_item_width = trackview.editor().frame_to_pixel(item_duration); - name_pixbuf_width = pixel_width (new_name, *NAME_FONT) + 2; + name_pixbuf_width = pixel_width (new_name, NAME_FONT) + 2; name_pixbuf->property_pixbuf() = pixbuf_from_string(new_name, NAME_FONT, name_pixbuf_width, NAME_HEIGHT, Gdk::Color ("#000000")); } diff --git a/gtk2_ardour/time_axis_view_item.h b/gtk2_ardour/time_axis_view_item.h index e7384a8f85..5bcaa48545 100644 --- a/gtk2_ardour/time_axis_view_item.h +++ b/gtk2_ardour/time_axis_view_item.h @@ -90,7 +90,7 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList bool name_active() const { return name_connected; } // Default sizes, font and spacing - static Pango::FontDescription* NAME_FONT; + static Pango::FontDescription NAME_FONT; static void set_constant_heights (); static const double NAME_X_OFFSET; static const double GRAB_HANDLE_LENGTH; diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index 179f341470..90f7923916 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -303,7 +303,7 @@ get_canvas_points (string /*who*/, uint32_t npoints) return new ArdourCanvas::Points (npoints); } -Pango::FontDescription* +Pango::FontDescription get_font_for_style (string widgetname) { Gtk::Window window (WINDOW_TOPLEVEL); @@ -326,10 +326,10 @@ get_font_for_style (string widgetname) PangoContext* ctxt = (PangoContext*) pango_layout_get_context ((PangoLayout*) layout->gobj()); pfd = pango_context_get_font_description (ctxt); - return new Pango::FontDescription (pfd, true); /* make a copy */ + return Pango::FontDescription (pfd); /* make a copy */ } - return new Pango::FontDescription (pfd, true); /* make a copy */ + return Pango::FontDescription (pfd); /* make a copy */ } uint32_t diff --git a/gtk2_ardour/utils.h b/gtk2_ardour/utils.h index b42371f4a2..c019989d94 100644 --- a/gtk2_ardour/utils.h +++ b/gtk2_ardour/utils.h @@ -59,7 +59,7 @@ unsigned char* xpm2rgba (const char** xpm, uint32_t& w, uint32_t& h); ArdourCanvas::Points* get_canvas_points (std::string who, uint32_t npoints); -Pango::FontDescription* get_font_for_style (std::string widgetname); +Pango::FontDescription get_font_for_style (std::string widgetname); uint32_t rgba_from_style (std::string, uint32_t, uint32_t, uint32_t, uint32_t, std::string = "fg", int = Gtk::STATE_NORMAL, bool = true); diff --git a/gtk2_ardour/verbose_cursor.cc b/gtk2_ardour/verbose_cursor.cc index b51898929d..2ae215acec 100644 --- a/gtk2_ardour/verbose_cursor.cc +++ b/gtk2_ardour/verbose_cursor.cc @@ -21,11 +21,13 @@ #include #include "pbd/stacktrace.h" #include "ardour/profile.h" -#include "editor.h" + #include "ardour_ui.h" -#include "verbose_cursor.h" -#include "utils.h" +#include "audio_clock.h" +#include "editor.h" #include "editor_drag.h" +#include "utils.h" +#include "verbose_cursor.h" #include "i18n.h" @@ -38,13 +40,9 @@ VerboseCursor::VerboseCursor (Editor* editor) , _xoffset (0) , _yoffset (0) { - Pango::FontDescription* font = get_font_for_style (N_("VerboseCanvasCursor")); - _canvas_item = new ArdourCanvas::NoEventText (*_editor->track_canvas->root()); - _canvas_item->property_font_desc() = *font; + _canvas_item->property_font_desc() = get_font_for_style (N_("VerboseCanvasCursor")); _canvas_item->property_anchor() = Gtk::ANCHOR_NW; - - delete font; } ArdourCanvas::Item * @@ -131,9 +129,9 @@ VerboseCursor::set_time (framepos_t frame, double x, double y) AudioClock::Mode m; if (Profile->get_sae() || Profile->get_small_screen()) { - m = ARDOUR_UI::instance()->primary_clock.mode(); + m = ARDOUR_UI::instance()->primary_clock->mode(); } else { - m = ARDOUR_UI::instance()->secondary_clock.mode(); + m = ARDOUR_UI::instance()->secondary_clock->mode(); } switch (m) { @@ -185,9 +183,9 @@ VerboseCursor::set_duration (framepos_t start, framepos_t end, double x, double AudioClock::Mode m; if (Profile->get_sae() || Profile->get_small_screen()) { - m = ARDOUR_UI::instance()->primary_clock.mode (); + m = ARDOUR_UI::instance()->primary_clock->mode (); } else { - m = ARDOUR_UI::instance()->secondary_clock.mode (); + m = ARDOUR_UI::instance()->secondary_clock->mode (); } switch (m) { diff --git a/libs/gtkmm2ext/gtkmm2ext/utils.h b/libs/gtkmm2ext/gtkmm2ext/utils.h index 60123bb843..c92d91ae58 100644 --- a/libs/gtkmm2ext/gtkmm2ext/utils.h +++ b/libs/gtkmm2ext/gtkmm2ext/utils.h @@ -61,7 +61,7 @@ namespace Gtkmm2ext { gint vpadding); Glib::RefPtr pixbuf_from_string (const std::string& name, - Pango::FontDescription* font, + const Pango::FontDescription& font, int clip_width, int clip_height, Gdk::Color fg); diff --git a/libs/gtkmm2ext/utils.cc b/libs/gtkmm2ext/utils.cc index 878d5402af..a08c9442a3 100644 --- a/libs/gtkmm2ext/utils.cc +++ b/libs/gtkmm2ext/utils.cc @@ -184,7 +184,7 @@ convert_bgra_to_rgba (guint8 const* src, } Glib::RefPtr -Gtkmm2ext::pixbuf_from_string(const string& name, Pango::FontDescription* font, int clip_width, int clip_height, Gdk::Color fg) +Gtkmm2ext::pixbuf_from_string(const string& name, const Pango::FontDescription& font, int clip_width, int clip_height, Gdk::Color fg) { static Glib::RefPtr* empty_pixbuf = 0; @@ -203,9 +203,9 @@ Gtkmm2ext::pixbuf_from_string(const string& name, Pango::FontDescription* font, cairo_text_extents_t te; cairo_set_source_rgba (cr, fg.get_red_p(), fg.get_green_p(), fg.get_blue_p(), 1.0); - cairo_select_font_face (cr, font->get_family().c_str(), + cairo_select_font_face (cr, font.get_family().c_str(), CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); - cairo_set_font_size (cr, font->get_size() / Pango::SCALE); + cairo_set_font_size (cr, font.get_size() / Pango::SCALE); cairo_text_extents (cr, name.c_str(), &te); cairo_move_to (cr, 0.5, int (0.5 - te.height / 2 - te.y_bearing + clip_height / 2));