allow flags to be setable from the MixerSnapshotDialog

This commit is contained in:
Nikolaus Gullotta 2019-04-10 14:51:13 -05:00 committed by Nikolaus Gullotta
parent 6dc4227cc4
commit 574de9fa55
No known key found for this signature in database
GPG key ID: 565F60578092AA31
4 changed files with 89 additions and 9 deletions

View file

@ -262,6 +262,21 @@ bool MixerSnapshotDialog::bootstrap_display_and_model(Gtkmm2ext::DnDTreeView<str
//newest snaps should be at the top
model->set_sort_column(6, SORT_DESCENDING);
//new stuff - see TODO
display.append_column(_("EQ"), _columns.recall_eq); // col 8
display.append_column(_("Comp"), _columns.recall_comp);
display.append_column(_("I/O"), _columns.recall_io);
display.append_column(_("Groups"), _columns.recall_groups);
display.append_column(_("VCAs"), _columns.recall_vcas); //col 12
// TODO make this a vector
for(int i = 8; i <= 12; i++) {
CellRendererToggle* cell = dynamic_cast<CellRendererToggle*>(display.get_column_cell_renderer(i));
cell->property_activatable() = true;
cell->property_radio() = true;
cell->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &MixerSnapshotDialog::recall_flag_cell_action), global, i));
}
display.set_headers_visible(true);
display.set_headers_clickable(true);
display.set_reorderable(false);
@ -469,6 +484,12 @@ void MixerSnapshotDialog::refill()
row[_columns.date] = gdt.format ("%F %H:%M");
row[_columns.full_path] = path;
row[_columns.snapshot] = snap;
row[_columns.recall_eq] = snap->recall_eq();
row[_columns.recall_comp] = snap->recall_comp();
row[_columns.recall_io] = snap->recall_io();
row[_columns.recall_groups] = snap->recall_group();
row[_columns.recall_vcas] = snap->recall_vca();
}
local_model->clear();
@ -506,6 +527,12 @@ void MixerSnapshotDialog::refill()
row[_columns.date] = gdt.format ("%F %H:%M");
row[_columns.full_path] = path;
row[_columns.snapshot] = snap;
row[_columns.recall_eq] = snap->recall_eq();
row[_columns.recall_comp] = snap->recall_comp();
row[_columns.recall_io] = snap->recall_io();
row[_columns.recall_groups] = snap->recall_group();
row[_columns.recall_vcas] = snap->recall_vca();
}
}
@ -524,4 +551,50 @@ void MixerSnapshotDialog::fav_cell_action(const string& path, bool global)
(*iter)[_columns.favorite] = snap->get_favorite();
snap->write((*iter)[_columns.full_path]);
}
}
void MixerSnapshotDialog::recall_flag_cell_action(const std::string& path, bool global, int col_index)
{
TreeModel::iterator iter;
if(global) {
iter = global_model->get_iter(path);
} else {
iter = local_model->get_iter(path);
}
if(iter) {
MixerSnapshot* snap = (*iter)[_columns.snapshot];
switch (col_index)
{
case 8:
snap->set_recall_eq(!snap->recall_eq());
(*iter)[_columns.recall_eq] = snap->recall_eq();
break;
case 9:
snap->set_recall_comp(!snap->recall_comp());
(*iter)[_columns.recall_comp] = snap->recall_comp();
break;
case 10:
snap->set_recall_io(!snap->recall_io());
(*iter)[_columns.recall_io] = snap->recall_io();
break;
case 11:
snap->set_recall_group(!snap->recall_group());
(*iter)[_columns.recall_groups] = snap->recall_group();
break;
case 12:
snap->set_recall_vca(!snap->recall_vca());
(*iter)[_columns.recall_vcas] = snap->recall_vca();
break;
default:
break;
}
snap->write((*iter)[_columns.full_path]);
}
}

View file

@ -64,6 +64,7 @@ class MixerSnapshotDialog : public ArdourWindow
bool button_press(GdkEventButton*, bool);
void window_opened();
void fav_cell_action(const std::string&, bool);
void recall_flag_cell_action(const std::string&, bool, int);
struct MixerSnapshotColumns : public Gtk::TreeModel::ColumnRecord {
@ -79,6 +80,11 @@ class MixerSnapshotDialog : public ArdourWindow
add (timestamp);
add (full_path);
add (snapshot);
add (recall_eq);
add (recall_comp);
add (recall_io);
add (recall_groups);
add (recall_vcas);
}
Gtk::TreeModelColumn<bool> favorite;
Gtk::TreeModelColumn<std::string> name;
@ -91,6 +97,11 @@ class MixerSnapshotDialog : public ArdourWindow
Gtk::TreeModelColumn<int64_t> timestamp;
Gtk::TreeModelColumn<std::string> full_path;
Gtk::TreeModelColumn<ARDOUR::MixerSnapshot*> snapshot;
Gtk::TreeModelColumn<bool> recall_eq;
Gtk::TreeModelColumn<bool> recall_comp;
Gtk::TreeModelColumn<bool> recall_io;
Gtk::TreeModelColumn<bool> recall_groups;
Gtk::TreeModelColumn<bool> recall_vcas;
};
MixerSnapshotColumns _columns;

View file

@ -73,11 +73,11 @@ class LIBARDOUR_API MixerSnapshot
std::vector<State> get_groups() {return group_states;};
std::vector<State> get_vcas() {return vca_states;};
bool recall_eq() { return _flags & RecallEQ;};
bool recall_comp() { return _flags & RecallComp;};
bool recall_io() { return _flags & RecallIO;};
bool recall_group() { return _flags & RecallGroup;};
bool recall_vca() { return _flags & RecallVCA;};
bool recall_eq() const { return _flags & RecallEQ;};
bool recall_comp() const { return _flags & RecallComp;};
bool recall_io() const { return _flags & RecallIO;};
bool recall_group() const { return _flags & RecallGroup;};
bool recall_vca() const { return _flags & RecallVCA;};
void set_recall_eq(bool);
void set_recall_comp(bool);

View file

@ -361,10 +361,6 @@ void MixerSnapshot::write(const string path)
return;
}
set_recall_eq(true);
set_recall_io(true);
set_recall_vca(true);
XMLNode* node = new XMLNode("MixerSnapshot");
node->set_property(X_("flags"), _flags);
node->set_property(X_("favorite"), favorite);