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()
59 add_tool(new BC_Title(x, y, _("In X:")));
61 in_x = new TranslateCoord(this, client, x, y, &client->config.in_x);
62 in_x->create_objects();
65 add_tool(new BC_Title(x, y, _("In Y:")));
67 in_y = new TranslateCoord(this, client, x, y, &client->config.in_y);
68 in_y->create_objects();
71 add_tool(new BC_Title(x, y, _("In W:")));
73 in_w = new TranslateCoord(this, client, x, y, &client->config.in_w);
74 in_w->create_objects();
77 add_tool(new BC_Title(x, y, _("In H:")));
79 in_h = new TranslateCoord(this, client, x, y, &client->config.in_h);
80 in_h->create_objects();
83 add_tool(reset = new TranslateReset(client, this, x, y));
87 add_tool(new BC_Title(x, y, _("Out X:")));
89 out_x = new TranslateCoord(this, client, x, y, &client->config.out_x);
90 out_x->create_objects();
93 add_tool(new BC_Title(x, y, _("Out Y:")));
95 out_y = new TranslateCoord(this, client, x, y, &client->config.out_y);
96 out_y->create_objects();
99 add_tool(new BC_Title(x, y, _("Out W:")));
101 out_w = new TranslateCoord(this, client, x, y, &client->config.out_w);
102 out_w->create_objects();
105 add_tool(new BC_Title(x, y, _("Out H:")));
107 out_h = new TranslateCoord(this, client, x, y, &client->config.out_h);
108 out_h->create_objects();
115 void TranslateWin::update()
117 in_x->update((int64_t)client->config.in_x);
118 in_y->update((int64_t)client->config.in_y);
119 in_w->update((int64_t)client->config.in_w);
120 in_h->update((int64_t)client->config.in_h);
121 out_x->update((int64_t)client->config.out_x);
122 out_y->update((int64_t)client->config.out_y);
123 out_y->update((int64_t)client->config.out_y);
124 out_w->update((int64_t)client->config.out_w);
125 out_h->update((int64_t)client->config.out_h);
130 TranslateCoord::TranslateCoord(TranslateWin *win,
131 TranslateMain *client,
135 : BC_TumbleTextBox(win,
143 //printf("TranslateWidth::TranslateWidth %f\n", client->config.w);
144 this->client = client;
149 TranslateCoord::~TranslateCoord()
153 int TranslateCoord::handle_event()
155 *value = atof(get_text());
157 client->send_configure_change();
161 TranslateReset::TranslateReset(TranslateMain *client, TranslateWin *win, int x, int y)
162 : BC_GenericButton(x, y, _("Reset"))
164 this->client = client;
167 TranslateReset::~TranslateReset()
170 int TranslateReset::handle_event()
172 client->config.reset();
174 client->send_configure_change();