From 77b77b88a3db21c47cf62afae147f24298c655f3 Mon Sep 17 00:00:00 2001 From: Doug McLain Date: Thu, 5 Jul 2007 06:12:46 +0000 Subject: Delta Cursor option backported from trunk git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2111 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/ardour.menus | 3 +++ gtk2_ardour/ardour2_ui_dark.rc | 7 +++++++ gtk2_ardour/ardour2_ui_light.rc | 7 +++++++ gtk2_ardour/ardour_ui.cc | 17 +++++++++++++---- gtk2_ardour/ardour_ui.h | 4 +++- gtk2_ardour/ardour_ui2.cc | 4 ++-- gtk2_ardour/ardour_ui_ed.cc | 2 ++ gtk2_ardour/ardour_ui_options.cc | 18 +++++++++++++++++- gtk2_ardour/audio_clock.cc | 30 ++++++++++++++++++++++++++++-- gtk2_ardour/audio_clock.h | 4 +++- libs/ardour/ardour/configuration_vars.h | 2 ++ 11 files changed, 87 insertions(+), 11 deletions(-) diff --git a/gtk2_ardour/ardour.menus b/gtk2_ardour/ardour.menus index dcb79d4c0b..b872a8d500 100644 --- a/gtk2_ardour/ardour.menus +++ b/gtk2_ardour/ardour.menus @@ -361,6 +361,9 @@ + + + diff --git a/gtk2_ardour/ardour2_ui_dark.rc b/gtk2_ardour/ardour2_ui_dark.rc index 631ef4b92e..c84ec1d231 100644 --- a/gtk2_ardour/ardour2_ui_dark.rc +++ b/gtk2_ardour/ardour2_ui_dark.rc @@ -667,6 +667,11 @@ style "transport_clock_display_delta" = "transport_clock_display" fg[NORMAL] = { 0.30, 0.30, 1.0 } } +style "transport_clock_display_delta" = "transport_clock_display" +{ + fg[NORMAL] = { 0.30, 0.30, 1.0 } +} + style "tempo_meter_clock_display" { font_name = "sans 7" @@ -1523,4 +1528,6 @@ widget "*ChannelCountSelector" style:highest "medium_bold_entry" widget "*ChannelCountSelector.GtkArrow" style:highest "default_buttons_menus" widget "*RegionListWholeFile" style:highest "treeview_parent_node" widget "*EditorHScrollbar" style:highest "editor_hscrollbar" +widget "*TransportClockDisplayDelta" style:highest "transport_clock_display_delta" +widget "*SecondaryClockDisplayDelta" style:highest "transport_clock_display_delta" diff --git a/gtk2_ardour/ardour2_ui_light.rc b/gtk2_ardour/ardour2_ui_light.rc index b713af4a8f..955171b407 100644 --- a/gtk2_ardour/ardour2_ui_light.rc +++ b/gtk2_ardour/ardour2_ui_light.rc @@ -671,6 +671,11 @@ style "transport_clock_display_delta" = "transport_clock_display" fg[NORMAL] = { 0.30, 0.30, 1.0 } } +style "transport_clock_display_delta" = "transport_clock_display" +{ + fg[NORMAL] = { 0.30, 0.30, 1.0 } +} + style "tempo_meter_clock_display" { font_name = "sans 7" @@ -1522,4 +1527,6 @@ widget "*ChannelCountSelector" style:highest "medium_bold_entry" widget "*ChannelCountSelector.GtkArrow" style:highest "default_buttons_menus" widget "*RegionListWholeFile" style:highest "treeview_parent_node" widget "*EditorHScrollbar" style:highest "editor_hscrollbar" +widget "*TransportClockDisplayDelta" style:highest "transport_clock_display_delta" +widget "*SecondaryClockDisplayDelta" style:highest "transport_clock_display_delta" diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index e7297df483..5022e6e6ee 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -92,7 +92,7 @@ UIConfiguration *ARDOUR_UI::ui_config = 0; sigc::signal ARDOUR_UI::Blink; sigc::signal ARDOUR_UI::RapidScreenUpdate; sigc::signal ARDOUR_UI::SuperRapidScreenUpdate; -sigc::signal ARDOUR_UI::Clock; +sigc::signal ARDOUR_UI::Clock; ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[]) @@ -1486,7 +1486,7 @@ void ARDOUR_UI::update_clocks () { if (!editor || !editor->dragging_playhead()) { - Clock (session->audible_frame()); /* EMIT_SIGNAL */ + Clock (session->audible_frame(), false, editor->edit_cursor_position(false)); /* EMIT_SIGNAL */ } } @@ -2609,8 +2609,17 @@ ARDOUR_UI::use_config () void ARDOUR_UI::update_transport_clocks (nframes_t pos) { - primary_clock.set (pos); - secondary_clock.set (pos); + if (Config->get_primary_clock_delta_edit_cursor()) { + primary_clock.set (pos, false, editor->edit_cursor_position(false), 1); + } else { + primary_clock.set (pos, 0, true); + } + + if (Config->get_secondary_clock_delta_edit_cursor()) { + secondary_clock.set (pos, false, editor->edit_cursor_position(false), 2); + } else { + secondary_clock.set (pos); + } if (big_clock_window) { big_clock.set (pos); diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 750a56db7d..628206f70e 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -160,7 +160,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI static sigc::signal Blink; static sigc::signal RapidScreenUpdate; static sigc::signal SuperRapidScreenUpdate; - static sigc::signal Clock; + static sigc::signal Clock; /* this is a helper function to centralize the (complex) logic for blinking rec-enable buttons. @@ -692,6 +692,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI void toggle_ShowSoloMutes(); void toggle_LatchedRecordEnable (); void toggle_RegionEquivalentsOverlap (); + void toggle_PrimaryClockDeltaEditCursor (); + void toggle_SecondaryClockDeltaEditCursor (); void mtc_port_changed (); void map_solo_model (); diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index da2b2262ea..ff4b84467f 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -271,8 +271,8 @@ ARDOUR_UI::setup_transport () /* clocks, etc. */ - ARDOUR_UI::Clock.connect (bind (mem_fun (primary_clock, &AudioClock::set), false)); - ARDOUR_UI::Clock.connect (bind (mem_fun (secondary_clock, &AudioClock::set), false)); + ARDOUR_UI::Clock.connect (bind (mem_fun (primary_clock, &AudioClock::set), 1)); + ARDOUR_UI::Clock.connect (bind (mem_fun (secondary_clock, &AudioClock::set), 2)); primary_clock.ValueChanged.connect (mem_fun(*this, &ARDOUR_UI::primary_clock_value_changed)); secondary_clock.ValueChanged.connect (mem_fun(*this, &ARDOUR_UI::secondary_clock_value_changed)); diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index 3b70f9c801..78c7a3dcf9 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -413,6 +413,8 @@ ARDOUR_UI::install_actions () ActionManager::register_toggle_action (option_actions, X_("GainReduceFastTransport"), _("-12dB gain reduce ffwd/rewind"), mem_fun (*this, &ARDOUR_UI::toggle_GainReduceFastTransport)); ActionManager::register_toggle_action (option_actions, X_("LatchedRecordEnable"), _("Rec-enable stays engaged at stop"), mem_fun (*this, &ARDOUR_UI::toggle_LatchedRecordEnable)); ActionManager::register_toggle_action (option_actions, X_("RegionEquivalentsOverlap"), _("Region equivalents overlap"), mem_fun (*this, &ARDOUR_UI::toggle_RegionEquivalentsOverlap)); + ActionManager::register_toggle_action (option_actions, X_("PrimaryClockDeltaEditCursor"), _("Primary Clock delta to edit cursor"), mem_fun (*this, &ARDOUR_UI::toggle_PrimaryClockDeltaEditCursor)); + ActionManager::register_toggle_action (option_actions, X_("SecondaryClockDeltaEditCursor"), _("Secondary Clock delta to edit cursor"), mem_fun (*this, &ARDOUR_UI::toggle_SecondaryClockDeltaEditCursor)); RadioAction::Group denormal_group; diff --git a/gtk2_ardour/ardour_ui_options.cc b/gtk2_ardour/ardour_ui_options.cc index b59fdf803b..813c615d39 100644 --- a/gtk2_ardour/ardour_ui_options.cc +++ b/gtk2_ardour/ardour_ui_options.cc @@ -479,6 +479,18 @@ ARDOUR_UI::toggle_ShowSoloMutes() ActionManager::toggle_config_state ("options", "ShowSoloMutes", &Configuration::set_show_solo_mutes, &Configuration::get_show_solo_mutes); } +void +ARDOUR_UI::toggle_PrimaryClockDeltaEditCursor() +{ + ActionManager::toggle_config_state ("options", "PrimaryClockDeltaEditCursor", &Configuration::set_primary_clock_delta_edit_cursor, &Configuration::get_primary_clock_delta_edit_cursor); +} + +void +ARDOUR_UI::toggle_SecondaryClockDeltaEditCursor() +{ + ActionManager::toggle_config_state ("options", "SecondaryClockDeltaEditCursor", &Configuration::set_secondary_clock_delta_edit_cursor, &Configuration::get_secondary_clock_delta_edit_cursor); +} + void ARDOUR_UI::mtc_port_changed () { @@ -1039,7 +1051,11 @@ ARDOUR_UI::parameter_changed (const char* parameter_name) } } else if (PARAM_IS ("use-overlap-equivalency")) { ActionManager::map_some_state ("options", "RegionEquivalentsOverlap", &Configuration::get_use_overlap_equivalency); - } + } else if (PARAM_IS ("primary-clock-delta-edit-cursor")) { + ActionManager::map_some_state ("options", "PrimaryClockDeltaEditCursor", &Configuration::get_primary_clock_delta_edit_cursor); + } else if (PARAM_IS ("secondary-clock-delta-edit-cursor")) { + ActionManager::map_some_state ("options", "SecondaryClockDeltaEditCursor", &Configuration::get_secondary_clock_delta_edit_cursor); + } #undef PARAM_IS diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc index 0aa8ff8ab6..1220729b18 100644 --- a/gtk2_ardour/audio_clock.cc +++ b/gtk2_ardour/audio_clock.cc @@ -77,6 +77,8 @@ AudioClock::AudioClock (std::string clock_name, bool transient, std::string widg { session = 0; last_when = 0; + last_pdelta = 0; + last_sdelta = 0; key_entry_state = 0; ops_menu = 0; dragging = false; @@ -404,17 +406,41 @@ AudioClock::on_realize () } void -AudioClock::set (nframes_t when, bool force) +AudioClock::set (nframes_t when, bool force, nframes_t offset, int which) { if ((!force && !is_visible()) || session == 0) { return; } - if (when == last_when && !force) { + if (when == last_when && !offset && !force) { return; } + bool pdelta = Config->get_primary_clock_delta_edit_cursor(); + bool sdelta = Config->get_secondary_clock_delta_edit_cursor(); + + if (offset && which == 1 && pdelta) { + when = (when > offset) ? when - offset : offset - when; + } else if (offset && which == 2 && sdelta) { + when = (when > offset) ? when - offset : offset - when; + } + + if (which == 1 && pdelta && !last_pdelta) { + cout << "set_widget_name() called" << endl; + set_widget_name("TransportClockDisplayDelta"); + last_pdelta = true; + } else if (which == 1 && !pdelta && last_pdelta) { + set_widget_name("TransportClockDisplay"); + last_pdelta = false; + } else if (which == 2 && sdelta && !last_sdelta) { + set_widget_name("SecondaryClockDisplayDelta"); + last_sdelta = true; + } else if (which == 2 && !sdelta && last_sdelta) { + set_widget_name("SecondaryClockDisplay"); + last_sdelta = false; + } + switch (_mode) { case SMPTE: set_smpte (when, force); diff --git a/gtk2_ardour/audio_clock.h b/gtk2_ardour/audio_clock.h index 6c2f9c838c..fe56add4b5 100644 --- a/gtk2_ardour/audio_clock.h +++ b/gtk2_ardour/audio_clock.h @@ -46,7 +46,7 @@ class AudioClock : public Gtk::HBox Mode mode() const { return _mode; } - void set (nframes_t, bool force = false); + void set (nframes_t, bool force = false, nframes_t offset = 0, int which = 0); void set_mode (Mode); void set_widget_name (std::string); @@ -151,6 +151,8 @@ class AudioClock : public Gtk::HBox Gtk::Frame clock_frame; nframes_t last_when; + bool last_pdelta; + bool last_sdelta; uint32_t last_hrs; uint32_t last_mins; diff --git a/libs/ardour/ardour/configuration_vars.h b/libs/ardour/ardour/configuration_vars.h index 8003dc4a4c..61dc1bd225 100644 --- a/libs/ardour/ardour/configuration_vars.h +++ b/libs/ardour/ardour/configuration_vars.h @@ -112,6 +112,8 @@ CONFIG_VARIABLE (SlaveSource, slave_source, "slave-source", None) CONFIG_VARIABLE (ShuttleBehaviour, shuttle_behaviour, "shuttle-behaviour", Sprung) CONFIG_VARIABLE (ShuttleUnits, shuttle_units, "shuttle-units", Percentage) CONFIG_VARIABLE (bool, quieten_at_speed, "quieten-at-speed", true) +CONFIG_VARIABLE (bool, primary_clock_delta_edit_cursor, "primary-clock-delta-edit-cursor", false) +CONFIG_VARIABLE (bool, secondary_clock_delta_edit_cursor, "secondary-clock-delta-edit-cursor", false) /* timecode and sync */ -- cgit v1.2.3