shuttlerc, boobytraps, vwindow hang, lock cleanup
[goodguy/cinelerra.git] / cinelerra-5.1 / guicast / bcslider.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 BCSLIDER_H
23 #define BCSLIDER_H
24
25 #include "bcbitmap.inc"
26 #include "bcsubwindow.h"
27
28 class BC_ISlider;
29 class BC_FSlider;
30 class BC_PercentageSlider;
31
32 class BC_Slider : public BC_SubWindow
33 {
34 public:
35         BC_Slider(int x,
36                 int y,
37                 int pixels,
38                 int pointer_motion_range,
39                 VFrame **images,
40                 int show_number,
41                 int vertical,
42                 int use_caption);
43         virtual ~BC_Slider();
44
45         friend class BC_ISlider;
46         friend class BC_FSlider;
47         friend class BC_PercentageSlider;
48
49         virtual int handle_event() { return 0; };
50
51         int initialize();
52         void enable();
53         void disable();
54         void enable_show_value(int v);
55         static int get_span(int vertical);
56         int get_button_pixels();
57         virtual int value_to_pixel() { return 0; };
58         int keypress_event();
59         int cursor_enter_event();
60         int cursor_leave_event();
61         int button_press_event();
62         virtual int button_release_event();
63         int get_pointer_motion_range();
64         void set_pointer_motion_range(int value);
65         int cursor_motion_event();
66         int repeat_event(int64_t repeat_id);
67         int reposition_window(int x, int y, int w = -1, int h = -1);
68         int activate();
69         int deactivate();
70         virtual int increase_value() { return 0; };
71         virtual int decrease_value() { return 0; };
72         virtual int increase_value_big() { return 0; };
73         virtual int decrease_value_big() { return 0; };
74         virtual char* get_caption() { return caption; };
75
76 private:
77
78 #define SLIDER_UP 0
79 #define SLIDER_HI 1
80 #define SLIDER_DN 2
81 #define SLIDER_BG_UP 0
82 #define SLIDER_BG_HI 1
83 #define SLIDER_BG_DN 2
84 #define SLIDER_IMAGES 6
85
86         virtual int init_selection(int cursor_x, int cursor_y) { return 0; };
87         virtual int update_selection(int cursor_x, int cursor_y) { return 0; };
88         int set_images(VFrame **images);
89         int draw_face(int flush);
90         void show_value_tooltip();
91
92         VFrame **images;
93         BC_Pixmap **pixmaps;
94         int show_number, vertical, pointer_motion_range, pixels;
95         int keypress_tooltip_timer;
96         int button_pixel;
97         int status;
98         int button_down;
99         int min_pixel, max_pixel;
100         int text_line, text_height;
101         int use_caption;
102         char caption[BCTEXTLEN];
103         int active;
104         int enabled;
105 };
106
107
108 class BC_ISlider : public BC_Slider
109 {
110 public:
111         BC_ISlider(int x,
112                         int y,
113                         int vertical,
114                         int pixels,
115                         int pointer_motion_range,
116                         int64_t minvalue,
117                         int64_t maxvalue,
118                         int64_t value,
119                         int use_caption = 0,
120                         VFrame **data = 0,
121                         int *output = 0);
122
123         int update(int64_t value);
124         int update(int pointer_motion_range, int64_t value, int64_t minvalue, int64_t maxvalue);
125         int64_t get_value();
126         int64_t get_length();
127         int increase_value();
128         int decrease_value();
129         int increase_value_big();
130         int decrease_value_big();
131         virtual int handle_event();
132         virtual char* get_caption();
133
134 private:
135         int value_to_pixel();
136         int init_selection(int cursor_x, int cursor_y);
137         int update_selection(int cursor_x, int cursor_y);
138         int64_t minvalue, maxvalue, value;
139         int *output;
140 };
141
142 class BC_FSlider : public BC_Slider
143 {
144 public:
145         BC_FSlider(int x,
146                         int y,
147                         int vertical,
148                         int pixels,
149                         int pointer_motion_range,
150                         float minvalue,
151                         float maxvalue,
152                         float value,
153                         int use_caption = 0,
154                         VFrame **data = 0);
155
156         friend class BC_PercentageSlider;
157
158         int update(float value);
159         int update(int pointer_motion_range, float value, float minvalue, float maxvalue);
160         float get_value();
161         float get_length();
162         virtual int increase_value();
163         virtual int decrease_value();
164         virtual int increase_value_big();
165         virtual int decrease_value_big();
166         virtual char* get_caption();
167         void set_precision(float value);
168         void set_pagination(float small_change, float big_change);
169
170 private:
171         int value_to_pixel();
172         int init_selection(int cursor_x, int cursor_y);
173         int update_selection(int cursor_x, int cursor_y);
174         float minvalue, maxvalue, value;
175         float precision;
176         float small_change, big_change;
177 };
178
179 class BC_PercentageSlider : public BC_FSlider
180 {
181 public:
182         BC_PercentageSlider(int x,
183                         int y,
184                         int vertical,
185                         int pixels,
186                         int pointer_motion_range,
187                         float minvalue,
188                         float maxvalue,
189                         float value,
190                         int use_caption = 0,
191                         VFrame **data = 0);
192
193         char* get_caption();
194 private:
195 };
196
197
198 #endif