diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2006-11-16 18:42:48 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2006-11-16 18:42:48 +0000 |
commit | 2bf3ed423f7aecdaabf5fbb078d9e2f20d26880c (patch) | |
tree | 722c7b81b46f966c6cba9caacc12bbf21663ca7f /libs | |
parent | 7bbf76132164d3bd293c3bfdf2038dd47f1cc63b (diff) |
track naming patch from brian; slightly modified F11-bug workaround from brian; undo/redo items in edit menu now show operation to be undone/redone; canvas allocations now handled by an idle handler; region views respond to changes in fade/in/out curves ; undo/redo possible for some fade in/out operations; automation tracks extend to max_frames
git-svn-id: svn://localhost/ardour2/trunk@1134 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/audioregion.h | 5 | ||||
-rw-r--r-- | libs/ardour/ardour/automation_event.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/session.h | 17 | ||||
-rw-r--r-- | libs/ardour/audioregion.cc | 36 | ||||
-rw-r--r-- | libs/ardour/automation_event.cc | 14 | ||||
-rw-r--r-- | libs/ardour/panner.cc | 2 | ||||
-rw-r--r-- | libs/ardour/session.cc | 2 | ||||
-rw-r--r-- | libs/ardour/session_state.cc | 23 | ||||
-rw-r--r-- | libs/pbd/pbd/undo.h | 4 | ||||
-rw-r--r-- | libs/pbd/undo.cc | 15 |
10 files changed, 81 insertions, 39 deletions
diff --git a/libs/ardour/ardour/audioregion.h b/libs/ardour/ardour/audioregion.h index 6deeff05c4..1d389cec1a 100644 --- a/libs/ardour/ardour/audioregion.h +++ b/libs/ardour/ardour/audioregion.h @@ -171,8 +171,11 @@ class AudioRegion : public Region void recompute_at_start (); void recompute_at_end (); - void envelope_changed (Change); + void envelope_changed (); + void fade_in_changed (); + void fade_out_changed (); void source_offset_changed (); + void listen_to_my_curves (); void source_deleted (); diff --git a/libs/ardour/ardour/automation_event.h b/libs/ardour/ardour/automation_event.h index 459ec2b6cf..e5c194e683 100644 --- a/libs/ardour/ardour/automation_event.h +++ b/libs/ardour/ardour/automation_event.h @@ -152,7 +152,7 @@ class AutomationList : public PBD::StatefulDestructible (obj.*method)(*this); } - sigc::signal<void,Change> StateChanged; + sigc::signal<void> StateChanged; XMLNode& get_state(void); int set_state (const XMLNode &s); diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index a5a2d6b59a..55376bcd77 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -742,16 +742,19 @@ class Session : public PBD::StatefulDestructible /* History (for editors, mixers, UIs etc.) */ void undo (uint32_t n) { - history.undo (n); + _history.undo (n); } + void redo (uint32_t n) { - history.redo (n); + _history.redo (n); } - uint32_t undo_depth() const { return history.undo_depth(); } - uint32_t redo_depth() const { return history.redo_depth(); } - string next_undo() const { return history.next_undo(); } - string next_redo() const { return history.next_redo(); } + UndoHistory& history() { return _history; } + + uint32_t undo_depth() const { return _history.undo_depth(); } + uint32_t redo_depth() const { return _history.redo_depth(); } + string next_undo() const { return _history.next_undo(); } + string next_redo() const { return _history.next_redo(); } void begin_reversible_command (string cmd_name); void commit_reversible_command (Command* cmd = 0); @@ -1568,7 +1571,7 @@ class Session : public PBD::StatefulDestructible void reverse_diskstream_buffers (); - UndoHistory history; + UndoHistory _history; UndoTransaction* current_trans; GlobalRouteBooleanState get_global_route_boolean (bool (Route::*method)(void) const); diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc index e0f851e2f0..b0ad4472bb 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -80,7 +80,7 @@ AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, nframes_t start, n set_default_fades (); set_default_envelope (); - _envelope.StateChanged.connect (mem_fun (*this, &AudioRegion::envelope_changed)); + listen_to_my_curves (); } AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, nframes_t start, nframes_t length, const string& name, layer_t layer, Flag flags) @@ -105,7 +105,7 @@ AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, nframes_t start, n set_default_fades (); set_default_envelope (); - _envelope.StateChanged.connect (mem_fun (*this, &AudioRegion::envelope_changed)); + listen_to_my_curves (); } AudioRegion::AudioRegion (SourceList& srcs, nframes_t start, nframes_t length, const string& name, layer_t layer, Flag flags) @@ -132,7 +132,7 @@ AudioRegion::AudioRegion (SourceList& srcs, nframes_t start, nframes_t length, c set_default_fades (); set_default_envelope (); - _envelope.StateChanged.connect (mem_fun (*this, &AudioRegion::envelope_changed)); + listen_to_my_curves (); } @@ -196,7 +196,7 @@ AudioRegion::AudioRegion (boost::shared_ptr<const AudioRegion> other, nframes_t _scale_amplitude = other->_scale_amplitude; - _envelope.StateChanged.connect (mem_fun (*this, &AudioRegion::envelope_changed)); + listen_to_my_curves (); } AudioRegion::AudioRegion (boost::shared_ptr<const AudioRegion> other) @@ -237,7 +237,7 @@ AudioRegion::AudioRegion (boost::shared_ptr<const AudioRegion> other) _fade_in_disabled = 0; _fade_out_disabled = 0; - _envelope.StateChanged.connect (mem_fun (*this, &AudioRegion::envelope_changed)); + listen_to_my_curves (); } AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, const XMLNode& node) @@ -261,7 +261,7 @@ AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, const XMLNode& nod throw failed_constructor(); } - _envelope.StateChanged.connect (mem_fun (*this, &AudioRegion::envelope_changed)); + listen_to_my_curves (); } AudioRegion::AudioRegion (SourceList& srcs, const XMLNode& node) @@ -301,7 +301,7 @@ AudioRegion::AudioRegion (SourceList& srcs, const XMLNode& node) throw failed_constructor(); } - _envelope.StateChanged.connect (mem_fun (*this, &AudioRegion::envelope_changed)); + listen_to_my_curves (); } AudioRegion::~AudioRegion () @@ -316,6 +316,14 @@ AudioRegion::~AudioRegion () GoingAway (); /* EMIT SIGNAL */ } +void +AudioRegion::listen_to_my_curves () +{ + _envelope.StateChanged.connect (mem_fun (*this, &AudioRegion::envelope_changed)); + _fade_in.StateChanged.connect (mem_fun (*this, &AudioRegion::fade_in_changed)); + _fade_out.StateChanged.connect (mem_fun (*this, &AudioRegion::fade_out_changed)); +} + bool AudioRegion::verify_length (nframes_t len) { @@ -1248,7 +1256,19 @@ AudioRegion::normalize_to (float target_dB) } void -AudioRegion::envelope_changed (Change ignored) +AudioRegion::fade_in_changed () +{ + send_change (FadeInChanged); +} + +void +AudioRegion::fade_out_changed () +{ + send_change (FadeOutChanged); +} + +void +AudioRegion::envelope_changed () { send_change (EnvelopeChanged); } diff --git a/libs/ardour/automation_event.cc b/libs/ardour/automation_event.cc index cc2554a704..f5c9d3609a 100644 --- a/libs/ardour/automation_event.cc +++ b/libs/ardour/automation_event.cc @@ -192,7 +192,7 @@ AutomationList::maybe_signal_changed () if (_frozen) { changed_when_thawed = true; } else { - StateChanged (Change (0)); + StateChanged (); } } @@ -583,7 +583,7 @@ AutomationList::thaw () { _frozen = false; if (changed_when_thawed) { - StateChanged(Change(0)); /* EMIT SIGNAL */ + StateChanged(); /* EMIT SIGNAL */ } } @@ -1255,13 +1255,13 @@ AutomationList::set_state (const XMLNode& node) return deserialize_events (node); } - if (node.name() == X_("Envelope") && (nsos = node.child (X_("AutomationList")))) { - /* new school in old school clothing */ - return set_state (*nsos); - } - if (node.name() == X_("Envelope") || node.name() == X_("FadeOut") || node.name() == X_("FadeIn")) { + if ((nsos = node.child (X_("AutomationList")))) { + /* new school in old school clothing */ + return set_state (*nsos); + } + /* old school */ const XMLNodeList& elist = node.children(); diff --git a/libs/ardour/panner.cc b/libs/ardour/panner.cc index 00b31f314d..faf2f14fb3 100644 --- a/libs/ardour/panner.cc +++ b/libs/ardour/panner.cc @@ -259,7 +259,7 @@ BaseStereoPanner::load (istream& in, string path, uint32_t& linecnt) /* now that we are done loading */ - _automation.StateChanged (Change (0)); + _automation.StateChanged (); return 0; } diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 34615c4966..7e3b061656 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -405,7 +405,7 @@ Session::~Session () /* clear history so that no references to objects are held any more */ - history.clear (); + _history.clear (); /* clear state tree so that no references to objects are held any more */ diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index f80c9e9a82..94d9fe6b50 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -2097,7 +2097,7 @@ Session::commit_reversible_command (Command *cmd) gettimeofday (&now, 0); current_trans->set_timestamp (now); - history.add (current_trans); + _history.add (current_trans); } Session::GlobalRouteBooleanState @@ -2647,7 +2647,7 @@ Session::cleanup_sources (Session::cleanup_report& rep) /* dump the history list */ - history.clear (); + _history.clear (); /* save state so we don't end up a session file referring to non-existent sources. @@ -2798,7 +2798,7 @@ Session::save_history (string snapshot_name) string xml_path; string bak_path; - tree.set_root (&history.get_state()); + tree.set_root (&_history.get_state()); if (snapshot_name.empty()) { snapshot_name = _current_snapshot_name; @@ -2825,14 +2825,13 @@ Session::save_history (string snapshot_name) * possible to fix. */ - if (unlink (xml_path.c_str())) - { - error << string_compose (_("could not remove corrupt history file %1"), xml_path) << endmsg; + if (unlink (xml_path.c_str())) { + error << string_compose (_("could not remove corrupt history file %1"), xml_path) << endmsg; } else { - if (rename (bak_path.c_str(), xml_path.c_str())) - { - error << string_compose (_("could not restore history file from backup %1"), bak_path) << endmsg; - } + if (rename (bak_path.c_str(), xml_path.c_str())) + { + error << string_compose (_("could not restore history file from backup %1"), bak_path) << endmsg; + } } return -1; @@ -2862,7 +2861,7 @@ Session::restore_history (string snapshot_name) } /* replace history */ - history.clear(); + _history.clear(); for (XMLNodeConstIterator it = tree.root()->children().begin(); it != tree.root()->children().end(); it++) { @@ -2895,7 +2894,7 @@ Session::restore_history (string snapshot_name) } } - history.add (ut); + _history.add (ut); } return 0; diff --git a/libs/pbd/pbd/undo.h b/libs/pbd/pbd/undo.h index 277c41c2af..eb46750e4f 100644 --- a/libs/pbd/pbd/undo.h +++ b/libs/pbd/pbd/undo.h @@ -74,7 +74,7 @@ class UndoTransaction : public Command friend void command_death (UndoTransaction*, Command *); }; -class UndoHistory +class UndoHistory : public sigc::trackable { public: UndoHistory(); @@ -97,6 +97,8 @@ class UndoHistory XMLNode &get_state(); void save_state(); + sigc::signal<void> Changed; + private: bool _clearing; std::list<UndoTransaction*> UndoList; diff --git a/libs/pbd/undo.cc b/libs/pbd/undo.cc index 442a5439f2..277b83bfce 100644 --- a/libs/pbd/undo.cc +++ b/libs/pbd/undo.cc @@ -157,6 +157,8 @@ UndoHistory::add (UndoTransaction* const ut) UndoList.push_back (ut); /* we are now owners of the transaction */ + + Changed (); /* EMIT SIGNAL */ } void @@ -168,6 +170,8 @@ UndoHistory::remove (UndoTransaction* const ut) UndoList.remove (ut); RedoList.remove (ut); + + Changed (); /* EMIT SIGNAL */ } void @@ -182,6 +186,8 @@ UndoHistory::undo (unsigned int n) ut->undo (); RedoList.push_back (ut); } + + Changed (); /* EMIT SIGNAL */ } void @@ -196,6 +202,8 @@ UndoHistory::redo (unsigned int n) ut->redo (); UndoList.push_back (ut); } + + Changed (); /* EMIT SIGNAL */ } void @@ -204,6 +212,9 @@ UndoHistory::clear_redo () _clearing = true; RedoList.clear (); _clearing = false; + + Changed (); /* EMIT SIGNAL */ + } void @@ -212,6 +223,8 @@ UndoHistory::clear_undo () _clearing = true; UndoList.clear (); _clearing = false; + + Changed (); /* EMIT SIGNAL */ } void @@ -219,6 +232,8 @@ UndoHistory::clear () { clear_undo (); clear_redo (); + + Changed (); /* EMIT SIGNAL */ } XMLNode & UndoHistory::get_state() |