diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2006-05-19 20:10:35 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2006-05-19 20:10:35 +0000 |
commit | 9c6984dbbb5583147788876dba80e203c2d38d1a (patch) | |
tree | 4db0a08b1049f8ddd8f237c85474568e8a62e099 /gtk2_ardour | |
parent | 50ee09e80ff91bf0146e89728578d5e31aba23b7 (diff) |
allow for mandatory control protocols, plus some ongoing work on automation control point selection (unfinished)
git-svn-id: svn://localhost/trunk/ardour2@516 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/add_route_dialog.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui_ed.cc | 38 | ||||
-rw-r--r-- | gtk2_ardour/automation_time_axis.cc | 25 | ||||
-rw-r--r-- | gtk2_ardour/automation_time_axis.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor.cc | 26 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/editor_canvas_events.cc | 131 | ||||
-rw-r--r-- | gtk2_ardour/editor_mouse.cc | 17 | ||||
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 26 | ||||
-rw-r--r-- | gtk2_ardour/selection.cc | 4 |
10 files changed, 179 insertions, 93 deletions
diff --git a/gtk2_ardour/add_route_dialog.cc b/gtk2_ardour/add_route_dialog.cc index ef8e601344..8664dae61c 100644 --- a/gtk2_ardour/add_route_dialog.cc +++ b/gtk2_ardour/add_route_dialog.cc @@ -61,7 +61,7 @@ AddRouteDialog::AddRouteDialog () : Dialog (_("ardour: add track/bus")), track_button (_("Tracks")), bus_button (_("Busses")), - routes_adjustment (1, 1, 32, 1, 4), + routes_adjustment (1, 1, 128, 1, 4), routes_spinner (routes_adjustment) { if (channel_combo_strings.empty()) { diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index 70031b102a..f8d4943fd7 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -34,6 +34,7 @@ #include <ardour/session.h> #include <ardour/control_protocol_manager.h> +#include <ardour/control_protocol.h> #include "i18n.h" @@ -472,24 +473,27 @@ ARDOUR_UI::build_control_surface_menu () for (i = ControlProtocolManager::instance().control_protocol_info.begin(); i != ControlProtocolManager::instance().control_protocol_info.end(); ++i) { - string action_name = "Toggle"; - action_name += legalize_for_path ((*i)->name); - action_name += "Surface"; - - string action_label = (*i)->name; - - Glib::RefPtr<Action> act = ActionManager::register_toggle_action (editor->editor_actions, action_name.c_str(), action_label.c_str(), - (bind (mem_fun (*this, &ARDOUR_UI::toggle_control_protocol), *i))); - - Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act); - - if ((*i)->protocol || (*i)->requested) { - tact->set_active (); + if (!(*i)->mandatory) { + + string action_name = "Toggle"; + action_name += legalize_for_path ((*i)->name); + action_name += "Surface"; + + string action_label = (*i)->name; + + Glib::RefPtr<Action> act = ActionManager::register_toggle_action (editor->editor_actions, action_name.c_str(), action_label.c_str(), + (bind (mem_fun (*this, &ARDOUR_UI::toggle_control_protocol), *i))); + + Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act); + + if ((*i)->protocol || (*i)->requested) { + tact->set_active (); + } + + ui += "<menuitem action='"; + ui += action_name; + ui += "'/>\n"; } - - ui += "<menuitem action='"; - ui += action_name; - ui += "'/>\n"; } ui += "</menu>\n</menu>\n</menubar>\n"; diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index dfa0076eaa..2175008b34 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -536,6 +536,31 @@ AutomationTimeAxisView::cut_copy_clear_one (AutomationLine& line, Selection& sel return ret; } +void +AutomationTimeAxisView::reset_objects (PointSelection& selection) +{ + for (vector<AutomationLine*>::iterator i = lines.begin(); i != lines.end(); ++i) { + reset_objects_one ((**i), selection); + } +} + +void +AutomationTimeAxisView::reset_objects_one (AutomationLine& line, PointSelection& selection) +{ + AutomationList& alist (line.the_list()); + + _session.add_undo (alist.get_memento()); + + for (PointSelection::iterator i = selection.begin(); i != selection.end(); ++i) { + + if (&(*i).track != this) { + continue; + } + + alist.reset_range ((*i).start, (*i).end); + } +} + bool AutomationTimeAxisView::cut_copy_clear_objects (PointSelection& selection, CutCopyOp op) { diff --git a/gtk2_ardour/automation_time_axis.h b/gtk2_ardour/automation_time_axis.h index 0fd166c432..deb08b41f0 100644 --- a/gtk2_ardour/automation_time_axis.h +++ b/gtk2_ardour/automation_time_axis.h @@ -64,6 +64,7 @@ class AutomationTimeAxisView : public TimeAxisView { bool cut_copy_clear (Selection&, Editing::CutCopyOp); bool cut_copy_clear_objects (PointSelection&, Editing::CutCopyOp); bool paste (jack_nframes_t, float times, Selection&, size_t nth); + void reset_objects (PointSelection&); void add_ghost (GhostRegion*); void remove_ghost (GhostRegion*); @@ -105,6 +106,7 @@ class AutomationTimeAxisView : public TimeAxisView { bool cut_copy_clear_one (AutomationLine&, Selection&, Editing::CutCopyOp); bool cut_copy_clear_objects_one (AutomationLine&, PointSelection&, Editing::CutCopyOp); bool paste_one (AutomationLine&, jack_nframes_t, float times, Selection&, size_t nth); + void reset_objects_one (AutomationLine&, PointSelection&); virtual void set_automation_state (ARDOUR::AutoState) = 0; bool ignore_state_request; diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 5df36c91b1..62cfb30e6d 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -3143,19 +3143,25 @@ Editor::set_selected_control_point_from_click (Selection::Operation op, bool wit return; } + /* select this point and any others that it represents */ + + bool commit; + if (with_undo) { - begin_reversible_command (_("set selected control point")); + begin_reversible_command (_("select control points")); } + + double y1, y2; + jack_nframes_t x1, x2; - switch (op) { - case Selection::Set: - break; - case Selection::Toggle: - break; - case Selection::Extend: - break; - } - if (with_undo) { + x1 = pixel_to_frame (clicked_control_point->get_x() - 10); + x2 = pixel_to_frame (clicked_control_point->get_x() + 10); + y1 = clicked_control_point->get_x() - 10; + y2 = clicked_control_point->get_y() + 10; + + commit = select_all_within (x1, x2, y1, y2, op); + + if (with_undo && commit) { commit_reversible_command (); } } diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 91f2bc9810..995d5347ed 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -841,6 +841,7 @@ class Editor : public PublicEditor /* EDITING OPERATIONS */ + void reset_point_selection (); void toggle_region_mute (); void toggle_region_opaque (); void raise_region (); diff --git a/gtk2_ardour/editor_canvas_events.cc b/gtk2_ardour/editor_canvas_events.cc index 256920d32f..29997f5f57 100644 --- a/gtk2_ardour/editor_canvas_events.cc +++ b/gtk2_ardour/editor_canvas_events.cc @@ -52,77 +52,78 @@ Editor::track_canvas_scroll (GdkEventScroll* ev) switch (ev->direction) { case GDK_SCROLL_UP: - if (Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) { - //if (ev->state == GDK_CONTROL_MASK) { - /* XXX - the ev->x will be out of step with the canvas - if we're in mid zoom, so we have to get the damn mouse - pointer again - */ - track_canvas.get_pointer (x, y); - track_canvas.window_to_world (x, y, wx, wy); - wx += horizontal_adjustment.get_value(); - wy += vertical_adjustment.get_value(); - - GdkEvent event; - event.type = GDK_BUTTON_RELEASE; - event.button.x = wx; - event.button.y = wy; - - jack_nframes_t where = event_frame (&event, 0, 0); - temporal_zoom_to_frame (true, where); - return true; - } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::Shift)) { - if (!current_stepping_trackview) { - step_timeout = Glib::signal_timeout().connect (mem_fun(*this, &Editor::track_height_step_timeout), 500); - if (!(current_stepping_trackview = dynamic_cast<AudioTimeAxisView*> (trackview_by_y_position (ev->y)))) { - return false; + if (Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) { + //if (ev->state == GDK_CONTROL_MASK) { + /* XXX + the ev->x will be out of step with the canvas + if we're in mid zoom, so we have to get the damn mouse + pointer again + */ + track_canvas.get_pointer (x, y); + track_canvas.window_to_world (x, y, wx, wy); + wx += horizontal_adjustment.get_value(); + wy += vertical_adjustment.get_value(); + + GdkEvent event; + event.type = GDK_BUTTON_RELEASE; + event.button.x = wx; + event.button.y = wy; + + jack_nframes_t where = event_frame (&event, 0, 0); + temporal_zoom_to_frame (true, where); + return true; + } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::Shift)) { + if (!current_stepping_trackview) { + step_timeout = Glib::signal_timeout().connect (mem_fun(*this, &Editor::track_height_step_timeout), 500); + if (!(current_stepping_trackview = dynamic_cast<AudioTimeAxisView*> (trackview_by_y_position (ev->y)))) { + return false; + } } + gettimeofday (&last_track_height_step_timestamp, 0); + current_stepping_trackview->step_height (true); + return true; + } else { + scroll_tracks_up_line (); + return true; } - gettimeofday (&last_track_height_step_timestamp, 0); - current_stepping_trackview->step_height (true); - return true; - } else { - scroll_tracks_up_line (); - return true; - } - break; + break; case GDK_SCROLL_DOWN: - if (Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) { - //if (ev->state == GDK_CONTROL_MASK) { - track_canvas.get_pointer (x, y); - track_canvas.window_to_world (x, y, wx, wy); - wx += horizontal_adjustment.get_value(); - wy += vertical_adjustment.get_value(); - - GdkEvent event; - event.type = GDK_BUTTON_RELEASE; - event.button.x = wx; - event.button.y = wy; - - jack_nframes_t where = event_frame (&event, 0, 0); - temporal_zoom_to_frame (false, where); - return true; - } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::Shift)) { - if (!current_stepping_trackview) { - step_timeout = Glib::signal_timeout().connect (mem_fun(*this, &Editor::track_height_step_timeout), 500); - if (!(current_stepping_trackview = dynamic_cast<AudioTimeAxisView*> (trackview_by_y_position (ev->y)))) { - return false; + if (Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) { + //if (ev->state == GDK_CONTROL_MASK) { + track_canvas.get_pointer (x, y); + track_canvas.window_to_world (x, y, wx, wy); + wx += horizontal_adjustment.get_value(); + wy += vertical_adjustment.get_value(); + + GdkEvent event; + event.type = GDK_BUTTON_RELEASE; + event.button.x = wx; + event.button.y = wy; + + jack_nframes_t where = event_frame (&event, 0, 0); + temporal_zoom_to_frame (false, where); + return true; + } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::Shift)) { + if (!current_stepping_trackview) { + step_timeout = Glib::signal_timeout().connect (mem_fun(*this, &Editor::track_height_step_timeout), 500); + if (!(current_stepping_trackview = dynamic_cast<AudioTimeAxisView*> (trackview_by_y_position (ev->y)))) { + return false; + } } + gettimeofday (&last_track_height_step_timestamp, 0); + current_stepping_trackview->step_height (false); + return true; + } else { + scroll_tracks_down_line (); + return true; } - gettimeofday (&last_track_height_step_timestamp, 0); - current_stepping_trackview->step_height (false); - return true; - } else { - scroll_tracks_down_line (); - return true; - } - break; + break; + default: /* no left/right handling yet */ break; } - + return false; } @@ -547,6 +548,12 @@ Editor::canvas_control_point_event (GdkEvent *event, ArdourCanvas::Item* item, C clicked_regionview = 0; break; + case GDK_SCROLL_UP: + break; + + case GDK_SCROLL_DOWN: + break; + default: break; } diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index 21e99ae202..bf8b16c0d7 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -328,7 +328,7 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp case PanAutomationControlPointItem: case RedirectAutomationControlPointItem: if ((cp = static_cast<ControlPoint *> (item->get_data ("control_point"))) != 0) { - set_selected_control_point_from_click (Keyboard::selection_type (event->button.state), true); + set_selected_control_point_from_click (Keyboard::selection_type (event->button.state), false); } break; @@ -2495,13 +2495,26 @@ Editor::control_point_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* cp->line.point_drag (*cp, cx_frames , fraction, push); set_verbose_canvas_cursor_text (cp->line.get_verbose_cursor_string (fraction)); + + drag_info.first_move = false; } void Editor::control_point_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event) { ControlPoint* cp = reinterpret_cast<ControlPoint *> (drag_info.data); - control_point_drag_motion_callback (item, event); + + if (drag_info.first_move) { + + /* just a click */ + + if ((event->type == GDK_BUTTON_RELEASE) && (event->button.button == 1) && Keyboard::modifier_state_equals (event->button.state, Keyboard::Shift)) { + reset_point_selection (); + } + + } else { + control_point_drag_motion_callback (item, event); + } cp->line.end_drag (cp); } diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 3fb1d40c19..bccdce27c1 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -1351,18 +1351,27 @@ Editor::select_all_within (jack_nframes_t start, jack_nframes_t end, double top, } (*iter)->get_selectables (start, end, top, bot, touched); } + + cerr << "select all within found " << touched.size() << endl; + begin_reversible_command (_("select all within")); switch (op) { case Selection::Toggle: + cerr << "toggle\n"; selection->add (touched); break; case Selection::Set: + cerr << "set\n"; selection->set (touched); break; case Selection::Extend: + cerr << "extend\n"; /* not defined yet */ break; } + + cerr << "selection now has " << selection->points.size() << endl; + commit_reversible_command (); return !touched.empty(); } @@ -3149,6 +3158,23 @@ Editor::duplicate_selection (float times) } void +Editor::reset_point_selection () +{ + /* reset all selected points to the relevant default value */ + + cerr << "point selection has " << selection->points.size() << " entries\n"; + + for (PointSelection::iterator i = selection->points.begin(); i != selection->points.end(); ++i) { + + AutomationTimeAxisView* atv = dynamic_cast<AutomationTimeAxisView*>(&(*i).track); + + if (atv) { + atv->reset_objects (selection->points); + } + } +} + +void Editor::center_playhead () { float page = canvas_width * frames_per_unit; diff --git a/gtk2_ardour/selection.cc b/gtk2_ardour/selection.cc index 82e8bbb682..8424ff5378 100644 --- a/gtk2_ardour/selection.cc +++ b/gtk2_ardour/selection.cc @@ -633,6 +633,8 @@ Selection::add (list<Selectable*>& selectables) if (!autos.empty()) { add (autos); } + + cerr << "Selection @ " << this << " has " << points.size() << " points\n"; } void @@ -651,6 +653,6 @@ Selection::add (vector<AutomationSelectable*>& autos) points.push_back (**i); delete *i; } - + PointsChanged (); } |