From 8fed7470f5fb37ebd007410f4095851ba29ad2b4 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 17 Feb 2008 17:49:38 +0000 Subject: Merge with 2.0-ongoing R3077. git-svn-id: svn://localhost/ardour2/branches/3.0@3078 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/ardour.menus | 7 +++-- gtk2_ardour/ardour_ui.h | 2 ++ gtk2_ardour/ardour_ui_ed.cc | 6 +++- gtk2_ardour/ardour_ui_options.cc | 18 ++++++++++++ gtk2_ardour/audio_region_view.cc | 4 ++- gtk2_ardour/editor.cc | 2 -- gtk2_ardour/editor_mouse.cc | 2 +- gtk2_ardour/tempo_dialog.cc | 61 ++++++++++++++++++---------------------- gtk2_ardour/tempo_dialog.h | 9 ++---- 9 files changed, 65 insertions(+), 46 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/ardour.menus b/gtk2_ardour/ardour.menus index 9387c1eb3e..73f65ef157 100644 --- a/gtk2_ardour/ardour.menus +++ b/gtk2_ardour/ardour.menus @@ -367,10 +367,12 @@ - + + + @@ -442,8 +444,9 @@ - + + diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 2bc2736183..d35d87a423 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -732,6 +732,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI void toggle_ShowTrackMeters (); void toggle_only_copy_imported_files (); void toggle_use_narrow_ms(); + void toggle_rubberbanding_snaps_to_grid (); + void toggle_TapeMachineMode(); void mtc_port_changed (); void map_solo_model (); diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index dff8745252..c94fb1ba9d 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -418,6 +418,8 @@ ARDOUR_UI::install_actions () #ifndef HAVE_LIBLO act->set_sensitive (false); #endif + act = ActionManager::register_toggle_action (option_actions, X_("ToggleTapeMachineMode"), _("Tape Machine mode"), mem_fun (*this, &ARDOUR_UI::toggle_TapeMachineMode)); + ActionManager::session_sensitive_actions.push_back (act); ActionManager::register_toggle_action (option_actions, X_("SyncEditorAndMixerTrackOrder"), _("Sync Editor and Mixer track order"), mem_fun (*this, &ARDOUR_UI::toggle_sync_order_keys)); ActionManager::register_toggle_action (option_actions, X_("StopPluginsWithTransport"), _("Stop plugins with transport"), mem_fun (*this, &ARDOUR_UI::toggle_StopPluginsWithTransport)); @@ -432,7 +434,9 @@ ARDOUR_UI::install_actions () ActionManager::register_toggle_action (option_actions, X_("PrimaryClockDeltaEditCursor"), _("Primary Clock delta to edit point"), mem_fun (*this, &ARDOUR_UI::toggle_PrimaryClockDeltaEditCursor)); ActionManager::register_toggle_action (option_actions, X_("SecondaryClockDeltaEditCursor"), _("Secondary Clock delta to edit point"), mem_fun (*this, &ARDOUR_UI::toggle_SecondaryClockDeltaEditCursor)); ActionManager::register_toggle_action (option_actions, X_("ShowTrackMeters"), _("Enable Editor Meters"), mem_fun (*this, &ARDOUR_UI::toggle_ShowTrackMeters)); - ActionManager::register_toggle_action (option_actions, X_("OnlyCopyImportedFiles"), _("Always copy imported files"), mem_fun (*this, &ARDOUR_UI::toggle_only_copy_imported_files)); + ActionManager::register_toggle_action (option_actions, X_("OnlyCopyImportedFiles"), _("Always copy imported files"), mem_fun (*this, &ARDOUR_UI::toggle_only_copy_imported_files)); + ActionManager::register_toggle_action (option_actions, X_("RubberbandingSnapsToGrid"), _("Rubberbanding Snaps to Grid"), mem_fun (*this, &ARDOUR_UI::toggle_rubberbanding_snaps_to_grid)); + ActionManager::register_toggle_action (option_actions, X_("DefaultNarrowMS"), _("Use narrow mixer strips"), mem_fun (*this, &ARDOUR_UI::toggle_use_narrow_ms)); RadioAction::Group denormal_group; diff --git a/gtk2_ardour/ardour_ui_options.cc b/gtk2_ardour/ardour_ui_options.cc index 903255cd87..6b1eb3e299 100644 --- a/gtk2_ardour/ardour_ui_options.cc +++ b/gtk2_ardour/ardour_ui_options.cc @@ -523,12 +523,24 @@ ARDOUR_UI::toggle_ShowTrackMeters() ActionManager::toggle_config_state ("options", "ShowTrackMeters", &Configuration::set_show_track_meters, &Configuration::get_show_track_meters); } +void +ARDOUR_UI::toggle_TapeMachineMode () +{ + ActionManager::toggle_config_state ("options", "ToggleTapeMachineMode", &Configuration::set_tape_machine_mode, &Configuration::get_tape_machine_mode); +} + void ARDOUR_UI::toggle_use_narrow_ms() { ActionManager::toggle_config_state ("options", "DefaultNarrowMS", &Configuration::set_default_narrow_ms, &Configuration::get_default_narrow_ms); } +void +ARDOUR_UI::toggle_rubberbanding_snaps_to_grid () +{ + ActionManager::toggle_config_state ("options", "RubberbandingSnapsToGrid", &Configuration::set_rubberbanding_snaps_to_grid, &Configuration::get_rubberbanding_snaps_to_grid); +} + void ARDOUR_UI::mtc_port_changed () { @@ -1040,6 +1052,8 @@ ARDOUR_UI::parameter_changed (const char* parameter_name) ActionManager::map_some_state ("Transport", "ToggleAutoReturn", &Configuration::get_auto_return); } else if (PARAM_IS ("auto-input")) { ActionManager::map_some_state ("Transport", "ToggleAutoInput", &Configuration::get_auto_input); + } else if (PARAM_IS ("tape-machine-mode")) { + ActionManager::map_some_state ("options", "ToggleTapeMachineMode", &Configuration::get_tape_machine_mode); } else if (PARAM_IS ("punch-out")) { ActionManager::map_some_state ("Transport", "TogglePunchOut", &Configuration::get_punch_out); } else if (PARAM_IS ("punch-in")) { @@ -1138,7 +1152,11 @@ ARDOUR_UI::parameter_changed (const char* parameter_name) editor->toggle_meter_updating(); } else if (PARAM_IS ("default-narrow_ms")) { ActionManager::map_some_state ("options", "DefaultNarrowMS", &Configuration::get_default_narrow_ms); + } else if (PARAM_IS ("rubberbanding-snaps-to-grid")) { + ActionManager::map_some_state ("options", "RubberbandingSnapsToGrid", &Configuration::get_rubberbanding_snaps_to_grid); } + + #undef PARAM_IS } diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc index 2b4b4bbe3f..c3e3b9a036 100644 --- a/gtk2_ardour/audio_region_view.cc +++ b/gtk2_ardour/audio_region_view.cc @@ -809,7 +809,8 @@ AudioRegionView::create_waves () ChanCount nchans = atv.get_diskstream()->n_channels(); - cerr << "creating waves for " << _region->name() << " with wfd = " << wait_for_data << " and channels = " << nchans << endl; + cerr << "creating waves for " << _region->name() << " with wfd = " << wait_for_data + << " and channels = " << nchans.n_audio() << endl; /* in tmp_waves, set up null pointers for each channel so the vector is allocated */ for (uint32_t n = 0; n < nchans.n_audio(); ++n) { @@ -828,6 +829,7 @@ AudioRegionView::create_waves () if (wait_for_data) { if (audio_region()->audio_source(n)->peaks_ready (bind (mem_fun(*this, &AudioRegionView::peaks_ready_handler), n), data_ready_connection)) { + cerr << "\tData is ready\n"; cerr << "\tData is ready\n"; create_one_wave (n, true); } else { diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index c5e34c38de..a11b3a548d 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -4597,8 +4597,6 @@ Editor::get_regions_after (RegionSelection& rs, nframes64_t where, const TrackSe void Editor::get_regions_for_action (RegionSelection& rs, bool allow_entered) { - bool use_regions_at = true; - if (selection->regions.empty()) { if (selection->tracks.empty()) { diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index d4e6a4218f..eef83e819e 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -5246,7 +5246,7 @@ Editor::drag_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event) return; } - if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) { + if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier()) && Config->get_rubberbanding_snaps_to_grid()) { if (drag_info.first_move) { snap_to (drag_info.grab_frame); } diff --git a/gtk2_ardour/tempo_dialog.cc b/gtk2_ardour/tempo_dialog.cc index 6f46ec1a9d..622045579c 100644 --- a/gtk2_ardour/tempo_dialog.cc +++ b/gtk2_ardour/tempo_dialog.cc @@ -138,7 +138,7 @@ TempoDialog::init (const BBT_Time& when, double bpm, double note_type, bool mova when_table.set_homogeneous (true); when_table.set_row_spacings (2); when_table.set_col_spacings (2); - when_table.set_border_width (6); + when_table.set_border_width (0); when_table.attach (when_bar_label, 0, 1, 0, 1, AttachOptions(0), FILL|EXPAND); when_table.attach (when_bar_entry, 1, 2, 0, 1, AttachOptions(0), FILL|EXPAND); @@ -178,6 +178,10 @@ TempoDialog::init (const BBT_Time& when, double bpm, double note_type, bool mova bpm_spinner.signal_activate().connect (bind (mem_fun (*this, &TempoDialog::response), RESPONSE_ACCEPT)); bpm_spinner.signal_button_press_event().connect (mem_fun (*this, &TempoDialog::bpm_button_press), false); bpm_spinner.signal_button_release_event().connect (mem_fun (*this, &TempoDialog::bpm_button_release), false); + when_bar_entry.signal_activate().connect (bind (mem_fun (*this, &TempoDialog::response), RESPONSE_ACCEPT)); + when_bar_entry.signal_key_release_event().connect (mem_fun (*this, &TempoDialog::entry_key_release), false); + when_beat_entry.signal_activate().connect (bind (mem_fun (*this, &TempoDialog::response), RESPONSE_ACCEPT)); + when_beat_entry.signal_key_release_event().connect (mem_fun (*this, &TempoDialog::entry_key_release), false); note_types.signal_changed().connect (mem_fun (*this, &TempoDialog::note_types_change)); } @@ -196,6 +200,17 @@ TempoDialog::bpm_button_release (GdkEventButton* ev) return false; } +bool +TempoDialog::entry_key_release (GdkEventKey* ev) +{ + if (when_beat_entry.get_text() != "" && when_bar_entry.get_text() != "") { + set_response_sensitive (RESPONSE_ACCEPT, true); + } else { + set_response_sensitive (RESPONSE_ACCEPT, false); + } + return false; +} + double TempoDialog::get_bpm () { @@ -258,8 +273,6 @@ MeterDialog::MeterDialog (TempoMap& map, nframes_t frame, const string & action) bpb_frame (_("Meter")), ok_button (action), cancel_button (_("Cancel")), - when_bar_label (_("Bar"), ALIGN_LEFT, ALIGN_CENTER), - when_beat_label (_("Beat"), ALIGN_LEFT, ALIGN_CENTER), when_frame (_("Location")) { BBT_Time when; @@ -275,8 +288,6 @@ MeterDialog::MeterDialog (MeterSection& section, const string & action) bpb_frame (_("Meter")), ok_button (action), cancel_button (_("Cancel")), - when_bar_label (_("Bar"), ALIGN_LEFT, ALIGN_CENTER), - when_beat_label (_("Beat"), ALIGN_LEFT, ALIGN_CENTER), when_frame (_("Location")) { init (section.start(), section.beats_per_bar(), section.note_divisor(), section.movable()); @@ -337,32 +348,14 @@ MeterDialog::init (const BBT_Time& when, double bpb, double note_type, bool mova if (movable) { snprintf (buf, sizeof (buf), "%" PRIu32, when.bars); when_bar_entry.set_text (buf); - snprintf (buf, sizeof (buf), "%" PRIu32, when.beats); - when_beat_entry.set_text (buf); when_bar_entry.set_name ("MetricEntry"); - when_beat_entry.set_name ("MetricEntry"); - - when_bar_label.set_name ("MetricLabel"); - when_beat_label.set_name ("MetricLabel"); Gtkmm2ext::set_size_request_to_display_given_text (when_bar_entry, "999g", 5, 7); - Gtkmm2ext::set_size_request_to_display_given_text (when_beat_entry, "999g", 5, 7); - - when_table.set_homogeneous (true); - when_table.set_row_spacings (2); - when_table.set_col_spacings (2); - when_table.set_border_width (6); - - when_table.attach (when_bar_label, 0, 1, 0, 1, AttachOptions(0), FILL|EXPAND); - when_table.attach (when_bar_entry, 1, 2, 0, 1, AttachOptions(0), FILL|EXPAND); - when_table.attach (when_beat_label, 0, 1, 1, 2, AttachOptions(0), AttachOptions(0)); - when_table.attach (when_beat_entry, 1, 2, 1, 2, AttachOptions(0), AttachOptions(0)); - HBox* when_hbox = manage (new HBox()); - Label* when_label = manage(new Label(_("Meter Begins at:"), ALIGN_LEFT, ALIGN_TOP)); - when_hbox->pack_end(when_table, PACK_EXPAND_PADDING, 6); + Label* when_label = manage(new Label(_("Meter Begins at Bar:"), ALIGN_LEFT, ALIGN_TOP)); + when_hbox->pack_end(when_bar_entry, PACK_EXPAND_PADDING, 6); when_hbox->pack_start(*when_label, PACK_EXPAND_PADDING, 6); when_frame.set_name ("MetricDialogFrame"); @@ -386,13 +379,17 @@ MeterDialog::init (const BBT_Time& when, double bpb, double note_type, bool mova set_name ("MetricDialog"); bpb_entry.signal_activate().connect (bind (mem_fun (*this, &MeterDialog::response), RESPONSE_ACCEPT)); - bpb_entry.signal_key_press_event().connect (mem_fun (*this, &MeterDialog::bpb_key_press), false); - bpb_entry.signal_key_release_event().connect (mem_fun (*this, &MeterDialog::bpb_key_release)); + bpb_entry.signal_key_press_event().connect (mem_fun (*this, &MeterDialog::entry_key_press), false); + bpb_entry.signal_key_release_event().connect (mem_fun (*this, &MeterDialog::entry_key_release)); + when_bar_entry.signal_activate().connect (bind (mem_fun (*this, &MeterDialog::response), RESPONSE_ACCEPT)); + when_bar_entry.signal_key_press_event().connect (mem_fun (*this, &MeterDialog::entry_key_press), false); + when_bar_entry.signal_key_release_event().connect (mem_fun (*this, &MeterDialog::entry_key_release)); + note_types.signal_changed().connect (mem_fun (*this, &MeterDialog::note_types_change)); } bool -MeterDialog::bpb_key_press (GdkEventKey* ev) +MeterDialog::entry_key_press (GdkEventKey* ev) { switch (ev->keyval) { @@ -440,9 +437,9 @@ MeterDialog::bpb_key_press (GdkEventKey* ev) } bool -MeterDialog::bpb_key_release (GdkEventKey* ev) +MeterDialog::entry_key_release (GdkEventKey* ev) { - if (bpb_entry.get_text() != "") { + if (when_bar_entry.get_text() != "" && bpb_entry.get_text() != "") { set_response_sensitive (RESPONSE_ACCEPT, true); } else { set_response_sensitive (RESPONSE_ACCEPT, false); @@ -504,9 +501,7 @@ MeterDialog::get_bbt_time (BBT_Time& requested) return false; } - if (sscanf (when_beat_entry.get_text().c_str(), "%" PRIu32, &requested.beats) != 1) { - return false; - } + requested.beats = 1; requested.ticks = 0; diff --git a/gtk2_ardour/tempo_dialog.h b/gtk2_ardour/tempo_dialog.h index c2053644a1..cbb237abb8 100644 --- a/gtk2_ardour/tempo_dialog.h +++ b/gtk2_ardour/tempo_dialog.h @@ -66,6 +66,7 @@ private: void bpm_changed (); bool bpm_button_press (GdkEventButton* ); bool bpm_button_release (GdkEventButton* ); + bool entry_key_release (GdkEventKey* ); void note_types_change (); }; @@ -78,10 +79,6 @@ struct MeterDialog : public ArdourDialog Gtk::Button ok_button; Gtk::Button cancel_button; Gtk::Entry when_bar_entry; - Gtk::Entry when_beat_entry; - Gtk::Label when_bar_label; - Gtk::Label when_beat_label; - Gtk::Table when_table; Gtk::Frame when_frame; char buf[64]; @@ -94,8 +91,8 @@ struct MeterDialog : public ArdourDialog private: void init (const ARDOUR::BBT_Time&, double, double, bool); - bool bpb_key_press (GdkEventKey* ); - bool bpb_key_release (GdkEventKey* ); + bool entry_key_press (GdkEventKey* ); + bool entry_key_release (GdkEventKey* ); void note_types_change (); }; -- cgit v1.2.3