revert last fix - its not relevant to 3.0 (yet)
[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 "ardour_dialog.h"
26 #include "port_matrix.h"
27
28 namespace ARDOUR {
29         class Session;
30         class Bundle;
31 }
32
33 class BundleEditorMatrix : public PortMatrix
34 {
35   public:
36         BundleEditorMatrix (ARDOUR::Session &, boost::shared_ptr<ARDOUR::Bundle>);
37
38         void set_state (int, std::string const &, bool, uint32_t);
39         bool get_state (int, std::string const &) const;
40         uint32_t n_rows () const;
41         uint32_t maximum_rows () const;
42         uint32_t minimum_rows () const;
43         std::string row_name (int) const;
44         void add_row ();
45         void remove_row (int);
46         std::string row_descriptor () const;
47
48   private:
49
50         boost::shared_ptr<ARDOUR::UserBundle> _bundle;
51 };
52
53 class BundleEditor : public ArdourDialog
54 {
55   public:
56         BundleEditor (ARDOUR::Session &, boost::shared_ptr<ARDOUR::UserBundle>, bool);
57
58   protected:
59         void on_map ();
60
61   private:
62         void name_changed ();
63         void input_or_output_changed ();
64         void type_changed ();
65         
66         BundleEditorMatrix _matrix;
67         boost::shared_ptr<ARDOUR::UserBundle> _bundle;
68         Gtk::Entry _name;
69         Gtk::ComboBoxText _input_or_output;
70         Gtk::ComboBoxText _type;
71 };
72
73 class BundleManager : public ArdourDialog
74 {
75   public:
76         BundleManager (ARDOUR::Session &);
77
78   private:
79
80         void new_clicked ();
81         void edit_clicked ();
82         void delete_clicked ();
83         void add_bundle (boost::shared_ptr<ARDOUR::Bundle>);
84         void bundle_name_changed (boost::shared_ptr<ARDOUR::UserBundle>);
85         void set_button_sensitivity ();
86
87         class ModelColumns : public Gtk::TreeModelColumnRecord
88         {
89         public:
90                 ModelColumns () {
91                         add (name);
92                         add (bundle);
93                 }
94                 
95                 Gtk::TreeModelColumn<Glib::ustring> name;
96                 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::UserBundle> > bundle;
97         };
98         
99         Gtk::TreeView _tree_view;
100         Glib::RefPtr<Gtk::ListStore> _list_model;
101         ModelColumns _list_model_columns;
102         ARDOUR::Session& _session;
103         Gtk::Button edit_button;
104         Gtk::Button delete_button;
105 };
106
107 #endif