void check_execution_abort() { if(execution_in_progress) { HourGlass(); short unsigned int key = PRGM_GetKey(); if(key == KEY_PRGM_ACON) esc_flag = 1; } }
void main(void){ Bdisp_EnableColor(0);//Use 3-bit mode. Bdisp_AllClr_VRAM(); Bdisp_PutDisp_DD(); for(;;){ HourGlass(); if(keyPressed(KEY_PRGM_MENU)){ int key; GetKey(&key); } } }
void DecodeDlg::DecodePreview() { CString lfn; EngineSetup(); decoder->PostThreadMessage(ENG_CLEAR, 1, 0); // Clear any existing list (and reset control) m_DecodeGo.SetLabel(IDS_CANCELBUTTON); InfoClear(); HourGlass(true); m_DecodeList.SetSel(-1, FALSE); // Clear all selections int rmax = m_DecodeList.GetCount(); if (rmax == 0) return; TransferOptions(&decoder->UD); // Copy options to the control CWaitCursor wai; if (SHOW_DEBUG) deBox.Init(&debugPosn); CString cpath = CurrentOutput(); for (int row=0; row < rmax; row++) // Step through the whole list { m_DecodeList.GetText(row, lfn); // Read the filename if (clipboardSet && lfn == clipboardString) { cFile.Close(); // Make sure the temp is closed decoder->PostThreadMessage(ENG_DECODE, row, (LPARAM) (strdup((const char *) cFile))); } else decoder->PostThreadMessage(ENG_DECODE, row, (LPARAM) (strdup((const char *) lfn))); } decoder->PostThreadMessage(ENG_LOAD, 0, 0); }
bool Document :: Save() { short err, ret; if (saveas) return SaveAs(); HourGlass(); File f(fname); if ((err = f.Open("w+")) == 0) { long loc = 0; bString str(NULL, 4096); while (loc < mle->GetNumChars()) { mle->Export(str, &loc, MlCfText); f.Write(str, str.Length(), 1); } f.Close(); mle->SetModified(FALSE); modified = FALSE; ret = TRUE; } else { char buf[300]; sprintf(buf, "Error %d saving %s", err, (const char*)fname); wMessageBox mb(this, buf, "Error", MbIconExclamation | MbOk); ret = FALSE; } HourGlass(); return ret; }
void DecodeDlg::DecodeGoDone(int rc) { HourGlass(false); m_DecodeOut.ModifyStyle(LVS_SHOWSELALWAYS, 0); if (rc < 0) { SetState(MS_GO, true); // Force back to Go state Info1(IDS_CANCEL); } else // Not cancelled, set to DONE, etc. { int r = m_DecodeOut.GetItemCount() - 1; m_DecodeOut.SetImage(r, DecIcon(m_DecodeOut.GetItemData(r), NULL)); // Update the last icon SetState(MS_DONE); Info1("Done decoding."); if (rc != 0) { CString wrk; wrk.Format("%d errors found.", rc); Info2(wrk); } else Info2("No errors."); } if (SHOW_DEBUG) deBox.Ready(); }
static BOOL Video_Open( HWND hWindow, LPVIDEO lpVideo, WORD wDisk, long lStartFrame ) /***********************************************************************/ { if ( !lpVideo ) return( NO ); HourGlass( YES ); // Cleanup any open video file if ( lpVideo->lpSwitches ) { FreeUp( (LPTR)lpVideo->lpSwitches ); lpVideo->lpSwitches = NULL; } if ( lpVideo->idLoopTimer ) { KillTimer( hWindow, lpVideo->idLoopTimer ); lpVideo->idLoopTimer = NULL; } if ( lpVideo->hDevice ) { Video_Close( hWindow, lpVideo ); lpVideo->hDevice = NULL; } FNAME szFileName; GetWindowText( hWindow, szFileName, sizeof(STRING) ); GetStringParm( szFileName, 0/*nIndex*/, ',', szFileName ); lpVideo->lpSwitches = ExtractSwitches( szFileName ); // Replace any %d in the file name with the disk number, // and flag whether we need to check disk labels wsprintf( szFileName, szFileName, wDisk ); BOOL bFullScreen = (BOOL)GetSwitchValue( 'f', lpVideo->lpSwitches ); VideoInit( NO/*ZoomBy2*/, bFullScreen ); if ( !lpVideo->iZoomFactor ) { if ( iDefaultZoomFactor ) lpVideo->iZoomFactor = iDefaultZoomFactor; else { lpVideo->iZoomFactor = (int)GetSwitchValue( 'z', lpVideo->lpSwitches ); if ( !lpVideo->iZoomFactor ) lpVideo->iZoomFactor = 1; } } STRING szAlias; wsprintf( szAlias, "A%d%ld", wDisk, (LPSTR)hWindow ); if ( !(lpVideo->hDevice = MCIOpen( GetApp()->m_hDeviceAVI, szFileName, szAlias, hWindow, lStartFrame )) ) { HourGlass( NO ); return( NO ); } lpVideo->lFrames = MCIGetLength( lpVideo->hDevice ); lpVideo->wDisk = wDisk; //MCISetVideoDrawProc( lpVideo->hDevice, NULL/*lpDrawDibProc*/, NULL/*lpDrawDCProc*/ ); MCISetTimeFormat( lpVideo->hDevice, MCI_FORMAT_FRAMES ); // force the control to take on the size of the video file RECT rect; GetClientRect( hWindow, &rect ); MapWindowPoints( hWindow, GetParent(hWindow), (LPPOINT)&rect, 2 ); SetWindowPos( hWindow, NULL, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, SWP_NOZORDER | SWP_NOACTIVATE ); HourGlass( NO ); return( YES ); }
void DecodeDlg::DecodePreviewDone(int rc) { bool clmode = ((CUud32App *) AfxGetApp())->GetCLMode(); if (SHOW_DEBUG) { deBox.Ready(); // OK to interact with debug box decoder->UD.SetLastMessage(""); // Messages already retrieved } if (rc == CUud32acxCtrl::uudRetCancel) // Cancel. { HourGlass(false); m_DecodeGo.SetLabel(IDS_PREVIEW); Info1(IDS_CANCEL); return; } else if (rc != CUud32acxCtrl::uudRetOK) { CString emsg(decoder->UD.GetLastMessage()); CString lfn; int row = m_DecodeList.GetFirstSel(); if (row >= 0) m_DecodeList.GetText(row, lfn); else lfn = "(Unknown?)"; if (ArgMessageBox("Load Encoded Files", MB_OKCANCEL | MB_ICONQUESTION, "Error loading file:\r\n%s\r\nCode: %d [%s]\r\nContinue?", (const char *) lfn, rc, (const char *) emsg) == IDOK) decoder->PostThreadMessage(ENG_LOAD, 0, 0); // Restart the engine with next file else { HourGlass(false); Info1(IDS_CANCEL); m_DecodeGo.SetLabel(IDS_PREVIEW); } return; } Info1("Done loading."); CString lfn(decoder->UD.GetLastMessage()); Info2(lfn); // Messages already routed m_DecodeList.SetSel(-1, FALSE); // Clear all selections m_DecodeList.SetCaretIndex(0, FALSE); // Scroll list back to top int row, rmax = decoder->UD.GetDFCount(); // Read maximum file count CString cpath(CurrentOutput()); if (rmax == 0) { Info1(IDS_NOTHING_DECODE); if (!clmode) { CString msg; msg.LoadString(IDS_NOFIND_DECODE); MessageBox(msg, "Decode", MB_ICONEXCLAMATION | MB_OK); } m_DecodeGo.SetLabel(IDS_PREVIEW); HourGlass(false); SetState(MS_PREVIEW); return; } m_DecodeOut.SetRedraw(FALSE); m_DecodeOut.SetItemCount(rmax + 1); // Maximum items to add... for (row=0; row < rmax; row++) if (!(decoder->UD.GetDFileFlags(row) & CUud32acxCtrl::uudFileNoData)) { lfn = decoder->UD.GetDFile(row); lfn = decoder->UD.FileFilter(lfn); if (!options[OPT_PCASE]) // Preserve case on output lfn.MakeLower(); m_DecodeOut.InsertItem(LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM, 0, lfn, 0, 0, DecIcon(row, cpath + lfn), row); } m_DecodeOut.SetRedraw(TRUE); HourGlass(false); if (m_DecodeOut.GetItemCount() == 0) { Info1(IDS_NOTHING_DECODE); CString msg; msg.LoadString(IDS_NOTHING_DECODE); m_DecodeGo.SetLabel(IDS_PREVIEW); if (!clmode) MessageBox(msg, "Decode", MB_ICONEXCLAMATION | MB_OK); SetState(MS_PREVIEW); return; } DupCheck(); SetState(MS_GO); if (options[OPT_DNOPROMPT]) // Decode without prompting { CWnd *go = GetDlgItem(IDC_DECODEGO); ASSERT(go != NULL); if (!clmode && go != NULL) // Not command line mode PostMessage(WM_COMMAND, IDC_DECODEGO, (LPARAM) go->m_hWnd); } }
void DecodeDlg::DecodeGo() { if (m_DecodeOut.GetItemCount() == 0) return; InfoClear(); CString cpath = CurrentOutput(); int errct = 0; TransferOptions(&decoder->UD); decoder->UD.m_overwrite = TRUE; // Force overwrite mode decoder->POE = (options[OPT_POE] != 0); // Set Pause on Errors flag // decoder->OWrite = (options[OPT_OWRITE] != 0); // Set Overwrite OK flag OnCommand(DO_NONE, 0); // Unselect everything if (cpath.GetLength() > 3) // More than just a drive spec { CString fname(cpath); if (fname[fname.GetLength() - 1] == '\\') fname = fname.Left(fname.GetLength() - 1); // Remove trailing backslash CFileStatus fsta; if (!CFile::GetStatus(fname, fsta)) { ArgMessageBox("Decode Files", MB_ICONEXCLAMATION | MB_OK, "Output directory:\r\n%s\r\ndoes not exist.", (const char *) fname); return; } if (!(fsta.m_attribute & CFile::directory)) { ArgMessageBox("Decode Files", MB_ICONEXCLAMATION | MB_OK, "Output path:\r\n%s\r\nis in use as a filename or is not a directory.", (const char *) fname); return; } } // Directory test if int rmax = m_DecodeOut.GetItemCount(); CString lfn; int ud_row; ri.AddMRU(&m_DecodePath, MAX_MRU); CWaitCursor wai; HourGlass(true); m_DecodeGo.SetLabel(IDS_CANCELBUTTON); cancelFlag = false; if (SHOW_DEBUG) deBox.Init(&debugPosn); decoder->PostThreadMessage(ENG_CLEAR, 0, 0); // Waste any existing list, but don't reset for (int row=0; !cancelFlag && row < rmax; row++) // Actually decode the files { ud_row = m_DecodeOut.GetItemData(row); // The UUDeview row number if (decoder->UD.GetDFileFlags(ud_row) & (CUud32acxCtrl::uudFileError | CUud32acxCtrl::uudFileDecoded)) continue; // Already processed lfn = cpath + m_DecodeOut.GetItemText(row, 0); // The output filename decoder->PostThreadMessage(ENG_DECODE, (WPARAM) ud_row, (LPARAM) strdup(lfn)); // Add the file to decode } m_DecodeOut.ModifyStyle(0, LVS_SHOWSELALWAYS); decoder->PostThreadMessage(ENG_DECLIST, 0, 0); // Start decoding.... }
Document :: Document(wWindow *parent, const char *fn) : wMdiDocument(MDI_MAXTITLEAUTO) { short err; File f(fn); bFileName nm; wDimension d=parent->GetSize(); CreateWindow(parent, FaTitleBar | FaSysMenu | FaMinMax | FaSizeBorder); mle = 0; SetIcon(icon = new wIcon(ResIcon, I_DOC)); nm.Parse(fn); SetCaption(nm.Filename()); HourGlass(); modified = FALSE; saveas = FALSE; fname = fn; ChangeFrameSize(wDimension(d.xWidth() / 3, d.yHeight() / 3)); ChangePosition(wPointl(5,5)); mle = new wMLEntry(this, 0, wPointl(0,0), GetSize(), MlHscroll | MlVscroll); if ((err = f.Open("r")) == 0) { ushort numb; long pos = 0; bString str(NULL, 4096); while ((numb = (ushort)f.Read((char *)(const char *)str, 1, 4096)) != 0) { str.AdjustLength(numb); mle->Import(str, &pos, MlCfText); } f.Close(); } else { char buf[300]; sprintf(buf, "Error %d opening %s", err, fn); wMessageBox mb(this, buf, "Error", MbIconExclamation | MbOk); } HourGlass(); mle->SetForeground(((Editor*)parent)->ForeG()); mle->SetBackground(((Editor*)parent)->BackG()); mle->SetFont( ((Editor*)parent)->Font() ); mle->SetTabStop(((Editor*)parent)->Tab()); mle->SetWrap(((Editor*)parent)->WordWrap()); mle->SetFirstChar(0); // REPOSITION TO FIRST CHARACTER mle->SetCursorPosition(0); // PLACE CURSOR mle->EnableUpdate(); mle->Show(); // SHOW IT mle->SetFocus(); // GIVE IT FOCUS SO CURSOR APPEARS mle->SetModified(FALSE); Show(); }