From 5695b1790e3fdee4f15a45ed507e41ac866917cd Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 26 Oct 2006 00:47:22 +0000 Subject: remove StateManager code entirely and more debugging output cruft git-svn-id: svn://localhost/ardour2/trunk@1008 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/automation_line.cc | 10 --- gtk2_ardour/automation_line.h | 4 -- gtk2_ardour/region_gain_line.cc | 8 --- gtk2_ardour/region_gain_line.h | 4 -- libs/ardour/SConscript | 1 - libs/ardour/ardour/audio_unit.h | 2 - libs/ardour/ardour/automation_event.h | 17 ----- libs/ardour/ardour/curve.h | 4 -- libs/ardour/ardour/insert.h | 16 ----- libs/ardour/ardour/io.h | 17 ----- libs/ardour/ardour/ladspa_plugin.h | 3 - libs/ardour/ardour/location.h | 17 ----- libs/ardour/ardour/plugin.h | 3 - libs/ardour/ardour/plugin_state.h | 14 ---- libs/ardour/ardour/redirect.h | 13 ---- libs/ardour/ardour/route.h | 6 -- libs/ardour/ardour/session.h | 1 - libs/ardour/ardour/state_manager.h | 56 ---------------- libs/ardour/ardour/tempo.h | 28 -------- libs/ardour/ardour/vst_plugin.h | 2 - libs/ardour/audio_track.cc | 3 +- libs/ardour/audio_unit.cc | 12 ---- libs/ardour/automation_event.cc | 121 ---------------------------------- libs/ardour/curve.cc | 9 --- libs/ardour/insert.cc | 48 -------------- libs/ardour/io.cc | 31 --------- libs/ardour/ladspa_plugin.cc | 27 -------- libs/ardour/location.cc | 91 +------------------------ libs/ardour/panner.cc | 10 --- libs/ardour/playlist.cc | 5 -- libs/ardour/redirect.cc | 33 ---------- libs/ardour/route.cc | 13 ---- libs/ardour/send.cc | 14 +--- libs/ardour/session_state.cc | 10 --- libs/ardour/state_manager.cc | 91 ------------------------- libs/ardour/tempo.cc | 120 --------------------------------- 36 files changed, 6 insertions(+), 858 deletions(-) delete mode 100644 libs/ardour/ardour/plugin_state.h delete mode 100644 libs/ardour/ardour/state_manager.h delete mode 100644 libs/ardour/state_manager.cc diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index 371552fbfc..339af96d76 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -1168,16 +1168,6 @@ AutomationLine::hide_selection () // show_selection (); } - -#ifdef STATE_MANAGER -// This is copied into AudioRegionGainLine -UndoAction -AutomationLine::get_memento () -{ - return alist.get_memento(); -} -#endif - void AutomationLine::list_changed (Change ignored) { diff --git a/gtk2_ardour/automation_line.h b/gtk2_ardour/automation_line.h index 0e44c95a33..0567ffaa56 100644 --- a/gtk2_ardour/automation_line.h +++ b/gtk2_ardour/automation_line.h @@ -206,10 +206,6 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoin void reset_callback (const ARDOUR::AutomationList&); void list_changed (ARDOUR::Change); -#ifdef STATE_MANAGER - UndoAction get_memento(); -#endif - virtual bool event_handler (GdkEvent*); private: diff --git a/gtk2_ardour/region_gain_line.cc b/gtk2_ardour/region_gain_line.cc index 58a8a9acad..a961af5256 100644 --- a/gtk2_ardour/region_gain_line.cc +++ b/gtk2_ardour/region_gain_line.cc @@ -89,11 +89,3 @@ AudioRegionGainLine::end_drag (ControlPoint* cp) } -#ifdef STATE_MANAGER -// This is a copy from AutomationList -UndoAction -AudioRegionGainLine::get_memento () -{ - return alist.get_memento(); -} -#endif diff --git a/gtk2_ardour/region_gain_line.h b/gtk2_ardour/region_gain_line.h index 916bf78a78..ffd64a6491 100644 --- a/gtk2_ardour/region_gain_line.h +++ b/gtk2_ardour/region_gain_line.h @@ -30,10 +30,6 @@ class AudioRegionGainLine : public AutomationLine private: ARDOUR::Session& session; AudioRegionView& rv; - -#ifdef STATE_MANAGER - UndoAction get_memento(); -#endif }; diff --git a/libs/ardour/SConscript b/libs/ardour/SConscript index 054b251ae7..827f2b06e1 100644 --- a/libs/ardour/SConscript +++ b/libs/ardour/SConscript @@ -91,7 +91,6 @@ sndfile_helpers.cc sndfilesource.cc source.cc source_factory.cc -state_manager.cc tempo.cc utils.cc version.cc diff --git a/libs/ardour/ardour/audio_unit.h b/libs/ardour/ardour/audio_unit.h index aa7c34a2d2..d82425765d 100644 --- a/libs/ardour/ardour/audio_unit.h +++ b/libs/ardour/ardour/audio_unit.h @@ -66,8 +66,6 @@ class AUPlugin : public ARDOUR::Plugin int connect_and_run (vector& bufs, uint32_t maxbuf, int32_t& in, int32_t& out, nframes_t nframes, nframes_t offset); std::set automatable() const; - void store_state (ARDOUR::PluginState&); - void restore_state (ARDOUR::PluginState&); string describe_parameter (uint32_t); string state_node_name () const { return "audiounit"; } void print_parameter (uint32_t, char*, uint32_t len) const; diff --git a/libs/ardour/ardour/automation_event.h b/libs/ardour/ardour/automation_event.h index e2940bc2e1..89823bc738 100644 --- a/libs/ardour/ardour/automation_event.h +++ b/libs/ardour/ardour/automation_event.h @@ -33,7 +33,6 @@ #include #include -#include namespace ARDOUR { @@ -153,10 +152,6 @@ class AutomationList : public PBD::StatefulDestructible sigc::signal StateChanged; -#ifdef STATE_MANAGER - UndoAction get_memento () const; -#endif - virtual void store_state (XMLNode& node) const; virtual void load_state (const XMLNode&); @@ -192,12 +187,6 @@ class AutomationList : public PBD::StatefulDestructible protected: - struct State : public ARDOUR::StateManager::State { - AutomationEventList events; - - State (std::string why) : ARDOUR::StateManager::State (why) {} - }; - AutomationEventList events; mutable Glib::Mutex lock; bool _frozen; @@ -246,15 +235,9 @@ class AutomationList : public PBD::StatefulDestructible virtual double unlocked_eval (double where); -#ifdef STATE_MANAGER - Change restore_state (StateManager::State&); - StateManager::State* state_factory (std::string why) const; -#endif - virtual ControlEvent* point_factory (double,double) const; virtual ControlEvent* point_factory (const ControlEvent&) const; - AutomationList* cut_copy_clear (double, double, int op); }; diff --git a/libs/ardour/ardour/curve.h b/libs/ardour/ardour/curve.h index 9de7d0ef48..97601e29ee 100644 --- a/libs/ardour/ardour/curve.h +++ b/libs/ardour/ardour/curve.h @@ -66,10 +66,6 @@ class Curve : public AutomationList ControlEvent* point_factory (double,double) const; ControlEvent* point_factory (const ControlEvent&) const; -#ifdef STATE_MANAGER - Change restore_state (StateManager::State&); -#endif - private: AutomationList::iterator last_bound; diff --git a/libs/ardour/ardour/insert.h b/libs/ardour/ardour/insert.h index 30378139ab..885cab4457 100644 --- a/libs/ardour/ardour/insert.h +++ b/libs/ardour/ardour/insert.h @@ -28,7 +28,6 @@ #include #include #include -#include #include class XMLNode; @@ -87,15 +86,6 @@ class PortInsert : public Insert int32_t compute_output_streams (int32_t cnt) const; }; -struct PluginInsertState : public RedirectState -{ - PluginInsertState (std::string why) - : RedirectState (why) {} - ~PluginInsertState() {} - - PluginState plugin_state; -}; - class PluginInsert : public Insert { public: @@ -110,9 +100,6 @@ class PluginInsert : public Insert XMLNode& get_state(void); int set_state(const XMLNode&); - StateManager::State* state_factory (std::string why) const; - Change restore_state (StateManager::State&); - void run (vector& bufs, uint32_t nbufs, nframes_t nframes, nframes_t offset); void silence (nframes_t nframes, nframes_t offset); void activate (); @@ -158,9 +145,6 @@ class PluginInsert : public Insert void transport_stopped (nframes_t now); - protected: - void store_state (PluginInsertState&) const; - private: void parameter_changed (uint32_t, float); diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h index cbac629593..e1ed7aef95 100644 --- a/libs/ardour/ardour/io.h +++ b/libs/ardour/ardour/io.h @@ -36,7 +36,6 @@ #include #include -#include #include #include #include @@ -167,20 +166,11 @@ virtual ~IO(); XMLNode& get_state (void); int set_state (const XMLNode&); -#ifdef STATE_MANAGER - virtual UndoAction get_memento() const; -#endif - static int disable_connecting (void); - static int enable_connecting (void); - static int disable_ports (void); - static int enable_ports (void); - static int disable_panners (void); - static int reset_panners (void); static sigc::signal PortsLegal; @@ -299,13 +289,6 @@ public: GainControllable _gain_control; - /* state management */ - -#ifdef STATE_MANAGER - Change restore_state (State&); - StateManager::State* state_factory (std::string why) const; -#endif - AutoState _gain_automation_state; AutoStyle _gain_automation_style; diff --git a/libs/ardour/ardour/ladspa_plugin.h b/libs/ardour/ardour/ladspa_plugin.h index 291ff41dc8..aeac7f05c6 100644 --- a/libs/ardour/ardour/ladspa_plugin.h +++ b/libs/ardour/ardour/ladspa_plugin.h @@ -33,7 +33,6 @@ #include #include -#include #include #include @@ -84,8 +83,6 @@ class LadspaPlugin : public ARDOUR::Plugin void set_block_size (nframes_t nframes) {} int connect_and_run (vector& bufs, uint32_t maxbuf, int32_t& in, int32_t& out, nframes_t nframes, nframes_t offset); - void store_state (ARDOUR::PluginState&); - void restore_state (ARDOUR::PluginState&); string describe_parameter (uint32_t); string state_node_name() const { return "ladspa"; } void print_parameter (uint32_t, char*, uint32_t len) const; diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h index e618f46dfe..94f70bb4e8 100644 --- a/libs/ardour/ardour/location.h +++ b/libs/ardour/ardour/location.h @@ -36,7 +36,6 @@ #include #include -#include using std::string; @@ -181,30 +180,14 @@ class Locations : public PBD::StatefulDestructible (obj.*method)(locations, arg); } -#ifdef STATE_MANAGER - UndoAction get_memento () const; -#endif - private: -#ifdef STATE_MANAGER - struct State : public ARDOUR::StateManager::State { - LocationList locations; - LocationList states; - - State (std::string why) : ARDOUR::StateManager::State (why) {} - }; -#endif LocationList locations; Location *current_location; mutable Glib::Mutex lock; int set_current_unlocked (Location *); void location_changed (Location*); -#ifdef STATE_MANAGER - Change restore_state (StateManager::State&); - StateManager::State* state_factory (std::string why) const; -#endif }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h index e0b2dfc12b..1521dd929d 100644 --- a/libs/ardour/ardour/plugin.h +++ b/libs/ardour/ardour/plugin.h @@ -29,7 +29,6 @@ #include #include -#include #include #include @@ -120,8 +119,6 @@ class Plugin : public PBD::StatefulDestructible virtual int connect_and_run (vector& bufs, uint32_t maxbuf, int32_t& in, int32_t& out, nframes_t nframes, nframes_t offset) = 0; virtual std::set automatable() const = 0; - virtual void store_state (ARDOUR::PluginState&) = 0; - virtual void restore_state (ARDOUR::PluginState&) = 0; virtual string describe_parameter (uint32_t) = 0; virtual string state_node_name() const = 0; virtual void print_parameter (uint32_t, char*, uint32_t len) const = 0; diff --git a/libs/ardour/ardour/plugin_state.h b/libs/ardour/ardour/plugin_state.h deleted file mode 100644 index bd499e2b90..0000000000 --- a/libs/ardour/ardour/plugin_state.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __ardour_plugin_state_h__ -#define __ardour_plugin_state_h__ - -#include - -namespace ARDOUR { - -struct PluginState { - std::map parameters; -}; - -} - -#endif /* __ardour_plugin_state_h__ */ diff --git a/libs/ardour/ardour/redirect.h b/libs/ardour/ardour/redirect.h index 691e690b47..e60438f3ba 100644 --- a/libs/ardour/ardour/redirect.h +++ b/libs/ardour/ardour/redirect.h @@ -47,14 +47,6 @@ namespace ARDOUR { class Session; -struct RedirectState : public StateManager::State { - RedirectState (string why) - : StateManager::State (why) {} - ~RedirectState () {} - - bool active; -}; - class Redirect : public IO { public: @@ -99,9 +91,6 @@ class Redirect : public IO XMLNode& get_state (void); int set_state (const XMLNode&); - StateManager::State* state_factory (string why) const; - Change restore_state (StateManager::State&); - void *get_gui () const { return _gui; } void set_gui (void *p) { _gui = p; } @@ -137,8 +126,6 @@ class Redirect : public IO void can_automate (uint32_t); set can_automate_list; - void store_state (RedirectState&) const; - virtual void automation_list_creation_callback (uint32_t, AutomationList&) {} private: diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index af104bb6ea..c8b135fb6b 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -205,11 +205,6 @@ class Route : public IO sigc::signal SelectedChanged; - /* undo */ - - UndoAction get_memento() const; - void set_state (state_id_t); - int set_control_outs (const vector& ports); IO* control_outs() { return _control_outs; } @@ -314,7 +309,6 @@ class Route : public IO void silence (nframes_t nframes, nframes_t offset); sigc::connection input_signal_connection; - state_id_t _current_state_id; uint32_t redirect_max_outs; uint32_t _remote_control_id; diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index da5a098aa0..cdc79164e6 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -162,7 +162,6 @@ class Session : public PBD::StatefulDestructible void* ptr; bool yes_or_no; SlaveSource slave; - Route* route; }; boost::shared_ptr region; diff --git a/libs/ardour/ardour/state_manager.h b/libs/ardour/ardour/state_manager.h deleted file mode 100644 index e123b2cb37..0000000000 --- a/libs/ardour/ardour/state_manager.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef __ardour_state_manager_h__ -#define __ardour_state_manager_h__ - -#include -#include -#include - -#include - -#include - -namespace ARDOUR { - -typedef uint32_t state_id_t; - -class StateManager : public virtual sigc::trackable -{ - public: - struct State { - std::string operation; - State (std::string why) : operation (why) {} - virtual ~State() {} - }; - - typedef std::list StateMap; - - StateManager (); - virtual ~StateManager (); - - virtual void drop_all_states (); - virtual void use_state (state_id_t); - virtual void save_state (std::string why); - - sigc::signal StateChanged; - - state_id_t _current_state_id; - - virtual bool should_save_state () const { return true; } - - static void prohibit_save (); - static void allow_save (const char* why, bool dosave); - - protected: - static bool _allow_save; - static sigc::signal SaveAllowed; - - StateMap states; - - virtual Change restore_state (State&) = 0; - virtual State* state_factory (std::string why) const = 0; - virtual void send_state_changed (Change); -}; - -} // namespace ARDOUR - -#endif /* __ardour_state_manager_h__ */ diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index eaadcb1c99..f8751b5d2b 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -34,7 +34,6 @@ #include #include -#include class XMLNode; @@ -162,18 +161,6 @@ class TempoSection : public MetricSection, public Tempo { typedef list Metrics; -#ifdef STATE_MANAGER -class TempoMapState : public StateManager::State { - public: - TempoMapState (std::string why) - : StateManager::State (why) { - metrics = new Metrics; - } - - Metrics *metrics; -}; -#endif - class TempoMap : public PBD::StatefulDestructible { public: @@ -248,10 +235,6 @@ class TempoMap : public PBD::StatefulDestructible void dump (std::ostream&) const; void clear (); -#ifdef STATE_MANAGER - UndoAction get_memento() const; -#endif - /* this is a helper class that we use to be able to keep track of which meter *AND* tempo are in effect at a given point in time. @@ -315,17 +298,6 @@ class TempoMap : public PBD::StatefulDestructible int move_metric_section (MetricSection&, const BBT_Time& to); void do_insert (MetricSection* section); - -#ifdef STATE_MANAGER - Change restore_state (StateManager::State&); - StateManager::State* state_factory (std::string why) const; - - bool in_set_state; - - /* override state_manager::save_state so we can check in_set_state */ - - void save_state (std::string why); -#endif }; }; /* namespace ARDOUR */ diff --git a/libs/ardour/ardour/vst_plugin.h b/libs/ardour/ardour/vst_plugin.h index 7b8246868c..e7f09a8986 100644 --- a/libs/ardour/ardour/vst_plugin.h +++ b/libs/ardour/ardour/vst_plugin.h @@ -74,8 +74,6 @@ class VSTPlugin : public ARDOUR::Plugin void deactivate (); void set_block_size (nframes_t nframes); int connect_and_run (vector& bufs, uint32_t maxbuf, int32_t& in, int32_t& out, nframes_t nframes, nframes_t offset); - void store_state (ARDOUR::PluginState&); - void restore_state (ARDOUR::PluginState&); string describe_parameter (uint32_t); string state_node_name() const { return "vst"; } void print_parameter (uint32_t, char*, uint32_t len) const; diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc index d61ec7b003..69e183b669 100644 --- a/libs/ardour/audio_track.cc +++ b/libs/ardour/audio_track.cc @@ -794,7 +794,8 @@ AudioTrack::freeze (InterThreadInfo& itt) FreezeRecordInsertInfo* frii = new FreezeRecordInsertInfo ((*r)->get_state(), insert); frii->id = insert->id(); -#ifdef STATE_MANAGER + +#ifdef FIX_ME_TO_WORK_WITHOUT_STATE_MANAGER frii->memento = (*r)->get_memento(); #endif _freeze_record.insert_info.push_back (frii); diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc index ac240828b5..6879123ff1 100644 --- a/libs/ardour/audio_unit.cc +++ b/libs/ardour/audio_unit.cc @@ -190,18 +190,6 @@ AUPlugin::automatable() const return automates; } -void -AUPlugin::store_state (ARDOUR::PluginState&) -{ - -} - -void -AUPlugin::restore_state (ARDOUR::PluginState&) -{ - -} - string AUPlugin::describe_parameter (uint32_t) { diff --git a/libs/ardour/automation_event.cc b/libs/ardour/automation_event.cc index 6b7f0ff016..00a6e638a7 100644 --- a/libs/ardour/automation_event.cc +++ b/libs/ardour/automation_event.cc @@ -63,12 +63,6 @@ AutomationList::AutomationList (double defval, bool with_state) lookup_cache.left = -1; lookup_cache.range.first = events.end(); - if (!no_state) { -#ifdef STATE_MANAGER - save_state (_("initial")); -#endif - } - AutomationListCreated(this); } @@ -140,25 +134,6 @@ AutomationList::~AutomationList() for (AutomationEventList::iterator x = events.begin(); x != events.end(); ++x) { delete (*x); } - -#ifdef STATE_MANAGER - std::set all_events; - AutomationList::State* asp; - - for (StateMap::iterator i = states.begin(); i != states.end(); ++i) { - - if ((asp = dynamic_cast (*i)) != 0) { - - for (AutomationEventList::iterator x = asp->events.begin(); x != asp->events.end(); ++x) { - all_events.insert (*x); - } - } - } - - for (std::set::iterator i = all_events.begin(); i != all_events.end(); ++i) { - delete (*i); - } -#endif } bool @@ -240,11 +215,6 @@ AutomationList::clear () { Glib::Mutex::Lock lm (lock); events.clear (); - if (!no_state) { -#ifdef STATE_MANAGER - save_state (_("cleared")); -#endif - } mark_dirty (); } @@ -276,9 +246,6 @@ void AutomationList::_x_scale (double factor) (*i)->when = floor ((*i)->when * factor); } -#ifdef STATE_MANAGER - save_state ("x-scaled"); -#endif mark_dirty (); } @@ -415,12 +382,6 @@ AutomationList::add (double when, double value, bool for_loading) } mark_dirty (); - - if (!no_state && !for_loading) { -#ifdef STATE_MANAGER - save_state (_("added event")); -#endif - } } if (!for_loading) { @@ -452,11 +413,6 @@ AutomationList::erase (AutomationList::iterator start, AutomationList::iterator Glib::Mutex::Lock lm (lock); events.erase (start, end); reposition_for_rt_add (0); - if (!no_state) { -#ifdef STATE_MANAGER - save_state (_("removed multiple events")); -#endif - } mark_dirty (); } maybe_signal_changed (); @@ -485,12 +441,6 @@ AutomationList::reset_range (double start, double endt) reset = true; - if (!no_state) { -#ifdef STATE_MANAGER - save_state (_("removed range")); -#endif - } - mark_dirty (); } } @@ -518,11 +468,6 @@ AutomationList::erase_range (double start, double endt) events.erase (s, e); reposition_for_rt_add (0); erased = true; - if (!no_state) { -#ifdef STATE_MANAGER - save_state (_("removed range")); -#endif - } mark_dirty (); } @@ -550,12 +495,6 @@ AutomationList::move_range (iterator start, iterator end, double xdelta, double ++start; } - if (!no_state) { -#ifdef STATE_MANAGER - save_state (_("event range adjusted")); -#endif - } - mark_dirty (); } @@ -574,12 +513,6 @@ AutomationList::modify (iterator iter, double when, double val) Glib::Mutex::Lock lm (lock); (*iter)->when = when; (*iter)->value = val; - if (!no_state) { -#ifdef STATE_MANAGER - save_state (_("event adjusted")); -#endif - } - mark_dirty (); } @@ -635,42 +568,6 @@ AutomationList::thaw () } } -#ifdef STATE_MANAGER -StateManager::State* -AutomationList::state_factory (std::string why) const -{ - State* state = new State (why); - - for (AutomationEventList::const_iterator x = events.begin(); x != events.end(); ++x) { - state->events.push_back (point_factory (**x)); - } - - return state; -} - -Change -AutomationList::restore_state (StateManager::State& state) -{ - { - Glib::Mutex::Lock lm (lock); - State* lstate = dynamic_cast (&state); - - events.clear (); - for (AutomationEventList::const_iterator x = lstate->events.begin(); x != lstate->events.end(); ++x) { - events.push_back (point_factory (**x)); - } - } - - return Change (0); -} - -UndoAction -AutomationList::get_memento () const -{ - return sigc::bind (mem_fun (*(const_cast (this)), &StateManager::use_state), _current_state_id); -} -#endif - void AutomationList::set_max_xval (double x) { @@ -1107,11 +1004,6 @@ AutomationList::cut_copy_clear (double start, double end, int op) if (changed) { reposition_for_rt_add (0); - if (!no_state) { -#ifdef STATE_MANAGER - save_state (_("cut/copy/clear")); -#endif - } } mark_dirty (); @@ -1141,12 +1033,6 @@ AutomationList::copy (iterator start, iterator end) x = tmp; } - - if (!no_state) { -#ifdef STATE_MANAGER - save_state (_("copy")); -#endif - } } return nal; @@ -1211,13 +1097,6 @@ AutomationList::paste (AutomationList& alist, double pos, float times) } reposition_for_rt_add (0); - - if (!no_state) { -#ifdef STATE_MANAGER - save_state (_("paste")); -#endif - } - mark_dirty (); } diff --git a/libs/ardour/curve.cc b/libs/ardour/curve.cc index 5f7d692471..c9c6db7baf 100644 --- a/libs/ardour/curve.cc +++ b/libs/ardour/curve.cc @@ -435,15 +435,6 @@ Curve::point_factory (const ControlEvent& other) const return new CurvePoint (other.when, other.value); } -#ifdef STATE_MANAGER -Change -Curve::restore_state (StateManager::State& state) -{ - mark_dirty (); - return AutomationList::restore_state (state); -} -#endif - extern "C" { void diff --git a/libs/ardour/insert.cc b/libs/ardour/insert.cc index 5531e4136b..ee8fdbcec0 100644 --- a/libs/ardour/insert.cc +++ b/libs/ardour/insert.cc @@ -81,10 +81,6 @@ PluginInsert::PluginInsert (Session& s, boost::shared_ptr plug, Placemen init (); -#ifdef STATE_MANAGER - save_state (_("initial state")); -#endif - { Glib::Mutex::Lock em (_session.engine().process_lock()); IO::MoreOutputs (output_streams ()); @@ -102,10 +98,6 @@ PluginInsert::PluginInsert (Session& s, const XMLNode& node) set_automatable (); -#ifdef STATE_MANAGER - save_state (_("initial state")); -#endif - _plugins[0]->ParameterChanged.connect (mem_fun (*this, &PluginInsert::parameter_changed)); { @@ -129,10 +121,6 @@ PluginInsert::PluginInsert (const PluginInsert& other) init (); -#ifdef STATE_MANAGER - save_state (_("initial state")); -#endif - RedirectCreated (this); /* EMIT SIGNAL */ } @@ -781,35 +769,6 @@ PluginInsert::latency() return _plugins[0]->latency (); } -void -PluginInsert::store_state (PluginInsertState& state) const -{ - Redirect::store_state (state); - _plugins[0]->store_state (state.plugin_state); -} - -Change -PluginInsert::restore_state (StateManager::State& state) -{ - PluginInsertState* pistate = dynamic_cast (&state); - - Redirect::restore_state (state); - - _plugins[0]->restore_state (pistate->plugin_state); - - return Change (0); -} - -StateManager::State* -PluginInsert::state_factory (std::string why) const -{ - PluginInsertState* state = new PluginInsertState (why); - - store_state (*state); - - return state; -} - ARDOUR::PluginType PluginInsert::type () { @@ -847,10 +806,7 @@ PortInsert::PortInsert (Session& s, Placement p) : Insert (s, p, 1, -1, 1, -1) { init (); -#ifdef STATE_MANAGER - save_state (_("initial state")); RedirectCreated (this); /* EMIT SIGNAL */ -#endif } @@ -858,11 +814,7 @@ PortInsert::PortInsert (const PortInsert& other) : Insert (other._session, other.placement(), 1, -1, 1, -1) { init (); -#ifdef STATE_MANAGER - save_state (_("initial state")); RedirectCreated (this); /* EMIT SIGNAL */ -#endif - } void diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index a9751268ff..323c58b65e 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -2313,27 +2313,6 @@ IO::setup_peak_meters () } } -#ifdef STATE_MANAGER -UndoAction -IO::get_memento() const -{ - return sigc::bind (mem_fun (*(const_cast(this)), &StateManager::use_state), _current_state_id); -} - -Change -IO::restore_state (StateManager::State& state) -{ - return Change (0); -} - -StateManager::State* -IO::state_factory (std::string why) const -{ - StateManager::State* state = new StateManager::State (why); - return state; -} -#endif - /** Update the peak meters. @@ -2490,10 +2469,6 @@ IO::load_automation (const string& path) } } -#ifdef STATE_MANAGER - _gain_automation_curve.save_state (_("loaded from disk")); -#endif - return 0; } @@ -2619,12 +2594,6 @@ IO::transport_stopped (nframes_t frame) if (_gain_automation_curve.automation_state() != Off) { -#ifdef STATE_MANAGER - if (gain_automation_recording()) { - _gain_automation_curve.save_state (_("automation write/touch")); - } -#endif - /* the src=0 condition is a special signal to not propagate automation gain changes into the mix group when locating. */ diff --git a/libs/ardour/ladspa_plugin.cc b/libs/ardour/ladspa_plugin.cc index 0744a62db4..c96e14e30a 100644 --- a/libs/ardour/ladspa_plugin.cc +++ b/libs/ardour/ladspa_plugin.cc @@ -158,33 +158,6 @@ LadspaPlugin::~LadspaPlugin () } } -void -LadspaPlugin::store_state (PluginState& state) -{ - state.parameters.clear (); - - for (uint32_t i = 0; i < parameter_count(); ++i){ - - if (LADSPA_IS_PORT_INPUT(port_descriptor (i)) && - LADSPA_IS_PORT_CONTROL(port_descriptor (i))){ - pair datum; - - datum.first = i; - datum.second = shadow_data[i]; - - state.parameters.insert (datum); - } - } -} - -void -LadspaPlugin::restore_state (PluginState& state) -{ - for (map::iterator i = state.parameters.begin(); i != state.parameters.end(); ++i) { - set_parameter (i->first, i->second); - } -} - float LadspaPlugin::default_value (uint32_t port) { diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc index f9bcd76a0b..579a0e2820 100644 --- a/libs/ardour/location.cc +++ b/libs/ardour/location.cc @@ -372,9 +372,6 @@ Locations::Locations () { current_location = 0; -#ifdef STATE_MANAGER - save_state (_("initial")); -#endif } Locations::~Locations () @@ -385,27 +382,6 @@ Locations::~Locations () delete *i; i = tmp; } - -#ifdef STATE_MANAGER - - std::set all_locations; - - - for (StateMap::iterator siter = states.begin(); siter != states.end(); ++siter) { - - State* lstate = dynamic_cast (*siter); - - for (LocationList::iterator liter = lstate->locations.begin(); liter != lstate->locations.end(); ++liter) { - all_locations.insert (*liter); - } - - for (LocationList::iterator siter = lstate->states.begin(); siter != lstate->states.end(); ++siter) { - all_locations.insert (*siter); - } - } - - set_delete (&all_locations); -#endif } int @@ -458,10 +434,6 @@ Locations::clear () current_location = 0; } -#ifdef STATE_MANAGER - save_state (_("clear")); -#endif - changed (); /* EMIT SIGNAL */ current_changed (0); /* EMIT SIGNAL */ } @@ -485,10 +457,6 @@ Locations::clear_markers () } } -#ifdef STATE_MANAGER - save_state (_("clear markers")); -#endif - changed (); /* EMIT SIGNAL */ } @@ -515,10 +483,6 @@ Locations::clear_ranges () current_location = 0; } -#ifdef STATE_MANAGER - save_state (_("clear ranges")); -#endif - changed (); /* EMIT SIGNAL */ current_changed (0); /* EMIT SIGNAL */ } @@ -535,10 +499,6 @@ Locations::add (Location *loc, bool make_current) } } -#ifdef STATE_MANAGER - save_state (_("add")); -#endif - added (loc); /* EMIT SIGNAL */ if (make_current) { @@ -575,11 +535,8 @@ Locations::remove (Location *loc) } if (was_removed) { -#ifdef STATE_MANAGER - save_state (_("remove")); -#endif - - removed (loc); /* EMIT SIGNAL */ + + removed (loc); /* EMIT SIGNAL */ if (was_current) { current_changed (0); /* EMIT SIGNAL */ @@ -592,9 +549,6 @@ Locations::remove (Location *loc) void Locations::location_changed (Location* loc) { -#ifdef STATE_MANAGER - save_state (X_("location changed")); -#endif changed (); /* EMIT SIGNAL */ } @@ -834,47 +788,6 @@ Locations::auto_punch_location () const return 0; } -#ifdef STATE_MANAGER -StateManager::State* -Locations::state_factory (std::string why) const -{ - State* state = new State (why); - - state->locations = locations; - - for (LocationList::const_iterator i = locations.begin(); i != locations.end(); ++i) { - state->states.push_back (new Location (**i)); - } - - return state; -} - -Change -Locations::restore_state (StateManager::State& state) -{ - { - Glib::Mutex::Lock lm (lock); - State* lstate = dynamic_cast (&state); - - locations = lstate->locations; - LocationList& states = lstate->states; - LocationList::iterator l, s; - - for (l = locations.begin(), s = states.begin(); s != states.end(); ++s, ++l) { - (*l) = (*s); - } - } - - return Change (0); -} - -UndoAction -Locations::get_memento () const -{ - return sigc::bind (mem_fun (*(const_cast (this)), &StateManager::use_state), _current_state_id); -} -#endif - uint32_t Locations::num_range_markers () const { diff --git a/libs/ardour/panner.cc b/libs/ardour/panner.cc index 229c4c5e1c..4b0bd25ba4 100644 --- a/libs/ardour/panner.cc +++ b/libs/ardour/panner.cc @@ -206,13 +206,6 @@ BaseStereoPanner::transport_stopped (nframes_t frame) _automation.reposition_for_rt_add (frame); if (_automation.automation_state() != Off) { - - if (_automation.automation_write()) { -#ifdef STATE_MANAGER - _automation.save_state (_("automation write pass")); -#endif - } - set_position (_automation.eval (frame)); } } @@ -287,9 +280,6 @@ BaseStereoPanner::load (istream& in, string path, uint32_t& linecnt) /* now that we are done loading */ -#ifdef STATE_MANAGER - _automation.save_state (_("loaded from disk")); -#endif _automation.StateChanged (Change (0)); return 0; diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index 87eed692b6..139f62cb91 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -1427,12 +1427,7 @@ Playlist::state (bool full_state) if (full_state) { RegionLock rlock (this, false); - - cerr << _name << " getting region state for " << regions.size() << endl; - for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) { - cerr << "\t" << " now at " << (*i) << endl; - cerr << "\t\t" << (*i)->name() << endl; node->add_child_nocopy ((*i)->get_state()); } } diff --git a/libs/ardour/redirect.cc b/libs/ardour/redirect.cc index 18b16eaa73..e609687662 100644 --- a/libs/ardour/redirect.cc +++ b/libs/ardour/redirect.cc @@ -144,12 +144,6 @@ Redirect::load_automation (string path) tosave.insert (port); } -#ifdef STATE_MANAGER - for (set::iterator i = tosave.begin(); i != tosave.end(); ++i) { - automation_list (*i).save_state (_("loaded from disk")); - } -#endif - return 0; bad: @@ -438,37 +432,10 @@ Redirect::find_next_event (nframes_t now, nframes_t end, ControlEvent& next_even return next_event.when != max_frames; } -void -Redirect::store_state (RedirectState& state) const -{ - state.active = _active; -} - -Change -Redirect::restore_state (StateManager::State& state) -{ - RedirectState* rstate = dynamic_cast (&state); - set_active (rstate->active, this); - return Change (0); -} - -StateManager::State* -Redirect::state_factory (std::string why) const -{ - RedirectState* state = new RedirectState (why); - - store_state (*state); - - return state; -} - void Redirect::set_active (bool yn, void* src) { _active = yn; -#ifdef STATE_MANAGER - save_state (_("active_changed")); -#endif active_changed (this, src); _session.set_dirty (); } diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 782cb1c69e..82f1c4b31c 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -1976,19 +1976,6 @@ Route::handle_transport_stopped (bool abort_ignored, bool did_locate, bool can_f _roll_delay = _initial_delay; } -UndoAction -Route::get_memento() const -{ - void (Route::*pmf)(state_id_t) = &Route::set_state; - return sigc::bind (mem_fun (*(const_cast(this)), pmf), _current_state_id); -} - -void -Route::set_state (state_id_t id) -{ - return; -} - void Route::input_change_handler (IOChange change, void *ignored) { diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc index 1479eab420..51d41a93b1 100644 --- a/libs/ardour/send.cc +++ b/libs/ardour/send.cc @@ -36,10 +36,7 @@ Send::Send (Session& s, Placement p) { _metering = false; expected_inputs = 0; -#ifdef STATE_MANAGER - save_state (_("initial state")); -#endif - RedirectCreated (this); /* EMIT SIGNAL */ + RedirectCreated (this); /* EMIT SIGNAL */ } Send::Send (Session& s, const XMLNode& node) @@ -52,11 +49,7 @@ Send::Send (Session& s, const XMLNode& node) throw failed_constructor(); } -#ifdef STATE_MANAGER - save_state (_("initial state")); -#endif - - RedirectCreated (this); /* EMIT SIGNAL */ + RedirectCreated (this); /* EMIT SIGNAL */ } Send::Send (const Send& other) @@ -64,9 +57,6 @@ Send::Send (const Send& other) { _metering = false; expected_inputs = 0; -#ifdef STATE_MANAGER - save_state (_("initial state")); -#endif RedirectCreated (this); /* EMIT SIGNAL */ } diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index d742186d6b..8a49636941 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -1010,8 +1010,6 @@ Session::set_state (const XMLNode& node) return -1; } - StateManager::prohibit_save (); - if ((prop = node.property ("name")) != 0) { _name = prop->value (); } @@ -1147,10 +1145,6 @@ Session::set_state (const XMLNode& node) start_location = location; } -#ifdef STATE_MANAGER - _locations.save_state (_("initial state")); -#endif - if ((child = find_named_node (node, "EditGroups")) == 0) { error << _("Session: XML state has no edit groups section") << endmsg; goto out; @@ -1195,8 +1189,6 @@ Session::set_state (const XMLNode& node) _state_of_the_state = Clean; - StateManager::allow_save (_("initial state"), true); - if (state_was_pending) { save_state (_current_snapshot_name); remove_pending_capture_state (); @@ -1206,8 +1198,6 @@ Session::set_state (const XMLNode& node) return 0; out: - /* we failed, re-enable state saving but don't actually save internal state */ - StateManager::allow_save (X_("ignored"), false); return ret; } diff --git a/libs/ardour/state_manager.cc b/libs/ardour/state_manager.cc deleted file mode 100644 index 153773ed30..0000000000 --- a/libs/ardour/state_manager.cc +++ /dev/null @@ -1,91 +0,0 @@ -#include -#include - -#include "i18n.h" - -using namespace ARDOUR; -using namespace std; -using namespace PBD; - -bool StateManager::_allow_save = true; -sigc::signal StateManager::SaveAllowed; - -StateManager::StateManager () -{ - _current_state_id = 0; -} - -StateManager::~StateManager() -{ -} - -void -StateManager::prohibit_save () -{ - _allow_save = false; -} - -void -StateManager::allow_save (const char* why, bool do_save) -{ - _allow_save = true; - if (do_save) { - SaveAllowed (why); - SaveAllowed.slots().erase (SaveAllowed.slots().begin(), SaveAllowed.slots().end()); - } -} - -void -StateManager::drop_all_states () -{ - for (StateMap::iterator i = states.begin(); i != states.end(); ++i) { - delete *i; - } - - states.clear (); - - save_state (_("cleared history")); -} - -void -StateManager::use_state (state_id_t id) -{ - Change what_changed; - state_id_t n; - StateMap::iterator i; - - for (n = 0, i = states.begin(); n < id && i != states.end(); ++n, ++i); - - if (n != id || i == states.end()) { - fatal << string_compose (_("programming error: illegal state ID (%1) passed to " - "StateManager::set_state() (range = 0-%2)"), id, states.size()-1) - << endmsg; - /*NOTREACHED*/ - return; - } - - what_changed = restore_state (**i); - _current_state_id = id; - send_state_changed (what_changed); -} - -void -StateManager::save_state (std::string why) -{ - if (!should_save_state()) - return; - - if (!_allow_save) { - SaveAllowed.connect (mem_fun (*this, &StateManager::save_state)); - return; - } - - states.push_back (state_factory (why)); - _current_state_id = states.size() - 1; -} - -void -StateManager::send_state_changed (Change what_changed) -{ - StateChanged (what_changed); -} diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index e9d46f83e3..0ff94324bb 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -206,9 +206,6 @@ TempoMap::TempoMap (nframes_t fr) _frame_rate = fr; last_bbt_valid = false; BBT_Time start; -#ifdef STATE_MANAGER - in_set_state = false; -#endif start.bars = 1; start.beats = 1; @@ -224,10 +221,6 @@ TempoMap::TempoMap (nframes_t fr) metrics->push_back (t); metrics->push_back (m); - -#ifdef STATE_MANAGER - save_state (_("initial")); -#endif } TempoMap::~TempoMap () @@ -260,9 +253,6 @@ TempoMap::move_metric_section (MetricSection& section, const BBT_Time& when) section.set_start (corrected); metrics->sort (cmp); timestamp_metrics (); -#ifdef STATE_MANAGER - save_state (_("move metric")); -#endif return 0; } @@ -331,12 +321,6 @@ TempoMap::remove_meter (const MeterSection& tempo) } } } - - if (removed) { -#ifdef STATE_MANAGER - save_state (_("metric removed")); -#endif - } } if (removed) { @@ -377,10 +361,6 @@ TempoMap::add_tempo (const Tempo& tempo, BBT_Time where) where.ticks = 0; do_insert (new TempoSection (where, tempo.beats_per_minute())); - -#ifdef STATE_MANAGER - save_state (_("add tempo")); -#endif } StateChanged (Change (0)); @@ -407,12 +387,6 @@ TempoMap::replace_tempo (TempoSection& existing, const Tempo& replacement) break; } } - - if (replaced) { -#ifdef STATE_MANAGER - save_state (_("replace tempo")); -#endif - } } if (replaced) { @@ -443,10 +417,6 @@ TempoMap::add_meter (const Meter& meter, BBT_Time where) where.ticks = 0; do_insert (new MeterSection (where, meter.beats_per_bar(), meter.note_divisor())); - -#ifdef STATE_MANAGER - save_state (_("add meter")); -#endif } StateChanged (Change (0)); @@ -472,12 +442,6 @@ TempoMap::replace_meter (MeterSection& existing, const Meter& replacement) break; } } - - if (replaced) { -#ifdef STATE_MANAGER - save_state (_("replaced meter")); -#endif - } } if (replaced) { @@ -1282,10 +1246,6 @@ TempoMap::set_state (const XMLNode& node) XMLNodeConstIterator niter; Metrics old_metrics (*metrics); -#ifdef STATE_MANAGER - in_set_state = true; -#endif - metrics->clear(); nlist = node.children(); @@ -1325,24 +1285,8 @@ TempoMap::set_state (const XMLNode& node) metrics->sort (cmp); timestamp_metrics (); } - -#ifdef STATE_MANAGER - in_set_state = false; -#endif } - /* This state needs to be saved. This string will never be a part of the - object's history though, because the allow_save flag is false during - session load. This state will eventually be tagged "initial state", - by a call to StateManager::allow_save from Session::set_state. - - If this state is not saved, there is no way to reach it through undo actions. - */ - -#ifdef STATE_MANAGER - save_state(_("load XML data")); -#endif - StateChanged (Change (0)); return 0; @@ -1366,67 +1310,3 @@ TempoMap::dump (std::ostream& o) const } } -#ifdef STATE_MANAGER -UndoAction -TempoMap::get_memento () const -{ - return sigc::bind (mem_fun (*(const_cast (this)), &StateManager::use_state), _current_state_id); -} - -Change -TempoMap::restore_state (StateManager::State& state) -{ - Glib::RWLock::ReaderLock lm (lock); - - TempoMapState* tmstate = dynamic_cast (&state); - - /* We can't just set the metrics pointer to the address of the metrics list - stored in the state, cause this would ruin this state for restoring in - the future. If they have the same address, they are the same list. - Thus we need to copy all the elements from the state metrics list to the - current metrics list. - */ - metrics->clear(); - for (Metrics::iterator i = tmstate->metrics->begin(); i != tmstate->metrics->end(); ++i) { - TempoSection *ts; - MeterSection *ms; - - if ((ts = dynamic_cast(*i)) != 0) { - metrics->push_back (new TempoSection (*ts)); - } else if ((ms = dynamic_cast(*i)) != 0) { - metrics->push_back (new MeterSection (*ms)); - } - } - - last_bbt_valid = false; - - return Change (0); -} - -StateManager::State* -TempoMap::state_factory (std::string why) const -{ - TempoMapState* state = new TempoMapState (why); - - for (Metrics::iterator i = metrics->begin(); i != metrics->end(); ++i) { - TempoSection *ts; - MeterSection *ms; - - if ((ts = dynamic_cast(*i)) != 0) { - state->metrics->push_back (new TempoSection (*ts)); - } else if ((ms = dynamic_cast(*i)) != 0) { - state->metrics->push_back (new MeterSection (*ms)); - } - } - - return state; -} - -void -TempoMap::save_state (std::string why) -{ - if (!in_set_state) { - StateManager::save_state (why); - } -} -#endif -- cgit v1.2.3