From fd7da506ec769c911c35264b49bff28f408a02f9 Mon Sep 17 00:00:00 2001 From: Good Guy Date: Tue, 25 Sep 2018 10:00:36 -0600 Subject: [PATCH] xyz toggle camera/projector, single frame proxy fix, neophyte size fix, shortcuts update --- cinelerra-5.1/cinelerra/awindowgui.C | 8 +- cinelerra-5.1/cinelerra/cwindowgui.C | 6 +- cinelerra-5.1/cinelerra/gwindowgui.C | 229 +++++++++++++----- cinelerra-5.1/cinelerra/gwindowgui.h | 16 +- cinelerra-5.1/cinelerra/mwindow.C | 13 + cinelerra-5.1/cinelerra/mwindow.h | 2 + cinelerra-5.1/doc/shortcuts.html | 12 + cinelerra-5.1/ffmpeg/audio/h264_mp3.mp4 | 1 + cinelerra-5.1/ffmpeg/audio/h265_mp3.mp4 | 1 + .../plugins/theme_neophyte/neophyte.C | 14 +- 10 files changed, 226 insertions(+), 76 deletions(-) create mode 100644 cinelerra-5.1/ffmpeg/audio/h264_mp3.mp4 create mode 100644 cinelerra-5.1/ffmpeg/audio/h265_mp3.mp4 diff --git a/cinelerra-5.1/cinelerra/awindowgui.C b/cinelerra-5.1/cinelerra/awindowgui.C index 1ab6ea1a..e3271ccd 100644 --- a/cinelerra-5.1/cinelerra/awindowgui.C +++ b/cinelerra-5.1/cinelerra/awindowgui.C @@ -1699,8 +1699,12 @@ EDL *AWindowGUI::collect_proxy(Indexable *indexable) proxy_edl->session->audio_tracks = unproxy_asset->channels; proxy_edl->create_default_tracks(); double length = proxy_asset->frame_rate > 0 ? - (double)proxy_asset->video_length / proxy_asset->frame_rate : - 1.0 / mwindow->edl->session->frame_rate; + ( proxy_asset->video_length >= 0 ? + ( proxy_asset->video_length / proxy_asset->frame_rate ) : + ( proxy_edl->session->si_useduration ? + proxy_edl->session->si_duration : + 1.0 / proxy_asset->frame_rate ) ) : + 1.0 / proxy_edl->session->frame_rate; Track *current = proxy_edl->tracks->first; for( int vtrack=0; current; current=NEXT ) { if( current->data_type != TRACK_VIDEO ) continue; diff --git a/cinelerra-5.1/cinelerra/cwindowgui.C b/cinelerra-5.1/cinelerra/cwindowgui.C index c854ce31..f6da4064 100644 --- a/cinelerra-5.1/cinelerra/cwindowgui.C +++ b/cinelerra-5.1/cinelerra/cwindowgui.C @@ -565,8 +565,10 @@ int CWindowGUI::keypress_event() } break; - case KEY_F1: cwindow_operation = CWINDOW_PROTECT; break; - case KEY_F2: cwindow_operation = CWINDOW_ZOOM; break; + case KEY_F1: if( shift_down() ) { mwindow->toggle_camera_xyz(); break; } + cwindow_operation = CWINDOW_PROTECT; break; + case KEY_F2: if( shift_down() ) { mwindow->toggle_projector_xyz(); break; } + cwindow_operation = CWINDOW_ZOOM; break; case KEY_F3: cwindow_operation = CWINDOW_MASK; break; case KEY_F4: cwindow_operation = CWINDOW_RULER; break; case KEY_F5: cwindow_operation = CWINDOW_CAMERA; break; diff --git a/cinelerra-5.1/cinelerra/gwindowgui.C b/cinelerra-5.1/cinelerra/gwindowgui.C index c5248b48..306bc2ac 100644 --- a/cinelerra-5.1/cinelerra/gwindowgui.C +++ b/cinelerra-5.1/cinelerra/gwindowgui.C @@ -27,6 +27,7 @@ #include "edl.h" #include "edlsession.h" #include "gwindowgui.h" +#include "keys.h" #include "language.h" #include "localsession.h" #include "mainmenu.h" @@ -49,6 +50,8 @@ GWindowGUI::GWindowGUI(MWindow *mwindow, int w, int h) { this->mwindow = mwindow; color_thread = 0; + camera_xyz = 0; + projector_xyz = 0; } GWindowGUI::~GWindowGUI() @@ -66,12 +69,12 @@ void GWindowGUI::start_color_thread(GWindowColorButton *color_button) lock_window("GWindowGUI::start_color_thread"); } -const char *GWindowGUI::other_text[NON_AUTOMATION_TOTAL] = +const char *GWindowGUI::non_auto_text[NON_AUTOMATION_TOTAL] = { N_("Assets"), N_("Titles"), N_("Transitions"), - N_("Plugin Keyframes") + N_("Plugin Keyframes"), }; const char *GWindowGUI::auto_text[AUTOMATION_TOTAL] = @@ -144,18 +147,28 @@ static toggleinfo toggle_order[] = {1, AUTOMATION_FADE}, {1, AUTOMATION_MUTE}, {1, AUTOMATION_SPEED}, + {1, AUTOMATION_MODE}, + {1, AUTOMATION_PAN}, + {1, AUTOMATION_MASK}, + {0, -1}, // bar {1, AUTOMATION_CAMERA_X}, {1, AUTOMATION_CAMERA_Y}, {1, AUTOMATION_CAMERA_Z}, + {-1, NONAUTOTOGGLES_CAMERA_XYZ}, + {0, -1}, // bar {1, AUTOMATION_PROJECTOR_X}, {1, AUTOMATION_PROJECTOR_Y}, {1, AUTOMATION_PROJECTOR_Z}, - {0, -1}, // bar - {1, AUTOMATION_MODE}, - {1, AUTOMATION_PAN}, - {1, AUTOMATION_MASK}, + {-1, NONAUTOTOGGLES_PROJECTOR_XYZ}, }; +const char *GWindowGUI::toggle_text(toggleinfo *tp) +{ + if( tp->isauto > 0 ) return _(auto_text[tp->ref]); + if( !tp->isauto ) return _(non_auto_text[tp->ref]); + return _("XYZ"); +} + void GWindowGUI::calculate_extents(BC_WindowBase *gui, int *w, int *h) { int temp1, temp2, temp3, temp4, temp5, temp6, temp7; @@ -165,7 +178,7 @@ void GWindowGUI::calculate_extents(BC_WindowBase *gui, int *w, int *h) 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; + int ref = tp->ref; if( ref < 0 ) { *h += get_resources()->bar_data->get_h() + 5; continue; @@ -174,8 +187,7 @@ void GWindowGUI::calculate_extents(BC_WindowBase *gui, int *w, int *h) BC_WindowBase::get_resources()->checkbox_images, 0, &temp1, ¤t_w, ¤t_h, &temp2, &temp3, &temp4, &temp5, &temp6, &temp7, - _(isauto ? auto_text[ref] : other_text[ref]), - MEDIUMFONT); + toggle_text(tp), MEDIUMFONT); current_w += current_h; *w = MAX(current_w, *w); *h += current_h + 5; @@ -367,28 +379,48 @@ void GWindowGUI::create_objects() y += bar->get_h() + 5; continue; } - 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; - } - const char *label = _(tp->isauto ? auto_text[tp->ref] : other_text[tp->ref]); - int color = !tp->isauto ? -1 : auto_colors[tp->ref]; + const char *label = toggle_text(tp); + int color = tp->isauto > 0 ? auto_colors[tp->ref] : WHITE; GWindowToggle *toggle = new GWindowToggle(this, x, y, label, color, tp); add_tool(toggles[i] = toggle); - if( vframe ) - draw_vframe(vframe, get_w()-vframe->get_w()-10, y); - else if( tp->isauto ) { - int wh = toggle->get_h() - 4; - GWindowColorButton *color_button = - new GWindowColorButton(toggle, get_w()-wh-10, y+2, wh); - add_tool(color_button); - color_button->set_color(color); - color_button->draw_face(); + if( tp->isauto > 0 ) { + 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 ) { + int wh = toggle->get_h() - 4; + GWindowColorButton *color_button = + new GWindowColorButton(toggle, get_w()-wh-10, y+2, wh); + add_tool(color_button); + color_button->set_color(color); + color_button->draw_face(); + } + else + draw_vframe(vframe, get_w()-vframe->get_w()-10, y); + } + else if( tp->isauto < 0 ) { + const char *accel = 0; + switch( ref ) { + case NONAUTOTOGGLES_CAMERA_XYZ: + camera_xyz = toggle; + accel = _("SHF+F1"); + break; + case NONAUTOTOGGLES_PROJECTOR_XYZ: + projector_xyz = toggle; + accel = _("SHF+F2"); + break; + } + if( accel ) { + int x1 = get_w() - BC_Title::calculate_w(this, accel) - 10; + add_subwindow(new BC_Title(x1, y, accel)); + } } y += toggles[i]->get_h() + 5; } + update_toggles(0); unlock_window(); } @@ -407,9 +439,30 @@ void GWindowGUI::update_toggles(int use_lock) if( toggles[i] ) toggles[i]->update(); } + camera_xyz->set_value(check_xyz(AUTOMATION_CAMERA_X) > 0 ? 1 : 0); + projector_xyz->set_value(check_xyz(AUTOMATION_PROJECTOR_X) > 0 ? 1 : 0); + if(use_lock) unlock_window(); } +void GWindowGUI::toggle_camera_xyz() +{ + int v = camera_xyz->get_value() ? 0 : 1; + camera_xyz->set_value(v); + xyz_check(AUTOMATION_CAMERA_X, v); + update_toggles(0); + update_mwindow(); +} + +void GWindowGUI::toggle_projector_xyz() +{ + int v = projector_xyz->get_value() ? 0 : 1; + projector_xyz->set_value(v); + xyz_check(AUTOMATION_PROJECTOR_X, v); + update_toggles(0); + update_mwindow(); +} + int GWindowGUI::translation_event() { mwindow->session->gwindow_x = get_x(); @@ -436,6 +489,14 @@ int GWindowGUI::close_event() int GWindowGUI::keypress_event() { switch(get_keypress()) { + case KEY_F1: + if( shift_down() ) + toggle_camera_xyz(); + break; + case KEY_F2: + if( shift_down() ) + toggle_projector_xyz(); + break; case 'w': case 'W': case '0': @@ -448,10 +509,41 @@ int GWindowGUI::keypress_event() return 0; } +int GWindowGUI::check_xyz(int group) +{ +// returns 1=all set, -1=all clear, 0=mixed + int *autos = mwindow->edl->session->auto_conf->autos; + int v = autos[group], ret = v ? 1 : -1; + if( autos[group+1] != v || autos[group+2] != v ) ret = 0; + return ret; +} +void GWindowGUI::xyz_check(int group, int v) +{ + int *autos = mwindow->edl->session->auto_conf->autos; + autos[group+0] = v; + autos[group+1] = v; + autos[group+2] = v; +} + +int* GWindowGUI::get_main_value(toggleinfo *info) +{ + if( info->isauto > 0 ) + return &mwindow->edl->session->auto_conf->autos[info->ref]; + if( !info->isauto ) { + switch( info->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; +} + GWindowToggle::GWindowToggle(GWindowGUI *gui, int x, int y, const char *text, int color, toggleinfo *info) - : BC_CheckBox(x, y, *get_main_value(gui->mwindow, info), text, MEDIUMFONT, color) + : BC_CheckBox(x, y, 0, text, MEDIUMFONT, color) { this->gui = gui; this->info = info; @@ -467,15 +559,57 @@ GWindowToggle::~GWindowToggle() int GWindowToggle::handle_event() { int value = get_value(); - *get_main_value(gui->mwindow, info) = value; + if( info->isauto >= 0 ) { + *gui->get_main_value(info) = value; + switch( info->ref ) { + case AUTOMATION_CAMERA_X: + case AUTOMATION_CAMERA_Y: + case AUTOMATION_CAMERA_Z: { + int v = gui->check_xyz(AUTOMATION_CAMERA_X); + gui->camera_xyz->set_value(v > 0 ? 1 : 0); + break; } + case AUTOMATION_PROJECTOR_X: + case AUTOMATION_PROJECTOR_Y: + case AUTOMATION_PROJECTOR_Z: { + int v = gui->check_xyz(AUTOMATION_PROJECTOR_X); + gui->projector_xyz->set_value(v > 0 ? 1 : 0); + break; } + } + } + else { + int group = -1; + switch( info->ref ) { + case NONAUTOTOGGLES_CAMERA_XYZ: group = AUTOMATION_CAMERA_X; break; + case NONAUTOTOGGLES_PROJECTOR_XYZ: group = AUTOMATION_PROJECTOR_X; break; + } + if( group >= 0 ) { + gui->xyz_check(group, value); + gui->update_toggles(0); + } + } gui->update_mwindow(); - // Update stuff in MWindow unlock_window(); MWindow *mwindow = gui->mwindow; mwindow->gui->lock_window("GWindowToggle::handle_event"); - if( info->isauto ) { + 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); + + if( value && info->isauto > 0 ) { int autogroup_type = -1; switch( info->ref ) { case AUTOMATION_FADE: @@ -498,24 +632,10 @@ int GWindowToggle::handle_event() autogroup_type = AUTOGROUPTYPE_ZOOM; break; } - if( value && autogroup_type >= 0 ) { + if( autogroup_type >= 0 ) { mwindow->edl->local_session->zoombar_showautotype = autogroup_type; mwindow->gui->zoombar->update_autozoom(); } - mwindow->gui->draw_overlays(1); - } - else { - 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; - } } mwindow->gui->unlock_window(); @@ -524,25 +644,10 @@ int GWindowToggle::handle_event() return 1; } -int* GWindowToggle::get_main_value(MWindow *mwindow, toggleinfo *info) -{ - if( info->isauto ) - return &mwindow->edl->session->auto_conf->autos[info->ref]; - - switch( info->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() { - int *vp = get_main_value(gui->mwindow, info); - if( !vp ) return; - set_value(*vp); + int *vp = gui->get_main_value(info); + if( vp ) set_value(*vp); } void GWindowToggle::update_gui(int color) diff --git a/cinelerra-5.1/cinelerra/gwindowgui.h b/cinelerra-5.1/cinelerra/gwindowgui.h index 8a347d6c..bde6fa7d 100644 --- a/cinelerra-5.1/cinelerra/gwindowgui.h +++ b/cinelerra-5.1/cinelerra/gwindowgui.h @@ -34,8 +34,11 @@ enum { NONAUTOTOGGLES_TITLES, NONAUTOTOGGLES_TRANSITIONS, NONAUTOTOGGLES_PLUGIN_AUTOS, + NONAUTOTOGGLES_CAMERA_XYZ, + NONAUTOTOGGLES_PROJECTOR_XYZ, NONAUTOTOGGLES_BAR1, NONAUTOTOGGLES_BAR2, + NONAUTOTOGGLES_BAR3, NONAUTOTOGGLES_COUNT }; @@ -55,17 +58,26 @@ public: int keypress_event(); void start_color_thread(GWindowColorButton *color_button); void update_toggles(int use_lock); + void toggle_camera_xyz(); + void toggle_projector_xyz(); void update_mwindow(); void load_defaults(); void save_defaults(); + int *get_main_value(toggleinfo *info); + int check_xyz(int group); + void xyz_check(int group, int v); - static const char *other_text[]; + static const char *non_auto_text[]; static const char *auto_text[]; + static const char *xyz_group[]; + static const char *xyz_accel[]; static int auto_colors[]; + static const char *toggle_text(toggleinfo *tp); MWindow *mwindow; GWindowToggle *toggles[NONAUTOTOGGLES_COUNT + AUTOMATION_TOTAL]; GWindowColorThread *color_thread; + GWindowToggle *camera_xyz, *projector_xyz; }; class GWindowToggle : public BC_CheckBox @@ -79,8 +91,6 @@ public: void update(); void update_gui(int color); - static int* get_main_value(MWindow *mwindow, toggleinfo *info); - int color; toggleinfo *info; GWindowGUI *gui; diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index d680f508..53b1c17d 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -2955,6 +2955,19 @@ void MWindow::toggle_editing_mode() set_editing_mode(EDITING_ARROW, 0, 1); } +void MWindow::toggle_camera_xyz() +{ + gwindow->gui->lock_window("MWindow::toggle_camera_xyz"); + gwindow->gui->toggle_camera_xyz(); + gwindow->gui->unlock_window(); +} + +void MWindow::toggle_projector_xyz() +{ + gwindow->gui->lock_window("MWindow::toggle_projector_xyz"); + gwindow->gui->toggle_projector_xyz(); + gwindow->gui->unlock_window(); +} void MWindow::set_labels_follow_edits(int value) { diff --git a/cinelerra-5.1/cinelerra/mwindow.h b/cinelerra-5.1/cinelerra/mwindow.h index c6db8e7e..4bf36424 100644 --- a/cinelerra-5.1/cinelerra/mwindow.h +++ b/cinelerra-5.1/cinelerra/mwindow.h @@ -251,6 +251,8 @@ public: void move_up(int64_t distance = 0); void move_down(int64_t distance = 0); int find_selection(double position, int scroll_display = 0); + void toggle_camera_xyz(); + void toggle_projector_xyz(); // seek to labels // shift_down must be passed by the caller because different windows call diff --git a/cinelerra-5.1/doc/shortcuts.html b/cinelerra-5.1/doc/shortcuts.html index dd775cc9..10696795 100644 --- a/cinelerra-5.1/doc/shortcuts.html +++ b/cinelerra-5.1/doc/shortcuts.html @@ -1398,6 +1398,18 @@ 'Ctrl' Proxy quick switch + +
+ F1 + 'Shift' + Toggle on/off all XYZ of camera + + +
+ F2 + 'Shift' + Toggle on/off all XYZ of projector +

