00001 #include "polarwindow.h"
00002
00003 #include <libintl.h>
00004 #define _(String) gettext(String)
00005 #define gettext_noop(String) String
00006 #define N_(String) gettext_noop (String)
00007
00008
00009 PLUGIN_THREAD_OBJECT(PolarMain, PolarThread, PolarWindow)
00010
00011
00012
00013
00014
00015
00016
00017 PolarWindow::PolarWindow(PolarMain *client)
00018 : BC_Window("",
00019 MEGREY,
00020 client->gui_string,
00021 210,
00022 120,
00023 200,
00024 120,
00025 0,
00026 !client->show_initially)
00027 {
00028 this->client = client;
00029 }
00030
00031 PolarWindow::~PolarWindow()
00032 {
00033 delete depth_slider;
00034 delete angle_slider;
00035 delete automation[0];
00036 delete automation[1];
00037 }
00038
00039 int PolarWindow::create_objects()
00040 {
00041 int x = 10, y = 10;
00042 add_tool(new BC_Title(x, y, _("Depth")));
00043 add_tool(automation[0] = new AutomatedFn(client, this, x + 80, y, 0));
00044 y += 20;
00045 add_tool(depth_slider = new DepthSlider(client, x, y));
00046 y += 35;
00047 add_tool(new BC_Title(x, y, _("Angle")));
00048 add_tool(automation[1] = new AutomatedFn(client, this, x + 80, y, 1));
00049 y += 20;
00050 add_tool(angle_slider = new AngleSlider(client, x, y));
00051 }
00052
00053 int PolarWindow::close_event()
00054 {
00055 client->save_defaults();
00056 hide_window();
00057 client->send_hide_gui();
00058 }
00059
00060 DepthSlider::DepthSlider(PolarMain *client, int x, int y)
00061 : BC_ISlider(x, y, 190, 30, 200, client->depth, 0, MAXDEPTH, DKGREY, BLACK, 1)
00062 {
00063 this->client = client;
00064 }
00065 DepthSlider::~DepthSlider()
00066 {
00067 }
00068 int DepthSlider::handle_event()
00069 {
00070 client->depth = get_value();
00071 client->send_configure_change();
00072 }
00073
00074 AngleSlider::AngleSlider(PolarMain *client, int x, int y)
00075 : BC_ISlider(x, y, 190, 30, 200, client->angle, 0, MAXANGLE, DKGREY, BLACK, 1)
00076 {
00077 this->client = client;
00078 }
00079 AngleSlider::~AngleSlider()
00080 {
00081 }
00082 int AngleSlider::handle_event()
00083 {
00084 client->angle = get_value();
00085 client->send_configure_change();
00086 }
00087
00088 AutomatedFn::AutomatedFn(PolarMain *client, PolarWindow *window, int x, int y, int number)
00089 : BC_CheckBox(x, y, 16, 16, client->automated_function == number, _("Automate"))
00090 {
00091 this->client = client;
00092 this->window = window;
00093 this->number = number;
00094 }
00095
00096 AutomatedFn::~AutomatedFn()
00097 {
00098 }
00099
00100 int AutomatedFn::handle_event()
00101 {
00102 for(int i = 0; i < 2; i++)
00103 {
00104 if(i != number) window->automation[i]->update(0);
00105 }
00106 update(1);
00107 client->automated_function = number;
00108 client->send_configure_change();
00109 }
00110