diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2007-11-08 05:06:23 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2007-11-08 05:06:23 +0000 |
commit | 62941af2cf8da4c5424afb9173fdb310c2c23eef (patch) | |
tree | f671f3a58da36af1694375054c2dfd6a2724aa52 | |
parent | c61de034c7271b0334ade1325a674702e026bc13 (diff) |
change kbd selection to F1 & F2; make kbd selection differentiate between rolling and not rolling conditions, using mouse location for not rolling; marker selection starts tobe used; markers get lines when selected; hide marker_grab_line now
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2608 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/editor.cc | 1 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/editor_keys.cc | 34 | ||||
-rw-r--r-- | gtk2_ardour/editor_markers.cc | 21 | ||||
-rw-r--r-- | gtk2_ardour/editor_mouse.cc | 25 | ||||
-rw-r--r-- | gtk2_ardour/marker.cc | 53 | ||||
-rw-r--r-- | gtk2_ardour/marker.h | 6 |
7 files changed, 129 insertions, 12 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 844fea9905..335e7e2f05 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -227,6 +227,7 @@ Editor::Editor () selection->TracksChanged.connect (mem_fun(*this, &Editor::track_selection_changed)); selection->RegionsChanged.connect (mem_fun(*this, &Editor::region_selection_changed)); selection->PointsChanged.connect (mem_fun(*this, &Editor::point_selection_changed)); + selection->MarkersChanged.connect (mem_fun(*this, &Editor::marker_selection_changed)); clicked_regionview = 0; clicked_trackview = 0; diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index ac36ee1d3b..e68d425397 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1424,6 +1424,7 @@ class Editor : public PublicEditor void track_selection_changed (); void region_selection_changed (); void point_selection_changed (); + void marker_selection_changed (); enum SelectionOp { CreateSelection, diff --git a/gtk2_ardour/editor_keys.cc b/gtk2_ardour/editor_keys.cc index b3081e8c8a..065560aa54 100644 --- a/gtk2_ardour/editor_keys.cc +++ b/gtk2_ardour/editor_keys.cc @@ -42,13 +42,24 @@ void Editor::keyboard_selection_finish (bool add) { if (session && have_pending_keyboard_selection) { - begin_reversible_command (_("keyboard selection")); + + nframes64_t end; + bool ignored; + + if (session->transport_rolling()) { + end = session->audible_frame(); + } else { + if (!mouse_frame (end, ignored)) { + return; + } + } + if (add) { - selection->add (pending_keyboard_selection_start, session->audible_frame()); + selection->add (pending_keyboard_selection_start, end); } else { - selection->set (0, pending_keyboard_selection_start, session->audible_frame()); + selection->set (0, pending_keyboard_selection_start, end); } - commit_reversible_command (); + have_pending_keyboard_selection = false; } } @@ -57,8 +68,19 @@ void Editor::keyboard_selection_begin () { if (session) { - pending_keyboard_selection_start = session->audible_frame(); - have_pending_keyboard_selection = true; + if (session->transport_rolling()) { + pending_keyboard_selection_start = session->audible_frame(); + have_pending_keyboard_selection = true; + } else { + bool ignored; + nframes64_t where; // XXX fix me + + if (mouse_frame (where, ignored)) { + pending_keyboard_selection_start = where; + have_pending_keyboard_selection = true; + } + + } } } diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index 158715846d..c7da177efd 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -994,3 +994,24 @@ Editor::update_punch_range_view (bool visibility) // gnome_canvas_item_hide (transport_punchout_line); // } } + +void +Editor::marker_selection_changed () +{ + for (LocationMarkerMap::iterator i = location_markers.begin(); i != location_markers.end(); ++i) { + LocationMarkers* lam = i->second; + + if (lam->start) { + lam->start->hide_line(); + } + + if (lam->end) { + lam->end->hide_line(); + } + } + + for (MarkerSelection::iterator x = selection->markers.begin(); x != selection->markers.end(); ++x) { + (*x)->add_line (track_canvas.root(), canvas_height); + (*x)->show_line (); + } +} diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index 86e6a9960a..6436b19684 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -1557,8 +1557,8 @@ Editor::motion_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item */ if (!drag_info.move_threshold_passed) { - bool x_threshold_passed = (abs ((nframes64_t) (drag_info.current_pointer_x - drag_info.grab_x)) > 4LL); - bool y_threshold_passed = (abs ((nframes64_t) (drag_info.current_pointer_y - drag_info.grab_y)) > 4LL); + bool x_threshold_passed = (llabs ((nframes64_t) (drag_info.current_pointer_x - drag_info.grab_x)) > 4LL); + bool y_threshold_passed = (llabs ((nframes64_t) (drag_info.current_pointer_y - drag_info.grab_y)) > 4LL); drag_info.move_threshold_passed = (x_threshold_passed || y_threshold_passed); @@ -2147,8 +2147,8 @@ Editor::start_marker_grab (ArdourCanvas::Item* item, GdkEvent* event) update_marker_drag_item (location); if (location->is_mark()) { - marker_drag_line->show(); - marker_drag_line->raise_to_top(); + // marker_drag_line->show(); + // marker_drag_line->raise_to_top(); } else { range_marker_drag_rect->show(); range_marker_drag_rect->raise_to_top(); @@ -2159,6 +2159,23 @@ Editor::start_marker_grab (ArdourCanvas::Item* item, GdkEvent* event) } else { show_verbose_time_cursor (location->end(), 10); } + + Selection::Operation op = Keyboard::selection_type (event->button.state); + + switch (op) { + case Selection::Toggle: + selection->toggle (marker); + break; + case Selection::Set: + selection->set (marker); + break; + case Selection::Extend: + selection->add (marker); + break; + case Selection::Add: + selection->add (marker); + break; + } } void diff --git a/gtk2_ardour/marker.cc b/gtk2_ardour/marker.cc index 4065ad978b..880e02b5e9 100644 --- a/gtk2_ardour/marker.cc +++ b/gtk2_ardour/marker.cc @@ -250,9 +250,9 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con delete font; if (annotate_left) { - text->property_x() = -(text->property_text_width()); + text->property_x() = -(text->property_text_width()); } else { - text->property_x() = label_offset; + text->property_x() = label_offset; } text->property_y() = 0.0; text->property_anchor() = Gtk::ANCHOR_NW; @@ -266,6 +266,9 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con group->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_marker_event), mark, this)); } + line = 0; + line_points = 0; + } Marker::~Marker () @@ -274,6 +277,46 @@ Marker::~Marker () delete text; delete mark; delete points; + + if (line) { + delete line; + delete line_points; + } +} + +void +Marker::add_line (ArdourCanvas::Group* group, double initial_height) +{ + if (!line) { + + line_points = new ArdourCanvas::Points (); + line_points->push_back (Gnome::Art::Point (unit_position, 0.0)); + line_points->push_back (Gnome::Art::Point (unit_position, initial_height)); + + line = new ArdourCanvas::Line (*group); + line->property_width_pixels() = 1; + line->property_points() = *line_points; + line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_EditCursor.get(); + } + + show_line (); +} + +void +Marker::show_line () +{ + if (line) { + line->raise_to_top(); + line->show (); + } +} + +void +Marker::hide_line () +{ + if (line) { + line->hide (); + } } ArdourCanvas::Item& @@ -299,6 +342,12 @@ Marker::set_position (nframes_t frame) group->move (new_unit_position - unit_position, 0.0); frame_position = frame; unit_position = new_unit_position; + + if (line) { + (*line_points)[0].set_x (unit_position); + (*line_points)[1].set_x (unit_position); + line->property_points() = *line_points; + } } void diff --git a/gtk2_ardour/marker.h b/gtk2_ardour/marker.h index 7865004d54..5090990c3c 100644 --- a/gtk2_ardour/marker.h +++ b/gtk2_ardour/marker.h @@ -57,6 +57,10 @@ class Marker : public sigc::trackable ArdourCanvas::Item& the_item() const; + void add_line (ArdourCanvas::Group*, double initial_height); + void show_line (); + void hide_line (); + void set_position (nframes_t); void set_name (const string&); void set_color_rgba (uint32_t rgba); @@ -73,6 +77,8 @@ class Marker : public sigc::trackable ArdourCanvas::Polygon *mark; ArdourCanvas::Text *text; ArdourCanvas::Points *points; + ArdourCanvas::Line *line; + ArdourCanvas::Points *line_points; double unit_position; nframes_t frame_position; |