remove StateManager code entirely and more debugging output cruft

git-svn-id: svn://localhost/ardour2/trunk@1008 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis
2006-10-26 00:47:22 +00:00
parent bcd511aa3f
commit 5695b1790e
36 changed files with 6 additions and 858 deletions

View File

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

View File

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

View File

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

View File

@@ -30,10 +30,6 @@ class AudioRegionGainLine : public AutomationLine
private:
ARDOUR::Session& session;
AudioRegionView& rv;
#ifdef STATE_MANAGER
UndoAction get_memento();
#endif
};

View File

@@ -91,7 +91,6 @@ sndfile_helpers.cc
sndfilesource.cc
source.cc
source_factory.cc
state_manager.cc
tempo.cc
utils.cc
version.cc

View File

@@ -66,8 +66,6 @@ class AUPlugin : public ARDOUR::Plugin
int connect_and_run (vector<Sample*>& bufs, uint32_t maxbuf, int32_t& in, int32_t& out, nframes_t nframes, nframes_t offset);
std::set<uint32_t> 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;

View File

@@ -33,7 +33,6 @@
#include <pbd/statefuldestructible.h>
#include <ardour/ardour.h>
#include <ardour/state_manager.h>
namespace ARDOUR {
@@ -153,10 +152,6 @@ class AutomationList : public PBD::StatefulDestructible
sigc::signal<void,Change> 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);
};

View File

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

View File

@@ -28,7 +28,6 @@
#include <sigc++/signal.h>
#include <ardour/ardour.h>
#include <ardour/redirect.h>
#include <ardour/plugin_state.h>
#include <ardour/types.h>
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<Sample *>& 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);

View File

@@ -36,7 +36,6 @@
#include <ardour/ardour.h>
#include <ardour/utils.h>
#include <ardour/state_manager.h>
#include <ardour/curve.h>
#include <ardour/types.h>
#include <ardour/data_type.h>
@@ -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<int> 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;

View File

