Removed gtkmm.h usage.
[ardour.git] / gtk2_ardour / redirect_box.h
1 /*
2     Copyright (C) 2004 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     $Id$
19 */
20
21 #ifndef __ardour_gtk_redirect_box__
22 #define __ardour_gtk_redirect_box__
23
24 #include <vector>
25
26 #include <cmath>
27 #include <gtkmm.h>
28 #include <gtkmm2ext/auto_spin.h>
29 #include <gtkmm2ext/click_box.h>
30
31 #include <ardour/types.h>
32 #include <ardour/ardour.h>
33 #include <ardour/io.h>
34 #include <ardour/insert.h>
35 #include <ardour/stateful.h>
36 #include <ardour/redirect.h>
37
38 #include <pbd/fastlog.h>
39
40 #include "route_ui.h"
41 #include "io_selector.h"
42 #include "enums.h"
43
44 class MotionController;
45 class PluginSelector;
46 class RouteRedirectSelection;
47
48 namespace ARDOUR {
49         class Route;
50         class Send;
51         class Insert;
52         class Session;
53         class PortInsert;
54         class Connection;
55         class Plugin;
56 }
57
58
59 class RedirectBox : public Gtk::HBox
60 {
61   public:
62         RedirectBox (ARDOUR::Placement, ARDOUR::Session&, ARDOUR::Route &, PluginSelector &, RouteRedirectSelection &, bool owner_is_mixer = false);
63         ~RedirectBox ();
64
65         void set_width (Width);
66
67         void set_title (const std::string & title);
68         void set_title_shown (bool flag);
69         
70         void update();
71
72         void select_all_redirects ();
73         void deselect_all_redirects ();
74         void select_all_plugins ();
75         void select_all_inserts ();
76         void select_all_sends ();
77         
78         sigc::signal<void,ARDOUR::Redirect *> RedirectSelected;
79         sigc::signal<void,ARDOUR::Redirect *> RedirectUnselected;
80         
81   protected:
82         void set_stuff_from_route ();
83
84   private:
85         ARDOUR::Route &     _route;
86         ARDOUR::Session &   _session;
87         bool                _owner_is_mixer;
88
89         ARDOUR::Placement   _placement;
90
91         PluginSelector     & _plugin_selector;
92         RouteRedirectSelection  & _rr_selection;
93         
94         
95         Gtk::EventBox       redirect_eventbox;
96         Gtk::HBox           redirect_hpacker;
97         Gtk::TreeView       redirect_display;
98         Gtk::ScrolledWindow redirect_scroller;
99
100         Width _width;
101         
102         sigc::connection newplug_connection;
103         
104         Gtk::Menu *send_action_menu;
105         void build_send_action_menu ();
106
107         void new_send ();
108         void show_send_controls ();
109
110         Gtk::Menu *redirect_menu;
111         vector<Gtk::MenuItem*> selection_dependent_items;
112         Gtk::MenuItem* redirect_paste_item;
113         gint redirect_menu_map_handler (GdkEventAny *ev);
114         Gtk::Menu * build_redirect_menu (Gtk::TreeView&);
115         void build_redirect_tooltip (Gtk::TreeView&, Gtk::EventBox&, string);
116         void show_redirect_menu (gint arg);
117
118         void choose_send ();
119         void send_io_finished (IOSelector::Result, ARDOUR::Redirect*, IOSelectorWindow*);
120         void choose_insert ();
121         void choose_plugin ();
122         void insert_plugin_chosen (ARDOUR::Plugin *);
123
124         gint redirect_button (GdkEventButton *);
125         void redirects_changed (void *);
126         void show_redirect_active (ARDOUR::Redirect *, void *);
127         void show_redirect_name (void*, ARDOUR::Redirect *);
128         void add_redirect_to_display (ARDOUR::Redirect *);
129
130         void show_plugin_selector ();
131
132
133         string redirect_name (ARDOUR::Redirect&);
134
135
136         void remove_redirect_gui (ARDOUR::Redirect *);
137
138         void disconnect_newplug();
139
140         void redirects_reordered (gint, gint);
141         gint compute_redirect_sort_keys ();
142         vector<sigc::connection> redirect_active_connections;
143         vector<sigc::connection> redirect_name_connections;
144         
145         bool redirect_drag_in_progress;
146         void redirect_drag_begin (GdkDragContext*);
147         void redirect_drag_end (GdkDragContext*);
148         void all_redirects_active(bool state);
149
150         void cut_redirects ();
151         void copy_redirects ();
152         void paste_redirects ();
153         void clear_redirects ();
154         void clone_redirects ();
155         void rename_redirects ();
156
157         void for_selected_redirects (void (RedirectBox::*pmf)(ARDOUR::Redirect*));
158         void get_selected_redirects (vector<ARDOUR::Redirect*>&);
159
160         
161         void activate_redirect (ARDOUR::Redirect*);
162         void deactivate_redirect (ARDOUR::Redirect*);
163         void cut_redirect (ARDOUR::Redirect*);
164         void copy_redirect (ARDOUR::Redirect*);
165         void edit_redirect (ARDOUR::Redirect*);
166         void hide_redirect_editor (ARDOUR::Redirect*);
167         void rename_redirect (ARDOUR::Redirect*);
168
169         gint idle_delete_redirect (ARDOUR::Redirect *);
170
171         void wierd_plugin_dialog (ARDOUR::Plugin& p, uint32_t streams, ARDOUR::IO& io);
172
173 };
174
175 #endif /* __ardour_gtk_redirect_box__ */