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