13
0

a variety of bits and pieces for selection ops

git-svn-id: svn://localhost/ardour2/trunk@1375 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2007-01-23 21:45:05 +00:00
parent d38944becd
commit 3cfa32d6c2
9 changed files with 114 additions and 86 deletions

View File

@ -111,6 +111,7 @@
(gtk_accel_path "<Actions>/Editor/extend-range-to-end-of-region" "rightanglebracket")
(gtk_accel_path "<Actions>/Editor/scroll-backward" "leftarrow")
(gtk_accel_path "<Actions>/Editor/start-range" "<Control>KP_Down")
; (gtk_accel_path "<Actions>/Editor/ToggleTranzportSurface" "")
; (gtk_accel_path "<Actions>/ShuttleActions/SetShuttleUnitsSemitones" "")
; (gtk_accel_path "<Actions>/JACK/JACKLatency128" "")
; (gtk_accel_path "<Actions>/Snap/snap-to-beat" "")

View File

@ -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__ */

View File

@ -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<AutomationList>(alist, &before, &alist.get_state()));
_session.add_command (new MementoCommand<AutomationList>(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<AutomationList>(alist, &before, &alist.get_state()));
_session.add_command (new MementoCommand<AutomationList>(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;

View File

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

View File

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

View File

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

View File

@ -23,6 +23,7 @@
#include <ardour/route_group.h>
#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);
}
}

View File

@ -630,8 +630,16 @@ void
Selection::toggle (const vector<AutomationSelectable*>& autos)
{
for (vector<AutomationSelectable*>::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<AutomationSelectable*>& autos)
{
for (vector<AutomationSelectable*>::iterator i = autos.begin(); i != autos.end(); ++i) {
points.push_back (**i);
delete *i;
}
PointsChanged ();

View File

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