20 #include <gtkmm/liststore.h>
44 _display.set_headers_visible (
false);
47 _scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
56 SessionHandlePtr::set_session (s);
66 if (
_display.get_selection()->count_selected_rows() > 0) {
68 TreeModel::iterator i =
_display.get_selection()->get_selected();
72 if (snap_name.length() == 0) {
87 if (ev->button == 3) {
90 Gtk::TreeModel::Path path;
91 Gtk::TreeViewColumn* col;
94 _display.get_path_at_pos ((
int) ev->x, (
int) ev->y, path, col, cx, cy);
95 Gtk::TreeModel::iterator iter =
_model->get_iter (path);
97 Gtk::TreeModel::Row row = *iter;
115 using namespace Menu_Helpers;
117 MenuList& items (
_menu.items());
126 _menu.popup (button, time);
136 prompter.set_name (
"Prompter");
137 prompter.set_title (
_(
"Rename Snapshot"));
138 prompter.add_button (Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
142 if (prompter.run() == RESPONSE_ACCEPT) {
144 if (new_name.length()) {
155 vector<string> choices;
157 std::string prompt =
string_compose (
_(
"Do you really want to remove snapshot \"%1\" ?\n(which cannot be undone)"), name);
159 choices.push_back (
_(
"No, do nothing."));
160 choices.push_back (
_(
"Yes, remove it."));
164 if (prompter.run () == 1) {
177 vector<std::string> state_file_paths;
182 if (state_file_paths.empty()) {
190 for (vector<string>::iterator i = state_file_names.begin(); i != state_file_names.end(); ++i)
192 string statename = (*i);
193 TreeModel::Row row = *(
_model->append());
200 display_name = statename;
203 _display.get_selection()->select(row);
const std::string root_path() const
void popup_context_menu(int, int32_t, std::string)
static ARDOUR_UI * instance()
void add_item_with_sensitivity(Gtk::Menu_Helpers::MenuList &, Gtk::Menu_Helpers::MenuElem, bool)
void set_initial_text(std::string txt)
void remove_state(std::string snapshot_name)
int load_session(const std::string &path, const std::string &snapshot, std::string mix_template=std::string())
void set_prompt(std::string prompt)
Gtk::TreeModelColumn< std::string > real_name
Glib::RefPtr< Gtk::ListStore > _model
LIBARDOUR_API std::vector< std::string > get_file_names_no_extension(const std::vector< std::string > &file_paths)
void get_result(std::string &str, bool strip=true)
std::string snap_name() const
EditorSnapshots(Editor *)
LIBARDOUR_API void get_state_files_in_directory(const std::string &directory_path, std::vector< std::string > &result)
Gtk::ScrolledWindow _scroller
void set_session(ARDOUR::Session *)
bool button_press(GdkEventButton *)
const SessionDirectory & session_directory() const
ARDOUR::Session * _session
void rename_state(std::string old_name, std::string new_name)
std::string string_compose(const std::string &fmt, const T1 &o1)
Gtk::TreeModelColumn< std::string > visible_name