1 #include "bcdisplayinfo.h"
2 #include "deinterwindow.h"
6 #define _(String) gettext(String)
7 #define gettext_noop(String) String
8 #define N_(String) gettext_noop (String)
12 PLUGIN_THREAD_OBJECT(DeInterlaceMain, DeInterlaceThread, DeInterlaceWindow)
17 DeInterlaceWindow::DeInterlaceWindow(DeInterlaceMain *client, int x, int y)
18 : BC_Window(client->gui_string,
29 this->client = client;
32 DeInterlaceWindow::~DeInterlaceWindow()
36 int DeInterlaceWindow::create_objects()
39 add_tool(new BC_Title(x, y, _("Select lines to keep")));
41 add_tool(none = new DeInterlaceOption(client, this, DEINTERLACE_NONE, x, y, _("Do nothing")));
43 add_tool(odd_fields = new DeInterlaceOption(client, this, DEINTERLACE_EVEN, x, y, _("Odd lines")));
45 add_tool(even_fields = new DeInterlaceOption(client, this, DEINTERLACE_ODD, x, y, _("Even lines")));
47 add_tool(average_fields = new DeInterlaceOption(client, this, DEINTERLACE_AVG, x, y, _("Average lines")));
49 add_tool(swap_odd_fields = new DeInterlaceOption(client, this, DEINTERLACE_SWAP_ODD, x, y, _("Swap odd fields")));
51 add_tool(swap_even_fields = new DeInterlaceOption(client, this, DEINTERLACE_SWAP_EVEN, x, y, _("Swap even fields")));
53 add_tool(temporalswap_top_fields = new DeInterlaceOption(client, this, DEINTERLACE_TEMPORALSWAP_TOP, x, y, _("Temporal swap top field first")));
56 add_tool(temporalswap_bottom_fields = new DeInterlaceOption(client, this, DEINTERLACE_TEMPORALSWAP_BOTTOM, x, y, _("Temporal swap bottom field first")));
58 add_tool(avg_even = new DeInterlaceOption(client, this, DEINTERLACE_AVG_EVEN, x, y, _("Average even lines")));
59 draw_line(170, y + 5, 190, y + 5);
60 draw_line(190, y + 5, 190, y + 70);
61 draw_line(150, y + 70, 190, y + 70);
63 add_tool(avg_odd = new DeInterlaceOption(client, this, DEINTERLACE_AVG_ODD, x, y, _("Average odd lines")));
64 draw_line(170, y + 5, 190, y + 5);
66 add_tool(adaptive = new DeInterlaceAdaptive(client, x, y));
67 add_tool(threshold = new DeInterlaceThreshold(client, x + 100, y));
69 char string[BCTEXTLEN];
70 get_status_string(string, 0);
71 add_tool(status = new BC_Title(x, y, string));
78 WINDOW_CLOSE_EVENT(DeInterlaceWindow)
80 void DeInterlaceWindow::get_status_string(char *string, int changed_rows)
82 sprintf(string, _("Changed rows: %d\n"), changed_rows);
85 int DeInterlaceWindow::set_mode(int mode, int recursive)
87 none->update(mode == DEINTERLACE_NONE);
88 odd_fields->update(mode == DEINTERLACE_EVEN);
89 even_fields->update(mode == DEINTERLACE_ODD);
90 average_fields->update(mode == DEINTERLACE_AVG);
91 swap_odd_fields->update(mode == DEINTERLACE_SWAP_ODD);
92 swap_even_fields->update(mode == DEINTERLACE_SWAP_EVEN);
93 temporalswap_top_fields->update(mode == DEINTERLACE_TEMPORALSWAP_TOP);
94 temporalswap_bottom_fields->update(mode == DEINTERLACE_TEMPORALSWAP_BOTTOM);
95 avg_even->update(mode == DEINTERLACE_AVG_EVEN);
96 avg_odd->update(mode == DEINTERLACE_AVG_ODD);
98 client->config.mode = mode;
101 client->send_configure_change();
106 DeInterlaceOption::DeInterlaceOption(DeInterlaceMain *client,
107 DeInterlaceWindow *window,
112 : BC_Radial(x, y, client->config.mode == output, text)
114 this->client = client;
115 this->window = window;
116 this->output = output;
119 DeInterlaceOption::~DeInterlaceOption()
122 int DeInterlaceOption::handle_event()
124 window->set_mode(output, 0);
129 DeInterlaceAdaptive::DeInterlaceAdaptive(DeInterlaceMain *client, int x, int y)
130 : BC_CheckBox(x, y, client->config.adaptive, _("Adaptive"))
132 this->client = client;
134 int DeInterlaceAdaptive::handle_event()
136 client->config.adaptive = get_value();
137 client->send_configure_change();
143 DeInterlaceThreshold::DeInterlaceThreshold(DeInterlaceMain *client, int x, int y)
144 : BC_IPot(x, y, client->config.threshold, 0, 100)
146 this->client = client;
148 int DeInterlaceThreshold::handle_event()
150 client->config.threshold = get_value();
151 client->send_configure_change();