add edit drag-handle constraits, add plugin/attach dialog apply btn
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / plugindialog.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  */
21
22 #ifndef PLUGINDIALOG_H
23 #define PLUGINDIALOG_H
24
25 #include "bcdialog.h"
26 #include "condition.inc"
27 #include "guicast.h"
28 #include "mutex.inc"
29 #include "mwindow.inc"
30 #include "plugin.inc"
31 #include "plugindialog.inc"
32 #include "pluginserver.inc"
33 #include "sharedlocation.h"
34 #include "thread.h"
35 #include "track.inc"
36 #include "transition.inc"
37
38 class PluginDialogThread : public BC_DialogThread
39 {
40 public:
41         PluginDialogThread(MWindow *mwindow);
42         ~PluginDialogThread();
43
44 // Set up parameters for a transition menu.
45         void start_window(Track *track,
46                 Plugin *plugin,
47                 const char *title,
48                 int is_mainmenu,
49                 int data_type);
50         BC_Window* new_gui();
51         void handle_done_event(int result);
52         void handle_close_event(int result);
53         void apply();
54
55         MWindow *mwindow;
56         Track *track;
57         int data_type;
58         Transition *transition;
59 // Plugin being modified if there is one
60         Plugin *plugin;
61         char window_title[BCTEXTLEN];
62 // If attaching from main menu
63         int is_mainmenu;
64
65
66 // type of attached plugin
67         int plugin_type;    // 0: none  1: plugin   2: shared plugin   3: module
68
69 // location of attached plugin if shared
70         SharedLocation shared_location;
71
72 // Title of attached plugin if new
73         char plugin_title[BCTEXTLEN];
74 // For the main menu invocation,
75 // attach 1 standalone on the first track and share it with other tracks
76         int single_standalone;
77 };
78
79 class PluginDialogListItem : public BC_ListBoxItem
80 {
81 public:
82         PluginDialogListItem(const char *item, int n)
83          : BC_ListBoxItem(item), item_no(n) {}
84         int item_no;
85 };
86
87 class PluginDialog : public BC_Window
88 {
89 public:
90         PluginDialog(MWindow *mwindow,
91                 PluginDialogThread *thread,
92                 const char *title,
93                 int x,
94                 int y);
95         ~PluginDialog();
96
97         void create_objects();
98
99         int attach_new(int number);
100         int attach_shared(int number);
101         int attach_module(int number);
102         void save_settings();
103         int resize_event(int w, int h);
104         void load_plugin_list(int redraw);
105         void apply();
106
107         BC_Title *standalone_title;
108         PluginDialogNew *standalone_list;
109         BC_Title *shared_title;
110         PluginDialogShared *shared_list;
111         BC_Title *module_title;
112         PluginDialogModules *module_list;
113         PluginDialogSingle *single_standalone;
114         PluginDialogSearchText *search_text;
115         BC_OKButton *ok_btn;
116         BC_CancelButton *can_btn;
117         PluginDialogApply *apy_btn;
118         PluginDialogThread *thread;
119
120         ArrayList<BC_ListBoxItem*> standalone_data;
121         ArrayList<BC_ListBoxItem*> shared_data;
122         ArrayList<BC_ListBoxItem*> module_data;
123         ArrayList<SharedLocation*> plugin_locations; // locations of all shared plugins
124         ArrayList<SharedLocation*> module_locations; // locations of all shared modules
125         ArrayList<PluginServer*> plugindb;           // locations of all simple plugins, no need for memory freeing!
126
127         int selected_available;
128         int selected_shared;
129         int selected_modules;
130
131         MWindow *mwindow;
132 };
133
134
135 /*
136  * class PluginDialogTextBox : public BC_TextBox
137  * {
138  * public:
139  *      PluginDialogTextBox(PluginDialog *dialog, char *text, int x, int y);
140  *      ~PluginDialogTextBox();
141  *
142  *      int handle_event();
143  *      PluginDialog *dialog;
144  * };
145  */
146
147 /*
148  * class PluginDialogDetach : public BC_GenericButton
149  * {
150  * public:
151  *      PluginDialogDetach(MWindow *mwindow, PluginDialog *dialog, int x, int y);
152  *      ~PluginDialogDetach();
153  *
154  *      int handle_event();
155  *      PluginDialog *dialog;
156  * };
157  */
158
159 /*
160  * class PluginDialogAttachNew : public BC_GenericButton
161  * {
162  * public:
163  *      PluginDialogAttachNew(MWindow *mwindow, PluginDialog *dialog, int x, int y);
164  *      ~PluginDialogAttachNew();
165  *
166  *      int handle_event();
167  *      PluginDialog *dialog;
168  * };
169  *
170  * class PluginDialogChangeNew : public BC_GenericButton
171  * {
172  * public:
173  *    PluginDialogChangeNew(MWindow *mwindow, PluginDialog *dialog, int x, int y);
174  *    ~PluginDialogChangeNew();
175  *
176  *    int handle_event();
177  *    PluginDialog *dialog;
178  * };
179  */
180
181
182 class PluginDialogNew : public BC_ListBox
183 {
184 public:
185         PluginDialogNew(PluginDialog *dialog,
186                 ArrayList<BC_ListBoxItem*> *standalone_data,
187                 int x,
188                 int y,
189                 int w,
190                 int h);
191         ~PluginDialogNew();
192
193         int handle_event();
194         int selection_changed();
195         PluginDialog *dialog;
196 };
197
198 class PluginDialogShared : public BC_ListBox
199 {
200 public:
201         PluginDialogShared(PluginDialog *dialog,
202                 ArrayList<BC_ListBoxItem*> *shared_data,
203                 int x,
204                 int y,
205                 int w,
206                 int h);
207         ~PluginDialogShared();
208
209         int handle_event();
210         int selection_changed();
211         PluginDialog *dialog;
212 };
213
214 class PluginDialogModules : public BC_ListBox
215 {
216 public:
217         PluginDialogModules(PluginDialog *dialog,
218                 ArrayList<BC_ListBoxItem*> *module_data,
219                 int x,
220                 int y,
221                 int w,
222                 int h);
223         ~PluginDialogModules();
224
225         int handle_event();
226         int selection_changed();
227         PluginDialog *dialog;
228 };
229
230 class PluginDialogSingle : public BC_CheckBox
231 {
232 public:
233         PluginDialogSingle(PluginDialog *dialog, int x, int y);
234         int handle_event();
235         PluginDialog *dialog;
236 };
237
238 class PluginDialogSearchText : public BC_TextBox
239 {
240 public:
241         PluginDialogSearchText(PluginDialog *dialog, int x, int y, int w);
242         int handle_event();
243
244         PluginDialog *dialog;
245 };
246
247 class PluginDialogApply : public BC_GenericButton
248 {
249 public:
250         PluginDialogApply(PluginDialog *dialog, int x, int y);
251         int handle_event();
252
253         PluginDialog *dialog;
254 };
255 /*
256  * class PluginDialogAttachShared : public BC_GenericButton
257  * {
258  * public:
259  *      PluginDialogAttachShared(MWindow *mwindow, PluginDialog *dialog, int x, int y);
260  *      ~PluginDialogAttachShared();
261  *
262  *      int handle_event();
263  *      PluginDialog *dialog;
264  * };
265  *
266  * class PluginDialogChangeShared : public BC_GenericButton
267  * {
268  * public:
269  *    PluginDialogChangeShared(MWindow *mwindow, PluginDialog *dialog, int x, int y);
270  *    ~PluginDialogChangeShared();
271  *
272  *    int handle_event();
273  *    PluginDialog *dialog;
274  * };
275  *
276  *
277  * class PluginDialogAttachModule : public BC_GenericButton
278  * {
279  * public:
280  *      PluginDialogAttachModule(MWindow *mwindow, PluginDialog *dialog, int x, int y);
281  *      ~PluginDialogAttachModule();
282  *
283  *      int handle_event();
284  *      PluginDialog *dialog;
285  * };
286  *
287  * class PluginDialogChangeModule : public BC_GenericButton
288  * {
289  * public:
290  *    PluginDialogChangeModule(MWindow *mwindow, PluginDialog *dialog, int x, int y);
291  *    ~PluginDialogChangeModule();
292  *
293  *    int handle_event();
294  *    PluginDialog *dialog;
295  * }
296  */
297
298
299
300 #endif