From 95f86161c3b9c422bbd04ec8f685aa7e856d6dd7 Mon Sep 17 00:00:00 2001 From: Good Guy Date: Wed, 26 Sep 2018 18:53:58 -0600 Subject: [PATCH] patch expander changes, rework show assets/titles/transitions, add projector/camera shortcuts --- cinelerra-5.1/cinelerra/apatchgui.C | 27 +-- cinelerra-5.1/cinelerra/atrack.C | 8 +- cinelerra-5.1/cinelerra/cwindowgui.C | 1 + cinelerra-5.1/cinelerra/editpanel.C | 12 +- cinelerra-5.1/cinelerra/gwindowgui.C | 4 +- cinelerra-5.1/cinelerra/indexfile.C | 2 +- cinelerra-5.1/cinelerra/mainmenu.C | 20 ++- cinelerra-5.1/cinelerra/mwindow.C | 6 - cinelerra-5.1/cinelerra/mwindow.h | 1 - cinelerra-5.1/cinelerra/patchgui.C | 104 ++++------- cinelerra-5.1/cinelerra/patchgui.h | 2 +- cinelerra-5.1/cinelerra/resourcepixmap.C | 38 ++-- cinelerra-5.1/cinelerra/resourcepixmap.h | 52 ++---- cinelerra-5.1/cinelerra/track.C | 28 ++- cinelerra-5.1/cinelerra/track.h | 3 + cinelerra-5.1/cinelerra/trackcanvas.C | 184 +++++++++----------- cinelerra-5.1/cinelerra/trackcanvas.h | 3 +- cinelerra-5.1/cinelerra/transitionhandles.C | 2 +- cinelerra-5.1/cinelerra/viewmenu.C | 18 +- cinelerra-5.1/cinelerra/vpatchgui.C | 22 +-- cinelerra-5.1/cinelerra/vtrack.C | 8 +- 21 files changed, 230 insertions(+), 315 deletions(-) diff --git a/cinelerra-5.1/cinelerra/apatchgui.C b/cinelerra-5.1/cinelerra/apatchgui.C index 824e7a86..f41959ac 100644 --- a/cinelerra-5.1/cinelerra/apatchgui.C +++ b/cinelerra-5.1/cinelerra/apatchgui.C @@ -93,8 +93,9 @@ int APatchGUI::update(int x, int y) int x1 = 0; int y1 = PatchGUI::update(x, y); + int y2 = y1 + mwindow->theme->fade_h; if( fade ) { - if( h - y1 < mwindow->theme->fade_h ) { + if( h < y2 ) { delete fade; fade = 0; } @@ -110,26 +111,28 @@ int APatchGUI::update(int x, int y) mwindow->edl->local_session->automation_maxs[AUTOGROUPTYPE_AUDIO_FADE]); } } - else - if( h - y1 >= mwindow->theme->fade_h ) { + else if( h >= y2 ) { patchbay->add_subwindow(fade = new AFadePatch(mwindow, this, x1+x, y1+y, patchbay->get_w() - 10)); } - y1 += mwindow->theme->fade_h; + if( fade ) + y1 = y2; + y2 = y1 + mwindow->theme->meter_h; if( meter ) { - if( h - y1 < mwindow->theme->meter_h ) { + if( h < y2 ) { delete meter; meter = 0; } } - else - if( h - y1 >= mwindow->theme->meter_h ) { + else if( h >= y2 ) { patchbay->add_subwindow(meter = new AMeterPatch(mwindow, this, x1+x, y1+y)); } - y1 += mwindow->theme->meter_h; + if( meter ) + y1 = y2; + y2 = y1 + mwindow->theme->pan_h; if( pan ) { - if( h - y1 < mwindow->theme->pan_h ) { + if( h < y2 ) { delete mix; mix = 0; delete pan; pan = 0; delete nudge; nudge = 0; @@ -157,8 +160,7 @@ int APatchGUI::update(int x, int y) nudge->update(); } } - else - if( h - y1 >= mwindow->theme->pan_h ) { + else if( h >= y2 ) { patchbay->add_subwindow(mix = new AMixPatch(mwindow, this, x1+x, y1+y+5)); x1 += mix->get_w() + 10; patchbay->add_subwindow(pan = new APanPatch(mwindow, this, x1+x, y1+y)); @@ -166,7 +168,8 @@ int APatchGUI::update(int x, int y) patchbay->add_subwindow(nudge = new NudgePatch(mwindow, this, x1+x, y1+y, patchbay->get_w() - x1-x - 10)); } - y1 += mwindow->theme->pan_h; + if( pan ) + y1 = y2; return y1; } diff --git a/cinelerra-5.1/cinelerra/atrack.C b/cinelerra-5.1/cinelerra/atrack.C index ee39162a..5ba270e6 100644 --- a/cinelerra-5.1/cinelerra/atrack.C +++ b/cinelerra-5.1/cinelerra/atrack.C @@ -106,11 +106,9 @@ void ATrack::create_objects() int ATrack::vertical_span(Theme *theme) { int track_h = Track::vertical_span(theme); - int patch_h = 0; - if(expand_view) - { - patch_h += theme->title_h + theme->play_h + theme->fade_h + theme->meter_h + theme->pan_h; - } + int patch_h = theme->title_h; + if( expand_view ) + patch_h += theme->play_h + theme->fade_h + theme->meter_h + theme->pan_h; return MAX(track_h, patch_h); } diff --git a/cinelerra-5.1/cinelerra/cwindowgui.C b/cinelerra-5.1/cinelerra/cwindowgui.C index f6da4064..19ff101e 100644 --- a/cinelerra-5.1/cinelerra/cwindowgui.C +++ b/cinelerra-5.1/cinelerra/cwindowgui.C @@ -488,6 +488,7 @@ int CWindowGUI::keypress_event() lock_window("CWindowGUI::keypress_event 1"); break; case 'x': + if( ctrl_down() || shift_down() || alt_down() ) break; unlock_window(); mwindow->gui->lock_window("CWindowGUI::keypress_event 2"); mwindow->cut(); diff --git a/cinelerra-5.1/cinelerra/editpanel.C b/cinelerra-5.1/cinelerra/editpanel.C index 1c357b54..b370723a 100644 --- a/cinelerra-5.1/cinelerra/editpanel.C +++ b/cinelerra-5.1/cinelerra/editpanel.C @@ -953,6 +953,8 @@ EditCut::~EditCut() } int EditCut::keypress_event() { + if( ctrl_down() || shift_down() || alt_down() ) + return 0; if( get_keypress() == 'x' ) return handle_event(); return 0; @@ -1011,14 +1013,16 @@ EditCommercial::EditCommercial(MWindow *mwindow, EditPanel *panel, int x, int y) { this->mwindow = mwindow; this->panel = panel; - set_tooltip(_("Commercial ( shift X )")); + set_tooltip(_("Commercial ( shift A )")); } EditCommercial::~EditCommercial() { } int EditCommercial::keypress_event() { - if( get_keypress() == 'X' ) + if( ctrl_down() || !shift_down() || alt_down() ) + return 0; + if( get_keypress() == 'A' ) return handle_event(); return 0; } @@ -1180,6 +1184,8 @@ EditUndo::~EditUndo() } int EditUndo::keypress_event() { + if( ctrl_down() || shift_down() || alt_down() ) + return 0; if( get_keypress() == 'z' ) return handle_event(); return 0; @@ -1202,6 +1208,8 @@ EditRedo::~EditRedo() } int EditRedo::keypress_event() { + if( ctrl_down() || !shift_down() || alt_down() ) + return 0; if( get_keypress() == 'Z' ) return handle_event(); return 0; diff --git a/cinelerra-5.1/cinelerra/gwindowgui.C b/cinelerra-5.1/cinelerra/gwindowgui.C index d237fc49..e2345968 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 ) { diff --git a/cinelerra-5.1/cinelerra/indexfile.C b/cinelerra-5.1/cinelerra/indexfile.C index 3d21d2af..c063b44c 100644 --- a/cinelerra-5.1/cinelerra/indexfile.C +++ b/cinelerra-5.1/cinelerra/indexfile.C @@ -690,7 +690,7 @@ SET_TRACE float *buffer = 0; int buffer_shared = 0; int center_pixel = mwindow->edl->local_session->zoom_track / 2; - if( mwindow->edl->session->show_titles ) + if( edit->track->show_titles() ) center_pixel += mwindow->theme->get_image("title_bg_data")->get_h(); if( index_state->index_status == INDEX_BUILDING ) { diff --git a/cinelerra-5.1/cinelerra/mainmenu.C b/cinelerra-5.1/cinelerra/mainmenu.C index 1deb52a1..a94fb589 100644 --- a/cinelerra-5.1/cinelerra/mainmenu.C +++ b/cinelerra-5.1/cinelerra/mainmenu.C @@ -247,13 +247,19 @@ void MainMenu::create_objects() viewmenu->add_item(plugin_automation = new PluginAutomation(mwindow, "7")); viewmenu->add_item(mask_automation = new ShowAutomation(mwindow, _("Mask"), "8", AUTOMATION_MASK)); viewmenu->add_item(speed_automation = new ShowAutomation(mwindow, _("Speed"), "9", AUTOMATION_SPEED)); - viewmenu->add_item(camera_x = new ShowAutomation(mwindow, _("Camera X"), "", AUTOMATION_CAMERA_X)); - viewmenu->add_item(camera_y = new ShowAutomation(mwindow, _("Camera Y"), "", AUTOMATION_CAMERA_Y)); - viewmenu->add_item(camera_z = new ShowAutomation(mwindow, _("Camera Z"), "", AUTOMATION_CAMERA_Z)); - viewmenu->add_item(project_x = new ShowAutomation(mwindow, _("Projector X"), "", AUTOMATION_PROJECTOR_X)); - viewmenu->add_item(project_y = new ShowAutomation(mwindow, _("Projector Y"), "", AUTOMATION_PROJECTOR_Y)); - viewmenu->add_item(project_z = new ShowAutomation(mwindow, _("Projector Z"), "", AUTOMATION_PROJECTOR_Z)); + camera_x = new ShowAutomation(mwindow, _("Camera X"), "Ctl-Shift-X", AUTOMATION_CAMERA_X); + camera_x->set_ctrl(); camera_x->set_shift(); viewmenu->add_item(camera_x); + camera_y = new ShowAutomation(mwindow, _("Camera Y"), "Ctl-Shift-Y", AUTOMATION_CAMERA_Y); + camera_y->set_ctrl(); camera_y->set_shift(); viewmenu->add_item(camera_y); + camera_z = new ShowAutomation(mwindow, _("Camera Z"), "Ctl-Shift-Z", AUTOMATION_CAMERA_Z); + camera_z->set_ctrl(); camera_z->set_shift(); viewmenu->add_item(camera_z); + project_x = new ShowAutomation(mwindow, _("Projector X"), "Alt-Shift-X", AUTOMATION_PROJECTOR_X); + project_x->set_alt(); project_x->set_shift(); viewmenu->add_item(project_x); + project_y = new ShowAutomation(mwindow, _("Projector Y"), "Alt-Shift-Y", AUTOMATION_PROJECTOR_Y); + project_y->set_alt(); project_y->set_shift(); viewmenu->add_item(project_y); + project_z = new ShowAutomation(mwindow, _("Projector Z"), "Alt-Shift-Z", AUTOMATION_PROJECTOR_Z); + project_z->set_alt(); project_z->set_shift(); viewmenu->add_item(project_z); add_menu(windowmenu = new BC_Menu(_("Window"))); windowmenu->add_item(show_vwindow = new ShowVWindow(mwindow)); @@ -810,7 +816,7 @@ int KeyframeCurveTypeItem::handle_event() CutDefaultKeyframe::CutDefaultKeyframe(MWindow *mwindow) - : BC_MenuItem(_("Cut default keyframe"), _("Alt-X"), 'X') + : BC_MenuItem(_("Cut default keyframe"), _("Alt-x"), 'x') { set_alt(); this->mwindow = mwindow; diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index 53b1c17d..3213969a 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -2880,12 +2880,6 @@ void MWindow::toggle_loop_playback() sync_parameters(CHANGE_PARAMS); } -//void MWindow::set_titles(int value) -//{ -// edl->session->show_titles = value; -// trackmovement(edl->local_session->track_start); -//} - void MWindow::set_screens(int value) { screens = value; diff --git a/cinelerra-5.1/cinelerra/mwindow.h b/cinelerra-5.1/cinelerra/mwindow.h index 4bf36424..2b2f56c0 100644 --- a/cinelerra-5.1/cinelerra/mwindow.h +++ b/cinelerra-5.1/cinelerra/mwindow.h @@ -142,7 +142,6 @@ public: void hide_gwindow(); int tile_windows(int window_config); char *get_cwindow_display(); -// void set_titles(int value); void set_screens(int value); int asset_to_edl(EDL *new_edl, Asset *new_asset, diff --git a/cinelerra-5.1/cinelerra/patchgui.C b/cinelerra-5.1/cinelerra/patchgui.C index 9ae8c4ef..9d527f11 100644 --- a/cinelerra-5.1/cinelerra/patchgui.C +++ b/cinelerra-5.1/cinelerra/patchgui.C @@ -96,59 +96,36 @@ int PatchGUI::reposition(int x, int y) int y1 = 0; - if(x != this->x || y != this->y) - { - this->x = x; - this->y = y; + if( x != this->x || y != this->y ) { + this->x = x; this->y = y; - if(title) - { -TRACE("PatchGUI::reposition 1\n"); + if( title ) title->reposition_window(title->get_x(), y1 + y, 0); -TRACE("PatchGUI::reposition 2\n"); - } + if( expand ) + expand->reposition_window(expand->get_x(), y1 + y); y1 += mwindow->theme->title_h; - if(play) - { -TRACE("PatchGUI::reposition 3\n"); + if( play ) { play->reposition_window(play->get_x(), y1 + y); x1 += play->get_w(); -TRACE("PatchGUI::reposition 4\n"); record->reposition_window(record->get_x(), y1 + y); x1 += record->get_w(); -TRACE("PatchGUI::reposition 5\n"); // automate->reposition_window(x1, y1 + y); // x1 += automate->get_w(); gang->reposition_window(gang->get_x(), y1 + y); x1 += gang->get_w(); -TRACE("PatchGUI::reposition 6\n"); draw->reposition_window(draw->get_x(), y1 + y); x1 += draw->get_w(); -TRACE("PatchGUI::reposition 7\n"); mute->reposition_window(mute->get_x(), y1 + y); x1 += mute->get_w(); -TRACE("PatchGUI::reposition 8\n"); - - if(expand) - { -TRACE("PatchGUI::reposition 9\n"); -// VFrame **expandpatch_data = mwindow->theme->get_image_set("expandpatch_data"); -// int x = patchbay->get_w() - 10 - expandpatch_data[0]->get_w(); - expand->reposition_window( - expand->get_x(), - y1 + y); -TRACE("PatchGUI::reposition 10\n"); - x1 += expand->get_w(); -TRACE("PatchGUI::reposition 11\n"); - } } y1 += mwindow->theme->play_h; } - else - { - y1 += mwindow->theme->title_h; - y1 += mwindow->theme->play_h; + else { + if( title ) + y1 += mwindow->theme->title_h; + if( play ) + y1 += mwindow->theme->play_h; } return y1; @@ -165,49 +142,45 @@ int PatchGUI::update(int x, int y) int x1 = 0; //printf("PatchGUI::update 10\n"); - if(title) - { - if(h - y1 < 0) - { - delete title; - title = 0; + int y2 = y1 + mwindow->theme->title_h; + if( title ) { + if( h < y2 ) { + delete title; title = 0; + delete expand; expand = 0; } - else - { + else { title->update(track->title); + expand->update(track->expand_view); } } - else - if(h - y1 >= 0) - { - patchbay->add_subwindow(title = new TitlePatch(mwindow, this, x1 + x, y1 + y)); + else if( h >= y2 ) { + VFrame **expandpatch_data = mwindow->theme->get_image_set("expandpatch_data"); + int x2 = patchbay->get_w() - expandpatch_data[0]->get_w() - 5; + patchbay->add_subwindow(title = new TitlePatch(mwindow, this, x1 + x, y1 + y, x2-x1-5)); + patchbay->add_subwindow(expand = new ExpandPatch(mwindow, this, x2, y1 + y)); } - y1 += mwindow->theme->title_h; - if(play) - { - if(h - y1 < mwindow->theme->play_h) - { + if( title ) + y1 = y2; + + y2 = y1 + mwindow->theme->play_h; + if( play ) { + if( h < y2 ) { delete play; play = 0; delete record; record = 0; delete gang; gang = 0; delete draw; draw = 0; delete mute; mute = 0; - delete expand; expand = 0; } - else - { + else { play->update(track->play); record->update(track->record); gang->update(track->gang); draw->update(track->draw); mute->update(mwindow->get_int_auto(this, AUTOMATION_MUTE)->value); - expand->update(track->expand_view); } } - else - if(h - y1 >= mwindow->theme->play_h) - { + else if( h >= y2 ) { patchbay->add_subwindow(play = new PlayPatch(mwindow, this, x1 + x, y1 + y)); //printf("PatchGUI::update %d %d\n", __LINE__, play->get_h()); x1 += play->get_w(); @@ -219,15 +192,9 @@ int PatchGUI::update(int x, int y) x1 += draw->get_w(); patchbay->add_subwindow(mute = new MutePatch(mwindow, this, x1 + x, y1 + y)); x1 += mute->get_w(); - - VFrame **expandpatch_data = mwindow->theme->get_image_set("expandpatch_data"); - patchbay->add_subwindow(expand = new ExpandPatch(mwindow, - this, - patchbay->get_w() - 10 - expandpatch_data[0]->get_w(), - y1 + y)); - x1 += expand->get_w(); } - y1 += mwindow->theme->play_h; + if( play ) + y1 = y2; //UNTRACE return y1; @@ -662,9 +629,8 @@ int ExpandPatch::button_release_event() } -TitlePatch::TitlePatch(MWindow *mwindow, PatchGUI *patch, int x, int y) - : BC_TextBox(x, y, patch->patchbay->get_w() - 10, 1, - patch->track->title, 1, MEDIUMFONT, 1) +TitlePatch::TitlePatch(MWindow *mwindow, PatchGUI *patch, int x, int y, int w) + : BC_TextBox(x, y, w, 1, patch->track->title, 1, MEDIUMFONT, 1) { this->mwindow = mwindow; this->patch = patch; diff --git a/cinelerra-5.1/cinelerra/patchgui.h b/cinelerra-5.1/cinelerra/patchgui.h index da415bb9..53ba9d20 100644 --- a/cinelerra-5.1/cinelerra/patchgui.h +++ b/cinelerra-5.1/cinelerra/patchgui.h @@ -113,7 +113,7 @@ public: class TitlePatch : public BC_TextBox { public: - TitlePatch(MWindow *mwindow, PatchGUI *patch, int x, int y); + TitlePatch(MWindow *mwindow, PatchGUI *patch, int x, int y, int w); int handle_event(); void update(const char *text); MWindow *mwindow; diff --git a/cinelerra-5.1/cinelerra/resourcepixmap.C b/cinelerra-5.1/cinelerra/resourcepixmap.C index 6f74c85d..cdc1e1b1 100644 --- a/cinelerra-5.1/cinelerra/resourcepixmap.C +++ b/cinelerra-5.1/cinelerra/resourcepixmap.C @@ -117,14 +117,9 @@ void ResourcePixmap::resize(int w, int h) void ResourcePixmap::draw_data(TrackCanvas *canvas, - Edit *edit, - int64_t edit_x, - int64_t edit_w, - int64_t pixmap_x, - int64_t pixmap_w, - int64_t pixmap_h, - int mode, - int indexes_only) + Edit *edit, int64_t edit_x, int64_t edit_w, + int64_t pixmap_x, int64_t pixmap_w, int64_t pixmap_h, + int mode, int indexes_only) { // Get new areas to fill in relative to pixmap // Area to redraw relative to pixmap @@ -135,9 +130,8 @@ void ResourcePixmap::draw_data(TrackCanvas *canvas, // if( mode == IGNORE_THREAD ) return; int y = 0; - if( mwindow->edl->session->show_titles ) + if( edit->track->show_titles() ) y += mwindow->theme->get_image("title_bg_data")->get_h(); - Track *track = edit->edits->track; // If want indexes only & index can't be drawn, don't do anything. @@ -374,6 +368,7 @@ void ResourcePixmap::draw_data(TrackCanvas *canvas, // Draw media which already exists + Track *track = edit->track; if( track->draw ) { switch( track->data_type ) { @@ -404,16 +399,6 @@ void ResourcePixmap::draw_data(TrackCanvas *canvas, break; } } - -// Draw title -SET_TRACE - if( mwindow->edl->session->show_titles ) - draw_title(canvas, - edit, - edit_x, - edit_w, - pixmap_x, - pixmap_w); SET_TRACE } @@ -531,7 +516,7 @@ void ResourcePixmap::draw_audio_source(TrackCanvas *canvas, Edit *edit, int x, i w++; Indexable *indexable = edit->get_source(); int center_pixel = mwindow->edl->local_session->zoom_track / 2; - if( mwindow->edl->session->show_titles ) + if( edit->track->show_titles() ) center_pixel += mwindow->theme->get_image("title_bg_data")->get_h(); int64_t scale_y = mwindow->edl->local_session->zoom_y; int y_max = center_pixel + scale_y / 2 - 1; @@ -693,11 +678,12 @@ void ResourcePixmap::draw_audio_source(TrackCanvas *canvas, Edit *edit, int x, i canvas->test_timer(); } -void ResourcePixmap::draw_wave(TrackCanvas *canvas, int x, double high, double low) +void ResourcePixmap::draw_wave(TrackCanvas *canvas, + int x, double high, double low) { int top_pixel = 0; if( mwindow->edl->session->show_titles ) - top_pixel = mwindow->theme->get_image("title_bg_data")->get_h(); + top_pixel += mwindow->theme->get_image("title_bg_data")->get_h(); int center_pixel = mwindow->edl->local_session->zoom_track / 2 + top_pixel; int bottom_pixel = top_pixel + mwindow->edl->local_session->zoom_track; int y1 = (int)(center_pixel - @@ -733,7 +719,7 @@ void ResourcePixmap::draw_video_resource(TrackCanvas *canvas, if( frame_w < picon_w ) frame_w = picon_w; // Current pixel relative to pixmap int y = 0; - if( mwindow->edl->session->show_titles ) + if( edit->track->show_titles() ) y += mwindow->theme->get_image("title_bg_data")->get_h(); // Frame in project touched by current pixel @@ -781,8 +767,8 @@ void ResourcePixmap::draw_subttl_resource(TrackCanvas *canvas, Edit *edit, int x SEdit *sedit = (SEdit *)edit; char *text = sedit->get_text(); if( !*text || w < 10 ) return; - int center_pixel = mwindow->edl->local_session->zoom_track / 2; - if( mwindow->edl->session->show_titles ) + int center_pixel = canvas->resource_h() / 2; + if( edit->track->show_titles() ) center_pixel += mwindow->theme->get_image("title_bg_data")->get_h(); int64_t scale_y = mwindow->edl->local_session->zoom_y; int x0 = edit_x; diff --git a/cinelerra-5.1/cinelerra/resourcepixmap.h b/cinelerra-5.1/cinelerra/resourcepixmap.h index 99e43f35..7d1394fd 100644 --- a/cinelerra-5.1/cinelerra/resourcepixmap.h +++ b/cinelerra-5.1/cinelerra/resourcepixmap.h @@ -34,56 +34,32 @@ class ResourcePixmap : public BC_Pixmap { public: - ResourcePixmap(MWindow *mwindow, - MWindowGUI *gui, - Edit *edit, - int pane_number, - int w, - int h); + ResourcePixmap(MWindow *mwindow, MWindowGUI *gui, Edit *edit, + int pane_number, int w, int h); ~ResourcePixmap(); void resize(int w, int h); void draw_data(TrackCanvas *canvas, - Edit *edit, - int64_t edit_x, - int64_t edit_w, - int64_t pixmap_x, - int64_t pixmap_w, - int64_t pixmap_h, - int mode, - int indexes_only); + Edit *edit, int64_t edit_x, int64_t edit_w, + int64_t pixmap_x, int64_t pixmap_w, int64_t pixmap_h, + int mode, int indexes_only); void draw_audio_resource(TrackCanvas *canvas, - Edit *edit, - int x, - int w); + Edit *edit, int x, int w); void draw_video_resource(TrackCanvas *canvas, - Edit *edit, - int64_t edit_x, - int64_t edit_w, - int64_t pixmap_x, - int64_t pixmap_w, - int refresh_x, - int refresh_w, + Edit *edit, int64_t edit_x, int64_t edit_w, + int64_t pixmap_x, int64_t pixmap_w, + int refresh_x, int refresh_w, int mode); void draw_audio_source(TrackCanvas *canvas, - Edit *edit, - int x, - int w); + Edit *edit, int x, int w); void draw_subttl_resource(TrackCanvas *canvas, - Edit *edit, - int x, - int w); + Edit *edit, int x, int w); // Called by ResourceThread to update pixmap void draw_wave(TrackCanvas *canvas, - int x, - double high, - double low); + int x, double high, double low); void draw_title(TrackCanvas *canvas, - Edit *edit, - int64_t edit_x, - int64_t edit_w, - int64_t pixmap_x, - int64_t pixmap_w); + Edit *edit, int64_t edit_x, int64_t edit_w, + int64_t pixmap_x, int64_t pixmap_w); void reset(); // Change to hourglass if timer expired void test_timer(); diff --git a/cinelerra-5.1/cinelerra/track.C b/cinelerra-5.1/cinelerra/track.C index b13e9e9d..84e875d7 100644 --- a/cinelerra-5.1/cinelerra/track.C +++ b/cinelerra-5.1/cinelerra/track.C @@ -218,16 +218,13 @@ printf("Track::operator= 1\n"); int Track::vertical_span(Theme *theme) { int result = 0; - if(expand_view) - result = edl->local_session->zoom_track + - plugin_set.total * - theme->get_image("plugin_bg_data")->get_h(); - else - result = edl->local_session->zoom_track; - - if(edl->session->show_titles) + if( show_titles() ) result += theme->get_image("title_bg_data")->get_h(); - + if( show_assets() ) + result += edl->local_session->zoom_track; + if( expand_view ) + result += plugin_set.total * theme->get_image("plugin_bg_data")->get_h(); + result = MAX(result, theme->title_h); return result; } @@ -284,7 +281,20 @@ int Track::has_speed() return 0; } +int Track::show_assets() +{ + return expand_view || edl->session->show_assets ? 1 : 0; +} + +int Track::show_titles() +{ + return expand_view || edl->session->show_titles ? 1 : 0; +} +int Track::show_transitions() +{ + return expand_view || edl->session->auto_conf->transitions ? 1 : 0; +} void Track::get_source_dimensions(double position, int &w, int &h) { diff --git a/cinelerra-5.1/cinelerra/track.h b/cinelerra-5.1/cinelerra/track.h index baa4218b..bb1081e7 100644 --- a/cinelerra-5.1/cinelerra/track.h +++ b/cinelerra-5.1/cinelerra/track.h @@ -276,6 +276,9 @@ public: int feather_edits(int64_t start, int64_t end, int64_t units); int64_t get_feather(int64_t selectionstart, int64_t selectionend); + int show_assets(); + int show_titles(); + int show_transitions(); // Absolute number of this track int number_of(); diff --git a/cinelerra-5.1/cinelerra/trackcanvas.C b/cinelerra-5.1/cinelerra/trackcanvas.C index 2edb89be..47edc557 100644 --- a/cinelerra-5.1/cinelerra/trackcanvas.C +++ b/cinelerra-5.1/cinelerra/trackcanvas.C @@ -708,9 +708,6 @@ void TrackCanvas::draw_resources(int mode, if(debug) PRINT_TRACE - if(!mwindow->edl->session->show_assets) return; - - // can't stop thread here, because this is called for every pane // if(mode != IGNORE_THREAD && !indexes_only) // gui->resource_thread->stop_draw(!indexes_only); @@ -809,15 +806,21 @@ void TrackCanvas::draw_resources(int mode, if(pixmap_w > pixmap->pixmap_w || pixmap_h > pixmap->pixmap_h) pixmap->resize(pixmap_w, pixmap_h); - pixmap->draw_data(this, - edit, - edit_x, - edit_w, - pixmap_x, - pixmap_w, - pixmap_h, - mode, - indexes_only); +// Draw data + if( current->show_assets() ) + pixmap->draw_data(this, + edit, edit_x, edit_w, + pixmap_x, pixmap_w, pixmap_h, + mode, indexes_only); + else { + set_bg_color(BLACK); + clear_box(0,0, pixmap_w,pixmap_h, pixmap); + } +// Draw title + if( current->show_titles() ) + pixmap->draw_title(this, + edit, edit_x, edit_w, + pixmap_x, pixmap_w); // Resize it if it's smaller if(pixmap_w < pixmap->pixmap_w || pixmap_h < pixmap->pixmap_h) @@ -958,27 +961,22 @@ void TrackCanvas::get_pixmap_size(Edit *edit, // } pixmap_h = mwindow->edl->local_session->zoom_track; - if(mwindow->edl->session->show_titles) pixmap_h += mwindow->theme->get_image("title_bg_data")->get_h(); + Track *track = edit->edits->track; + if( track->show_titles() ) + pixmap_h += mwindow->theme->get_image("title_bg_data")->get_h(); //printf("get_pixmap_size %d %d %d %d\n", edit_x, edit_w, pixmap_x, pixmap_w); } void TrackCanvas::edit_dimensions(Edit *edit, - int64_t &x, - int64_t &y, - int64_t &w, - int64_t &h) + int64_t &x, int64_t &y, int64_t &w, int64_t &h) { -// w = Units::round(edit->track->from_units(edit->length) * -// mwindow->edl->session->sample_rate / -// mwindow->edl->local_session->zoom_sample); - - h = resource_h(); - x = Units::round(edit->track->from_units(edit->startproject) * mwindow->edl->session->sample_rate / mwindow->edl->local_session->zoom_sample - mwindow->edl->local_session->view_start[pane->number]); + y = edit->edits->track->y_pixel - mwindow->edl->local_session->track_start[pane->number]; + // Method for calculating w so when edits are together we never get off by one error due to rounding int64_t x_next = Units::round(edit->track->from_units(edit->startproject + edit->length) * mwindow->edl->session->sample_rate / @@ -986,10 +984,12 @@ void TrackCanvas::edit_dimensions(Edit *edit, mwindow->edl->local_session->view_start[pane->number]); w = x_next - x; - y = edit->edits->track->y_pixel - mwindow->edl->local_session->track_start[pane->number]; - - if(mwindow->edl->session->show_titles) - h += mwindow->theme->get_image("title_bg_data")->get_h(); + int edit_h = 0; + if( edit->track->show_titles() ) + edit_h += mwindow->theme->get_image("title_bg_data")->get_h(); + if( edit->track->show_assets() ) + edit_h += resource_h(); + h = edit_h; } void TrackCanvas::track_dimensions(Track *track, int64_t &x, int64_t &y, int64_t &w, int64_t &h) @@ -1239,13 +1239,14 @@ void TrackCanvas::plugin_dimensions(Plugin *plugin, int64_t &x, int64_t &y, int6 w = Units::round(plugin->track->from_units(plugin->length) * mwindow->edl->session->sample_rate / mwindow->edl->local_session->zoom_sample); - y = plugin->track->y_pixel - - mwindow->edl->local_session->track_start[pane->number] + - mwindow->edl->local_session->zoom_track + - plugin->plugin_set->get_number() * - mwindow->theme->get_image("plugin_bg_data")->get_h(); - if(mwindow->edl->session->show_titles) + y = plugin->track->y_pixel + - mwindow->edl->local_session->track_start[pane->number]; + if( plugin->track->show_titles() ) y += mwindow->theme->get_image("title_bg_data")->get_h(); + if( plugin->track->show_assets() ) + y += resource_h(); + y += plugin->plugin_set->get_number() * + mwindow->theme->get_image("plugin_bg_data")->get_h(); h = mwindow->theme->get_image("plugin_bg_data")->get_h(); } @@ -1378,42 +1379,30 @@ void TrackCanvas::get_handle_coords(Edit *edit, int64_t &x, int64_t &y, int64_t edit_dimensions(edit, x, y, w, h); - if(mwindow->edl->session->show_titles) - { + if( edit->track->show_titles() ) y += mwindow->theme->get_image("title_bg_data")->get_h(); - } - else - { - y = 0; - } if(side == EDIT_OUT) - { x += w - handle_w; - } h = handle_h; w = handle_w; } -void TrackCanvas::get_transition_coords(int64_t &x, int64_t &y, int64_t &w, int64_t &h) +void TrackCanvas::get_transition_coords(Edit *edit, + int64_t &x, int64_t &y, int64_t &w, int64_t &h) { -//printf("TrackCanvas::get_transition_coords 1\n"); -// int transition_w = mwindow->theme->transitionhandle_data[0]->get_w(); -// int transition_h = mwindow->theme->transitionhandle_data[0]->get_h(); - int transition_w = 30; - int transition_h = 30; -//printf("TrackCanvas::get_transition_coords 1\n"); - - if(mwindow->edl->session->show_titles) + int transition_w = 30, transition_h = 30; + + if( edit->track->show_titles() ) y += mwindow->theme->get_image("title_bg_data")->get_h(); -//printf("TrackCanvas::get_transition_coords 2\n"); + if( edit->track->show_assets() ) + y += resource_h() / 2; - y += (h - mwindow->theme->get_image("title_bg_data")->get_h()) / 2 - transition_h / 2; x -= transition_w / 2; - - h = transition_h; + y -= transition_h / 2; w = transition_w; + h = transition_h; } void TrackCanvas::draw_highlighting() @@ -1428,21 +1417,18 @@ void TrackCanvas::draw_highlighting() //printf("TrackCanvas::draw_highlighting 1 %p %p\n", // mwindow->session->track_highlighted, mwindow->session->edit_highlighted); if(mwindow->session->edit_highlighted) { -//printf("TrackCanvas::draw_highlighting 2\n"); if((mwindow->session->current_operation == DRAG_ATRANSITION && mwindow->session->track_highlighted->data_type == TRACK_AUDIO) || (mwindow->session->current_operation == DRAG_VTRANSITION && mwindow->session->track_highlighted->data_type == TRACK_VIDEO)) { -//printf("TrackCanvas::draw_highlighting 2\n"); - edit_dimensions(mwindow->session->edit_highlighted, x, y, w, h); -//printf("TrackCanvas::draw_highlighting 2\n"); - + edit_dimensions(mwindow->session->edit_highlighted, + x, y, w, h); if(MWindowGUI::visible(x, x + w, 0, get_w()) && MWindowGUI::visible(y, y + h, 0, get_h())) { draw_box = 1; - get_transition_coords(x, y, w, h); + get_transition_coords(mwindow->session->edit_highlighted, + x, y, w, h); } -//printf("TrackCanvas::draw_highlighting 3\n"); } } break; @@ -1610,8 +1596,6 @@ void TrackCanvas::draw_plugins() int current_show = 0; int current_preset = 0; -// if(!mwindow->edl->session->show_assets) goto done; - for(int i = 0; i < plugin_on_toggles.total; i++) plugin_on_toggles.values[i]->in_use = 0; for(int i = 0; i < plugin_show_toggles.total; i++) @@ -1787,14 +1771,19 @@ void TrackCanvas::draw_hard_edges() { int64_t x, y, w, h; -// if(!mwindow->edl->session->show_assets) return; - for(Track *track = mwindow->edl->tracks->first; track; track = track->next) { for(Edit *edit = track->edits->first; edit; edit = edit->next) { if( !edit->hard_left && !edit->hard_right ) continue; edit_dimensions(edit, x, y, w, h); set_color(GREEN); - set_opaque(); int y1 = y+h-1; + set_opaque(); + int y1 = y; + if( track->show_titles() ) + y1 += mwindow->theme->get_image("title_bg_data")->get_h(); + if( track->show_assets() ) + y1 += resource_h(); + if( y1 == y ) + y1 += mwindow->theme->title_h; if( edit->hard_left ) { ArrayList xpt, ypt; xpt.append(x); ypt.append(y1); @@ -1843,16 +1832,16 @@ void TrackCanvas::draw_transitions() { int64_t x, y, w, h; -// if(!mwindow->edl->session->show_assets) return; - for(Track *track = mwindow->edl->tracks->first; track; track = track->next) { + if( !track->show_transitions() ) continue; + for(Edit *edit = track->edits->first; edit; edit = edit->next) { if(!edit->transition) continue; edit_dimensions(edit, x, y, w, h); int strip_x = x, strip_y = y; - if(mwindow->edl->session->show_titles) + if( track->show_titles() ) strip_y += mwindow->theme->get_image("title_bg_data")->get_h(); - get_transition_coords(x, y, w, h); + get_transition_coords(edit, x, y, w, h); int strip_w = Units::round(edit->track->from_units(edit->transition->length) * mwindow->edl->session->sample_rate / mwindow->edl->local_session->zoom_sample); if( MWindowGUI::visible(x, x + w, 0, get_w()) && @@ -2127,9 +2116,7 @@ int TrackCanvas::do_keyframes(int cursor_x, } } - if(!result && - session->auto_conf->plugins /* && - mwindow->edl->session->show_assets */) { + if(!result && session->auto_conf->plugins) { Plugin *plugin; KeyFrame *keyframe; result = do_plugin_autos(track, cursor_x, cursor_y, @@ -2875,14 +2862,13 @@ void TrackCanvas::calculate_viewport(Track *track, mwindow->edl->local_session->zoom_sample / mwindow->edl->session->sample_rate; unit_end = track->to_doubleunits(view_end); - yscale = mwindow->edl->local_session->zoom_track; -//printf("TrackCanvas::calculate_viewport yscale=%.0f\n", yscale); - center_pixel = (int)(track->y_pixel - - mwindow->edl->local_session->track_start[pane->number] + - yscale / 2) + - (mwindow->edl->session->show_titles ? - mwindow->theme->get_image("title_bg_data")->get_h() : - 0); + yscale = resource_h(); + center_pixel = track->y_pixel + - mwindow->edl->local_session->track_start[pane->number]; + if( track->show_assets() ) + center_pixel += yscale / 2; + if( track->show_titles() ) + center_pixel += mwindow->theme->get_image("title_bg_data")->get_h(); zoom_sample = mwindow->edl->local_session->zoom_sample; zoom_units = track->to_doubleunits(zoom_sample / mwindow->edl->session->sample_rate); @@ -3375,11 +3361,13 @@ int TrackCanvas::do_plugin_autos(Track *track, int cursor_x, int cursor_y, for(int i = 0; i < track->plugin_set.total && !result; i++) { PluginSet *plugin_set = track->plugin_set.values[i]; - int center_pixel = (int)(track->y_pixel - - mwindow->edl->local_session->track_start[pane->number] + - mwindow->edl->local_session->zoom_track + - (i + 0.5) * mwindow->theme->get_image("plugin_bg_data")->get_h() + - (mwindow->edl->session->show_titles ? mwindow->theme->get_image("title_bg_data")->get_h() : 0)); + int center_pixel = track->y_pixel - + mwindow->edl->local_session->track_start[pane->number]; + if( track->show_titles() ) + center_pixel += mwindow->theme->get_image("title_bg_data")->get_h(); + if( track->show_assets() ) + center_pixel += resource_h(); + center_pixel += (i + 0.5) * mwindow->theme->get_image("plugin_bg_data")->get_h(); for(Plugin *plugin = (Plugin*)plugin_set->first; plugin && !result; @@ -3491,7 +3479,7 @@ void TrackCanvas::draw_overlays() draw_inout_points(); // Transitions - if(mwindow->edl->session->auto_conf->transitions) draw_transitions(); + draw_transitions(); // Plugins draw_plugins(); @@ -4373,9 +4361,9 @@ int TrackCanvas::do_edit_handles(int cursor_x, int cursor_y, int button_press, int handle_result = -1; int result = 0; - if( !mwindow->edl->session->show_assets ) return 0; - for( Track *track=mwindow->edl->tracks->first; track && !result; track=track->next) { + if( !track->show_assets() ) continue; + for( Edit *edit=track->edits->first; edit && !result; edit=edit->next ) { int64_t edit_x, edit_y, edit_w, edit_h; edit_dimensions(edit, edit_x, edit_y, edit_w, edit_h); @@ -4494,8 +4482,6 @@ int TrackCanvas::do_plugin_handles(int cursor_x, int handle_result = 0; int result = 0; -// if(!mwindow->edl->session->show_assets) return 0; - for(Track *track = mwindow->edl->tracks->first; track && !result; track = track->next) { @@ -4562,8 +4548,6 @@ int TrackCanvas::do_tracks(int cursor_x, int cursor_y, int button_press) { int result = 0; -// if(!mwindow->edl->session->show_assets) return 0; - for(Track *track = mwindow->edl->tracks->first; track && !result; track = track->next) { @@ -4588,9 +4572,8 @@ int TrackCanvas::do_edits(int cursor_x, int cursor_y, int button_press, int drag { int result = 0; - if(!mwindow->edl->session->show_assets) return 0; - for(Track *track = mwindow->edl->tracks->first; track && !result; track = track->next) { + if( !track->show_assets() ) continue; for(Edit *edit = track->edits->first; edit && !result; edit = edit->next) { int64_t edit_x, edit_y, edit_w, edit_h; @@ -4677,10 +4660,6 @@ int TrackCanvas::do_plugins(int cursor_x, int cursor_y, int drag_start, int64_t x, y, w, h; Track *track = 0; - -// if(!mwindow->edl->session->show_assets) return 0; - - for(track = mwindow->edl->tracks->first; track && !done; track = track->next) { if(!track->expand_view) continue; @@ -4789,15 +4768,14 @@ int TrackCanvas::do_transitions(int cursor_x, int cursor_y, int result = 0; int64_t x, y, w, h; - if(/* !mwindow->edl->session->show_assets || */ - !mwindow->edl->session->auto_conf->transitions) return 0; for( Track *track = mwindow->edl->tracks->first; track && !result; track = track->next ) { + if( !track->show_transitions() ) continue; for( Edit *edit = track->edits->first; edit; edit = edit->next ) { if( edit->transition ) { edit_dimensions(edit, x, y, w, h); - get_transition_coords(x, y, w, h); + get_transition_coords(edit, x, y, w, h); if( MWindowGUI::visible(x, x + w, 0, get_w()) && MWindowGUI::visible(y, y + h, 0, get_h()) ) { diff --git a/cinelerra-5.1/cinelerra/trackcanvas.h b/cinelerra-5.1/cinelerra/trackcanvas.h index 2bda2ea9..a5d007e5 100644 --- a/cinelerra-5.1/cinelerra/trackcanvas.h +++ b/cinelerra-5.1/cinelerra/trackcanvas.h @@ -84,7 +84,8 @@ public: void draw_overlays(); void update_handles(); // Convert edit coords to transition coords - void get_transition_coords(int64_t &x, int64_t &y, int64_t &w, int64_t &h); + void get_transition_coords(Edit *edit, + int64_t &x, int64_t &y, int64_t &w, int64_t &h); void get_handle_coords(Edit *edit, int64_t &x, int64_t &y, diff --git a/cinelerra-5.1/cinelerra/transitionhandles.C b/cinelerra-5.1/cinelerra/transitionhandles.C index 625dc25d..00a5835b 100644 --- a/cinelerra-5.1/cinelerra/transitionhandles.C +++ b/cinelerra-5.1/cinelerra/transitionhandles.C @@ -82,7 +82,7 @@ void TransitionHandles::update() { int64_t edit_x, edit_y, edit_w, edit_h; trackcanvas->edit_dimensions(edit, edit_x, edit_y, edit_w, edit_h); - trackcanvas->get_transition_coords(edit_x, edit_y, edit_w, edit_h); + trackcanvas->get_transition_coords(edit, edit_x, edit_y, edit_w, edit_h); if(visible(edit_x, edit_w, edit_y, edit_h)) { diff --git a/cinelerra-5.1/cinelerra/viewmenu.C b/cinelerra-5.1/cinelerra/viewmenu.C index 2478136e..206faf43 100644 --- a/cinelerra-5.1/cinelerra/viewmenu.C +++ b/cinelerra-5.1/cinelerra/viewmenu.C @@ -43,13 +43,7 @@ int ShowAssets::handle_event() { set_checked(get_checked() ^ 1); mwindow->edl->session->show_assets = get_checked(); - mwindow->gui->update(1, - 1, - 0, - 0, - 1, - 0, - 0); + mwindow->gui->update(1, 1, 0, 0, 1, 0, 0); mwindow->gui->unlock_window(); mwindow->gwindow->gui->update_toggles(1); mwindow->gui->lock_window("ShowAssets::handle_event"); @@ -70,13 +64,7 @@ int ShowTitles::handle_event() { set_checked(get_checked() ^ 1); mwindow->edl->session->show_titles = get_checked(); - mwindow->gui->update(1, - 1, - 0, - 0, - 1, - 0, - 0); + mwindow->gui->update(1, 1, 0, 0, 1, 0, 0); mwindow->gui->unlock_window(); mwindow->gwindow->gui->update_toggles(1); mwindow->gui->lock_window("ShowTitles::handle_event"); @@ -111,7 +99,7 @@ ShowAutomation::ShowAutomation(MWindow *mwindow, const char *text, const char *hotkey, int subscript) - : BC_MenuItem(text, hotkey, hotkey[0]) + : BC_MenuItem(text, hotkey, hotkey[strlen(hotkey)-1]) { this->mwindow = mwindow; this->subscript = subscript; diff --git a/cinelerra-5.1/cinelerra/vpatchgui.C b/cinelerra-5.1/cinelerra/vpatchgui.C index 8b9c0b47..2d01e014 100644 --- a/cinelerra-5.1/cinelerra/vpatchgui.C +++ b/cinelerra-5.1/cinelerra/vpatchgui.C @@ -89,10 +89,10 @@ int VPatchGUI::update(int x, int y) int x1 = 0; int y1 = PatchGUI::update(x, y); + int y2 = y1 + mwindow->theme->fade_h; if( fade ) { - if( h - y1 < mwindow->theme->fade_h ) { - delete fade; - fade = 0; + if( h < y2 ) { + delete fade; fade = 0; } else { fade->update(fade->get_w(), mwindow->get_float_auto(this, AUTOMATION_FADE)->get_value(), @@ -100,15 +100,16 @@ int VPatchGUI::update(int x, int y) mwindow->edl->local_session->automation_maxs[AUTOGROUPTYPE_VIDEO_FADE]); } } - else - if( h - y1 >= mwindow->theme->fade_h ) { + else if( h >= y2 ) { patchbay->add_subwindow(fade = new VFadePatch(mwindow, this, x1+x, y1+y, patchbay->get_w() - 10)); } - y1 += mwindow->theme->fade_h; + if( fade ) + y1 = y2; + y2 = y1 + mwindow->theme->mode_h; if( mode ) { - if( h - y1 < mwindow->theme->mode_h ) { + if( h < y2 ) { delete mix; mix = 0; delete mode; mode = 0; delete nudge; nudge = 0; @@ -122,8 +123,7 @@ int VPatchGUI::update(int x, int y) nudge->update(); } } - else - if( h - y1 >= mwindow->theme->mode_h ) { + else if( h >= y2 ) { patchbay->add_subwindow(mix = new VMixPatch(mwindow, this, x1+x, y1+y+5)); x1 += mix->get_w(); patchbay->add_subwindow(mode = new VModePatch(mwindow, this, x1+x, y1+y)); @@ -132,13 +132,13 @@ int VPatchGUI::update(int x, int y) patchbay->add_subwindow(nudge = new NudgePatch(mwindow, this, x1+x, y1+y, patchbay->get_w() - x1-x - 10)); } + if( mode ) + y1 = y2; - y1 += mwindow->theme->mode_h; return y1; } - void VPatchGUI::synchronize_fade(float value_change) { if( fade && !change_source ) { diff --git a/cinelerra-5.1/cinelerra/vtrack.C b/cinelerra-5.1/cinelerra/vtrack.C index 53a6550b..c8a34e45 100644 --- a/cinelerra-5.1/cinelerra/vtrack.C +++ b/cinelerra-5.1/cinelerra/vtrack.C @@ -85,11 +85,9 @@ int VTrack::copy_settings(Track *track) int VTrack::vertical_span(Theme *theme) { int track_h = Track::vertical_span(theme); - int patch_h = 0; - if(expand_view) - { - patch_h += theme->title_h + theme->play_h + theme->fade_h + theme->mode_h; - } + int patch_h = theme->title_h; + if( expand_view ) + patch_h += theme->play_h + theme->fade_h + theme->mode_h; return MAX(track_h, patch_h); } -- 2.26.2