e720a630b385c629a2aa56b5e53348e7f342a865
[ardour.git] / gtk2_ardour / io_selector.h
1 /*
2     Copyright (C) 2002-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_io_selector_h__
21 #define __ardour_ui_io_selector_h__
22
23 #include "ardour_dialog.h"
24 #include "port_matrix.h"
25
26 class IOSelector : public PortMatrix {
27   public:
28         IOSelector (ARDOUR::Session&, boost::shared_ptr<ARDOUR::IO>, bool);
29
30         void set_state (int, std::string const &, bool);
31         bool get_state (int, std::string const &) const;
32         uint32_t n_rows () const;
33         uint32_t maximum_rows () const;
34         uint32_t minimum_rows () const;
35         std::string row_name (int) const;
36         void add_row ();
37         void remove_row (int);
38         std::string row_descriptor () const;
39         boost::shared_ptr<ARDOUR::IO> const io() { return _io; }
40
41   private:
42         boost::shared_ptr<ARDOUR::IO> _io;
43         
44         void ports_changed (ARDOUR::IOChange, void*);
45 };
46
47 class IOSelectorWindow : public ArdourDialog
48 {
49   public:
50         IOSelectorWindow (ARDOUR::Session&, boost::shared_ptr<ARDOUR::IO>, bool for_input, bool can_cancel = false);
51         ~IOSelectorWindow ();
52
53         IOSelector& selector() { return _selector; }
54
55   protected:
56         void on_map ();
57         
58   private:
59         IOSelector _selector;
60
61         /* overall operation buttons */
62
63         Gtk::Button add_button;
64         Gtk::Button ok_button;
65         Gtk::Button cancel_button;
66         Gtk::Button rescan_button;
67
68         void rescan ();
69         void cancel ();
70         void accept ();
71
72         void ports_changed (ARDOUR::IOChange change, void *src);
73         void io_name_changed (void *src);
74 };
75
76
77 class PortInsertUI : public Gtk::VBox
78 {
79   public: 
80         PortInsertUI (ARDOUR::Session&, boost::shared_ptr<ARDOUR::PortInsert>);
81         
82         void redisplay ();
83         void finished (IOSelector::Result);
84
85   private:
86         Gtk::HBox hbox;
87         IOSelector input_selector;
88         IOSelector output_selector;
89 };
90
91 class PortInsertWindow : public ArdourDialog
92 {
93   public: 
94         PortInsertWindow (ARDOUR::Session&, boost::shared_ptr<ARDOUR::PortInsert>, bool can_cancel = false);
95         
96   protected:
97         void on_map ();
98         
99   private:
100         PortInsertUI _portinsertui;
101         Gtk::VBox vbox;
102         
103         Gtk::Button ok_button;
104         Gtk::Button cancel_button;
105         Gtk::Button rescan_button;
106         Gtk::Frame button_frame;
107         
108         void rescan ();
109         void cancel ();
110         void accept ();
111
112         void plugin_going_away ();
113         sigc::connection going_away_connection;
114 };
115
116
117 #endif