void LKSurface::DrawBitmap(const int x, const int y, const int cx, const int cy, const LKBitmap& Bitmap, const int cxSrc, const int cySrc) { #ifdef USE_GDI HGDIOBJ old = ::SelectObject(GetTempDC(), (HBITMAP) Bitmap); if (cxSrc != cx || cySrc != cy) { ::StretchBlt(*this, x, y, cx, cy, GetTempDC(), 0, 0, cxSrc, cySrc, SRCPAINT); } else { ::BitBlt(*this, x, y, cx, cy, GetTempDC(), 0, 0, SRCPAINT); } ::SelectObject(GetTempDC(), old); #elif defined(ENABLE_OPENGL) if(_pCanvas && Bitmap.IsDefined()) { _pCanvas->Stretch(x, y, cx, cy, Bitmap, 0, 0, cxSrc, cySrc); } #else if(_pCanvas && Bitmap.IsDefined()) { if (cxSrc != cx || cySrc != cy) { _pCanvas->StretchOr(x, y, cx, cy, Bitmap, 0, 0, cxSrc, cySrc); } else { _pCanvas->CopyOr(x, y, cx, cy, Bitmap, 0, 0); } } #endif }
void LKSurface::DrawBitmap(const int x, const int y, const int cx, const int cy, const LKBitmap& Bitmap) { #ifdef WIN32 HGDIOBJ old = ::SelectObject(GetTempDC(), (HBITMAP) Bitmap); ::BitBlt(*this, x, y, cx, cy, GetTempDC(), 0, 0, SRCPAINT); ::SelectObject(GetTempDC(), old); #elif defined(ENABLE_OPENGL) if(_pCanvas && Bitmap.IsDefined()) { _pCanvas->Stretch(x, y, cx, cy, Bitmap, 0, 0, cx, cy); } #else if(_pCanvas && Bitmap.IsDefined()) { _pCanvas->CopyOr(x, y, cx, cy, Bitmap, 0, 0); } #endif }
void LKSurface::DrawMaskedBitmap(const int x, const int y, const int cx, const int cy, const LKBitmap& Bitmap, const int cxSrc, const int cySrc) { #ifdef WIN32 HGDIOBJ old = ::SelectObject(GetTempDC(), (HBITMAP) Bitmap); if (cxSrc != cx || cySrc != cy) { ::StretchBlt(*this, x, y, cx, cy, GetTempDC(), 0, 0, cxSrc, cySrc, SRCPAINT); ::StretchBlt(*this, x, y, cx, cy, GetTempDC(), cxSrc, 0, cxSrc, cySrc, SRCAND); } else { ::BitBlt(*this, x, y, cx, cy, GetTempDC(), 0, 0, SRCPAINT); ::BitBlt(*this, x, y, cx, cy, GetTempDC(), cxSrc, 0, SRCAND); } ::SelectObject(GetTempDC(), old); #else if(_pCanvas && Bitmap.IsDefined()) { if (cxSrc != cx || cySrc != cy) { _pCanvas->StretchOr(x, y, cx, cy, Bitmap, 0, 0, cxSrc, cySrc); _pCanvas->StretchAnd(x, y, cx, cy, Bitmap, cxSrc, 0, cxSrc, cySrc); } else { _pCanvas->CopyOr(x, y, cx, cy, Bitmap, 0, 0); _pCanvas->CopyAnd(x, y, cx, cy, Bitmap, cxSrc, 0); } } #endif }
void LKSurface::DrawBitmapCopy(const int x, const int y, const int cx, const int cy, const LKBitmap& Bitmap) { #ifdef USE_GDI HGDIOBJ old = ::SelectObject(GetTempDC(), (HBITMAP) Bitmap); ::BitBlt(*this, x, y, cx, cy, GetTempDC(), 0, 0, SRCCOPY); ::SelectObject(GetTempDC(), old); #else if(_pCanvas && Bitmap.IsDefined()) { _pCanvas->Copy(x, y, cx, cy, Bitmap, 0, 0); } #endif }
void CloseProgressDialog() { delete pWndProgress; pWndProgress = NULL; SplashBitmap.Release(); }
short dlgStartupShowModal(void) { WndProperty* wp = nullptr; #if TESTBENCH StartupStore(TEXT(". Startup dialog, RUN_MODE=%d %s"), RUN_MODE, NEWLINE); #endif switch(RUN_MODE) { case RUN_WELCOME: // FLY SIM PROFILE EXIT wf = InitFlySim(); break; case RUN_DUALPROF: // PROFILE AIRCRAFT CLOSE wf = InitDualProfile(); break; case RUN_PROFILE: case RUN_AIRCRAFT: case RUN_PILOT: case RUN_DEVICE: // CHOOSE PROFILE wf = InitStartup(RUN_MODE); break; } if (!wf) { return 0; } wf->SetHeight(ScreenSizeY); wf->SetWidth(ScreenSizeX); WindowControl* wSplash = wf->FindByName(TEXT("frmSplash")); if(wSplash) { wSplash->SetWidth(ScreenSizeX); // wSplash->SetHeight(ScreenSizeY);// - IBLSCALE(55)); } if (!CheckRootDir()) { TCHAR mydir[MAX_PATH]; TCHAR mes[MAX_PATH]; LocalPath(mydir, _T("")); _stprintf(mes, _T("%s"), mydir); MessageBoxX(_T("NO LK8000 DIRECTORY\nCheck Installation!"), _T("FATAL ERROR 000"), mbOk); MessageBoxX(mes, _T("NO LK8000 DIRECTORY"), mbOk, true); RUN_MODE = RUN_EXIT; Shutdown(); goto _exit; } if (!CheckDataDir()) { TCHAR mydir[MAX_PATH]; TCHAR mes[MAX_PATH]; SystemPath(mydir, _T(LKD_SYSTEM)); _stprintf(mes, _T("%s"), mydir); MessageBoxX(_T("NO SYSTEM DIRECTORY\nCheck Installation!"), _T("FATAL ERROR 001"), mbOk); MessageBoxX(mes, _T("NO SYSTEM DIRECTORY"), mbOk, true); RUN_MODE = RUN_EXIT; Shutdown(); goto _exit; } if (!CheckLanguageDir()) { TCHAR mydir[MAX_PATH]; TCHAR mes[MAX_PATH]; StartupStore(_T("... CHECK LANGUAGE DIRECTORY FAILED!%s"), NEWLINE); LocalPath(mydir, _T(LKD_LANGUAGE)); _stprintf(mes, _T("%s"), mydir); MessageBoxX(_T("LANGUAGE DIRECTORY CHECK FAIL\nCheck Language Install"), _T("FATAL ERROR 002"), mbOk); MessageBoxX(mes, _T("NO LANGUAGE DIRECTORY"), mbOk, true); RUN_MODE = RUN_EXIT; Shutdown(); goto _exit; } if (!CheckLanguageEngMsg()) { TCHAR mydir[MAX_PATH]; TCHAR mes[MAX_PATH]; StartupStore(_T("... CHECK LANGUAGE ENG_MSG FAILED!%s"), NEWLINE); LocalPath(mydir, _T(LKD_LANGUAGE)); _stprintf(mes, _T("%s/ENG_MSG.TXT"), mydir); MessageBoxX(_T("ENG_MSG.TXT MISSING in LANGUAGE\nCheck Language Install"), _T("FATAL ERROR 012"), mbOk); MessageBoxX(mes, _T("MISSING FILE!"), mbOk, true); RUN_MODE = RUN_EXIT; Shutdown(); goto _exit; } if (!CheckSystemDefaultMenu()) { TCHAR mydir[MAX_PATH]; TCHAR mes[MAX_PATH]; StartupStore(_T("... CHECK SYSTEM DEFAULT_MENU.TXT FAILED!%s"), NEWLINE); SystemPath(mydir, _T(LKD_SYSTEM)); _stprintf(mes, _T("%s/DEFAULT_MENU.TXT"), mydir); MessageBoxX(_T("DEFAULT_MENU.TXT MISSING in SYSTEM\nCheck System Install"), _T("FATAL ERROR 022"), mbOk); MessageBoxX(mes, _T("MISSING FILE!"), mbOk, true); RUN_MODE = RUN_EXIT; Shutdown(); goto _exit; } if (!CheckSystemBitmaps()) { TCHAR mydir[MAX_PATH]; TCHAR mes[MAX_PATH]; StartupStore(_T("... CHECK SYSTEM _BITMAPSH FAILED!%s"), NEWLINE); SystemPath(mydir, _T(LKD_BITMAPS)); _stprintf(mes, _T("%s/_BITMAPSH"), mydir); MessageBoxX(_T("_BITMAPSH MISSING in SYSTEM Bitmaps\nCheck System Install"), _T("FATAL ERROR 032"), mbOk); MessageBoxX(mes, _T("MISSING FILE!"), mbOk, true); RUN_MODE = RUN_EXIT; Shutdown(); goto _exit; } extern unsigned short Bitmaps_Errors; if (Bitmaps_Errors) { TCHAR mes[MAX_PATH]; _stprintf(mes, _T("MISSING %d SYSTEM BITMAPS! CHECK INSTALLATION."), Bitmaps_Errors); MessageBoxX(mes, _T("MISSING FILES!"), mbOk, true); } if (!CheckPolarsDir()) { TCHAR mydir[MAX_PATH]; TCHAR mes[MAX_PATH]; StartupStore(_T("... CHECK POLARS DIRECTORY FAILED!%s"), NEWLINE); LocalPath(mydir, _T(LKD_POLARS)); _stprintf(mes, _T("%s"), mydir); MessageBoxX(_T("NO POLARS DIRECTORY\nCheck Install"), _T("FATAL ERROR 003"), mbOk); MessageBoxX(mes, _T("NO POLARS DIRECTORY"), mbOk, true); RUN_MODE = RUN_EXIT; Shutdown(); goto _exit; } extern bool CheckFilesystemWritable(void); if (!CheckFilesystemWritable()) { MessageBoxX(_T("LK8000 CANNOT WRITE IN MEMORY CARD!\nCARD IS LOCKED, OR DAMAGED, OR FULL."), _T("CRITICAL PROBLEM"), mbOk); RUN_MODE = RUN_EXIT; Shutdown(); goto _exit; } // Standby for a system request to close the application during this phase. wf->SetTimerNotify(500, OnTimerNotify); if (wf->ShowModal() == mrCancel) { RUN_MODE = RUN_EXIT; } if (RUN_MODE == RUN_SHUTDOWN) goto _exit; wp = (WndProperty*) wf->FindByName(TEXT("prpProfile")); if (wp) { DataFieldFileReader* dfe = (DataFieldFileReader*) wp->GetDataField(); if (RUN_MODE == RUN_PROFILE) { if (_tcslen(dfe->GetPathFile()) > 0) { if (_tcscmp(dfe->GetPathFile(), startProfileFile)) { // if they are not the same _tcscpy(startProfileFile, dfe->GetPathFile()); if (_tcscmp(startProfileFile, _T("PROFILE_RESET")) == 0) { #if TESTBENCH StartupStore(_T("... Selected FULL RESET virtual profile\n")); #endif MessageBoxX(MsgToken(1758), MsgToken(1757), mbOk); FullResetAsked = true; } else { #if TESTBENCH StartupStore(_T("... Selected new profile, preloading..\n")); #endif FullResetAsked = false; } } } } if (RUN_MODE == RUN_AIRCRAFT) { if (_tcslen(dfe->GetPathFile()) > 0) { if (_tcscmp(dfe->GetPathFile(), startAircraftFile)) { // if they are not the same _tcscpy(startAircraftFile, dfe->GetPathFile()); #if TESTBENCH StartupStore(_T("... Selected new aircraft, preloading..\n")); #endif } } } if (RUN_MODE == RUN_DEVICE) { if (_tcslen(dfe->GetPathFile()) > 0) { if (_tcscmp(dfe->GetPathFile(), startDeviceFile)) { // if they are not the same _tcscpy(startDeviceFile, dfe->GetPathFile()); #if TESTBENCH StartupStore(_T("... Selected new device, preloading..\n")); #endif } } } if (RUN_MODE == RUN_PILOT) { if (_tcslen(dfe->GetPathFile()) > 0) { if (_tcscmp(dfe->GetPathFile(), startPilotFile)) { // if they are not the same _tcscpy(startPilotFile, dfe->GetPathFile()); #if TESTBENCH StartupStore(_T("... Selected new pilot, preloading..\n")); #endif } } } RUN_MODE = RUN_DUALPROF; } if (RUN_MODE == RUN_EXIT) { #if __linux__ RUN_MODE = RUN_WELCOME; #endif LKSound(_T("LK_SLIDE.WAV")); if (MessageBoxX( // LKTOKEN _@M198_ = "Confirm Exit?" MsgToken(198), TEXT("LK8000"), mbYesNo) == IdYes) { Shutdown(); } else { RUN_MODE = RUN_WELCOME; } } _exit: if (wf != NULL) { delete wf; wf = NULL; } StartBitmap.Release(); ProfileBitmap.Release(); if (RUN_MODE == RUN_FLY || RUN_MODE == RUN_SIM) { LKSound(_T("LK_SLIDE.WAV")); return 0; // do not repeat dialog } if (RUN_MODE == RUN_EXIT || RUN_MODE == RUN_SHUTDOWN) return -1; // terminate else return 1; // repeat dialog }