add PromotedSnapshot signal to manager, and subscribe to this this in the global MixerSnapshotList

This commit is contained in:
Nikolaus Gullotta 2019-08-14 14:05:05 -05:00 committed by Nikolaus Gullotta
parent 132e895b18
commit 4a085b91f5
No known key found for this signature in database
GPG key ID: 565F60578092AA31
4 changed files with 21 additions and 2 deletions

View file

@ -149,8 +149,13 @@ void MixerSnapshotList::bootstrap_display_and_model()
void MixerSnapshotList::set_session (Session* s)
{
SessionHandlePtr::set_session (s);
redisplay ();
if(s) {
SessionHandlePtr::set_session(s);
redisplay ();
if(_global) {
s->snapshot_manager().PromotedSnapshot.connect(connections, invalidator(*this), boost::bind(&MixerSnapshotList::add_promoted_snapshot, this, _1), gui_context());
}
}
}
void MixerSnapshotList::new_snapshot() {
@ -342,6 +347,14 @@ void MixerSnapshotList::substitution_dialog_response(int response, MixerSnapshot
snapshot->set_route_states(clean);
}
void MixerSnapshotList::add_promoted_snapshot(MixerSnapshot* snapshot)
{
if(!snapshot) {
return;
}
redisplay();
}
/* Pop up the snapshot display context menu.
* @param button Button used to open the menu.

View file

@ -109,6 +109,7 @@ private:
void promote_snapshot (Gtk::TreeModel::iterator&);
Gtk::TreeModel::const_iterator get_row_by_name(const std::string&);
bool remove_row(Gtk::TreeModel::const_iterator&);
void add_promoted_snapshot(ARDOUR::MixerSnapshot*);
};
#endif // __gtk_ardour_mixer_snapshots_h__

View file

@ -27,6 +27,8 @@
#include "ardour/mixer_snapshot.h"
#include "ardour/session.h"
#include "pbd/signals.h"
namespace ARDOUR {
typedef std::set<MixerSnapshot*> SnapshotList;
@ -56,6 +58,8 @@ public:
void refresh();
void clear() { _global_snapshots.clear(); _local_snapshots.clear(); };
PBD::Signal1<void, ARDOUR::MixerSnapshot*> PromotedSnapshot;
private:
void ensure_snapshot_dir(bool global);
std::string _global_path;

View file

@ -128,6 +128,7 @@ bool MixerSnapshotManager::promote(MixerSnapshot* snapshot) {
//insert the new snapshot
_global_snapshots.insert(new_snap);
PromotedSnapshot(new_snap); /* EMIT SIGNAL */
return true;
}
return false;