mixer snapshot list can be local *or* global. This will be controlled by it's constructor

This commit is contained in:
Nikolaus Gullotta 2019-08-01 14:02:19 -05:00 committed by Nikolaus Gullotta
parent e0ce2c00e5
commit 3d0a362ccd
No known key found for this signature in database
GPG key ID: 565F60578092AA31
3 changed files with 16 additions and 8 deletions

View file

@ -54,12 +54,13 @@ using namespace Gtk;
using namespace ARDOUR;
using namespace ARDOUR_UI_UTILS;
MixerSnapshotList::MixerSnapshotList ()
MixerSnapshotList::MixerSnapshotList (bool global)
: add_template_button("Add Snapshot")
, add_session_template_button("Add from Session")
, _window_packer(new VBox())
, _button_packer(new HBox())
, _bug_user(true)
, _global(global)
{
_snapshot_model = ListStore::create (_columns);
_snapshot_display.set_model (_snapshot_model);
@ -106,7 +107,7 @@ void MixerSnapshotList::new_snapshot() {
prompter.get_result(name);
if (name.length()) {
RouteList rl = PublicEditor::instance().get_selection().tracks.routelist();
_session->snapshot_manager().create_snapshot(name, rl, false);
_session->snapshot_manager().create_snapshot(name, rl, _global);
redisplay();
}
}
@ -128,7 +129,7 @@ void MixerSnapshotList::new_snapshot_from_session() {
string session_path = session_selector.get_filename();
string name = basename_nosuffix(session_path);
_session->snapshot_manager().create_snapshot(name, session_path, false);
_session->snapshot_manager().create_snapshot(name, session_path, _global);
redisplay();
}
@ -283,15 +284,21 @@ MixerSnapshotList::redisplay ()
return;
}
SnapshotList local_snapshots = _session->snapshot_manager().get_local_snapshots();
SnapshotList active_list;
if(_global) {
active_list = _session->snapshot_manager().get_global_snapshots();
} else if(!_global) {
active_list = _session->snapshot_manager().get_local_snapshots();
}
if(local_snapshots.empty()) {
if(active_list.empty()) {
printf("it's empty jim, cannot redisplay\n");
return;
}
_snapshot_model->clear();
for(SnapshotList::const_iterator it = local_snapshots.begin(); it != local_snapshots.end(); it++) {
for(SnapshotList::const_iterator it = active_list.begin(); it != active_list.end(); it++) {
TreeModel::Row row = *(_snapshot_model->append());
row[_columns.name] = (*it)->get_label();
row[_columns.snapshot] = (*it);

View file

@ -35,7 +35,7 @@
class MixerSnapshotList : public ARDOUR::SessionHandlePtr
{
public:
MixerSnapshotList ();
MixerSnapshotList (bool global);
void set_session (ARDOUR::Session *);
@ -74,6 +74,7 @@ private:
Gtk::Button add_session_template_button;
bool _bug_user;
bool _global;
bool button_press (GdkEventButton *);
void selection_changed ();

View file

@ -274,7 +274,7 @@ Mixer_UI::Mixer_UI ()
rhs_pane2.add (rhs_pane1);
rhs_pane2.add (group_display_frame);
_mix_snaps = new MixerSnapshotList();
_mix_snaps = new MixerSnapshotList(true);
// Gtk::VBox* mix_packer = new Gtk::VBox();
// mix_packer->pack_start(_mix_snaps->widget());
// mix_packer->pack_start(_mix_snaps->get_add_template_button());