1 #include "awindowgui.h"
4 #include "cwindowgui.h"
6 #include "edlsession.h"
8 #include "levelwindowgui.h"
10 #include "localsession.h"
12 #include "mainsession.h"
14 #include "meterpanel.h"
15 #include "mwindowgui.h"
17 #include "overlayframe.h"
19 #include "playtransport.h"
20 #include "recordgui.h"
21 #include "recordmonitor.h"
22 #include "resourcepixmap.h"
23 #include "statusbar.h"
26 #include "trackcanvas.h"
28 #include "vwindowgui.h"
43 theme_title = DEFAULT_THEME;
47 mtransport_margin = 0;
50 BC_WindowBase::get_resources()->bg_color = BLOND;
51 BC_WindowBase::get_resources()->button_up = 0xffc000;
52 BC_WindowBase::get_resources()->button_highlighted = 0xffe000;
53 BC_WindowBase::get_resources()->recursive_resizing = 0;
63 preferences_category_overlap = 0;
67 #include "data/about_png.h"
68 about_bg = new VFrame(about_png);
78 // Need to delete everything here
83 aspect_ratios.remove_all_objects();
84 frame_rates.remove_all_objects();
85 frame_sizes.remove_all_objects();
86 sample_rates.remove_all_objects();
87 zoom_values.remove_all_objects();
90 void Theme::flush_images()
92 if(data_buffer) delete [] data_buffer;
93 if(contents_buffer) delete [] contents_buffer;
96 contents.remove_all();
99 void Theme::initialize()
101 message_normal = BLACK;
104 // Force to use local data for images
105 extern unsigned char _binary_theme_data_start[];
106 set_data(_binary_theme_data_start);
108 // Set images which weren't set by subclass
109 new_image("mode_add", "mode_add.png");
110 new_image("mode_divide", "mode_divide.png");
111 new_image("mode_multiply", "mode_multiply.png");
112 new_image("mode_normal", "mode_normal.png");
113 new_image("mode_replace", "mode_replace.png");
114 new_image("mode_subtract", "mode_subtract.png");
120 void Theme::build_menus()
124 aspect_ratios.append(new BC_ListBoxItem("3:2"));
125 aspect_ratios.append(new BC_ListBoxItem("4:3"));
126 aspect_ratios.append(new BC_ListBoxItem("16:9"));
127 aspect_ratios.append(new BC_ListBoxItem("2.10:1"));
128 aspect_ratios.append(new BC_ListBoxItem("2.20:1"));
129 aspect_ratios.append(new BC_ListBoxItem("2.25:1"));
130 aspect_ratios.append(new BC_ListBoxItem("2.30:1"));
131 aspect_ratios.append(new BC_ListBoxItem("2.35:1"));
132 aspect_ratios.append(new BC_ListBoxItem("2.66:1"));
133 frame_sizes.append(new BC_ListBoxItem("160x120"));
134 frame_sizes.append(new BC_ListBoxItem("240x180"));
135 frame_sizes.append(new BC_ListBoxItem("320x240"));
136 frame_sizes.append(new BC_ListBoxItem("360x240"));
137 frame_sizes.append(new BC_ListBoxItem("400x300"));
138 frame_sizes.append(new BC_ListBoxItem("512x384"));
139 frame_sizes.append(new BC_ListBoxItem("640x480"));
140 frame_sizes.append(new BC_ListBoxItem("720x480"));
141 frame_sizes.append(new BC_ListBoxItem("720x576"));
142 frame_sizes.append(new BC_ListBoxItem("1280x720"));
143 frame_sizes.append(new BC_ListBoxItem("960x1080"));
144 frame_sizes.append(new BC_ListBoxItem("1920x1080"));
145 frame_sizes.append(new BC_ListBoxItem("1920x1088"));
146 sample_rates.append(new BC_ListBoxItem("8000"));
147 sample_rates.append(new BC_ListBoxItem("16000"));
148 sample_rates.append(new BC_ListBoxItem("22050"));
149 sample_rates.append(new BC_ListBoxItem("32000"));
150 sample_rates.append(new BC_ListBoxItem("44100"));
151 sample_rates.append(new BC_ListBoxItem("48000"));
152 sample_rates.append(new BC_ListBoxItem("96000"));
153 sample_rates.append(new BC_ListBoxItem("192000"));
154 frame_rates.append(new BC_ListBoxItem("1"));
155 frame_rates.append(new BC_ListBoxItem("5"));
156 frame_rates.append(new BC_ListBoxItem("10"));
157 frame_rates.append(new BC_ListBoxItem("12"));
158 frame_rates.append(new BC_ListBoxItem("15"));
159 frame_rates.append(new BC_ListBoxItem("23.97"));
160 frame_rates.append(new BC_ListBoxItem("24"));
161 frame_rates.append(new BC_ListBoxItem("25"));
162 frame_rates.append(new BC_ListBoxItem("29.97"));
163 frame_rates.append(new BC_ListBoxItem("30"));
164 frame_rates.append(new BC_ListBoxItem("50"));
165 frame_rates.append(new BC_ListBoxItem("59.94"));
166 frame_rates.append(new BC_ListBoxItem("60"));
167 char string[BCTEXTLEN];
168 for(int i = 1; i < 17; i++)
170 sprintf(string, "%d", (int)pow(2, i));
171 zoom_values.append(new BC_ListBoxItem(string));
176 void Theme::overlay(VFrame *dst, VFrame *src, int in_x1, int in_x2)
180 unsigned char **in_rows;
181 unsigned char **out_rows;
185 w = MIN(src->get_w(), dst->get_w());
186 h = MIN(dst->get_h(), src->get_h());
193 h = MIN(dst->get_h(), src->get_h());
195 in_rows = src->get_rows();
196 out_rows = dst->get_rows();
198 switch(src->get_color_model())
201 switch(dst->get_color_model())
204 for(int i = 0; i < h; i++)
206 unsigned char *in_row = in_rows[i] + in_x1 * 4;
207 unsigned char *out_row = out_rows[i];
208 for(int j = 0; j < w; j++)
210 int opacity = in_row[3];
211 int transparency = 0xff - opacity;
212 out_row[0] = (in_row[0] * opacity + out_row[0] * transparency) / 0xff;
213 out_row[1] = (in_row[1] * opacity + out_row[1] * transparency) / 0xff;
214 out_row[2] = (in_row[2] * opacity + out_row[2] * transparency) / 0xff;
215 out_row[3] = MAX(in_row[3], out_row[3]);
222 for(int i = 0; i < h; i++)
224 unsigned char *in_row = in_rows[i] + in_x1 * 4;
225 unsigned char *out_row = out_rows[i];
226 for(int j = 0; j < w; j++)
228 int opacity = in_row[3];
229 int transparency = 0xff - opacity;
230 out_row[0] = (in_row[0] * opacity + out_row[0] * transparency) / 0xff;
231 out_row[1] = (in_row[1] * opacity + out_row[1] * transparency) / 0xff;
232 out_row[2] = (in_row[2] * opacity + out_row[2] * transparency) / 0xff;
243 void Theme::build_transport(char *title,
244 unsigned char *png_overlay,
248 if(!png_overlay) return;
249 VFrame default_data(png_overlay);
251 data[0] = new VFrame(0, default_data.get_w(), default_data.get_h(), BC_RGBA8888);
252 data[1] = new VFrame(0, default_data.get_w(), default_data.get_h(), BC_RGBA8888);
253 data[2] = new VFrame(0, default_data.get_w(), default_data.get_h(), BC_RGBA8888);
254 data[0]->clear_frame();
255 data[1]->clear_frame();
256 data[2]->clear_frame();
258 for(int i = 0; i < 3; i++)
262 if(!bg_data[i]) break;
268 in_x2 = default_data.get_w();
272 in_x1 = (int)(bg_data[i]->get_w() * 0.33);
273 in_x2 = in_x1 + default_data.get_w();
277 in_x1 = bg_data[i]->get_w() - default_data.get_w();
278 in_x2 = in_x1 + default_data.get_w();
290 new_image_set_images(title, 3, data[0], data[1], data[2]);
301 void Theme::build_patches(VFrame** &data,
302 unsigned char *png_overlay,
306 if(!png_overlay || !bg_data) return;
307 VFrame default_data(png_overlay);
308 data = new VFrame*[5];
309 data[0] = new VFrame(0, default_data.get_w(), default_data.get_h(), BC_RGBA8888);
310 data[1] = new VFrame(0, default_data.get_w(), default_data.get_h(), BC_RGBA8888);
311 data[2] = new VFrame(0, default_data.get_w(), default_data.get_h(), BC_RGBA8888);
312 data[3] = new VFrame(0, default_data.get_w(), default_data.get_h(), BC_RGBA8888);
313 data[4] = new VFrame(0, default_data.get_w(), default_data.get_h(), BC_RGBA8888);
315 for(int i = 0; i < 5; i++)
324 in_x2 = default_data.get_w();
328 in_x1 = (int)(bg_data[i]->get_w() * 0.33);
329 in_x2 = in_x1 + default_data.get_w();
333 in_x1 = bg_data[i]->get_w() - default_data.get_w();
334 in_x2 = in_x1 + default_data.get_w();
352 void Theme::build_button(VFrame** &data,
353 unsigned char *png_overlay,
358 if(!png_overlay) return;
359 VFrame default_data(png_overlay);
361 if(!up_vframe || !hi_vframe || !dn_vframe) return;
362 data = new VFrame*[3];
363 data[0] = new VFrame(0, default_data.get_w(), default_data.get_h(), BC_RGBA8888);
364 data[1] = new VFrame(0, default_data.get_w(), default_data.get_h(), BC_RGBA8888);
365 data[2] = new VFrame(0, default_data.get_w(), default_data.get_h(), BC_RGBA8888);
366 data[0]->copy_from(up_vframe);
367 data[1]->copy_from(hi_vframe);
368 data[2]->copy_from(dn_vframe);
369 for(int i = 0; i < 3; i++)
374 void Theme::build_toggle(VFrame** &data,
375 unsigned char *png_overlay,
378 VFrame *checked_vframe,
380 VFrame *checkedhi_vframe)
387 !checkedhi_vframe) return;
388 VFrame default_data(png_overlay);
389 data = new VFrame*[5];
390 data[0] = new VFrame(0, default_data.get_w(), default_data.get_h(), BC_RGBA8888);
391 data[1] = new VFrame(0, default_data.get_w(), default_data.get_h(), BC_RGBA8888);
392 data[2] = new VFrame(0, default_data.get_w(), default_data.get_h(), BC_RGBA8888);
393 data[3] = new VFrame(0, default_data.get_w(), default_data.get_h(), BC_RGBA8888);
394 data[4] = new VFrame(0, default_data.get_w(), default_data.get_h(), BC_RGBA8888);
395 data[0]->copy_from(up_vframe);
396 data[1]->copy_from(hi_vframe);
397 data[2]->copy_from(checked_vframe);
398 data[3]->copy_from(dn_vframe);
399 data[4]->copy_from(checkedhi_vframe);
400 for(int i = 0; i < 5; i++)
405 #define TIMEBAR_HEIGHT 10
406 #define PATCHBAY_W 145
410 void Theme::get_mwindow_sizes(MWindowGUI *gui, int w, int h)
414 void Theme::draw_mwindow_bg(MWindowGUI *gui)
421 void Theme::draw_awindow_bg(AWindowGUI *gui)
423 gui->clear_box(0, 0, mwindow->session->awindow_w, mwindow->session->awindow_h);
427 void Theme::draw_vwindow_bg(VWindowGUI *gui)
431 // mwindow->session->vwindow_w,
432 // mwindow->session->vwindow_h);
434 // gui->draw_3segmenth(vtimebar_x,
443 void Theme::draw_cwindow_bg(CWindowGUI *gui)
445 gui->clear_box(0, 0, mwindow->session->cwindow_w, mwindow->session->cwindow_h);
449 void Theme::draw_lwindow_bg(LevelWindowGUI *gui)
451 gui->clear_box(0, 0, mwindow->session->lwindow_w, mwindow->session->lwindow_h);
456 void Theme::draw_rmonitor_bg(RecordMonitorGUI *gui)
458 gui->clear_box(0, 0, mwindow->session->rmonitor_w, mwindow->session->rmonitor_h);
463 void Theme::draw_rwindow_bg(RecordGUI *gui)
465 gui->clear_box(0, 0, mwindow->session->rwindow_w, mwindow->session->rwindow_h);
469 void Theme::draw_resource_bg(TrackCanvas *canvas,
470 ResourcePixmap *pixmap,
481 switch(mwindow->edl->local_session->zoom_track)
483 case 1024: image = get_image("resource1024"); break;
484 case 512: image = get_image("resource512"); break;
485 case 256: image = get_image("resource256"); break;
486 case 128: image = get_image("resource128"); break;
487 case 64: image = get_image("resource64"); break;
489 case 32: image = get_image("resource32"); break;
492 canvas->draw_3segmenth(x1,
501 void Theme::get_vwindow_sizes(VWindowGUI *gui)
505 void Theme::get_cwindow_sizes(CWindowGUI *gui, int cwindow_controls)
509 void Theme::get_awindow_sizes(AWindowGUI *gui)
514 // afolders_y = deletedisk_data[0]->get_h();
516 afolders_w = mwindow->session->afolders_w;
517 afolders_h = mwindow->session->awindow_h - afolders_y;
518 adivider_x = afolders_x + afolders_w;
521 adivider_h = afolders_h;
522 alist_x = afolders_x + afolders_w + 5;
523 alist_y = afolders_y;
524 alist_w = mwindow->session->awindow_w - alist_x;
525 alist_h = afolders_h;
528 void Theme::get_rmonitor_sizes(int do_audio,
541 rmonitor_canvas_y = 30;
547 rmonitor_canvas_y = 0;
556 rmonitor_channel_x = x;
557 rmonitor_channel_y = 5;
559 rmonitor_canvas_y = 35;
565 rmonitor_interlace_x = x;
566 rmonitor_interlace_y = y;
572 rmonitor_meter_x = mwindow->session->rmonitor_w - MeterPanel::get_meters_width(audio_channels, 1);
573 rmonitor_meter_y = 40;
574 rmonitor_meter_h = mwindow->session->rmonitor_h - 10 - rmonitor_meter_y;
578 rmonitor_meter_x = mwindow->session->rmonitor_w;
581 rmonitor_canvas_x = 0;
582 rmonitor_canvas_w = rmonitor_meter_x - rmonitor_canvas_x;
583 if(do_audio) rmonitor_canvas_w -= 10;
584 rmonitor_canvas_h = mwindow->session->rmonitor_h - rmonitor_canvas_y;
587 void Theme::get_recordgui_sizes(RecordGUI *gui, int w, int h)
591 void Theme::get_batchrender_sizes(BatchRenderGUI *gui,
596 batchrender_x2 = 300;
597 batchrender_x3 = 400;
600 void Theme::get_plugindialog_sizes()
603 plugindialog_new_x = x;
604 plugindialog_new_y = y;
605 plugindialog_shared_x = mwindow->session->plugindialog_w / 3;
606 plugindialog_shared_y = y;
607 plugindialog_module_x = mwindow->session->plugindialog_w * 2 / 3;
608 plugindialog_module_y = y;
610 plugindialog_new_w = plugindialog_shared_x - plugindialog_new_x - 10;
611 plugindialog_new_h = mwindow->session->plugindialog_h - 100;
612 plugindialog_shared_w = plugindialog_module_x - plugindialog_shared_x - 10;
613 plugindialog_shared_h = mwindow->session->plugindialog_h - 100;
614 plugindialog_module_w = mwindow->session->plugindialog_w - plugindialog_module_x - 10;
615 plugindialog_module_h = mwindow->session->plugindialog_h - 100;
617 plugindialog_newattach_x = plugindialog_new_x + 20;
618 plugindialog_newattach_y = plugindialog_new_y + plugindialog_new_h + 10;
619 plugindialog_sharedattach_x = plugindialog_shared_x + 20;
620 plugindialog_sharedattach_y = plugindialog_shared_y + plugindialog_shared_h + 10;
621 plugindialog_moduleattach_x = plugindialog_module_x + 20;
622 plugindialog_moduleattach_y = plugindialog_module_y + plugindialog_module_h + 10;
625 void Theme::get_menueffect_sizes(int use_list)
629 menueffect_list_x = 10;
630 menueffect_list_y = 10;
631 menueffect_list_w = mwindow->session->menueffect_w - 400;
632 menueffect_list_h = mwindow->session->menueffect_h -
634 BC_OKButton::calculate_h() - 10;
638 menueffect_list_x = 0;
639 menueffect_list_y = 10;
640 menueffect_list_w = 0;
641 menueffect_list_h = 0;
644 menueffect_file_x = menueffect_list_x + menueffect_list_w + 10;
645 menueffect_file_y = 10;
647 menueffect_tools_x = menueffect_file_x;
648 menueffect_tools_y = menueffect_file_y + 20;
651 void Theme::get_preferences_sizes()
655 void Theme::draw_preferences_bg(PreferencesWindow *gui)
659 void Theme::get_new_sizes(NewWindow *gui)
663 void Theme::draw_new_bg(NewWindow *gui)
667 void Theme::draw_new_bg2(NewWindow *gui,BC_WidgetGrid *grid_A,BC_WidgetGrid *grid_V)
671 void Theme::draw_setformat_bg(SetFormatWindow *window)
684 // c-file-style: "linux"