summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2014-12-24 04:29:43 +1100
committerPaul Davis <paul@linuxaudiosystems.com>2015-01-02 08:01:12 -0500
commit884cc6f90c54c6e2e528973502554ee9405c94a2 (patch)
treed7ac77b7632e4fbcc7785b802586740c27092719 /gtk2_ardour
parent0f7df2979cfa482ed71a752f527b17e2aee81501 (diff)
Add automation track control points to undo history (and selection_op history).
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/editor.cc4
-rw-r--r--gtk2_ardour/editor.h4
-rw-r--r--gtk2_ardour/editor_actions.cc4
-rw-r--r--gtk2_ardour/selection.cc48
4 files changed, 54 insertions, 6 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index 27631cd66a..019d2f91e8 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -3360,7 +3360,7 @@ Editor::commit_reversible_selection_op ()
}
void
-Editor::undo_reversible_selection_op ()
+Editor::undo_selection_op ()
{
if (_session) {
selection_op_history_it++;
@@ -3381,7 +3381,7 @@ Editor::undo_reversible_selection_op ()
}
void
-Editor::redo_reversible_selection_op ()
+Editor::redo_selection_op ()
{
if (_session) {
if (selection_op_history_it > 0) {
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index b5c4fa404c..655782e269 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -443,8 +443,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void begin_selection_op_history ();
void begin_reversible_selection_op (std::string cmd_name);
void commit_reversible_selection_op ();
- void undo_reversible_selection_op ();
- void redo_reversible_selection_op ();
+ void undo_selection_op ();
+ void redo_selection_op ();
void begin_reversible_command (std::string cmd_name);
void begin_reversible_command (GQuark);
void commit_reversible_command ();
diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc
index 214eebac6e..49b39397cd 100644
--- a/gtk2_ardour/editor_actions.cc
+++ b/gtk2_ardour/editor_actions.cc
@@ -317,8 +317,8 @@ Editor::register_actions ()
alternate_redo_action = reg_sens (editor_actions, "alternate-redo", _("Redo"), sigc::bind (sigc::mem_fun(*this, &Editor::redo), 1U));
alternate_alternate_redo_action = reg_sens (editor_actions, "alternate-alternate-redo", _("Redo"), sigc::bind (sigc::mem_fun(*this, &Editor::redo), 1U));
- selection_undo_action = reg_sens (editor_actions, "undo-last-selection-op", _("Undo Last Selection Op"), sigc::mem_fun(*this, &Editor::undo_reversible_selection_op));
- selection_redo_action = reg_sens (editor_actions, "redo-last-selection-op", _("Redo Last Selection Op"), sigc::mem_fun(*this, &Editor::redo_reversible_selection_op));
+ selection_undo_action = reg_sens (editor_actions, "undo-last-selection-op", _("Undo Selection Change"), sigc::mem_fun(*this, &Editor::undo_selection_op));
+ selection_redo_action = reg_sens (editor_actions, "redo-last-selection-op", _("Redo Selection Change"), sigc::mem_fun(*this, &Editor::redo_selection_op));
reg_sens (editor_actions, "export-audio", _("Export Audio"), sigc::mem_fun(*this, &Editor::export_audio));
reg_sens (editor_actions, "export-range", _("Export Range"), sigc::mem_fun(*this, &Editor::export_range));
diff --git a/gtk2_ardour/selection.cc b/gtk2_ardour/selection.cc
index ae00c4f8c4..4a619e1b03 100644
--- a/gtk2_ardour/selection.cc
+++ b/gtk2_ardour/selection.cc
@@ -1232,6 +1232,20 @@ Selection::get_state () const
}
+ for (PointSelection::const_iterator i = points.begin(); i != points.end(); ++i) {
+ AutomationTimeAxisView* atv = dynamic_cast<AutomationTimeAxisView*> (&(*i)->line().trackview);
+ if (atv) {
+ XMLNode* r = node->add_child (X_("ControlPoint"));
+ r->add_property (X_("type"), "track");
+ r->add_property (X_("route-id"), atoi (atv->parent_route()->id ().to_s ().c_str()));
+ r->add_property (X_("automation-list-id"), atoi ((*i)->line().the_list()->id ().to_s ().c_str()));
+ r->add_property (X_("parameter"), EventTypeMap::instance().to_symbol ((*i)->line().the_list()->parameter ()));
+
+ snprintf(buf, sizeof(buf), "%d", (*i)->view_index());
+ r->add_property (X_("view-index"), string(buf));
+ }
+ }
+
for (TimeSelection::const_iterator i = time.begin(); i != time.end(); ++i) {
XMLNode* t = node->add_child (X_("AudioRange"));
snprintf(buf, sizeof(buf), "%" PRId64, (*i).start);
@@ -1261,6 +1275,7 @@ Selection::set_state (XMLNode const & node, int)
}
clear_regions ();
+ clear_points ();
clear_time ();
clear_tracks ();
clear_markers ();
@@ -1295,6 +1310,39 @@ Selection::set_state (XMLNode const & node, int)
regions.pending.push_back (id);
}
+ } else if ((*i)->name() == X_("ControlPoint")) {
+ XMLProperty* prop_type = (*i)->property (X_("type"));
+ XMLProperty* prop_route_id = (*i)->property (X_("route-id"));
+ XMLProperty* prop_alist_id = (*i)->property (X_("automation-list-id"));
+ XMLProperty* prop_parameter = (*i)->property (X_("parameter"));
+ XMLProperty* prop_view_index = (*i)->property (X_("view-index"));
+
+ assert (prop_type);
+ assert (prop_route_id);
+ assert (prop_alist_id);
+ assert (prop_parameter);
+ assert (prop_view_index);
+
+ if (prop_type->value () == "track") {
+ PBD::ID id (prop_route_id->value ());
+ RouteTimeAxisView* rtv = editor->get_route_view_by_route_id (id);
+
+ if (rtv) {
+ boost::shared_ptr<AutomationTimeAxisView> atv = rtv->automation_child (EventTypeMap::instance().from_symbol (prop_parameter->value ()));
+ if (atv) {
+ list<boost::shared_ptr<AutomationLine> > lines = atv->lines();
+ for (list<boost::shared_ptr<AutomationLine> > ::iterator i = lines.begin(); i != lines.end(); ++i) {
+ if ((*i)->the_list()->id() == prop_alist_id->value()) {
+ ControlPoint* cp = (*i)->nth(atol(prop_view_index->value().c_str()));
+ if (cp) {
+ add (cp);
+ }
+ }
+ }
+ }
+ }
+ }
+
} else if ((*i)->name() == X_("AudioRange")) {
XMLProperty* prop_start = (*i)->property (X_("start"));
XMLProperty* prop_end = (*i)->property (X_("end"));