diff options
Diffstat (limited to 'gtk2_ardour')
41 files changed, 667 insertions, 479 deletions
diff --git a/gtk2_ardour/SConscript b/gtk2_ardour/SConscript index 33f2d3471b..2d59be1b5e 100644 --- a/gtk2_ardour/SConscript +++ b/gtk2_ardour/SConscript @@ -59,6 +59,7 @@ if gtkardour['FFT_ANALYSIS']: if gtkardour['COREAUDIO']: gtkardour.Append(CCFLAGS='-DHAVE_COREAUDIO') + gtkardour.Merge([libraries['appleutility']]) skipped_files=Split(""" connection_editor.cc diff --git a/gtk2_ardour/ardev_common.sh b/gtk2_ardour/ardev_common.sh index ce3b1935c5..bf644f3e84 100755 --- a/gtk2_ardour/ardev_common.sh +++ b/gtk2_ardour/ardev_common.sh @@ -2,7 +2,7 @@ export ARDOUR_PATH=./glade:./pixmaps:. -export LD_LIBRARY_PATH=../libs/surfaces/control_protocol:../libs/ardour:../libs/midi++2:../libs/pbd:../libs/soundtouch:../libs/gtkmm2ext:../libs/sigc++2:../libs/glibmm2:../libs/gtkmm2/atk:../libs/gtkmm2/pango:../libs/gtkmm2/gdk:../libs/gtkmm2/gtk:../libs/libgnomecanvasmm:../libs/libsndfile:$LD_LIBRARY_PATH +export LD_LIBRARY_PATH=../libs/surfaces/control_protocol:../libs/ardour:../libs/midi++2:../libs/pbd:../libs/soundtouch:../libs/gtkmm2ext:../libs/sigc++2:../libs/glibmm2:../libs/gtkmm2/atk:../libs/gtkmm2/pango:../libs/gtkmm2/gdk:../libs/gtkmm2/gtk:../libs/libgnomecanvasmm:../libs/libsndfile:../libs/appleutility:$LD_LIBRARY_PATH # DYLD_LIBRARY_PATH is for darwin. export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH diff --git a/gtk2_ardour/ardour2_ui.rc b/gtk2_ardour/ardour2_ui.rc index 6945ea1338..d589f6ce55 100644 --- a/gtk2_ardour/ardour2_ui.rc +++ b/gtk2_ardour/ardour2_ui.rc @@ -219,6 +219,14 @@ style "mute_button" = "small_button" fg[PRELIGHT] = { 0, 0, 0 } } + +style "multiline_combo" = "small_button" +{ + font_name = "sans 8" + xthickness = 0 + ythickness = 0 +} + style "mixer_mute_button" = "mute_button" { font_name = "sans 7" @@ -951,6 +959,7 @@ widget "*TrackRecordEnableButton" style "track_rec_enable_button" widget "*TrackRecordEnableButton*" style "track_rec_enable_button" widget "*TrackMuteButton*" style "mute_button" widget "*TrackLoopButton*" style "track_loop_button" +widget "*PanAutomationLineSelector*" style "multiline_combo" widget "*EditorTimeButton*" style "time_button" widget "*EditorMixerButton*" style "default_buttons_menus" widget "*SoloButton*" style "solo_button" diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 827a967361..203d64c3c3 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -1326,6 +1326,7 @@ ARDOUR_UI::start_engine () settings for a new session */ session->save_state (""); + session->save_history (); } /* there is too much going on, in too many threads, for us to @@ -1499,6 +1500,7 @@ ARDOUR_UI::save_state_canfail (string name) } if ((ret = session->save_state (name)) != 0) { + session->save_history(); return ret; } } diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc index 25f3068a81..d2cc3e1e1c 100644 --- a/gtk2_ardour/ardour_ui_dialogs.cc +++ b/gtk2_ardour/ardour_ui_dialogs.cc @@ -156,6 +156,7 @@ ARDOUR_UI::unload_session () case 1: session->save_state (""); + session->save_history(); break; } } diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc index b12713433b..dff2300529 100644 --- a/gtk2_ardour/audio_region_view.cc +++ b/gtk2_ardour/audio_region_view.cc @@ -28,6 +28,7 @@ #include <ardour/audioregion.h> #include <ardour/audiosource.h> #include <ardour/audio_diskstream.h> +#include <pbd/memento_command.h> #include "streamview.h" #include "audio_region_view.h" @@ -896,18 +897,20 @@ AudioRegionView::add_gain_point_event (ArdourCanvas::Item *item, GdkEvent *ev) gain_line->view_to_model_y (y); trackview.session().begin_reversible_command (_("add gain control point")); - trackview.session().add_undo (audio_region().envelope().get_memento()); + XMLNode &before = audio_region().envelope().get_state(); if (!audio_region().envelope_active()) { - trackview.session().add_undo( bind( mem_fun(audio_region(), &AudioRegion::set_envelope_active), false) ); + XMLNode &before = audio_region().get_state(); audio_region().set_envelope_active(true); - trackview.session().add_redo( bind( mem_fun(audio_region(), &AudioRegion::set_envelope_active), true) ); + XMLNode &after = audio_region().get_state(); + trackview.session().add_command (new MementoCommand<AudioRegion>(audio_region(), before, after)); } audio_region().envelope().add (fx, y); - trackview.session().add_redo_no_execute (audio_region().envelope().get_memento()); + XMLNode &after = audio_region().envelope().get_state(); + trackview.session().add_command (new MementoCommand<Curve>(audio_region().envelope(), before, after)); trackview.session().commit_reversible_command (); } diff --git a/gtk2_ardour/audio_time_axis.cc b/gtk2_ardour/audio_time_axis.cc index 376e05aa4c..9ae94d1fe0 100644 --- a/gtk2_ardour/audio_time_axis.cc +++ b/gtk2_ardour/audio_time_axis.cc @@ -31,6 +31,7 @@ #include <pbd/error.h> #include <pbd/stl_delete.h> #include <pbd/whitespace.h> +#include <pbd/memento_command.h> #include <gtkmm2ext/gtk_ui.h> #include <gtkmm2ext/selector.h> diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index b87a71ca87..5c09ddd49b 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -23,6 +23,7 @@ #include <vector> #include <pbd/stl_delete.h> +#include <pbd/memento_command.h> #include <ardour/automation_event.h> #include <ardour/curve.h> @@ -887,7 +888,7 @@ AutomationLine::start_drag (ControlPoint* cp, float fraction) } trackview.editor.current_session()->begin_reversible_command (str); - trackview.editor.current_session()->add_undo (get_memento()); + trackview.editor.current_session()->add_command (new MementoUndoCommand<AutomationLine>(*this, get_state())); first_drag_fraction = fraction; last_drag_fraction = fraction; @@ -936,7 +937,7 @@ AutomationLine::end_drag (ControlPoint* cp) update_pending = false; - trackview.editor.current_session()->add_redo_no_execute (get_memento()); + trackview.editor.current_session()->add_command (new MementoRedoCommand<AutomationLine>(*this, get_state())); trackview.editor.current_session()->commit_reversible_command (); trackview.editor.current_session()->set_dirty (); } @@ -1013,11 +1014,11 @@ AutomationLine::remove_point (ControlPoint& cp) model_representation (cp, mr); trackview.editor.current_session()->begin_reversible_command (_("remove control point")); - trackview.editor.current_session()->add_undo (get_memento()); + XMLNode &before = get_state(); alist.erase (mr.start, mr.end); - trackview.editor.current_session()->add_redo_no_execute (get_memento()); + trackview.editor.current_session()->add_command(new MementoCommand<AutomationLine>(*this, before, get_state())); trackview.editor.current_session()->commit_reversible_command (); trackview.editor.current_session()->set_dirty (); } @@ -1225,9 +1226,9 @@ void AutomationLine::clear () { /* parent must create command */ - trackview.editor.current_session()->add_undo (get_memento()); + XMLNode &before = get_state(); alist.clear(); - trackview.editor.current_session()->add_redo_no_execute (get_memento()); + trackview.editor.current_session()->add_command (new MementoCommand<AutomationLine>(*this, before, get_state())); trackview.editor.current_session()->commit_reversible_command (); trackview.editor.current_session()->set_dirty (); } @@ -1266,3 +1267,16 @@ AutomationLine::hide_all_but_selected_control_points () } } } + +XMLNode &AutomationLine::get_state(void) +{ + // TODO + return alist.get_state(); +} + +int AutomationLine::set_state(const XMLNode &node) +{ + // TODO + alist.set_state(node); + return 0; +} diff --git a/gtk2_ardour/automation_line.h b/gtk2_ardour/automation_line.h index e922de6c80..ec86b7455f 100644 --- a/gtk2_ardour/automation_line.h +++ b/gtk2_ardour/automation_line.h @@ -94,7 +94,7 @@ class ControlPoint ShapeType _shape; }; -class AutomationLine : public sigc::trackable +class AutomationLine : public sigc::trackable, public Stateful { public: AutomationLine (const string & name, TimeAxisView&, ArdourCanvas::Group&, ARDOUR::AutomationList&); @@ -158,7 +158,12 @@ class AutomationLine : public sigc::trackable bool is_last_point (ControlPoint &); bool is_first_point (ControlPoint &); + XMLNode& get_state (void); + int set_state (const XMLNode&); + + PBD::ID id() { return _id; } protected: + PBD::ID _id; string _name; guint32 _height; uint32_t _line_color; diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index 02a88b578b..7025a11178 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -1,4 +1,5 @@ #include <ardour/route.h> +#include <pbd/memento_command.h> #include "ardour_ui.h" #include "automation_time_axis.h" @@ -40,6 +41,7 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro auto_write_item = 0; auto_play_item = 0; ignore_state_request = false; + first_call_to_set_height = true; // base_rect = gnome_canvas_item_new (GNOME_CANVAS_GROUP(canvas_display), // gnome_canvas_simplerect_get_type(), @@ -72,6 +74,8 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro clear_button.set_name ("TrackVisualButton"); hide_button.set_name ("TrackRemoveButton"); + controls_table.set_no_show_all(); + ARDOUR_UI::instance()->tooltips().set_tip(height_button, _("track height")); ARDOUR_UI::instance()->tooltips().set_tip(auto_button, _("automation state")); ARDOUR_UI::instance()->tooltips().set_tip(clear_button, _("clear track")); @@ -98,7 +102,7 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro } } name_label.set_text (shortpname); - name_label.set_alignment (1.0, 0.5); + name_label.set_alignment (Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); if (nomparent.length()) { @@ -114,7 +118,7 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro plugname = new Label (pname); plugname->set_name (X_("TrackPlugName")); - plugname->set_alignment (1.0, 0.5); + plugname->show(); name_label.set_name (X_("TrackParameterName")); controls_table.remove (name_hbox); controls_table.attach (*plugname, 1, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); @@ -138,8 +142,8 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro controls_table.attach (hide_button, 0, 1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); controls_table.attach (height_button, 0, 1, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); - controls_table.attach (auto_button, 6, 8, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); - controls_table.attach (clear_button, 6, 8, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); + controls_table.attach (auto_button, 5, 8, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); + controls_table.attach (clear_button, 5, 8, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); controls_table.show_all (); @@ -281,11 +285,11 @@ AutomationTimeAxisView::set_height (TrackHeight ht) uint32_t h = height_to_pixels (ht); bool changed = (height != (uint32_t) h); + bool changed_between_small_and_normal = ( (ht == Small || ht == Smaller) ^ (height_style == Small || height_style == Smaller) ); + TimeAxisView* state_parent = get_parent_with_state (); XMLNode* xml_node = state_parent->get_child_xml_node (_state_name); - //controls_table.show_all (); - TimeAxisView::set_height (ht); base_rect->property_y2() = h; @@ -297,117 +301,88 @@ AutomationTimeAxisView::set_height (TrackHeight ht) (*i)->set_height (); } + switch (ht) { case Largest: xml_node->add_property ("track_height", "largest"); - controls_table.remove (name_hbox); - if (plugname) { - if (plugname_packed) { - controls_table.remove (*plugname); - plugname_packed = false; - } - controls_table.attach (*plugname, 1, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); - plugname_packed = true; - controls_table.attach (name_hbox, 1, 5, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); - } else { - controls_table.attach (name_hbox, 1, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); - } - controls_table.show_all (); - - hide_name_entry (); - show_name_label (); break; case Large: xml_node->add_property ("track_height", "large"); - controls_table.remove (name_hbox); - if (plugname) { - if (plugname_packed) { - controls_table.remove (*plugname); - plugname_packed = false; - } - controls_table.attach (*plugname, 1, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); - plugname_packed = true; - } else { - controls_table.attach (name_hbox, 1, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); - } - controls_table.show_all (); - hide_name_entry (); - show_name_label (); break; case Larger: xml_node->add_property ("track_height", "larger"); - controls_table.remove (name_hbox); - if (plugname) { - if (plugname_packed) { - controls_table.remove (*plugname); - plugname_packed = false; - } - controls_table.attach (*plugname, 1, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); - plugname_packed = true; - } else { - controls_table.attach (name_hbox, 1, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); - } - controls_table.show_all (); - hide_name_entry (); - show_name_label (); break; case Normal: xml_node->add_property ("track_height", "normal"); - controls_table.remove (name_hbox); - if (plugname) { - if (plugname_packed) { - controls_table.remove (*plugname); - plugname_packed = false; - } - controls_table.attach (*plugname, 1, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); - plugname_packed = true; - controls_table.attach (name_hbox, 1, 5, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); - } else { - controls_table.attach (name_hbox, 1, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); - } - controls_table.show_all (); - hide_name_entry (); - show_name_label (); break; case Smaller: xml_node->add_property ("track_height", "smaller"); - controls_table.remove (name_hbox); - if (plugname) { - if (plugname_packed) { - controls_table.remove (*plugname); - plugname_packed = false; - } - } - controls_table.attach (name_hbox, 1, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); - controls_table.hide_all (); - hide_name_entry (); - show_name_label (); - name_hbox.show_all (); - controls_table.show (); break; case Small: xml_node->add_property ("track_height", "small"); - controls_table.remove (name_hbox); - if (plugname) { - if (plugname_packed) { - controls_table.remove (*plugname); - plugname_packed = false; - } - } - controls_table.attach (name_hbox, 1, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); - controls_table.hide_all (); - hide_name_entry (); - show_name_label (); - name_hbox.show_all (); - controls_table.show (); break; } + if (changed_between_small_and_normal || first_call_to_set_height) { + first_call_to_set_height = false; + switch (ht) { + case Largest: + case Large: + case Larger: + case Normal: + + controls_table.remove (name_hbox); + + if (plugname) { + if (plugname_packed) { + controls_table.remove (*plugname); + plugname_packed = false; + } + controls_table.attach (*plugname, 1, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); + plugname_packed = true; + controls_table.attach (name_hbox, 1, 5, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); + } else { + controls_table.attach (name_hbox, 1, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); + } + hide_name_entry (); + show_name_label (); + name_hbox.show_all (); + + auto_button.show(); + height_button.show(); + clear_button.show(); + hide_button.show_all(); + break; + + case Smaller: + case Small: + + controls_table.remove (name_hbox); + if (plugname) { + if (plugname_packed) { + controls_table.remove (*plugname); + plugname_packed = false; + } + } + controls_table.attach (name_hbox, 1, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); + controls_table.hide_all (); + hide_name_entry (); + show_name_label (); + name_hbox.show_all (); + + auto_button.hide(); + height_button.hide(); + clear_button.hide(); + hide_button.hide(); + break; + } + } + if (changed) { /* only emit the signal if the height really changed */ route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */ @@ -501,13 +476,13 @@ AutomationTimeAxisView::cut_copy_clear_one (AutomationLine& line, Selection& sel AutomationList& alist (line.the_list()); bool ret = false; - _session.add_undo (alist.get_memento()); + XMLNode &before = alist.get_state(); switch (op) { case Cut: if ((what_we_got = alist.cut (selection.time.front().start, selection.time.front().end)) != 0) { editor.get_cut_buffer().add (what_we_got); - _session.add_redo_no_execute (alist.get_memento()); + _session.add_command(new MementoCommand<AutomationList>(alist, before, alist.get_state())); ret = true; } break; @@ -519,7 +494,7 @@ AutomationTimeAxisView::cut_copy_clear_one (AutomationLine& line, Selection& sel case Clear: if ((what_we_got = alist.cut (selection.time.front().start, selection.time.front().end)) != 0) { - _session.add_redo_no_execute (alist.get_memento()); + _session.add_command(new MementoCommand<AutomationList>(alist, before, alist.get_state())); delete what_we_got; what_we_got = 0; ret = true; @@ -551,7 +526,7 @@ AutomationTimeAxisView::reset_objects_one (AutomationLine& line, PointSelection& { AutomationList& alist (line.the_list()); - _session.add_undo (alist.get_memento()); + _session.add_command (new MementoUndoCommand<AutomationList>(alist, alist.get_state())); for (PointSelection::iterator i = selection.begin(); i != selection.end(); ++i) { @@ -582,7 +557,7 @@ AutomationTimeAxisView::cut_copy_clear_objects_one (AutomationLine& line, PointS AutomationList& alist (line.the_list()); bool ret = false; - _session.add_undo (alist.get_memento()); + XMLNode &before = alist.get_state(); for (PointSelection::iterator i = selection.begin(); i != selection.end(); ++i) { @@ -594,7 +569,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_redo_no_execute (alist.get_memento()); + _session.add_command (new MementoCommand<AutomationList>(alist, before, alist.get_state())); ret = true; } break; @@ -606,7 +581,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_redo_no_execute (alist.get_memento()); + _session.add_command (new MementoCommand<AutomationList>(alist, before, alist.get_state())); delete what_we_got; what_we_got = 0; ret = true; @@ -663,9 +638,9 @@ AutomationTimeAxisView::paste_one (AutomationLine& line, jack_nframes_t pos, flo (*x)->value = foo; } - _session.add_undo (alist.get_memento()); + XMLNode &before = alist.get_state(); alist.paste (copy, pos, times); - _session.add_redo_no_execute (alist.get_memento()); + _session.add_command (new MementoCommand<AutomationList>(alist, before, alist.get_state())); return true; } diff --git a/gtk2_ardour/automation_time_axis.h b/gtk2_ardour/automation_time_axis.h index 6de11a7c6d..0cd9acc034 100644 --- a/gtk2_ardour/automation_time_axis.h +++ b/gtk2_ardour/automation_time_axis.h @@ -84,6 +84,8 @@ class AutomationTimeAxisView : public TimeAxisView { string _state_name; bool in_destructor; + bool first_call_to_set_height; + Gtk::Button hide_button; Gtk::Button height_button; Gtk::Button clear_button; diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 518ef7217a..513251085c 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -28,6 +28,7 @@ #include <pbd/convert.h> #include <pbd/error.h> +#include <pbd/memento_command.h> #include <gtkmm/image.h> #include <gdkmm/color.h> @@ -2878,8 +2879,8 @@ void Editor::begin_reversible_command (string name) { if (session) { - UndoAction ua = get_memento(); - session->begin_reversible_command (name, &ua); + before = &get_state(); + session->begin_reversible_command (name); } } @@ -2887,8 +2888,7 @@ void Editor::commit_reversible_command () { if (session) { - UndoAction ua = get_memento(); - session->commit_reversible_command (&ua); + session->commit_reversible_command (new MementoCommand<Editor>(*this, *before, get_state())); } } diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 05a134157e..3488c756ac 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -142,6 +142,8 @@ class Editor : public PublicEditor XMLNode& get_state (); int set_state (const XMLNode& ); + PBD::ID id() { return _id; } + void set_mouse_mode (Editing::MouseMode, bool force=true); void step_mouse_mode (bool next); Editing::MouseMode current_mouse_mode () { return mouse_mode; } @@ -346,6 +348,8 @@ class Editor : public PublicEditor ARDOUR::AudioEngine& engine; bool constructed; + PBD::ID _id; + PlaylistSelector* _playlist_selector; void set_frames_per_unit (double); @@ -1595,13 +1599,14 @@ class Editor : public PublicEditor UndoAction get_memento() const; + XMLNode *before; /* used in *_reversible_command */ void begin_reversible_command (string cmd_name); void commit_reversible_command (); /* visual history */ UndoHistory visual_history; - UndoCommand current_visual_command; + UndoTransaction current_visual_command; void begin_reversible_visual_command (const string & cmd_name); void commit_reversible_visual_command (); diff --git a/gtk2_ardour/editor_audio_import.cc b/gtk2_ardour/editor_audio_import.cc index f8c632f08a..7524f9605c 100644 --- a/gtk2_ardour/editor_audio_import.cc +++ b/gtk2_ardour/editor_audio_import.cc @@ -31,6 +31,7 @@ #include <ardour/audio_track.h> #include <ardour/audioplaylist.h> #include <ardour/audiofilesource.h> +#include <pbd/memento_command.h> #include "ardour_ui.h" #include "editor.h" @@ -320,9 +321,9 @@ Editor::finish_bringing_in_audio (AudioRegion& region, uint32_t in_chans, uint32 AudioRegion* copy = new AudioRegion (region); begin_reversible_command (_("insert sndfile")); - session->add_undo (playlist->get_memento()); + XMLNode &before = playlist->get_state(); playlist->add_region (*copy, pos); - session->add_redo_no_execute (playlist->get_memento()); + session->add_command (new MementoCommand<Playlist>(*playlist, before, playlist->get_state())); commit_reversible_command (); pos += region.length(); diff --git a/gtk2_ardour/editor_keyboard.cc b/gtk2_ardour/editor_keyboard.cc index d2b7c1160e..f48d860d15 100644 --- a/gtk2_ardour/editor_keyboard.cc +++ b/gtk2_ardour/editor_keyboard.cc @@ -20,6 +20,7 @@ #include <ardour/audioregion.h> #include <ardour/playlist.h> +#include <pbd/memento_command.h> #include "editor.h" #include "region_view.h" @@ -102,11 +103,12 @@ Editor::kbd_mute_unmute_region () { if (entered_regionview) { begin_reversible_command (_("mute region")); - session->add_undo (entered_regionview->region().playlist()->get_memento()); + XMLNode &before = entered_regionview->region().playlist()->get_state(); entered_regionview->region().set_muted (!entered_regionview->region().muted()); - session->add_redo_no_execute (entered_regionview->region().playlist()->get_memento()); + XMLNode &after = entered_regionview->region().playlist()->get_state(); + session->add_command (new MementoCommand<ARDOUR::Playlist>(*(entered_regionview->region().playlist()), before, after)); commit_reversible_command(); } } diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index f34b8590a4..ccc1415888 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -26,6 +26,7 @@ #include <gtkmm2ext/gtk_ui.h> #include <ardour/location.h> +#include <pbd/memento_command.h> #include "editor.h" #include "marker.h" @@ -290,9 +291,10 @@ Editor::mouse_add_new_marker (jack_nframes_t where) if (session) { Location *location = new Location (where, where, "mark", Location::IsMark); session->begin_reversible_command (_("add marker")); - session->add_undo (session->locations()->get_memento()); + XMLNode &before = session->locations()->get_state(); session->locations()->add (location, true); - session->add_redo_no_execute (session->locations()->get_memento()); + XMLNode &after = session->locations()->get_state(); + session->add_command (new MementoCommand<Locations>(*(session->locations()), before, after)); session->commit_reversible_command (); } } @@ -329,9 +331,10 @@ gint Editor::really_remove_marker (Location* loc) { session->begin_reversible_command (_("remove marker")); - session->add_undo (session->locations()->get_memento()); + XMLNode &before = session->locations()->get_state(); session->locations()->remove (loc); - session->add_redo_no_execute (session->locations()->get_memento()); + XMLNode &after = session->locations()->get_state(); + session->add_command (new MementoCommand<Locations>(*(session->locations()), before, after)); session->commit_reversible_command (); return FALSE; } @@ -838,12 +841,13 @@ Editor::marker_menu_rename () } begin_reversible_command ( _("rename marker") ); - session->add_undo( session->locations()->get_memento() ); + XMLNode &before = session->locations()->get_state(); dialog.get_result(txt); loc->set_name (txt); - session->add_redo_no_execute( session->locations()->get_memento() ); + XMLNode &after = session->locations()->get_state(); + session->add_command (new MementoCommand<Locations>(*(session->locations()), before, after)); commit_reversible_command (); } @@ -868,16 +872,18 @@ Editor::new_transport_marker_menu_set_loop () if ((tll = transport_loop_location()) == 0) { Location* loc = new Location (temp_location->start(), temp_location->end(), _("Loop"), Location::IsAutoLoop); - session->add_undo (session->locations()->get_memento()); + XMLNode &before = session->locations()->get_state(); session->locations()->add (loc, true); session->set_auto_loop_location (loc); - session->add_redo_no_execute (session->locations()->get_memento()); + XMLNode &after = session->locations()->get_state(); + session->add_command (new MementoCommand<Locations>(*(session->locations()), before, after)); } else { - session->add_undo (retype_return<void>(bind (mem_fun (*tll, &Location::set), tll->start(), tll->end()))); - session->add_redo (retype_return<void>(bind (mem_fun (*tll, &Location::set), temp_location->start(), temp_location->end()))); + XMLNode &before = tll->get_state(); tll->set_hidden (false, this); tll->set (temp_location->start(), temp_location->end()); + XMLNode &after = tll->get_state(); + session->add_command (new MementoCommand<Location>(*tll, before, after)); } commit_reversible_command (); @@ -894,15 +900,17 @@ Editor::new_transport_marker_menu_set_punch () if ((tpl = transport_punch_location()) == 0) { tpl = new Location (temp_location->start(), temp_location->end(), _("Punch"), Location::IsAutoPunch); - session->add_undo (session->locations()->get_memento()); + XMLNode &before = session->locations()->get_state(); session->locations()->add (tpl, true); session->set_auto_punch_location (tpl); - session->add_redo_no_execute (session->locations()->get_memento()); + XMLNode &after = session->locations()->get_state(); + session->add_command (new MementoCommand<Locations>(*(session->locations()), before, after)); } else { - session->add_undo (retype_return<void>(bind (mem_fun (*tpl, &Location::set), tpl->start(), tpl->end()))); - session->add_redo (retype_return<void>(bind (mem_fun (*tpl, &Location::set), temp_location->start(), temp_location->end()))); + XMLNode &before = tpl->get_state(); tpl->set_hidden(false, this); tpl->set(temp_location->start(), temp_location->end()); + XMLNode &after = tpl->get_state(); + session->add_command (new MementoCommand<Location>(*tpl, before, after)); } commit_reversible_command (); diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index 9b7ad99acb..a05dcba9e3 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -28,6 +28,7 @@ #include <pbd/error.h> #include <gtkmm2ext/utils.h> +#include <pbd/memento_command.h> #include "ardour_ui.h" #include "editor.h" @@ -1818,9 +1819,14 @@ Editor::fade_in_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* even } begin_reversible_command (_("change fade in length")); - session->add_undo (arv->region().get_memento()); + XMLNode &before = arv->audio_region().get_state(); + arv->audio_region().set_fade_in_length (fade_length); - session->add_redo_no_execute (arv->region().get_memento()); + + XMLNode &after = arv->audio_region().get_state(); + session->add_command(new MementoCommand<ARDOUR::AudioRegion>(arv->audio_region(), + before, + after)); commit_reversible_command (); fade_in_drag_motion_callback (item, event); } @@ -1910,9 +1916,12 @@ Editor::fade_out_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* eve } begin_reversible_command (_("change fade out length")); - session->add_undo (arv->region().get_memento()); + XMLNode &before = arv->region().get_state(); + arv->audio_region().set_fade_out_length (fade_length); - session->add_redo_no_execute (arv->region().get_memento()); + + XMLNode &after = arv->region().get_state(); + session->add_command(new MementoCommand<ARDOUR::Region>(arv->region(), before, after)); commit_reversible_command (); fade_out_drag_motion_callback (item, event); @@ -2154,7 +2163,7 @@ Editor::marker_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event begin_reversible_command ( _("move marker") ); - session->add_undo( session->locations()->get_memento() ); + XMLNode &before = session->locations()->get_state(); Location * location = find_location_from_marker (marker, is_start); @@ -2166,7 +2175,8 @@ Editor::marker_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event } } - session->add_redo_no_execute( session->locations()->get_memento() ); + XMLNode &after = session->locations()->get_state(); + session->add_command(new MementoCommand<Locations>(*(session->locations()), before, after)); commit_reversible_command (); marker_drag_line->hide(); @@ -2280,9 +2290,10 @@ Editor::meter_marker_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* if (drag_info.copy == true) { begin_reversible_command (_("copy meter mark")); - session->add_undo (map.get_memento()); + XMLNode &before = map.get_state(); map.add_meter (marker->meter(), when); - session->add_redo_no_execute (map.get_memento()); + XMLNode &after = map.get_state(); + session->add_command(new MementoCommand<TempoMap>(map, before, after)); commit_reversible_command (); // delete the dummy marker we used for visual representation of copying. @@ -2290,9 +2301,10 @@ Editor::meter_marker_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* delete marker; } else { begin_reversible_command (_("move meter mark")); - session->add_undo (map.get_memento()); + XMLNode &before = map.get_state(); map.move_meter (marker->meter(), when); - session->add_redo_no_execute (map.get_memento()); + XMLNode &after = map.get_state(); + session->add_command(new MementoCommand<TempoMap>(map, before, after)); commit_reversible_command (); } } @@ -2407,12 +2419,13 @@ Editor::tempo_marker_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* TempoMap& map (session->tempo_map()); map.bbt_time (drag_info.last_pointer_frame, when); - + if (drag_info.copy == true) { begin_reversible_command (_("copy tempo mark")); - session->add_undo (map.get_memento()); + XMLNode &before = map.get_state(); map.add_tempo (marker->tempo(), when); - session->add_redo_no_execute (map.get_memento()); + XMLNode &after = map.get_state(); + session->add_command (new MementoCommand<TempoMap>(map, before, after)); commit_reversible_command (); // delete the dummy marker we used for visual representation of copying. @@ -2420,9 +2433,10 @@ Editor::tempo_marker_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* delete marker; } else { begin_reversible_command (_("move tempo mark")); - session->add_undo (map.get_memento()); + XMLNode &before = map.get_state(); map.move_tempo (marker->tempo(), when); - session->add_redo_no_execute (map.get_memento()); + XMLNode &after = map.get_state(); + session->add_command (new MementoCommand<TempoMap>(map, before, after)); commit_reversible_command (); } } @@ -2786,7 +2800,7 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) insert_result = affected_playlists.insert (to_playlist); if (insert_result.second) { - session->add_undo (to_playlist->get_memento ()); + session->add_command (new MementoUndoCommand<Playlist>(*to_playlist, to_playlist->get_state())); } latest_regionview = 0; @@ -3224,7 +3238,7 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) insert_result = motion_frozen_playlists.insert (pl); if (insert_result.second) { pl->freeze(); - session->add_undo(pl->get_memento()); + session->add_command(new MementoUndoCommand<Playlist>(*pl, pl->get_state())); } } } @@ -3352,7 +3366,7 @@ Editor::region_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event insert_result = motion_frozen_playlists.insert(to_playlist); if (insert_result.second) { to_playlist->freeze(); - session->add_undo(to_playlist->get_memento()); + session->add_command(new MementoUndoCommand<Playlist>(*to_playlist, to_playlist->get_state())); } } @@ -3434,7 +3448,7 @@ Editor::region_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event out: for (set<Playlist*>::iterator p = motion_frozen_playlists.begin(); p != motion_frozen_playlists.end(); ++p) { (*p)->thaw (); - session->add_redo_no_execute ((*p)->get_memento()); + session->add_command (new MementoRedoCommand<Playlist>(*(*p), (*p)->get_state())); } motion_frozen_playlists.clear (); @@ -3629,9 +3643,10 @@ Editor::start_selection_grab (ArdourCanvas::Item* item, GdkEvent* event) Playlist* playlist = clicked_trackview->playlist(); - session->add_undo (playlist->get_memento ()); + before = &(playlist->get_state()); clicked_trackview->playlist()->add_region (*region, selection->time[clicked_selection].start); - session->add_redo_no_execute (playlist->get_memento ()); + XMLNode &after = playlist->get_state(); + session->add_command(new MementoCommand<Playlist>(*playlist, *before, after)); commit_reversible_command (); @@ -3998,7 +4013,7 @@ Editor::trim_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) Playlist * pl = (*i)->region().playlist(); insert_result = motion_frozen_playlists.insert (pl); if (insert_result.second) { - session->add_undo (pl->get_memento()); + session->add_command(new MementoUndoCommand<Playlist>(*pl, pl->get_state())); } } } @@ -4188,8 +4203,8 @@ Editor::trim_finished_callback (ArdourCanvas::Item* item, GdkEvent* event) for (set<Playlist*>::iterator p = motion_frozen_playlists.begin(); p != motion_frozen_playlists.end(); ++p) { //(*p)->thaw (); - session->add_redo_no_execute ((*p)->get_memento()); - } + session->add_command (new MementoRedoCommand<Playlist>(*(*p), (*p)->get_state())); + } motion_frozen_playlists.clear (); @@ -4222,18 +4237,22 @@ Editor::point_trim (GdkEvent* event) i != selection->regions.by_layer().end(); ++i) { if (!(*i)->region().locked()) { - session->add_undo ((*i)->region().playlist()->get_memento()); + Playlist *pl = (*i)->region().playlist(); + XMLNode &before = pl->get_state(); (*i)->region().trim_front (new_bound, this); - session->add_redo_no_execute ((*i)->region().playlist()->get_memento()); + XMLNode &after = pl->get_state(); + session->add_command(new MementoCommand<Playlist>(*pl, before, after)); } } } else { if (!rv->region().locked()) { - session->add_undo (rv->region().playlist()->get_memento()); + Playlist *pl = rv->region().playlist(); + XMLNode &before = pl->get_state(); rv->region().trim_front (new_bound, this); - session->add_redo_no_execute (rv->region().playlist()->get_memento()); + XMLNode &after = pl->get_state(); + session->add_command(new MementoCommand<Playlist>(*pl, before, after)); } } @@ -4249,18 +4268,22 @@ Editor::point_trim (GdkEvent* event) for (list<RegionView*>::const_iterator i = selection->regions.by_layer().begin(); i != selection->regions.by_layer().end(); ++i) { if (!(*i)->region().locked()) { - session->add_undo ((*i)->region().playlist()->get_memento()); + Playlist *pl = (*i)->region().playlist(); + XMLNode &before = pl->get_state(); (*i)->region().trim_end (new_bound, this); - session->add_redo_no_execute ((*i)->region().playlist()->get_memento()); + XMLNode &after = pl->get_state(); + session->add_command(new MementoCommand<Playlist>(*pl, before, after)); } } } else { if (!rv->region().locked()) { - session->add_undo (rv->region().playlist()->get_memento()); + Playlist *pl = rv->region().playlist(); + XMLNode &before = pl->get_state(); rv->region().trim_end (new_bound, this); - session->add_redo_no_execute (rv->region().playlist()->get_memento()); + XMLNode &after = pl->get_state(); + session->add_command (new MementoCommand<Playlist>(*pl, before, after)); } } @@ -4282,7 +4305,8 @@ Editor::thaw_region_after_trim (RegionView& rv) } region.thaw (_("trimmed region")); - session->add_redo_no_execute (region.playlist()->get_memento()); + XMLNode &after = region.playlist()->get_state(); + session->add_command (new MementoRedoCommand<Playlist>(*(region.playlist()), after)); AudioRegionView* arv = dynamic_cast<AudioRegionView*>(&rv); if (arv) @@ -4421,16 +4445,19 @@ Editor::end_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event) switch (range_marker_op) { case CreateRangeMarker: + { begin_reversible_command (_("new range marker")); - session->add_undo (session->locations()->get_memento()); + XMLNode &before = session->locations()->get_state(); newloc = new Location(temp_location->start(), temp_location->end(), "unnamed", Location::IsRangeMarker); session->locations()->add (newloc, true); - session->add_redo_no_execute (session->locations()->get_memento()); + XMLNode &after = session->locations()->get_state(); + session->add_command(new MementoCommand<Locations>(*(session->locations()), before, after)); commit_reversible_command (); range_bar_drag_rect->hide(); range_marker_drag_rect->hide(); break; + } case CreateTransportMarker: // popup menu to pick loop or punch @@ -4804,9 +4831,10 @@ Editor::mouse_brush_insert_region (RegionView* rv, jack_nframes_t pos) Playlist* playlist = atv->playlist(); double speed = atv->get_diskstream()->speed(); - session->add_undo (playlist->get_memento()); + XMLNode &before = playlist->get_state(); playlist->add_region (*(new AudioRegion (arv->audio_region())), (jack_nframes_t) (pos * speed)); - session->add_redo_no_execute (playlist->get_memento()); + XMLNode &after = playlist->get_state(); + session->add_command(new MementoCommand<Playlist>(*playlist, before, after)); // playlist is frozen, so we have to update manually diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index af366e18d0..9b69026a01 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -28,6 +28,7 @@ #include <pbd/error.h> #include <pbd/basename.h> #include <pbd/pthread_utils.h> +#include <pbd/memento_command.h> #include <gtkmm2ext/utils.h> #include <gtkmm2ext/choice.h> @@ -209,9 +210,10 @@ Editor::split_regions_at (jack_nframes_t where, RegionSelection& regions) _new_regionviews_show_envelope = arv->envelope_visible(); if (pl) { - session->add_undo (pl->get_memento()); + XMLNode &before = pl->get_state(); pl->split_region ((*a)->region(), where); - session->add_redo_no_execute (pl->get_memento()); + XMLNode &after = pl->get_state(); + session->add_command(new MementoCommand<Playlist>(*pl, before, after)); } a = tmp; @@ -231,9 +233,10 @@ Editor::remove_clicked_region () Playlist* playlist = clicked_audio_trackview->playlist(); begin_reversible_command (_("remove region")); - session->add_undo (playlist->get_memento()); + XMLNode &before = playlist->get_state(); playlist->remove_region (&clicked_regionview->region()); - session->add_redo_no_execute (playlist->get_memento()); + XMLNode &after = playlist->get_state(); + session->add_command(new MementoCommand<Playlist>(*playlist, before, after)); commit_reversible_command (); } @@ -406,9 +409,10 @@ Editor::nudge_forward (bool next) distance = next_distance; } - session->add_undo (r.playlist()->get_memento()); + XMLNode &before = r.playlist()->get_state(); r.set_position (r.position() + distance, this); - session->add_redo_no_execute (r.playlist()->get_memento()); + XMLNode &after = r.playlist()->get_state(); + session->add_command (new MementoCommand<Playlist>(*(r.playlist()), before, after)); } commit_reversible_command (); @@ -440,14 +444,15 @@ Editor::nudge_backward (bool next) distance = next_distance; } - session->add_undo (r.playlist()->get_memento()); + XMLNode &before = r.playlist()->get_state(); if (r.position() > distance) { r.set_position (r.position() - distance, this); } else { r.set_position (0, this); } - session->add_redo_no_execute (r.playlist()->get_memento()); + XMLNode &after = r.playlist()->get_state(); + session->add_command(new MementoCommand<Playlist>(*(r.playlist()), before, after)); } commit_reversible_command (); @@ -480,9 +485,10 @@ Editor::nudge_forward_capture_offset () for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) { Region& r ((*i)->region()); - session->add_undo (r.playlist()->get_memento()); + XMLNode &before = r.playlist()->get_state(); r.set_position (r.position() + distance, this); - session->add_redo_no_execute (r.playlist()->get_memento()); + XMLNode &after = r.playlist()->get_state(); + session->add_command(new MementoCommand<Playlist>(*(r.playlist()), before, after)); } commit_reversible_command (); @@ -506,14 +512,15 @@ Editor::nudge_backward_capture_offset () for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) { Region& r ((*i)->region()); - session->add_undo (r.playlist()->get_memento()); + XMLNode &before = r.playlist()->get_state(); if (r.position() > distance) { r.set_position (r.position() - distance, this); } else { r.set_position (0, this); } - session->add_redo_no_execute (r.playlist()->get_memento()); + XMLNode &after = r.playlist()->get_state(); + session->add_command(new MementoCommand<Playlist>(*(r.playlist()), before, after)); } commit_reversible_command (); @@ -1290,9 +1297,10 @@ Editor::add_location_from_selection () Location *location = new Location (start, end, "selection"); session->begin_reversible_command (_("add marker")); - session->add_undo (session->locations()->get_memento()); + XMLNode &before = session->locations()->get_state(); session->locations()->add (location, true); - session->add_redo_no_execute (session->locations()->get_memento()); + XMLNode &after = session->locations()->get_state(); + session->add_command(new MementoCommand<Locations>(*(session->locations()), before, after)); session->commit_reversible_command (); } @@ -1303,9 +1311,10 @@ Editor::add_location_from_playhead_cursor () Location *location = new Location (where, where, "mark", Location::IsMark); session->begin_reversible_command (_("add marker")); - session->add_undo (session->locations()->get_memento()); + XMLNode &before = session->locations()->get_state(); session->locations()->add (location, true); - session->add_redo_no_execute (session->locations()->get_memento()); + XMLNode &after = session->locations()->get_state(); + session->add_command(new MementoCommand<Locations>(*(session->locations()), before, after)); session->commit_reversible_command (); } @@ -1321,9 +1330,10 @@ Editor::add_location_from_audio_region () Location *location = new Location (region.position(), region.last_frame(), region.name()); session->begin_reversible_command (_("add marker")); - session->add_undo (session->locations()->get_memento()); + XMLNode &before = session->locations()->get_state(); session->locations()->add (location, true); - session->add_redo_no_execute (session->locations()->get_memento()); + XMLNode &after = session->locations()->get_state(); + session->add_command(new MementoCommand<Locations>(*(session->locations()), before, after)); session->commit_reversible_command (); } @@ -1739,9 +1749,10 @@ Editor::clear_markers () { if (session) { session->begin_reversible_command (_("clear markers")); - session->add_undo (session->locations()->get_memento()); + XMLNode &before = session->locations()->get_state(); session->locations()->clear_markers (); - session->add_redo_no_execute (session->locations()->get_memento()); + XMLNode &after = session->locations()->get_state(); + session->add_command(new MementoCommand<Locations>(*(session->locations()), before, after)); session->commit_reversible_command (); } } @@ -1751,7 +1762,7 @@ Editor::clear_ranges () { if (session) { session->begin_reversible_command (_("clear ranges")); - session->add_undo (session->locations()->get_memento()); + XMLNode &before = session->locations()->get_state(); Location * looploc = session->locations()->auto_loop_location(); Location * punchloc = session->locations()->auto_punch_location(); @@ -1761,7 +1772,8 @@ Editor::clear_ranges () if (looploc) session->locations()->add (looploc); if (punchloc) session->locations()->add (punchloc); - session->add_redo_no_execute (session->locations()->get_memento()); + XMLNode &after = session->locations()->get_state(); + session->add_command(new MementoCommand<Locations>(*(session->locations()), before, after)); session->commit_reversible_command (); } } @@ -1770,9 +1782,10 @@ void Editor::clear_locations () { session->begin_reversible_command (_("clear locations")); - session->add_undo (session->locations()->get_memento()); + XMLNode &before = session->locations()->get_state(); session->locations()->clear (); - session->add_redo_no_execute (session->locations()->get_memento()); + XMLNode &after = session->locations()->get_state(); + session->add_command(new MementoCommand<Locations>(*(session->locations()), before, after)); session->commit_reversible_command (); session->locations()->clear (); } @@ -1820,9 +1833,9 @@ Editor::insert_region_list_drag (AudioRegion& region, int x, int y) snap_to (where); begin_reversible_command (_("insert dragged region")); - session->add_undo (playlist->get_memento()); + XMLNode &before = playlist->get_state(); playlist->add_region (*(new AudioRegion (region)), where, 1.0); - session->add_redo_no_execute (playlist->get_memento()); + session->add_command(new MementoCommand<Playlist>(*playlist, before, playlist->get_state())); commit_reversible_command (); } @@ -1856,9 +1869,9 @@ Editor::insert_region_list_selection (float times) Region* region = (*i)[region_list_columns.region]; begin_reversible_command (_("insert region")); - session->add_undo (playlist->get_memento()); + XMLNode &before = playlist->get_state(); playlist->add_region (*(createRegion (*region)), edit_cursor->current_frame, times); - session->add_redo_no_execute (playlist->get_memento()); + session->add_command(new MementoCommand<Playlist>(*playlist, before, playlist->get_state())); commit_reversible_command (); } @@ -2283,7 +2296,9 @@ Editor::separate_region_from_selection () begin_reversible_command (_("separate")); doing_undo = true; } - if (doing_undo) session->add_undo ((playlist)->get_memento()); + XMLNode *before; + if (doing_undo) + before = &(playlist->get_state()); /* XXX need to consider musical time selections here at some point */ @@ -2293,7 +2308,8 @@ Editor::separate_region_from_selection () playlist->partition ((jack_nframes_t)((*t).start * speed), (jack_nframes_t)((*t).end * speed), true); } - if (doing_undo) session->add_redo_no_execute (playlist->get_memento()); + if (doing_undo) + session->add_command(new MementoCommand<Playlist>(*playlist, *before, playlist->get_state())); } } } @@ -2328,11 +2344,14 @@ Editor::separate_regions_using_location (Location& loc) if (atv->is_audio_track()) { if ((playlist = atv->playlist()) != 0) { + XMLNode *before; if (!doing_undo) { begin_reversible_command (_("separate")); doing_undo = true; } - if (doing_undo) session->add_undo ((playlist)->get_memento()); + if (doing_undo) + before = &(playlist->get_state()); + /* XXX need to consider musical time selections here at some point */ @@ -2340,7 +2359,8 @@ Editor::separate_regions_using_location (Location& loc) playlist->partition ((jack_nframes_t)(loc.start() * speed), (jack_nframes_t)(loc.end() * speed), true); - if (doing_undo) session->add_redo_no_execute (playlist->get_memento()); + if (doing_undo) + session->add_command(new MementoCommand<Playlist>(*playlist, *before, playlist->get_state())); } } } @@ -2411,9 +2431,10 @@ Editor::crop_region_to_selection () end = min (selection->time.end_frame(), start + region->length() - 1); cnt = end - start + 1; - session->add_undo ((*i)->get_memento()); + XMLNode &before = (*i)->get_state(); region->trim_to (start, cnt, this); - session->add_redo_no_execute ((*i)->get_memento()); + XMLNode &after = (*i)->get_state(); + session->add_command (new MementoCommand<Playlist>(*(*i), before, after)); } commit_reversible_command (); @@ -2454,9 +2475,9 @@ Editor::region_fill_track () return; } - session->add_undo (pl->get_memento()); + XMLNode &before = pl->get_state(); pl->add_region (*(new AudioRegion (*ar)), ar->last_frame(), times); - session->add_redo_no_execute (pl->get_memento()); + session->add_command (new MementoCommand<Playlist>(*pl, before, pl->get_state())); } commit_reversible_command (); @@ -2504,9 +2525,9 @@ Editor::region_fill_selection () continue; } - session->add_undo (playlist->get_memento()); + XMLNode &before = playlist->get_state(); playlist->add_region (*(createRegion (*region)), start, times); - session->add_redo_no_execute (playlist->get_memento()); + session->add_command (new MementoCommand<Playlist>(*playlist, before, playlist->get_state())); } commit_reversible_command (); @@ -2521,9 +2542,10 @@ Editor::set_a_regions_sync_position (Region& region, jack_nframes_t position) return; } begin_reversible_command (_("set region sync position")); - session->add_undo (region.playlist()->get_memento()); + XMLNode &before = region.playlist()->get_state(); region.set_sync_position (position); - session->add_redo_no_execute (region.playlist()->get_memento()); + XMLNode &after = region.playlist()->get_state(); + session->add_command(new MementoCommand<Playlist>(*(region.playlist()), before, after)); commit_reversible_command (); } @@ -2541,9 +2563,10 @@ Editor::set_region_sync_from_edit_cursor () Region& region (clicked_regionview->region()); begin_reversible_command (_("set sync from edit cursor")); - session->add_undo (region.playlist()->get_memento()); + XMLNode &before = region.playlist()->get_state(); region.set_sync_position (edit_cursor->current_frame); - session->add_redo_no_execute (region.playlist()->get_memento()); + XMLNode &after = region.playlist()->get_state(); + session->add_command(new MementoCommand<Playlist>(*(region.playlist()), before, after)); commit_reversible_command (); } @@ -2553,9 +2576,10 @@ Editor::remove_region_sync () if (clicked_regionview) { Region& region (clicked_regionview->region()); begin_reversible_command (_("remove sync")); - session->add_undo (region.playlist()->get_memento()); + XMLNode &before = region.playlist()->get_state(); region.clear_sync_position (); - session->add_redo_no_execute (region.playlist()->get_memento()); + XMLNode &after = region.playlist()->get_state(); + session->add_command(new MementoCommand<Playlist>(*(region.playlist()), before, after)); commit_reversible_command (); } } @@ -2568,9 +2592,10 @@ Editor::naturalize () } begin_reversible_command (_("naturalize")); for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) { - session->add_undo ((*i)->region().get_memento()); + XMLNode &before = (*i)->region().get_state(); (*i)->region().move_to_natural_position (this); - session->add_redo_no_execute ((*i)->region().get_memento()); + XMLNode &after = (*i)->region().get_state(); + session->add_command (new MementoCommand<Region>((*i)->region(), before, after)); } commit_reversible_command (); } @@ -2636,7 +2661,7 @@ Editor::align_selection_relative (RegionPoint point, jack_nframes_t position) Region& region ((*i)->region()); - session->add_undo (region.playlist()->get_memento()); + XMLNode &before = region.playlist()->get_state(); if (dir > 0) { region.set_position (region.position() + distance, this); @@ -2644,7 +2669,8 @@ Editor::align_selection_relative (RegionPoint point, jack_nframes_t position) region.set_position (region.position() - distance, this); } - session->add_redo_no_execute (region.playlist()->get_memento()); + XMLNode &after = region.playlist()->get_state(); + session->add_command(new MementoCommand<Playlist>(*(region.playlist()), before, after)); } @@ -2678,7 +2704,7 @@ Editor::align_region (Region& region, RegionPoint point, jack_nframes_t position void Editor::align_region_internal (Region& region, RegionPoint point, jack_nframes_t position) { - session->add_undo (region.playlist()->get_memento()); + XMLNode &before = region.playlist()->get_state(); switch (point) { case SyncPoint: @@ -2696,7 +2722,8 @@ Editor::align_region_internal (Region& region, RegionPoint point, jack_nframes_t break; } - session->add_redo_no_execute (region.playlist()->get_memento()); + XMLNode &after = region.playlist()->get_state(); + session->add_command(new MementoCommand<Playlist>(*(region.playlist()), before, after)); } void @@ -2718,9 +2745,10 @@ Editor::trim_region_to_edit_cursor () } begin_reversible_command (_("trim to edit")); - session->add_undo (region.playlist()->get_memento()); + XMLNode &before = region.playlist()->get_state(); region.trim_end( session_frame_to_track_frame(edit_cursor->current_frame, speed), this); - session->add_redo_no_execute (region.playlist()->get_memento()); + XMLNode &after = region.playlist()->get_state(); + session->add_command(new MementoCommand<Playlist>(*(region.playlist()), before, after)); commit_reversible_command (); } @@ -2743,9 +2771,10 @@ Editor::trim_region_from_edit_cursor () } begin_reversible_command (_("trim to edit")); - session->add_undo (region.playlist()->get_memento()); + XMLNode &before = region.playlist()->get_state(); region.trim_front ( session_frame_to_track_frame(edit_cursor->current_frame, speed), this); - session->add_redo_no_execute (region.playlist()->get_memento()); + XMLNode &after = region.playlist()->get_state(); + session->add_command(new MementoCommand<Playlist>(*(region.playlist()), before, after)); commit_reversible_command (); } @@ -2857,9 +2886,10 @@ Editor::bounce_range_selection () itt.cancel = false; itt.progress = false; - session->add_undo (playlist->get_memento()); + XMLNode &before = playlist->get_state(); atv->audio_track()->bounce_range (start, cnt, itt); - session->add_redo_no_execute (playlist->get_memento()); + XMLNode &after = playlist->get_state(); + session->add_command (new MementoCommand<Playlist> (*playlist, before, after)); } commit_reversible_command (); @@ -2977,7 +3007,7 @@ Editor::cut_copy_regions (CutCopyOp op) insert_result = freezelist.insert (pl); if (insert_result.second) { pl->freeze (); - session->add_undo (pl->get_memento()); + session->add_command (new MementoUndoCommand<Playlist>(*pl, pl->get_state())); } } } @@ -3041,7 +3071,7 @@ Editor::cut_copy_regions (CutCopyOp op) for (set<Playlist*>::iterator pl = freezelist.begin(); pl != freezelist.end(); ++pl) { (*pl)->thaw (); - session->add_redo_no_execute ((*pl)->get_memento()); + session->add_command (new MementoRedoCommand<Playlist>(*(*pl), (*pl)->get_state())); } } @@ -3154,9 +3184,9 @@ Editor::paste_named_selection (float times) tmp = chunk; ++tmp; - session->add_undo (apl->get_memento()); + XMLNode &before = apl->get_state(); apl->paste (**chunk, edit_cursor->current_frame, times); - session->add_redo_no_execute (apl->get_memento()); + session->add_command(new MementoCommand<AudioPlaylist>(*apl, before, apl->get_state())); if (tmp != ns->playlists.end()) { chunk = tmp; @@ -3185,9 +3215,9 @@ Editor::duplicate_some_regions (RegionSelection& regions, float times) sigc::connection c = atv->view()->RegionViewAdded.connect (mem_fun(*this, &Editor::collect_new_region_view)); playlist = (*i)->region().playlist(); - session->add_undo (playlist->get_memento()); + XMLNode &before = playlist->get_state(); playlist->duplicate (r, r.last_frame(), times); - session->add_redo_no_execute (playlist->get_memento()); + session->add_command(new MementoCommand<Playlist>(*playlist, before, playlist->get_state())); c.disconnect (); @@ -3225,9 +3255,10 @@ Editor::duplicate_selection (float times) if ((playlist = (*i)->playlist()) == 0) { continue; } - session->add_undo (playlist->get_memento()); + XMLNode &before = playlist->get_state(); playlist->duplicate (**ri, selection->time[clicked_selection].end, times); - session->add_redo_no_execute (playlist->get_memento()); + XMLNode &after = playlist->get_state(); + session->add_command (new MementoCommand<Playlist>(*playlist, before, after)); ++ri; if (ri == new_regions.end()) { @@ -3275,9 +3306,10 @@ void Editor::clear_playlist (Playlist& playlist) { begin_reversible_command (_("clear playlist")); - session->add_undo (playlist.get_memento()); + XMLNode &before = playlist.get_state(); playlist.clear (); - session->add_redo_no_execute (playlist.get_memento()); + XMLNode &after = playlist.get_state(); + session->add_command (new MementoCommand<Playlist>(playlist, before, after)); commit_reversible_command (); } @@ -3311,9 +3343,10 @@ Editor::nudge_track (bool use_edit_cursor, bool forwards) continue; } - session->add_undo (playlist->get_memento()); + XMLNode &before = playlist->get_state(); playlist->nudge_after (start, distance, forwards); - session->add_redo_no_execute (playlist->get_memento()); + XMLNode &after = playlist->get_state(); + session->add_command (new MementoCommand<Playlist>(*playlist, before, after)); } commit_reversible_command (); @@ -3367,9 +3400,9 @@ Editor::normalize_region () AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*r); if (!arv) continue; - session->add_undo (arv->region().get_memento()); + XMLNode &before = arv->region().get_state(); arv->audio_region().normalize_to (0.0f); - session->add_redo_no_execute (arv->region().get_memento()); + session->add_command (new MementoCommand<Region>(arv->region(), before, arv->region().get_state())); } commit_reversible_command (); @@ -3394,9 +3427,9 @@ Editor::denormalize_region () AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*r); if (!arv) continue; - session->add_undo (arv->region().get_memento()); + XMLNode &before = arv->region().get_state(); arv->audio_region().set_scale_amplitude (1.0f); - session->add_redo_no_execute (arv->region().get_memento()); + session->add_command (new MementoCommand<Region>(arv->region(), before, arv->region().get_state())); } commit_reversible_command (); @@ -3440,9 +3473,10 @@ Editor::apply_filter (AudioFilter& filter, string command) if (arv->audio_region().apply (filter) == 0) { - session->add_undo (playlist->get_memento()); + XMLNode &before = playlist->get_state(); playlist->replace_region (arv->region(), *(filter.results.front()), arv->region().position()); - session->add_redo_no_execute (playlist->get_memento()); + XMLNode &after = playlist->get_state(); + session->add_command(new MementoCommand<Playlist>(*playlist, before, after)); } else { goto out; } diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc index 5f998ada9f..9f7fe7cf09 100644 --- a/gtk2_ardour/editor_tempodisplay.cc +++ b/gtk2_ardour/editor_tempodisplay.cc @@ -27,6 +27,7 @@ #include <libgnomecanvasmm.h> #include <pbd/error.h> +#include <pbd/memento_command.h> #include <gtkmm2ext/utils.h> #include <gtkmm2ext/gtk_ui.h> @@ -273,9 +274,10 @@ Editor::mouse_add_new_tempo_event (jack_nframes_t frame) tempo_dialog.get_bbt_time (requested); begin_reversible_command (_("add tempo mark")); - session->add_undo (map.get_memento()); + XMLNode &before = map.get_state(); map.add_tempo (Tempo (bpm), requested); - session->add_redo_no_execute (map.get_memento()); + XMLNode &after = map.get_state(); + session->add_command(new MementoCommand<TempoMap>(map, before, after)); commit_reversible_command (); map.dump (cerr); @@ -313,9 +315,9 @@ Editor::mouse_add_new_meter_event (jack_nframes_t frame) meter_dialog.get_bbt_time (requested); begin_reversible_command (_("add meter mark")); - session->add_undo (map.get_memento()); + XMLNode &before = map.get_state(); map.add_meter (Meter (bpb, note_type), requested); - session->add_redo_no_execute (map.get_memento()); + session->add_command(new MementoCommand<TempoMap>(map, before, map.get_state())); commit_reversible_command (); map.dump (cerr); @@ -364,9 +366,10 @@ Editor::edit_meter_section (MeterSection* section) double note_type = meter_dialog.get_note_type (); begin_reversible_command (_("replace tempo mark")); - session->add_undo (session->tempo_map().get_memento()); + XMLNode &before = session->tempo_map().get_state(); session->tempo_map().replace_meter (*section, Meter (bpb, note_type)); - session->add_redo_no_execute (session->tempo_map().get_memento()); + XMLNode &after = session->tempo_map().get_state(); + session->add_command(new MementoCommand<TempoMap>(session->tempo_map(), before, after)); commit_reversible_command (); } @@ -392,10 +395,11 @@ Editor::edit_tempo_section (TempoSection* section) bpm = max (0.01, bpm); begin_reversible_command (_("replace tempo mark")); - session->add_undo (session->tempo_map().get_memento()); + XMLNode &before = session->tempo_map().get_state(); session->tempo_map().replace_tempo (*section, Tempo (bpm)); session->tempo_map().move_tempo (*section, when); - session->add_redo_no_execute (session->tempo_map().get_memento()); + XMLNode &after = session->tempo_map().get_state(); + session->add_command (new MementoCommand<TempoMap>(session->tempo_map(), before, after)); commit_reversible_command (); } @@ -441,9 +445,10 @@ gint Editor::real_remove_tempo_marker (TempoSection *section) { begin_reversible_command (_("remove tempo mark")); - session->add_undo (session->tempo_map().get_memento()); + XMLNode &before = session->tempo_map().get_state(); session->tempo_map().remove_tempo (*section); - session->add_redo_no_execute (session->tempo_map().get_memento()); + XMLNode &after = session->tempo_map().get_state(); + session->add_command(new MementoCommand<TempoMap>(session->tempo_map(), before, after)); commit_reversible_command (); return FALSE; @@ -474,9 +479,10 @@ gint Editor::real_remove_meter_marker (MeterSection *section) { begin_reversible_command (_("remove tempo mark")); - session->add_undo (session->tempo_map().get_memento()); + XMLNode &before = session->tempo_map().get_state(); session->tempo_map().remove_meter (*section); - session->add_redo_no_execute (session->tempo_map().get_memento()); + XMLNode &after = session->tempo_map().get_state(); + session->add_command(new MementoCommand<TempoMap>(session->tempo_map(), before, after)); commit_reversible_command (); return FALSE; } diff --git a/gtk2_ardour/editor_timefx.cc b/gtk2_ardour/editor_timefx.cc index 79772090f6..3fe0023d07 100644 --- a/gtk2_ardour/editor_timefx.cc +++ b/gtk2_ardour/editor_timefx.cc @@ -25,6 +25,7 @@ #include <pbd/error.h> #include <pbd/pthread_utils.h> +#include <pbd/memento_command.h> #include "editor.h" #include "audio_time_axis.h" @@ -206,9 +207,10 @@ Editor::do_timestretch (TimeStretchDialog& dialog) return; } - session->add_undo (playlist->get_memento()); + XMLNode &before = playlist->get_state(); playlist->replace_region (region, *new_region, region.position()); - session->add_redo_no_execute (playlist->get_memento()); + XMLNode &after = playlist->get_state(); + session->add_command (new MementoCommand<Playlist>(*playlist, before, after)); i = tmp; } diff --git a/gtk2_ardour/gain_automation_time_axis.cc b/gtk2_ardour/gain_automation_time_axis.cc index 5352015f11..c86c1390f3 100644 --- a/gtk2_ardour/gain_automation_time_axis.cc +++ b/gtk2_ardour/gain_automation_time_axis.cc @@ -20,6 +20,7 @@ #include <ardour/curve.h> #include <ardour/route.h> +#include <pbd/memento_command.h> #include "gain_automation_time_axis.h" #include "automation_line.h" @@ -63,9 +64,10 @@ GainAutomationTimeAxisView::add_automation_event (ArdourCanvas::Item* item, GdkE _session.begin_reversible_command (_("add gain automation event")); - _session.add_undo (curve.get_memento()); + XMLNode &before = curve.get_state(); curve.add (when, y); - _session.add_redo_no_execute (curve.get_memento()); + XMLNode &after = curve.get_state(); + _session.add_command(new MementoCommand<ARDOUR::Curve>(curve, before, after)); _session.commit_reversible_command (); _session.set_dirty (); } diff --git a/gtk2_ardour/location_ui.cc b/gtk2_ardour/location_ui.cc index f0fe230b57..deb4c1da36 100644 --- a/gtk2_ardour/location_ui.cc +++ b/gtk2_ardour/location_ui.cc @@ -27,6 +27,7 @@ #include <ardour/utils.h> #include <ardour/configuration.h> #include <ardour/session.h> +#include <pbd/memento_command.h> #include "ardour_ui.h" #include "prompter.h" @@ -654,9 +655,10 @@ gint LocationUI::do_location_remove (ARDOUR::Location *loc) } session->begin_reversible_command (_("remove marker")); - session->add_undo (session->locations()->get_memento()); + XMLNode &before = session->locations()->get_state(); session->locations()->remove (loc); - session->add_redo_no_execute (session->locations()->get_memento()); + XMLNode &after = session->locations()->get_state(); + session->add_command(new MementoCommand<Locations>(*(session->locations()), before, after)); session->commit_reversible_command (); return FALSE; @@ -772,9 +774,10 @@ LocationUI::add_new_location() jack_nframes_t where = session->audible_frame(); Location *location = new Location (where, where, "mark", Location::IsMark); session->begin_reversible_command (_("add marker")); - session->add_undo (session->locations()->get_memento()); + XMLNode &before = session->locations()->get_state(); session->locations()->add (location, true); - session->add_redo_no_execute (session->locations()->get_memento()); + XMLNode &after = session->locations()->get_state(); + session->add_command (new MementoCommand<Locations>(*(session->locations()), before, after)); session->commit_reversible_command (); } @@ -788,9 +791,10 @@ LocationUI::add_new_range() Location *location = new Location (where, where, "unnamed", Location::IsRangeMarker); session->begin_reversible_command (_("add range marker")); - session->add_undo (session->locations()->get_memento()); + XMLNode &before = session->locations()->get_state(); session->locations()->add (location, true); - session->add_redo_no_execute (session->locations()->get_memento()); + XMLNode &after = session->locations()->get_state(); + session->add_command (new MementoCommand<Locations>(*(session->locations()), before, after)); session->commit_reversible_command (); } } diff --git a/gtk2_ardour/main.cc b/gtk2_ardour/main.cc index 778355c858..27dc573706 100644 --- a/gtk2_ardour/main.cc +++ b/gtk2_ardour/main.cc @@ -293,60 +293,43 @@ Please consider the possibilities, and perhaps (re)start JACK.")); static bool maybe_load_session () { + /* If no session name is given: we're not loading a session yet, nor creating a new one */ + if (!session_name.length()) { + ui->hide_splash (); + if (!Config->get_no_new_session_dialog()) { + ui->new_session (true); + } - /* load session, if given */ - string name, path; - - if (session_name.length()){ - bool isnew; - - if (Session::find_session (session_name, path, name, isnew)) { - error << string_compose(_("could not load command line session \"%1\""), session_name) << endmsg; - } else { - - if (new_session) { - - /* command line required that the session be new */ - - if (isnew) { - - /* popup the new session dialog - once everything else is OK. - */ - - Glib::signal_idle().connect (bind (mem_fun (*ui, &ARDOUR_UI::cmdline_new_session), path)); - ui->set_will_create_new_session_automatically (true); - - } else { - - /* it wasn't new, but we require a new session */ + return true; + } - error << string_compose (_("\n\nA session named \"%1\" already exists.\n\ -To avoid this message, start ardour as \"ardour %1"), path) - << endmsg; - return false; - } + /* Load session or start the new session dialog */ + string name, path; - } else { + bool isnew; - /* command line didn't require a new session */ - - if (isnew) { - error << string_compose (_("\n\nNo session named \"%1\" exists.\n\ -To create it from the command line, start ardour as \"ardour --new %1"), path) - << endmsg; - return false; - } + if (Session::find_session (session_name, path, name, isnew)) { + error << string_compose(_("could not load command line session \"%1\""), session_name) << endmsg; + return false; + } - ui->load_session (path, name); - } + if (!new_session) { + + /* Loading a session, but the session doesn't exist */ + if (isnew) { + error << string_compose (_("\n\nNo session named \"%1\" exists.\n\ +To create it from the command line, start ardour as \"ardour --new %1"), path) << endmsg; + return false; } - if (no_splash) { - ui->show(); - } + ui->load_session (path, name); } else { + /* TODO: This bit of code doesn't work properly yet + Glib::signal_idle().connect (bind (mem_fun (*ui, &ARDOUR_UI::cmdline_new_session), path)); + ui->set_will_create_new_session_automatically (true); */ + + /* Show the NSD */ ui->hide_splash (); if (!Config->get_no_new_session_dialog()) { ui->new_session (true); diff --git a/gtk2_ardour/new_session_dialog.cc b/gtk2_ardour/new_session_dialog.cc index d1059cebe0..47a2b2b6d3 100644 --- a/gtk2_ardour/new_session_dialog.cc +++ b/gtk2_ardour/new_session_dialog.cc @@ -32,12 +32,15 @@ #include <gtkmm/filefilter.h> #include <gtkmm/stock.h> +#include "opts.h" NewSessionDialog::NewSessionDialog() : ArdourDialog ("New Session Dialog") { session_name_label = Gtk::manage(new class Gtk::Label(_("New Session Name :"))); m_name = Gtk::manage(new class Gtk::Entry()); + m_name->set_text(GTK_ARDOUR::session_name); + session_location_label = Gtk::manage(new class Gtk::Label(_("Create Session Directory In :"))); m_folder = Gtk::manage(new class Gtk::FileChooserButton(Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER)); session_template_label = Gtk::manage(new class Gtk::Label(_("Use Session Template :"))); @@ -324,13 +327,21 @@ NewSessionDialog::NewSessionDialog() m_folder->set_current_folder(getenv ("HOME")); m_folder->set_title(_("select directory")); - set_default_response (Gtk::RESPONSE_OK); - set_response_sensitive (Gtk::RESPONSE_OK, false); - set_response_sensitive (Gtk::RESPONSE_NONE, false); + on_new_session_page = true; m_notebook->set_current_page(0); m_notebook->show(); m_notebook->show_all_children(); + + set_default_response (Gtk::RESPONSE_OK); + if (!GTK_ARDOUR::session_name.length()) { + set_response_sensitive (Gtk::RESPONSE_OK, false); + set_response_sensitive (Gtk::RESPONSE_NONE, false); + } else { + set_response_sensitive (Gtk::RESPONSE_OK, true); + set_response_sensitive (Gtk::RESPONSE_NONE, true); + } + ///@ connect some signals m_connect_inputs->signal_clicked().connect (mem_fun (*this, &NewSessionDialog::connect_inputs_clicked)); @@ -501,11 +512,11 @@ NewSessionDialog::reset_name() bool NewSessionDialog::entry_key_release (GdkEventKey* ev) { - if (m_name->get_text() != "") { - set_response_sensitive (Gtk::RESPONSE_OK, true); + if (m_name->get_text() != "") { + set_response_sensitive (Gtk::RESPONSE_OK, true); set_response_sensitive (Gtk::RESPONSE_NONE, true); } else { - set_response_sensitive (Gtk::RESPONSE_OK, false); + set_response_sensitive (Gtk::RESPONSE_OK, false); } return true; } @@ -513,25 +524,27 @@ NewSessionDialog::entry_key_release (GdkEventKey* ev) void NewSessionDialog::notebook_page_changed (GtkNotebookPage* np, uint pagenum) { - if (pagenum == 1) { - m_okbutton->set_label(_("Open")); - set_response_sensitive (Gtk::RESPONSE_NONE, false); - m_okbutton->set_image (*(new Gtk::Image (Gtk::Stock::OPEN, Gtk::ICON_SIZE_BUTTON))); - if (m_treeview->get_selection()->count_selected_rows() == 0) { - set_response_sensitive (Gtk::RESPONSE_OK, false); + if (pagenum == 1) { + on_new_session_page = false; + m_okbutton->set_label(_("Open")); + set_response_sensitive (Gtk::RESPONSE_NONE, false); + m_okbutton->set_image (*(new Gtk::Image (Gtk::Stock::OPEN, Gtk::ICON_SIZE_BUTTON))); + if (m_treeview->get_selection()->count_selected_rows() == 0) { + set_response_sensitive (Gtk::RESPONSE_OK, false); } else { - set_response_sensitive (Gtk::RESPONSE_OK, true); + set_response_sensitive (Gtk::RESPONSE_OK, true); } } else { - if (m_name->get_text() != "") { - set_response_sensitive (Gtk::RESPONSE_NONE, true); + on_new_session_page = true; + if (m_name->get_text() != "") { + set_response_sensitive (Gtk::RESPONSE_NONE, true); } - m_okbutton->set_label(_("New")); - m_okbutton->set_image (*(new Gtk::Image (Gtk::Stock::NEW, Gtk::ICON_SIZE_BUTTON))); + m_okbutton->set_label(_("New")); + m_okbutton->set_image (*(new Gtk::Image (Gtk::Stock::NEW, Gtk::ICON_SIZE_BUTTON))); if (m_name->get_text() == "") { - set_response_sensitive (Gtk::RESPONSE_OK, false); + set_response_sensitive (Gtk::RESPONSE_OK, false); } else { - set_response_sensitive (Gtk::RESPONSE_OK, true); + set_response_sensitive (Gtk::RESPONSE_OK, true); } } } @@ -540,35 +553,37 @@ void NewSessionDialog::treeview_selection_changed () { if (m_treeview->get_selection()->count_selected_rows() == 0) { - if (!m_open_filechooser->get_filename().empty()) { - set_response_sensitive (Gtk::RESPONSE_OK, true); + if (!m_open_filechooser->get_filename().empty()) { + set_response_sensitive (Gtk::RESPONSE_OK, true); } else { - set_response_sensitive (Gtk::RESPONSE_OK, false); + set_response_sensitive (Gtk::RESPONSE_OK, false); } } else { - set_response_sensitive (Gtk::RESPONSE_OK, true); + set_response_sensitive (Gtk::RESPONSE_OK, true); } } void NewSessionDialog::file_chosen () { - m_treeview->get_selection()->unselect_all(); + if (on_new_session_page) return; + + m_treeview->get_selection()->unselect_all(); if (!m_open_filechooser->get_filename().empty()) { - set_response_sensitive (Gtk::RESPONSE_OK, true); + set_response_sensitive (Gtk::RESPONSE_OK, true); } else { - set_response_sensitive (Gtk::RESPONSE_OK, false); + set_response_sensitive (Gtk::RESPONSE_OK, false); } } void NewSessionDialog::template_chosen () { - if (m_template->get_filename() != "" ) {; - set_response_sensitive (Gtk::RESPONSE_NONE, true); + if (m_template->get_filename() != "" ) {; + set_response_sensitive (Gtk::RESPONSE_NONE, true); } else { - set_response_sensitive (Gtk::RESPONSE_NONE, false); + set_response_sensitive (Gtk::RESPONSE_NONE, false); } } diff --git a/gtk2_ardour/new_session_dialog.h b/gtk2_ardour/new_session_dialog.h index 366805d31f..5d652fd122 100644 --- a/gtk2_ardour/new_session_dialog.h +++ b/gtk2_ardour/new_session_dialog.h @@ -182,6 +182,8 @@ protected: void master_bus_button_clicked (); void monitor_bus_button_clicked (); + bool on_new_session_page; + }; diff --git a/gtk2_ardour/opts.cc b/gtk2_ardour/opts.cc index 69b8128824..fcd62de512 100644 --- a/gtk2_ardour/opts.cc +++ b/gtk2_ardour/opts.cc @@ -143,14 +143,19 @@ GTK_ARDOUR::parse_opts (int argc, char *argv[]) break; default: - break; + return print_help(execname); } } if (optind < argc) { + if (new_session) { + cerr << "Illogical combination: you can either create a new session, or a load an existing session but not both!" << endl; + return print_help(execname); + } session_name = argv[optind++]; } + return 0; } diff --git a/gtk2_ardour/pan_automation_time_axis.cc b/gtk2_ardour/pan_automation_time_axis.cc index fcef6f812c..ec884151b5 100644 --- a/gtk2_ardour/pan_automation_time_axis.cc +++ b/gtk2_ardour/pan_automation_time_axis.cc @@ -23,10 +23,12 @@ #include <ardour/panner.h> #include <gtkmm2ext/popup.h> +#include <pbd/memento_command.h> #include "pan_automation_time_axis.h" #include "automation_line.h" #include "canvas_impl.h" +#include "route_ui.h" #include "i18n.h" @@ -42,7 +44,7 @@ PanAutomationTimeAxisView::PanAutomationTimeAxisView (Session& s, boost::shared_ { multiline_selector.set_name ("PanAutomationLineSelector"); - controls_table.attach (multiline_selector, 1, 5, 1, 2, Gtk::FILL | Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); + controls_table.attach (multiline_selector, 1, 5, 1, 2, Gtk::EXPAND, Gtk::EXPAND); } PanAutomationTimeAxisView::~PanAutomationTimeAxisView () @@ -87,9 +89,10 @@ PanAutomationTimeAxisView::add_automation_event (ArdourCanvas::Item* item, GdkEv AutomationList& alist (lines[line_index]->the_list()); _session.begin_reversible_command (_("add pan automation event")); - _session.add_undo (alist.get_memento()); + XMLNode &before = alist.get_state(); alist.add (when, y); - _session.add_redo_no_execute (alist.get_memento()); + XMLNode &after = alist.get_state(); + _session.add_command(new MementoCommand<AutomationList>(alist, before, after)); _session.commit_reversible_command (); _session.set_dirty (); } @@ -105,15 +108,18 @@ void PanAutomationTimeAxisView::add_line (AutomationLine& line) { char buf[32]; - snprintf(buf,32,"Line %ld",lines.size()+1); + snprintf(buf,32,"Line %zu",lines.size()+1); multiline_selector.append_text(buf); if (lines.empty()) { multiline_selector.set_active(0); } - if (lines.size() + 1 > 1) { + if (lines.size() + 1 > 1 && (height_style != Small && height_style != Smaller)) { multiline_selector.show(); + } else { + multiline_selector.hide(); + } AutomationTimeAxisView::add_line(line); @@ -129,9 +135,10 @@ PanAutomationTimeAxisView::set_height (TimeAxisView::TrackHeight th) case Large: case Larger: case Normal: - multiline_selector.show(); - break; - + if (lines.size() > 1) { + multiline_selector.show(); + break; + } default: multiline_selector.hide(); } diff --git a/gtk2_ardour/plugin_selector.cc b/gtk2_ardour/plugin_selector.cc index a34533ade9..e0a62b177f 100644 --- a/gtk2_ardour/plugin_selector.cc +++ b/gtk2_ardour/plugin_selector.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -48,8 +48,6 @@ PluginSelector::PluginSelector (PluginManager *mgr) manager = mgr; session = 0; - o_selected_plug = -1; - i_selected_plug = 0; current_selection = PluginInfo::LADSPA; @@ -305,7 +303,7 @@ void PluginSelector::au_refiller () { guint row; - PluginInfoList &plugs = manager->au_plugin_info (); + PluginInfoList plugs (AUPluginInfo::discover ()); PluginInfoList::iterator i; char ibuf[16], obuf[16]; aumodel->clear(); @@ -346,7 +344,7 @@ PluginSelector::use_plugin (PluginInfoPtr pi) return; } - boost::shared_ptr<Plugin> plugin = manager->load (*session, pi); + PluginPtr plugin = pi->load (*session); if (plugin) { PluginCreated (plugin); diff --git a/gtk2_ardour/plugin_selector.h b/gtk2_ardour/plugin_selector.h index 06c2f1d18e..583506972a 100644 --- a/gtk2_ardour/plugin_selector.h +++ b/gtk2_ardour/plugin_selector.h @@ -30,7 +30,6 @@ namespace ARDOUR { class Session; class PluginManager; - class PluginInfo; } class PluginSelector : public ArdourDialog @@ -134,12 +133,6 @@ class PluginSelector : public ArdourDialog void au_display_selection_changed(); #endif //HAVE_COREAUDIO - ARDOUR::PluginInfo* i_selected_plug; - - // We need an integer for the output side because - // the name isn't promised to be unique. - gint o_selected_plug; - ARDOUR::PluginManager *manager; static void _input_refiller (void *); diff --git a/gtk2_ardour/plugin_ui.cc b/gtk2_ardour/plugin_ui.cc index beddad4e16..edc94864f2 100644 --- a/gtk2_ardour/plugin_ui.cc +++ b/gtk2_ardour/plugin_ui.cc @@ -90,13 +90,13 @@ PluginUIWindow::PluginUIWindow (AudioEngine &engine, boost::shared_ptr<PluginIns } else { - PluginUI* pu = new PluginUI (engine, insert, scrollable); + LadspaPluginUI* pu = new LadspaPluginUI (engine, insert, scrollable); _pluginui = pu; get_vbox()->add (*pu); - signal_map_event().connect (mem_fun (*pu, &PluginUI::start_updating)); - signal_unmap_event().connect (mem_fun (*pu, &PluginUI::stop_updating)); + signal_map_event().connect (mem_fun (*pu, &LadspaPluginUI::start_updating)); + signal_unmap_event().connect (mem_fun (*pu, &LadspaPluginUI::stop_updating)); } set_position (Gtk::WIN_POS_MOUSE); @@ -117,7 +117,7 @@ PluginUIWindow::~PluginUIWindow () { } -PluginUI::PluginUI (AudioEngine &engine, boost::shared_ptr<PluginInsert> pi, bool scrollable) +LadspaPluginUI::LadspaPluginUI (AudioEngine &engine, boost::shared_ptr<PluginInsert> pi, bool scrollable) : PlugUIBase (pi), engine(engine), button_table (initial_button_rows, initial_button_cols), @@ -165,13 +165,13 @@ PluginUI::PluginUI (AudioEngine &engine, boost::shared_ptr<PluginInsert> pi, boo pack_start (hpacker, false, false); } - insert->active_changed.connect (mem_fun(*this, &PluginUI::redirect_active_changed)); + insert->active_changed.connect (mem_fun(*this, &LadspaPluginUI::redirect_active_changed)); bypass_button.set_active (!insert->active()); build (engine); } -PluginUI::~PluginUI () +LadspaPluginUI::~LadspaPluginUI () { if (output_controls.size() > 0) { screen_update_connection.disconnect(); @@ -179,7 +179,7 @@ PluginUI::~PluginUI () } void -PluginUI::build (AudioEngine &engine) +LadspaPluginUI::build (AudioEngine &engine) { guint32 i = 0; @@ -326,8 +326,8 @@ PluginUI::build (AudioEngine &engine) } } - n_ins = plugin->get_info().n_inputs; - n_outs = plugin->get_info().n_outputs; + n_ins = plugin->get_info()->n_inputs; + n_outs = plugin->get_info()->n_outputs; if (box->children().empty()) { hpacker.remove (*frame); @@ -350,7 +350,7 @@ PluginUI::build (AudioEngine &engine) button_table.show_all (); } -PluginUI::ControlUI::ControlUI () +LadspaPluginUI::ControlUI::ControlUI () : automate_button (X_("")) // force creation of a label { automate_button.set_name ("PluginAutomateButton"); @@ -370,7 +370,7 @@ PluginUI::ControlUI::ControlUI () meterinfo = 0; } -PluginUI::ControlUI::~ControlUI() +LadspaPluginUI::ControlUI::~ControlUI() { if (adjustment) { delete adjustment; @@ -383,7 +383,7 @@ PluginUI::ControlUI::~ControlUI() } void -PluginUI::automation_state_changed (ControlUI* cui) +LadspaPluginUI::automation_state_changed (ControlUI* cui) { /* update button label */ @@ -413,13 +413,13 @@ static void integer_printer (char buf[32], Adjustment &adj, void *arg) } void -PluginUI::print_parameter (char *buf, uint32_t len, uint32_t param) +LadspaPluginUI::print_parameter (char *buf, uint32_t len, uint32_t param) { plugin->print_parameter (param, buf, len); } -PluginUI::ControlUI* -PluginUI::build_control_ui (AudioEngine &engine, guint32 port_index, PBD::Controllable* mcontrol) +LadspaPluginUI::ControlUI* +LadspaPluginUI::build_control_ui (AudioEngine &engine, guint32 port_index, PBD::Controllable* mcontrol) { ControlUI* control_ui; @@ -452,8 +452,8 @@ PluginUI::build_control_ui (AudioEngine &engine, guint32 port_index, PBD::Contro control_ui->combo = new Gtk::ComboBoxText; //control_ui->combo->set_value_in_list(true, false); set_popdown_strings (*control_ui->combo, setup_scale_values(port_index, control_ui)); - control_ui->combo->signal_changed().connect (bind (mem_fun(*this, &PluginUI::control_combo_changed), control_ui)); - plugin->ParameterChanged.connect (bind (mem_fun (*this, &PluginUI::parameter_changed), control_ui)); + control_ui->combo->signal_changed().connect (bind (mem_fun(*this, &LadspaPluginUI::control_combo_changed), control_ui)); + plugin->ParameterChanged.connect (bind (mem_fun (*this, &LadspaPluginUI::parameter_changed), control_ui)); control_ui->pack_start(control_ui->label, true, true); control_ui->pack_start(*control_ui->combo, false, true); @@ -476,7 +476,7 @@ PluginUI::build_control_ui (AudioEngine &engine, guint32 port_index, PBD::Contro control_ui->pack_start (*control_ui->button, false, true); control_ui->pack_start (control_ui->automate_button, false, false); - control_ui->button->signal_clicked().connect (bind (mem_fun(*this, &PluginUI::control_port_toggled), control_ui)); + control_ui->button->signal_clicked().connect (bind (mem_fun(*this, &LadspaPluginUI::control_port_toggled), control_ui)); if(plugin->get_parameter (port_index) == 1){ control_ui->button->set_active(true); @@ -514,7 +514,7 @@ PluginUI::build_control_ui (AudioEngine &engine, guint32 port_index, PBD::Contro Gtkmm2ext::set_size_request_to_display_given_text (*control_ui->clickbox, "g9999999", 2, 2); control_ui->clickbox->set_print_func (integer_printer, 0); } else { - sigc::slot<void,char*,uint32_t> pslot = sigc::bind (mem_fun(*this, &PluginUI::print_parameter), (uint32_t) port_index); + sigc::slot<void,char*,uint32_t> pslot = sigc::bind (mem_fun(*this, &LadspaPluginUI::print_parameter), (uint32_t) port_index); control_ui->control = new BarController (*control_ui->adjustment, *mcontrol, pslot); // should really match the height of the text in the automation button+label @@ -523,8 +523,8 @@ PluginUI::build_control_ui (AudioEngine &engine, guint32 port_index, PBD::Contro control_ui->control->set_style (BarController::LeftToRight); control_ui->control->set_use_parent (true); - control_ui->control->StartGesture.connect (bind (mem_fun(*this, &PluginUI::start_touch), control_ui)); - control_ui->control->StopGesture.connect (bind (mem_fun(*this, &PluginUI::stop_touch), control_ui)); + control_ui->control->StartGesture.connect (bind (mem_fun(*this, &LadspaPluginUI::start_touch), control_ui)); + control_ui->control->StopGesture.connect (bind (mem_fun(*this, &LadspaPluginUI::stop_touch), control_ui)); } @@ -547,14 +547,14 @@ PluginUI::build_control_ui (AudioEngine &engine, guint32 port_index, PBD::Contro } control_ui->pack_start (control_ui->automate_button, false, false); - control_ui->adjustment->signal_value_changed().connect (bind (mem_fun(*this, &PluginUI::control_adjustment_changed), control_ui)); - control_ui->automate_button.signal_clicked().connect (bind (mem_fun(*this, &PluginUI::astate_clicked), control_ui, (uint32_t) port_index)); + control_ui->adjustment->signal_value_changed().connect (bind (mem_fun(*this, &LadspaPluginUI::control_adjustment_changed), control_ui)); + control_ui->automate_button.signal_clicked().connect (bind (mem_fun(*this, &LadspaPluginUI::astate_clicked), control_ui, (uint32_t) port_index)); automation_state_changed (control_ui); - plugin->ParameterChanged.connect (bind (mem_fun(*this, &PluginUI::parameter_changed), control_ui)); + plugin->ParameterChanged.connect (bind (mem_fun(*this, &LadspaPluginUI::parameter_changed), control_ui)); insert->automation_list (port_index).automation_state_changed.connect - (bind (mem_fun(*this, &PluginUI::automation_state_changed), control_ui)); + (bind (mem_fun(*this, &LadspaPluginUI::automation_state_changed), control_ui)); } else if (plugin->parameter_is_output (port_index)) { @@ -603,24 +603,24 @@ PluginUI::build_control_ui (AudioEngine &engine, guint32 port_index, PBD::Contro output_controls.push_back (control_ui); } - plugin->ParameterChanged.connect (bind (mem_fun(*this, &PluginUI::parameter_changed), control_ui)); + plugin->ParameterChanged.connect (bind (mem_fun(*this, &LadspaPluginUI::parameter_changed), control_ui)); return control_ui; } void -PluginUI::start_touch (PluginUI::ControlUI* cui) +LadspaPluginUI::start_touch (LadspaPluginUI::ControlUI* cui) { insert->automation_list (cui->port_index).start_touch (); } void -PluginUI::stop_touch (PluginUI::ControlUI* cui) +LadspaPluginUI::stop_touch (LadspaPluginUI::ControlUI* cui) { insert->automation_list (cui->port_index).stop_touch (); } void -PluginUI::astate_clicked (ControlUI* cui, uint32_t port) +LadspaPluginUI::astate_clicked (ControlUI* cui, uint32_t port) { using namespace Menu_Helpers; @@ -633,25 +633,25 @@ PluginUI::astate_clicked (ControlUI* cui, uint32_t port) items.clear (); items.push_back (MenuElem (_("Off"), - bind (mem_fun(*this, &PluginUI::set_automation_state), (AutoState) Off, cui))); + bind (mem_fun(*this, &LadspaPluginUI::set_automation_state), (AutoState) Off, cui))); items.push_back (MenuElem (_("Play"), - bind (mem_fun(*this, &PluginUI::set_automation_state), (AutoState) Play, cui))); + bind (mem_fun(*this, &LadspaPluginUI::set_automation_state), (AutoState) Play, cui))); items.push_back (MenuElem (_("Write"), - bind (mem_fun(*this, &PluginUI::set_automation_state), (AutoState) Write, cui))); + bind (mem_fun(*this, &LadspaPluginUI::set_automation_state), (AutoState) Write, cui))); items.push_back (MenuElem (_("Touch"), - bind (mem_fun(*this, &PluginUI::set_automation_state), (AutoState) Touch, cui))); + bind (mem_fun(*this, &LadspaPluginUI::set_automation_state), (AutoState) Touch, cui))); automation_menu->popup (1, 0); } void -PluginUI::set_automation_state (AutoState state, ControlUI* cui) +LadspaPluginUI::set_automation_state (AutoState state, ControlUI* cui) { insert->set_port_automation_state (cui->port_index, state); } void -PluginUI::control_adjustment_changed (ControlUI* cui) +LadspaPluginUI::control_adjustment_changed (ControlUI* cui) { if (cui->ignore_change) { return; @@ -667,18 +667,18 @@ PluginUI::control_adjustment_changed (ControlUI* cui) } void -PluginUI::parameter_changed (uint32_t abs_port_id, float val, ControlUI* cui) +LadspaPluginUI::parameter_changed (uint32_t abs_port_id, float val, ControlUI* cui) { if (cui->port_index == abs_port_id) { if (!cui->update_pending) { cui->update_pending = true; - Gtkmm2ext::UI::instance()->call_slot (bind (mem_fun(*this, &PluginUI::update_control_display), cui)); + Gtkmm2ext::UI::instance()->call_slot (bind (mem_fun(*this, &LadspaPluginUI::update_control_display), cui)); } } } void -PluginUI::update_control_display (ControlUI* cui) +LadspaPluginUI::update_control_display (ControlUI* cui) { /* XXX how do we handle logarithmic stuff here ? */ @@ -715,7 +715,7 @@ PluginUI::update_control_display (ControlUI* cui) } void -PluginUI::control_port_toggled (ControlUI* cui) +LadspaPluginUI::control_port_toggled (ControlUI* cui) { if (!cui->ignore_change) { insert->set_parameter (cui->port_index, cui->button->get_active()); @@ -723,7 +723,7 @@ PluginUI::control_port_toggled (ControlUI* cui) } void -PluginUI::control_combo_changed (ControlUI* cui) +LadspaPluginUI::control_combo_changed (ControlUI* cui) { if (!cui->ignore_change) { string value = cui->combo->get_active_text(); @@ -743,26 +743,26 @@ PluginUIWindow::plugin_going_away (ARDOUR::Redirect* ignored) } void -PluginUI::redirect_active_changed (Redirect* r, void* src) +LadspaPluginUI::redirect_active_changed (Redirect* r, void* src) { - ENSURE_GUI_THREAD(bind (mem_fun(*this, &PluginUI::redirect_active_changed), r, src)); + ENSURE_GUI_THREAD(bind (mem_fun(*this, &LadspaPluginUI::redirect_active_changed), r, src)); bypass_button.set_active (!r->active()); } bool -PluginUI::start_updating (GdkEventAny* ignored) +LadspaPluginUI::start_updating (GdkEventAny* ignored) { if (output_controls.size() > 0 ) { screen_update_connection.disconnect(); screen_update_connection = ARDOUR_UI::instance()->RapidScreenUpdate.connect - (mem_fun(*this, &PluginUI::output_update)); + (mem_fun(*this, &LadspaPluginUI::output_update)); } return false; } bool -PluginUI::stop_updating (GdkEventAny* ignored) +LadspaPluginUI::stop_updating (GdkEventAny* ignored) { if (output_controls.size() > 0 ) { screen_update_connection.disconnect(); @@ -771,7 +771,7 @@ PluginUI::stop_updating (GdkEventAny* ignored) } void -PluginUI::output_update () +LadspaPluginUI::output_update () { for (vector<ControlUI*>::iterator i = output_controls.begin(); i != output_controls.end(); ++i) { float val = plugin->get_parameter ((*i)->port_index); @@ -805,7 +805,7 @@ PluginUI::output_update () } vector<string> -PluginUI::setup_scale_values(guint32 port_index, ControlUI* cui) +LadspaPluginUI::setup_scale_values(guint32 port_index, ControlUI* cui) { vector<string> enums; boost::shared_ptr<LadspaPlugin> lp = boost::dynamic_pointer_cast<LadspaPlugin> (plugin); diff --git a/gtk2_ardour/plugin_ui.h b/gtk2_ardour/plugin_ui.h index 570a224b66..dc1e61887b 100644 --- a/gtk2_ardour/plugin_ui.h +++ b/gtk2_ardour/plugin_ui.h @@ -50,6 +50,7 @@ namespace ARDOUR { class Plugin; class VSTPlugin; class Redirect; + class AUPlugin; } namespace PBD { @@ -86,11 +87,11 @@ class PlugUIBase : public virtual sigc::trackable void bypass_toggled(); }; -class PluginUI : public PlugUIBase, public Gtk::VBox +class LadspaPluginUI : public PlugUIBase, public Gtk::VBox { public: - PluginUI (ARDOUR::AudioEngine &, boost::shared_ptr<ARDOUR::PluginInsert> plug, bool scrollable=false); - ~PluginUI (); + LadspaPluginUI (ARDOUR::AudioEngine &, boost::shared_ptr<ARDOUR::PluginInsert> plug, bool scrollable=false); + ~LadspaPluginUI (); gint get_preferred_height () { return prefheight; } @@ -231,6 +232,22 @@ class VSTPluginUI : public PlugUIBase, public Gtk::VBox bool configure_handler (GdkEventConfigure*, Gtk::Socket*); void save_plugin_setting (); }; -#endif +#endif // VST_SUPPORT + +#ifdef HAVE_COREAUDIO +class AUPluginUI : public PlugUIBase +{ + public: + AUPluginUI (boost::shared_ptr<ARDOUR::PluginInsert>, boost::shared_ptr<ARDOUR::AUPlugin>); + ~AUPluginUI (); + + gint get_preferred_height (); + bool start_updating(GdkEventAny*) {return false;} + bool stop_updating(GdkEventAny*) {return false;} + + private: + boost::shared_ptr<ARDOUR::AUPlugin> au; +}; +#endif // HAVE_COREAUDIO #endif /* __ardour_plugin_ui_h__ */ diff --git a/gtk2_ardour/redirect_automation_time_axis.cc b/gtk2_ardour/redirect_automation_time_axis.cc index a53c1a20e4..e527fd1d5e 100644 --- a/gtk2_ardour/redirect_automation_time_axis.cc +++ b/gtk2_ardour/redirect_automation_time_axis.cc @@ -21,6 +21,7 @@ #include <ardour/redirect.h> #include <ardour/session.h> #include <cstdlib> +#include <pbd/memento_command.h> #include "redirect_automation_time_axis.h" #include "automation_line.h" @@ -98,9 +99,10 @@ RedirectAutomationTimeAxisView::add_automation_event (ArdourCanvas::Item* item, lines.front()->view_to_model_y (y); _session.begin_reversible_command (description); - _session.add_undo (alist.get_memento()); + XMLNode &before = alist.get_state(); alist.add (when, y); - _session.add_redo_no_execute (alist.get_memento()); + XMLNode &after = alist.get_state(); + _session.add_command(new MementoCommand<AutomationList>(alist, before, after)); _session.commit_reversible_command (); _session.set_dirty (); } diff --git a/gtk2_ardour/redirect_box.cc b/gtk2_ardour/redirect_box.cc index 0455dfdeb4..74198265d9 100644 --- a/gtk2_ardour/redirect_box.cc +++ b/gtk2_ardour/redirect_box.cc @@ -378,7 +378,7 @@ RedirectBox::wierd_plugin_dialog (Plugin& p, uint32_t streams, boost::shared_ptr /* i hate this kind of code */ - if (streams > p.get_info().n_inputs) { + if (streams > p.get_info()->n_inputs) { label.set_text (string_compose (_( "You attempted to add a plugin (%1).\n" "The plugin has %2 inputs\n" @@ -388,9 +388,9 @@ RedirectBox::wierd_plugin_dialog (Plugin& p, uint32_t streams, boost::shared_ptr "This makes no sense - you are throwing away\n" "part of the signal."), p.name(), - p.get_info().n_inputs, + p.get_info()->n_inputs, streams)); - } else if (streams < p.get_info().n_inputs) { + } else if (streams < p.get_info()->n_inputs) { label.set_text (string_compose (_( "You attempted to add a plugin (%1).\n" "The plugin has %2 inputs\n" @@ -401,7 +401,7 @@ RedirectBox::wierd_plugin_dialog (Plugin& p, uint32_t streams, boost::shared_ptr "side-chain inputs. A future version of Ardour will\n" "support this type of configuration."), p.name(), - p.get_info().n_inputs, + p.get_info()->n_inputs, streams)); } else { label.set_text (string_compose (_( @@ -415,8 +415,8 @@ RedirectBox::wierd_plugin_dialog (Plugin& p, uint32_t streams, boost::shared_ptr "\n" "Ardour does not understand what to do in such situations.\n"), p.name(), - p.get_info().n_inputs, - p.get_info().n_outputs, + p.get_info()->n_inputs, + p.get_info()->n_outputs, io->n_inputs(), io->n_outputs(), streams)); diff --git a/gtk2_ardour/region_editor.h b/gtk2_ardour/region_editor.h index 176ced0792..70590b0db5 100644 --- a/gtk2_ardour/region_editor.h +++ b/gtk2_ardour/region_editor.h @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: region_editor.h 231 2006-01-03 14:16:27Z karstenweise $ + $Id: /local/undo/gtk2_ardour/region_editor.h 5 2006-05-31T02:48:48.738745Z paul $ */ #ifndef __gtk_ardour_region_edit_h__ diff --git a/gtk2_ardour/region_gain_line.cc b/gtk2_ardour/region_gain_line.cc index a542be054e..0a4a3d29ea 100644 --- a/gtk2_ardour/region_gain_line.cc +++ b/gtk2_ardour/region_gain_line.cc @@ -1,5 +1,6 @@ #include <ardour/curve.h> #include <ardour/audioregion.h> +#include <pbd/memento_command.h> #include "region_gain_line.h" #include "audio_region_view.h" @@ -47,7 +48,8 @@ AudioRegionGainLine::start_drag (ControlPoint* cp, float fraction) { AutomationLine::start_drag(cp,fraction); if (!rv.audio_region().envelope_active()) { - trackview.session().add_undo( bind( mem_fun(rv.audio_region(), &AudioRegion::set_envelope_active), false) ); + trackview.session().add_command(new MementoUndoCommand<AudioRegion>(rv.audio_region(), rv.audio_region().get_state())); + rv.audio_region().set_envelope_active(false); } } @@ -60,17 +62,18 @@ AudioRegionGainLine::remove_point (ControlPoint& cp) model_representation (cp, mr); trackview.editor.current_session()->begin_reversible_command (_("remove control point")); - trackview.editor.current_session()->add_undo (get_memento()); + XMLNode &before = get_state(); if (!rv.audio_region().envelope_active()) { - trackview.session().add_undo( bind( mem_fun(rv.audio_region(), &AudioRegion::set_envelope_active), false) ); - trackview.session().add_redo( bind( mem_fun(rv.audio_region(), &AudioRegion::set_envelope_active), true) ); + XMLNode &before = rv.audio_region().get_state(); rv.audio_region().set_envelope_active(true); + XMLNode &after = rv.audio_region().get_state(); + trackview.session().add_command(new MementoCommand<AudioRegion>(rv.audio_region(), before, after)); } alist.erase (mr.start, mr.end); - trackview.editor.current_session()->add_redo_no_execute (get_memento()); + trackview.editor.current_session()->add_command (new MementoCommand<AudioRegionGainLine>(*this, before, get_state())); trackview.editor.current_session()->commit_reversible_command (); trackview.editor.current_session()->set_dirty (); } @@ -79,8 +82,8 @@ void AudioRegionGainLine::end_drag (ControlPoint* cp) { if (!rv.audio_region().envelope_active()) { - trackview.session().add_redo( bind( mem_fun(rv.audio_region(), &AudioRegion::set_envelope_active), true) ); rv.audio_region().set_envelope_active(true); + trackview.session().add_command(new MementoRedoCommand<AudioRegion>(rv.audio_region(), rv.audio_region().get_state())); } AutomationLine::end_drag(cp); } diff --git a/gtk2_ardour/region_gain_line.h b/gtk2_ardour/region_gain_line.h index bf6de0d810..02340c8bae 100644 --- a/gtk2_ardour/region_gain_line.h +++ b/gtk2_ardour/region_gain_line.h @@ -26,6 +26,7 @@ class AudioRegionGainLine : public AutomationLine void remove_point (ControlPoint&); + PBD::ID id() { return _id; } private: @@ -33,6 +34,8 @@ class AudioRegionGainLine : public AutomationLine AudioRegionView& rv; UndoAction get_memento(); + + PBD::ID _id; }; diff --git a/gtk2_ardour/route_params_ui.cc b/gtk2_ardour/route_params_ui.cc index 8b47a17511..86ac1e035e 100644 --- a/gtk2_ardour/route_params_ui.cc +++ b/gtk2_ardour/route_params_ui.cc @@ -287,9 +287,9 @@ void RouteParams_UI::cleanup_pre_view (bool stopupdate) { if (_active_pre_view) { - PluginUI * plugui = 0; + LadspaPluginUI * plugui = 0; - if (stopupdate && (plugui = dynamic_cast<PluginUI*>(_active_pre_view)) != 0) { + if (stopupdate && (plugui = dynamic_cast<LadspaPluginUI*>(_active_pre_view)) != 0) { plugui->stop_updating (0); } @@ -304,9 +304,9 @@ void RouteParams_UI::cleanup_post_view (bool stopupdate) { if (_active_post_view) { - PluginUI * plugui = 0; + LadspaPluginUI * plugui = 0; - if (stopupdate && (plugui = dynamic_cast<PluginUI*>(_active_post_view)) != 0) { + if (stopupdate && (plugui = dynamic_cast<LadspaPluginUI*>(_active_post_view)) != 0) { plugui->stop_updating (0); } _post_plugin_conn.disconnect(); @@ -556,7 +556,7 @@ RouteParams_UI::redirect_selected (boost::shared_ptr<ARDOUR::Redirect> redirect, if ((plugin_insert = boost::dynamic_pointer_cast<PluginInsert> (insert)) != 0) { - PluginUI *plugin_ui = new PluginUI (session->engine(), plugin_insert, true); + LadspaPluginUI *plugin_ui = new LadspaPluginUI (session->engine(), plugin_insert, true); if (place == PreFader) { cleanup_pre_view(); diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index cb9883b8e6..82d5b53cba 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -29,6 +29,7 @@ #include <pbd/error.h> #include <pbd/stl_delete.h> #include <pbd/whitespace.h> +#include <pbd/memento_command.h> #include <gtkmm/menu.h> #include <gtkmm/menuitem.h> @@ -575,46 +576,88 @@ RouteTimeAxisView::set_height (TrackHeight h) switch (height_style) { case Largest: xml_node->add_property ("track_height", "largest"); - show_name_entry (); - hide_name_label (); - controls_table.show_all(); break; + case Large: xml_node->add_property ("track_height", "large"); - show_name_entry (); - hide_name_label (); - controls_table.show_all(); break; + case Larger: xml_node->add_property ("track_height", "larger"); - show_name_entry (); - hide_name_label (); - controls_table.show_all(); break; + case Normal: xml_node->add_property ("track_height", "normal"); + break; + + case Smaller: + xml_node->add_property ("track_height", "smaller"); + break; + + case Small: + xml_node->add_property ("track_height", "small"); + break; + } + + switch (height_style) { + case Largest: + case Large: + case Larger: + case Normal: show_name_entry (); hide_name_label (); - controls_table.show_all(); + + mute_button->show_all(); + solo_button->show_all(); + if (rec_enable_button) + rec_enable_button->show_all(); + + edit_group_button.show_all(); + hide_button.show_all(); + visual_button.show_all(); + size_button.show_all(); + automation_button.show_all(); + + if (is_track() && track()->mode() == ARDOUR::Normal) { + playlist_button.show_all(); + } break; + case Smaller: - xml_node->add_property ("track_height", "smaller"); - controls_table.show_all (); show_name_entry (); hide_name_label (); + + mute_button->show_all(); + solo_button->show_all(); + if (rec_enable_button) + rec_enable_button->show_all(); + edit_group_button.hide (); hide_button.hide (); visual_button.hide (); size_button.hide (); automation_button.hide (); - playlist_button.hide (); + + if (is_track() && track()->mode() == ARDOUR::Normal) { + playlist_button.hide (); + } break; + case Small: - xml_node->add_property ("track_height", "small"); - controls_table.hide_all (); - controls_table.show (); hide_name_entry (); show_name_label (); + + mute_button->hide(); + solo_button->hide(); + if (rec_enable_button) + rec_enable_button->hide(); + + edit_group_button.hide (); + hide_button.hide (); + visual_button.hide (); + size_button.hide (); + automation_button.hide (); + playlist_button.hide (); name_label.set_text (_route->name()); break; } @@ -1008,12 +1051,12 @@ RouteTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op) } } + XMLNode &before = playlist->get_state(); switch (op) { case Cut: - _session.add_undo (playlist->get_memento()); if ((what_we_got = playlist->cut (time)) != 0) { editor.get_cut_buffer().add (what_we_got); - _session.add_redo_no_execute (playlist->get_memento()); + _session.add_command( new MementoCommand<Playlist>(*playlist, before, playlist->get_state())); ret = true; } break; @@ -1024,9 +1067,8 @@ RouteTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op) break; case Clear: - _session.add_undo (playlist->get_memento()); if ((what_we_got = playlist->cut (time)) != 0) { - _session.add_redo_no_execute (playlist->get_memento()); + _session.add_command( new MementoCommand<Playlist>(*playlist, before, playlist->get_state())); what_we_got->unref (); ret = true; } @@ -1055,9 +1097,9 @@ RouteTimeAxisView::paste (jack_nframes_t pos, float times, Selection& selection, if (get_diskstream()->speed() != 1.0f) pos = session_frame_to_track_frame(pos, get_diskstream()->speed() ); - _session.add_undo (playlist->get_memento()); + XMLNode &before = playlist->get_state(); playlist->paste (**p, pos, times); - _session.add_redo_no_execute (playlist->get_memento()); + _session.add_command( new MementoCommand<Playlist>(*playlist, before, playlist->get_state())); return true; } diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index f4b602d39c..e90355fd0a 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -25,6 +25,7 @@ #include <gtkmm2ext/bindable_button.h> #include <ardour/route_group.h> +#include <pbd/memento_command.h> #include "route_ui.h" #include "keyboard.h" @@ -130,9 +131,10 @@ RouteUI::mute_press(GdkEventButton* ev) /* ctrl-shift-click applies change to all routes */ _session.begin_reversible_command (_("mute change")); - _session.add_undo (_session.global_mute_memento(this)); + Session::GlobalMuteStateCommand *cmd = new Session::GlobalMuteStateCommand(_session, this); _session.set_all_mute (!_route->muted()); - _session.add_redo_no_execute (_session.global_mute_memento(this)); + cmd->mark(); + _session.add_command(cmd); _session.commit_reversible_command (); } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) { @@ -205,9 +207,10 @@ RouteUI::solo_press(GdkEventButton* ev) /* ctrl-shift-click applies change to all routes */ _session.begin_reversible_command (_("solo change")); - _session.add_undo (_session.global_solo_memento(this)); + Session::GlobalSoloStateCommand *cmd = new Session::GlobalSoloStateCommand(_session, this); _session.set_all_solo (!_route->soloed()); - _session.add_redo_no_execute (_session.global_solo_memento(this)); + cmd->mark(); + _session.add_command (cmd); _session.commit_reversible_command (); } else if (Keyboard::modifier_state_contains (ev->state, Keyboard::ModifierMask (Keyboard::Control|Keyboard::Alt))) { @@ -215,10 +218,11 @@ RouteUI::solo_press(GdkEventButton* ev) // ctrl-alt-click: exclusively solo this track, not a toggle */ _session.begin_reversible_command (_("solo change")); - _session.add_undo (_session.global_solo_memento(this)); + Session::GlobalSoloStateCommand *cmd = new Session::GlobalSoloStateCommand (_session, this); _session.set_all_solo (false); _route->set_solo (true, this); - _session.add_redo_no_execute (_session.global_solo_memento(this)); + cmd->mark(); + _session.add_command(cmd); _session.commit_reversible_command (); } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::Shift)) { @@ -278,7 +282,7 @@ RouteUI::rec_enable_press(GdkEventButton* ev) else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::Control|Keyboard::Shift))) { _session.begin_reversible_command (_("rec-enable change")); - _session.add_undo (_session.global_record_enable_memento(this)); + Session::GlobalRecordEnableStateCommand *cmd = new Session::GlobalRecordEnableStateCommand(_session, this); if (rec_enable_button->get_active()) { _session.record_disenable_all (); @@ -286,7 +290,8 @@ RouteUI::rec_enable_press(GdkEventButton* ev) _session.record_enable_all (); } - _session.add_redo_no_execute (_session.global_record_enable_memento(this)); + cmd->mark(); + _session.add_command(cmd); _session.commit_reversible_command (); } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) { @@ -555,9 +560,10 @@ RouteUI::set_mix_group_solo(boost::shared_ptr<Route> route, bool yn) if((mix_group = route->mix_group()) != 0){ _session.begin_reversible_command (_("mix group solo change")); - _session.add_undo (_session.global_solo_memento (this)); + Session::GlobalSoloStateCommand *cmd = new Session::GlobalSoloStateCommand(_session, this); mix_group->apply(&Route::set_solo, yn, this); - _session.add_redo_no_execute (_session.global_solo_memento(this)); + cmd->mark(); + _session.add_command (cmd); _session.commit_reversible_command (); } else { reversibly_apply_route_boolean ("solo change", &Route::set_solo, !route->soloed(), this); @@ -568,8 +574,10 @@ void RouteUI::reversibly_apply_route_boolean (string name, void (Route::*func)(bool, void *), bool yn, void *arg) { _session.begin_reversible_command (name); - _session.add_undo (bind (mem_fun (*_route, func), !yn, (void *) arg)); - _session.add_redo (bind (mem_fun (*_route, func), yn, (void *) arg)); + XMLNode &before = _route->get_state(); + bind(mem_fun(*_route, func), yn, arg)(); + XMLNode &after = _route->get_state(); + _session.add_command (new MementoCommand<Route>(*_route, before, after)); _session.commit_reversible_command (); } @@ -577,8 +585,10 @@ void RouteUI::reversibly_apply_audio_track_boolean (string name, void (AudioTrack::*func)(bool, void *), bool yn, void *arg) { _session.begin_reversible_command (name); - _session.add_undo (bind (mem_fun (*audio_track(), func), !yn, (void *) arg)); - _session.add_redo (bind (mem_fun (*audio_track(), func), yn, (void *) arg)); + XMLNode &before = audio_track()->get_state(); + bind (mem_fun (*audio_track(), func), yn, arg)(); + XMLNode &after = audio_track()->get_state(); + _session.add_command (new MementoCommand<AudioTrack>(*audio_track(), before, after)); _session.commit_reversible_command (); } @@ -589,9 +599,10 @@ RouteUI::set_mix_group_mute(boost::shared_ptr<Route> route, bool yn) if((mix_group = route->mix_group()) != 0){ _session.begin_reversible_command (_("mix group mute change")); - _session.add_undo (_session.global_mute_memento (this)); + Session::GlobalMuteStateCommand *cmd = new Session::GlobalMuteStateCommand (_session, this); mix_group->apply(&Route::set_mute, yn, this); - _session.add_redo_no_execute (_session.global_mute_memento(this)); + cmd->mark(); + _session.add_command(cmd); _session.commit_reversible_command (); } else { reversibly_apply_route_boolean ("mute change", &Route::set_mute, !route->muted(), this); @@ -605,9 +616,10 @@ RouteUI::set_mix_group_rec_enable(boost::shared_ptr<Route> route, bool yn) if((mix_group = route->mix_group()) != 0){ _session.begin_reversible_command (_("mix group rec-enable change")); - _session.add_undo (_session.global_record_enable_memento (this)); + Session::GlobalRecordEnableStateCommand *cmd = new Session::GlobalRecordEnableStateCommand(_session, this); mix_group->apply (&Route::set_record_enable, yn, this); - _session.add_redo_no_execute (_session.global_record_enable_memento(this)); + cmd->mark(); + _session.add_command(cmd); _session.commit_reversible_command (); } else { reversibly_apply_route_boolean ("rec-enable change", &Route::set_record_enable, !_route->record_enabled(), this); diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc index 842d4046d8..2e1f3c5273 100644 --- a/gtk2_ardour/time_axis_view.cc +++ b/gtk2_ardour/time_axis_view.cc @@ -128,6 +128,7 @@ TimeAxisView::TimeAxisView (ARDOUR::Session& sess, PublicEditor& ed, TimeAxisVie controls_table.attach (name_hbox, 0, 4, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); controls_table.show_all (); + controls_table.set_no_show_all (); controls_vbox.pack_start (controls_table, false, false); controls_vbox.show (); diff --git a/gtk2_ardour/vst_pluginui.cc b/gtk2_ardour/vst_pluginui.cc index 7adf702f4d..5e65475c46 100644 --- a/gtk2_ardour/vst_pluginui.cc +++ b/gtk2_ardour/vst_pluginui.cc @@ -31,17 +31,17 @@ using namespace Gtk; using namespace ARDOUR; using namespace PBD; -VSTPluginUI::VSTPluginUI (PluginInsert& pi, VSTPlugin& vp) +VSTPluginUI::VSTPluginUI (boost::shared_ptr<PluginInsert> pi, boost::shared_ptr<VSTPlugin> vp) : PlugUIBase (pi), vst (vp) { - fst_run_editor (vst.fst()); + fst_run_editor (vst->fst()); preset_box.pack_end (bypass_button, false, false, 10); preset_box.pack_end (save_button, false, false); preset_box.pack_end (combo, false, false); - bypass_button.set_active (!insert.active()); + bypass_button.set_active (!insert->active()); pack_start (preset_box, false, false); pack_start (socket, true, true); @@ -55,7 +55,7 @@ VSTPluginUI::~VSTPluginUI () int VSTPluginUI::get_preferred_height () { - return vst.fst()->height; + return vst->fst()->height; } int @@ -69,7 +69,7 @@ VSTPluginUI::package (Gtk::Window& win) this assumes that the window's owner understands the XEmbed protocol. */ - socket.add_id (fst_get_XID (vst.fst())); + socket.add_id (fst_get_XID (vst->fst())); return 0; } |