4 * Copyright (C) 1997-2011 Adam Williams <broadcast at earthling dot net>
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.
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.
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
22 #include "awindowgui.h"
23 #include "bcsignals.h"
26 #include "cwindowgui.h"
29 #include "edlsession.h"
30 #include "keyframegui.h"
32 #include "levelwindowgui.h"
34 #include "localsession.h"
36 #include "mainsession.h"
38 #include "meterpanel.h"
39 #include "mwindowgui.h"
41 #include "overlayframe.h"
43 #include "playtransport.h"
44 //#include "presetsgui.h"
45 #include "recordgui.h"
46 #include "recordmonitor.h"
47 #include "resourcepixmap.h"
48 #include "statusbar.h"
52 #include "trackcanvas.h"
54 #include "vwindowgui.h"
62 new VFrame(default_data.get_w(), default_data.get_h(), BC_RGBA8888)
67 window_border = xS(10);
68 widget_border = xS(5);
70 theme_title = _(DEFAULT_THEME);
72 mtransport_margin = 0;
74 control_pixels = xS(50);
75 stack_button_w = xS(32);
76 timebar_cursor_color = RED;
78 BC_WindowBase::get_resources()->bg_color = BLOND;
79 BC_WindowBase::get_resources()->button_up = 0xffc000;
80 BC_WindowBase::get_resources()->button_highlighted = 0xffe000;
81 BC_WindowBase::get_resources()->recursive_resizing = 0;
83 zero_crossing_color = 0xc03545;
84 graph_active_color = GRAPH_ACTIVE_COLOR;
85 graph_inactive_color = GRAPH_INACTIVE_COLOR;
86 graph_grid_color = GRAPH_GRID_COLOR;
87 graph_bg_color = GRAPH_BG_COLOR;
88 graph_border1_color = GRAPH_BORDER1_COLOR;
89 graph_border2_color = GRAPH_BORDER2_COLOR;
91 inout_highlight_color = GREEN;
98 clock_bg_color = BLACK;
99 clock_fg_color = GREEN;
100 assetedit_color = YELLOW;
101 const char *cp = getenv("BC_USE_COMMERCIALS");
102 use_commercials = !cp ? 0 : atoi(cp);
104 preferences_category_overlap = 0;
106 loadmode_w = xS(350);
109 #include "data/about_bg_png.h"
110 about_bg = new VFramePng(about_bg_png);
113 drag_pane_color = WHITE;
115 appendasset_data = 0;
117 asset_append_data = 0;
119 asset_index_data = 0;
121 asset_project_data = 0;
124 camerakeyframe_data = 0;
128 channel_position_data = 0;
129 delete_all_indexes_data = 0;
133 deleteproject_data = 0;
138 edithandlein_data = 0;
139 edithandleout_data = 0;
144 mask_mode_toggle = 0;
151 maskkeyframe_data = 0;
152 modekeyframe_data = 0;
162 pankeyframe_data = 0;
166 presentation_data = 0;
167 presentation_loop = 0;
168 presentation_stop = 0;
169 projectorkeyframe_data = 0;
170 redrawindex_data = 0;
179 statusbar_cancel_data = 0;
180 timebar_view_data = 0;
182 tumblepatch_data = 0;
185 vtimebar_bg_data = 0;
189 // Need to delete everything here
194 aspect_ratios.remove_all_objects();
195 frame_rates.remove_all_objects();
196 frame_sizes.remove_all_objects();
197 sample_rates.remove_all_objects();
198 zoom_values.remove_all_objects();
203 void Theme::flush_images()
207 void Theme::initialize()
209 message_normal = BLACK;
212 // Force to use local data for images
213 extern unsigned char _binary_theme_data_start[];
214 set_data(_binary_theme_data_start);
216 // Set images which weren't set by subclass
217 new_image("mode_normal", "mode_normal.png");
218 new_image("mode_add", "mode_add.png");
219 new_image("mode_subtract", "mode_subtract.png");
220 new_image("mode_multiply", "mode_multiply.png");
221 new_image("mode_divide", "mode_divide.png");
222 new_image("mode_replace", "mode_replace.png");
223 new_image("mode_max", "mode_max.png");
224 new_image("mode_min", "mode_min.png");
225 new_image("mode_darken", "mode_darken.png");
226 new_image("mode_lighten", "mode_lighten.png");
227 new_image("mode_dst", "mode_dst.png");
228 new_image("mode_dstatop", "mode_dstatop.png");
229 new_image("mode_dstin", "mode_dstin.png");
230 new_image("mode_dstout", "mode_dstout.png");
231 new_image("mode_dstover", "mode_dstover.png");
232 new_image("mode_src", "mode_src.png");
233 new_image("mode_srcatop", "mode_srcatop.png");
234 new_image("mode_srcin", "mode_srcin.png");
235 new_image("mode_srcout", "mode_srcout.png");
236 new_image("mode_srcover", "mode_srcover.png");
237 new_image("mode_and", "mode_and.png");
238 new_image("mode_or", "mode_or.png");
239 new_image("mode_xor", "mode_xor.png");
240 new_image("mode_overlay", "mode_overlay.png");
241 new_image("mode_screen", "mode_screen.png");
242 new_image("mode_burn", "mode_burn.png");
243 new_image("mode_dodge", "mode_dodge.png");
244 new_image("mode_hardlight", "mode_hardlight.png");
245 new_image("mode_softlight", "mode_softlight.png");
246 new_image("mode_difference", "mode_difference.png");
248 new_image_set("mode_popup", 3, "mode_up.png", "mode_hi.png", "mode_dn.png");
250 // Images all themes have
251 new_image("mwindow_icon", "heroine_icon.png");
252 new_image("vwindow_icon", "heroine_icon.png");
253 new_image("cwindow_icon", "heroine_icon.png");
254 new_image("awindow_icon", "heroine_icon.png");
255 new_image("record_icon", "heroine_icon.png");
256 new_image("clip_icon", "clip_icon.png");
257 new_image_set("mixpatch_data", 5, "mixpatch_up.png", "mixpatch_hi.png",
258 "mixpatch_checked.png", "mixpatch_dn.png", "mixpatch_checkedhi.png");
261 new_image("aeffect_icon", "aeffect_icon.png");
262 new_image("veffect_icon", "veffect_icon.png");
263 new_image("atransition_icon", "atransition_icon.png");
264 new_image("vtransition_icon", "atransition_icon.png");
272 void Theme::build_menus()
274 aspect_ratios.append(new BC_ListBoxItem("3:2"));
275 aspect_ratios.append(new BC_ListBoxItem("4:3"));
276 aspect_ratios.append(new BC_ListBoxItem("16:9"));
277 aspect_ratios.append(new BC_ListBoxItem("2.10:1"));
278 aspect_ratios.append(new BC_ListBoxItem("2.20:1"));
279 aspect_ratios.append(new BC_ListBoxItem("2.25:1"));
280 aspect_ratios.append(new BC_ListBoxItem("2.30:1"));
281 aspect_ratios.append(new BC_ListBoxItem("2.35:1"));
282 aspect_ratios.append(new BC_ListBoxItem("2.66:1"));
284 frame_sizes.append(new BC_ListBoxItem("128x96 "));
285 frame_sizes.append(new BC_ListBoxItem("160x120 "));
286 frame_sizes.append(new BC_ListBoxItem("320x240 "));
287 frame_sizes.append(new BC_ListBoxItem("360x240 "));
288 frame_sizes.append(new BC_ListBoxItem("400x300 "));
289 frame_sizes.append(new BC_ListBoxItem("640x360 nHD"));
290 frame_sizes.append(new BC_ListBoxItem("640x400 "));
291 frame_sizes.append(new BC_ListBoxItem("640x480 VGA"));
292 frame_sizes.append(new BC_ListBoxItem("720x480 NTSC"));
293 frame_sizes.append(new BC_ListBoxItem("720x576 PAL"));
294 frame_sizes.append(new BC_ListBoxItem("768x432 "));
295 frame_sizes.append(new BC_ListBoxItem("800x450 "));
296 frame_sizes.append(new BC_ListBoxItem("800x600 SVGA"));
297 frame_sizes.append(new BC_ListBoxItem("896x504 "));
298 frame_sizes.append(new BC_ListBoxItem("960x540 qHD"));
299 frame_sizes.append(new BC_ListBoxItem("1024x576 "));
300 frame_sizes.append(new BC_ListBoxItem("1024x768 XGA"));
301 frame_sizes.append(new BC_ListBoxItem("1152x648 "));
302 frame_sizes.append(new BC_ListBoxItem("1280x720 HD"));
303 frame_sizes.append(new BC_ListBoxItem("1280x1024 SXGA"));
304 frame_sizes.append(new BC_ListBoxItem("1366x768 WXGA"));
305 frame_sizes.append(new BC_ListBoxItem("1600x900 HD+"));
306 frame_sizes.append(new BC_ListBoxItem("1600x1200 UXGA"));
307 frame_sizes.append(new BC_ListBoxItem("1920x1080 Full HD"));
308 frame_sizes.append(new BC_ListBoxItem("2048x1152 "));
309 frame_sizes.append(new BC_ListBoxItem("2304x1296 "));
310 frame_sizes.append(new BC_ListBoxItem("2560x1440 QHD"));
311 frame_sizes.append(new BC_ListBoxItem("2880x1620 "));
312 frame_sizes.append(new BC_ListBoxItem("3200x1800 QHD+"));
313 frame_sizes.append(new BC_ListBoxItem("3520x1980 "));
314 frame_sizes.append(new BC_ListBoxItem("3840x2160 4K UHD"));
315 frame_sizes.append(new BC_ListBoxItem("4096x2304 Full 4K UHD"));
316 frame_sizes.append(new BC_ListBoxItem("4480x2520 "));
317 frame_sizes.append(new BC_ListBoxItem("5120x2880 5K UHD"));
318 frame_sizes.append(new BC_ListBoxItem("5760x3240 "));
319 frame_sizes.append(new BC_ListBoxItem("6400x3600 "));
320 frame_sizes.append(new BC_ListBoxItem("7040x3960 "));
321 frame_sizes.append(new BC_ListBoxItem("7680x4320 8K UHD"));
323 sample_rates.append(new BC_ListBoxItem("8000"));
324 sample_rates.append(new BC_ListBoxItem("16000"));
325 sample_rates.append(new BC_ListBoxItem("22050"));
326 sample_rates.append(new BC_ListBoxItem("32000"));
327 sample_rates.append(new BC_ListBoxItem("44100"));
328 sample_rates.append(new BC_ListBoxItem("48000"));
329 sample_rates.append(new BC_ListBoxItem("96000"));
330 sample_rates.append(new BC_ListBoxItem("192000"));
332 frame_rates.append(new BC_ListBoxItem("0.25"));
333 frame_rates.append(new BC_ListBoxItem("1"));
334 frame_rates.append(new BC_ListBoxItem("5"));
335 frame_rates.append(new BC_ListBoxItem("10"));
336 frame_rates.append(new BC_ListBoxItem("12"));
337 frame_rates.append(new BC_ListBoxItem("15"));
338 frame_rates.append(new BC_ListBoxItem("23.976"));
339 frame_rates.append(new BC_ListBoxItem("24"));
340 frame_rates.append(new BC_ListBoxItem("25"));
341 frame_rates.append(new BC_ListBoxItem("29.97"));
342 frame_rates.append(new BC_ListBoxItem("30"));
343 frame_rates.append(new BC_ListBoxItem("50"));
344 frame_rates.append(new BC_ListBoxItem("59.94"));
345 frame_rates.append(new BC_ListBoxItem("60"));
346 frame_rates.append(new BC_ListBoxItem("100"));
347 frame_rates.append(new BC_ListBoxItem("120"));
348 frame_rates.append(new BC_ListBoxItem("1000"));
350 char string[BCTEXTLEN];
351 for(int i = 1; i < 17; i++)
353 sprintf(string, "%d", (int)pow(2, i));
354 zoom_values.append(new BC_ListBoxItem(string));
359 void Theme::overlay(VFrame *dst, VFrame *src, int in_x1, int in_x2)
363 unsigned char **in_rows;
364 unsigned char **out_rows;
368 w = MIN(src->get_w(), dst->get_w());
369 h = MIN(dst->get_h(), src->get_h());
376 h = MIN(dst->get_h(), src->get_h());
378 in_rows = src->get_rows();
379 out_rows = dst->get_rows();
381 switch(src->get_color_model())
384 switch(dst->get_color_model())
387 for(int i = 0; i < h; i++)
389 unsigned char *in_row = in_rows[i] + in_x1 * 4;
390 unsigned char *out_row = out_rows[i];
391 for(int j = 0; j < w; j++)
393 int opacity = in_row[3];
394 int transparency = out_row[3] * (0xff - opacity) / 0xff;
395 out_row[0] = (in_row[0] * opacity + out_row[0] * transparency) / 0xff;
396 out_row[1] = (in_row[1] * opacity + out_row[1] * transparency) / 0xff;
397 out_row[2] = (in_row[2] * opacity + out_row[2] * transparency) / 0xff;
398 out_row[3] = MAX(in_row[3], out_row[3]);
405 for(int i = 0; i < h; i++)
407 unsigned char *in_row = in_rows[i] + in_x1 * 4;
408 unsigned char *out_row = out_rows[i];
409 for(int j = 0; j < w; j++)
411 int opacity = in_row[3];
412 int transparency = 0xff - opacity;
413 out_row[0] = (in_row[0] * opacity + out_row[0] * transparency) / 0xff;
414 out_row[1] = (in_row[1] * opacity + out_row[1] * transparency) / 0xff;
415 out_row[2] = (in_row[2] * opacity + out_row[2] * transparency) / 0xff;
426 void Theme::build_transport(char *title,
427 unsigned char *png_overlay,
431 if(!png_overlay) return;
432 VFramePng default_data(png_overlay);
434 data[0] = NEW_VFRAME;
435 data[1] = NEW_VFRAME;
436 data[2] = NEW_VFRAME;
437 data[0]->clear_frame();
438 data[1]->clear_frame();
439 data[2]->clear_frame();
441 for(int i = 0; i < 3; i++)
445 if(!bg_data[i]) break;
451 in_x2 = default_data.get_w();
455 in_x1 = (int)(bg_data[i]->get_w() * 0.33);
456 in_x2 = in_x1 + default_data.get_w();
460 in_x1 = bg_data[i]->get_w() - default_data.get_w();
461 in_x2 = in_x1 + default_data.get_w();
465 overlay(data[i], bg_data[i], in_x1, in_x2);
466 overlay(data[i], &default_data);
469 new_image_set_images(title, 3, data[0], data[1], data[2]);
480 void Theme::build_patches(VFrame** &data,
481 unsigned char *png_overlay,
485 if(!png_overlay || !bg_data) return;
486 VFramePng default_data(png_overlay);
487 data = new VFrame*[5];
488 data[0] = NEW_VFRAME;
489 data[1] = NEW_VFRAME;
490 data[2] = NEW_VFRAME;
491 data[3] = NEW_VFRAME;
492 data[4] = NEW_VFRAME;
494 for(int i = 0; i < 5; i++)
504 in_x2 = default_data.get_w();
508 in_x1 = (int)(bg_data[i]->get_w() * 0.33);
509 in_x2 = in_x1 + default_data.get_w();
513 in_x1 = bg_data[i]->get_w() - default_data.get_w();
514 in_x2 = in_x1 + default_data.get_w();
532 void Theme::build_button(VFrame** &data,
533 unsigned char *png_overlay,
538 if(!png_overlay) return;
539 VFramePng default_data(png_overlay);
541 if(!up_vframe || !hi_vframe || !dn_vframe) return;
542 data = new VFrame*[3];
543 data[0] = NEW_VFRAME;
544 data[1] = NEW_VFRAME;
545 data[2] = NEW_VFRAME;
546 data[0]->copy_from(up_vframe);
547 data[1]->copy_from(hi_vframe);
548 data[2]->copy_from(dn_vframe);
549 for(int i = 0; i < 3; i++)
554 void Theme::build_button(VFrame** &data,
555 unsigned char *png_overlay,
561 if(!png_overlay) return;
562 VFramePng default_data(png_overlay);
564 if(!up_vframe || !hi_vframe || !dn_vframe) return;
565 data = new VFrame*[4];
566 data[0] = NEW_VFRAME;
567 data[1] = NEW_VFRAME;
568 data[2] = NEW_VFRAME;
569 data[3] = NEW_VFRAME;
570 data[0]->copy_from(up_vframe);
571 data[1]->copy_from(hi_vframe);
572 data[2]->copy_from(dn_vframe);
573 data[2]->copy_from(at_vframe);
574 for(int i = 0; i < 4; i++)
579 void Theme::build_toggle(VFrame** &data,
580 unsigned char *png_overlay,
583 VFrame *checked_vframe,
585 VFrame *checkedhi_vframe)
592 !checkedhi_vframe) return;
593 VFramePng default_data(png_overlay);
594 data = new VFrame*[5];
595 data[0] = NEW_VFRAME;
596 data[1] = NEW_VFRAME;
597 data[2] = NEW_VFRAME;
598 data[3] = NEW_VFRAME;
599 data[4] = NEW_VFRAME;
600 data[0]->copy_from(up_vframe);
601 data[1]->copy_from(hi_vframe);
602 data[2]->copy_from(checked_vframe);
603 data[3]->copy_from(dn_vframe);
604 data[4]->copy_from(checkedhi_vframe);
605 for(int i = 0; i < 5; i++)
611 void Theme::get_mwindow_sizes(MWindowGUI *gui, int w, int h)
614 mbuttons_y = gui->menu_h() + yS(1);
615 mbuttons_w = w - (ffmpeg_toggle[0]->get_w()+xS(2) +
616 proxy_p_toggle[0]->get_w()+xS(2) +
618 mbuttons_h = get_image("mbutton_bg")->get_h();
619 mclock_x = window_border - xS(5);
620 mclock_y = mbuttons_y-1 + mbuttons_h;
621 mclock_w = get_image("clock_bg")->get_w() - xS(20);
622 mclock_h = get_image("clock_bg")->get_h();
623 mtimebar_x = get_image("patchbay_bg")->get_w();
624 mtimebar_y = mbuttons_y - 1 + mbuttons_h;
625 mtimebar_w = w - mtimebar_x;
626 mtimebar_h = get_image("timebar_bg")->get_h();
629 mzoom_y = h - get_image("statusbar")->get_h();
632 mstatus_y = mzoom_y + mzoom_h;
634 mstatus_h = h - mstatus_y;
635 mstatus_message_x = xS(10);
636 mstatus_message_y = yS(5);
637 mstatus_progress_x = mstatus_w - statusbar_cancel_data[0]->get_w() - xS(240);
638 mstatus_progress_y = mstatus_h - BC_WindowBase::get_resources()->progress_images[0]->get_h() - yS(3);
639 mstatus_progress_w = xS(230);
640 mstatus_cancel_x = mstatus_w - statusbar_cancel_data[0]->get_w();
641 mstatus_cancel_y = mstatus_h - statusbar_cancel_data[0]->get_h();
643 mcanvas_y = mbuttons_y-1 + mbuttons_h;
645 mcanvas_h = mzoom_y - mtimebar_y;
646 control_pixels = (mcanvas_w * control_pixels) / 1000;
648 patchbay_y = mcanvas_y + mclock_h;
649 patchbay_w = get_image("patchbay_bg")->get_w();
650 patchbay_h = mcanvas_h - mclock_h;
651 pane_w = get_image_set("xpane")[0]->get_w();
652 pane_h = get_image_set("ypane")[0]->get_h();
653 pane_x = mcanvas_x + mcanvas_w;
654 pane_y = mcanvas_y + mcanvas_h;
656 mhscroll_y = mcanvas_y + mcanvas_h - BC_ScrollBar::get_span(SCROLL_HORIZ);
657 mhscroll_w = w - BC_ScrollBar::get_span(SCROLL_VERT);
658 mvscroll_x = mcanvas_x + mcanvas_w;
659 mvscroll_y = mcanvas_y;
660 mvscroll_h = mcanvas_h;
663 void Theme::get_pane_sizes(MWindowGUI *gui,
664 int *view_x, int *view_y, int *view_w, int *view_h,
665 int number, int x, int y, int w, int h)
673 if(number == TOP_LEFT_PANE ||
674 number == BOTTOM_LEFT_PANE)
676 *view_x += patchbay_w;
677 *view_w -= patchbay_w;
681 if(number == TOP_LEFT_PANE ||
682 number == TOP_RIGHT_PANE)
684 *view_y += mtimebar_h;
685 *view_h -= mtimebar_h;
689 if(number == BOTTOM_LEFT_PANE ||
690 number == BOTTOM_RIGHT_PANE ||
691 gui->horizontal_panes() ||
692 gui->total_panes() == 1)
694 *view_h -= BC_ScrollBar::get_span(SCROLL_HORIZ);
698 if(number == TOP_RIGHT_PANE ||
699 number == BOTTOM_RIGHT_PANE ||
700 gui->vertical_panes() ||
701 gui->total_panes() == 1)
703 *view_w -= BC_ScrollBar::get_span(SCROLL_VERT);
707 void Theme::draw_mwindow_bg(MWindowGUI *gui)
712 void Theme::get_cwindow_sizes(CWindowGUI *gui, int cwindow_controls)
714 int total_buttons = !use_commercials ? 16 : 17;
715 int edit_w = EditPanel::calculate_w(mwindow, 1, total_buttons);
716 int transport_w = PlayTransport::get_transport_width(mwindow) + toggle_margin;
717 int zoom_w = ZoomPanel::calculate_w(czoom_w);
718 int status_w = get_image("cwindow_active")->get_w();
719 // Space between buttons & status icon
720 int division_w = xS(24);
727 if(mwindow->edl->session->cwindow_meter)
729 cmeter_x = mwindow->session->cwindow_w -
730 MeterPanel::get_meters_width(this,
731 mwindow->edl->session->audio_channels,
732 mwindow->edl->session->cwindow_meter);
736 cmeter_x = mwindow->session->cwindow_w;
740 int buttons_h = get_image("rewind")->get_h() + widget_border;
741 int panel_y = mwindow->session->cwindow_h - buttons_h + yS(4);
742 ctransport_x = widget_border;
743 if( ctransport_x + transport_w + widget_border +
744 edit_w + widget_border + zoom_w + widget_border +
745 division_w + status_w > cmeter_x ) {
746 ctransport_y = panel_y;
747 czoom_x = ctransport_x + transport_w + widget_border;
750 cstatus_y = panel_y - yS(2);
751 int edit_h = EditPanel::calculate_h(mwindow) + widget_border;
752 buttons_h += edit_h; panel_y -= edit_h;
753 cedit_x = widget_border;
757 ctransport_x = widget_border;
758 ctransport_y = panel_y;
759 cedit_x = ctransport_x + transport_w + widget_border;
761 czoom_x = cedit_x + edit_w + widget_border;
763 cstatus_x = czoom_x + zoom_w + division_w;
766 buttons_h += ctimebar_h;
768 ccomposite_x = xS(0);
769 ccomposite_y = yS(5);
770 ccomposite_w = get_image("cpanel_bg")->get_w();
771 ccomposite_h = mwindow->session->cwindow_h - buttons_h;
773 ccanvas_x = ccomposite_x + ccomposite_w;
775 ccanvas_h = ccomposite_h;
777 ccanvas_w = cmeter_x - ccanvas_x - widget_border;
784 ccomposite_x = -get_image("cpanel_bg")->get_w();
786 ccomposite_w = get_image("cpanel_bg")->get_w();
787 ccomposite_h = mwindow->session->cwindow_h - get_image("cbuttons_left")->get_h();
790 cedit_y = mwindow->session->cwindow_h + yS(17);
791 ctransport_x = xS(10);
792 ctransport_y = cedit_y + yS(40);
795 ccanvas_w = mwindow->session->cwindow_w;
796 ccanvas_h = mwindow->session->cwindow_h;
797 cmeter_x = mwindow->session->cwindow_w;
798 cstatus_x = mwindow->session->cwindow_w;
799 cstatus_y = mwindow->session->cwindow_h;
800 czoom_x = mwindow->session->cwindow_w;
801 czoom_y = mwindow->session->cwindow_h;
808 cmeter_y = widget_border;
809 cmeter_h = mwindow->session->cwindow_h - cmeter_y - widget_border;
811 // ctimebar_x = ccanvas_x;
812 // ctimebar_y = ccanvas_y + ccanvas_h;
813 // ctimebar_w = ccanvas_w;
815 ctimebar_y = ccanvas_y + ccanvas_h;
816 ctimebar_w = mwindow->session->cwindow_w;
817 if(mwindow->edl->session->cwindow_meter)
819 ctimebar_w = cmeter_x - widget_border;
829 void Theme::draw_awindow_bg(AWindowGUI *gui)
831 gui->clear_box(0, 0, mwindow->session->awindow_w, mwindow->session->awindow_h);
835 void Theme::draw_vwindow_bg(VWindowGUI *gui)
839 // mwindow->session->vwindow_w,
840 // mwindow->session->vwindow_h);
842 // gui->draw_3segmenth(vtimebar_x,
851 void Theme::draw_cwindow_bg(CWindowGUI *gui)
853 gui->clear_box(0, 0, mwindow->session->cwindow_w, mwindow->session->cwindow_h);
857 void Theme::draw_lwindow_bg(LevelWindowGUI *gui)
859 gui->clear_box(0, 0, mwindow->session->lwindow_w, mwindow->session->lwindow_h);
864 void Theme::draw_rmonitor_bg(RecordMonitorGUI *gui)
866 gui->clear_box(0, 0, mwindow->session->rmonitor_w, mwindow->session->rmonitor_h);
871 void Theme::draw_rwindow_bg(RecordGUI *gui)
873 gui->clear_box(0, 0, mwindow->session->rwindow_w, mwindow->session->rwindow_h);
877 void Theme::draw_resource_bg(TrackCanvas *canvas, ResourcePixmap *pixmap,
878 int color, Edit *edit, int edit_x, int edit_w,
879 int pixmap_x, int x1, int y1, int x2, int y2)
882 int data_h = edit->track->data_h;
884 case 1024: image = get_image("resource1024"); break;
885 case 512: image = get_image("resource512"); break;
886 case 256: image = get_image("resource256"); break;
887 case 128: image = get_image("resource128"); break;
888 case 64: image = get_image("resource64"); break;
891 image = get_image("resource32");
893 VFrame *frame = image;
894 int bg_color = canvas->get_bg_color();
896 int alpha = (~color >> 24) & 0xff;
897 frame = pixmap->change_picon_alpha(image, alpha);
898 canvas->set_bg_color(color & 0xffffff);
900 canvas->draw_3segmenth(x1, y1, x2 - x1,
901 edit_x - pixmap_x, edit_w, frame, pixmap);
902 if( frame != image ) {
904 canvas->set_bg_color(bg_color);
909 void Theme::get_vwindow_sizes(VWindowGUI *gui)
911 int edit_w = EditPanel::calculate_w(mwindow, 0, 12);
912 int transport_w = PlayTransport::get_transport_width(mwindow) + toggle_margin;
913 // Space between buttons & time
914 int division_w = xS(30);
917 int vtime_border = xS(15);
919 vmeter_y = widget_border;
920 vmeter_h = mwindow->session->vwindow_h - cmeter_y - widget_border;
922 if(mwindow->edl->session->vwindow_meter)
924 vmeter_x = mwindow->session->vwindow_w -
925 MeterPanel::get_meters_width(this,
926 mwindow->edl->session->audio_channels,
927 mwindow->edl->session->vwindow_meter);
931 vmeter_x = mwindow->session->vwindow_w;
936 vcanvas_w = vmeter_x - vcanvas_x - widget_border;
938 int buttons_h = get_image("rewind")->get_h() + widget_border;
939 int panel_y = mwindow->session->vwindow_h - buttons_h + yS(4);
940 vtransport_x = widget_border;
941 if( vtransport_x + transport_w + widget_border +
942 edit_w + widget_border + vtime_w + xS(40) + widget_border > vmeter_x ) {
943 vtransport_y = panel_y;
944 vzoom_x = vtransport_x + transport_w + widget_border;
946 vdivision_x = xS(320);
947 vtime_x = vdivision_x;
949 int edit_h = EditPanel::calculate_h(mwindow) + widget_border;
950 buttons_h += edit_h; panel_y -= edit_h;
951 vedit_x = widget_border;
955 vtransport_x = widget_border;
956 vtransport_y = panel_y;
957 vedit_x = vtransport_x + transport_w + widget_border;
959 vdivision_x = vedit_x + edit_w + division_w;
960 vtime_x = vdivision_x + vtime_border;
963 buttons_h += vtimebar_h;
965 // vtimebar_x = vcanvas_x;
966 // vtimebar_y = vcanvas_y + vcanvas_h;
967 // vtimebar_w = vcanvas_w;
969 vcanvas_h = mwindow->session->vwindow_h - buttons_h;
971 vtimebar_y = vcanvas_y + vcanvas_h;
972 vtimebar_w = vmeter_x - widget_border;
976 void Theme::get_awindow_sizes(AWindowGUI *gui)
981 // afolders_y = deletedisk_data[0]->get_h();
983 afolders_w = mwindow->session->afolders_w;
984 afolders_h = mwindow->session->awindow_h - afolders_y;
985 adivider_x = afolders_x + afolders_w;
988 adivider_h = afolders_h;
989 alist_x = afolders_x + afolders_w + xS(5);
990 alist_y = afolders_y;
991 alist_w = mwindow->session->awindow_w - alist_x;
992 alist_h = afolders_h;
995 void Theme::get_rmonitor_sizes(int do_audio,
1008 rmonitor_canvas_y = yS(30);
1009 rmonitor_tx_x = xS(10);
1014 rmonitor_canvas_y = 0;
1023 rmonitor_channel_x = x;
1024 rmonitor_channel_y = yS(5);
1026 rmonitor_canvas_y = yS(35);
1032 rmonitor_interlace_x = x;
1033 rmonitor_interlace_y = y;
1041 rmonitor_meter_x = mwindow->session->rmonitor_w -
1042 MeterPanel::get_meters_width(this, audio_channels, 1);
1043 rmonitor_meter_w = mwindow->session->rmonitor_w;
1047 rmonitor_meter_x = widget_border;
1048 rmonitor_meter_w = mwindow->session->rmonitor_w - widget_border * 2;
1051 rmonitor_meter_y = yS(40);
1052 rmonitor_meter_h = mwindow->session->rmonitor_h - yS(10) - rmonitor_meter_y;
1056 rmonitor_meter_x = mwindow->session->rmonitor_w;
1059 rmonitor_canvas_x = 0;
1060 rmonitor_canvas_w = rmonitor_meter_x - rmonitor_canvas_x;
1061 if(do_audio) rmonitor_canvas_w -= xS(10);
1062 rmonitor_canvas_h = mwindow->session->rmonitor_h - rmonitor_canvas_y;
1064 if(!do_video && do_audio)
1066 rmonitor_meter_y -= yS(30);
1067 rmonitor_meter_h += yS(30);
1072 void Theme::get_recordgui_sizes(RecordGUI *gui, int w, int h)
1076 void Theme::get_batchrender_sizes(BatchRenderGUI *gui,
1080 batchrender_x1 = xS(10);
1081 batchrender_x2 = xS(300);
1082 batchrender_x3 = xS(400);
1085 void Theme::get_plugindialog_sizes()
1087 int xs10 = xS(10), ys10 = yS(10);
1088 int xs20 = xS(20), ys100 = yS(100);
1089 int x = xs10, y = yS(30);
1090 plugindialog_new_x = x;
1091 plugindialog_new_y = y;
1092 plugindialog_shared_x = mwindow->session->plugindialog_w / 3;
1093 plugindialog_shared_y = y;
1094 plugindialog_module_x = mwindow->session->plugindialog_w * 2 / 3;
1095 plugindialog_module_y = y;
1097 plugindialog_new_w = plugindialog_shared_x - plugindialog_new_x - xs10;
1098 plugindialog_new_h = mwindow->session->plugindialog_h - ys100;
1099 plugindialog_shared_w = plugindialog_module_x - plugindialog_shared_x - xs10;
1100 plugindialog_shared_h = mwindow->session->plugindialog_h - ys100;
1101 plugindialog_module_w = mwindow->session->plugindialog_w - plugindialog_module_x - xs10;
1102 plugindialog_module_h = mwindow->session->plugindialog_h - ys100;
1104 plugindialog_newattach_x = plugindialog_new_x + xs20;
1105 plugindialog_newattach_y = plugindialog_new_y + plugindialog_new_h + ys10;
1106 plugindialog_sharedattach_x = plugindialog_shared_x + xs20;
1107 plugindialog_sharedattach_y = plugindialog_shared_y + plugindialog_shared_h + ys10;
1108 plugindialog_moduleattach_x = plugindialog_module_x + xs20;
1109 plugindialog_moduleattach_y = plugindialog_module_y + plugindialog_module_h + ys10;
1112 // void Theme::get_presetdialog_sizes(PresetsWindow *gui)
1114 // int x = window_border;
1115 // int y = window_border + BC_Title::calculate_h(gui, "P") + widget_border;
1117 // presets_list_x = x;
1118 // presets_list_y = y;
1119 // presets_list_w = mwindow->session->presetdialog_w / 2;
1120 // presets_list_h = mwindow->session->presetdialog_h -
1121 // BC_OKButton::calculate_h() -
1125 // presets_text_x = presets_list_x + presets_list_w + widget_border;
1126 // presets_text_y = y;
1127 // presets_text_w = mwindow->session->presetdialog_w - presets_text_x - window_border;
1128 // y += BC_TextBox::calculate_h(gui,
1131 // 1) + widget_border;
1133 // presets_delete_x = presets_text_x;
1134 // presets_delete_y = y;
1135 // y += BC_GenericButton::calculate_h() + widget_border;
1137 // presets_save_x = presets_text_x;
1138 // presets_save_y = y;
1139 // y += BC_GenericButton::calculate_h() + widget_border;
1141 // presets_apply_x = presets_text_x;
1142 // presets_apply_y = y;
1143 // y += BC_GenericButton::calculate_h();
1146 void Theme::get_keyframedialog_sizes(KeyFrameWindow *gui)
1148 int x = window_border;
1149 int y = window_border +
1150 BC_Title::calculate_h(gui, "P", LARGEFONT) +
1155 #ifdef EDIT_KEYFRAME
1156 presets_list_w = mwindow->session->keyframedialog_w / 2 -
1160 presets_list_w = mwindow->session->keyframedialog_w -
1164 presets_list_h = mwindow->session->keyframedialog_h -
1165 BC_OKButton::calculate_h() -
1169 BC_Title::calculate_h(gui, "P") -
1171 BC_TextBox::calculate_h(gui,
1176 (BC_GenericButton::calculate_h() + widget_border) * 3 -
1178 y += presets_list_h + widget_border + widget_border + BC_Title::calculate_h(gui, "P");
1181 presets_text_w = presets_list_w;
1182 y += BC_TextBox::calculate_h(gui,
1187 presets_delete_x = presets_text_x;
1188 presets_delete_y = y;
1189 y += BC_GenericButton::calculate_h() + widget_border;
1191 presets_save_x = presets_text_x;
1193 y += BC_GenericButton::calculate_h() + widget_border;
1195 presets_apply_x = presets_text_x;
1196 presets_apply_y = y;
1197 y += BC_GenericButton::calculate_h();
1199 #ifdef EDIT_KEYFRAME
1200 x = mwindow->session->keyframedialog_w / 2 + widget_border;
1202 BC_Title::calculate_h(gui, "P", LARGEFONT) +
1205 keyframe_list_x = x;
1206 keyframe_list_y = y;
1207 keyframe_list_w = mwindow->session->keyframedialog_w / 2 -
1210 keyframe_list_h = mwindow->session->keyframedialog_h -
1214 BC_Title::calculate_h(gui, "P") -
1216 BC_TextBox::calculate_h(gui,
1221 BC_Title::calculate_h(gui, "P") -
1223 BC_OKButton::calculate_h() -
1225 // keyframe_text_x = keyframe_list_x + keyframe_list_w + widget_border;
1226 // keyframe_text_y = y;
1227 // keyframe_text_w = mwindow->session->keyframedialog_w - keyframe_text_x - window_border;
1228 // y += BC_TextBox::calculate_h(gui,
1231 // 1) + widget_border;
1234 y += keyframe_list_h + BC_Title::calculate_h(gui, "P") + widget_border + widget_border;
1235 keyframe_value_x = keyframe_list_x;
1236 keyframe_value_y = y;
1237 keyframe_value_w = keyframe_list_w;
1238 y += BC_TextBox::calculate_h(gui,
1243 keyframe_all_x = keyframe_value_x;
1251 void Theme::get_menueffect_sizes(int use_list)
1255 menueffect_list_x = xS(10);
1256 menueffect_list_y = yS(10);
1257 menueffect_list_w = mwindow->session->menueffect_w - xS(400);
1258 menueffect_list_h = mwindow->session->menueffect_h -
1260 BC_OKButton::calculate_h() - yS(10);
1264 menueffect_list_x = 0;
1265 menueffect_list_y = yS(10);
1266 menueffect_list_w = 0;
1267 menueffect_list_h = 0;
1270 menueffect_file_x = menueffect_list_x + menueffect_list_w + xS(10);
1271 menueffect_file_y = yS(10);
1273 menueffect_tools_x = menueffect_file_x;
1274 menueffect_tools_y = menueffect_file_y + yS(20);
1277 void Theme::get_preferences_sizes()
1281 void Theme::draw_preferences_bg(PreferencesWindow *gui)
1285 void Theme::get_new_sizes(NewWindow *gui)
1289 void Theme::draw_new_bg(NewWindow *gui)
1293 void Theme::draw_setformat_bg(SetFormatWindow *window)
1298 int Theme::get_color_title_bg()
1300 VFrame *title_bg = get_image("title_bg_data");
1301 int tw = title_bg->get_w(), th = title_bg->get_h();
1302 int colormodel = title_bg->get_color_model();
1303 int bpp = BC_CModels::calculate_pixelsize(colormodel);
1304 uint8_t **rows = title_bg->get_rows();
1305 int cx = tw / 2, cy = th / 2;
1306 uint8_t *bp = rows[cy] + cx * bpp;
1307 int br = bp[0], bg = bp[1], bb = bp[2];
1308 int color = (br<<16) | (bg<<8) | (bb<<0);