r1007: Make configure detect and work on amd64.
[cinelerra_cv/mob.git] / guicast / bcpot.h
blob228d899b05538cceb2ac8988e9cb74aae5b41ec7
1 #ifndef BCPOT_H
2 #define BCPOT_H
4 #include "bcpixmap.h"
5 #include "vframe.inc"
6 #include "bcsubwindow.h"
8 #define POT_UP 0
9 #define POT_HIGH 1
10 #define POT_DN 2
11 #define POT_STATES 3
13 class BC_FPot;
14 class BC_IPot;
15 class BC_QPot;
16 class BC_PercentagePot;
18 class BC_Pot : public BC_SubWindow
20 public:
21 BC_Pot(int x, int y, VFrame **data);
22 virtual ~BC_Pot();
24 friend class BC_FPot;
25 friend class BC_IPot;
26 friend class BC_QPot;
27 friend class BC_PercentagePot;
30 static int calculate_h();
31 int initialize();
32 virtual float get_percentage() { return 0; };
33 virtual int percentage_to_value(float percentage) { return 0; };
34 virtual int handle_event() { return 0; };
35 virtual char* get_caption() { return ""; };
36 virtual int increase_value() { return 0; };
37 virtual int decrease_value() { return 0; };
38 void set_use_caption(int value);
40 int reposition_window(int x, int y);
41 int repeat_event(int64_t repeat_id);
42 int cursor_enter_event();
43 int cursor_leave_event();
44 int button_press_event();
45 virtual int button_release_event();
46 int cursor_motion_event();
47 int keypress_event();
49 private:
50 int set_data(VFrame **data);
51 int draw();
52 float percentage_to_angle(float percentage);
53 float angle_to_percentage(float angle);
54 int angle_to_coords(int &x1, int &y1, int &x2, int &y2, float angle);
55 float coords_to_angle(int x2, int y2);
56 void show_value_tooltip();
58 VFrame **data;
59 BC_Pixmap *images[POT_STATES];
60 char caption[BCTEXTLEN], temp_tooltip_text[BCTEXTLEN];
61 int status;
62 int64_t keypress_tooltip_timer;
63 float angle_offset;
64 float start_cursor_angle;
65 float start_needle_angle;
66 float prev_angle, angle_correction;
67 int use_caption;
70 class BC_FPot : public BC_Pot
72 public:
73 BC_FPot(int x,
74 int y,
75 float value,
76 float minvalue,
77 float maxvalue,
78 VFrame **data = 0);
79 ~BC_FPot();
81 char* get_caption();
82 int increase_value();
83 int decrease_value();
84 float get_percentage();
85 float get_value();
86 int percentage_to_value(float percentage);
87 void update(float value);
88 void update(float value, float minvalue, float maxvalue);
89 void set_precision(float value);
91 private:
92 float value, minvalue, maxvalue;
93 float precision;
96 class BC_IPot : public BC_Pot
98 public:
99 BC_IPot(int x,
100 int y,
101 int64_t value,
102 int64_t minvalue,
103 int64_t maxvalue,
104 VFrame **data = 0);
105 ~BC_IPot();
107 char* get_caption();
108 int increase_value();
109 int decrease_value();
110 float get_percentage();
111 int percentage_to_value(float percentage);
112 int64_t get_value();
113 void update(int64_t value);
114 void update(int64_t value, int64_t minvalue, int64_t maxvalue);
116 private:
117 int64_t value, minvalue, maxvalue;
120 class BC_QPot : public BC_Pot
122 public:
123 BC_QPot(int x,
124 int y,
125 int64_t value, // Units of frequencies
126 VFrame **data = 0);
127 ~BC_QPot();
129 char* get_caption();
130 int increase_value();
131 int decrease_value();
132 float get_percentage();
133 int percentage_to_value(float percentage);
134 // Units of frequencies
135 int64_t get_value();
136 // Units of frequencies
137 void update(int64_t value);
139 private:
140 // Units of frequency index
141 int64_t value, minvalue, maxvalue;
144 class BC_PercentagePot : public BC_Pot
146 public:
147 BC_PercentagePot(int x,
148 int y,
149 float value,
150 float minvalue,
151 float maxvalue,
152 VFrame **data = 0);
153 ~BC_PercentagePot();
155 char* get_caption();
156 int increase_value();
157 int decrease_value();
158 float get_percentage();
159 float get_value();
160 int percentage_to_value(float percentage);
161 void update(float value);
163 private:
164 float value, minvalue, maxvalue;
167 #endif