limited history depth (no GUI yet); more work on import dialog and semantics

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2361 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2007-09-02 15:17:13 +00:00
parent 6c2728f981
commit f2a2e9c002
21 changed files with 355 additions and 180 deletions

View file

@ -138,7 +138,8 @@ CONFIG_VARIABLE (bool, verify_remove_last_capture, "verify-remove-last-capture",
CONFIG_VARIABLE (bool, no_new_session_dialog, "no-new-session-dialog", false)
CONFIG_VARIABLE (bool, use_vst, "use-vst", true)
CONFIG_VARIABLE (uint32_t, subframes_per_frame, "subframes-per-frame", 100)
CONFIG_VARIABLE (uint32_t, saved_history_depth, "save-history-depth", 100)
CONFIG_VARIABLE (uint32_t, saved_history_depth, "save-history-depth", 20)
CONFIG_VARIABLE (uint32_t, history_depth, "history-depth", 20)
CONFIG_VARIABLE (bool, use_overlap_equivalency, "use-overlap-equivalency", false)
CONFIG_VARIABLE (bool, periodic_safety_backups, "periodic-safety-backups", true)
CONFIG_VARIABLE (uint32_t, periodic_safety_backup_interval, "periodic-safety-backup-interval", 120)

View file

@ -1717,6 +1717,7 @@ class Session : public PBD::StatefulDestructible
XMLNode& get_control_protocol_state ();
void set_history_depth (uint32_t depth);
};
} // namespace ARDOUR

View file

@ -117,6 +117,9 @@ Session::first_stage_init (string fullpath, string snapshot_name)
_path += '/';
}
set_history_depth (Config->get_history_depth());
/* these two are just provisional settings. set_state()
will likely override them.
*/
@ -2979,7 +2982,6 @@ Session::add_instant_xml (XMLNode& node, const std::string& dir)
Config->add_instant_xml (node, get_user_ardour_path());
}
int
Session::save_history (string snapshot_name)
{
@ -3284,8 +3286,10 @@ Session::config_changed (const char* parameter_name)
set_slave_source (Config->get_slave_source());
} else if (PARAM_IS ("remote-model")) {
set_remote_control_ids ();
} else if (PARAM_IS ("denormal-model")) {
} else if (PARAM_IS ("denormal-model")) {
setup_fpu ();
} else if (PARAM_IS ("history-depth")) {
set_history_depth (Config->get_history_depth());
}
set_dirty ();
@ -3293,3 +3297,9 @@ Session::config_changed (const char* parameter_name)
#undef PARAM_IS
}
void
Session::set_history_depth (uint32_t d)
{
_history.set_depth (d);
}

View file

@ -86,8 +86,8 @@ class UndoHistory : public sigc::trackable
unsigned long undo_depth() const { return UndoList.size(); }
unsigned long redo_depth() const { return RedoList.size(); }
std::string next_undo() const { return (UndoList.empty() ? std::string("") : UndoList.back()->name()); }
std::string next_redo() const { return (RedoList.empty() ? std::string("") : RedoList.back()->name()); }
std::string next_undo() const { return (UndoList.empty() ? std::string() : UndoList.back()->name()); }
std::string next_redo() const { return (RedoList.empty() ? std::string() : RedoList.back()->name()); }
void clear ();
void clear_undo ();
@ -96,10 +96,14 @@ class UndoHistory : public sigc::trackable
XMLNode &get_state(uint32_t depth = 0);
void save_state();
sigc::signal<void> Changed;
void set_depth (uint32_t);
uint32_t get_depth() const { return _depth; }
sigc::signal<void> Changed;
private:
bool _clearing;
uint32_t _depth;
std::list<UndoTransaction*> UndoList;
std::list<UndoTransaction*> RedoList;

View file

@ -148,12 +148,28 @@ XMLNode &UndoTransaction::get_state()
UndoHistory::UndoHistory ()
{
_clearing = false;
_depth = 0;
}
void
UndoHistory::set_depth (uint32_t d)
{
_depth = d;
while (_depth > 0 && UndoList.size() > _depth) {
UndoList.pop_front ();
}
}
void
UndoHistory::add (UndoTransaction* const ut)
{
ut->GoingAway.connect (bind (mem_fun (*this, &UndoHistory::remove), ut));
while (_depth > 0 && UndoList.size() > _depth) {
UndoList.pop_front ();
}
UndoList.push_back (ut);
/* we are now owners of the transaction */