shuttle and transportque reworks, new shdmp, titler font textbox tweak
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / deinterlace / deinterwindow.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 "bcdisplayinfo.h"
23 #include "deinterwindow.h"
24 #include "language.h"
25
26
27
28
29
30
31
32
33 DeInterlaceWindow::DeInterlaceWindow(DeInterlaceMain *client)
34  : PluginClientWindow(client,
35         200,
36         250,
37         200,
38         250,
39         0)
40 {
41         this->client = client;
42 }
43
44 DeInterlaceWindow::~DeInterlaceWindow()
45 {
46 }
47
48 void DeInterlaceWindow::create_objects()
49 {
50         int x = 10, y = 10;
51         add_tool(new BC_Title(x, y, _("Select lines to keep")));
52         y += 25;
53         add_tool(none = new DeInterlaceOption(client, this, DEINTERLACE_NONE, x, y, _("Do nothing")));
54         y += 25;
55         add_tool(odd_fields = new DeInterlaceOption(client, this, DEINTERLACE_EVEN, x, y, _("Odd lines")));
56         y += 25;
57         add_tool(even_fields = new DeInterlaceOption(client, this, DEINTERLACE_ODD, x, y, _("Even lines")));
58         y += 25;
59         add_tool(average_fields = new DeInterlaceOption(client, this, DEINTERLACE_AVG, x, y, _("Average lines")));
60         y += 25;
61         add_tool(swap_odd_fields = new DeInterlaceOption(client, this, DEINTERLACE_SWAP_ODD, x, y, _("Swap odd fields")));
62         y += 25;
63         add_tool(swap_even_fields = new DeInterlaceOption(client, this, DEINTERLACE_SWAP_EVEN, x, y, _("Swap even fields")));
64         y += 25;
65         add_tool(avg_even = new DeInterlaceOption(client, this, DEINTERLACE_AVG_EVEN, x, y, _("Average even lines")));
66
67 //      draw_line(170, y + 5, 190, y + 5);
68 //      draw_line(190, y + 5, 190, y + 70);
69 //      draw_line(150, y + 70, 190, y + 70);
70         y += 25;
71         add_tool(avg_odd = new DeInterlaceOption(client, this, DEINTERLACE_AVG_ODD, x, y, _("Average odd lines")));
72 //      draw_line(170, y + 5, 190, y + 5);
73 //      y += 30;
74 //      add_tool(adaptive = new DeInterlaceAdaptive(client, x, y));
75 //      add_tool(threshold = new DeInterlaceThreshold(client, x + 100, y));
76 //      y += 50;
77 //      char string[BCTEXTLEN];
78 //      get_status_string(string, 0);
79 //      add_tool(status = new BC_Title(x, y, string));
80         show_window();
81 }
82
83
84 void DeInterlaceWindow::get_status_string(char *string, int changed_rows)
85 {
86         sprintf(string, _("Changed rows: %d\n"), changed_rows);
87 }
88
89 int DeInterlaceWindow::set_mode(int mode, int recursive)
90 {
91         none->update(mode == DEINTERLACE_NONE);
92         odd_fields->update(mode == DEINTERLACE_EVEN);
93         even_fields->update(mode == DEINTERLACE_ODD);
94         average_fields->update(mode == DEINTERLACE_AVG);
95         swap_odd_fields->update(mode == DEINTERLACE_SWAP_ODD);
96         swap_even_fields->update(mode == DEINTERLACE_SWAP_EVEN);
97         avg_even->update(mode == DEINTERLACE_AVG_EVEN);
98         avg_odd->update(mode == DEINTERLACE_AVG_ODD);
99
100         client->config.mode = mode;
101
102         if(!recursive)
103                 client->send_configure_change();
104         return 0;
105 }
106
107
108 DeInterlaceOption::DeInterlaceOption(DeInterlaceMain *client,
109                 DeInterlaceWindow *window,
110                 int output,
111                 int x,
112                 int y,
113                 char *text)
114  : BC_Radial(x, y, client->config.mode == output, text)
115 {
116         this->client = client;
117         this->window = window;
118         this->output = output;
119 }
120
121 DeInterlaceOption::~DeInterlaceOption()
122 {
123 }
124 int DeInterlaceOption::handle_event()
125 {
126         window->set_mode(output, 0);
127         return 1;
128 }
129
130
131 // DeInterlaceAdaptive::DeInterlaceAdaptive(DeInterlaceMain *client, int x, int y)
132 //  : BC_CheckBox(x, y, client->config.adaptive, _("Adaptive"))
133 // {
134 //      this->client = client;
135 // }
136 // int DeInterlaceAdaptive::handle_event()
137 // {
138 //      client->config.adaptive = get_value();
139 //      client->send_configure_change();
140 //      return 1;
141 // }
142 //
143 //
144 //
145 // DeInterlaceThreshold::DeInterlaceThreshold(DeInterlaceMain *client, int x, int y)
146 //  : BC_IPot(x, y, client->config.threshold, 0, 100)
147 // {
148 //      this->client = client;
149 // }
150 // int DeInterlaceThreshold::handle_event()
151 // {
152 //      client->config.threshold = get_value();
153 //      client->send_configure_change();
154 //      return 1;
155 // }
156 //
157
158
159
160