1 #include "bcdisplayinfo.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,
35 this->client = client;
42 int ScaleWin::create_objects()
46 add_tool(new BC_Title(x, y, _("X Scale:")));
48 width = new ScaleWidth(this, client, x, y);
49 width->create_objects();
51 add_tool(new BC_Title(x, y, _("Y Scale:")));
53 height = new ScaleHeight(this, client, x, y);
54 height->create_objects();
56 add_tool(constrain = new ScaleConstrain(client, x, y));
62 int ScaleWin::close_event()
68 ScaleWidth::ScaleWidth(ScaleWin *win,
72 : BC_TumbleTextBox(win,
73 (float)client->config.w,
80 //printf("ScaleWidth::ScaleWidth %f\n", client->config.w);
81 this->client = client;
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)
96 client->config.h = client->config.w;
97 win->height->update(client->config.h);
100 //printf("ScaleWidth::handle_event 1 %f\n", client->config.w);
101 client->send_configure_change();
108 ScaleHeight::ScaleHeight(ScaleWin *win, ScaleMain *client, int x, int y)
109 : BC_TumbleTextBox(win,
110 (float)client->config.h,
117 this->client = client;
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)
130 client->config.w = client->config.h;
131 win->width->update(client->config.w);
134 client->send_configure_change();
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();