4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
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.
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.
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
22 #include "bcdisplayinfo.h"
25 #include "translate.h"
26 #include "translatewin.h"
40 TranslateWin::TranslateWin(TranslateMain *client)
41 : PluginClientWindow(client,
48 this->client = client;
51 TranslateWin::~TranslateWin()
55 void TranslateWin::create_objects()
57 int xs10 = xS(10), xs150 = xS(150);
58 int ys10 = yS(10), ys20 = yS(20), ys30 = yS(30), ys40 = yS(40);
59 int x = xs10, y = ys10;
61 add_tool(new BC_Title(x, y, _("In X:")));
63 in_x = new TranslateCoord(this, client, x, y, &client->config.in_x);
64 in_x->create_objects();
67 add_tool(new BC_Title(x, y, _("In Y:")));
69 in_y = new TranslateCoord(this, client, x, y, &client->config.in_y);
70 in_y->create_objects();
73 add_tool(new BC_Title(x, y, _("In W:")));
75 in_w = new TranslateCoord(this, client, x, y, &client->config.in_w);
76 in_w->create_objects();
79 add_tool(new BC_Title(x, y, _("In H:")));
81 in_h = new TranslateCoord(this, client, x, y, &client->config.in_h);
82 in_h->create_objects();
85 add_tool(reset = new TranslateReset(client, this, x, y));
89 add_tool(new BC_Title(x, y, _("Out X:")));
91 out_x = new TranslateCoord(this, client, x, y, &client->config.out_x);
92 out_x->create_objects();
95 add_tool(new BC_Title(x, y, _("Out Y:")));
97 out_y = new TranslateCoord(this, client, x, y, &client->config.out_y);
98 out_y->create_objects();
101 add_tool(new BC_Title(x, y, _("Out W:")));
103 out_w = new TranslateCoord(this, client, x, y, &client->config.out_w);
104 out_w->create_objects();
107 add_tool(new BC_Title(x, y, _("Out H:")));
109 out_h = new TranslateCoord(this, client, x, y, &client->config.out_h);
110 out_h->create_objects();
117 void TranslateWin::update()
119 in_x->update((int64_t)client->config.in_x);
120 in_y->update((int64_t)client->config.in_y);
121 in_w->update((int64_t)client->config.in_w);
122 in_h->update((int64_t)client->config.in_h);
123 out_x->update((int64_t)client->config.out_x);
124 out_y->update((int64_t)client->config.out_y);
125 out_y->update((int64_t)client->config.out_y);
126 out_w->update((int64_t)client->config.out_w);
127 out_h->update((int64_t)client->config.out_h);
132 TranslateCoord::TranslateCoord(TranslateWin *win,
133 TranslateMain *client,
137 : BC_TumbleTextBox(win,
145 //printf("TranslateWidth::TranslateWidth %f\n", client->config.w);
146 this->client = client;
151 TranslateCoord::~TranslateCoord()
155 int TranslateCoord::handle_event()
157 *value = atof(get_text());
159 client->send_configure_change();
163 TranslateReset::TranslateReset(TranslateMain *client, TranslateWin *win, int x, int y)
164 : BC_GenericButton(x, y, _("Reset"))
166 this->client = client;
169 TranslateReset::~TranslateReset()
172 int TranslateReset::handle_event()
174 client->config.reset();
176 client->send_configure_change();