4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
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.
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.
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
27 #include "bcsubwindow.h"
37 class BC_PercentagePot;
39 class BC_Pot : public BC_SubWindow
42 BC_Pot(int x, int y, VFrame **data);
48 friend class BC_PercentagePot;
51 static int calculate_h();
52 static int calculate_w();
54 virtual float get_percentage() { return 0; };
55 virtual int percentage_to_value(float percentage) { return 0; };
56 virtual int handle_event() { return 0; };
57 virtual const char* get_caption() { return ""; };
58 virtual int increase_value() { return 0; };
59 virtual int decrease_value() { return 0; };
60 void set_use_caption(int value);
65 int reposition_window(int x, int y);
66 int repeat_event(int64_t repeat_id);
67 int cursor_enter_event();
68 int cursor_leave_event();
69 int button_press_event();
70 virtual int button_release_event();
71 int cursor_motion_event();
75 int set_data(VFrame **data);
77 float percentage_to_angle(float percentage);
78 float angle_to_percentage(float angle);
79 int angle_to_coords(int &x1, int &y1, int &x2, int &y2, float angle);
80 float coords_to_angle(int x2, int y2);
81 void show_value_tooltip();
84 BC_Pixmap *images[POT_STATES];
85 char caption[BCTEXTLEN];
87 int64_t keypress_tooltip_timer;
89 float start_cursor_angle;
90 float start_needle_angle;
91 float prev_angle, angle_correction;
96 class BC_FPot : public BC_Pot
107 const char* get_caption();
108 int increase_value();
109 int decrease_value();
110 float get_percentage();
112 int percentage_to_value(float percentage);
113 void update(float value);
114 void update(float value, float minvalue, float maxvalue);
115 void set_precision(float value);
118 float value, minvalue, maxvalue;
122 class BC_IPot : public BC_Pot
133 const char* get_caption();
134 int increase_value();
135 int decrease_value();
136 float get_percentage();
137 int percentage_to_value(float percentage);
139 void update(int64_t value);
140 void update(int64_t value, int64_t minvalue, int64_t maxvalue);
143 int64_t value, minvalue, maxvalue;
146 class BC_QPot : public BC_Pot
151 int64_t value, // Units of frequencies
155 const char* get_caption();
156 int increase_value();
157 int decrease_value();
158 float get_percentage();
159 int percentage_to_value(float percentage);
160 // Units of frequencies
162 // Units of frequencies
163 void update(int64_t value);
166 // Units of frequency index
167 int64_t value, minvalue, maxvalue;
170 class BC_PercentagePot : public BC_Pot
173 BC_PercentagePot(int x,
181 const char* get_caption();
182 int increase_value();
183 int decrease_value();
184 float get_percentage();
186 int percentage_to_value(float percentage);
187 void update(float value);
190 float value, minvalue, maxvalue;