rework crikey, fix uninited vars in listbox
[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
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         CriKeyWindow *gui;
98 };
99
100 class CriKeyDrag : public BC_CheckBox
101 {
102 public:
103         CriKeyDrag(CriKeyWindow *gui, int x, int y);
104
105         int handle_event();
106         CriKeyWindow *gui;
107 };
108
109 class CriKeyPointList : public BC_ListBox
110 {
111 public:
112         CriKeyPointList(CriKeyWindow *gui, CriKey *plugin, int x, int y);
113         ~CriKeyPointList();
114
115         int handle_event();
116         int selection_changed();
117         int column_resize_event();
118         ArrayList<BC_ListBoxItem*> cols[PT_SZ];
119         void clear();
120         void new_point(const char *ep, const char *xp, const char *yp,
121                 const char *tp, const char *tag);
122         void del_point(int i);
123         void set_point(int i, int c, float v);
124         void set_point(int i, int c, const char *cp);
125         int set_selected(int k);
126         void update(int k);
127         void update_list(int k);
128
129
130         CriKeyWindow *gui;
131         CriKey *plugin;
132         const char *titles[PT_SZ];
133         int widths[PT_SZ];
134 };
135
136 class CriKeyNewPoint : public BC_GenericButton
137 {
138 public:
139         CriKeyNewPoint(CriKeyWindow *gui, CriKey *plugin, int x, int y);
140         ~CriKeyNewPoint();
141
142         int handle_event();
143
144         CriKeyWindow *gui;
145         CriKey *plugin;
146 };
147
148 class CriKeyDelPoint : public BC_GenericButton
149 {
150 public:
151         CriKeyDelPoint(CriKeyWindow *gui, CriKey *plugin, int x, int y);
152         ~CriKeyDelPoint();
153
154         int handle_event();
155
156         CriKey *plugin;
157         CriKeyWindow *gui;
158 };
159
160 class CriKeyPointUp : public BC_GenericButton
161 {
162 public:
163         CriKeyPointUp(CriKeyWindow *gui, int x, int y);
164         ~CriKeyPointUp();
165
166         int handle_event();
167
168         CriKeyWindow *gui;
169 };
170
171 class CriKeyPointDn : public BC_GenericButton
172 {
173 public:
174         CriKeyPointDn(CriKeyWindow *gui, int x, int y);
175         ~CriKeyPointDn();
176
177         int handle_event();
178
179         CriKeyWindow *gui;
180 };
181
182 class CriKeyReset : public BC_GenericButton
183 {
184 public:
185         CriKeyReset(CriKeyWindow *gui, CriKey *plugin, int x, int y);
186         ~CriKeyReset();
187
188         int handle_event();
189
190         CriKey *plugin;
191         CriKeyWindow *gui;
192 };
193
194
195 class CriKeyWindow : public PluginClientWindow
196 {
197 public:
198         CriKeyWindow(CriKey *plugin);
199         ~CriKeyWindow();
200
201         void create_objects();
202         void update_gui();
203         void start_color_thread();
204         int grab_event(XEvent *event);
205         void done_event(int result);
206         int check_configure_change(int ret);
207         void send_configure_change();
208
209         CriKey *plugin;
210         CriKeyThreshold *threshold;
211         CriKeyDrawMode *draw_mode;
212
213         BC_Title *title_x, *title_y;
214         CriKeyPointX *point_x;
215         CriKeyPointY *point_y;
216         CriKeyNewPoint *new_point;
217         CriKeyDelPoint *del_point;
218         CriKeyPointUp *point_up;
219         CriKeyPointDn *point_dn;
220         int dragging, pending_config;
221         float last_x, last_y;
222         CriKeyDrag *drag;
223         CriKeyPointList *point_list;
224         CriKeyReset *reset;
225         BC_Title *notes;
226 };
227
228 #endif
229