fb2b01e73da769598f8d687143c9f4fd951e14df
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / histogram / histogramwindow.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 1997-2011 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 HISTOGRAMWINDOW_H
23 #define HISTOGRAMWINDOW_H
24
25
26
27 #include "histogram.inc"
28 #include "histogramwindow.inc"
29 #include "pluginvclient.h"
30
31
32
33 class HistogramSlider : public BC_SubWindow
34 {
35 public:
36         HistogramSlider(HistogramMain *plugin,
37                 HistogramWindow *gui,
38                 int x,
39                 int y,
40                 int w,
41                 int h,
42                 int is_input);
43
44         void update();
45         int input_to_pixel(float input);
46
47         int operation;
48         enum
49         {
50                 NONE,
51                 DRAG_INPUT,
52                 DRAG_MIN_OUTPUT,
53                 DRAG_MAX_OUTPUT,
54         };
55         int is_input;
56         HistogramMain *plugin;
57         HistogramWindow *gui;
58 };
59
60 class HistogramParade : public BC_Toggle
61 {
62 public:
63         HistogramParade(HistogramMain *plugin,
64                 HistogramWindow *gui,
65                 int x,
66                 int y,
67                 int value);
68         int handle_event();
69         HistogramMain *plugin;
70         HistogramWindow *gui;
71         int value;
72 };
73
74 class HistogramCarrot : public BC_Toggle
75 {
76 public:
77         HistogramCarrot(HistogramMain *plugin, HistogramWindow *gui, int x, int y);
78         virtual ~HistogramCarrot();
79
80         void update();
81         float* get_value();
82         int cursor_motion_event();
83         int button_release_event();
84         int button_press_event();
85
86         int starting_x;
87         int offset_x;
88         int offset_y;
89         int drag_operation;
90         HistogramMain *plugin;
91         HistogramWindow *gui;
92 };
93
94
95 class HistogramAuto : public BC_CheckBox
96 {
97 public:
98         HistogramAuto(HistogramMain *plugin, int x, int y);
99         int handle_event();
100         HistogramMain *plugin;
101 };
102
103 class HistogramPlot : public BC_CheckBox
104 {
105 public:
106         HistogramPlot(HistogramMain *plugin, int x, int y);
107         int handle_event();
108         HistogramMain *plugin;
109 };
110
111 class HistogramSplit : public BC_CheckBox
112 {
113 public:
114         HistogramSplit(HistogramMain *plugin, int x, int y);
115         int handle_event();
116         HistogramMain *plugin;
117 };
118
119 class HistogramMode : public BC_Radial
120 {
121 public:
122         HistogramMode(HistogramMain *plugin, int x, int y, int value,
123                 char *text);
124         int handle_event();
125         HistogramMain *plugin;
126         int value;
127 };
128
129 class HistogramReset : public BC_GenericButton
130 {
131 public:
132         HistogramReset(HistogramMain *plugin, int x, int y);
133         int handle_event();
134         HistogramMain *plugin;
135 };
136
137 class HistogramSelect : public BC_GenericButton
138 {
139 public:
140         HistogramSelect(HistogramMain *plugin, HistogramWindow *gui, int x, int y);
141         int handle_event();
142         HistogramMain *plugin;
143         HistogramWindow *gui;
144 };
145
146 class HistogramClearFrames : public BC_Button
147 {
148 public:
149         HistogramClearFrames(HistogramMain *plugin, HistogramWindow *gui, int x, int y);
150         int handle_event();
151         HistogramMain *plugin;
152         HistogramWindow *gui;
153 };
154
155 class HistogramLogSlider : public BC_FSlider
156 {
157 public:
158         HistogramLogSlider(HistogramMain *plugin, HistogramWindow *gui, int x, int y);
159         int handle_event();
160         HistogramMain *plugin;
161         HistogramWindow *gui;
162 };
163
164 class HistogramFrames : public BC_TumbleTextBox
165 {
166 public:
167         HistogramFrames(HistogramMain *plugin, HistogramWindow *gui, int x, int y);
168         int handle_event();
169         void update(int frames);
170
171         HistogramMain *plugin;
172         HistogramWindow *gui;
173 };
174
175 class HistogramText : public BC_TumbleTextBox
176 {
177 public:
178         HistogramText(HistogramMain *plugin,
179                 HistogramWindow *gui, int x, int y,
180                 float hist_min = HIST_MIN_INPUT,
181                 float hist_max = HIST_MAX_INPUT);
182
183         int handle_event();
184         void update();
185         float* get_value();
186
187         HistogramMain *plugin;
188         HistogramWindow *gui;
189 };
190
191 class HistogramCanvas : public BC_SubWindow
192 {
193 public:
194         HistogramCanvas(HistogramMain *plugin, HistogramWindow *gui,
195                         int x, int y, int w, int h);
196         int button_press_event();
197         int cursor_motion_event();
198         int button_release_event();
199         HistogramMain *plugin;
200         HistogramWindow *gui;
201 };
202
203 class HistogramWindow : public PluginClientWindow
204 {
205 public:
206         HistogramWindow(HistogramMain *plugin);
207         ~HistogramWindow();
208
209         void create_objects();
210         void update(int do_canvases, int do_carrots, int do_text, int do_toggles);
211         void draw_canvas_mode(int mode, int color, int y, int h);
212         void update_canvas();
213         int keypress_event();
214         int resize_event(int w, int h);
215
216         void get_point_extents(HistogramPoint *current,
217                         int *x1, int *y1, int *x2, int *y2, int *x, int *y);
218
219         HistogramSlider *output;
220         HistogramAuto *automatic;
221         HistogramMode *mode_v, *mode_r, *mode_g, *mode_b /*,  *mode_a */;
222         HistogramParade *parade_on, *parade_off;
223         HistogramText *low_output;
224         HistogramText *high_output;
225         HistogramText *threshold;
226         HistogramText *low_input;
227         HistogramText *high_input;
228         HistogramText *gamma;
229         HistogramFrames *frames;
230         HistogramCanvas *canvas;
231         HistogramCarrot *low_input_carrot;
232         HistogramCarrot *gamma_carrot;
233         HistogramCarrot *high_input_carrot;
234         HistogramCarrot *low_output_carrot;
235         HistogramCarrot *high_output_carrot;
236         HistogramReset *reset;
237         BC_Title *canvas_title1;
238         BC_Title *canvas_title2;
239         BC_Title *threshold_title;
240         BC_Bar *bar;
241         HistogramSelect *select;
242         HistogramClearFrames *clear_frames;
243         HistogramLogSlider *log_slider;
244         BC_Title *log_title1;
245         BC_Title *log_title2;
246
247 // Value to change with keypresses
248         float *active_value;
249         HistogramMain *plugin;
250         int canvas_w;
251         int canvas_h;
252         int title1_x;
253         int title2_x;
254         int title3_x;
255         int title4_x;
256         HistogramPlot *plot;
257         HistogramSplit *split;
258 };
259
260 #endif