01ab8d5a8b54ea13dacedd73c31e78e451e13a75
[goodguy/history.git] / cinelerra-5.1 / plugins / crikey / crikeywindow.h
1 /*
2  * CINELERRA
3  * Copyright (C) 2008-2015 Adam Williams <broadcast at earthling dot net>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  *
19  */
20
21 #ifndef __CRIKEYWINDOW_H__
22 #define __CRIKEYWINDOW_H__
23
24 #include "guicast.h"
25 #include "colorpicker.h"
26
27 class CriKey;
28 class CriKeyWindow;
29 class CriKeyNum;
30 class CriKeyPointX;
31 class CriKeyPointY;
32 class CriKeyColorButton;
33 class CriKeyColorPicker;
34 class CriKeyDrawMode;
35 class CriKeyDrawModeItem;
36 class CriKeyThreshold;
37 class CriKeyDrag;
38 class CriKeyPoints;
39 class CriKeyNewPoint;
40 class CriKeyDelPoint;
41 class CriKeyPointUp;
42 class CriKeyPointDn;
43 class CriKeyCurPoint;
44
45
46 class CriKeyNum : public BC_TumbleTextBox
47 {
48 public:
49         CriKeyWindow *gui;
50
51         CriKeyNum(CriKeyWindow *gui, int x, int y, float output);
52         ~CriKeyNum();
53 };
54 class CriKeyPointX : public CriKeyNum
55 {
56 public:
57         CriKeyPointX(CriKeyWindow *gui, int x, int y, float output)
58          : CriKeyNum(gui, x, y, output) {}
59         ~CriKeyPointX() {}
60
61         int handle_event();
62 };
63 class CriKeyPointY : public CriKeyNum
64 {
65 public:
66         CriKeyPointY(CriKeyWindow *gui, int x, int y, float output)
67          : CriKeyNum(gui, x, y, output) {}
68         ~CriKeyPointY() {}
69
70         int handle_event();
71 };
72
73 class CriKeyColorButton : public BC_GenericButton
74 {
75 public:
76         CriKeyColorButton(CriKeyWindow *gui, int x, int y);
77
78         int handle_event();
79         CriKeyWindow *gui;
80 };
81
82 class CriKeyColorPicker : public ColorPicker
83 {
84 public:
85         CriKeyColorPicker(CriKeyColorButton *color_button);
86
87         void start(int color);
88         int handle_new_color(int color, int alpha);
89         void handle_done_event(int result);
90
91         CriKeyColorButton *color_button;
92         int color, orig_color;
93 };
94
95 class CriKeyDrawMode : public BC_PopupMenu
96 {
97         const char *draw_modes[DRAW_MODES];
98 public:
99         CriKeyDrawMode(CriKeyWindow *gui, int x, int y);
100
101         void create_objects();
102         void update(int mode, int send=1);
103         CriKeyWindow *gui;
104         int mode;
105 };
106 class CriKeyDrawModeItem : public BC_MenuItem
107 {
108 public:
109         CriKeyDrawModeItem(const char *txt, int id)
110         : BC_MenuItem(txt) { this->id = id; }
111
112         int handle_event();
113         CriKeyWindow *gui;
114         int id;
115 };
116
117 class CriKeyThreshold : public BC_FSlider
118 {
119 public:
120         CriKeyThreshold(CriKeyWindow *gui, int x, int y, int w);
121         int handle_event();
122         CriKeyWindow *gui;
123 };
124
125 class CriKeyDrag : public BC_CheckBox
126 {
127 public:
128         CriKeyDrag(CriKeyWindow *gui, int x, int y);
129
130         int handle_event();
131         CriKeyWindow *gui;
132 };
133
134 class CriKeyPoints : public BC_ListBox
135 {
136 public:
137         CriKeyPoints(CriKeyWindow *gui, CriKey *plugin, int x, int y);
138         ~CriKeyPoints();
139
140         int handle_event();
141         int selection_changed();
142         int column_resize_event();
143         ArrayList<BC_ListBoxItem*> cols[PT_SZ];
144         void clear();
145         void new_point(const char *ep, const char *xp, const char *yp, const char *tp);
146         void del_point(int i);
147         void set_point(int i, int c, float v);
148         void set_point(int i, int c, const char *cp);
149         int set_selected(int k);
150         void update_list();
151         void update(int k);
152
153
154         CriKeyWindow *gui;
155         CriKey *plugin;
156         const char *titles[PT_SZ];
157         int widths[PT_SZ];
158 };
159
160 class CriKeyNewPoint : public BC_GenericButton
161 {
162 public:
163         CriKeyNewPoint(CriKeyWindow *gui, CriKey *plugin, int x, int y);
164         ~CriKeyNewPoint();
165
166         int handle_event();
167
168         CriKeyWindow *gui;
169         CriKey *plugin;
170 };
171
172 class CriKeyDelPoint : public BC_GenericButton
173 {
174 public:
175         CriKeyDelPoint(CriKeyWindow *gui, CriKey *plugin, int x, int y);
176         ~CriKeyDelPoint();
177
178         int handle_event();
179
180         CriKey *plugin;
181         CriKeyWindow *gui;
182 };
183
184 class CriKeyPointUp : public BC_GenericButton
185 {
186 public:
187         CriKeyPointUp(CriKeyWindow *gui, int x, int y);
188         ~CriKeyPointUp();
189
190         int handle_event();
191
192         CriKeyWindow *gui;
193 };
194
195 class CriKeyPointDn : public BC_GenericButton
196 {
197 public:
198         CriKeyPointDn(CriKeyWindow *gui, int x, int y);
199         ~CriKeyPointDn();
200
201         int handle_event();
202
203         CriKeyWindow *gui;
204 };
205
206 class CriKeyCurPoint : public BC_Title
207 {
208 public:
209         CriKeyCurPoint(CriKeyWindow *gui, CriKey *plugin, int x, int y);
210         ~CriKeyCurPoint();
211
212         void update(int n);
213
214         CriKey *plugin;
215         CriKeyWindow *gui;
216 };
217
218 class CriKeyWindow : public PluginClientWindow
219 {
220 public:
221         CriKeyWindow(CriKey *plugin);
222         ~CriKeyWindow();
223
224         void create_objects();
225         void update_color(int color);
226         void update_gui();
227         void start_color_thread();
228         int grab_event(XEvent *event);
229         void done_event(int result);
230         int check_configure_change(int ret);
231         void send_configure_change();
232
233         CriKey *plugin;
234         CriKeyThreshold *threshold;
235         CriKeyDrawMode *draw_mode;
236
237         CriKeyColorButton *color_button;
238         CriKeyColorPicker *color_picker;
239         int color_x, color_y;
240         BC_Title *title_x, *title_y;
241         CriKeyPointX *point_x;
242         CriKeyPointY *point_y;
243         CriKeyNewPoint *new_point;
244         CriKeyDelPoint *del_point;
245         CriKeyPointUp *point_up;
246         CriKeyPointDn *point_dn;
247         CriKeyCurPoint *cur_point;
248         int dragging, pending_config;
249         float last_x, last_y;
250         CriKeyDrag *drag;
251         CriKeyPoints *points;
252 };
253
254 #endif
255