@@ -33,7 +33,6 @@
#include <jack/types.h>
#include <ardour/ladspa.h>
#include <ardour/plugin_state.h>
#include <ardour/plugin.h>
#include <ardour/ladspa_plugin.h>
@@ -84,8 +83,6 @@ class LadspaPlugin : public ARDOUR::Plugin
void set_block_size (nframes_t nframes) {}
int connect_and_run (vector<Sample*>& 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;

View File

@@ -36,7 +36,6 @@
#include <pbd/statefuldestructible.h>
#include <ardour/ardour.h>
#include <ardour/state_manager.h>
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

View File

@@ -29,7 +29,6 @@
#include <jack/types.h>
#include <ardour/types.h>
#include <ardour/plugin_state.h>
#include <ardour/cycles.h>
#include <vector>
@@ -120,8 +119,6 @@ class Plugin : public PBD::StatefulDestructible
virtual int connect_and_run (vector<Sample*>& bufs, uint32_t maxbuf, int32_t& in, int32_t& out, nframes_t nframes, nframes_t offset) = 0;
virtual std::set<uint32_t> 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;

View File

@@ -1,14 +0,0 @@
#ifndef __ardour_plugin_state_h__
#define __ardour_plugin_state_h__
#include <map>
namespace ARDOUR {
struct PluginState {
std::map<uint32_t,float> parameters;
};
}
#endif /* __ardour_plugin_state_h__ */

View File

@@ -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<uint32_t> can_automate_list;
void store_state (RedirectState&) const;
virtual void automation_list_creation_callback (uint32_t, AutomationList&) {}
private:

View File

@@ -205,11 +205,6 @@ class Route : public IO
sigc::signal<void,void*> SelectedChanged;
/* undo */
UndoAction get_memento() const;
void set_state (state_id_t);
int set_control_outs (const vector<std::string>& 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;

View File

@@ -162,7 +162,6 @@ class Session : public PBD::StatefulDestructible
void* ptr;
bool yes_or_no;
SlaveSource slave;
Route* route;
};
boost::shared_ptr<Region> region;

View File

@@ -1,56 +0,0 @@
#ifndef __ardour_state_manager_h__
#define __ardour_state_manager_h__
#include <list>
#include <string>
#include <set>
#include <sigc++/signal.h>
#include <ardour/ardour.h>
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<State*> 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<void,Change> 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<void,const char*> 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__ */

View File

@@ -34,7 +34,6 @@
#include <sigc++/signal.h>
#include <ardour/ardour.h>
#include <ardour/state_manager.h>
class XMLNode;
@@ -162,18 +161,6 @@ class TempoSection : public MetricSection, public Tempo {
typedef list<MetricSection*> 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 */

View File

@@ -74,8 +74,6 @@ class VSTPlugin : public ARDOUR::Plugin
void deactivate ();
void set_block_size (nframes_t nframes);
int connect_and_run (vector<Sample*>& 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;

View File

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

View File

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

View File

@@ -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<ControlEvent*> all_events;
AutomationList::State* asp;
for (StateMap::iterator i = states.begin(); i != states.end(); ++i) {
if ((asp = dynamic_cast<AutomationList::State*> (*i)) != 0) {
for (AutomationEventList::iterator x = asp->events.begin(); x != asp->events.end(); ++x) {
all_events.insert (*x);
}
}
}
for (std::set<ControlEvent*>::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*> (&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<AutomationList*> (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 ();
}

View File

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

View File

@@ -81,10 +81,6 @@ PluginInsert::PluginInsert (Session& s, boost::shared_ptr<Plugin> 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<PluginInsertState*> (&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

View File

@@ -2313,27 +2313,6 @@ IO::setup_peak_meters ()
}
}
#ifdef STATE_MANAGER
UndoAction
IO::get_memento() const
{
return sigc::bind (mem_fun (*(const_cast<IO *>(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.
*/

View File

@@ -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<uint32_t,float> datum;
datum.first = i;
datum.second = shadow_data[i];
state.parameters.insert (datum);
}
}
}
void
LadspaPlugin::restore_state (PluginState& state)
{
for (map<uint32_t,float>::iterator i = state.parameters.begin(); i != state.parameters.end(); ++i) {
set_parameter (i->first, i->second);
}
}
float
LadspaPlugin::default_value (uint32_t port)
{

View File

@@ -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<Location*> all_locations;
for (StateMap::iterator siter = states.begin(); siter != states.end(); ++siter) {
State* lstate = dynamic_cast<State*> (*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*> (&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<Locations*> (this)), &StateManager::use_state), _current_state_id);
}
#endif
uint32_t
Locations::num_range_markers () const
{

View File

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

View File

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

View File

@@ -144,12 +144,6 @@ Redirect::load_automation (string path)
tosave.insert (port);
}
#ifdef STATE_MANAGER
for (set<uint32_t>::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<RedirectState*> (&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 ();
}

View File

@@ -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<Route *>(this)), pmf), _current_state_id);
}
void
Route::set_state (state_id_t id)
{
return;
}
void
Route::input_change_handler (IOChange change, void *ignored)
{

View File

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

View File

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

View File

@@ -1,91 +0,0 @@
#include <pbd/error.h>
#include <ardour/state_manager.h>
#include "i18n.h"
using namespace ARDOUR;
using namespace std;
using namespace PBD;
bool StateManager::_allow_save = true;
sigc::signal<void,const char*> 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);
}

View File

@@ -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<TempoMap *> (this)), &StateManager::use_state), _current_state_id);
}
Change
TempoMap::restore_state (StateManager::State& state)
{
Glib::RWLock::ReaderLock lm (lock);
TempoMapState* tmstate = dynamic_cast<TempoMapState*> (&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<TempoSection*>(*i)) != 0) {
metrics->push_back (new TempoSection (*ts));
} else if ((ms = dynamic_cast<MeterSection*>(*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<TempoSection*>(*i)) != 0) {
state->metrics->push_back (new TempoSection (*ts));
} else if ((ms = dynamic_cast<MeterSection*>(*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