Add back 2 patches for histogram and overlayframe that are working correctly and...
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / polar / polarwindow.C
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
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.
10  *
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.
15  *
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
19  *
20  */
21
22 #include "language.h"
23 #include "polarwindow.h"
24
25
26 PLUGIN_THREAD_OBJECT(PolarMain, PolarThread, PolarWindow)
27
28
29
30
31
32
33
34 PolarWindow::PolarWindow(PolarMain *client)
35  : BC_Window("",
36         MEGREY,
37         client->gui_string,
38         210,
39         120,
40         200,
41         120,
42         0,
43         !client->show_initially)
44 {
45         this->client = client;
46 }
47
48 PolarWindow::~PolarWindow()
49 {
50         delete depth_slider;
51         delete angle_slider;
52         delete automation[0];
53         delete automation[1];
54 }
55
56 int PolarWindow::create_objects()
57 {
58         int xs10 = xS(10), xs80 = xS(80), xs190 = xS(190), xs200 = xS(200);
59         int ys10 = yS(10), ys20 = yS(20), ys30 = yS(30), ys35 = yS(35);
60         int x = xs10, y = ys10;
61         add_tool(new BC_Title(x, y, _("Depth")));
62         add_tool(automation[0] = new AutomatedFn(client, this, x + xs80, y, 0));
63         y += ys20;
64         add_tool(depth_slider = new DepthSlider(client, x, y));
65         y += ys35;
66         add_tool(new BC_Title(x, y, _("Angle")));
67         add_tool(automation[1] = new AutomatedFn(client, this, x + xs80, y, xS(1)));
68         y += ys20;
69         add_tool(angle_slider = new AngleSlider(client, x, y));
70 }
71
72 int PolarWindow::close_event()
73 {
74         client->save_defaults();
75         hide_window();
76         client->send_hide_gui();
77         return 1;
78 }
79
80 DepthSlider::DepthSlider(PolarMain *client, int x, int y)
81  : BC_ISlider(x, y, xs190, ys30, xs200, client->depth, 0, MAXDEPTH, DKGREY, BLACK, 1)
82 {
83         this->client = client;
84 }
85 DepthSlider::~DepthSlider()
86 {
87 }
88 int DepthSlider::handle_event()
89 {
90         client->depth = get_value();
91         client->send_configure_change();
92         return 1;
93 }
94
95 AngleSlider::AngleSlider(PolarMain *client, int x, int y)
96  : BC_ISlider(x, y, xs190, ys30, xs200, client->angle, 0, MAXANGLE, DKGREY, BLACK, 1)
97 {
98         this->client = client;
99 }
100 AngleSlider::~AngleSlider()
101 {
102 }
103 int AngleSlider::handle_event()
104 {
105         client->angle = get_value();
106         client->send_configure_change();
107         return 1;
108 }
109
110 AutomatedFn::AutomatedFn(PolarMain *client, PolarWindow *window, int x, int y, int number)
111  : BC_CheckBox(x, y, xS(16), yS(16), client->automated_function == number, _("Automate"))
112 {
113         this->client = client;
114         this->window = window;
115         this->number = number;
116 }
117
118 AutomatedFn::~AutomatedFn()
119 {
120 }
121
122 int AutomatedFn::handle_event()
123 {
124         for(int i = 0; i < 2; i++)
125         {
126                 if(i != number) window->automation[i]->update(0);
127         }
128         update(1);
129         client->automated_function = number;
130         client->send_configure_change();
131         return 1;
132 }
133