// 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)
{
void reset_callback (const ARDOUR::AutomationList&);
void list_changed (ARDOUR::Change);
-#ifdef STATE_MANAGER
- UndoAction get_memento();
-#endif
-
virtual bool event_handler (GdkEvent*);
private:
}
-#ifdef STATE_MANAGER
-// This is a copy from AutomationList
-UndoAction
-AudioRegionGainLine::get_memento ()
-{
- return alist.get_memento();
-}
-#endif
private:
ARDOUR::Session& session;
AudioRegionView& rv;
-
-#ifdef STATE_MANAGER
- UndoAction get_memento();
-#endif
};
sndfilesource.cc
source.cc
source_factory.cc
-state_manager.cc
tempo.cc
utils.cc
version.cc
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;
#include <pbd/statefuldestructible.h>
#include <ardour/ardour.h>
-#include <ardour/state_manager.h>
namespace ARDOUR {
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&);
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;
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);
};
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;
#include <sigc++/signal.h>
#include <ardour/ardour.h>
#include <ardour/redirect.h>
-#include <ardour/plugin_state.h>
#include <ardour/types.h>
class XMLNode;
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:
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 ();
void transport_stopped (nframes_t now);
- protected:
- void store_state (PluginInsertState&) const;
-
private:
void parameter_changed (uint32_t, float);
#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>
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;
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;
#include <jack/types.h>
#include <ardour/ladspa.h>
-#include <ardour/plugin_state.h>
#include <ardour/plugin.h>
#include <ardour/ladspa_plugin.h>
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;
#include <pbd/statefuldestructible.h>
#include <ardour/ardour.h>
-#include <ardour/state_manager.h>
using std::string;
(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
#include <jack/types.h>
#include <ardour/types.h>
-#include <ardour/plugin_state.h>
#include <ardour/cycles.h>
#include <vector>
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;
+++ /dev/null
-#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__ */
class Session;
-struct RedirectState : public StateManager::State {
- RedirectState (string why)
- : StateManager::State (why) {}
- ~RedirectState () {}
-
- bool active;
-};
-
class Redirect : public IO
{
public:
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; }
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:
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; }
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;
void* ptr;
bool yes_or_no;
SlaveSource slave;
- Route* route;
};
boost::shared_ptr<Region> region;
+++ /dev/null
-#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__ */
#include <sigc++/signal.h>
#include <ardour/ardour.h>
-#include <ardour/state_manager.h>
class XMLNode;
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:
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.
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 */
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;
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);
return automates;
}
-void
-AUPlugin::store_state (ARDOUR::PluginState&)
-{
-
-}
-
-void
-AUPlugin::restore_state (ARDOUR::PluginState&)
-{
-
-}
-
string
AUPlugin::describe_parameter (uint32_t)
{
lookup_cache.left = -1;
lookup_cache.range.first = events.end();
- if (!no_state) {
-#ifdef STATE_MANAGER
- save_state (_("initial"));
-#endif
- }
-
AutomationListCreated(this);
}
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
{
Glib::Mutex::Lock lm (lock);
events.clear ();
- if (!no_state) {
-#ifdef STATE_MANAGER
- save_state (_("cleared"));
-#endif
- }
mark_dirty ();
}
(*i)->when = floor ((*i)->when * factor);
}
-#ifdef STATE_MANAGER
- save_state ("x-scaled");
-#endif
mark_dirty ();
}
}
mark_dirty ();
-
- if (!no_state && !for_loading) {
-#ifdef STATE_MANAGER
- save_state (_("added event"));
-#endif
- }
}
if (!for_loading) {
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 ();
reset = true;
- if (!no_state) {
-#ifdef STATE_MANAGER
- save_state (_("removed range"));
-#endif
- }
-
mark_dirty ();
}
}
events.erase (s, e);
reposition_for_rt_add (0);
erased = true;
- if (!no_state) {
-#ifdef STATE_MANAGER
- save_state (_("removed range"));
-#endif
- }
mark_dirty ();
}
++start;
}
- if (!no_state) {
-#ifdef STATE_MANAGER
- save_state (_("event range adjusted"));
-#endif
- }
-
mark_dirty ();
}
Glib::Mutex::Lock lm (lock);
(*iter)->when = when;
(*iter)->value = val;
- if (!no_state) {
-#ifdef STATE_MANAGER
- save_state (_("event adjusted"));
-#endif
- }
-
mark_dirty ();
}
}
}
-#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)
{
if (changed) {
reposition_for_rt_add (0);
- if (!no_state) {
-#ifdef STATE_MANAGER
- save_state (_("cut/copy/clear"));
-#endif
- }
}
mark_dirty ();
x = tmp;
}
-
- if (!no_state) {
-#ifdef STATE_MANAGER
- save_state (_("copy"));
-#endif
- }
}
return nal;
}
reposition_for_rt_add (0);
-
- if (!no_state) {
-#ifdef STATE_MANAGER
- save_state (_("paste"));
-#endif
- }
-
mark_dirty ();
}
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
init ();
-#ifdef STATE_MANAGER
- save_state (_("initial state"));
-#endif
-
{
Glib::Mutex::Lock em (_session.engine().process_lock());
IO::MoreOutputs (output_streams ());
set_automatable ();
-#ifdef STATE_MANAGER
- save_state (_("initial state"));
-#endif
-
_plugins[0]->ParameterChanged.connect (mem_fun (*this, &PluginInsert::parameter_changed));
{
init ();
-#ifdef STATE_MANAGER
- save_state (_("initial state"));
-#endif
-
RedirectCreated (this); /* EMIT SIGNAL */
}
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 ()
{
: Insert (s, p, 1, -1, 1, -1)
{
init ();
-#ifdef STATE_MANAGER
- save_state (_("initial state"));
RedirectCreated (this); /* EMIT SIGNAL */
-#endif
}
: Insert (other._session, other.placement(), 1, -1, 1, -1)
{
init ();
-#ifdef STATE_MANAGER
- save_state (_("initial state"));
RedirectCreated (this); /* EMIT SIGNAL */
-#endif
-
}
void
}
}
-#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.
}
}
-#ifdef STATE_MANAGER
- _gain_automation_curve.save_state (_("loaded from disk"));
-#endif
-
return 0;
}
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.
*/
}
}
-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)
{
{
current_location = 0;
-#ifdef STATE_MANAGER
- save_state (_("initial"));
-#endif
}
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
current_location = 0;
}
-#ifdef STATE_MANAGER
- save_state (_("clear"));
-#endif
-
changed (); /* EMIT SIGNAL */
current_changed (0); /* EMIT SIGNAL */
}
}
}
-#ifdef STATE_MANAGER
- save_state (_("clear markers"));
-#endif
-
changed (); /* EMIT SIGNAL */
}
current_location = 0;
}
-#ifdef STATE_MANAGER
- save_state (_("clear ranges"));
-#endif
-
changed (); /* EMIT SIGNAL */
current_changed (0); /* EMIT SIGNAL */
}
}
}
-#ifdef STATE_MANAGER
- save_state (_("add"));
-#endif
-
added (loc); /* EMIT SIGNAL */
if (make_current) {
}
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 */
void
Locations::location_changed (Location* loc)
{
-#ifdef STATE_MANAGER
- save_state (X_("location changed"));
-#endif
changed (); /* EMIT SIGNAL */
}
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
{
_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));
}
}
/* now that we are done loading */
-#ifdef STATE_MANAGER
- _automation.save_state (_("loaded from disk"));
-#endif
_automation.StateChanged (Change (0));
return 0;
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());
}
}
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:
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 ();
}
_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)
{
{
_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)
throw failed_constructor();
}
-#ifdef STATE_MANAGER
- save_state (_("initial state"));
-#endif
-
- RedirectCreated (this); /* EMIT SIGNAL */
+ RedirectCreated (this); /* EMIT SIGNAL */
}
Send::Send (const Send& other)
{
_metering = false;
expected_inputs = 0;
-#ifdef STATE_MANAGER
- save_state (_("initial state"));
-#endif
RedirectCreated (this); /* EMIT SIGNAL */
}
return -1;
}
- StateManager::prohibit_save ();
-
if ((prop = node.property ("name")) != 0) {
_name = prop->value ();
}
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;
_state_of_the_state = Clean;
- StateManager::allow_save (_("initial state"), true);
-
if (state_was_pending) {
save_state (_current_snapshot_name);
remove_pending_capture_state ();
return 0;
out:
- /* we failed, re-enable state saving but don't actually save internal state */
- StateManager::allow_save (X_("ignored"), false);
return ret;
}
+++ /dev/null
-#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);
-}
_frame_rate = fr;
last_bbt_valid = false;
BBT_Time start;
-#ifdef STATE_MANAGER
- in_set_state = false;
-#endif
start.bars = 1;
start.beats = 1;
metrics->push_back (t);
metrics->push_back (m);
-
-#ifdef STATE_MANAGER
- save_state (_("initial"));
-#endif
}
TempoMap::~TempoMap ()
section.set_start (corrected);
metrics->sort (cmp);
timestamp_metrics ();
-#ifdef STATE_MANAGER
- save_state (_("move metric"));
-#endif
return 0;
}
}
}
}
-
- if (removed) {
-#ifdef STATE_MANAGER
- save_state (_("metric removed"));
-#endif
- }
}
if (removed) {
where.ticks = 0;
do_insert (new TempoSection (where, tempo.beats_per_minute()));
-
-#ifdef STATE_MANAGER
- save_state (_("add tempo"));
-#endif
}
StateChanged (Change (0));
break;
}
}
-
- if (replaced) {
-#ifdef STATE_MANAGER
- save_state (_("replace tempo"));
-#endif
- }
}
if (replaced) {
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));
break;
}
}
-
- if (replaced) {
-#ifdef STATE_MANAGER
- save_state (_("replaced meter"));
-#endif
- }
}
if (replaced) {
XMLNodeConstIterator niter;
Metrics old_metrics (*metrics);
-#ifdef STATE_MANAGER
- in_set_state = true;
-#endif
-
metrics->clear();
nlist = node.children();
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;
}
}
-#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