3e897f80e0b22fd71ac23d6fe582773ecd0baff8
[goodguy/cinelerra.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
26 class CriKey;
27 class CriKeyWindow;
28 class CriKeyNum;
29 class CriKeyPointX;
30 class CriKeyPointY;
31 class CriKeyDrawMode;
32 class CriKeyDrawModeItem;
33 class CriKeyThreshold;
34 class CriKeyDrag;
35 class CriKeyPointList;
36 class CriKeyNewPoint;
37 class CriKeyDelPoint;
38 class CriKeyPointUp;
39 class CriKeyPointDn;
40 class CriKeyReset;
41
42
43 class CriKeyNum : public BC_TumbleTextBox
44 {
45 public:
46         CriKeyWindow *gui;
47
48         CriKeyNum(CriKeyWindow *gui, int x, int y, float output);
49         ~CriKeyNum();
50 };
51 class CriKeyPointX : public CriKeyNum
52 {
53 public:
54         CriKeyPointX(CriKeyWindow *gui, int x, int y, float output)
55          : CriKeyNum(gui, x, y, output) {}
56         ~CriKeyPointX() {}
57
58         int handle_event();
59 };
60 class CriKeyPointY : public CriKeyNum
61 {
62 public:
63         CriKeyPointY(CriKeyWindow *gui, int x, int y, float output)
64          : CriKeyNum(gui, x, y, output) {}
65         ~CriKeyPointY() {}
66
67         int handle_event();
68 };
69
70 class CriKeyDrawMode : public BC_PopupMenu
71 {
72         const char *draw_modes[DRAW_MODES];
73 public:
74         CriKeyDrawMode(CriKeyWindow *gui, int x, int y);
75
76         void create_objects();
77         void update(int mode, int send=1);
78         CriKeyWindow *gui;
79         int mode;
80 };
81 class CriKeyDrawModeItem : public BC_MenuItem
82 {
83 public:
84         CriKeyDrawModeItem(const char *txt, int id)
85         : BC_MenuItem(txt) { this->id = id; }
86
87         int handle_event();
88         CriKeyWindow *gui;
89         int id;
90 };
91
92 class CriKeyThreshold : public BC_FSlider
93 {
94 public:
95         CriKeyThreshold(CriKeyWindow *gui, int x, int y, int w);
96         int handle_event();
97         int wheel_event(int v);
98         CriKeyWindow *gui;
99 };
100
101 class CriKeyDrag : public BC_CheckBox
102 {
103 public:
104         CriKeyDrag(CriKeyWindow *gui, int x, int y);
105
106         int handle_event();
107         CriKeyWindow *gui;
108 };
109
110 class CriKeyPointList : public BC_ListBox
111 {
112 public:
113         CriKeyPointList(CriKeyWindow *gui, CriKey *plugin, int x, int y);
114         ~CriKeyPointList();
115
116         int handle_event();
117         int selection_changed();
118         int column_resize_event();
119         ArrayList<BC_ListBoxItem*> cols[PT_SZ];
120         void clear();
121         void new_point(const char *ep, const char *xp, const char *yp,
122                 const char *tp, const char *tag);
123         void del_point(int i);
124         void set_point(int i, int c, float v);
125         void set_point(int i, int c, const char *cp);
126         int set_selected(int k);
127         void update(int k);
128         void update_list(int k);
129
130
131         CriKeyWindow *gui;
132         CriKey *plugin;
133         const char *titles[PT_SZ];
134         int widths[PT_SZ];
135 };
136
137 class CriKeyNewPoint : public BC_GenericButton
138 {
139 public:
140         CriKeyNewPoint(CriKeyWindow *gui, CriKey *plugin, int x, int y);
141         ~CriKeyNewPoint();
142
143         int handle_event();
144
145         CriKeyWindow *gui;
146         CriKey *plugin;
147 };
148
149 class CriKeyDelPoint : public BC_GenericButton
150 {
151 public:
152         CriKeyDelPoint(CriKeyWindow *gui, CriKey *plugin, int x, int y);
153         ~CriKeyDelPoint();
154
155         int handle_event();
156
157         CriKey *plugin;
158         CriKeyWindow *gui;
159 };
160
161 class CriKeyPointUp : public BC_GenericButton
162 {
163 public:
164         CriKeyPointUp(CriKeyWindow *gui, int x, int y);
165         ~CriKeyPointUp();
166
167         int handle_event();
168
169         CriKeyWindow *gui;
170 };
171
172 class CriKeyPointDn : public BC_GenericButton
173 {
174 public:
175         CriKeyPointDn(CriKeyWindow *gui, int x, int y);
176         ~CriKeyPointDn();
177
178         int handle_event();
179
180         CriKeyWindow *gui;
181 };
182
183 class CriKeyReset : public BC_GenericButton
184 {
185 public:
186         CriKeyReset(CriKeyWindow *gui, CriKey *plugin, int x, int y);
187         ~CriKeyReset();
188
189         int handle_event();
190
191         CriKey *plugin;
192         CriKeyWindow *gui;
193 };
194
195
196 class CriKeyWindow : public PluginClientWindow
197 {
198 public:
199         CriKeyWindow(CriKey *plugin);
200         ~CriKeyWindow();
201
202         void create_objects();
203         void update_gui();
204         void start_color_thread();
205         int grab_event(XEvent *event);
206         int do_grab_event(XEvent *event);
207         void done_event(int result);
208         void send_configure_change();
209
210         CriKey *plugin;
211         CriKeyThreshold *threshold;
212         CriKeyDrawMode *draw_mode;
213
214         BC_Title *title_x, *title_y;
215         CriKeyPointX *point_x;
216         CriKeyPointY *point_y;
217         CriKeyNewPoint *new_point;
218         CriKeyDelPoint *del_point;
219         CriKeyPointUp *point_up;
220         CriKeyPointDn *point_dn;
221         int dragging, pending_config;
222         float last_x, last_y;
223         CriKeyDrag *drag;
224         CriKeyPointList *point_list;
225         CriKeyReset *reset;
226         BC_Title *notes;
227 };
228
229 #endif
230