From: Good Guy Date: Thu, 3 Aug 2017 21:31:44 +0000 (-0600) Subject: shift keypad toggles audio, xtion masks, render+prefs widget placement X-Git-Url: https://git.cinelerra-gg.org/git/?a=commitdiff_plain;h=d66e2dde00fcfbe27c461a9956e66753faa62c95;p=goodguy%2Fhistory.git shift keypad toggles audio, xtion masks, render+prefs widget placement --- diff --git a/cinelerra-5.1/cinelerra/interfaceprefs.C b/cinelerra-5.1/cinelerra/interfaceprefs.C index 556bc8bd..90c67b1a 100644 --- a/cinelerra-5.1/cinelerra/interfaceprefs.C +++ b/cinelerra-5.1/cinelerra/interfaceprefs.C @@ -80,7 +80,7 @@ void InterfacePrefs::create_objects() x = x2; BC_Title *title; add_subwindow(title = new BC_Title(x, y, _("Keyframe reticle:"))); - y += 25; + y += title->get_h() + 5; keyframe_reticle = new KeyframeReticle(pwindow, this, x, y, &pwindow->thread->preferences->keyframe_reticle); add_subwindow(keyframe_reticle); @@ -505,7 +505,7 @@ int HairlineItem::handle_event() KeyframeReticle::KeyframeReticle(PreferencesWindow *pwindow, InterfacePrefs *iface_prefs, int x, int y, int *output) - : BC_PopupMenu(x, y, 175, hairline_to_string(*output)) + : BC_PopupMenu(x, y, 220, hairline_to_string(*output)) { this->pwindow = pwindow; this->iface_prefs = iface_prefs; diff --git a/cinelerra-5.1/cinelerra/playtransport.C b/cinelerra-5.1/cinelerra/playtransport.C index d8f0cbf5..85fe95a4 100644 --- a/cinelerra-5.1/cinelerra/playtransport.C +++ b/cinelerra-5.1/cinelerra/playtransport.C @@ -180,74 +180,52 @@ int PlayTransport::flip_vertical(int vertical, int &x, int &y) int PlayTransport::keypress_event() { int result = 1; - if(subwindow->shift_down()) - { - switch(subwindow->get_keypress()) - { - case END: - subwindow->lock_window("PlayTransport::keypress_event 1"); - goto_end(); - subwindow->unlock_window(); - break; - case HOME: - subwindow->lock_window("PlayTransport::keypress_event 2"); - goto_start(); - subwindow->unlock_window(); - break; - default: - result = 0; - break; - } + int key = subwindow->get_keypress(); +// unqualified keys, still holding lock + switch( key ) { + case HOME: + goto_start(); + return result; + case END: + goto_end(); return result; } -// Set playback range to in/out points if CTRL is down - int use_inout = 0; - if(subwindow->ctrl_down()) - { - use_inout = 1; - } + int toggle_audio = subwindow->shift_down() ? 1 : 0; + int use_inout = subwindow->ctrl_down() ? 1 : 0; + int command = -1, prev_command = engine->command->command; using_inout = use_inout; subwindow->unlock_window(); - - switch(subwindow->get_keypress()) - { - case KPPLUS: handle_transport(FAST_REWIND, 0, use_inout); break; - case KP6: handle_transport(NORMAL_REWIND, 0, use_inout); break; - case KP5: handle_transport(SLOW_REWIND, 0, use_inout); break; - case KP4: handle_transport(SINGLE_FRAME_REWIND, 0, use_inout); break; - case KP1: handle_transport(SINGLE_FRAME_FWD, 0, use_inout); break; - case KP2: handle_transport(SLOW_FWD, 0, use_inout); break; - case KP3: handle_transport(NORMAL_FWD, 0, use_inout); break; - case KPENTER: handle_transport(FAST_FWD, 0, use_inout); break; - case KPINS: handle_transport(STOP, 0, use_inout); break; - case ' ': { - int prev_command = engine->command->command; - int new_command = prev_command == COMMAND_NONE || - prev_command == CURRENT_FRAME || - prev_command == PAUSE || - prev_command == STOP ? NORMAL_FWD : STOP; - handle_transport(new_command, 0, use_inout); break; - } - case 'k': handle_transport(STOP, 0, use_inout); break; - case END: - subwindow->lock_window("PlayTransport::keypress_event 3"); - goto_end(); - subwindow->unlock_window(); - break; - case HOME: - subwindow->lock_window("PlayTransport::keypress_event 4"); - goto_start(); - subwindow->unlock_window(); - break; - default: - result = 0; + switch( key ) { + case 'k': + case KPINS: command = STOP; break; + case KPPLUS: command = FAST_REWIND; break; + case KP6: command = NORMAL_REWIND; break; + case KP5: command = SLOW_REWIND; break; + case KP4: command = SINGLE_FRAME_REWIND; break; + case KP1: command = SINGLE_FRAME_FWD; break; + case KP2: command = SLOW_FWD; break; + case KP3: command = NORMAL_FWD; break; + case KPENTER: command = FAST_FWD; break; + case ' ': + switch( prev_command ) { + case COMMAND_NONE: + case CURRENT_FRAME: + case PAUSE: + case STOP: + command = NORMAL_FWD; break; + } + break; + default: + result = 0; + break; } + if( command >= 0 ) + handle_transport(command, 0, use_inout, 1, toggle_audio); subwindow->lock_window("PlayTransport::keypress_event 5"); - return result; } @@ -265,115 +243,80 @@ void PlayTransport::goto_end() void PlayTransport::handle_transport(int command, - int wait_tracking, - int use_inout, - int update_refresh) + int wait_tracking, int use_inout, int update_refresh, int toggle_audio) { - if(!get_edl()) return; + if( !get_edl() ) return; // Stop requires transferring the output buffer to a refresh buffer. int do_stop = 0; + int resume = 0; //printf("PlayTransport::handle_transport 1 %d\n", command); int prev_command = engine->command->command; int prev_direction = engine->command->get_direction(); int prev_single_frame = engine->command->single_frame(); // Dispatch command - switch(command) - { -// Commands that play back - case FAST_REWIND: - case NORMAL_REWIND: - case SLOW_REWIND: - case SINGLE_FRAME_REWIND: - case SINGLE_FRAME_FWD: - case SLOW_FWD: - case NORMAL_FWD: - case FAST_FWD: + switch(command) { + case FAST_REWIND: // Commands that play back + case NORMAL_REWIND: + case SLOW_REWIND: + case SINGLE_FRAME_REWIND: + case SINGLE_FRAME_FWD: + case SLOW_FWD: + case NORMAL_FWD: + case FAST_FWD: + if( prev_command == command && !prev_single_frame ) { // Same direction pressed twice. Stop - if(prev_command == command && - !prev_single_frame) - { - do_stop = 1; - } - else + do_stop = 1; + break; + } // Resume or change direction - if(prev_command != STOP && - prev_command != COMMAND_NONE && - prev_command != SINGLE_FRAME_FWD && - prev_command != SINGLE_FRAME_REWIND) - { - engine->que->send_command(STOP, - CHANGE_NONE, - 0, - 0, - 0, - 0); - engine->interrupt_playback(wait_tracking); - engine->que->send_command(command, - CHANGE_NONE, - get_edl(), - 1, - 1, - use_inout); - } - else + switch( prev_command ) { + default: + engine->que->send_command(STOP, CHANGE_NONE, 0, 0, 0, 0); + engine->interrupt_playback(wait_tracking); + resume = 1; +// fall through + case STOP: + case COMMAND_NONE: + case SINGLE_FRAME_FWD: + case SINGLE_FRAME_REWIND: // Start from scratch - { - engine->que->send_command(command, - CHANGE_NONE, - get_edl(), - 1, - 0, - use_inout); - } + engine->que->send_command(command, CHANGE_NONE, get_edl(), + 1, resume, use_inout, toggle_audio); break; + } + break; // Commands that stop - case STOP: - do_stop = 1; - break; + case STOP: + do_stop = 1; + break; - case REWIND: - case GOTO_END: - engine->que->send_command(STOP, - CHANGE_NONE, - 0, - 0, - 0, - 0); + case REWIND: + case GOTO_END: + engine->que->send_command(STOP, CHANGE_NONE, 0, 0, 0, 0); engine->interrupt_playback(wait_tracking); break; } - if(do_stop) - { - engine->que->send_command(STOP, - CHANGE_NONE, - 0, - 0, - 0, - 0); + if( do_stop ) { + engine->que->send_command(STOP, CHANGE_NONE, 0, 0, 0, 0); engine->interrupt_playback(wait_tracking); // This is necessary to get an OpenGL output buffer // printf("PlayTransport::handle_transport 2 update_refresh=%d prev_command=%d prev_direction=%d\n", // update_refresh, prev_command, prev_direction); - if(!prev_single_frame && - update_refresh && - prev_command != STOP && - prev_command != COMMAND_NONE) - { - engine->que->send_command( - (prev_direction == PLAY_FORWARD) ? SINGLE_FRAME_REWIND : SINGLE_FRAME_FWD, - CHANGE_NONE, - get_edl(), - 1, - 0, - 0); + if( !prev_single_frame && update_refresh && + prev_command != STOP && prev_command != COMMAND_NONE ) { + int command = (prev_direction == PLAY_FORWARD) ? + SINGLE_FRAME_REWIND : SINGLE_FRAME_FWD; + engine->que->send_command(command, + CHANGE_NONE, get_edl(), 1, 0, 0); } } } + EDL* PlayTransport::get_edl() { return mwindow->edl; diff --git a/cinelerra-5.1/cinelerra/playtransport.h b/cinelerra-5.1/cinelerra/playtransport.h index 6de294af..11233b2b 100644 --- a/cinelerra-5.1/cinelerra/playtransport.h +++ b/cinelerra-5.1/cinelerra/playtransport.h @@ -56,11 +56,9 @@ public: // of playback // update_refresh - causes a frame advance to be issued after STOP to update // the refresh frame. - void handle_transport(int command, - int wait_tracking = 0, - int use_inout = 0, - int update_refresh = 1); - +// toggle_audio - reverses audio playback enable in RenderEngine::get_duty + void handle_transport(int command, int wait_tracking=0, + int use_inout=0, int update_refresh=1, int toggle_audio=0); int pause_transport(); int reset_transport(); int get_w(); diff --git a/cinelerra-5.1/cinelerra/render.C b/cinelerra-5.1/cinelerra/render.C index 6667cbbb..085384ae 100644 --- a/cinelerra-5.1/cinelerra/render.C +++ b/cinelerra-5.1/cinelerra/render.C @@ -1121,7 +1121,7 @@ void RenderThread::run() #define WIDTH 480 -#define HEIGHT 455 +#define HEIGHT 480 RenderWindow::RenderWindow(MWindow *mwindow, @@ -1185,16 +1185,18 @@ void RenderWindow::create_objects() if( is_image ) render->range_type = RANGE_1FRAME; - int x1 = x + title->get_w() + 20, x2 = x1 + 140; + int x1 = x + title->get_w() + 20; add_subwindow(rangeproject = new RenderRangeProject(this, render->range_type == RANGE_PROJECT, x1, y)); - add_subwindow(range1frame = new RenderRange1Frame(this, - render->range_type == RANGE_1FRAME, x2, y)); y += 20; add_subwindow(rangeselection = new RenderRangeSelection(this, render->range_type == RANGE_SELECTION, x1, y)); + y += 20; add_subwindow(rangeinout = new RenderRangeInOut(this, - render->range_type == RANGE_INOUT, x2, y)); + render->range_type == RANGE_INOUT, x1, y)); + y += 20; + add_subwindow(range1frame = new RenderRange1Frame(this, + render->range_type == RANGE_1FRAME, x1, y)); y += 30; if( is_image ) diff --git a/cinelerra-5.1/cinelerra/renderengine.C b/cinelerra-5.1/cinelerra/renderengine.C index bb8f43a8..4e8bc7de 100644 --- a/cinelerra-5.1/cinelerra/renderengine.C +++ b/cinelerra-5.1/cinelerra/renderengine.C @@ -189,11 +189,11 @@ void RenderEngine::get_duty() do_video = 0; //printf("RenderEngine::get_duty %d\n", __LINE__); - if(!command->single_frame() && - get_edl()->tracks->playable_audio_tracks() && - get_edl()->session->audio_channels) + if( get_edl()->tracks->playable_audio_tracks() && + get_edl()->session->audio_channels ) { - do_audio = 1; + do_audio = !command->single_frame() ? 1 : 0; + if( command->audio_toggle ) do_audio = !do_audio; } //printf("RenderEngine::get_duty %d\n", __LINE__); diff --git a/cinelerra-5.1/cinelerra/transportque.C b/cinelerra-5.1/cinelerra/transportque.C index fef68582..16aa45fa 100644 --- a/cinelerra-5.1/cinelerra/transportque.C +++ b/cinelerra-5.1/cinelerra/transportque.C @@ -52,6 +52,7 @@ void TransportCommand::reset() infinite = 0; realtime = 0; resume = 0; + audio_toggle = 0; // Don't reset the change type for commands which don't perform the change if(command != STOP) change_type = 0; command = COMMAND_NONE; @@ -85,6 +86,7 @@ void TransportCommand::copy_from(TransportCommand *command) this->playbackstart = command->playbackstart; this->realtime = command->realtime; this->resume = command->resume; + this->audio_toggle = command->audio_toggle; } TransportCommand& TransportCommand::operator=(TransportCommand &command) @@ -148,13 +150,10 @@ float TransportCommand::get_speed() } // Assume starting without pause -void TransportCommand::set_playback_range(EDL *edl, int use_inout) +void TransportCommand::set_playback_range(EDL *edl, int use_inout, int toggle_audio) { if(!edl) edl = this->edl; - - - switch(command) { case SLOW_FWD: @@ -226,6 +225,7 @@ void TransportCommand::set_playback_range(EDL *edl, int use_inout) break; } + audio_toggle = toggle_audio; } void TransportCommand::playback_range_adjust_inout() @@ -275,12 +275,8 @@ TransportQue::~TransportQue() delete output_lock; } -int TransportQue::send_command(int command, - int change_type, - EDL *new_edl, - int realtime, - int resume, - int use_inout) +int TransportQue::send_command(int command, int change_type, EDL *new_edl, + int realtime, int resume, int use_inout, int toggle_audio) { input_lock->lock("TransportQue::send_command 1"); this->command.command = command; @@ -307,7 +303,7 @@ int TransportQue::send_command(int command, } // Set playback range - this->command.set_playback_range(new_edl, use_inout); + this->command.set_playback_range(new_edl, use_inout, toggle_audio); } input_lock->unlock(); diff --git a/cinelerra-5.1/cinelerra/transportque.h b/cinelerra-5.1/cinelerra/transportque.h index 5093b0ea..1eed30e7 100644 --- a/cinelerra-5.1/cinelerra/transportque.h +++ b/cinelerra-5.1/cinelerra/transportque.h @@ -41,7 +41,7 @@ public: void copy_from(TransportCommand *command); TransportCommand& operator=(TransportCommand &command); // Get the range to play back from the EDL - void set_playback_range(EDL *edl = 0, int use_inout = 0); + void set_playback_range(EDL *edl=0, int use_inout=0, int toggle_audio=0); // Adjust playback range with in/out points for rendering void playback_range_adjust_inout(); @@ -69,6 +69,8 @@ public: int realtime; // Use persistant starting point int resume; +// reverse audio duty + int audio_toggle; private: // Copied to render engines @@ -88,7 +90,8 @@ public: int realtime, // Persistent starting point int resume = 0, - int use_inout = 0); + int use_inout = 0, + int toggle_audio = 0); void update_change_type(int change_type); TransportCommand command; diff --git a/cinelerra-5.1/cinelerra/transportque.inc b/cinelerra-5.1/cinelerra/transportque.inc index 5f0c0b90..3ce2f20e 100644 --- a/cinelerra-5.1/cinelerra/transportque.inc +++ b/cinelerra-5.1/cinelerra/transportque.inc @@ -28,22 +28,22 @@ // Commands // Perform change but don't render anything -#define COMMAND_NONE 0 +#define COMMAND_NONE 0 // Stop playback but keep existing change_type flag -#define STOP 7 - -#define SINGLE_FRAME_FWD 1 -#define NORMAL_FWD 2 -#define FAST_FWD 3 -#define SINGLE_FRAME_REWIND 4 -#define NORMAL_REWIND 5 -#define FAST_REWIND 6 -#define PAUSE 8 -#define SLOW_FWD 9 -#define SLOW_REWIND 10 -#define REWIND 11 -#define GOTO_END 12 -#define CURRENT_FRAME 13 +#define STOP 7 + +#define SINGLE_FRAME_FWD 1 +#define NORMAL_FWD 2 +#define FAST_FWD 3 +#define SINGLE_FRAME_REWIND 4 +#define NORMAL_REWIND 5 +#define FAST_REWIND 6 +#define PAUSE 8 +#define SLOW_FWD 9 +#define SLOW_REWIND 10 +#define REWIND 11 +#define GOTO_END 12 +#define CURRENT_FRAME 13 // Level of change. Changes have to be inclusive of all the lesser changes. // Delete cache diff --git a/cinelerra-5.1/cinelerra/vdeviceprefs.C b/cinelerra-5.1/cinelerra/vdeviceprefs.C index e4b6dd28..beada605 100644 --- a/cinelerra-5.1/cinelerra/vdeviceprefs.C +++ b/cinelerra-5.1/cinelerra/vdeviceprefs.C @@ -617,7 +617,7 @@ int VScalingItem::handle_event() VScalingEquation::VScalingEquation(int x, int y, int *output) - : BC_PopupMenu(x, y, 175, interpolation_to_string(*output)) + : BC_PopupMenu(x, y, 240, interpolation_to_string(*output)) { this->output = output; } diff --git a/cinelerra-5.1/plugins/shapes/burst.png b/cinelerra-5.1/plugins/shapes/burst.png new file mode 100644 index 00000000..b605c6df Binary files /dev/null and b/cinelerra-5.1/plugins/shapes/burst.png differ diff --git a/cinelerra-5.1/plugins/shapes/specks.png b/cinelerra-5.1/plugins/shapes/specks.png new file mode 100644 index 00000000..63a75b69 Binary files /dev/null and b/cinelerra-5.1/plugins/shapes/specks.png differ diff --git a/cinelerra-5.1/plugins/shapes/spiral.png b/cinelerra-5.1/plugins/shapes/spiral.png index 9a8da9f8..e2eaa805 100644 Binary files a/cinelerra-5.1/plugins/shapes/spiral.png and b/cinelerra-5.1/plugins/shapes/spiral.png differ