2 Copyright (C) 2010 Paul Davis
3 Author: Johannes Mueller
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #ifndef __gtk2_ardour_template_dialog_h__
22 #define __gtk2_ardour_template_dialog_h__
26 #include <gtkmm/liststore.h>
27 #include <gtkmm/progressbar.h>
28 #include <gtkmm/treeview.h>
30 #include "ardour_dialog.h"
31 #include "progress_reporter.h"
40 class TemplateDialog : public ArdourDialog,
41 public PBD::ScopedConnectionList
48 class TemplateManager : public Gtk::HBox,
49 public ProgressReporter
52 virtual ~TemplateManager () {}
53 virtual void init () = 0;
55 PBD::Signal0<void> TemplatesImported;
60 void setup_model (const std::vector<ARDOUR::TemplateInfo>& templates);
62 void row_selection_changed ();
63 void render_template_names (Gtk::CellRenderer* rnd, const Gtk::TreeModel::iterator& it);
64 void validate_edit (const Glib::ustring& path_string, const Glib::ustring& new_name);
67 bool key_event (GdkEventKey* ev);
69 virtual void rename_template (Gtk::TreeModel::iterator& item, const Glib::ustring& new_name) = 0;
70 virtual void delete_selected_template () = 0;
72 void export_all_templates ();
73 void import_template_set ();
75 virtual std::string templates_dir () const = 0;
77 virtual bool adjust_xml_tree (XMLTree& tree, const std::string& old_name, const std::string& new_name) const = 0;
79 bool adjust_plugin_paths (XMLNode* node, const std::string& name, const std::string& new_name) const;
81 struct SessionTemplateColumns : public Gtk::TreeModel::ColumnRecord {
82 SessionTemplateColumns () {
87 Gtk::TreeModelColumn<std::string> name;
88 Gtk::TreeModelColumn<std::string> path;
91 SessionTemplateColumns _template_columns;
92 Glib::RefPtr<Gtk::ListStore> _template_model;
94 Gtk::TreeView _template_treeview;
95 Gtk::CellRendererText _validating_cellrenderer;
96 Gtk::TreeView::Column _validated_column;
98 Gtk::Button _remove_button;
99 Gtk::Button _rename_button;
101 Gtk::Button _export_all_templates_button;
102 Gtk::Button _import_template_set_button;
104 Gtk::ProgressBar _progress_bar;
105 std::string _current_action;
107 void update_progress_gui (float p);
110 class SessionTemplateManager : public TemplateManager
113 SessionTemplateManager () : TemplateManager () {}
114 ~SessionTemplateManager () {}
119 void rename_template (Gtk::TreeModel::iterator& item, const Glib::ustring& new_name);
120 void delete_selected_template ();
122 std::string templates_dir () const;
124 bool adjust_xml_tree (XMLTree& tree, const std::string& old_name, const std::string& new_name) const;
128 class RouteTemplateManager : public TemplateManager
131 RouteTemplateManager () : TemplateManager () {}
132 ~RouteTemplateManager () {}
137 void rename_template (Gtk::TreeModel::iterator& item, const Glib::ustring& new_name);
138 void delete_selected_template ();
140 std::string templates_dir () const;
142 bool adjust_xml_tree (XMLTree& tree, const std::string& old_name, const std::string& new_name) const;
146 #endif /* __gtk2_ardour_template_dialog_h__ */