void BoundingBoxDialog::updateData(void) { LDrawModelViewer *modelViewer = getModelViewer(); if (m_model != NULL && modelViewer != NULL) { UCCHAR buf1[1024]; UCCHAR buf2[1024]; modelViewer->getBoundingMin().print(buf1, COUNT_OF(buf1)); sucprintf(buf2, COUNT_OF(buf2), _UC("<%s>"), buf1); windowSetText(IDC_MIN_POINT, buf2); modelViewer->getBoundingMax().print(buf1, COUNT_OF(buf1)); sucprintf(buf2, COUNT_OF(buf2), _UC("<%s>"), buf1); windowSetText(IDC_MAX_POINT, buf2); } else { windowSetText(IDC_MIN_POINT, _UC("")); windowSetText(IDC_MAX_POINT, _UC("")); } }
LDLTriangleLine *LDLQuadLine::newTriangleLine(int p1, int p2, int p3) { UCCHAR pointBuf1[64] = _UC(""); UCCHAR pointBuf2[64] = _UC(""); UCCHAR pointBuf3[64] = _UC(""); UCCHAR ucNewLine[1024]; char *newLine; LDLTriangleLine *retValue; printPoint(p1, pointBuf1); printPoint(p2, pointBuf2); printPoint(p3, pointBuf3); sucprintf(ucNewLine, COUNT_OF(ucNewLine), _UC("3 %ld %s %s %s"), m_colorNumber, pointBuf1, pointBuf2, pointBuf3); newLine = ucstringtombs(ucNewLine); retValue = new LDLTriangleLine(m_parentModel, newLine, m_lineNumber, m_line); delete newLine; return retValue; }
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPSTR lpCmdLine, int nCmdShow) { ModelLoader* modelLoader; bool screenSaver = isScreenSaver(); int retValue; STARTUPINFO startupInfo; bool fromConsole = false; //HMODULE hThumbs = LoadLibrary("LDViewThumbs.dll"); //if (hThumbs != NULL) //{ // PFNDLLREGISTERSERVER pDllRegisterServer = // (PFNDLLREGISTERSERVER)GetProcAddress(hThumbs, "DllRegisterServer"); // CoInitialize(NULL); // if (pDllRegisterServer != NULL) // { // pDllRegisterServer(); // } //} memset(&startupInfo, 0, sizeof(startupInfo)); startupInfo.cb = sizeof(startupInfo); GetStartupInfo(&startupInfo); if (startupInfo.lpTitle != NULL && stringHasCaseInsensitivePrefix(startupInfo.lpTitle, "command line ") && strcasestr(startupInfo.lpTitle, "ldview") != NULL) { runningWithConsole(); fromConsole = true; } #ifdef _DEBUG int _debugFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); _debugFlag |= _CRTDBG_LEAK_CHECK_DF; _CrtSetDbgFlag(_debugFlag); _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG); if (!fromConsole) { createConsole(); } // MessageBox(NULL, "Attach a debugger now...", "Debug", MB_OK); #endif // _DEBUG bool udok = setupUserDefaults(lpCmdLine, screenSaver, isRemovableDrive(hInstance)); setupLocalStrings(); if (TCUserDefaults::boolForKey(DEBUG_COMMAND_LINE_KEY, false, false)) { std::string message = "Command Line:\n"; message += lpCmdLine; MessageBox(NULL, message.c_str(), "LDView", MB_OK); } if (!udok && !TCUserDefaults::longForKey("IniFailureShown", 0, 0)) { UCCHAR message[2048]; UCSTR iniPath = mbstoucstring(TCUserDefaults::getIniPath()); sucprintf(message, COUNT_OF(message), TCLocalStrings::get(_UC("IniFailure")), iniPath); CUIWindow::messageBoxUC(NULL, message, _UC("LDView"), MB_OK); delete iniPath; TCUserDefaults::setLongForKey(1, "IniFailureShown", false); } if (screenSaver) { if (strncasecmp(lpCmdLine, "/p", 2) == 0 || strncasecmp(lpCmdLine, "-p", 2) == 0 || strncasecmp(lpCmdLine, "p", 1) == 0) { // preview mode return doPreview(hInstance, lpCmdLine); } if (strncasecmp(lpCmdLine, "/c", 2) == 0 || strncasecmp(lpCmdLine, "-c", 2) == 0 || strncasecmp(lpCmdLine, "c", 1) == 0 || strlen(lpCmdLine) == 0) { SSConfigure *configure; configure = new SSConfigure(hInstance); #ifdef _DEBUG _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG); createConsole(); #endif // _DEBUG configure->run(); // configure mode return 1; } // This shouldn't be necessary, but I've received a report of a whole // bunch of copies of the LDView screensaver running at once. This // might not fix things entirely, but it will at least prevent it // from launching multiple times concurrently. CreateMutex(NULL, FALSE, "LDView Screensaver"); if (GetLastError() == ERROR_ALREADY_EXISTS) { return 0; } } #ifdef _LOG_PERFORMANCE LARGE_INTEGER frequency; if (QueryPerformanceFrequency(&frequency)) { debugPrintf("Frequency: %I64d\n", frequency.QuadPart); } #endif // _LOG_PERFORMANCE OleInitialize(NULL); //Win7JumpListStuff(); modelLoader = new ModelLoader(CUIWindow::getLanguageModule(), nCmdShow, screenSaver); retValue = mainLoop(); modelLoader->release(); return retValue; } // WinMain