X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fgwindowgui.C;h=4589fb1eed977264e0a7b212953b5ffeebcc34d7;hb=29368703cfeb89b567e60dc9f25a1df3733bea68;hp=127059e66a5cc1542c6d7b7f8842c100d3e0c817;hpb=30bdb85eb33a8ee7ba675038a86c6be59c43d7bd;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/cinelerra/gwindowgui.C b/cinelerra-5.1/cinelerra/gwindowgui.C index 127059e6..4589fb1e 100644 --- a/cinelerra-5.1/cinelerra/gwindowgui.C +++ b/cinelerra-5.1/cinelerra/gwindowgui.C @@ -30,6 +30,7 @@ #include "mainsession.h" #include "mwindow.h" #include "mwindowgui.h" +#include "theme.h" #include "trackcanvas.h" @@ -38,34 +39,50 @@ GWindowGUI::GWindowGUI(MWindow *mwindow, int w, int h) : BC_Window(_(PROGRAM_NAME ": Overlays"), - mwindow->session->gwindow_x, mwindow->session->gwindow_y, + mwindow->session->gwindow_x, mwindow->session->gwindow_y, w, h, w, h, 0, 0, 1) { this->mwindow = mwindow; } -static const char *other_text[NON_AUTOMATION_TOTAL] = +const char *GWindowGUI::other_text[NON_AUTOMATION_TOTAL] = { - _("Assets"), - _("Titles"), - _("Transitions"), - _("Plugin Autos") + "Assets", + "Titles", + "Transitions", + "Plugin Autos" }; -static const char *auto_text[AUTOMATION_TOTAL] = +const char *GWindowGUI::auto_text[AUTOMATION_TOTAL] = { - _("Mute"), - _("Camera X"), - _("Camera Y"), - _("Camera Z"), - _("Projector X"), - _("Projector Y"), - _("Projector Z"), - _("Fade"), - _("Pan"), - _("Mode"), - _("Mask"), - _("Speed") + "Mute", + "Camera X", + "Camera Y", + "Camera Z", + "Projector X", + "Projector Y", + "Projector Z", + "Fade", + "Pan", + "Mode", + "Mask", + "Speed" +}; + +int GWindowGUI::auto_colors[AUTOMATION_TOTAL] = +{ + PINK, + RED, + GREEN, + BLUE, + LTPINK, + LTGREEN, + LTBLUE, + LTPURPLE, + 0, + 0, + 0, + ORANGE, }; @@ -74,12 +91,10 @@ static toggleinfo toggle_order[] = {0, NON_AUTOMATION_ASSETS}, {0, NON_AUTOMATION_TITLES}, {0, NON_AUTOMATION_TRANSITIONS}, + {0, NON_AUTOMATION_PLUGIN_AUTOS}, + {0, -1}, // bar {1, AUTOMATION_FADE}, {1, AUTOMATION_MUTE}, - {1, AUTOMATION_MODE}, - {1, AUTOMATION_PAN}, - {0, NON_AUTOMATION_PLUGIN_AUTOS}, - {1, AUTOMATION_MASK}, {1, AUTOMATION_SPEED}, {1, AUTOMATION_CAMERA_X}, {1, AUTOMATION_CAMERA_Y}, @@ -87,6 +102,9 @@ static toggleinfo toggle_order[] = {1, AUTOMATION_PROJECTOR_X}, {1, AUTOMATION_PROJECTOR_Y}, {1, AUTOMATION_PROJECTOR_Z}, + {1, AUTOMATION_MODE}, + {1, AUTOMATION_PAN}, + {1, AUTOMATION_MASK}, }; void GWindowGUI::calculate_extents(BC_WindowBase *gui, int *w, int *h) @@ -96,15 +114,19 @@ void GWindowGUI::calculate_extents(BC_WindowBase *gui, int *w, int *h) *w = 10; *h = 10; - for(int i = 0; i < NON_AUTOMATION_TOTAL + AUTOMATION_TOTAL; i++) - { + for( int i=0; i<(int)(sizeof(toggle_order)/sizeof(toggle_order[0])); ++i ) { + toggleinfo *tp = &toggle_order[i]; + int isauto = tp->isauto, ref = tp->ref; + if( ref < 0 ) { + *h += get_resources()->bar_data->get_h() + 5; + continue; + } BC_Toggle::calculate_extents(gui, BC_WindowBase::get_resources()->checkbox_images, 0, &temp1, ¤t_w, ¤t_h, &temp2, &temp3, &temp4, &temp5, &temp6, &temp7, - toggle_order[i].isauto ? - auto_text[toggle_order[i].ref] : - other_text[toggle_order[i].ref], MEDIUMFONT); + _(isauto ? auto_text[ref] : other_text[ref]), + MEDIUMFONT); *w = MAX(current_w, *w); *h += current_h + 5; } @@ -120,14 +142,26 @@ void GWindowGUI::create_objects() int x = 10, y = 10; lock_window("GWindowGUI::create_objects 1"); - - for(int i = 0; i < NON_AUTOMATION_TOTAL + AUTOMATION_TOTAL; i++) - { - add_tool(toggles[i] = new GWindowToggle(mwindow, - this, - x, - y, - toggle_order[i])); + for( int i=0; i<(int)(sizeof(toggle_order)/sizeof(toggle_order[0])); ++i ) { + toggleinfo *tp = &toggle_order[i]; + int ref = tp->ref; + if( ref < 0 ) { + BC_Bar *bar = new BC_Bar(x,y,get_w()-x-10); + add_tool(bar); + toggles[i] = 0; + y += bar->get_h() + 5; + continue; + } + toggles[i] = new GWindowToggle(mwindow, this, x, y, *tp); + add_tool(toggles[i]); + VFrame *vframe = 0; + switch( ref ) { + case AUTOMATION_MODE: vframe = mwindow->theme->modekeyframe_data; break; + case AUTOMATION_PAN: vframe = mwindow->theme->pankeyframe_data; break; + case AUTOMATION_MASK: vframe = mwindow->theme->maskkeyframe_data; break; + } + if( vframe ) + draw_vframe(vframe, get_w()-vframe->get_w()-10, y); y += toggles[i]->get_h() + 5; } unlock_window(); @@ -144,9 +178,8 @@ void GWindowGUI::update_toggles(int use_lock) { if(use_lock) lock_window("GWindowGUI::update_toggles"); - for(int i = 0; i < NON_AUTOMATION_TOTAL + AUTOMATION_TOTAL; i++) - { - toggles[i]->update(); + for( int i=0; i<(int)(sizeof(toggle_order)/sizeof(toggle_order[0])); ++i ) { + if( toggles[i] ) toggles[i]->update(); } if(use_lock) unlock_window(); @@ -176,29 +209,28 @@ int GWindowGUI::close_event() int GWindowGUI::keypress_event() { - switch(get_keypress()) - { - case 'w': - case 'W': - if(ctrl_down()) - { - close_event(); - return 1; - } - break; + switch(get_keypress()) { + case 'w': + case 'W': + case '0': + if( ctrl_down() ) { + close_event(); + return 1; + } + break; } return 0; } - - - - GWindowToggle::GWindowToggle(MWindow *mwindow, GWindowGUI *gui, int x, int y, toggleinfo toggleinf) : BC_CheckBox(x, y, *get_main_value(mwindow, toggleinf), - toggleinf.isauto ? auto_text[toggleinf.ref] : other_text[toggleinf.ref]) + _((toggleinf.isauto ? + GWindowGUI::auto_text[toggleinf.ref] : + GWindowGUI::other_text[toggleinf.ref])), + MEDIUMFONT, + !toggleinf.isauto ? -1 : GWindowGUI::auto_colors[toggleinf.ref]) { this->mwindow = mwindow; this->gui = gui; @@ -242,30 +274,23 @@ int GWindowToggle::handle_event() int* GWindowToggle::get_main_value(MWindow *mwindow, toggleinfo toggleinf) { - if(toggleinf.isauto) - { + if( toggleinf.isauto ) return &mwindow->edl->session->auto_conf->autos[toggleinf.ref]; - } - else - { - switch(toggleinf.ref) - { - case NON_AUTOMATION_ASSETS: - return &mwindow->edl->session->show_assets; - case NON_AUTOMATION_TITLES: - return &mwindow->edl->session->show_titles; - case NON_AUTOMATION_TRANSITIONS: - return &mwindow->edl->session->auto_conf->transitions; - case NON_AUTOMATION_PLUGIN_AUTOS: - return &mwindow->edl->session->auto_conf->plugins; - } + + switch(toggleinf.ref) { + case NON_AUTOMATION_ASSETS: return &mwindow->edl->session->show_assets; + case NON_AUTOMATION_TITLES: return &mwindow->edl->session->show_titles; + case NON_AUTOMATION_TRANSITIONS: return &mwindow->edl->session->auto_conf->transitions; + case NON_AUTOMATION_PLUGIN_AUTOS: return &mwindow->edl->session->auto_conf->plugins; } return 0; } void GWindowToggle::update() { - set_value(*get_main_value(mwindow, toggleinf)); + int *vp = get_main_value(mwindow, toggleinf); + if( !vp ) return; + set_value(*vp); }