RouteDialog: Move built-in types into template list experiment
[ardour.git] / gtk2_ardour / add_route_dialog.h
1 /*
2     Copyright (C) 2000-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 __gtk_ardour_add_route_dialog_h__
21 #define __gtk_ardour_add_route_dialog_h__
22
23 #include <string>
24
25 #include <gtkmm/entry.h>
26 #include <gtkmm/dialog.h>
27 #include <gtkmm/frame.h>
28 #include <gtkmm/radiobutton.h>
29 #include <gtkmm/adjustment.h>
30 #include <gtkmm/spinbutton.h>
31 #include <gtkmm/button.h>
32 #include <gtkmm/combobox.h>
33 #include <gtkmm/comboboxtext.h>
34 #include <gtkmm/textview.h>
35 #include <gtkmm/treemodel.h>
36 #include <gtkmm/treeview.h>
37 #include <gtkmm/treestore.h>
38 #include <gtkmm/liststore.h>
39 #include <gtkmm/scrolledwindow.h>
40
41 #include "ardour/plugin.h"
42 #include "ardour/types.h"
43 #include "ardour/template_utils.h"
44
45 #include "ardour_dialog.h"
46 #include "instrument_selector.h"
47 #include "route_dialogs.h"
48
49 class Editor;
50 class RouteGroupDialog;
51
52 class AddRouteDialog : public ArdourDialog
53 {
54 public:
55         AddRouteDialog ();
56         ~AddRouteDialog ();
57
58         enum ResponseId {
59                 Add,
60                 AddAndClose,
61         };
62
63         enum TypeWanted {
64                 AudioTrack,
65                 MidiTrack,
66                 MixedTrack,
67                 AudioBus,
68                 MidiBus,
69                 VCAMaster,
70         };
71         TypeWanted type_wanted();
72
73         ARDOUR::ChanCount channels ();
74         uint32_t channel_count ();
75         int count ();
76
77         std::string name_template () const;
78         bool name_template_is_default () const;
79         ARDOUR::PluginInfoPtr requested_instrument ();
80
81         ARDOUR::TrackMode mode();
82         ARDOUR::RouteGroup* route_group ();
83
84         RouteDialogs::InsertAt insert_at();
85         bool use_strict_io();
86
87         std::string get_template_path();
88
89 private:
90         Gtk::Entry name_template_entry;
91         Gtk::Adjustment routes_adjustment;
92         Gtk::SpinButton routes_spinner;
93         Gtk::ComboBoxText channel_combo;
94         Gtk::Label configuration_label;
95         Gtk::Label manual_label;
96         Gtk::Label add_label;
97         Gtk::Label name_label;
98         Gtk::Label group_label;
99         Gtk::Label insert_label;
100         Gtk::Label strict_io_label;
101         Gtk::Label mode_label;
102         Gtk::Label instrument_label;
103         Gtk::ComboBoxText mode_combo;
104         Gtk::ComboBoxText route_group_combo;
105         InstrumentSelector instrument_combo;
106         Gtk::ComboBoxText insert_at_combo;
107         Gtk::ComboBoxText strict_io_combo;
108
109         void track_type_chosen ();
110         void refill_channel_setups ();
111         void refill_route_groups ();
112         void refill_track_modes ();
113         void add_route_group (ARDOUR::RouteGroup *);
114         void group_changed ();
115         void channel_combo_changed ();
116         bool channel_separator (const Glib::RefPtr<Gtk::TreeModel> &m, const Gtk::TreeModel::iterator &i);
117         bool route_separator (const Glib::RefPtr<Gtk::TreeModel> &m, const Gtk::TreeModel::iterator &i);
118         void maybe_update_name_template_entry ();
119
120         struct TrackTemplateColumns : public Gtk::TreeModel::ColumnRecord {
121                 TrackTemplateColumns () {
122                         add (name);
123                         add (path);
124                         add (description);
125                         add (created_with);
126                 }
127
128                 Gtk::TreeModelColumn<std::string> name;
129                 Gtk::TreeModelColumn<std::string> path;
130                 Gtk::TreeModelColumn<std::string> description;
131                 Gtk::TreeModelColumn<std::string> created_with;
132         };
133
134         TrackTemplateColumns track_template_columns;
135
136     Glib::RefPtr<Gtk::TreeStore>  trk_template_model;
137     Gtk::TreeView                 trk_template_chooser;
138
139         void trk_template_row_selected ();
140
141         Gtk::TextView trk_template_desc;
142         Gtk::Frame    trk_template_desc_frame;
143
144         void reset_template_option_visibility ();
145         void new_group_dialog_finished (int, RouteGroupDialog*);
146         void on_show ();
147         void on_response (int);
148
149         struct ChannelSetup {
150                 std::string name;
151                 uint32_t    channels;
152         };
153
154         typedef std::vector<ChannelSetup> ChannelSetups;
155         ChannelSetups channel_setups;
156
157         static std::vector<std::string> builtin_types;
158         static std::vector<std::string> channel_combo_strings;
159         static std::vector<std::string> bus_mode_strings;
160
161         bool name_edited_by_user;
162         void name_template_entry_insertion (Glib::ustring const &,int*);
163         void name_template_entry_deletion (int, int);
164 };
165
166 #endif /* __gtk_ardour_add_route_dialog_h__ */