void JobSetQueueFile(const wchar_t *filename, bool distributed, bool autorun) { g_VDJobQueue.SetAutoRunEnabled(false); g_VDJobQueue.SetJobFilePath(filename, distributed, distributed); g_VDJobQueue.SetAutoRunEnabled(autorun); }
bool VDUIJobControlDialog::OnCommand(uint32 id, uint32 extcode) { OnMenuHit(id); if (extcode == BN_CLICKED) { HWND hwndItem = GetDlgItem(mhdlg, IDC_JOBS); int index = ListView_GetNextItem(hwndItem, -1, LVNI_ALL | LVNI_SELECTED); VDJob *vdj = NULL; if (index >= 0) vdj = g_VDJobQueue.ListGet(index); switch(id) { case IDOK: Destroy(); return true; case IDC_DELETE: if (vdj) { // Do not delete jobs that are in progress! if (vdj->GetState() != VDJob::kStateInProgress) { fUpdateDisable = true; g_VDJobQueue.Delete(vdj, false); delete vdj; g_VDJobQueue.SetModified(); fUpdateDisable = false; if (g_VDJobQueue.ListSize() > 0) ListView_SetItemState(hwndItem, index==g_VDJobQueue.ListSize() ? index-1 : index, LVIS_SELECTED, LVIS_SELECTED); } } return TRUE; case IDC_POSTPONE: if (vdj) { // Do not postpone jobs in progress int state = vdj->GetState(); if (state != VDJob::kStateInProgress) { if (state == VDJob::kStatePostponed) vdj->SetState(VDJob::kStateWaiting); else vdj->SetState(VDJob::kStatePostponed); vdj->Refresh(); g_VDJobQueue.SetModified(); } } return TRUE; case IDC_MOVE_UP: if (!vdj || index <= 0) return TRUE; g_VDJobQueue.Swap(index-1, index); ListView_SetItemState(hwndItem, index , 0, LVIS_SELECTED | LVIS_FOCUSED); ListView_SetItemState(hwndItem, index-1, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); ListView_RedrawItems(hwndItem, index-1, index); g_VDJobQueue.SetModified(); return TRUE; case IDC_MOVE_DOWN: if (!vdj || index >= g_VDJobQueue.ListSize()-1) return TRUE; g_VDJobQueue.Swap(index+1, index); ListView_SetItemState(hwndItem, index , 0, LVIS_SELECTED | LVIS_FOCUSED); ListView_SetItemState(hwndItem, index+1, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); ListView_RedrawItems(hwndItem, index, index+1); g_VDJobQueue.SetModified(); return TRUE; case IDC_START: if (g_VDJobQueue.IsRunInProgress()) { g_VDJobQueue.RunAllStop(); EnableControl(IDC_START, FALSE); } else g_VDJobQueue.RunAllStart(); return TRUE; case IDC_ABORT: if (g_VDJobQueue.IsRunInProgress()) { g_VDJobQueue.RunAllStop(); EnableControl(IDC_START, false); EnableControl(IDC_ABORT, false); if (g_dubber) g_dubber->Abort(); } return TRUE; case IDC_RELOAD: if (!vdj) return TRUE; if (!vdj->IsReloadMarkerPresent()) MessageBox(mhdlg, "This job was created with an older version of VirtualDub and cannot be reloaded.", g_szError, MB_ICONERROR|MB_OK); else vdj->Reload(); return TRUE; case IDC_AUTOSTART: g_VDJobQueue.SetAutoRunEnabled(IsButtonChecked(IDC_AUTOSTART)); return TRUE; } } return false; }