fix segv for plugin render_gui when plugin moved up/dn, opencv build fixes, opts...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / scale.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 SCALE_H
23 #define SCALE_H
24
25 #include "guicast.h"
26 #include "mwindow.inc"
27 #include "scale.inc"
28
29 class Scale : public BC_MenuItem
30 {
31 public:
32         Scale(MWindow *mwindow);
33         ~Scale();
34
35         int handle_event();
36
37         ScaleThread *thread;
38         MWindow *mwindow;
39 };
40
41 class ScaleWindow;
42
43 class ScaleThread : public Thread
44 {
45 public:
46         ScaleThread(MWindow *mwindow);
47         ~ScaleThread();
48
49         void run();
50
51         int update_window(int offset_updated = 0);
52         int update_aspect(ScaleWindow *window);
53
54 // change a value to negative to signal it was the value changed
55         int dimension[4];        // new dimensions to apply
56         int orig_dimension[4];   // dimensions for getting scale
57         int offsets[4];          // Offsets of new images in old images
58         float ratio[4];
59         float aspect_w, aspect_h;
60         int constrain_ratio;
61         int scale_data;
62         int auto_aspect;
63         int already_running;
64
65         MWindow *mwindow;
66         ScaleWindow *window;
67 };
68
69 class ScaleSizeText;
70 class ScaleRatioText;
71 class ScalePosition;
72 class ScaleOffsetText;
73 class ScaleAspectW;
74 class ScaleAspectH;
75
76 class ScaleWindow : public BC_Window
77 {
78 public:
79         ScaleWindow(ScaleThread *thread);
80         ~ScaleWindow();
81
82         void create_objects();
83         ScaleThread *thread;
84         ScaleSizeText *dimension[4];
85         ScaleRatioText *ratio[4];
86 //      ScaleOffsetText *offsets[4];
87         ScaleAspectW *aspect_w;
88         ScaleAspectH *aspect_h;
89 //      ScalePosition *position1, *position2;
90 };
91
92 class ScaleSizeText : public BC_TextBox
93 {
94 public:
95         ScaleSizeText(int x, int y, ScaleThread *thread, int *output);
96         ~ScaleSizeText();
97         int handle_event();
98         ScaleThread *thread;
99         int *output;
100 };
101
102
103 class ScaleOffsetText : public BC_TextBox
104 {
105 public:
106         ScaleOffsetText(int x, int y, ScaleThread *thread, int *output);
107         ~ScaleOffsetText();
108         int handle_event();
109         ScaleThread *thread;
110         int *output;
111 };
112
113 class ScaleRatioText : public BC_TextBox
114 {
115 public:
116         ScaleRatioText(int x, int y, ScaleThread *thread, float *output);
117         ~ScaleRatioText();
118         int handle_event();
119         ScaleThread *thread;
120         float *output;
121 };
122
123 class ScaleAspectAuto : public BC_CheckBox
124 {
125 public:
126         ScaleAspectAuto(int x, int y, ScaleThread *thread);
127         ~ScaleAspectAuto();
128         int handle_event();
129         ScaleThread *thread;
130 };
131
132 class ScaleAspectW : public BC_TextBox
133 {
134 public:
135         ScaleAspectW(int x, int y, ScaleThread *thread, float *output, char *string);
136         ~ScaleAspectW();
137         int handle_event();
138         ScaleThread *thread;
139         float *output;
140 };
141
142 class ScaleAspectH : public BC_TextBox
143 {
144 public:
145         ScaleAspectH(int x, int y, ScaleThread *thread, float *output, char *string);
146         ~ScaleAspectH();
147         int handle_event();
148         ScaleThread *thread;
149         float *output;
150 };
151
152
153 class ScaleData : public BC_CheckBox
154 {
155 public:
156         ScaleData(int x, int y, ScaleThread *thread);
157         ~ScaleData();
158         int handle_event();
159         ScaleThread *thread;
160 };
161
162 class ScaleConstrain : public BC_CheckBox
163 {
164 public:
165         ScaleConstrain(int x, int y, ScaleThread *thread);
166         ~ScaleConstrain();
167         int handle_event();
168         ScaleThread *thread;
169 };
170
171 class ScalePosition : public BC_SubWindow
172 {
173 public:
174         ScalePosition(int x, int y, ScaleThread *thread, ScaleWindow *window,
175                 int *orig_dimension, int *scale_dimension, int *offsets);
176
177         ~ScalePosition();
178
179         int draw();
180         int button_press();
181         int cursor_motion();
182         int button_release();
183         int get_scale();
184
185         int *orig_dimension;
186         int *scale_dimension;
187         int *offsets;
188         ScaleThread *thread;
189         ScaleWindow *window;
190         int button_down;
191         int center_x, center_y, offset_x, offset_y;
192         float hscale, vscale;
193 };
194
195
196
197 #endif