From: Good Guy Date: Sat, 30 Nov 2019 03:29:02 +0000 (-0700) Subject: tweak zoom/fullscr to remember cwdw scale after fullscr X-Git-Tag: 2019-11~1 X-Git-Url: https://cinelerra-gg.org/git/?a=commitdiff_plain;h=b78b166faf60a1c7357f990b1e2fb0e70be29fee;p=goodguy%2Fcinelerra.git tweak zoom/fullscr to remember cwdw scale after fullscr --- diff --git a/cinelerra-5.1/cinelerra/canvas.C b/cinelerra-5.1/cinelerra/canvas.C index 410145f0..e3e1b0f3 100644 --- a/cinelerra-5.1/cinelerra/canvas.C +++ b/cinelerra-5.1/cinelerra/canvas.C @@ -135,11 +135,6 @@ int Canvas::get_fullscreen() return is_fullscreen; } -void Canvas::set_fullscreen(int value) -{ - is_fullscreen = value; -} - // Get dimensions given a zoom void Canvas::calculate_sizes(float aspect_ratio, int output_w, int output_h, float zoom, @@ -576,29 +571,34 @@ void Canvas::stop_video() } } - -int Canvas::use_fullscreen(int on) +int Canvas::set_fullscreen(int on, int unlock) { + int ret = 0; + BC_WindowBase *window = get_canvas(); + if( unlock ) + window->unlock_window(); if( on && !get_fullscreen() ) { start_fullscreen(); - return 1; + ret = 1; } if( !on && get_fullscreen() ) { stop_fullscreen(); - return 1; + ret = 1; } - return 0; + if( unlock ) + window->lock_window("Canvas::set_fullscreen"); + return ret; } void Canvas::start_fullscreen() { - set_fullscreen(1); + is_fullscreen = 1; create_canvas(); } void Canvas::stop_fullscreen() { - set_fullscreen(0); + is_fullscreen = 0; create_canvas(); } @@ -661,7 +661,6 @@ void Canvas::create_canvas() } - int Canvas::cursor_leave_event_base(BC_WindowBase *caller) { int result = 0; @@ -693,20 +692,19 @@ int Canvas::button_press_event_base(BC_WindowBase *caller) int Canvas::keypress_event(BC_WindowBase *caller) { int key = caller->get_keypress(); + int on = -1; switch( key ) { case 'f': - caller->unlock_window(); - use_fullscreen(get_fullscreen() ? 0 : 1); - caller->lock_window("Canvas::keypress_event 1"); + on = get_fullscreen() ? 0 : 1; break; case ESC: - caller->unlock_window(); - use_fullscreen(0); - caller->lock_window("Canvas::keypress_event 2"); + on = 0; break; default: return 0; } + if( on >= 0 ) + set_fullscreen(on); return 1; } @@ -933,9 +931,7 @@ int CanvasSubWindowItem::handle_event() { // It isn't a problem to delete the canvas from in here because the event // dispatcher is the canvas subwindow. - canvas->subwindow->unlock_window(); - canvas->use_fullscreen(0); - canvas->subwindow->lock_window("CanvasSubWindowItem::handle_event"); + canvas->set_fullscreen(0); return 1; } @@ -1108,18 +1104,10 @@ int CanvasToggleControls::handle_event() char* CanvasToggleControls::calculate_text(int cwindow_controls) { - if(!cwindow_controls) - return _("Show controls"); - else - return _("Hide controls"); + return !cwindow_controls ? _("Show controls") : _("Hide controls"); } - - - - - CanvasFullScreenItem::CanvasFullScreenItem(Canvas *canvas) : BC_MenuItem(_("Fullscreen"), "f", 'f') { @@ -1127,20 +1115,11 @@ CanvasFullScreenItem::CanvasFullScreenItem(Canvas *canvas) } int CanvasFullScreenItem::handle_event() { - canvas->subwindow->unlock_window(); - canvas->use_fullscreen(1); - canvas->subwindow->lock_window("CanvasFullScreenItem::handle_event"); + canvas->set_fullscreen(1); return 1; } - - - - - - - CanvasPopupRemoveSource::CanvasPopupRemoveSource(Canvas *canvas) : BC_MenuItem(_("Close source")) { diff --git a/cinelerra-5.1/cinelerra/canvas.h b/cinelerra-5.1/cinelerra/canvas.h index 140f70f2..1ea04448 100644 --- a/cinelerra-5.1/cinelerra/canvas.h +++ b/cinelerra-5.1/cinelerra/canvas.h @@ -79,9 +79,8 @@ public: virtual void toggle_controls() {} virtual int get_cwindow_controls() { return 0; } virtual int get_fullscreen(); - virtual void set_fullscreen(int value); virtual int get_clear_color(); - virtual int use_fullscreen(int on); + virtual int set_fullscreen(int on, int unlock=1); int cursor_leave_event_base(BC_WindowBase *caller); int cursor_enter_event_base(BC_WindowBase *caller); diff --git a/cinelerra-5.1/cinelerra/cwindow.C b/cinelerra-5.1/cinelerra/cwindow.C index d4047e35..0ba2530d 100644 --- a/cinelerra-5.1/cinelerra/cwindow.C +++ b/cinelerra-5.1/cinelerra/cwindow.C @@ -327,8 +327,9 @@ int CWindowRemoteHandler::remote_process_key(RemoteControl *remote_control, int case 'e': break; case 'f': { - Canvas *canvas = mwindow_gui->mwindow->cwindow->gui->canvas; - canvas->use_fullscreen(canvas->get_fullscreen() ? 0 : 1); + CWindowCanvas *canvas = mwindow_gui->mwindow->cwindow->gui->canvas; + int on = canvas->get_fullscreen() ? 0 : 1; + canvas->Canvas::set_fullscreen(on, 0); return 1; } default: return -1; diff --git a/cinelerra-5.1/cinelerra/cwindowgui.C b/cinelerra-5.1/cinelerra/cwindowgui.C index fb0cdd67..567c9338 100644 --- a/cinelerra-5.1/cinelerra/cwindowgui.C +++ b/cinelerra-5.1/cinelerra/cwindowgui.C @@ -443,9 +443,11 @@ int CWindowGUI::keypress_event() result = 1; break; case 'f': - unlock_window(); - canvas->use_fullscreen(canvas->get_fullscreen() ? 0 : 1); - lock_window("CWindowGUI::keypress_event 1"); + canvas->set_fullscreen(canvas->get_fullscreen() ? 0 : 1); + result = 1; + break; + case ESC: + canvas->set_fullscreen(0); result = 1; break; case 'x': @@ -465,12 +467,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 +980,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 +999,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) { - if( Canvas::use_fullscreen(on) ) { - gui->lock_window("CWindowCanvas::use_fullscreen"); + int ret = 0; + if( on && !get_fullscreen() ) { + last_xscroll = get_xscroll(); + last_yscroll = get_yscroll(); + last_zoom = get_zoom(); + Canvas::set_fullscreen(1); zoom_auto(); - if( !on ) gui->zoom_panel->update(0); - gui->unlock_window(); + ret = 1; } - return 1; + if( !on && get_fullscreen() ) { + Canvas::set_fullscreen(0); + 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() diff --git a/cinelerra-5.1/cinelerra/cwindowgui.h b/cinelerra-5.1/cinelerra/cwindowgui.h index 2930efa0..f58ac69a 100644 --- a/cinelerra-5.1/cinelerra/cwindowgui.h +++ b/cinelerra-5.1/cinelerra/cwindowgui.h @@ -319,9 +319,7 @@ public: void reset_camera(); void reset_projector(); void draw_crophandle(int x, int y); - int use_fullscreen(int on); - void start_fullscreen(); - void stop_fullscreen(); + int set_fullscreen(int on); // Draw the camera/projector overlay in different colors. void draw_outlines(int do_camera); @@ -333,6 +331,8 @@ public: MWindow *mwindow; CWindowGUI *gui; + float last_xscroll, last_yscroll; + float last_zoom; }; #endif diff --git a/cinelerra-5.1/cinelerra/dbwindow.C b/cinelerra-5.1/cinelerra/dbwindow.C index 28603bc6..efb10b8f 100644 --- a/cinelerra-5.1/cinelerra/dbwindow.C +++ b/cinelerra-5.1/cinelerra/dbwindow.C @@ -951,7 +951,6 @@ DbWindowCanvas(DbWindowGUI *gui, int x, int y, int w, int h) : Canvas(gui->dwindow->mwindow, gui, x, y, w, h, w, h, 0) { this->gui = gui; - this->is_fullscreen = 0; } DbWindowCanvas:: diff --git a/cinelerra-5.1/cinelerra/dbwindow.h b/cinelerra-5.1/cinelerra/dbwindow.h index f36644f5..24a40df8 100644 --- a/cinelerra-5.1/cinelerra/dbwindow.h +++ b/cinelerra-5.1/cinelerra/dbwindow.h @@ -226,7 +226,6 @@ class DbWindowCanvas : public Canvas { public: DbWindowGUI *gui; - int is_fullscreen; DbWindowCanvas(DbWindowGUI *gui, int x, int y, int w, int h); ~DbWindowCanvas(); @@ -234,8 +233,6 @@ public: void draw_frame(VFrame *frame, int x, int y, int w, int h); int button_press_event() { return 0; } int keypress_event() { return 0; } - int get_fullscreen() { return is_fullscreen; } - void set_fullscreen(int value) { is_fullscreen = value; } }; class DbWindowVIcon : public VIcon diff --git a/cinelerra-5.1/cinelerra/record.C b/cinelerra-5.1/cinelerra/record.C index 2dd9e2c5..dd587a5e 100644 --- a/cinelerra-5.1/cinelerra/record.C +++ b/cinelerra-5.1/cinelerra/record.C @@ -1826,8 +1826,9 @@ int Record::remote_process_key(RemoteControl *remote_control, int key) channel_down(); break; case 'f': { - Canvas *canvas = record_monitor->window->canvas; - canvas->use_fullscreen(canvas->get_fullscreen() ? 0 : 1); + RecordMonitorCanvas *canvas = record_monitor->window->canvas; + int on = canvas->get_fullscreen() ? 0 : 1; + canvas->Canvas::set_fullscreen(on, 0); break; } default: return -1; diff --git a/cinelerra-5.1/cinelerra/recordmonitor.C b/cinelerra-5.1/cinelerra/recordmonitor.C index d8302adc..983f53e3 100644 --- a/cinelerra-5.1/cinelerra/recordmonitor.C +++ b/cinelerra-5.1/cinelerra/recordmonitor.C @@ -874,6 +874,11 @@ int RecordMonitorCanvas::keypress_event() return 1; } +int RecordMonitorCanvas::keypress_event(RecordMonitorGUI *window) +{ + return Canvas::keypress_event(window); +} + RecordMonitorFullsize::RecordMonitorFullsize(MWindow *mwindow, RecordMonitorGUI *window) diff --git a/cinelerra-5.1/cinelerra/recordmonitor.h b/cinelerra-5.1/cinelerra/recordmonitor.h index 956cd214..987d325b 100644 --- a/cinelerra-5.1/cinelerra/recordmonitor.h +++ b/cinelerra-5.1/cinelerra/recordmonitor.h @@ -107,7 +107,7 @@ public: void enable_signal_status(int enable); MeterPanel *meters; - Canvas *canvas; + RecordMonitorCanvas *canvas; // RecordTransport *record_transport; #ifdef HAVE_FIREWIRE AVC1394Transport *avc1394_transport; @@ -228,6 +228,7 @@ public: int cursor_enter_event(); void reset_translation(); int keypress_event(); + int keypress_event(RecordMonitorGUI *window); int get_output_w(); int get_output_h(); diff --git a/cinelerra-5.1/cinelerra/resample.C b/cinelerra-5.1/cinelerra/resample.C index 8ebd90dc..04209af6 100644 --- a/cinelerra-5.1/cinelerra/resample.C +++ b/cinelerra-5.1/cinelerra/resample.C @@ -70,6 +70,9 @@ void Resample::reset() input_position = 0; } +/* This algorithm from: + * SIGNAL PROCESSING ALGORITHMS IN FORTRAN AND C + * S.D. Stearns and R.A. David, Prentice-Hall, 1992 */ void Resample::blackman(double fcn, int filter_l) { double wcn = M_PI * fcn; diff --git a/cinelerra-5.1/cinelerra/versioninfo.h b/cinelerra-5.1/cinelerra/versioninfo.h index 70ed4824..d6e20b7c 100644 --- a/cinelerra-5.1/cinelerra/versioninfo.h +++ b/cinelerra-5.1/cinelerra/versioninfo.h @@ -5,7 +5,7 @@ #define REPOMAINTXT "git://git.cinelerra-gg.org/goodguy/cinelerra.git\n" #define COPYRIGHT_DATE "2019" #define COPYRIGHTTEXT1 "(c) 2006-2019 Heroine Virtual Ltd. by Adam Williams\n" -#define COPYRIGHTTEXT2 "(c) 2007-2019 cin5 derivative by W.P. Morrow aka goodguy\n" +#define COPYRIGHTTEXT2 "2007-2020 mods for Cinelerra-GG by W.P.Morrow aka goodguy\n" #undef COMPILEDATE #endif diff --git a/cinelerra-5.1/cinelerra/vwindowgui.C b/cinelerra-5.1/cinelerra/vwindowgui.C index 8ecdb0d6..7c1d51e0 100644 --- a/cinelerra-5.1/cinelerra/vwindowgui.C +++ b/cinelerra-5.1/cinelerra/vwindowgui.C @@ -364,15 +364,10 @@ int VWindowGUI::keypress_event() mwindow->redo_entry(this); break; case 'f': - unlock_window(); - canvas->use_fullscreen(canvas->get_fullscreen() ? 0 : 1); - lock_window("VWindowGUI::keypress_event 1"); + canvas->set_fullscreen(canvas->get_fullscreen() ? 0 : 1); break; case ESC: - unlock_window(); - if( canvas->get_fullscreen() ) - canvas->use_fullscreen(0); - lock_window("VWindowGUI::keypress_event 2"); + canvas->set_fullscreen(0); break; case KEY_F1: case KEY_F2: @@ -878,14 +873,3 @@ void VWindowCanvas::draw_overlays() } } -int VWindowCanvas::use_fullscreen(int on) -{ - if( Canvas::use_fullscreen(on) ) { - gui->lock_window("VWindowCanvas::use_fullscreen"); - zoom_auto(); - draw_refresh(1); - gui->unlock_window(); - } - return 1; -} - diff --git a/cinelerra-5.1/cinelerra/vwindowgui.h b/cinelerra-5.1/cinelerra/vwindowgui.h index d25df29c..712565dd 100644 --- a/cinelerra-5.1/cinelerra/vwindowgui.h +++ b/cinelerra-5.1/cinelerra/vwindowgui.h @@ -121,7 +121,6 @@ public: void draw_overlays(); void close_source(); void zoom_auto(); - int use_fullscreen(int on); MWindow *mwindow; VWindowGUI *gui; diff --git a/cinelerra-5.1/cinelerra/zwindowgui.C b/cinelerra-5.1/cinelerra/zwindowgui.C index a52bad96..62bcb93e 100644 --- a/cinelerra-5.1/cinelerra/zwindowgui.C +++ b/cinelerra-5.1/cinelerra/zwindowgui.C @@ -96,22 +96,22 @@ int ZWindowGUI::keypress_event() close_event(); return 1; } - unlock_window(); int result = 1; switch( key ) { case 'f': - canvas->use_fullscreen(canvas->get_fullscreen() ? 0 : 1); + canvas->set_fullscreen(canvas->get_fullscreen() ? 0 : 1); break; case ESC: - canvas->use_fullscreen(0); + canvas->set_fullscreen(0); break; default: + unlock_window(); mwindow->gui->lock_window("ZWindowGUI::keypress_event"); result = mwindow->gui->mbuttons->transport->do_keypress(key); mwindow->gui->unlock_window(); + lock_window("ZWindowGUI::keypress_event 1"); } - lock_window("ZWindowGUI::keypress_event 1"); return result; } diff --git a/cinelerra-5.1/msg/txt b/cinelerra-5.1/msg/txt index 6ddc0351..bcb5f0b6 100644 --- a/cinelerra-5.1/msg/txt +++ b/cinelerra-5.1/msg/txt @@ -8,6 +8,11 @@ Cinfinity icons selected in Preferences Sam (CC BY 3.0, Cakewalk and Neophyte themes by Olaf Wolff (CC BY 4.0, https://creativecommons.org/licenses/by/4.0/) . +November 2019 New Features of note: + Audio improvements added for playback/speed/sampling. + Spanish po and website translations updated by Sergio. + Transcode 1:1 added to convert to a different format. + Compositor zoom using the wheel & panning is available. October 2019 New Features of note: Scaling for any size monitor now available in Preferences. New Shape Wipe video transitions have been contributed.