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(avg_even = new DeInterlaceOption(client, this, DEINTERLACE_AVG_EVEN, x, y, _("Average even lines")));
54 draw_line(170, y + 5, 190, y + 5);
55 draw_line(190, y + 5, 190, y + 70);
56 draw_line(150, y + 70, 190, y + 70);
58 add_tool(avg_odd = new DeInterlaceOption(client, this, DEINTERLACE_AVG_ODD, x, y, _("Average odd lines")));
59 draw_line(170, y + 5, 190, y + 5);
61 add_tool(adaptive = new DeInterlaceAdaptive(client, x, y));
62 add_tool(threshold = new DeInterlaceThreshold(client, x + 100, y));
64 char string[BCTEXTLEN];
65 get_status_string(string, 0);
66 add_tool(status = new BC_Title(x, y, string));
73 WINDOW_CLOSE_EVENT(DeInterlaceWindow)
75 void DeInterlaceWindow::get_status_string(char *string, int changed_rows)
77 sprintf(string, _("Changed rows: %d\n"), changed_rows);
80 int DeInterlaceWindow::set_mode(int mode, int recursive)
82 none->update(mode == DEINTERLACE_NONE);
83 odd_fields->update(mode == DEINTERLACE_EVEN);
84 even_fields->update(mode == DEINTERLACE_ODD);
85 average_fields->update(mode == DEINTERLACE_AVG);
86 swap_odd_fields->update(mode == DEINTERLACE_SWAP_ODD);
87 swap_even_fields->update(mode == DEINTERLACE_SWAP_EVEN);
88 avg_even->update(mode == DEINTERLACE_AVG_EVEN);
89 avg_odd->update(mode == DEINTERLACE_AVG_ODD);
91 client->config.mode = mode;
94 client->send_configure_change();
99 DeInterlaceOption::DeInterlaceOption(DeInterlaceMain *client,
100 DeInterlaceWindow *window,
105 : BC_Radial(x, y, client->config.mode == output, text)
107 this->client = client;
108 this->window = window;
109 this->output = output;
112 DeInterlaceOption::~DeInterlaceOption()
115 int DeInterlaceOption::handle_event()
117 window->set_mode(output, 0);
122 DeInterlaceAdaptive::DeInterlaceAdaptive(DeInterlaceMain *client, int x, int y)
123 : BC_CheckBox(x, y, client->config.adaptive, _("Adaptive"))
125 this->client = client;
127 int DeInterlaceAdaptive::handle_event()
129 client->config.adaptive = get_value();
130 client->send_configure_change();
136 DeInterlaceThreshold::DeInterlaceThreshold(DeInterlaceMain *client, int x, int y)
137 : BC_IPot(x, y, client->config.threshold, 0, 100)
139 this->client = client;
141 int DeInterlaceThreshold::handle_event()
143 client->config.threshold = get_value();
144 client->send_configure_change();