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
This commit is contained in:
Paul Davis 2007-11-08 05:06:23 +00:00
parent c61de034c7
commit 62941af2cf
7 changed files with 130 additions and 13 deletions

View file

@ -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;

View file

@ -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,

View file

@ -42,13 +42,24 @@ void
Editor::keyboard_selection_finish (bool add)
{
if (session && have_pending_keyboard_selection) {
begin_reversible_command (_("keyboard selection"));
if (add) {
selection->add (pending_keyboard_selection_start, session->audible_frame());
nframes64_t end;
bool ignored;
if (session->transport_rolling()) {
end = session->audible_frame();
} else {
selection->set (0, pending_keyboard_selection_start, session->audible_frame());
if (!mouse_frame (end, ignored)) {
return;
}
}
commit_reversible_command ();
if (add) {
selection->add (pending_keyboard_selection_start, end);
} else {
selection->set (0, pending_keyboard_selection_start, end);
}
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;
}
}
}
}

View file

@ -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 ();
}
}

View file

@ -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

View file

@ -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

View file

@ -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;