diff --git a/cinelerra-5.1/ffmpeg/audio/h264_mp3.mp4 b/cinelerra-5.1/ffmpeg/audio/h264_mp3.mp4 new file mode 100644 index 00000000..fea07159 --- /dev/null +++ b/cinelerra-5.1/ffmpeg/audio/h264_mp3.mp4 @@ -0,0 +1 @@ +mp4 libmp3lame diff --git a/cinelerra-5.1/ffmpeg/audio/h265_mp3.mp4 b/cinelerra-5.1/ffmpeg/audio/h265_mp3.mp4 new file mode 100644 index 00000000..fea07159 --- /dev/null +++ b/cinelerra-5.1/ffmpeg/audio/h265_mp3.mp4 @@ -0,0 +1 @@ +mp4 libmp3lame diff --git a/cinelerra-5.1/plugins/theme_neophyte/neophyte.C b/cinelerra-5.1/plugins/theme_neophyte/neophyte.C index ac64d8b7..c84b18d7 100644 --- a/cinelerra-5.1/plugins/theme_neophyte/neophyte.C +++ b/cinelerra-5.1/plugins/theme_neophyte/neophyte.C @@ -458,18 +458,18 @@ void NEOPHYTETHEME::initialize() // Dialog "Load files…" switch SI/IEC resources->filebox_szfmt_images = new_image_set( 12, + "file_size_zero_up.png", + "file_size_zero_hi.png", + "file_size_zero_dn.png", + "file_size_lwrb_up.png", + "file_size_lwrb_hi.png", + "file_size_lwrb_dn.png", "file_size_capb_up.png", "file_size_capb_hi.png", "file_size_capb_dn.png", "file_size_semi_up.png", "file_size_semi_hi.png", - "file_size_semi_dn.png", - "file_size_lwrb_up.png", - "file_size_lwrb_hi.png", - "file_size_lwrb_dn.png", - "file_size_zero_up.png", - "file_size_zero_hi.png", - "file_size_zero_dn.png"); + "file_size_semi_dn.png"); resources->listbox_column = new_image_set( 3, "column_up.png", -- 2.26.2