X-Git-Url: https://git.cinelerra-gg.org/git/?p=goodguy%2Fcinelerra.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fcwindowgui.C;h=052a713d9a3eb5d831c7666ea464c15829a600c6;hp=1266f241653cc662e1e792d0297656977a30c807;hb=3b4b6f588c4f2643316afcbc486ca6a35c16a431;hpb=0e16112661802284c0d2c9eb8d1df84141125e91 diff --git a/cinelerra-5.1/cinelerra/cwindowgui.C b/cinelerra-5.1/cinelerra/cwindowgui.C index 1266f241..052a713d 100644 --- a/cinelerra-5.1/cinelerra/cwindowgui.C +++ b/cinelerra-5.1/cinelerra/cwindowgui.C @@ -21,6 +21,7 @@ #include "automation.h" #include "autos.h" +#include "bccolors.h" #include "bcsignals.h" #include "canvas.h" #include "clip.h" @@ -442,10 +443,13 @@ int CWindowGUI::keypress_event() keyboard_zoomout(); result = 1; break; - case 'f': - unlock_window(); - canvas->use_fullscreen(canvas->get_fullscreen() ? 0 : 1); - lock_window("CWindowGUI::keypress_event 1"); + case 'f': { + int on = canvas->get_fullscreen() ? 0 : 1; + canvas->set_fullscreen(on, 1); + result = 1; + break; } + case ESC: + canvas->set_fullscreen(0, 1); result = 1; break; case 'x': @@ -465,12 +469,6 @@ int CWindowGUI::keypress_event() lock_window("CWindowGUI::keypress_event 3"); result = 1; break; - case ESC: - unlock_window(); - canvas->use_fullscreen(0); - lock_window("CWindowGUI::keypress_event 4"); - result = 1; - break; case LEFT: if( !ctrl_down() ) { int alt_down = this->alt_down(); @@ -984,6 +982,9 @@ CWindowCanvas::CWindowCanvas(MWindow *mwindow, CWindowGUI *gui) { this->mwindow = mwindow; this->gui = gui; + last_xscroll = 0; + last_yscroll = 0; + last_zoom = 0; } void CWindowCanvas::status_event() @@ -1000,15 +1001,25 @@ void CWindowCanvas::update_zoom(int x, int y, float zoom) mwindow->edl->session->cwindow_scrollbars = use_scrollbars; } -int CWindowCanvas::use_fullscreen(int on) +int CWindowCanvas::set_fullscreen(int on, int unlock) { - if( Canvas::use_fullscreen(on) ) { - gui->lock_window("CWindowCanvas::use_fullscreen"); - zoom_auto(); - if( !on ) gui->zoom_panel->update(0); - gui->unlock_window(); + int ret = 0; + if( on && !get_fullscreen() ) { + last_xscroll = get_xscroll(); + last_yscroll = get_yscroll(); + last_zoom = get_zoom(); + Canvas::set_fullscreen(1, unlock); +// zoom_auto(); + ret = 1; } - return 1; + if( !on && get_fullscreen() ) { + Canvas::set_fullscreen(0, unlock); + gui->zoom_panel->update(get_zoom()); + update_zoom(last_xscroll, last_yscroll, last_zoom); + gui->update_canvas(); + ret = 1; + } + return ret; } int CWindowCanvas::get_xscroll() @@ -2335,45 +2346,22 @@ int CWindowCanvas::do_eyedrop(int &rerender, int button_press, int draw) gui->eyedrop_visible = 1; } -// Decompression coefficients straight out of jpeglib -#define V_TO_R 1.40200 -#define V_TO_G -0.71414 - -#define U_TO_G -0.34414 -#define U_TO_B 1.77200 - -#define GET_COLOR(type, components, max, do_yuv) \ -{ \ +#define GET_COLOR(type, components, max, do_yuv) { \ type *row = (type*)(refresh_frame->get_rows()[i]) + \ j * components; \ float red = (float)*row++ / max; \ float green = (float)*row++ / max; \ float blue = (float)*row++ / max; \ if( do_yuv ) \ - { \ - float r = red + V_TO_R * (blue - 0.5); \ - float g = red + U_TO_G * (green - 0.5) + V_TO_G * (blue - 0.5); \ - float b = red + U_TO_B * (green - 0.5); \ - mwindow->edl->local_session->red += r; \ - mwindow->edl->local_session->green += g; \ - mwindow->edl->local_session->blue += b; \ - if( r > mwindow->edl->local_session->red_max ) mwindow->edl->local_session->red_max = r; \ - if( g > mwindow->edl->local_session->green_max ) mwindow->edl->local_session->green_max = g; \ - if( b > mwindow->edl->local_session->blue_max ) mwindow->edl->local_session->blue_max = b; \ - } \ - else \ - { \ - mwindow->edl->local_session->red += red; \ - mwindow->edl->local_session->green += green; \ - mwindow->edl->local_session->blue += blue; \ - if( red > mwindow->edl->local_session->red_max ) mwindow->edl->local_session->red_max = red; \ - if( green > mwindow->edl->local_session->green_max ) mwindow->edl->local_session->green_max = green; \ - if( blue > mwindow->edl->local_session->blue_max ) mwindow->edl->local_session->blue_max = blue; \ - } \ + YUV::yuv.yuv_to_rgb_f(red, green, blue, red, green-0.5, blue-0.5); \ + mwindow->edl->local_session->red += red; \ + mwindow->edl->local_session->green += green; \ + mwindow->edl->local_session->blue += blue; \ + if( red > mwindow->edl->local_session->red_max ) mwindow->edl->local_session->red_max = red; \ + if( green > mwindow->edl->local_session->green_max ) mwindow->edl->local_session->green_max = green; \ + if( blue > mwindow->edl->local_session->blue_max ) mwindow->edl->local_session->blue_max = blue; \ } - - mwindow->edl->local_session->red = 0; mwindow->edl->local_session->green = 0; mwindow->edl->local_session->blue = 0; @@ -3085,7 +3073,9 @@ int CWindowCanvas::test_zoom(int &redraw) if( EQUIV(zoom, my_zoom_table[idx]) ) continue; if( zoom < my_zoom_table[idx] ) break; } - zoom = idx < total_zooms ? my_zoom_table[idx] : 1.1 * zoom; + float zoom11 = 1.1f * zoom; + zoom = idx < total_zooms ? my_zoom_table[idx] : zoom11; + if( zoom > zoom11 ) zoom = zoom11; break; } case WHEEL_DOWN: { int idx = total_zooms; @@ -3093,7 +3083,9 @@ int CWindowCanvas::test_zoom(int &redraw) if( EQUIV(my_zoom_table[idx], zoom) ) continue; if( my_zoom_table[idx] < zoom ) break; } - zoom = idx >= 0 ? my_zoom_table[idx] : 0.9 * zoom; + float zoom09 = 0.9f * zoom; + zoom = idx >= 0 ? my_zoom_table[idx] : zoom09; + if( zoom < zoom09 ) zoom = zoom09; break; } case MIDDLE_BUTTON: if( gui->shift_down() ) { @@ -3259,7 +3251,7 @@ int CWindowCanvas::button_press_event() break; case CWINDOW_ZOOM: - test_zoom(redraw); + result = test_zoom(redraw); break; case CWINDOW_CROP: