mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-27 00:47:43 +01:00
NO-OP: trim whitespace and indentation issues
This commit is contained in:
parent
0697433974
commit
a72a313b4b
4 changed files with 158 additions and 158 deletions
|
|
@ -34,11 +34,11 @@ using namespace ArdourWidgets;
|
|||
using namespace ARDOUR_UI_UTILS;
|
||||
|
||||
struct ColumnInfo {
|
||||
int index;
|
||||
int sort_idx;
|
||||
AlignmentEnum al;
|
||||
const char* label;
|
||||
const char* tooltip;
|
||||
int index;
|
||||
int sort_idx;
|
||||
AlignmentEnum al;
|
||||
const char* label;
|
||||
const char* tooltip;
|
||||
};
|
||||
|
||||
MixerSnapshotDialog::MixerSnapshotDialog(Session* s)
|
||||
|
|
@ -46,13 +46,13 @@ MixerSnapshotDialog::MixerSnapshotDialog(Session* s)
|
|||
{
|
||||
global_model = Gtk::ListStore::create(_columns);
|
||||
local_model = Gtk::ListStore::create(_columns);
|
||||
|
||||
|
||||
bootstrap_display_and_model(global_display, global_model, true);
|
||||
bootstrap_display_and_model(local_display, local_model, false);
|
||||
|
||||
global_display.signal_button_press_event().connect(sigc::bind(sigc::mem_fun(*this, &MixerSnapshotDialog::button_press), true), false);
|
||||
local_display.signal_button_press_event().connect(sigc::bind(sigc::mem_fun(*this, &MixerSnapshotDialog::button_press), false), false);
|
||||
|
||||
|
||||
set_session(s);
|
||||
}
|
||||
|
||||
|
|
@ -70,55 +70,55 @@ bool MixerSnapshotDialog::button_press(GdkEventButton* ev, bool global)
|
|||
if (ev->button == 3) {
|
||||
|
||||
Gtk::TreeModel::Path path;
|
||||
Gtk::TreeViewColumn* col;
|
||||
int cx;
|
||||
int cy;
|
||||
|
||||
Gtk::TreeViewColumn* col;
|
||||
int cx;
|
||||
int cy;
|
||||
|
||||
TreeModel::iterator iter;
|
||||
if(global) {
|
||||
global_display.get_path_at_pos ((int) ev->x, (int) ev->y, path, col, cx, cy);
|
||||
global_display.get_path_at_pos ((int) ev->x, (int) ev->y, path, col, cx, cy);
|
||||
iter = global_model->get_iter(path);
|
||||
} else {
|
||||
local_display.get_path_at_pos ((int) ev->x, (int) ev->y, path, col, cx, cy);
|
||||
iter = local_model->get_iter(path);
|
||||
}
|
||||
|
||||
if (iter) {
|
||||
TreeModel::Row row = *(iter);
|
||||
popup_context_menu(ev->button, ev->time, row[_columns.full_path]);
|
||||
if (iter) {
|
||||
TreeModel::Row row = *(iter);
|
||||
popup_context_menu(ev->button, ev->time, row[_columns.full_path]);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
if (ev->type == GDK_2BUTTON_PRESS) {
|
||||
|
||||
|
||||
TreeModel::iterator iter;
|
||||
if(global) {
|
||||
iter = global_display.get_selection()->get_selected();
|
||||
} else {
|
||||
iter = local_display.get_selection()->get_selected();
|
||||
}
|
||||
|
||||
|
||||
global_display.get_selection()->unselect_all();
|
||||
local_display.get_selection()->unselect_all();
|
||||
local_display.get_selection()->unselect_all();
|
||||
|
||||
if(iter) {
|
||||
MixerSnapshot* s = (*iter)[_columns.snapshot];
|
||||
s->recall();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void MixerSnapshotDialog::popup_context_menu(int btn, int64_t time, string path)
|
||||
{
|
||||
using namespace Menu_Helpers;
|
||||
MenuList& items(menu.items());
|
||||
items.clear();
|
||||
add_item_with_sensitivity(items, MenuElem(_("Remove"), sigc::bind(sigc::mem_fun(*this, &MixerSnapshotDialog::remove_snapshot), path)), true);
|
||||
add_item_with_sensitivity(items, MenuElem(_("Rename..."), sigc::bind(sigc::mem_fun(*this, &MixerSnapshotDialog::rename_snapshot), path)), true);
|
||||
menu.popup(btn, time);
|
||||
MenuList& items(menu.items());
|
||||
items.clear();
|
||||
add_item_with_sensitivity(items, MenuElem(_("Remove"), sigc::bind(sigc::mem_fun(*this, &MixerSnapshotDialog::remove_snapshot), path)), true);
|
||||
add_item_with_sensitivity(items, MenuElem(_("Rename..."), sigc::bind(sigc::mem_fun(*this, &MixerSnapshotDialog::rename_snapshot), path)), true);
|
||||
menu.popup(btn, time);
|
||||
}
|
||||
|
||||
void MixerSnapshotDialog::remove_snapshot(const string path)
|
||||
|
|
@ -132,21 +132,21 @@ void MixerSnapshotDialog::rename_snapshot(const string old_path)
|
|||
string dir_name = Glib::path_get_dirname(old_path);
|
||||
|
||||
Prompter prompt(true);
|
||||
prompt.set_name("Rename MixerSnapshot Prompter");
|
||||
prompt.set_title(_("New Snapshot Name:"));
|
||||
prompt.add_button(Stock::SAVE, RESPONSE_ACCEPT);
|
||||
prompt.set_prompt(_("Rename Mixer Snapshot:"));
|
||||
prompt.set_initial_text(basename_nosuffix(old_path));
|
||||
prompt.set_name("Rename MixerSnapshot Prompter");
|
||||
prompt.set_title(_("New Snapshot Name:"));
|
||||
prompt.add_button(Stock::SAVE, RESPONSE_ACCEPT);
|
||||
prompt.set_prompt(_("Rename Mixer Snapshot:"));
|
||||
prompt.set_initial_text(basename_nosuffix(old_path));
|
||||
|
||||
if (prompt.run() == RESPONSE_ACCEPT) {
|
||||
string new_label;
|
||||
prompt.get_result(new_label);
|
||||
if (new_label.length() > 0) {
|
||||
string new_label;
|
||||
prompt.get_result(new_label);
|
||||
if (new_label.length() > 0) {
|
||||
string new_path = Glib::build_filename(dir_name, new_label + ".xml");
|
||||
::g_rename(old_path.c_str(), new_path.c_str());
|
||||
refill();
|
||||
}
|
||||
}
|
||||
refill();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool MixerSnapshotDialog::bootstrap_display_and_model(Gtkmm2ext::DnDTreeView<string>& display, Glib::RefPtr<ListStore> model, bool global)
|
||||
|
|
@ -155,14 +155,14 @@ bool MixerSnapshotDialog::bootstrap_display_and_model(Gtkmm2ext::DnDTreeView<str
|
|||
return false;
|
||||
}
|
||||
|
||||
display.set_model(model);
|
||||
display.set_model(model);
|
||||
|
||||
display.append_column(_("Fav"), _columns.favorite);
|
||||
display.append_column(_("Name"), _columns.name);
|
||||
display.append_column(_("# Tracks"), _columns.n_tracks);
|
||||
display.append_column(_("# VCAs"), _columns.n_vcas);
|
||||
display.append_column(_("# Groups"), _columns.n_groups);
|
||||
display.append_column(_("Special Tracks"), _columns.has_specials);
|
||||
display.append_column(_("Fav"), _columns.favorite);
|
||||
display.append_column(_("Name"), _columns.name);
|
||||
display.append_column(_("# Tracks"), _columns.n_tracks);
|
||||
display.append_column(_("# VCAs"), _columns.n_vcas);
|
||||
display.append_column(_("# Groups"), _columns.n_groups);
|
||||
display.append_column(_("Special Tracks"), _columns.has_specials);
|
||||
display.append_column(_("Date"), _columns.date);
|
||||
display.append_column(_("Version"), _columns.version);
|
||||
|
||||
|
|
@ -170,15 +170,15 @@ bool MixerSnapshotDialog::bootstrap_display_and_model(Gtkmm2ext::DnDTreeView<str
|
|||
model->set_sort_column(6, SORT_DESCENDING);
|
||||
|
||||
display.set_headers_visible(true);
|
||||
display.set_headers_clickable(true);
|
||||
display.set_reorderable(false);
|
||||
display.set_rules_hint(true);
|
||||
display.add_object_drag(_columns.name.index(), "");
|
||||
display.set_drag_column(_columns.name.index());
|
||||
display.set_headers_clickable(true);
|
||||
display.set_reorderable(false);
|
||||
display.set_rules_hint(true);
|
||||
display.add_object_drag(_columns.name.index(), "");
|
||||
display.set_drag_column(_columns.name.index());
|
||||
|
||||
CellRendererToggle* fav_cell = dynamic_cast<CellRendererToggle*>(display.get_column_cell_renderer(0));
|
||||
fav_cell->property_activatable() = true;
|
||||
fav_cell->property_radio() = true;
|
||||
fav_cell->property_activatable() = true;
|
||||
fav_cell->property_radio() = true;
|
||||
fav_cell->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &MixerSnapshotDialog::fav_cell_action), global));
|
||||
|
||||
HBox* add_remove = manage(new HBox);
|
||||
|
|
@ -190,15 +190,15 @@ bool MixerSnapshotDialog::bootstrap_display_and_model(Gtkmm2ext::DnDTreeView<str
|
|||
VBox* vbox = manage(new VBox);
|
||||
vbox->set_homogeneous();
|
||||
vbox->pack_start(*add_remove);
|
||||
vbox->set_size_request(800, -1);
|
||||
vbox->set_size_request(800, -1);
|
||||
|
||||
if(global) {
|
||||
btn_add->signal_clicked().connect(sigc::bind(sigc::mem_fun(*this, &MixerSnapshotDialog::new_snapshot), true));
|
||||
btn_new->signal_clicked().connect(sigc::bind(sigc::mem_fun(*this, &MixerSnapshotDialog::new_snap_from_session), true));
|
||||
|
||||
|
||||
global_scroller.set_border_width(10);
|
||||
global_scroller.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC);
|
||||
global_scroller.add(global_display);
|
||||
global_scroller.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC);
|
||||
global_scroller.add(global_display);
|
||||
|
||||
Table* table = manage(new Table(3, 3));
|
||||
table->set_size_request(-1, 400);
|
||||
|
|
@ -210,9 +210,9 @@ bool MixerSnapshotDialog::bootstrap_display_and_model(Gtkmm2ext::DnDTreeView<str
|
|||
btn_new->signal_clicked().connect(sigc::bind(sigc::mem_fun(*this, &MixerSnapshotDialog::new_snap_from_session), false));
|
||||
|
||||
local_scroller.set_border_width(10);
|
||||
local_scroller.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC);
|
||||
local_scroller.add(local_display);
|
||||
|
||||
local_scroller.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC);
|
||||
local_scroller.add(local_display);
|
||||
|
||||
Table* table = manage(new Table(3, 3));
|
||||
table->set_size_request(-1, 400);
|
||||
table->attach(local_scroller, 0, 3, 0, 5 );
|
||||
|
|
@ -221,36 +221,36 @@ bool MixerSnapshotDialog::bootstrap_display_and_model(Gtkmm2ext::DnDTreeView<str
|
|||
}
|
||||
|
||||
ColumnInfo ci[] = {
|
||||
{ 0, 0, ALIGN_CENTER, _("Favorite"), _("") },
|
||||
{ 1, 1, ALIGN_LEFT, _("Name"), _("") },
|
||||
{ 2, 2, ALIGN_CENTER, _("# Tracks"), _("") },
|
||||
{ 3, 3, ALIGN_CENTER, _("# VCAs"), _("") },
|
||||
{ 4, 4, ALIGN_CENTER, _("# Groups"), _("") },
|
||||
{ 5, 5, ALIGN_CENTER, _("Special Tracks"), _("") },
|
||||
{ 6, 8, ALIGN_LEFT, _("Date"), _("") },
|
||||
{ 0, 0, ALIGN_CENTER, _("Favorite"), _("") },
|
||||
{ 1, 1, ALIGN_LEFT, _("Name"), _("") },
|
||||
{ 2, 2, ALIGN_CENTER, _("# Tracks"), _("") },
|
||||
{ 3, 3, ALIGN_CENTER, _("# VCAs"), _("") },
|
||||
{ 4, 4, ALIGN_CENTER, _("# Groups"), _("") },
|
||||
{ 5, 5, ALIGN_CENTER, _("Special Tracks"), _("") },
|
||||
{ 6, 8, ALIGN_LEFT, _("Date"), _("") },
|
||||
{ 7, 7, ALIGN_LEFT, _("Version"), _("") },
|
||||
{ -1,-1, ALIGN_CENTER, 0, 0 }
|
||||
{ -1,-1, ALIGN_CENTER, 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
for (int i = 0; ci[i].index >= 0; ++i) {
|
||||
ColumnInfo info = ci[i];
|
||||
|
||||
TreeViewColumn* col = display.get_column(info.index);
|
||||
TreeViewColumn* col = display.get_column(info.index);
|
||||
|
||||
Label* label = manage(new Label (info.label));
|
||||
label->set_alignment(info.al);
|
||||
set_tooltip(*label, info.tooltip);
|
||||
col->set_widget(*label);
|
||||
Label* label = manage(new Label (info.label));
|
||||
label->set_alignment(info.al);
|
||||
set_tooltip(*label, info.tooltip);
|
||||
col->set_widget(*label);
|
||||
label->show();
|
||||
|
||||
|
||||
col->set_sort_column(info.sort_idx);
|
||||
col->set_expand(false);
|
||||
col->set_alignment(info.al);
|
||||
col->set_alignment(info.al);
|
||||
|
||||
//...and this sets the alignment for the data cells
|
||||
CellRendererText* rend = dynamic_cast<CellRendererText*>(display.get_column_cell_renderer(info.index));
|
||||
if (rend) {
|
||||
rend->property_xalign() = (info.al == ALIGN_RIGHT ? 1.0 : (info.al == ALIGN_LEFT ? 0.0 : 0.5));
|
||||
//...and this sets the alignment for the data cells
|
||||
CellRendererText* rend = dynamic_cast<CellRendererText*>(display.get_column_cell_renderer(info.index));
|
||||
if (rend) {
|
||||
rend->property_xalign() = (info.al == ALIGN_RIGHT ? 1.0 : (info.al == ALIGN_LEFT ? 0.0 : 0.5));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
@ -264,49 +264,49 @@ void MixerSnapshotDialog::new_snapshot(bool global)
|
|||
string path = Glib::build_filename(user_config_directory(-1), "mixer_snapshots/");
|
||||
if(!Glib::file_test(path.c_str(), Glib::FILE_TEST_EXISTS & Glib::FILE_TEST_IS_DIR))
|
||||
::g_mkdir(path.c_str(), 0775);
|
||||
|
||||
|
||||
path = Glib::build_filename(_session->session_directory().root_path(), "mixer_snapshots/");
|
||||
if(!Glib::file_test(path.c_str(), Glib::FILE_TEST_EXISTS & Glib::FILE_TEST_IS_DIR))
|
||||
::g_mkdir(path.c_str(), 0775);
|
||||
|
||||
MixerSnapshot* snap = new MixerSnapshot(_session);
|
||||
|
||||
|
||||
Prompter prompt(true);
|
||||
prompt.set_name("New Mixer Snapshot Prompter");
|
||||
prompt.set_title(_("Mixer Snapshot Name:"));
|
||||
prompt.add_button(Stock::SAVE, RESPONSE_ACCEPT);
|
||||
prompt.set_prompt(_("Set Mixer Snapshot Name"));
|
||||
prompt.set_initial_text(_session->name());
|
||||
prompt.set_title(_("Mixer Snapshot Name:"));
|
||||
prompt.add_button(Stock::SAVE, RESPONSE_ACCEPT);
|
||||
prompt.set_prompt(_("Set Mixer Snapshot Name"));
|
||||
prompt.set_initial_text(_session->name());
|
||||
|
||||
RouteList rl = PublicEditor::instance().get_selection().tracks.routelist();
|
||||
|
||||
|
||||
CheckButton* sel = new CheckButton(_("Selected Tracks Only:"));
|
||||
sel->set_active(!rl.empty());
|
||||
sel->show();
|
||||
prompt.get_vbox()->pack_start(*sel);
|
||||
|
||||
|
||||
if(prompt.run() == RESPONSE_ACCEPT) {
|
||||
string new_label;
|
||||
prompt.get_result(new_label);
|
||||
if (new_label.length() > 0) {
|
||||
snap->label = new_label;
|
||||
|
||||
prompt.get_result(new_label);
|
||||
if (new_label.length() > 0) {
|
||||
snap->label = new_label;
|
||||
|
||||
string path = "";
|
||||
if(global) {
|
||||
path = Glib::build_filename(user_config_directory(-1), "mixer_snapshots/", snap->label + ".xml");
|
||||
} else {
|
||||
path = Glib::build_filename(_session->session_directory().root_path(), "mixer_snapshots/", snap->label + ".xml");
|
||||
}
|
||||
|
||||
|
||||
if(!rl.empty() && sel->get_active())
|
||||
snap->snap(rl);
|
||||
else
|
||||
snap->snap();
|
||||
|
||||
|
||||
snap->write(path);
|
||||
refill();
|
||||
}
|
||||
}
|
||||
refill();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MixerSnapshotDialog::new_snap_from_session(bool global)
|
||||
|
|
@ -314,7 +314,7 @@ void MixerSnapshotDialog::new_snap_from_session(bool global)
|
|||
string testpath = Glib::build_filename(user_config_directory(-1), "mixer_snapshots/");
|
||||
if(!Glib::file_test(testpath.c_str(), Glib::FILE_TEST_EXISTS & Glib::FILE_TEST_IS_DIR))
|
||||
::g_mkdir(testpath.c_str(), 0775);
|
||||
|
||||
|
||||
testpath = Glib::build_filename(_session->session_directory().root_path(), "mixer_snapshots/");
|
||||
if(!Glib::file_test(testpath.c_str(), Glib::FILE_TEST_EXISTS & Glib::FILE_TEST_IS_DIR))
|
||||
::g_mkdir(testpath.c_str(), 0775);
|
||||
|
|
@ -322,29 +322,29 @@ void MixerSnapshotDialog::new_snap_from_session(bool global)
|
|||
Gtk::FileChooserDialog session_selector(_("Open Session"), FILE_CHOOSER_ACTION_OPEN);
|
||||
string session_parent_dir = Glib::path_get_dirname(_session->path());
|
||||
session_selector.add_button(Stock::CANCEL, RESPONSE_CANCEL);
|
||||
session_selector.add_button(Stock::OPEN, RESPONSE_ACCEPT);
|
||||
session_selector.add_button(Stock::OPEN, RESPONSE_ACCEPT);
|
||||
session_selector.set_current_folder(session_parent_dir);
|
||||
|
||||
int response = session_selector.run();
|
||||
session_selector.hide();
|
||||
session_selector.hide();
|
||||
|
||||
if (response == RESPONSE_CANCEL) {
|
||||
return;
|
||||
}
|
||||
if (response == RESPONSE_CANCEL) {
|
||||
return;
|
||||
}
|
||||
|
||||
string session_path = session_selector.get_filename();
|
||||
|
||||
MixerSnapshot* snapshot = new MixerSnapshot(_session, session_path);
|
||||
|
||||
snapshot->label = basename_nosuffix(session_path);
|
||||
|
||||
|
||||
string path = "";
|
||||
if(global) {
|
||||
path = Glib::build_filename(user_config_directory(-1), "mixer_snapshots/", snapshot->label + ".xml");
|
||||
} else {
|
||||
path = Glib::build_filename(_session->session_directory().root_path(), "mixer_snapshots/", snapshot->label + ".xml");
|
||||
}
|
||||
|
||||
|
||||
snapshot->write(path);
|
||||
refill();
|
||||
}
|
||||
|
|
@ -354,7 +354,7 @@ void MixerSnapshotDialog::refill()
|
|||
global_model->clear();
|
||||
|
||||
string global_directory = Glib::build_filename(user_config_directory(-1), "mixer_snapshots/");
|
||||
|
||||
|
||||
vector<string> files;
|
||||
find_files_matching_pattern(files, global_directory, "*.xml");
|
||||
|
||||
|
|
@ -380,7 +380,7 @@ void MixerSnapshotDialog::refill()
|
|||
row[_columns.has_specials] = snap->has_specials();
|
||||
|
||||
GStatBuf gsb;
|
||||
g_stat(path.c_str(), &gsb);
|
||||
g_stat(path.c_str(), &gsb);
|
||||
Glib::DateTime gdt(Glib::DateTime::create_now_local(gsb.st_mtime));
|
||||
|
||||
row[_columns.timestamp] = gsb.st_mtime;
|
||||
|
|
@ -417,7 +417,7 @@ void MixerSnapshotDialog::refill()
|
|||
row[_columns.has_specials] = snap->has_specials();
|
||||
|
||||
GStatBuf gsb;
|
||||
g_stat(path.c_str(), &gsb);
|
||||
g_stat(path.c_str(), &gsb);
|
||||
Glib::DateTime gdt(Glib::DateTime::create_now_local(gsb.st_mtime));
|
||||
|
||||
row[_columns.timestamp] = gsb.st_mtime;
|
||||
|
|
@ -434,11 +434,11 @@ void MixerSnapshotDialog::fav_cell_action(const string& path, bool global)
|
|||
iter = global_model->get_iter(path);
|
||||
else
|
||||
iter = local_model->get_iter(path);
|
||||
|
||||
|
||||
if(iter) {
|
||||
MixerSnapshot* snap = (*iter)[_columns.snapshot];
|
||||
snap->favorite = !snap->favorite;
|
||||
(*iter)[_columns.favorite] = snap->favorite;
|
||||
(*iter)[_columns.favorite] = snap->favorite;
|
||||
snap->write((*iter)[_columns.full_path]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class MixerSnapshotDialog : public ArdourDialog
|
|||
void set_session(ARDOUR::Session*);
|
||||
|
||||
int run();
|
||||
|
||||
|
||||
void refill();
|
||||
|
||||
private:
|
||||
|
|
@ -58,9 +58,9 @@ class MixerSnapshotDialog : public ArdourDialog
|
|||
|
||||
void rename_snapshot(const std::string);
|
||||
void remove_snapshot(const std::string);
|
||||
|
||||
|
||||
bool bootstrap_display_and_model(Gtkmm2ext::DnDTreeView<std::string>&, Glib::RefPtr<Gtk::ListStore>, bool);
|
||||
|
||||
|
||||
void popup_context_menu(int, int64_t, std::string);
|
||||
bool button_press(GdkEventButton*, bool);
|
||||
void fav_cell_action(const std::string&, bool);
|
||||
|
|
|
|||
|
|
@ -51,11 +51,11 @@ class MixerSnapshot
|
|||
std::string name;
|
||||
XMLNode node;
|
||||
};
|
||||
|
||||
|
||||
bool empty() {
|
||||
return (
|
||||
route_states.empty() &&
|
||||
group_states.empty() &&
|
||||
route_states.empty() &&
|
||||
group_states.empty() &&
|
||||
vca_states.empty()
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ MixerSnapshot::MixerSnapshot(Session* s)
|
|||
, timestamp(time(0))
|
||||
, favorite(false)
|
||||
, last_modified_with(string_compose("%1 %2", PROGRAM_NAME, revision))
|
||||
{
|
||||
{
|
||||
if(s)
|
||||
_session = s;
|
||||
}
|
||||
|
|
@ -37,7 +37,7 @@ MixerSnapshot::MixerSnapshot(Session* s, string file_path)
|
|||
, timestamp(time(0))
|
||||
, favorite(false)
|
||||
, last_modified_with(string_compose("%1 %2", PROGRAM_NAME, revision))
|
||||
{
|
||||
{
|
||||
if(s)
|
||||
_session = s;
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ MixerSnapshot::MixerSnapshot(Session* s, string file_path)
|
|||
string suffix = "." + PBD::get_suffix(file_path);
|
||||
if(suffix == statefile_suffix)
|
||||
load_from_session(file_path);
|
||||
|
||||
|
||||
if(suffix == ".xml")
|
||||
load(file_path);
|
||||
}
|
||||
|
|
@ -66,7 +66,7 @@ bool MixerSnapshot::has_specials()
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -78,11 +78,11 @@ void MixerSnapshot::clear()
|
|||
vca_states.clear();
|
||||
}
|
||||
|
||||
void MixerSnapshot::snap(boost::shared_ptr<Route> route)
|
||||
void MixerSnapshot::snap(boost::shared_ptr<Route> route)
|
||||
{
|
||||
if(!route)
|
||||
return;
|
||||
|
||||
|
||||
string name = route->name();
|
||||
XMLNode& original = route->get_state();
|
||||
XMLNode copy (original);
|
||||
|
|
@ -93,14 +93,14 @@ void MixerSnapshot::snap(boost::shared_ptr<Route> route)
|
|||
}
|
||||
|
||||
XMLNode* slavable = find_named_node(copy, "Slavable");
|
||||
|
||||
|
||||
if(slavable)
|
||||
{
|
||||
XMLNodeList nlist = slavable->children();
|
||||
for(XMLNodeConstIterator niter = nlist.begin(); niter != nlist.end(); niter++) {
|
||||
string number;
|
||||
(*niter)->get_property(X_("number"), number);
|
||||
|
||||
|
||||
int i = atoi(number.c_str());
|
||||
boost::shared_ptr<VCA> vca = _session->vca_manager().vca_by_number(i);
|
||||
|
||||
|
|
@ -113,8 +113,8 @@ void MixerSnapshot::snap(boost::shared_ptr<Route> route)
|
|||
}
|
||||
|
||||
State state {
|
||||
route->id().to_s(),
|
||||
route->name(),
|
||||
route->id().to_s(),
|
||||
route->name(),
|
||||
copy
|
||||
};
|
||||
|
||||
|
|
@ -133,10 +133,10 @@ void MixerSnapshot::snap(RouteGroup* group)
|
|||
string name = group->name();
|
||||
XMLNode& original = group->get_state();
|
||||
XMLNode copy (original);
|
||||
|
||||
|
||||
State state {
|
||||
group->id().to_s(),
|
||||
group->name(),
|
||||
group->id().to_s(),
|
||||
group->name(),
|
||||
copy
|
||||
};
|
||||
|
||||
|
|
@ -155,10 +155,10 @@ void MixerSnapshot::snap(boost::shared_ptr<VCA> vca)
|
|||
string name = vca->name();
|
||||
XMLNode& original = vca->get_state();
|
||||
XMLNode copy (original);
|
||||
|
||||
|
||||
State state {
|
||||
vca->id().to_s(),
|
||||
vca->name(),
|
||||
vca->id().to_s(),
|
||||
vca->name(),
|
||||
copy
|
||||
};
|
||||
|
||||
|
|
@ -166,13 +166,13 @@ void MixerSnapshot::snap(boost::shared_ptr<VCA> vca)
|
|||
}
|
||||
|
||||
|
||||
void MixerSnapshot::snap()
|
||||
void MixerSnapshot::snap()
|
||||
{
|
||||
if(!_session)
|
||||
return;
|
||||
|
||||
clear();
|
||||
|
||||
|
||||
RouteList rl = _session->get_routelist();
|
||||
if(rl.empty())
|
||||
return;
|
||||
|
|
@ -181,7 +181,7 @@ void MixerSnapshot::snap()
|
|||
snap((*it));
|
||||
}
|
||||
|
||||
void MixerSnapshot::snap(RouteList rl)
|
||||
void MixerSnapshot::snap(RouteList rl)
|
||||
{
|
||||
if(!_session)
|
||||
return;
|
||||
|
|
@ -212,7 +212,7 @@ void MixerSnapshot::reassign_masters(boost::shared_ptr<Slavable> slv, XMLNode no
|
|||
(*niter)->get_property(X_("name"), name);
|
||||
|
||||
boost::shared_ptr<VCA> vca = _session->vca_manager().vca_by_name(name);
|
||||
|
||||
|
||||
if(vca)
|
||||
slv->assign(vca);
|
||||
}
|
||||
|
|
@ -224,7 +224,7 @@ void MixerSnapshot::recall()
|
|||
return;
|
||||
|
||||
_session->begin_reversible_command(_("mixer-snapshot recall"));
|
||||
|
||||
|
||||
//vcas
|
||||
for(vector<State>::const_iterator i = vca_states.begin(); i != vca_states.end(); i++) {
|
||||
State state = (*i);
|
||||
|
|
@ -242,13 +242,13 @@ void MixerSnapshot::recall()
|
|||
vca->set_state(state.node, PBD::Stateful::loading_state_version);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//routes
|
||||
for(vector<State>::const_iterator i = route_states.begin(); i != route_states.end(); i++) {
|
||||
State state = (*i);
|
||||
|
||||
|
||||
boost::shared_ptr<Route> route = _session->route_by_id(PBD::ID(state.id));
|
||||
|
||||
|
||||
if(!route)
|
||||
route = _session->route_by_name(state.name);
|
||||
|
||||
|
|
@ -282,13 +282,13 @@ void MixerSnapshot::write(const string path)
|
|||
return;
|
||||
|
||||
XMLNode* node = new XMLNode("MixerSnapshot");
|
||||
XMLNode* child;
|
||||
XMLNode* child;
|
||||
|
||||
child = node->add_child ("ProgramVersion");
|
||||
child->set_property("modified-with", last_modified_with);
|
||||
child->set_property("modified-with", last_modified_with);
|
||||
|
||||
child = node->add_child ("Favorite");
|
||||
child->set_property("favorite", favorite);
|
||||
child->set_property("favorite", favorite);
|
||||
|
||||
child = node->add_child("Routes");
|
||||
for(vector<State>::iterator i = route_states.begin(); i != route_states.end(); i++) {
|
||||
|
|
@ -306,7 +306,7 @@ void MixerSnapshot::write(const string path)
|
|||
}
|
||||
|
||||
XMLTree tree;
|
||||
tree.set_root(node);
|
||||
tree.set_root(node);
|
||||
tree.write(path);
|
||||
}
|
||||
|
||||
|
|
@ -319,7 +319,7 @@ void MixerSnapshot::load(const string path)
|
|||
|
||||
XMLTree tree;
|
||||
tree.read(path);
|
||||
|
||||
|
||||
XMLNode* root = tree.root();
|
||||
if(!root) {
|
||||
return;
|
||||
|
|
@ -349,19 +349,19 @@ void MixerSnapshot::load(const string path)
|
|||
string name, id;
|
||||
(*niter)->get_property(X_("name"), name);
|
||||
(*niter)->get_property(X_("id"), id);
|
||||
|
||||
|
||||
State state {id, name, (**niter)};
|
||||
route_states.push_back(state);
|
||||
}
|
||||
}
|
||||
|
||||
if(group_node) {
|
||||
XMLNodeList nlist = group_node->children();
|
||||
XMLNodeList nlist = group_node->children();
|
||||
for(XMLNodeConstIterator niter = nlist.begin(); niter != nlist.end(); niter++) {
|
||||
string name, id;
|
||||
(*niter)->get_property(X_("name"), name);
|
||||
(*niter)->get_property(X_("id"), id);
|
||||
|
||||
|
||||
State state {id, name, (**niter)};
|
||||
group_states.push_back(state);
|
||||
}
|
||||
|
|
@ -373,7 +373,7 @@ void MixerSnapshot::load(const string path)
|
|||
string name, id;
|
||||
(*niter)->get_property(X_("name"), name);
|
||||
(*niter)->get_property(X_("id"), id);
|
||||
|
||||
|
||||
State state {id, name, (**niter)};
|
||||
vca_states.push_back(state);
|
||||
}
|
||||
|
|
@ -412,7 +412,7 @@ XMLNode& MixerSnapshot::sanitize_node(XMLNode& node)
|
|||
const string proc[] = {"PRE", "EQ", "Comp", "POST"};
|
||||
const string name = "Processor";
|
||||
const string prop = "name";
|
||||
|
||||
|
||||
for(int i = 0; i <= 3; i++)
|
||||
node.remove_node_and_delete(name, prop, proc[i]);
|
||||
#endif
|
||||
|
|
@ -445,7 +445,7 @@ void MixerSnapshot::load_from_session(XMLNode& node)
|
|||
|
||||
pair<int, string> pair (atoi(number.c_str()), name);
|
||||
number_name_pairs.push_back(pair);
|
||||
|
||||
|
||||
State state {id, name, (**niter)};
|
||||
vca_states.push_back(state);
|
||||
}
|
||||
|
|
@ -458,13 +458,13 @@ void MixerSnapshot::load_from_session(XMLNode& node)
|
|||
(*niter)->get_property(X_("name"), name);
|
||||
(*niter)->get_property(X_("id"), id);
|
||||
|
||||
/* ugly workaround - recall() expects
|
||||
that a route's Slavable children has
|
||||
the "name" property. Normal session state
|
||||
/* ugly workaround - recall() expects
|
||||
that a route's Slavable children has
|
||||
the "name" property. Normal session state
|
||||
files don't have this. So we stash it,
|
||||
reverse look-up the name based on its number,
|
||||
reverse look-up the name based on its number,
|
||||
and then add it to a copy of the node. */
|
||||
|
||||
|
||||
XMLNode copy (**niter);
|
||||
XMLNode* slavable = find_named_node(copy, "Slavable");
|
||||
if(slavable) {
|
||||
|
|
@ -477,25 +477,25 @@ void MixerSnapshot::load_from_session(XMLNode& node)
|
|||
int mst_number = atoi(number.c_str());
|
||||
int vca_number = (*p).first;
|
||||
string vca_name = (*p).second;
|
||||
|
||||
|
||||
if(vca_number == mst_number)
|
||||
(*siter)->set_property(X_("name"), vca_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
State state {id, name, copy};
|
||||
route_states.push_back(state);
|
||||
}
|
||||
}
|
||||
|
||||
if(group_node) {
|
||||
XMLNodeList nlist = group_node->children();
|
||||
XMLNodeList nlist = group_node->children();
|
||||
for(XMLNodeConstIterator niter = nlist.begin(); niter != nlist.end(); niter++) {
|
||||
string name, id;
|
||||
(*niter)->get_property(X_("name"), name);
|
||||
(*niter)->get_property(X_("id"), id);
|
||||
|
||||
|
||||
State state {id, name, (**niter)};
|
||||
group_states.push_back(state);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue