More port matrix re-working. Global matrix now has separate visibility buttons
[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 (ARDOUR::Session &, boost::shared_ptr<ARDOUR::Bundle>);
38
39         void set_state (ARDOUR::BundleChannel c[2], bool s);
40         State get_state (ARDOUR::BundleChannel c[2]) const;
41         void add_channel (boost::shared_ptr<ARDOUR::Bundle>);
42         bool can_remove_channels (int d) const {
43                 return d == OURS;
44         }
45         void remove_channel (ARDOUR::BundleChannel);
46         bool can_rename_channels (int d) const {
47                 return d == OURS;
48         }
49         void rename_channel (ARDOUR::BundleChannel);
50         void setup ();
51
52   private:
53         enum {
54                 OTHER = 0,
55                 OURS = 1
56         };
57                 
58         boost::shared_ptr<PortGroup> _port_group;
59         boost::shared_ptr<ARDOUR::Bundle> _bundle;
60 };
61
62 class BundleEditor : public ArdourDialog
63 {
64   public:
65         BundleEditor (ARDOUR::Session &, boost::shared_ptr<ARDOUR::UserBundle>, bool);
66
67   protected:
68         void on_map ();
69
70   private:
71         void name_changed ();
72         void input_or_output_changed ();
73         void type_changed ();
74         
75         BundleEditorMatrix _matrix;
76         boost::shared_ptr<ARDOUR::UserBundle> _bundle;
77         Gtk::Entry _name;
78         Gtk::ComboBoxText _input_or_output;
79         Gtk::ComboBoxText _type;
80 };
81
82 class BundleManager : public ArdourDialog
83 {
84   public:
85         BundleManager (ARDOUR::Session &);
86
87   private:
88
89         void new_clicked ();
90         void edit_clicked ();
91         void delete_clicked ();
92         void add_bundle (boost::shared_ptr<ARDOUR::Bundle>);
93         void bundle_name_changed (boost::shared_ptr<ARDOUR::UserBundle>);
94         void set_button_sensitivity ();
95
96         class ModelColumns : public Gtk::TreeModelColumnRecord
97         {
98         public:
99                 ModelColumns () {
100                         add (name);
101                         add (bundle);
102                 }
103                 
104                 Gtk::TreeModelColumn<Glib::ustring> name;
105                 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::UserBundle> > bundle;
106         };
107         
108         Gtk::TreeView _tree_view;
109         Glib::RefPtr<Gtk::ListStore> _list_model;
110         ModelColumns _list_model_columns;
111         ARDOUR::Session& _session;
112         Gtk::Button edit_button;
113         Gtk::Button delete_button;
114 };
115
116 class NameChannelDialog : public ArdourDialog
117 {
118 public:
119         NameChannelDialog ();
120         NameChannelDialog (boost::shared_ptr<ARDOUR::Bundle>, uint32_t);
121
122         std::string get_name () const;
123
124 private:
125
126         void setup ();
127         
128         boost::shared_ptr<ARDOUR::Bundle> _bundle;
129         uint32_t _channel;
130         Gtk::Entry _name;
131         bool _adding;
132 };
133
134 #endif