00001 #ifndef SCALE_H
00002 #define SCALE_H
00003
00004 #include "guicast.h"
00005 #include "mwindow.inc"
00006 #include "scale.inc"
00007
00008 class Scale : public BC_MenuItem
00009 {
00010 public:
00011 Scale(MWindow *mwindow);
00012 ~Scale();
00013
00014 int handle_event();
00015
00016 ScaleThread *thread;
00017 MWindow *mwindow;
00018 };
00019
00020 class ScaleWindow;
00021
00022 class ScaleThread : public Thread
00023 {
00024 public:
00025 ScaleThread(MWindow *mwindow);
00026 ~ScaleThread();
00027
00028 void run();
00029
00030 int update_window(int offset_updated = 0);
00031 int update_aspect(ScaleWindow *window);
00032
00033
00034 int dimension[4];
00035 int orig_dimension[4];
00036 int offsets[4];
00037 float ratio[4];
00038 float aspect_w, aspect_h;
00039 int constrain_ratio;
00040 int scale_data;
00041 int auto_aspect;
00042 int already_running;
00043
00044 MWindow *mwindow;
00045 ScaleWindow *window;
00046 };
00047
00048 class ScaleSizeText;
00049 class ScaleRatioText;
00050 class ScalePosition;
00051 class ScaleOffsetText;
00052 class ScaleAspectW;
00053 class ScaleAspectH;
00054
00055 class ScaleWindow : public BC_Window
00056 {
00057 public:
00058 ScaleWindow(ScaleThread *thread);
00059 ~ScaleWindow();
00060
00061 int create_objects();
00062 ScaleThread *thread;
00063 ScaleSizeText *dimension[4];
00064 ScaleRatioText *ratio[4];
00065
00066 ScaleAspectW *aspect_w;
00067 ScaleAspectH *aspect_h;
00068
00069 };
00070
00071 class ScaleSizeText : public BC_TextBox
00072 {
00073 public:
00074 ScaleSizeText(int x, int y, ScaleThread *thread, int *output);
00075 ~ScaleSizeText();
00076 int handle_event();
00077 ScaleThread *thread;
00078 int *output;
00079 };
00080
00081
00082 class ScaleOffsetText : public BC_TextBox
00083 {
00084 public:
00085 ScaleOffsetText(int x, int y, ScaleThread *thread, int *output);
00086 ~ScaleOffsetText();
00087 int handle_event();
00088 ScaleThread *thread;
00089 int *output;
00090 };
00091
00092 class ScaleRatioText : public BC_TextBox
00093 {
00094 public:
00095 ScaleRatioText(int x, int y, ScaleThread *thread, float *output);
00096 ~ScaleRatioText();
00097 int handle_event();
00098 ScaleThread *thread;
00099 float *output;
00100 };
00101
00102 class ScaleAspectAuto : public BC_CheckBox
00103 {
00104 public:
00105 ScaleAspectAuto(int x, int y, ScaleThread *thread);
00106 ~ScaleAspectAuto();
00107 int handle_event();
00108 ScaleThread *thread;
00109 };
00110
00111 class ScaleAspectW : public BC_TextBox
00112 {
00113 public:
00114 ScaleAspectW(int x, int y, ScaleThread *thread, float *output, char *string);
00115 ~ScaleAspectW();
00116 int handle_event();
00117 ScaleThread *thread;
00118 float *output;
00119 };
00120
00121 class ScaleAspectH : public BC_TextBox
00122 {
00123 public:
00124 ScaleAspectH(int x, int y, ScaleThread *thread, float *output, char *string);
00125 ~ScaleAspectH();
00126 int handle_event();
00127 ScaleThread *thread;
00128 float *output;
00129 };
00130
00131
00132 class ScaleData : public BC_CheckBox
00133 {
00134 public:
00135 ScaleData(int x, int y, ScaleThread *thread);
00136 ~ScaleData();
00137 int handle_event();
00138 ScaleThread *thread;
00139 };
00140
00141 class ScaleConstrain : public BC_CheckBox
00142 {
00143 public:
00144 ScaleConstrain(int x, int y, ScaleThread *thread);
00145 ~ScaleConstrain();
00146 int handle_event();
00147 ScaleThread *thread;
00148 };
00149
00150 class ScalePosition : public BC_SubWindow
00151 {
00152 public:
00153 ScalePosition(int x, int y, ScaleThread *thread, ScaleWindow *window,
00154 int *orig_dimension, int *scale_dimension, int *offsets);
00155
00156 ~ScalePosition();
00157
00158 int draw();
00159 int button_press();
00160 int cursor_motion();
00161 int button_release();
00162 int get_scale();
00163
00164 int *orig_dimension;
00165 int *scale_dimension;
00166 int *offsets;
00167 ScaleThread *thread;
00168 ScaleWindow *window;
00169 int button_down;
00170 int center_x, center_y, offset_x, offset_y;
00171 float hscale, vscale;
00172 };
00173
00174
00175
00176 #endif