X-Git-Url: https://git.cinelerra-gg.org/git/?p=goodguy%2Fcinelerra.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fmixersalign.C;h=b5fe9227402cf6239206375f2942441b40865614;hp=1e91b6ca5e6cfdf1563809add3b13a2c32875d0d;hb=5ec378f09aeeb646705fdb8035b39a186374fba0;hpb=a0ed17a5d6ecf2b010d977bc1f9b7226f24c20f6 diff --git a/cinelerra-5.1/cinelerra/mixersalign.C b/cinelerra-5.1/cinelerra/mixersalign.C index 1e91b6ca..b5fe9227 100644 --- a/cinelerra-5.1/cinelerra/mixersalign.C +++ b/cinelerra-5.1/cinelerra/mixersalign.C @@ -85,7 +85,7 @@ MixersAlignMixerList::MixersAlignMixerList(MixersAlignWindow *gui, this->dialog = dialog; this->gui = gui; for( int i=MIX_SZ; --i>=0; ) { - col_widths[i] = mix_widths[i]; + col_widths[i] = xS(mix_widths[i]); col_titles[i] = _(mix_titles[i]); } } @@ -200,7 +200,7 @@ MixersAlignMTrackList::MixersAlignMTrackList(MixersAlignWindow *gui, this->dialog = dialog; this->gui = gui; for( int i=MTK_SZ; --i>=0; ) { - col_widths[i] = mtk_widths[i]; + col_widths[i] = xS(mtk_widths[i]); col_titles[i] = _(mtk_titles[i]); } } @@ -273,7 +273,7 @@ MixersAlignATrackList::MixersAlignATrackList(MixersAlignWindow *gui, this->dialog = dialog; this->gui = gui; for( int i=ATK_SZ; --i>=0; ) { - col_widths[i] = atk_widths[i]; + col_widths[i] = xS(atk_widths[i]); col_titles[i] = _(atk_titles[i]); } } @@ -479,7 +479,7 @@ int MixersAlignUndoItem::handle_event() MixersAlignUndo::MixersAlignUndo(MixersAlignWindow *gui, MixersAlign *dialog, int x, int y) - : BC_PopupMenu(x, y, 100, _("Undo")) + : BC_PopupMenu(x, y, xS(100), _("Undo")) { this->gui = gui; this->dialog = dialog; @@ -505,7 +505,7 @@ void MixersAlignUndo::add_undo_item(int no) MixersAlignCheckPoint::MixersAlignCheckPoint(MixersAlignWindow *gui, MixersAlign *dialog, int x, int y) - : BC_GenericButton(x, y, 100, _("CheckPoint")) + : BC_GenericButton(x, y, xS(100), _("CheckPoint")) { this->gui = gui; this->dialog = dialog; @@ -518,7 +518,7 @@ int MixersAlignCheckPoint::handle_event() } MixersAlignWindow::MixersAlignWindow(MixersAlign *dialog, int x, int y) - : BC_Window(_("Align Mixers"), x, y, 880, 380, 880, 380, 1) + : BC_Window(_("Align Mixers"), x, y, xS(880), yS(380), xS(880), yS(380), 1) { this->dialog = dialog; } @@ -528,7 +528,9 @@ MixersAlignWindow::~MixersAlignWindow() void MixersAlignWindow::create_objects() { - int x = 10, y = 10, w4 = (get_w()-x-10)/4, lw = w4 + 20; + int xs10 = xS(10), xs20 = xS(20); + int ys10 = yS(10), ys20 = yS(20); + int x = xs10, y = ys10, w4 = (get_w()-x-xs10)/4, lw = w4 + xs20; int x1 = x, x2 = x1 + lw , x3 = x2 + lw, x4 = get_w()-x; mixer_title = new BC_Title(x1,y, _("Mixers:"), MEDIUMFONT, YELLOW); add_subwindow(mixer_title); @@ -536,25 +538,25 @@ void MixersAlignWindow::create_objects() add_subwindow(mtrack_title); atrack_title = new BC_Title(x3,y, _("Audio Tracks:"), MEDIUMFONT, YELLOW); add_subwindow(atrack_title); - y += mixer_title->get_h() + 10; - int y1 = y, y2 = get_h() - BC_OKButton::calculate_h() - 32; + y += mixer_title->get_h() + ys10; + int y1 = y, y2 = get_h() - BC_OKButton::calculate_h() - yS(32); int lh = y2 - y1; - mixer_list = new MixersAlignMixerList(this, dialog, x1, y, x2-x1-20, lh); + mixer_list = new MixersAlignMixerList(this, dialog, x1, y, x2-x1-xs20, lh); add_subwindow(mixer_list); - mtrack_list = new MixersAlignMTrackList(this, dialog, x2, y, x3-x2-20, lh); + mtrack_list = new MixersAlignMTrackList(this, dialog, x2, y, x3-x2-xs20, lh); add_subwindow(mtrack_list); - atrack_list = new MixersAlignATrackList(this, dialog, x3, y, x4-x3-20, lh); + atrack_list = new MixersAlignATrackList(this, dialog, x3, y, x4-x3-xs20, lh); add_subwindow(atrack_list); - int xr = x2-10 - MixersAlignReset::calculate_width(this); - y1 = y2+20; + int xr = x2-xs10 - MixersAlignReset::calculate_width(this); + y1 = y2+ys20; add_subwindow(reset = new MixersAlignReset(this, dialog, xr, y1)); - add_subwindow(match = new MixersAlignMatch(this, dialog, x2+10, y1)); - int xa = x3-10 - MixersAlignNudgeTracks::calculate_width(this); + add_subwindow(match = new MixersAlignMatch(this, dialog, x2+xs10, y1)); + int xa = x3-xs10 - MixersAlignNudgeTracks::calculate_width(this); add_subwindow(nudge_tracks = new MixersAlignNudgeTracks(this, dialog, xa, y1)); - y2 = y1 + nudge_tracks->get_h() + 10; + y2 = y1 + nudge_tracks->get_h() + ys10; add_subwindow(match_all = new MixersAlignMatchAll(this, dialog, xr, y2)); add_subwindow(nudge_selected = new MixersAlignNudgeSelected(this, dialog, xa, y2)); - int xu = x3+10; + int xu = x3+xs10; add_subwindow(check_point = new MixersAlignCheckPoint(this, dialog, xu, y1)); add_subwindow(undo = new MixersAlignUndo(this, dialog, xu, y2)); undo->create_objects(); @@ -565,27 +567,29 @@ void MixersAlignWindow::create_objects() int MixersAlignWindow::resize_event(int w, int h) { - int x = 10, y = 10, w4 = (w-x-10)/4, lw = w4 + 20; + int xs10 = xS(10), xs20 = xS(20); + int ys10 = yS(10), ys20 = yS(20); + int x = xs10, y = ys10, w4 = (w-x-xs10)/4, lw = w4 + xs20; int x1 = x, x2 = x1 + lw , x3 = x2 + lw, x4 = w-x; mixer_title->reposition_window(x1, y); mtrack_title->reposition_window(x2, y); atrack_title->reposition_window(x3, y); - y += mixer_title->get_h() + 10; - int y1 = y, y2 = h - BC_OKButton::calculate_h() - 32; + y += mixer_title->get_h() + ys10; + int y1 = y, y2 = h - BC_OKButton::calculate_h() - yS(32); int lh = y2 - y1; - mixer_list->reposition_window(x1, y, x2-x1-20, lh); - mtrack_list->reposition_window(x2, y, x3-x2-20, lh); - atrack_list->reposition_window(x3, y, x4-x3-20, lh); - int xr = x2-10 - MixersAlignReset::calculate_width(this); - y1 = y2+20; + mixer_list->reposition_window(x1, y, x2-x1-xs20, lh); + mtrack_list->reposition_window(x2, y, x3-x2-xs20, lh); + atrack_list->reposition_window(x3, y, x4-x3-xs20, lh); + int xr = x2-xs10 - MixersAlignReset::calculate_width(this); + y1 = y2+ys20; reset->reposition_window(xr, y1); - match->reposition_window(x2+10, y1); - int xa = x3-10 - MixersAlignNudgeTracks::calculate_width(this); + match->reposition_window(x2+xs10, y1); + int xa = x3-xs10 - MixersAlignNudgeTracks::calculate_width(this); nudge_tracks->reposition_window(xa, y1); - y2 = y1 + nudge_tracks->get_h() + 10; + y2 = y1 + nudge_tracks->get_h() + ys10; match_all->reposition_window(xr, y2); nudge_selected->reposition_window(xa, y2); - int xu = x3+10; + int xu = x3+xs10; check_point->reposition_window(xu, y1); undo->reposition_window(xu, y2); return 0; @@ -685,6 +689,7 @@ BC_Window *MixersAlign::new_gui() // shift armed mixer tracks by nudge void MixersAlign::nudge_tracks() { + mwindow->gui->lock_window("MixersAlign::apply_tracks"); int idx = ma_gui->mtrack_list->get_selection_number(0, 0); int midx = mmixer_of(idx); EDL *edl = mwindow->edl; @@ -716,7 +721,6 @@ void MixersAlign::nudge_tracks() } edl->optimize(); - mwindow->gui->lock_window("MixersAlign::apply_tracks"); mwindow->update_gui(1); mwindow->gui->unlock_window(); clear_mixer_nudge(); @@ -725,6 +729,7 @@ void MixersAlign::nudge_tracks() // move selected mixer edits by nudge void MixersAlign::nudge_selected() { + mwindow->gui->lock_window("MixersAlign::apply_selected"); int idx = ma_gui->mtrack_list->get_selection_number(0, 0); int midx = mmixer_of(idx); EDL *edl = mwindow->edl; @@ -778,7 +783,6 @@ void MixersAlign::nudge_selected() track->record = track_arms[i++]; edl->optimize(); - mwindow->gui->lock_window("MixersAlign::apply_selected"); mwindow->update_gui(1); mwindow->gui->unlock_window(); clear_mixer_nudge(); @@ -798,11 +802,13 @@ void MixersAlign::clear_mixer_nudge() void MixersAlign::check_point() { + mwindow->gui->lock_window("MixersAlign::check_point"); ma_gui->undo->add_undo_item(undo_edls.size()); EDL *undo_edl = new EDL(); undo_edl->create_objects(); undo_edl->copy_all(mwindow->edl); undo_edls.append(undo_edl); + mwindow->gui->unlock_window(); } @@ -856,22 +862,28 @@ void MixersAlign::handle_done_event(int result) thread->join(); } if( !result ) { + mwindow->gui->lock_window("MixersAlign::handle_done_event"); EDL *edl = mwindow->edl; mwindow->edl = undo_edls[0]; mwindow->undo_before(); mwindow->edl = edl; mwindow->undo_after(_("align mixers"), LOAD_ALL); + mwindow->gui->unlock_window(); } } void MixersAlign::handle_close_event(int result) { ma_gui = 0; + mixers.clear(); + mtracks.clear(); + atracks.clear(); + undo_edls.clear(); } void MixersAlign::load_mixers() { - mixers.remove_all_objects(); + mixers.clear(); Mixers &edl_mixers = mwindow->edl->mixers; for( int i=0; iedl->tracks->first; for( int no=0; track; ++no, track=track->next ) { if( track->data_type != TRACK_AUDIO ) continue; @@ -889,7 +901,7 @@ void MixersAlign::load_mtracks() void MixersAlign::load_atracks() { - atracks.remove_all_objects(); + atracks.clear(); Track *track=mwindow->edl->tracks->first; for( int no=0; track; ++no, track=track->next ) { if( track->data_type != TRACK_AUDIO ) continue; @@ -986,9 +998,9 @@ void MixersAlign::apply_undo(int no) failed = -1; thread->join(); } + mwindow->gui->lock_window("MixersAlignUndo::handle_event"); EDL *undo_edl = undo_edls[no]; mwindow->edl->copy_all(undo_edl); - mwindow->gui->lock_window("MixersAlignUndo::handle_event"); mwindow->update_gui(1); mwindow->gui->unlock_window(); ma_gui->reset->handle_event(); @@ -1224,8 +1236,8 @@ void MixersAlignTargetClient::process_package(LoadPackage *package) pkg->sd2 = sd2; pkg->ss = ss; pkg->pos = scan->pos; -printf("targ %s:%d at %jd,ss=%f sd2=%f\n", - scan->pkg->mixer->mixer->title, ch, scan->pos, ss, sd2); +//printf("targ %s:%d at %jd,ss=%f sd2=%f\n", +// scan->pkg->mixer->mixer->title, ch, scan->pos, ss, sd2); double *best = pkg->best; int i = 0, len = targ->len; while( i < len1 ) best[i++] = *data++; @@ -1514,7 +1526,7 @@ void MixersAlignMatchRevClient::process_package(LoadPackage *package) if( mix->mx < mx ) { mix->mx = mx; mix->mi = mi; -printf("best %d: %f at %jd\n", get_package_number(), mx, mi); +//printf("best %d: %f at %jd\n", get_package_number(), mx, mi); } farm->mixer_lock->unlock(); }