Remove use of i18n macros in headers. Prevents our gettext.h being included before...
[ardour.git] / gtk2_ardour / bundle_manager.h
1 /*
2     Copyright (C) 2007 Paul Davis
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #ifndef __ardour_ui_bundle_manager_h__
21 #define __ardour_ui_bundle_manager_h__
22
23 #include <gtkmm/treeview.h>
24 #include <gtkmm/liststore.h>
25 #include <gtkmm/entry.h>
26 #include "ardour_dialog.h"
27 #include "port_matrix.h"
28
29 namespace ARDOUR {
30         class Session;
31         class Bundle;
32 }
33
34 class BundleEditorMatrix : public PortMatrix
35 {
36   public:
37         BundleEditorMatrix (Gtk::Window *, ARDOUR::Session *, boost::shared_ptr<ARDOUR::Bundle>);
38
39         void set_state (ARDOUR::BundleChannel c[2], bool s);
40         PortMatrixNode::State get_state (ARDOUR::BundleChannel c[2]) const;
41
42         bool can_add_channel (boost::shared_ptr<ARDOUR::Bundle>) const;
43
44         void add_channel (boost::shared_ptr<ARDOUR::Bundle>);
45         bool can_remove_channels (boost::shared_ptr<ARDOUR::Bundle>) const;
46         void remove_channel (ARDOUR::BundleChannel);
47         bool can_rename_channels (boost::shared_ptr<ARDOUR::Bundle>) const;
48         void rename_channel (ARDOUR::BundleChannel);
49         void setup_ports (int);
50         bool list_is_global (int) const;
51
52         std::string disassociation_verb () const;
53
54   private:
55         enum {
56                 OTHER = 0,
57                 OURS = 1
58         };
59
60         boost::shared_ptr<PortGroup> _port_group;
61         boost::shared_ptr<ARDOUR::Bundle> _bundle;
62 };
63
64 class BundleEditor : public ArdourDialog
65 {
66   public:
67         BundleEditor (ARDOUR::Session *, boost::shared_ptr<ARDOUR::UserBundle>);
68
69   protected:
70         void on_map ();
71
72   private:
73         void name_changed ();
74         void input_or_output_changed ();
75         void type_changed ();
76         void on_show ();
77
78         BundleEditorMatrix _matrix;
79         boost::shared_ptr<ARDOUR::UserBundle> _bundle;
80         Gtk::Entry _name;
81         Gtk::ComboBoxText _input_or_output;
82         Gtk::ComboBoxText _type;
83 };
84
85 class BundleManager : public ArdourDialog
86 {
87   public:
88         BundleManager (ARDOUR::Session *);
89
90   private:
91
92         void new_clicked ();
93         void edit_clicked ();
94         void delete_clicked ();
95         void add_bundle (boost::shared_ptr<ARDOUR::Bundle>);
96         void bundle_changed (ARDOUR::Bundle::Change, boost::shared_ptr<ARDOUR::UserBundle>);
97         void set_button_sensitivity ();
98         void row_activated (Gtk::TreeModel::Path const & p, Gtk::TreeViewColumn* c);
99
100         class ModelColumns : public Gtk::TreeModelColumnRecord
101         {
102         public:
103                 ModelColumns () {
104                         add (name);
105                         add (bundle);
106                 }
107
108                 Gtk::TreeModelColumn<Glib::ustring> name;
109                 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::UserBundle> > bundle;
110         };
111
112         Gtk::TreeView _tree_view;
113         Glib::RefPtr<Gtk::ListStore> _list_model;
114         ModelColumns _list_model_columns;
115         Gtk::Button edit_button;
116         Gtk::Button delete_button;
117         PBD::ScopedConnectionList bundle_connections;
118 };
119
120 class NameChannelDialog : public ArdourDialog
121 {
122 public:
123         NameChannelDialog ();
124         NameChannelDialog (boost::shared_ptr<ARDOUR::Bundle>, uint32_t);
125
126         std::string get_name () const;
127
128 private:
129
130         void setup ();
131
132         boost::shared_ptr<ARDOUR::Bundle> _bundle;
133         uint32_t _channel;
134         Gtk::Entry _name;
135         bool _adding;
136 };
137
138 #endif