r870: Merge 2.1:
[cinelerra_cv.git] / cinelerra / scale.h
blob12a5fd4af3488e4b586e5c2b2f51a3db658061da
1 #ifndef SCALE_H
2 #define SCALE_H
4 #include "guicast.h"
5 #include "mwindow.inc"
6 #include "scale.inc"
8 class Scale : public BC_MenuItem
10 public:
11 Scale(MWindow *mwindow);
12 ~Scale();
14 int handle_event();
16 ScaleThread *thread;
17 MWindow *mwindow;
20 class ScaleWindow;
22 class ScaleThread : public Thread
24 public:
25 ScaleThread(MWindow *mwindow);
26 ~ScaleThread();
28 void run();
30 int update_window(int offset_updated = 0);
31 int update_aspect(ScaleWindow *window);
33 // change a value to negative to signal it was the value changed
34 int dimension[4]; // new dimensions to apply
35 int orig_dimension[4]; // dimensions for getting scale
36 int offsets[4]; // Offsets of new images in old images
37 float ratio[4];
38 float aspect_w, aspect_h;
39 int constrain_ratio;
40 int scale_data;
41 int auto_aspect;
42 int already_running;
44 MWindow *mwindow;
45 ScaleWindow *window;
48 class ScaleSizeText;
49 class ScaleRatioText;
50 class ScalePosition;
51 class ScaleOffsetText;
52 class ScaleAspectW;
53 class ScaleAspectH;
55 class ScaleWindow : public BC_Window
57 public:
58 ScaleWindow(ScaleThread *thread);
59 ~ScaleWindow();
61 int create_objects();
62 ScaleThread *thread;
63 ScaleSizeText *dimension[4];
64 ScaleRatioText *ratio[4];
65 // ScaleOffsetText *offsets[4];
66 ScaleAspectW *aspect_w;
67 ScaleAspectH *aspect_h;
68 // ScalePosition *position1, *position2;
71 class ScaleSizeText : public BC_TextBox
73 public:
74 ScaleSizeText(int x, int y, ScaleThread *thread, int *output);
75 ~ScaleSizeText();
76 int handle_event();
77 ScaleThread *thread;
78 int *output;
82 class ScaleOffsetText : public BC_TextBox
84 public:
85 ScaleOffsetText(int x, int y, ScaleThread *thread, int *output);
86 ~ScaleOffsetText();
87 int handle_event();
88 ScaleThread *thread;
89 int *output;
92 class ScaleRatioText : public BC_TextBox
94 public:
95 ScaleRatioText(int x, int y, ScaleThread *thread, float *output);
96 ~ScaleRatioText();
97 int handle_event();
98 ScaleThread *thread;
99 float *output;
102 class ScaleAspectAuto : public BC_CheckBox
104 public:
105 ScaleAspectAuto(int x, int y, ScaleThread *thread);
106 ~ScaleAspectAuto();
107 int handle_event();
108 ScaleThread *thread;
111 class ScaleAspectW : public BC_TextBox
113 public:
114 ScaleAspectW(int x, int y, ScaleThread *thread, float *output, char *string);
115 ~ScaleAspectW();
116 int handle_event();
117 ScaleThread *thread;
118 float *output;
121 class ScaleAspectH : public BC_TextBox
123 public:
124 ScaleAspectH(int x, int y, ScaleThread *thread, float *output, char *string);
125 ~ScaleAspectH();
126 int handle_event();
127 ScaleThread *thread;
128 float *output;
132 class ScaleData : public BC_CheckBox
134 public:
135 ScaleData(int x, int y, ScaleThread *thread);
136 ~ScaleData();
137 int handle_event();
138 ScaleThread *thread;
141 class ScaleConstrain : public BC_CheckBox
143 public:
144 ScaleConstrain(int x, int y, ScaleThread *thread);
145 ~ScaleConstrain();
146 int handle_event();
147 ScaleThread *thread;
150 class ScalePosition : public BC_SubWindow
152 public:
153 ScalePosition(int x, int y, ScaleThread *thread, ScaleWindow *window,
154 int *orig_dimension, int *scale_dimension, int *offsets);
156 ~ScalePosition();
158 int draw();
159 int button_press();
160 int cursor_motion();
161 int button_release();
162 int get_scale();
164 int *orig_dimension;
165 int *scale_dimension;
166 int *offsets;
167 ScaleThread *thread;
168 ScaleWindow *window;
169 int button_down;
170 int center_x, center_y, offset_x, offset_y;
171 float hscale, vscale;
176 #endif