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]);
}
}
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]);
}
}
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]);
}
}
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;
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;
}
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;
}
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);
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();
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;
// 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;
while( track && track->mixer_id != id ) track = track->next;
if( !track ) continue;
double nudge = mix->nudge;
- int record = track->record; track->record = 1;
+ int armed = track->armed; track->armed = 1;
if( nudge < 0 ) {
track->clear(0, -nudge, 1,
edl->session->labels_follow_edits,
edl->session->plugins_follow_edits,
edl->session->autos_follow_edits);
}
- track->record = record;
+ track->armed = armed;
}
}
edl->optimize();
- mwindow->gui->lock_window("MixersAlign::apply_tracks");
mwindow->update_gui(1);
mwindow->gui->unlock_window();
clear_mixer_nudge();
// 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;
ArrayList<int> track_arms; // ugly
for( Track *track=edl->tracks->first; track; track=track->next ) {
- track_arms.append(track->record);
- track->record = 0;
+ track_arms.append(track->armed);
+ track->armed = 0;
}
for( int m, i=0; (m=ma_gui->mixer_list->get_selection_number(0,i))>=0; ++i ) {
if( m == midx ) continue; // master does not move
while( track && track->mixer_id != id ) track = track->next;
if( !track ) continue;
double nudge = mix->nudge;
- track->record = 1;
+ track->armed = 1;
double position = 0; Track *first_track = 0;
EDL *clip = edl->selected_edits_to_clip(0, &position, &first_track);
if( clip ) {
position += nudge;
edl->paste_edits(clip, first_track, position, 1);
}
- track->record = 0;
+ track->armed = 0;
}
}
int i = 0;
for( Track *track=edl->tracks->first; track; track=track->next )
- track->record = track_arms[i++];
+ track->armed = track_arms[i++];
edl->optimize();
- mwindow->gui->lock_window("MixersAlign::apply_selected");
mwindow->update_gui(1);
mwindow->gui->unlock_window();
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();
}
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; i<edl_mixers.size(); ++i )
mixers.append(new MixersAlignMixer(edl_mixers[i]));
void MixersAlign::load_mtracks()
{
- mtracks.remove_all_objects();
+ mtracks.clear();
Track *track=mwindow->edl->tracks->first;
for( int no=0; track; ++no, track=track->next ) {
if( track->data_type != TRACK_AUDIO ) continue;
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;
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();
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++;
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();
}