X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fgwindowgui.C;h=70bfca1e96bf87736beaf39bda4e17c320222d34;hb=340840559db419a217ccb6adc7de1f96518d2906;hp=306bc2ac49e8133322f790b0ede77666d7a01247;hpb=fd7da506ec769c911c35264b49bff28f408a02f9;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/cinelerra/gwindowgui.C b/cinelerra-5.1/cinelerra/gwindowgui.C index 306bc2ac..70bfca1e 100644 --- a/cinelerra-5.1/cinelerra/gwindowgui.C +++ b/cinelerra-5.1/cinelerra/gwindowgui.C @@ -406,11 +406,11 @@ void GWindowGUI::create_objects() switch( ref ) { case NONAUTOTOGGLES_CAMERA_XYZ: camera_xyz = toggle; - accel = _("SHF+F1"); + accel = _("Shift-F1"); break; case NONAUTOTOGGLES_PROJECTOR_XYZ: projector_xyz = toggle; - accel = _("SHF+F2"); + accel = _("Shift-F2"); break; } if( accel ) { @@ -424,16 +424,24 @@ void GWindowGUI::create_objects() unlock_window(); } -void GWindowGUI::update_mwindow() +void GWindowGUI::update_mwindow(int toggles, int overlays) { unlock_window(); - mwindow->gui->mainmenu->update_toggles(1); + mwindow->gui->lock_window("GWindowGUI::update_mwindow"); + if( toggles ) + mwindow->gui->mainmenu->update_toggles(0); + if( overlays ) + mwindow->gui->draw_overlays(1); + mwindow->gui->unlock_window(); lock_window("GWindowGUI::update_mwindow"); } void GWindowGUI::update_toggles(int use_lock) { - if(use_lock) lock_window("GWindowGUI::update_toggles"); + if(use_lock) { + lock_window("GWindowGUI::update_toggles"); + set_cool(0); + } for( int i=0; i<(int)(sizeof(toggle_order)/sizeof(toggle_order[0])); ++i ) { if( toggles[i] ) toggles[i]->update(); @@ -451,7 +459,7 @@ void GWindowGUI::toggle_camera_xyz() camera_xyz->set_value(v); xyz_check(AUTOMATION_CAMERA_X, v); update_toggles(0); - update_mwindow(); + update_mwindow(1, 1); } void GWindowGUI::toggle_projector_xyz() @@ -460,7 +468,7 @@ void GWindowGUI::toggle_projector_xyz() projector_xyz->set_value(v); xyz_check(AUTOMATION_PROJECTOR_X, v); update_toggles(0); - update_mwindow(); + update_mwindow(1, 1); } int GWindowGUI::translation_event() @@ -549,6 +557,7 @@ GWindowToggle::GWindowToggle(GWindowGUI *gui, int x, int y, this->info = info; this->color = color; this->color_button = 0; + hot = hot_value = 0; } GWindowToggle::~GWindowToggle() @@ -559,6 +568,18 @@ GWindowToggle::~GWindowToggle() int GWindowToggle::handle_event() { int value = get_value(); + if( shift_down() ) { + if( !hot ) { + gui->set_hot(this); + value = 1; + } + else { + gui->set_cool(1); + value = hot_value; + } + } + else + gui->set_cool(0); if( info->isauto >= 0 ) { *gui->get_main_value(info) = value; switch( info->ref ) { @@ -587,27 +608,15 @@ int GWindowToggle::handle_event() gui->update_toggles(0); } } - gui->update_mwindow(); + gui->update_mwindow(1, 0); // Update stuff in MWindow unlock_window(); MWindow *mwindow = gui->mwindow; mwindow->gui->lock_window("GWindowToggle::handle_event"); - if( !info->isauto ) { - switch( info->ref ) { - case NON_AUTOMATION_ASSETS: - case NON_AUTOMATION_TITLES: - mwindow->gui->update(1, 1, 0, 0, 1, 0, 0); - break; - case NON_AUTOMATION_TRANSITIONS: - case NON_AUTOMATION_PLUGIN_AUTOS: - mwindow->gui->draw_overlays(1); - break; - } - } - else - mwindow->gui->draw_overlays(1); + mwindow->gui->update(1, 1, 0, 0, 1, 0, 0); + mwindow->gui->draw_overlays(1); if( value && info->isauto > 0 ) { int autogroup_type = -1; @@ -656,3 +665,50 @@ void GWindowToggle::update_gui(int color) draw_face(1,0); } +int GWindowToggle::draw_face(int flash, int flush) +{ + int ret = BC_Toggle::draw_face(flash, flush); + if( hot ) { + set_color(color); + set_opaque(); + draw_rectangle(text_x-1, text_y-1, text_w+1, text_h+1); + if( flash ) this->flash(0); + if( flush ) this->flush(); + } + return ret; +} + +void GWindowGUI::set_cool(int reset, int all) +{ + for( int i=0; i<(int)(sizeof(toggles)/sizeof(toggles[0])); ++i ) { + GWindowToggle* toggle = toggles[i]; + if( !toggle ) continue; + int *vp = get_main_value(toggle->info); + if( !vp ) continue; + if( toggle->hot ) { + toggle->hot = 0; + toggle->draw_face(1, 0); + } + if( reset > 0 ) + *vp = toggle->hot_value; + else { + toggle->hot_value = *vp; + if( reset < 0 ) { + if ( all || toggle->info->isauto > 0 ) + *vp = 0; + } + } + } + if( reset ) + update_toggles(0); +} + +void GWindowGUI::set_hot(GWindowToggle *toggle) +{ + int *vp = get_main_value(toggle->info); + if( !vp ) return; + set_cool(-1, !toggle->info->isauto ? 1 : 0); + toggle->hot = 1; + toggle->set_value(*vp = 1); +} +