void ProjectMetaData::copyDummyBmp() { // Now copy the dummy.bmp file from the instllation dir to the DeviceData\GUI dir // as this will be needed when the user starts using LGB. CFileOperation fileOp; try { INXString installnDir; CLabLgbBaseApp *baseApp = (CLabLgbBaseApp *) AfxGetApp(); baseApp->GetInstallationBaseDir(installnDir); INXString sourceDir = installnDir + IMAGEDIR; INXString sourceFile = ICON_PLACEHOLDER_FILE; if( fileOp.CheckPath( sourceDir + sourceFile) != PATH_IS_FILE ){ AfxMessageBox( "Problem with provision of installation 'placeholder' file - seek assistance!" ); assert(1==0); } INXString destDir; getProjectDir(destDir); destDir += GUIDIR; INXString destFile = ICON_PLACEHOLDER_FILE; if( fileOp.CheckPath( destDir + destFile) != PATH_IS_FILE ){ fileOp.CopyFileGood(sourceDir, sourceFile, destDir, destFile ); } }catch ( CFExeption(sError) ){ // For some reason, this catch doesn' work, as the handling of the exception's // INXString thows its own exception. AfxMessageBox( "Problem with 'placeholder' bitmap - seek assistance!" ); assert(1==0); } ExtPngFile pngFile; pngFile.setHostFileName(ICON_PLACEHOLDER_FILE); addPngFile( pngFile ); }
// Saves all the DEP that is open in the application void Project::SaveProjectDep() { CLabLgbBaseApp *pApp = ( CLabLgbBaseApp * ) AfxGetApp(); CMainFrame* pFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd; INXString csProjectDir; pProjMData->getProjectDir(csProjectDir); int response; int iRetest = 1; double dFreeDiskSpace; // test for sufficient disk space to save project, loop on retry, exit app on cancel while (iRetest > 0) { iRetest = 0; dFreeDiskSpace = pApp->MyGetFreeDiskSpaceMB(); if (dFreeDiskSpace < DISK_SPACE_CRITICAL_MB) { response = AfxMessageBox("Unable to save project, less than 10MB of free disk space remaining.\nCannot continue - Cancel will exit application.", MB_RETRYCANCEL | MB_ICONWARNING); if (response == IDRETRY) { iRetest = 1; } else { //@todo - we could be a bit nicer about this - freeze project view instead of exiting app // pFrame->exiting = TRUE; // pFrame->SendMessage(WM_CLOSE); exit(1); return; } } } // changed the DEP, so if SODL was uptodate before, set flag to indicate dirty SODL pProjMData->setDirtySODLFlag(); //DeleteUnused(pDEP[0]); for (int i=0; i<=DEPNum; i++) { pDEP[i]->SaveProg(csProjectDir + DEPDIR + pFrame->m_wndProjectBar.m_cProjTree.GetDEPPath(pDEP[i]->hItem) + pDEP[i]->depFilename + ".prg"); } }
bool DrawProgDoc::OnOpenDocument(const wxString& filename) { INXString filename; int len; int response; #ifdef _UNUSED_FUNCTIONS_TO_LOAD_THE_FILE CLabLgbBaseApp *pApp = ( CLabLgbBaseApp * ) AfxGetApp(); double dFreeDiskSpace = pApp->MyGetFreeDiskSpaceMB(); if (dFreeDiskSpace < DISK_SPACE_WARNING_MB) { response = AfxMessageBox("Warning, less than 50MB of free disk space remaining.\nYou may not be able save your work.\nContinue?",MB_YESNO | MB_ICONWARNING); if (response == IDNO) { return FALSE; } } else if (dFreeDiskSpace < DISK_SPACE_CRITICAL_MB) { AfxMessageBox("Unable to open project, less than 10MB of free disk space remaining.",MB_ICONWARNING); return FALSE; } #endif // Extract filename filename = (INXString)lpszPathName; //filename = filename.SpanExcluding("."); filename.MakeReverse(); filename = filename.SpanExcluding("\\"); filename.MakeReverse(); // remove .prg to get filename len = filename.GetLength() - 4; filename = filename.Left(len); if (!wxDocument::OnOpenDocument(lpszPathName)) return FALSE; // TODO: Add your specialized creation code here POSITION pos = GetFirstViewPosition(); DrawProgView* pView = (DrawProgView*) GetNextView(pos); if (pFrame->m_wndProjectBar.m_cProjTree.openProject) { pProject = pFrame->m_wndProjectBar.m_cProjTree.openProj; } else { pProject = pFrame->m_wndProjectBar.m_cProjTree.GetProjectPtr(pFrame->m_wndProjectBar.m_cProjTree.hSelItem); } // Check Folder Structure INXString csProjDir; pProject->pProjMData->initProjFolderMinder(); if(pProject->pProjMData->folderStructureNotOk()){ AfxMessageBox("Unable to open this project, because the directory structure is invalid"); return kErr_InvalidFolderStructure; } // Create DEP, load and initialise pDEP = pProject->AddDEP(); pDEP->LoadProg((INXString)lpszPathName); pDEP->InitTagLists(); pDEP->depFilename = filename; // Populate project tree if opening a project. Uses the loaded DEP to populate the tree if (pFrame->m_wndProjectBar.m_cProjTree.openProject) { pFrame->m_wndProjectBar.m_cProjTree.PopulateProjectTree(pDEP->condata, pProject); } pDEP->hItem = pFrame->m_wndProjectBar.m_cProjTree.hSelItem; // Set the project and DEP pointers in the view pView->pProject = pProject; pView->pDEP = pDEP; pView->RedrawWindow(); // Need to initialise undo for case when the view is already open pView->initUndo(); return true; }