refresh frame fix, dblclk proxy viewer fix, vicon refresh fix for awdw resize, fix...
[goodguy/history.git] / cinelerra-5.1 / guicast / bcpan.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 BCPAN_H
23 #define BCPAN_H
24
25 // pan  angles
26 //
27 //        360/0
28 //
29 //     270      90
30 //
31 //         180
32
33 #include "bcsubwindow.h"
34 #include "rotateframe.inc"
35 #include "vframe.inc"
36
37 #define PAN_UP 0
38 #define PAN_HI 1
39 #define PAN_POPUP 2
40 #define PAN_CHANNEL 3
41 #define PAN_STICK 4
42 #define PAN_CHANNEL_SMALL 5
43 #define PAN_STICK_SMALL 6
44 #define PAN_IMAGES 7
45
46
47
48 class BC_Pan : public BC_SubWindow
49 {
50 public:
51         BC_Pan(int x,
52                 int y,
53                 int virtual_r,
54                 float maxvalue,
55                 int total_values,
56                 int *value_positions,
57                 int stick_x,
58                 int stick_y,
59                 float *values);
60         virtual ~BC_Pan();
61
62         int initialize();
63         int update(int x, int y);
64         int button_press_event();
65         int cursor_motion_event();
66         int button_release_event();
67         int cursor_enter_event();
68         int cursor_leave_event();
69         int repeat_event(int64_t duration);
70         virtual int handle_event() { return 0; };
71 // change radial positions of channels
72         int change_channels(int new_channels, int *value_positions);
73 // update values from stick position
74         int stick_to_values();
75 // Generic conversion from stick to values for channel changes with no GUI
76         static int stick_to_values(float *values,
77                 int total_values,
78                 int *value_positions,
79                 int stick_x,
80                 int stick_y,
81                 int virtual_r,
82                 float maxvalue);
83         int get_total_values();
84         float get_value(int channel);
85         int get_stick_x();
86         int get_stick_y();
87         void set_images(VFrame **data);
88         static void calculate_stick_position(int total_values,
89                 int *value_positions,
90                 float *values,
91                 float maxvalue,
92                 int virtual_r,
93                 int &stick_x,
94                 int &stick_y);
95         static int rdtoxy(int &x, int &y, int a, int virtual_r);
96         int activate(int popup_x = -1, int popup_y = -1);
97         int deactivate();
98         float* get_values();
99
100 private:
101         void draw(int flash, int flush);
102         void draw_popup();
103 // update values from stick position
104         static float distance(int x1, int x2, int y1, int y2);
105 // get x and y positions of channels
106         static int get_channel_positions(int *value_x,
107                 int *value_y,
108                 int *value_positions,
109                 int virtual_r,
110                 int total_values);
111
112         int virtual_r;
113         float maxvalue;
114         int total_values;
115         int *value_positions;
116         int stick_x;
117         int stick_y;
118 // Cursor origin on button press
119         int x_origin, y_origin;
120 // Stick origin on button press
121         int stick_x_origin, stick_y_origin;
122         float *values;
123         int highlighted;
124 // virtual x and y positions
125         int *value_x, *value_y;
126         int active;
127
128 // Used in popup
129         BC_Pixmap *images[PAN_IMAGES];
130         VFrame *temp_channel;
131         RotateFrame *rotater;
132         BC_Popup *popup;
133 };
134
135 #endif