fix awdw solo vicon crash, fix nested clip for binfolders, open edit edl
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / theme.C
index fb3ff4df0b8cc6150e5639dca4f7f4dfc50e4b69..d89c789f76cb95018e954fc1f0d65002c16e0d7c 100644 (file)
@@ -24,6 +24,7 @@
 #include "clip.h"
 #include "bccolors.h"
 #include "cwindowgui.h"
+#include "edit.h"
 #include "edl.h"
 #include "edlsession.h"
 #include "keyframegui.h"
@@ -46,6 +47,7 @@
 #include "resourcepixmap.h"
 #include "statusbar.h"
 #include "theme.h"
+#include "track.h"
 #include "timebar.h"
 #include "trackcanvas.h"
 #include "vframe.h"
@@ -70,6 +72,7 @@ Theme::Theme()
        mtransport_margin = 0;
        toggle_margin = 0;
        control_pixels = xS(50);
+       stack_button_w = xS(32);
        timebar_cursor_color = RED;
 
        BC_WindowBase::get_resources()->bg_color = BLOND;
@@ -77,6 +80,13 @@ Theme::Theme()
        BC_WindowBase::get_resources()->button_highlighted = 0xffe000;
        BC_WindowBase::get_resources()->recursive_resizing = 0;
        audio_color = BLACK;
+       zero_crossing_color = 0xc03545;
+       graph_active_color = GRAPH_ACTIVE_COLOR;
+       graph_inactive_color = GRAPH_INACTIVE_COLOR;
+       graph_grid_color = GRAPH_GRID_COLOR;
+       graph_bg_color = GRAPH_BG_COLOR;
+       graph_border1_color = GRAPH_BORDER1_COLOR;
+       graph_border2_color = GRAPH_BORDER2_COLOR;
        fade_h = yS(22);
        inout_highlight_color = GREEN;
        meter_h = yS(17);
@@ -169,6 +179,7 @@ Theme::Theme()
        statusbar_cancel_data = 0;
        timebar_view_data = 0;
        transition_data = 0;
+       tumblepatch_data = 0;
        uptriangle_data = 0;
        viewasset_data = 0;
        vtimebar_bg_data = 0;
