diff --git a/gtk2_ardour/ardour.bindings b/gtk2_ardour/ardour.bindings index 49e95dfc8b..6ebd9b284c 100644 --- a/gtk2_ardour/ardour.bindings +++ b/gtk2_ardour/ardour.bindings @@ -111,6 +111,7 @@ (gtk_accel_path "/Editor/extend-range-to-end-of-region" "rightanglebracket") (gtk_accel_path "/Editor/scroll-backward" "leftarrow") (gtk_accel_path "/Editor/start-range" "KP_Down") +; (gtk_accel_path "/Editor/ToggleTranzportSurface" "") ; (gtk_accel_path "/ShuttleActions/SetShuttleUnitsSemitones" "") ; (gtk_accel_path "/JACK/JACKLatency128" "") ; (gtk_accel_path "/Snap/snap-to-beat" "") diff --git a/gtk2_ardour/automation_selectable.h b/gtk2_ardour/automation_selectable.h index 5b7f4d5705..2ce8f29a70 100644 --- a/gtk2_ardour/automation_selectable.h +++ b/gtk2_ardour/automation_selectable.h @@ -16,6 +16,14 @@ struct AutomationSelectable : public Selectable AutomationSelectable (nframes_t s, nframes_t e, double l, double h, TimeAxisView& atv) : start (s), end (e), low_fract (l), high_fract (h), track (atv) {} + + bool operator== (const AutomationSelectable& other) { + return start == other.start && + end == other.end && + low_fract == other.low_fract && + high_fract == other.high_fract && + &track == &other.track; + } }; #endif /* __ardour_gtk_automation_selectable_h__ */ diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index 776dff37f2..c3f53d266c 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -573,7 +573,7 @@ AutomationTimeAxisView::cut_copy_clear_objects_one (AutomationLine& line, PointS case Cut: if ((what_we_got = alist.cut ((*i).start, (*i).end)) != 0) { editor.get_cut_buffer().add (what_we_got); - _session.add_command (new MementoCommand(alist, &before, &alist.get_state())); + _session.add_command (new MementoCommand(alist, new XMLNode (before), &alist.get_state())); ret = true; } break; @@ -585,7 +585,7 @@ AutomationTimeAxisView::cut_copy_clear_objects_one (AutomationLine& line, PointS case Clear: if ((what_we_got = alist.cut ((*i).start, (*i).end)) != 0) { - _session.add_command (new MementoCommand(alist, &before, &alist.get_state())); + _session.add_command (new MementoCommand(alist, new XMLNode (before), &alist.get_state())); delete what_we_got; what_we_got = 0; ret = true; @@ -593,7 +593,9 @@ AutomationTimeAxisView::cut_copy_clear_objects_one (AutomationLine& line, PointS break; } } - + + delete &before; + if (what_we_got) { for (AutomationList::iterator x = what_we_got->begin(); x != what_we_got->end(); ++x) { double foo = (*x)->value; diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 17647494a5..fec951f9d2 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -3036,82 +3036,16 @@ Editor::edit_controls_button_release (GdkEventButton* ev) return TRUE; } -void -Editor::track_selection_changed () -{ - switch (selection->tracks.size()){ - case 0: - break; - default: - set_selected_mixer_strip (*(selection->tracks.front())); - break; - } - - for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { - (*i)->set_selected (false); - if (mouse_mode == MouseRange) { - (*i)->hide_selection (); - } - } - - for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) { - (*i)->set_selected (true); - if (mouse_mode == MouseRange) { - (*i)->show_selection (selection->time); - } - } -} - -void -Editor::time_selection_changed () -{ - for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { - (*i)->hide_selection (); - } - - if (selection->tracks.empty()) { - for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { - (*i)->show_selection (selection->time); - } - } else { - for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) { - (*i)->show_selection (selection->time); - } - } - - if (selection->time.empty()) { - ActionManager::set_sensitive (ActionManager::time_selection_sensitive_actions, false); - } else { - ActionManager::set_sensitive (ActionManager::time_selection_sensitive_actions, true); - } -} - -void -Editor::region_selection_changed () -{ - for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { - (*i)->set_selected_regionviews (selection->regions); - } -} - -void -Editor::point_selection_changed () -{ - for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { - (*i)->set_selected_points (selection->points); - } -} - gint Editor::mouse_select_button_release (GdkEventButton* ev) { /* this handles just right-clicks */ if (ev->button != 3) { - return FALSE; + return false; } - return TRUE; + return true; } Editor::TrackViewList * diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index 31560a779a..172f71d4a7 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -306,6 +306,16 @@ Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType it return; } + + if (event->type == GDK_BUTTON_PRESS || event->type == GDK_BUTTON_RELEASE) { + + if ((event->button.state & Keyboard::RelevantModifierKeyMask) && event->button.button != 1) { + + /* no selection action on modified button-2 or button-3 events */ + + return; + } + } Selection::Operation op = Keyboard::selection_type (event->button.state); bool press = (event->type == GDK_BUTTON_PRESS); @@ -4681,16 +4691,15 @@ Editor::drag_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event) return; } -// if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) { -// snap_to (drag_info.current_pointer_frame); - -// if (drag_info.first_move) { -// snap_to (drag_info.grab_frame); -// } -// } - + if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) { + if (drag_info.first_move) { + snap_to (drag_info.grab_frame); + } + snap_to (drag_info.current_pointer_frame); + } /* base start and end on initial click position */ + if (drag_info.current_pointer_frame < drag_info.grab_frame) { start = drag_info.current_pointer_frame; end = drag_info.grab_frame; @@ -4702,8 +4711,7 @@ Editor::drag_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event) if (drag_info.current_pointer_y < drag_info.grab_y) { y1 = drag_info.current_pointer_y; y2 = drag_info.grab_y; - } - else { + } else { y2 = drag_info.current_pointer_y; y1 = drag_info.grab_y; } @@ -4750,7 +4758,7 @@ Editor::end_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event) Selection::Operation op = Keyboard::selection_type (event->button.state); bool commit; - begin_reversible_command (_("select regions")); + begin_reversible_command (_("rubberband selection")); if (drag_info.grab_frame < drag_info.last_pointer_frame) { commit = select_all_within (drag_info.grab_frame, drag_info.last_pointer_frame, y1, y2, op); diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index e500175cbc..3b053d7042 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -1309,7 +1309,7 @@ Editor::select_all_in_track (Selection::Operation op) selection->set (touched); break; case Selection::Extend: - /* not defined yet */ + /* meaningless, because we're selecting everything */ break; case Selection::Add: selection->add (touched); @@ -1340,7 +1340,7 @@ Editor::select_all (Selection::Operation op) selection->set (touched); break; case Selection::Extend: - /* not defined yet */ + /* meaningless, because we're selecting everything */ break; } commit_reversible_command (); diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc index 0fcd83c58e..80f8ca347c 100644 --- a/gtk2_ardour/editor_selection.cc +++ b/gtk2_ardour/editor_selection.cc @@ -23,6 +23,7 @@ #include #include "editor.h" +#include "actions.h" #include "audio_time_axis.h" #include "audio_region_view.h" #include "audio_streamview.h" @@ -597,3 +598,69 @@ Editor::set_selected_regionview_from_map_event (GdkEventAny* ev, StreamView* sv, return true; } +void +Editor::track_selection_changed () +{ + switch (selection->tracks.size()){ + case 0: + break; + default: + set_selected_mixer_strip (*(selection->tracks.front())); + break; + } + + for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { + (*i)->set_selected (false); + if (mouse_mode == MouseRange) { + (*i)->hide_selection (); + } + } + + for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) { + (*i)->set_selected (true); + if (mouse_mode == MouseRange) { + (*i)->show_selection (selection->time); + } + } +} + +void +Editor::time_selection_changed () +{ + for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { + (*i)->hide_selection (); + } + + if (selection->tracks.empty()) { + for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { + (*i)->show_selection (selection->time); + } + } else { + for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) { + (*i)->show_selection (selection->time); + } + } + + if (selection->time.empty()) { + ActionManager::set_sensitive (ActionManager::time_selection_sensitive_actions, false); + } else { + ActionManager::set_sensitive (ActionManager::time_selection_sensitive_actions, true); + } +} + +void +Editor::region_selection_changed () +{ + for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { + (*i)->set_selected_regionviews (selection->regions); + } +} + +void +Editor::point_selection_changed () +{ + for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { + (*i)->set_selected_points (selection->points); + } +} + diff --git a/gtk2_ardour/selection.cc b/gtk2_ardour/selection.cc index 2ea9edfb2f..8a34752cdd 100644 --- a/gtk2_ardour/selection.cc +++ b/gtk2_ardour/selection.cc @@ -630,8 +630,16 @@ void Selection::toggle (const vector& autos) { for (vector::const_iterator x = autos.begin(); x != autos.end(); ++x) { - (*x)->set_selected (!(*x)->get_selected()); + if ((*x)->get_selected()) { + points.remove (**x); + } else { + points.push_back (**x); + } + + delete *x; } + + PointsChanged (); /* EMIT SIGNAL */ } void @@ -717,7 +725,6 @@ Selection::add (vector& autos) { for (vector::iterator i = autos.begin(); i != autos.end(); ++i) { points.push_back (**i); - delete *i; } PointsChanged (); diff --git a/libs/ardour/ardour/configuration_variable.h b/libs/ardour/ardour/configuration_variable.h index 4327fa69b1..8710369a64 100644 --- a/libs/ardour/ardour/configuration_variable.h +++ b/libs/ardour/ardour/configuration_variable.h @@ -61,6 +61,7 @@ class ConfigVariable : public ConfigVariableBase void add_to_node (XMLNode& node) { std::stringstream ss; ss << value; + cerr << "Config variable " << _name << " stored as " << ss.str() << endl; XMLNode* child = new XMLNode ("Option"); child->add_property ("name", _name); child->add_property ("value", ss.str());