00001 #ifndef BCPAN_H
00002 #define BCPAN_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "bcsubwindow.h"
00013 #include "rotateframe.inc"
00014 #include "vframe.inc"
00015
00016 #define PAN_UP 0
00017 #define PAN_HI 1
00018 #define PAN_POPUP 2
00019 #define PAN_CHANNEL 3
00020 #define PAN_STICK 4
00021 #define PAN_CHANNEL_SMALL 5
00022 #define PAN_STICK_SMALL 6
00023 #define PAN_IMAGES 7
00024
00025
00026
00027 class BC_Pan : public BC_SubWindow
00028 {
00029 public:
00030 BC_Pan(int x,
00031 int y,
00032 int virtual_r,
00033 float maxvalue,
00034 int total_values,
00035 int *value_positions,
00036 int stick_x,
00037 int stick_y,
00038 float *values);
00039 virtual ~BC_Pan();
00040
00041 int initialize();
00042 int update(int x, int y);
00043 int button_press_event();
00044 int cursor_motion_event();
00045 int button_release_event();
00046 int cursor_enter_event();
00047 int cursor_leave_event();
00048 int repeat_event(int64_t duration);
00049 virtual int handle_event() { return 0; };
00050
00051 int change_channels(int new_channels, int *value_positions);
00052
00053 int stick_to_values();
00054
00055 static int stick_to_values(float *values,
00056 int total_values,
00057 int *value_positions,
00058 int stick_x,
00059 int stick_y,
00060 int virtual_r,
00061 float maxvalue);
00062 int get_total_values();
00063 float get_value(int channel);
00064 int get_stick_x();
00065 int get_stick_y();
00066 void set_images(VFrame **data);
00067 static void calculate_stick_position(int total_values,
00068 int *value_positions,
00069 float *values,
00070 float maxvalue,
00071 int virtual_r,
00072 int &stick_x,
00073 int &stick_y);
00074 static int rdtoxy(int &x, int &y, int a, int virtual_r);
00075 int activate(int popup_x = -1, int popup_y = -1);
00076 int deactivate();
00077 float* get_values();
00078
00079 private:
00080 void draw();
00081 void draw_popup();
00082
00083 static float distance(int x1, int x2, int y1, int y2);
00084
00085 static int get_channel_positions(int *value_x,
00086 int *value_y,
00087 int *value_positions,
00088 int virtual_r,
00089 int total_values);
00090
00091 int virtual_r;
00092 float maxvalue;
00093 int total_values;
00094 int *value_positions;
00095 int stick_x;
00096 int stick_y;
00097
00098 int x_origin, y_origin;
00099
00100 int stick_x_origin, stick_y_origin;
00101 float *values;
00102 int highlighted;
00103
00104 int *value_x, *value_y;
00105 int active;
00106
00107
00108 BC_Pixmap *images[PAN_IMAGES];
00109 VFrame *temp_channel;
00110 RotateFrame *rotater;
00111 BC_Popup *popup;
00112 };
00113
00114 #endif