From b235856e446accd279160a69cc8950e123c0c82f Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 17 Apr 2008 15:25:45 +0000 Subject: [PATCH] gcc 4.3 compile fixes; new name-new-marker-at-creation option; make ferret region splits undoable git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3261 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/actions.cc | 1 + gtk2_ardour/ardour.menus | 1 + gtk2_ardour/ardour_ui.h | 1 + gtk2_ardour/ardour_ui_ed.cc | 1 + gtk2_ardour/ardour_ui_options.cc | 6 +++++ gtk2_ardour/editing.cc | 2 +- gtk2_ardour/editor.h | 1 + gtk2_ardour/editor_markers.cc | 3 +++ gtk2_ardour/editor_ops.cc | 46 ++++++++++++++++++++++++++++++++ gtk2_ardour/fft_result.cc | 1 + gtk2_ardour/location_ui.cc | 15 +++++++++++ gtk2_ardour/location_ui.h | 2 ++ gtk2_ardour/rhythm_ferret.cc | 1 + 13 files changed, 80 insertions(+), 1 deletion(-) diff --git a/gtk2_ardour/actions.cc b/gtk2_ardour/actions.cc index f6adbf3c92..1f5ff658c9 100644 --- a/gtk2_ardour/actions.cc +++ b/gtk2_ardour/actions.cc @@ -17,6 +17,7 @@ */ +#include #include #include #include diff --git a/gtk2_ardour/ardour.menus b/gtk2_ardour/ardour.menus index 3efcf9ce8e..bb8cd9daae 100644 --- a/gtk2_ardour/ardour.menus +++ b/gtk2_ardour/ardour.menus @@ -511,6 +511,7 @@ + diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index e71740134a..70ce687769 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -706,6 +706,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI void toggle_only_copy_imported_files (); void toggle_ShowTrackMeters (); void toggle_use_narrow_ms(); + void toggle_NameNewMarkers (); void toggle_rubberbanding_snaps_to_grid (); void toggle_auto_analyse_audio (); void toggle_TapeMachineMode(); diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index c5e8b14a7a..53f307749c 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -456,6 +456,7 @@ ARDOUR_UI::install_actions () ActionManager::register_toggle_action (option_actions, X_("AutoAnalyseAudio"), _("Auto-analyse new audio"), mem_fun (*this, &ARDOUR_UI::toggle_auto_analyse_audio)); ActionManager::register_toggle_action (option_actions, X_("DefaultNarrowMS"), _("Use narrow mixer strips"), mem_fun (*this, &ARDOUR_UI::toggle_use_narrow_ms)); + ActionManager::register_toggle_action (option_actions, X_("NameNewMarkers"), _("Name New Markers"), mem_fun (*this, &ARDOUR_UI::toggle_NameNewMarkers)); RadioAction::Group denormal_group; diff --git a/gtk2_ardour/ardour_ui_options.cc b/gtk2_ardour/ardour_ui_options.cc index 7b91410e15..02dc077688 100644 --- a/gtk2_ardour/ardour_ui_options.cc +++ b/gtk2_ardour/ardour_ui_options.cc @@ -577,6 +577,12 @@ 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_NameNewMarkers() +{ + ActionManager::toggle_config_state ("options", "NameNewMarkers", &Configuration::set_name_new_markers, &Configuration::get_name_new_markers); +} + void ARDOUR_UI::toggle_rubberbanding_snaps_to_grid () { diff --git a/gtk2_ardour/editing.cc b/gtk2_ardour/editing.cc index dd672c73a2..0bd0e3a6e2 100644 --- a/gtk2_ardour/editing.cc +++ b/gtk2_ardour/editing.cc @@ -17,7 +17,7 @@ */ -#include +#include #include "editing.h" diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index ed5f7a38b0..d20dd5af0f 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -465,6 +465,7 @@ class Editor : public PublicEditor void hide_marker (ArdourCanvas::Item*, GdkEvent*); void clear_marker_display (); void mouse_add_new_marker (nframes_t where, bool is_cd=false, bool is_xrun=false); + bool choose_new_marker_name(string &name); void update_cd_marker_display (); void ensure_cd_marker_updated (LocationMarkers * lam, ARDOUR::Location * location); diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index 9e8bd7f1c2..daad9383e5 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -404,6 +404,9 @@ Editor::mouse_add_new_marker (nframes_t where, bool is_cd, bool is_xrun) if (session) { session->locations()->next_available_name(markername, markerprefix); + if (!is_xrun && !choose_new_marker_name(markername)) { + return; + } Location *location = new Location (where, where, markername, (Location::Flags) flags); session->begin_reversible_command (_("add marker")); XMLNode &before = session->locations()->get_state(); diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 0f4d1d2f6d..2e9ce7ca2f 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -1836,6 +1836,46 @@ Editor::temporal_zoom_to_frame (bool coarser, nframes_t frame) reposition_and_zoom (new_leftmost, new_fpu); } + +bool +Editor::choose_new_marker_name(string &name) { + + if (!Config->get_name_new_markers()) { + /* don't prompt user for a new name */ + return true; + } + + ArdourPrompter dialog (true); + + dialog.set_prompt (_("New Name:")); + + WindowTitle title(Glib::get_application_name()); + title += _("Name New Location Marker"); + + dialog.set_title(title.get_string()); + + dialog.set_name ("MarkNameWindow"); + dialog.set_size_request (250, -1); + dialog.set_position (Gtk::WIN_POS_MOUSE); + + dialog.add_button (Stock::OK, RESPONSE_ACCEPT); + dialog.set_initial_text (name); + + dialog.show (); + + switch (dialog.run ()) { + case RESPONSE_ACCEPT: + break; + default: + return false; + } + + dialog.get_result(name); + return true; + +} + + void Editor::add_location_from_selection () { @@ -1871,6 +1911,9 @@ Editor::add_location_mark (nframes64_t where) select_new_marker = true; session->locations()->next_available_name(markername,"mark"); + if (!choose_new_marker_name(markername)) { + return; + } Location *location = new Location (where, where, markername, Location::IsMark); session->begin_reversible_command (_("add marker")); XMLNode &before = session->locations()->get_state(); @@ -2015,6 +2058,9 @@ Editor::set_mark () } session->locations()->next_available_name(markername,"mark"); + if (!choose_new_marker_name(markername)) { + return; + } session->locations()->add (new Location (pos, 0, markername, Location::IsMark), true); } diff --git a/gtk2_ardour/fft_result.cc b/gtk2_ardour/fft_result.cc index d692b9152b..a9858542a3 100644 --- a/gtk2_ardour/fft_result.cc +++ b/gtk2_ardour/fft_result.cc @@ -21,6 +21,7 @@ #include #include #include +#include #include #include diff --git a/gtk2_ardour/location_ui.cc b/gtk2_ardour/location_ui.cc index 2079d0dc7a..bdbe83a589 100644 --- a/gtk2_ardour/location_ui.cc +++ b/gtk2_ardour/location_ui.cc @@ -600,6 +600,12 @@ LocationEditRow::flags_changed (ARDOUR::Location *loc, void *src) i_am_the_modifier--; } +void +LocationEditRow::focus_name() { + name_entry.grab_focus(); +} + + LocationUI::LocationUI () : ArdourDialog ("locations dialog"), add_location_button (_("Add New Location")), @@ -628,6 +634,8 @@ LocationUI::LocationUI () location_rows_scroller.set_name ("LocationLocRowsScroller"); location_rows_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); location_rows_scroller.set_size_request (-1, 130); + + newest_location = 0; loc_frame_box.set_spacing (5); loc_frame_box.set_border_width (5); @@ -789,6 +797,10 @@ LocationUI::map_locations (Locations::LocationList& locations) erow->remove_requested.connect (mem_fun(*this, &LocationUI::location_remove_requested)); erow->redraw_ranges.connect (mem_fun(*this, &LocationUI::location_redraw_ranges)); loc_children.push_back(Box_Helpers::Element(*erow, PACK_SHRINK, 1, PACK_START)); + if (location == newest_location) { + newest_location = 0; + erow->focus_name(); + } } else if (location->is_auto_punch()) { punch_edit_row.set_session (session); @@ -820,6 +832,9 @@ LocationUI::add_new_location() nframes_t where = session->audible_frame(); session->locations()->next_available_name(markername,"mark"); Location *location = new Location (where, where, markername, Location::IsMark); + if (Config->get_name_new_markers()) { + newest_location = location; + } session->begin_reversible_command (_("add marker")); XMLNode &before = session->locations()->get_state(); session->locations()->add (location, true); diff --git a/gtk2_ardour/location_ui.h b/gtk2_ardour/location_ui.h index de435b999f..2cec03b1cb 100644 --- a/gtk2_ardour/location_ui.h +++ b/gtk2_ardour/location_ui.h @@ -50,6 +50,7 @@ class LocationEditRow : public Gtk::HBox void set_session (ARDOUR::Session *); void set_number (int); + void focus_name(); sigc::signal remove_requested; sigc::signal redraw_ranges; @@ -149,6 +150,7 @@ class LocationUI : public ArdourDialog private: ARDOUR::LocationStack* locations; + ARDOUR::Location *newest_location; void session_gone(); diff --git a/gtk2_ardour/rhythm_ferret.cc b/gtk2_ardour/rhythm_ferret.cc index 63440e7ab1..92bd2360a0 100644 --- a/gtk2_ardour/rhythm_ferret.cc +++ b/gtk2_ardour/rhythm_ferret.cc @@ -277,6 +277,7 @@ RhythmFerret::do_split_action () i = tmp; } + session->commit_reversible_command (); }