@@ -601,7 +612,9 @@ void Theme::get_mwindow_sizes(MWindowGUI *gui, int w, int h)
 {
        mbuttons_x = 0;
        mbuttons_y = gui->menu_h() + yS(1);
-       mbuttons_w = w - (ffmpeg_toggle[0]->get_w()+2 + proxy_p_toggle[0]->get_w()+xS(2));
+       mbuttons_w = w - (ffmpeg_toggle[0]->get_w()+xS(2) +
+                        proxy_p_toggle[0]->get_w()+xS(2) +
+                        stack_button_w);
        mbuttons_h = get_image("mbutton_bg")->get_h();
        mclock_x = window_border - xS(5);
        mclock_y = mbuttons_y-1 + mbuttons_h;
@@ -698,7 +711,7 @@ void Theme::draw_mwindow_bg(MWindowGUI *gui)
 
 void Theme::get_cwindow_sizes(CWindowGUI *gui, int cwindow_controls)
 {
-       int total_buttons = !use_commercials ? 15 : 16;
+       int total_buttons = !use_commercials ? 16 : 17;
        int edit_w = EditPanel::calculate_w(mwindow, 1, total_buttons);
        int transport_w = PlayTransport::get_transport_width(mwindow) + toggle_margin;
        int zoom_w = ZoomPanel::calculate_w(czoom_w);
@@ -720,60 +733,37 @@ SET_TRACE
                }
                else
                {
-                       cmeter_x = mwindow->session->cwindow_w + widget_border;
+                       cmeter_x = mwindow->session->cwindow_w;
                }
 
-               int buttons_h;
-
-               if(edit_w +
-                       widget_border * 2 +
-                       transport_w + widget_border +
-                       zoom_w + widget_border +
-                       division_w +
-                       status_w > cmeter_x)
-               {
-                       buttons_h = get_image("cbuttons_left")->get_h();
-
-                       cedit_x = widget_border;
-                       cedit_y = mwindow->session->cwindow_h -
-                               buttons_h +
-                               ctimebar_h +
-                               widget_border;
-
-                       ctransport_x = widget_border;
-                       ctransport_y = mwindow->session->cwindow_h -
-                               get_image_set("autokeyframe")[0]->get_h() -
-                               widget_border;
 
+               int buttons_h = get_image("rewind")->get_h() + widget_border;
+               int panel_y = mwindow->session->cwindow_h - buttons_h + yS(4);
+               ctransport_x = widget_border;
+               if( ctransport_x + transport_w + widget_border +
+                   edit_w + widget_border + zoom_w + widget_border +
+                   division_w + status_w > cmeter_x ) {
+                       ctransport_y = panel_y;
                        czoom_x = ctransport_x + transport_w + widget_border;
-                       czoom_y = ctransport_y + widget_border;
-
-                       cstatus_x = xS(426);
-                       cstatus_y = mwindow->session->cwindow_h -
-                               get_image("cwindow_active")->get_h() - yS(30);
+                       czoom_y = panel_y;
+                       cstatus_x = xS(440);
+                       cstatus_y = panel_y - yS(2);
+                       int edit_h = EditPanel::calculate_h(mwindow) + widget_border;
+                       buttons_h += edit_h;  panel_y -= edit_h;
+                       cedit_x = widget_border;
+                       cedit_y = panel_y;
                }
-               else
-               {
-                       buttons_h = ctimebar_h +
-                               widget_border +
-                               EditPanel::calculate_h(mwindow) +
-                               widget_border;
+               else {
                        ctransport_x = widget_border;
-                       ctransport_y = mwindow->session->cwindow_h -
-                               buttons_h +
-                               ctimebar_h +
-                               widget_border;
-
+                       ctransport_y = panel_y;
                        cedit_x = ctransport_x + transport_w + widget_border;
-                       cedit_y = ctransport_y;
-
+                       cedit_y = panel_y;
                        czoom_x = cedit_x + edit_w + widget_border;
-                       czoom_y = cedit_y + widget_border;
-//printf("Theme::get_cwindow_sizes %d %d %d\n", __LINE__, czoom_x, zoom_w);
+                       czoom_y = panel_y;
                        cstatus_x = czoom_x + zoom_w + division_w;
-                       cstatus_y = ctransport_y;
+                       cstatus_y = panel_y;
                }
-
+               buttons_h += ctimebar_h;
 
                ccomposite_x = xS(0);
                ccomposite_y = yS(5);
@@ -884,12 +874,13 @@ void Theme::draw_rwindow_bg(RecordGUI *gui)
 }
 
 
-void Theme::draw_resource_bg(TrackCanvas *canvas, ResourcePixmap *pixmap, int color,
-       int edit_x, int edit_w, int pixmap_x, int x1, int y1, int x2, int y2)
+void Theme::draw_resource_bg(TrackCanvas *canvas, ResourcePixmap *pixmap,
+               int color, Edit *edit, int edit_x, int edit_w,
+               int pixmap_x, int x1, int y1, int x2, int y2)
 {
        VFrame *image = 0;
-
-       switch(mwindow->edl->local_session->zoom_track) {
+       int data_h = edit->track->data_h;
+       switch( data_h ) {
                case 1024: image = get_image("resource1024");  break;
                case 512: image = get_image("resource512");  break;
                case 256: image = get_image("resource256");  break;
@@ -917,18 +908,17 @@ void Theme::draw_resource_bg(TrackCanvas *canvas, ResourcePixmap *pixmap, int co
 
 void Theme::get_vwindow_sizes(VWindowGUI *gui)
 {
-       int edit_w = EditPanel::calculate_w(mwindow, 0, 10);
+       int edit_w = EditPanel::calculate_w(mwindow, 0, 12);
        int transport_w = PlayTransport::get_transport_width(mwindow) + toggle_margin;
 // Space between buttons & time
        int division_w = xS(30);
-       vtime_w = xS(150);
+       vtime_w = xS(120);
        vtimebar_h = yS(16);
        int vtime_border = xS(15);
 
        vmeter_y = widget_border;
        vmeter_h = mwindow->session->vwindow_h - cmeter_y - widget_border;
 
-       int buttons_h;
        if(mwindow->edl->session->vwindow_meter)
        {
                vmeter_x = mwindow->session->vwindow_w -
@@ -938,55 +928,39 @@ void Theme::get_vwindow_sizes(VWindowGUI *gui)
        }
        else
        {
-               vmeter_x = mwindow->session->vwindow_w + widget_border;
+               vmeter_x = mwindow->session->vwindow_w;
        }
 
        vcanvas_x = 0;
        vcanvas_y = 0;
        vcanvas_w = vmeter_x - vcanvas_x - widget_border;
 
-       if(edit_w +
-               widget_border * 2 +
-               transport_w + widget_border +
-               vtime_w + division_w +
-               vtime_border > vmeter_x)
-       {
-               buttons_h = get_image("vbuttons_left")->get_h();
+       int buttons_h = get_image("rewind")->get_h() + widget_border;
+       int panel_y = mwindow->session->vwindow_h - buttons_h + yS(4);
+       vtransport_x = widget_border;
+       if( vtransport_x + transport_w + widget_border +
+           edit_w + widget_border + vtime_w + xS(40) + widget_border > vmeter_x ) {
+               vtransport_y = panel_y;
+               vzoom_x = vtransport_x + transport_w + widget_border;
+               vzoom_y = panel_y;
+               vdivision_x = xS(320);
+               vtime_x = vdivision_x;
+               vtime_y = panel_y;
+               int edit_h = EditPanel::calculate_h(mwindow) + widget_border;
+               buttons_h += edit_h;  panel_y -= edit_h;
                vedit_x = widget_border;
-               vedit_y = mwindow->session->vwindow_h -
-                       buttons_h +
-                       vtimebar_h +
-                       widget_border;
-
-               vtransport_x = widget_border;
-               vtransport_y = mwindow->session->vwindow_h -
-                       get_image_set("autokeyframe")[0]->get_h() -
-                       widget_border;
-
-               vdivision_x = xS(280);
-               vtime_x = vedit_x + xS(20); //vdivision_x;
-               vtime_y = vedit_y + yS(30); //+ yS(20);
+               vedit_y = panel_y;
        }
-       else
-       {
-               buttons_h = vtimebar_h +
-                       widget_border +
-                       EditPanel::calculate_h(mwindow) +
-                       widget_border;
+       else {
                vtransport_x = widget_border;
-               vtransport_y = mwindow->session->vwindow_h -
-                       buttons_h +
-                       vtimebar_h +
-                       widget_border;
-
+               vtransport_y = panel_y;
                vedit_x = vtransport_x + transport_w + widget_border;
-               vedit_y = vtransport_y;
-
+               vedit_y = panel_y;
                vdivision_x = vedit_x + edit_w + division_w;
                vtime_x = vdivision_x + vtime_border;
-               vtime_y = vedit_y + widget_border;
+               vtime_y = panel_y;
        }
-
+       buttons_h += vtimebar_h;
 
 //     vtimebar_x = vcanvas_x;
 //     vtimebar_y = vcanvas_y + vcanvas_h;
@@ -996,7 +970,6 @@ void Theme::get_vwindow_sizes(VWindowGUI *gui)
        vtimebar_x = 0;
        vtimebar_y = vcanvas_y + vcanvas_h;
        vtimebar_w = vmeter_x - widget_border;
-
 }