00001 #include "bcdisplayinfo.h"
00002 #include "clip.h"
00003 #include "translatewin.h"
00004
00005 #include <libintl.h>
00006 #define _(String) gettext(String)
00007 #define gettext_noop(String) String
00008 #define N_(String) gettext_noop (String)
00009
00010
00011
00012
00013
00014
00015
00016 PLUGIN_THREAD_OBJECT(TranslateMain, TranslateThread, TranslateWin)
00017
00018
00019
00020
00021
00022
00023 TranslateWin::TranslateWin(TranslateMain *client, int x, int y)
00024 : BC_Window(client->gui_string,
00025 x,
00026 y,
00027 300,
00028 220,
00029 300,
00030 220,
00031 0,
00032 0,
00033 1)
00034 {
00035 this->client = client;
00036 }
00037
00038 TranslateWin::~TranslateWin()
00039 {
00040 }
00041
00042 int TranslateWin::create_objects()
00043 {
00044 int x = 10, y = 10;
00045
00046 add_tool(new BC_Title(x, y, _("In X:")));
00047 y += 20;
00048 in_x = new TranslateCoord(this, client, x, y, &client->config.in_x);
00049 in_x->create_objects();
00050 y += 30;
00051
00052 add_tool(new BC_Title(x, y, _("In Y:")));
00053 y += 20;
00054 in_y = new TranslateCoord(this, client, x, y, &client->config.in_y);
00055 in_y->create_objects();
00056 y += 30;
00057
00058 add_tool(new BC_Title(x, y, _("In W:")));
00059 y += 20;
00060 in_w = new TranslateCoord(this, client, x, y, &client->config.in_w);
00061 in_w->create_objects();
00062 y += 30;
00063
00064 add_tool(new BC_Title(x, y, _("In H:")));
00065 y += 20;
00066 in_h = new TranslateCoord(this, client, x, y, &client->config.in_h);
00067 in_h->create_objects();
00068 y += 30;
00069
00070
00071 x += 150;
00072 y = 10;
00073 add_tool(new BC_Title(x, y, _("Out X:")));
00074 y += 20;
00075 out_x = new TranslateCoord(this, client, x, y, &client->config.out_x);
00076 out_x->create_objects();
00077 y += 30;
00078
00079 add_tool(new BC_Title(x, y, _("Out Y:")));
00080 y += 20;
00081 out_y = new TranslateCoord(this, client, x, y, &client->config.out_y);
00082 out_y->create_objects();
00083 y += 30;
00084
00085 add_tool(new BC_Title(x, y, _("Out W:")));
00086 y += 20;
00087 out_w = new TranslateCoord(this, client, x, y, &client->config.out_w);
00088 out_w->create_objects();
00089 y += 30;
00090
00091 add_tool(new BC_Title(x, y, _("Out H:")));
00092 y += 20;
00093 out_h = new TranslateCoord(this, client, x, y, &client->config.out_h);
00094 out_h->create_objects();
00095 y += 30;
00096
00097
00098
00099 show_window();
00100 flush();
00101 return 0;
00102 }
00103
00104 int TranslateWin::close_event()
00105 {
00106 set_done(1);
00107 return 1;
00108 }
00109
00110 TranslateCoord::TranslateCoord(TranslateWin *win,
00111 TranslateMain *client,
00112 int x,
00113 int y,
00114 float *value)
00115 : BC_TumbleTextBox(win,
00116 (int)*value,
00117 (int)0,
00118 (int)1000,
00119 x,
00120 y,
00121 100)
00122 {
00123
00124 this->client = client;
00125 this->win = win;
00126 this->value = value;
00127 }
00128
00129 TranslateCoord::~TranslateCoord()
00130 {
00131 }
00132
00133 int TranslateCoord::handle_event()
00134 {
00135 *value = atof(get_text());
00136
00137 client->send_configure_change();
00138 return 1;
00139 }
00140
00141