r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / plugins / scale / scalewin.C
blobce8b1878fa522ab616b4fb6485cd42a1c5be9bcb
1 #include "bcdisplayinfo.h"
2 #include "clip.h"
3 #include "scale.h"
5 #include <libintl.h>
6 #define _(String) gettext(String)
7 #define gettext_noop(String) String
8 #define N_(String) gettext_noop (String)
14 PLUGIN_THREAD_OBJECT(ScaleMain, ScaleThread, ScaleWin)
23 ScaleWin::ScaleWin(ScaleMain *client, int x, int y)
24  : BC_Window(client->gui_string, 
25         x,
26         y,
27         150, 
28         150, 
29         150, 
30         150, 
31         0, 
32         0,
33         1)
34
35         this->client = client; 
38 ScaleWin::~ScaleWin()
42 int ScaleWin::create_objects()
44         int x = 10, y = 10;
46         add_tool(new BC_Title(x, y, _("X Scale:")));
47         y += 20;
48         width = new ScaleWidth(this, client, x, y);
49         width->create_objects();
50         y += 30;
51         add_tool(new BC_Title(x, y, _("Y Scale:")));
52         y += 20;
53         height = new ScaleHeight(this, client, x, y);
54         height->create_objects();
55         y += 35;
56         add_tool(constrain = new ScaleConstrain(client, x, y));
57         show_window();
58         flush();
59         return 0;
62 int ScaleWin::close_event()
64         set_done(1);
65         return 1;
68 ScaleWidth::ScaleWidth(ScaleWin *win, 
69         ScaleMain *client, 
70         int x, 
71         int y)
72  : BC_TumbleTextBox(win,
73         (float)client->config.w,
74         (float)0,
75         (float)100,
76         x, 
77         y, 
78         100)
80 //printf("ScaleWidth::ScaleWidth %f\n", client->config.w);
81         this->client = client;
82         this->win = win;
85 ScaleWidth::~ScaleWidth()
89 int ScaleWidth::handle_event()
91         client->config.w = atof(get_text());
92         CLAMP(client->config.w, 0, 100);
94         if(client->config.constrain)
95         {
96                 client->config.h = client->config.w;
97                 win->height->update(client->config.h);
98         }
100 //printf("ScaleWidth::handle_event 1 %f\n", client->config.w);
101         client->send_configure_change();
102         return 1;
108 ScaleHeight::ScaleHeight(ScaleWin *win, ScaleMain *client, int x, int y)
109  : BC_TumbleTextBox(win,
110         (float)client->config.h,
111         (float)0,
112         (float)100,
113         x, 
114         y, 
115         100)
117         this->client = client;
118         this->win = win;
120 ScaleHeight::~ScaleHeight()
123 int ScaleHeight::handle_event()
125         client->config.h = atof(get_text());
126         CLAMP(client->config.h, 0, 100);
128         if(client->config.constrain)
129         {
130                 client->config.w = client->config.h;
131                 win->width->update(client->config.w);
132         }
134         client->send_configure_change();
135         return 1;
143 ScaleConstrain::ScaleConstrain(ScaleMain *client, int x, int y)
144  : BC_CheckBox(x, y, client->config.constrain, _("Constrain ratio"))
146         this->client = client;
148 ScaleConstrain::~ScaleConstrain()
151 int ScaleConstrain::handle_event()
153         client->config.constrain = get_value();
154         client->send_configure_change();