change to id based refs for plugins, save plugin on/off in edit drag/drop, fix transi...
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / puzzleobj / puzzleobjwindow.C
1 /*
2  * CINELERRA
3  * Copyright (C) 2014 Adam Williams <broadcast at earthling dot net>
4  * 
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  * 
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  * 
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  * 
19  */
20
21 #include "bcdisplayinfo.h"
22 #include "clip.h"
23 #include "language.h"
24 #include "puzzleobj.h"
25 #include "puzzleobjwindow.h"
26 #include "theme.h"
27
28 PuzzleObjWindow::PuzzleObjWindow(PuzzleObj *plugin)
29  : PluginClientWindow(plugin, xS(320), yS(100), xS(320), yS(100), 0)
30 {
31         this->plugin = plugin; 
32         pixels = 0;
33         iterations = 0;
34         pixels_title = 0;
35         iterations_title = 0;
36 }
37
38 PuzzleObjWindow::~PuzzleObjWindow()
39 {
40 }
41
42 void PuzzleObjWindow::create_objects()
43 {
44         int xs10 = xS(10), xs80 = xS(80), xs180 = xS(180);
45         int ys10 = yS(10);
46         int x = xs10, y = ys10;
47         BC_Title *title = new BC_Title(x, y, _("PuzzleObj"));
48         add_subwindow(title);
49         y += title->get_h() + ys10;
50         int x1 = x + xs80;
51         add_subwindow(pixels_title = new BC_Title(x,y,_("Pixels:")));
52         add_subwindow(pixels = new PuzzleObjISlider(this,
53                         x1,y,xs180, 1,1000, &plugin->config.pixels));
54         y += pixels->get_h() + ys10;
55         add_subwindow(iterations_title = new BC_Title(x,y,_("Iterations:")));
56         add_subwindow(iterations = new PuzzleObjISlider(this,
57                         x1,y,xs180, 0,50, &plugin->config.iterations));
58         show_window(1);
59 }
60
61 PuzzleObjISlider::PuzzleObjISlider(PuzzleObjWindow *win,
62                 int x, int y, int w, int min, int max, int *output)
63  : BC_ISlider(x, y, 0,w,w, min,max, *output)
64 {
65         this->win = win;
66         this->output = output;
67 }
68 PuzzleObjISlider::~PuzzleObjISlider()
69 {
70 }
71
72 int PuzzleObjISlider::handle_event()
73 {
74         *output = get_value();
75         win->plugin->send_configure_change();
76         return 1;
77 }
78