Esempio n. 1
0
void CViewerDlg::OnFindviewer() 
{
	// Fire up a common dlg to find new file
	CFileDialog fDlg(TRUE, LoadStringResource(IDS_VIEWERDLG_EXTENSION), NULL,  
		OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_NONETWORKBUTTON | OFN_PATHMUSTEXIST,
		LoadStringResource(IDS_VIEWERDLG_FILTER), this,
		MainFrame()->m_osVer.dwMajorVersion < 5 ? OPENFILENAME_SIZE_VERSION_400 : sizeof(OPENFILENAME)); 

	if(fDlg.DoModal() == IDOK)
	{
		m_Viewer= fDlg.GetPathName();
		EndDialog(IDOK);
	}
}
Esempio n. 2
0
bool ProjectPanel::saveWorkSpaceAs(bool saveCopyAs)
{
    FileDialog fDlg(_hSelf, ::GetModuleHandle(NULL));
    fDlg.setExtFilter(TEXT("All types"), TEXT(".*"), NULL);

    if (TCHAR *fn = fDlg.doSaveDlg())
    {
        writeWorkSpace(fn);
        if (!saveCopyAs)
        {
            _workSpaceFilePath = fn;
            setWorkSpaceDirty(false);
        }
        return true;
    }
    return false;
}
Esempio n. 3
0
void ProjectPanel::addFiles(HTREEITEM hTreeItem)
{
    FileDialog fDlg(_hSelf, ::GetModuleHandle(NULL));
    fDlg.setExtFilter(TEXT("All types"), TEXT(".*"), NULL);

    if (stringVector *pfns = fDlg.doOpenMultiFilesDlg())
    {
        size_t sz = pfns->size();
        for (size_t i = 0 ; i < sz ; ++i)
        {
            TCHAR *strValueLabel = ::PathFindFileName(pfns->at(i).c_str());
            _treeView.addItem(strValueLabel, hTreeItem, INDEX_LEAF, pfns->at(i).c_str());
        }
        _treeView.expand(hTreeItem);
        setWorkSpaceDirty(true);
    }
}
Esempio n. 4
0
const TCHAR * Notepad_plus::fileSaveSession(size_t nbFile, TCHAR ** fileNames)
{
	FileDialog fDlg(_pPublicInterface->getHSelf(), _pPublicInterface->getHinst());
	const TCHAR *ext = NppParameters::getInstance()->getNppGUI()._definedSessionExt.c_str();

	fDlg.setExtFilter(TEXT("All types"), TEXT(".*"), NULL);
	generic_string sessionExt = TEXT("");
	if (*ext != '\0')
	{
		if (*ext != '.')
			sessionExt += TEXT(".");
		sessionExt += ext;
		fDlg.setExtFilter(TEXT("Session file"), sessionExt.c_str(), NULL);
	}
	const TCHAR *sessionFileName = fDlg.doSaveDlg();

	return fileSaveSession(nbFile, fileNames, sessionFileName);
}
bool Notepad_plus::fileSaveAs(BufferID id, bool isSaveCopy)
{
	BufferID bufferID = id;
	if (id == BUFFER_INVALID)
		bufferID = _pEditView->getCurrentBufferID();
	Buffer * buf = MainFileManager->getBufferByID(bufferID);

	FileDialog fDlg(getMainWindowHandle(), _pPublicInterface->getHinst());

    fDlg.setExtFilter(TEXT("All types"), TEXT(".*"), NULL);
	int langTypeIndex = setFileOpenSaveDlgFilters(fDlg, buf->getLangType());
	fDlg.setDefFileName(buf->getFileName());
	
    fDlg.setExtIndex(langTypeIndex+1); // +1 for "All types"
	TCHAR *pfn = fDlg.doSaveDlg();

	if (pfn)
	{
		BufferID other = _pNonDocTab->findBufferByName(pfn);
		if (other == BUFFER_INVALID)	//can save, other view doesnt contain buffer
		{
			bool res = doSave(bufferID, pfn, isSaveCopy);
			//buf->setNeedsLexing(true);	//commented to fix wrapping being removed after save as (due to SCI_CLEARSTYLE or something, seems to be Scintilla bug)
			//Changing lexer after save seems to work properly
			return res;
		}
		else		//cannot save, other view has buffer already open, activate it
		{
			_nativeLangSpeaker.messageBox("FileAlreadyOpenedInNpp",
				getMainWindowHandle(),
				TEXT("The file is already opened in the Notepad++."),
				TEXT("ERROR"),
				MB_OK | MB_ICONSTOP);
			switchToFile(other);
			return false;
		}
	}
	else // cancel button is pressed
    {
        checkModifiedDocument();
		return false;
    }
}
Esempio n. 6
0
/*******************************************************************************
函数名称:         OnBnClickedButton1 点击浏览按钮
================================================================================
返回值:           void
--------------------------------------------------------------------------------
文件作者:				King.Sollyu					QQ:191067617
*******************************************************************************/
void CAddDlg::OnBnClickedButton1()
{
	CFileDialog fDlg(TRUE,TEXT("txt"),NULL,4|2,theApp.LoadStringFormId(ids_ui_add_filedlg_filer));
	if (fDlg.DoModal() == IDOK)
	{
		// 如果下拉菜单选择的为文件就直接输出文件路径
		// 负责就将选中的 文件名 改为 *
		if (m_ComboBox.GetCurSel() == 0)
		{
			SetDlgItemText(IDC_EDIT1,fDlg.GetPathName());
		}else 
		{
			CString strPathTemp;

			strPathTemp.Format(TEXT("%s\\*.%s"),fDlg.GetPathName().Left(fDlg.GetPathName().ReverseFind('\\')),fDlg.GetFileExt());
			SetDlgItemText(IDC_EDIT1,strPathTemp);
		}

	}
}
Esempio n. 7
0
void Notepad_plus::fileOpen()
{
	FileDialog fDlg(_pPublicInterface->getHSelf(), _pPublicInterface->getHinst());
	fDlg.setExtFilter(TEXT("All types"), TEXT(".*"), NULL);

	setFileOpenSaveDlgFilters(fDlg);

	BufferID lastOpened = BUFFER_INVALID;
	if (stringVector *pfns = fDlg.doOpenMultiFilesDlg())
	{
		size_t sz = pfns->size();
		for (size_t i = 0 ; i < sz ; i++) {
			BufferID test = doOpen(pfns->at(i).c_str(), fDlg.isReadOnly());
			if (test != BUFFER_INVALID)
				lastOpened = test;
		}
	}
	if (lastOpened != BUFFER_INVALID) {
		switchToFile(lastOpened);
	}
}
Esempio n. 8
0
bool Notepad_plus::fileRename(BufferID id)
{
	BufferID bufferID = id;
	if (id == BUFFER_INVALID)
		bufferID = _pEditView->getCurrentBufferID();
	Buffer * buf = MainFileManager->getBufferByID(bufferID);

	FileDialog fDlg(_pPublicInterface->getHSelf(), _pPublicInterface->getHinst());

	fDlg.setExtFilter(TEXT("All types"), TEXT(".*"), NULL);
	setFileOpenSaveDlgFilters(fDlg);

	fDlg.setDefFileName(buf->getFileName());
	TCHAR *pfn = fDlg.doSaveDlg();

	if (pfn)
	{
		MainFileManager->moveFile(bufferID, pfn);
	}
	return false;
}
Esempio n. 9
0
bool Notepad_plus::fileLoadSession(const TCHAR *fn)
{
	bool result = false;
	const TCHAR *sessionFileName = NULL;
	if (fn == NULL)
	{
		FileDialog fDlg(_pPublicInterface->getHSelf(), _pPublicInterface->getHinst());
		fDlg.setExtFilter(TEXT("All types"), TEXT(".*"), NULL);
		const TCHAR *ext = NppParameters::getInstance()->getNppGUI()._definedSessionExt.c_str();
		generic_string sessionExt = TEXT("");
		if (*ext != '\0')
		{
			if (*ext != '.')
				sessionExt += TEXT(".");
			sessionExt += ext;
			fDlg.setExtFilter(TEXT("Session file"), sessionExt.c_str(), NULL);
		}
		sessionFileName = fDlg.doOpenSingleFileDlg();
	}
	else
	{
		if (PathFileExists(fn))
			sessionFileName = fn;
	}

	if (sessionFileName)
	{
		bool isAllSuccessful = true;
		Session session2Load;

		if ((NppParameters::getInstance())->loadSession(&session2Load, sessionFileName))
		{
			isAllSuccessful = loadSession(&session2Load);
			result = true;
		}
		if (!isAllSuccessful)
			(NppParameters::getInstance())->writeSession(&session2Load, sessionFileName);
	}
	return result;
}
Esempio n. 10
0
void CFileSelectDlg::OnBnClickedButtonBrowse()
{
    // TODO: Add your control notification handler code here
    CString csEditText;
    m_edtFileName.GetWindowText(csEditText);

    int pos = csEditText.ReverseFind(_T('\\'));
    CString csDefName = _T("");
    if(pos != -1)
    {
        csDefName = csEditText.Right(csEditText.GetLength() - pos - 1);
        csDefName.Left(csDefName.GetLength() - 4);
    }
    static TCHAR szFilter[] = _T("LECTURNITY Source Documents (*.lsd)|*.lsd|All Files (*.*)|*.*||");
    CFileDialog fDlg(false, _T(".lsd"), /*NULL*/csDefName, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter);

    CString csLsdName;
    if(fDlg.DoModal() == IDOK)
    {
        m_edtFileName.SetWindowText(fDlg.GetPathName());
    }


}
Esempio n. 11
0
void CCY457OpenGLView::OnLoadspt() 
{
	char strFilter[]="(*.spt)|*.spt||";
	CFileDialog fDlg(1,"spt","*.spt",OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,strFilter);

	if(fDlg.DoModal()==IDOK)
	{
		CString sf=fDlg.GetPathName();
		FILE *fp=fopen(sf,"r");
		long float x,y,z,r11,r12,r13,r21,r22,r23,r31,r32,r33,tx,ty,tz;
		long float f,k,w,h,phi,omiga,kappa;
		fscanf(fp,"%lf",&f);
		fscanf(fp,"%lf",&k);

		fscanf(fp,"%lf %lf",&w,&h);
		fscanf(fp,"%lf %lf %lf",&x, &y, &z);
		fscanf(fp,"%lf %lf %lf",&phi,&omiga,&kappa);
		
		fscanf(fp,"%lf",&r11);
		fscanf(fp,"%lf",&r12);
		fscanf(fp,"%lf",&r13);
			
		fscanf(fp,"%lf",&r21);
		fscanf(fp,"%lf",&r22);
		fscanf(fp,"%lf",&r23);
			
		fscanf(fp,"%lf",&r31);
		fscanf(fp,"%lf",&r32);
		fscanf(fp,"%lf",&r33);
			
		fscanf(fp,"%lf",&tx);
		fscanf(fp,"%lf",&ty);
		fscanf(fp,"%lf",&tz);

		fclose(fp);

		////////////////////////////////

		float wx,wy,wz,ox,oy,oz;
		tx=-tx;
		ty=-ty;
		tz=1-tz;
		wx=r11*tx+r12*ty+r13*tz;
		wy=r21*tx+r22*ty+r23*tz;
		wz=r31*tx+r32*ty+r33*tz;
		ox=x-(z*(x-wx)/(z-wz));
		oy=y-(z*(y-wy)/(z-wz));
		oz=0.0;

		m_cameraData[m_cameraCount].x  = (float)y;
		m_cameraData[m_cameraCount].y  = (float)z;
		m_cameraData[m_cameraCount].z  = (float)x;
		m_cameraData[m_cameraCount].x0 = (float)oy;
		m_cameraData[m_cameraCount].y0 = (float)oz;
		m_cameraData[m_cameraCount].z0 = (float)ox;
		
		m_cameraCount++;
		m_camera=true;
	}
	
	InvalidateRect(NULL,FALSE);
}
Esempio n. 12
0
void qFacets::exportFacets()
{
	assert(m_app);
	if (!m_app)
		return;

	//disclaimer accepted?
	if (!ShowDisclaimer(m_app))
		return;

	//Retrive selected facets
	FacetSet facets;
	getFacetsInCurrentSelection(facets);

	if (facets.empty())
	{
		m_app->dispToConsole("Couldn't find any facet in the current selection!",ccMainAppInterface::ERR_CONSOLE_MESSAGE);
		return;
	}
	assert(!facets.empty());

	FacetsExportDlg fDlg(FacetsExportDlg::SHAPE_FILE_IO,m_app->getMainWindow());

	//persistent settings (default export path)
	QSettings settings;
	settings.beginGroup("qFacets");
	QString facetsSavePath = settings.value("exportPath",QApplication::applicationDirPath()).toString();
	fDlg.destinationPathLineEdit->setText(facetsSavePath + QString("/facets.shp"));

	if (!fDlg.exec())
		return;

	QString filename = fDlg.destinationPathLineEdit->text();

	//save current export path to persistent settings
	settings.setValue("exportPath",QFileInfo(filename).absolutePath());

	if (QFile(filename).exists())
	{
		//if the file already exists, ask for confirmation!
		if (QMessageBox::warning(m_app->getMainWindow(),"File already exists!","File already exists! Are you sure you want to overwrite it?",QMessageBox::Yes,QMessageBox::No) == QMessageBox::No)
			return;
	}

	//fields (shapefile) - WARNING names must not have more than 10 chars!
	ShpFilter::IntegerField  facetIndex("index");
	ShpFilter::DoubleField   facetSurface("surface");
	ShpFilter::DoubleField   facetRMS("rms");
	ShpFilter::IntegerField  facetDipDir("dip_dir");
	ShpFilter::IntegerField  facetDip("dip");
	ShpFilter::IntegerField  familyIndex("family_ind");
	ShpFilter::IntegerField  subfamilyIndex("subfam_ind");
	ShpFilter::DoubleField3D facetNormal("normal");
	ShpFilter::DoubleField3D facetBarycenter("center");
	ShpFilter::DoubleField   horizExtension("horiz_ext");
	ShpFilter::DoubleField   vertExtension("vert_ext");
	ShpFilter::DoubleField   surfaceExtension("surf_ext");

	size_t facetCount = facets.size();
	assert(facetCount != 0);
	try
	{
		facetIndex.values.reserve(facetCount);
		facetSurface.values.reserve(facetCount);
		facetRMS.values.reserve(facetCount);
		facetDipDir.values.reserve(facetCount);
		facetDip.values.reserve(facetCount);
		familyIndex.values.reserve(facetCount);
		subfamilyIndex.values.reserve(facetCount);
		facetNormal.values.reserve(facetCount);
		facetBarycenter.values.reserve(facetCount);
		horizExtension.values.reserve(facetCount);
		vertExtension.values.reserve(facetCount);
		surfaceExtension.values.reserve(facetCount);
	}
	catch (const std::bad_alloc&)
	{
		m_app->dispToConsole("Not enough memory!",ccMainAppInterface::ERR_CONSOLE_MESSAGE);
		return;
	}

	ccHObject toSave("facets");

	//depending on the 'main orientation', the job is more or less easy ;)
	bool useNativeOrientation = fDlg.nativeOriRadioButton->isChecked();
	bool useGlobalOrientation = fDlg.verticalOriRadioButton->isChecked();
	bool useCustomOrientation = fDlg.customOriRadioButton->isChecked();

	//Default base
	CCVector3 X(1,0,0), Y(0,1,0), Z(0,0,1);

	//'vertical' orientation (potentially specified by the user)
	if (!useNativeOrientation)
	{
		if (useCustomOrientation)
		{
			Z = CCVector3(	static_cast<PointCoordinateType>(fDlg.nXLineEdit->text().toDouble()),
							static_cast<PointCoordinateType>(fDlg.nYLineEdit->text().toDouble()),
							static_cast<PointCoordinateType>(fDlg.nZLineEdit->text().toDouble()) );
			Z.normalize();
		}
		else if (useGlobalOrientation)
		{
			//we compute the mean orientation (weighted by each facet's surface)
			CCVector3d Nsum(0,0,0);
			for (FacetSet::iterator it = facets.begin(); it != facets.end(); ++it)
			{
				double surf = (*it)->getSurface();
				CCVector3 N = (*it)->getNormal();
				Nsum.x += static_cast<double>(N.x) * surf;
				Nsum.y += static_cast<double>(N.y) * surf;
				Nsum.z += static_cast<double>(N.z) * surf;
			}
			Nsum.normalize();

			Z = CCVector3(	static_cast<PointCoordinateType>(Nsum.x),
							static_cast<PointCoordinateType>(Nsum.y),
							static_cast<PointCoordinateType>(Nsum.z) );
		}

		//update X & Y
		CCVector3 D = Z.cross(CCVector3(0,0,1));
		if (D.norm2() > ZERO_TOLERANCE) //otherwise the vertical dir hasn't changed!
		{
			X = -D;
			X.normalize();
			Y = Z.cross(X);
		}
	}

	//we compute the mean center (weighted by each facet's surface)
	CCVector3 C(0,0,0);
	{
		double weightSum = 0;
		for (FacetSet::iterator it = facets.begin(); it != facets.end(); ++it)
		{
			double surf = (*it)->getSurface();
			CCVector3 Ci = (*it)->getCenter();
			C += Ci * static_cast<PointCoordinateType>(surf);
			weightSum += surf;
		}
		if (weightSum)
			C /= static_cast<PointCoordinateType>(weightSum);
	}

	//determine the 'global' orientation matrix
	ccGLMatrix oriRotMat;
	oriRotMat.toIdentity();
	if (!useNativeOrientation)
	{
		oriRotMat.getColumn(0)[0] = static_cast<float>(X.x);
		oriRotMat.getColumn(0)[1] = static_cast<float>(X.y);
		oriRotMat.getColumn(0)[2] = static_cast<float>(X.z);
		oriRotMat.getColumn(1)[0] = static_cast<float>(Y.x);
		oriRotMat.getColumn(1)[1] = static_cast<float>(Y.y);
		oriRotMat.getColumn(1)[2] = static_cast<float>(Y.z);
		oriRotMat.getColumn(2)[0] = static_cast<float>(Z.x);
		oriRotMat.getColumn(2)[1] = static_cast<float>(Z.y);
		oriRotMat.getColumn(2)[2] = static_cast<float>(Z.z);
		oriRotMat.invert();

		ccGLMatrix transMat;
		transMat.setTranslation(-C);
		oriRotMat = oriRotMat * transMat;
		oriRotMat.setTranslation(oriRotMat.getTranslationAsVec3D() + C);
	}

	//for each facet
	for (FacetSet::iterator it=facets.begin(); it!=facets.end(); ++it)
	{
		ccFacet* facet = *it;
		ccPolyline* poly = facet->getContour();

		//if necessary, we create a (temporary) new facet
		if (!useNativeOrientation)
		{
			CCLib::GenericIndexedCloudPersist* vertices = poly->getAssociatedCloud();
			if (!vertices || vertices->size() < 3)
				continue;

			//create (temporary) new polyline
			ccPolyline* newPoly = new ccPolyline(*poly);
			ccPointCloud* pc = (newPoly ? dynamic_cast<ccPointCloud*>(newPoly->getAssociatedCloud()) : 0);
			if (pc)
			{
				pc->applyGLTransformation_recursive(&oriRotMat);
			}
			else
			{
				m_app->dispToConsole(QString("Failed to change the orientation of polyline '%1'! (not enough memory)").arg(poly->getName()),ccMainAppInterface::WRN_CONSOLE_MESSAGE);
				continue;
			}

			newPoly->set2DMode(true);
			poly = newPoly;
		}

		toSave.addChild(poly, useNativeOrientation ? ccHObject::DP_NONE : ccHObject::DP_PARENT_OF_OTHER);

		//save associated meta-data as 'shapefile' fields
		{
			//main parameters
			FacetMetaData data;
			GetFacetMetaData(facet, data);

			//horizontal and vertical extensions
			double horizExt = 0, vertExt = 0;
			ComputeFacetExtensions(data.normal,poly,horizExt,vertExt);

			facetIndex.values.push_back(data.facetIndex);
			facetSurface.values.push_back(data.surface);
			facetRMS.values.push_back(data.rms);
			facetDipDir.values.push_back(data.dipDir_deg);
			facetDip.values.push_back(data.dip_deg);
			familyIndex.values.push_back(data.familyIndex);
			subfamilyIndex.values.push_back(data.subfamilyIndex);
			facetNormal.values.push_back(CCVector3d(data.normal.x,data.normal.y,data.normal.z));
			facetBarycenter.values.push_back(CCVector3d(data.center.x,data.center.y,data.center.z));
			vertExtension.values.push_back(vertExt);
			horizExtension.values.push_back(horizExt);
			surfaceExtension.values.push_back(horizExt*vertExt);
		}
	}

	//save entities
	if (toSave.getChildrenNumber())
	{
		std::vector<ShpFilter::GenericField*> fields;
		fields.push_back(&facetIndex);
		fields.push_back(&facetBarycenter);
		fields.push_back(&facetNormal);
		fields.push_back(&facetRMS);
		fields.push_back(&horizExtension);
		fields.push_back(&vertExtension);
		fields.push_back(&surfaceExtension);
		fields.push_back(&facetSurface);
		fields.push_back(&facetDipDir);
		fields.push_back(&facetDip);
		fields.push_back(&familyIndex);
		fields.push_back(&subfamilyIndex);
		ShpFilter filter;
		filter.treatClosedPolylinesAsPolygons(true);
		ShpFilter::SaveParameters params;
		params.alwaysDisplaySaveDialog = false;
		if (filter.saveToFile(&toSave,fields,filename,params) == CC_FERR_NO_ERROR)
		{
			m_app->dispToConsole(QString("[qFacets] File '%1' successfully saved").arg(filename),ccMainAppInterface::STD_CONSOLE_MESSAGE);
		}
		else
		{
			m_app->dispToConsole(QString("[qFacets] Failed to save file '%1'!").arg(filename),ccMainAppInterface::WRN_CONSOLE_MESSAGE);
		}
	}
}
Esempio n. 13
0
void qFacets::exportFacetsInfo()
{
	assert(m_app);
	if (!m_app)
		return;

	//disclaimer accepted?
	if (!ShowDisclaimer(m_app))
		return;

	//Retrive selected facets
	FacetSet facets;
	getFacetsInCurrentSelection(facets);

	if (facets.empty())
	{
		m_app->dispToConsole("Couldn't find any facet in the current selection!",ccMainAppInterface::ERR_CONSOLE_MESSAGE);
		return;
	}
	assert(!facets.empty());

	FacetsExportDlg fDlg(FacetsExportDlg::ASCII_FILE_IO, m_app->getMainWindow());
	fDlg.orientationGroupBox->setEnabled(false);

	//persistent settings (default export path)
	QSettings settings;
	settings.beginGroup("qFacets");
	QString facetsSavePath = settings.value("exportPath", QApplication::applicationDirPath()).toString();
	fDlg.destinationPathLineEdit->setText(facetsSavePath + QString("/facets.csv"));

	if (!fDlg.exec())
		return;

	QString filename = fDlg.destinationPathLineEdit->text();

	//save current export path to persistent settings
	settings.setValue("exportPath", QFileInfo(filename).absolutePath());

	QFile outFile(filename);
	if (outFile.exists())
	{
		//if the file already exists, ask for confirmation!
		if (QMessageBox::warning(	m_app->getMainWindow(),
									"Overwrite",
									"File already exists! Are you sure you want to overwrite it?",
									QMessageBox::Yes,
									QMessageBox::No) == QMessageBox::No)
			return;
	}

	//open CSV file
	if (!outFile.open(QFile::WriteOnly | QFile::Text))
	{
		m_app->dispToConsole(QString("Failed to open file for writing! Check available space and access rights"), ccMainAppInterface::ERR_CONSOLE_MESSAGE);
		return;
	}

	//write header
	QTextStream outStream(&outFile);
	outStream << "Index;";
	outStream << " CenterX;";
	outStream << " CenterY;";
	outStream << " CenterZ;";
	outStream << " NormalX;";
	outStream << " NormalY;";
	outStream << " NormalZ;";
	outStream << " RMS;";
	outStream << " Horiz_ext;";
	outStream << " Vert_ext;";
	outStream << " Surf_ext;";
	outStream << " Surface;";
	outStream << " Dip dir.;";
	outStream << " Dip;";
	outStream << " Family ind.;";
	outStream << " Subfamily ind.;";
	outStream << " \n";

	//write data (one line per facet)
	for (FacetSet::iterator it=facets.begin(); it!=facets.end(); ++it)
	{
		ccFacet* facet = *it;
		FacetMetaData data;
		GetFacetMetaData(facet, data);
		//horizontal and vertical extensions
		double horizExt = 0, vertExt = 0;
		ComputeFacetExtensions(data.normal, facet->getContour(), horizExt, vertExt);

		outStream << data.facetIndex << ";";
		outStream << data.center.x << ";" << data.center.y << ";" << data.center.z << ";";
		outStream << data.normal.x << ";" << data.normal.y << ";" << data.normal.z << ";";
		outStream << data.rms << ";";
		outStream << horizExt << ";";
		outStream << vertExt << ";";
		outStream << horizExt*vertExt << ";";
		outStream << data.surface << ";";
		outStream << data.dipDir_deg << ";";
		outStream << data.dip_deg << ";";
		outStream << data.familyIndex << ";";
		outStream << data.subfamilyIndex << ";";
		outStream << "\n";
	}

	outFile.close();

	m_app->dispToConsole(QString("[qFacets] File '%1' succesfully saved").arg(filename),ccMainAppInterface::STD_CONSOLE_MESSAGE);
}
Esempio n. 14
0
void CTempDirPage::OnBrowse() 
{
	UpdateData();
	UpdateData(FALSE);
	CFileDialog fDlg(TRUE, NULL, NULL,  
		OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_NONETWORKBUTTON | OFN_PATHMUSTEXIST,
		LoadStringResource(IDS_TEXT_EDITOR_FILTER), this,
		MainFrame()->m_osVer.dwMajorVersion < 5 ? OPENFILENAME_SIZE_VERSION_400 : sizeof(OPENFILENAME)); 
	
	TCHAR buf[MAX_PATH];
	// Zero 1st char so commdlg knows we aren't providing a default filename
	buf[0]=_T('\0');  

    fDlg.m_ofn.lpstrFile= buf; 
	fDlg.m_ofn.nMaxFile= MAX_PATH; 

	// Set the dlg caption
    CString title = LoadStringResource(IDS_SELECT_DEFAULT_TEXT_EDITOR_CAPTION);
	fDlg.m_ofn.lpstrTitle = title;
	// We dont need no stinking file title
	fDlg.m_ofn.lpstrFileTitle=NULL;
	
	// Set the initial directory
	CString initDir = _T("\\");
	fDlg.m_ofn.lpstrInitialDir=initDir;

	fDlg.m_ofn.lpstrCustomFilter= NULL;

	// Set filter index
	fDlg.m_ofn.nFilterIndex=1;
	
	int retcode=fDlg.DoModal();

	if(retcode == IDOK)
	{
		m_AltExpl = fDlg.GetPathName() + _T(' ');
	}
	else
	{
		CString errorTxt;
		if(retcode == IDCANCEL)  // an error
		{
			DWORD exError=CommDlgExtendedError();
			if(exError != 0)
				errorTxt.FormatMessage(IDS_EXTENDED_ERROR_n_IN_FILEDIALOG, exError);
		}
		else
		{
			DWORD error=GetLastError();
			if(error)
			{
				LPVOID lpMsgBuf;
				FormatMessage( 
					FORMAT_MESSAGE_ALLOCATE_BUFFER | 
					FORMAT_MESSAGE_FROM_SYSTEM | 
					FORMAT_MESSAGE_IGNORE_INSERTS,
					NULL,
					error,
					MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
					(LPTSTR) &lpMsgBuf,
					0,
					NULL 
				);
				errorTxt = (TCHAR *)lpMsgBuf;
			}
			else
				errorTxt=LoadStringResource(IDS_UNKNOWN_FILEDIALOG_ERROR);
		}
		if(errorTxt.GetLength() > 0)
			AfxMessageBox(errorTxt, MB_ICONSTOP);
	}
	UpdateData(FALSE);
}
Esempio n. 15
0
void CBookmarks::OnExport() 
{
	CFileDialog fDlg(FALSE, NULL, NULL,  
		OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_NONETWORKBUTTON,
		LoadStringResource(IDS_TOOLS_EXPORT_FILTER), this,
		MainFrame()->m_osVer.dwMajorVersion < 5 ? OPENFILENAME_SIZE_VERSION_400 : sizeof(OPENFILENAME)); 
	
	TCHAR buf[LONGPATH+1];

	lstrcpy(buf, LoadStringResource(IDS_BKMK_EXPORT_DEFAULT_FILE));  

    fDlg.m_ofn.lpstrFile= buf; 
	fDlg.m_ofn.nMaxFile= LONGPATH; 

	// Set the dlg caption
    CString title = LoadStringResource(IDS_BKMK_EXPORT_TITLE);
	fDlg.m_ofn.lpstrTitle=title;
	// We dont need no stinking file title
	fDlg.m_ofn.lpstrFileTitle=NULL;
	
	// Set the initial directory
	fDlg.m_ofn.lpstrInitialDir=GET_P4REGPTR()->GetTempDir();

	// Set the user defined filter
	TCHAR customFilterBuf[512] = _T("");
	fDlg.m_ofn.lpstrCustomFilter= customFilterBuf;
	fDlg.m_ofn.nMaxCustFilter=512;

	CString errorTxt;
	int retcode=fDlg.DoModal();

	if(retcode == IDOK)
	{
		CString filename = fDlg.GetPathName();
		HANDLE hExportFile;

		if ((hExportFile=CreateFile(filename, GENERIC_READ | GENERIC_WRITE, 
					FILE_SHARE_READ, 0, CREATE_ALWAYS, 0, 0)) == INVALID_HANDLE_VALUE)
		{
			DWORD exError=GetLastError();
			errorTxt.FormatMessage(IDS_TOOLS_EXPORT_WRITE_ERROR_s_n, filename, exError);
		}
		else
		{
			DWORD NumberOfBytesWritten;

#ifdef UNICODE
			TCHAR uhdr[] = {0xFEFF};
			WriteFile(hExportFile, uhdr, 2, &NumberOfBytesWritten, NULL);
#endif
			CString recd = _T("<P4Win Bookmarks>\r\n");
			WriteFile(hExportFile, recd, recd.GetLength()*sizeof(TCHAR), &NumberOfBytesWritten, NULL);
			recd.FormatMessage(IDS_BKMK_IMPORTED_FROM_USER, GET_P4REGPTR()->GetP4User());
			WriteFile(hExportFile, recd, recd.GetLength()*sizeof(TCHAR), &NumberOfBytesWritten, NULL);

			int i, n;
			CString txt;
			CString desc;

			UpdateData();
			for (i = -1; ++i < MAX_BOOKMARKS; )
			{
				if (m_BkMkMenuName[i].GetLength() == 0)
					continue;
				if ((n = m_BkMkMenuName[i].Find(_T('\t'))) != -1)
				{
					txt = m_BkMkMenuName[i].Left(n);
					desc = m_BkMkMenuName[i].Mid(n+1);
					if (!desc.IsEmpty())
						txt += _T(" #") + desc;
				}
				else
				{
					txt = m_BkMkMenuName[i];
				}
				if (m_BkMkIsSubMenu[i])
					recd.FormatMessage(IDS_EXPORT_SUBMENU, txt);
				else
					recd.FormatMessage(IDS_EXPORT_ITEM, txt);
				WriteFile(hExportFile, recd, recd.GetLength()*sizeof(TCHAR), &NumberOfBytesWritten, NULL);
			}
			CloseHandle(hExportFile);
			recd.FormatMessage(IDS_BKMK_EXPORT_TOOLS_EXPORTED_TO_s, filename);
			MainFrame()->AddToStatusLog(recd, SV_COMPLETION);
		}
	}
}
Esempio n. 16
0
void ProjectPanel::popupMenuCmd(int cmdID)
{
    // get selected item handle
    HTREEITEM hTreeItem = _treeView.getSelection();
    if (!hTreeItem)
        return;

    switch (cmdID)
    {
    //
    // Toolbar menu buttons
    //
    case IDB_PROJECT_BTN:
    {
        POINT p = getMenuDisplayPoint(0);
        TrackPopupMenu(_hWorkSpaceMenu, TPM_LEFTALIGN, p.x, p.y, 0, _hSelf, NULL);
    }
    break;

    case IDB_EDIT_BTN:
    {
        POINT p = getMenuDisplayPoint(1);
        HMENU hMenu = NULL;
        NodeType nodeType = getNodeType(hTreeItem);
        if (nodeType == nodeType_project)
            hMenu = _hProjectMenu;
        else if (nodeType == nodeType_folder)
            hMenu = _hFolderMenu;
        else if (nodeType == nodeType_file)
            hMenu = _hFileMenu;
        if (hMenu)
            TrackPopupMenu(hMenu, TPM_LEFTALIGN, p.x, p.y, 0, _hSelf, NULL);
    }
    break;

    //
    // Toolbar menu commands
    //
    case IDM_PROJECT_NEWPROJECT :
    {
        HTREEITEM root = _treeView.getRoot();

        NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
        generic_string newProjectLabel = pNativeSpeaker->getAttrNameStr(PM_NEWPROJECTNAME, "ProjectManager", "NewProjectName");
        HTREEITEM addedItem = _treeView.addItem(newProjectLabel.c_str(),  root, INDEX_PROJECT);
        setWorkSpaceDirty(true);
        _treeView.expand(hTreeItem);
        TreeView_EditLabel(_treeView.getHSelf(), addedItem);
    }
    break;

    case IDM_PROJECT_NEWWS :
    {
        if (_isDirty)
        {
            int res = ::MessageBox(_hSelf, TEXT("The current workspace was modified. Do you want to save the current project?"), TEXT("New Workspace"), MB_YESNOCANCEL | MB_ICONQUESTION | MB_APPLMODAL);
            if (res == IDYES)
            {
                if (!saveWorkSpace())
                    return;
            }
            else if (res == IDNO)
            {
                // Don't save so do nothing here
            }
            else if (res == IDCANCEL)
            {
                // User cancels action "New Workspace" so we interrupt here
                return;
            }
        }
        _treeView.removeAllItems();
        newWorkSpace();
    }
    break;

    case IDM_PROJECT_RENAME :
        TreeView_EditLabel(_treeView.getHSelf(), hTreeItem);
        break;

    case IDM_PROJECT_NEWFOLDER :
    {
        NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
        generic_string newFolderLabel = pNativeSpeaker->getAttrNameStr(PM_NEWFOLDERNAME, "ProjectManager", "NewFolderName");
        addFolder(hTreeItem, newFolderLabel.c_str());
        setWorkSpaceDirty(true);
    }
    break;

    case IDM_PROJECT_MOVEDOWN :
    {
        if (_treeView.moveDown(hTreeItem))
            setWorkSpaceDirty(true);
    }
    break;

    case IDM_PROJECT_MOVEUP :
    {
        if (_treeView.moveUp(hTreeItem))
            setWorkSpaceDirty(true);
    }
    break;

    case IDM_PROJECT_ADDFILES :
    {
        addFiles(hTreeItem);
        if (getNodeType(hTreeItem) == nodeType_folder)
            _treeView.setItemImage(hTreeItem, INDEX_OPEN_NODE, INDEX_OPEN_NODE);
    }
    break;

    case IDM_PROJECT_ADDFILESRECUSIVELY :
    {
        addFilesFromDirectory(hTreeItem);
        if (getNodeType(hTreeItem) == nodeType_folder)
            _treeView.setItemImage(hTreeItem, INDEX_OPEN_NODE, INDEX_OPEN_NODE);
    }
    break;

    case IDM_PROJECT_OPENWS:
    {
        if (_isDirty)
        {
            int res = ::MessageBox(_hSelf, TEXT("The current workspace was modified. Do you want to save the current project?"), TEXT("Open Workspace"), MB_YESNOCANCEL | MB_ICONQUESTION | MB_APPLMODAL);
            if (res == IDYES)
            {
                if (!saveWorkSpace())
                    return;
            }
            else if (res == IDNO)
            {
                // Don't save so do nothing here
            }
            else if (res == IDCANCEL)
            {
                // User cancels action "New Workspace" so we interrupt here
                return;
            }
        }

        FileDialog fDlg(_hSelf, ::GetModuleHandle(NULL));
        fDlg.setExtFilter(TEXT("All types"), TEXT(".*"), NULL);
        if (TCHAR *fn = fDlg.doOpenSingleFileDlg())
        {
            if (!openWorkSpace(fn))
            {
                ::MessageBox(_hSelf, TEXT("The workspace could not be opened.\rIt seems the file to open is not a valid project file."), TEXT("Open Workspace"), MB_OK);
                return;
            }
        }
    }
    break;

    case IDM_PROJECT_RELOADWS:
    {
        if (_isDirty)
        {
            int res = ::MessageBox(_hSelf, TEXT("The current workspace was modified. Reloading will discard all modifications.\rDo you want to continue?"), TEXT("Reload Workspace"), MB_YESNO | MB_ICONQUESTION | MB_APPLMODAL);
            if (res == IDYES)
            {
                // Do nothing
            }
            else if (res == IDNO)
            {
                return;
            }
        }

        if (::PathFileExists(_workSpaceFilePath.c_str()))
        {
            openWorkSpace(_workSpaceFilePath.c_str());
        }
        else
        {
            ::MessageBox(_hSelf, TEXT("Cannot find the file to reload."), TEXT("Reload Workspace"), MB_OK | MB_ICONEXCLAMATION | MB_APPLMODAL);
        }
    }
    break;

    case IDM_PROJECT_SAVEWS:
        saveWorkSpace();
        break;

    case IDM_PROJECT_SAVEACOPYASWS:
    case IDM_PROJECT_SAVEASWS:
    {
        saveWorkSpaceAs(cmdID == IDM_PROJECT_SAVEACOPYASWS);
    }
    break;

    case IDM_PROJECT_DELETEFOLDER :
    {
        HTREEITEM parent = _treeView.getParent(hTreeItem);

        if (_treeView.getChildFrom(hTreeItem) != NULL)
        {
            TCHAR str2display[MAX_PATH] = TEXT("All the sub-items will be removed.\rAre you sure you want to remove this folder from the project?");
            if (::MessageBox(_hSelf, str2display, TEXT("Remove folder from project"), MB_YESNO) == IDYES)
            {
                _treeView.removeItem(hTreeItem);
                setWorkSpaceDirty(true);
            }
        }
        else
        {
            _treeView.removeItem(hTreeItem);
            setWorkSpaceDirty(true);
        }
        if (getNodeType(parent) == nodeType_folder)
            _treeView.setItemImage(parent, INDEX_CLOSED_NODE, INDEX_CLOSED_NODE);
    }
    break;

    case IDM_PROJECT_DELETEFILE :
    {
        HTREEITEM parent = _treeView.getParent(hTreeItem);

        TCHAR str2display[MAX_PATH] = TEXT("Are you sure you want to remove this file from the project?");
        if (::MessageBox(_hSelf, str2display, TEXT("Remove file from project"), MB_YESNO) == IDYES)
        {
            _treeView.removeItem(hTreeItem);
            setWorkSpaceDirty(true);
            if (getNodeType(parent) == nodeType_folder)
                _treeView.setItemImage(parent, INDEX_CLOSED_NODE, INDEX_CLOSED_NODE);
        }
    }
    break;

    case IDM_PROJECT_MODIFYFILEPATH :
    {
        FileRelocalizerDlg fileRelocalizerDlg;
        fileRelocalizerDlg.init(_hInst, _hParent);

        TCHAR textBuffer[MAX_PATH];
        TVITEM tvItem;
        tvItem.hItem = hTreeItem;
        tvItem.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
        tvItem.pszText = textBuffer;
        tvItem.cchTextMax = MAX_PATH;

        SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0,(LPARAM)&tvItem);
        if (!tvItem.lParam)
            return;
        generic_string * fn = (generic_string *)tvItem.lParam;

        if (fileRelocalizerDlg.doDialog(fn->c_str()) == 0)
        {
            generic_string newValue = fileRelocalizerDlg.getFullFilePath();
            if (*fn == newValue)
                return;

            *fn = newValue;
            TCHAR *strValueLabel = ::PathFindFileName(fn->c_str());
            lstrcpy(textBuffer, strValueLabel);
            int iImage = ::PathFileExists(fn->c_str())?INDEX_LEAF:INDEX_LEAF_INVALID;
            tvItem.iImage = tvItem.iSelectedImage = iImage;
            SendMessage(_treeView.getHSelf(), TVM_SETITEM, 0,(LPARAM)&tvItem);
            setWorkSpaceDirty(true);
        }
    }
    break;
    }
}
Esempio n. 17
0
void CBookmarks::OnImport() 
{
	BOOL foundHdr = FALSE;
	int nbradded = 0;

	CFileDialog fDlg(TRUE, NULL, NULL,  
		OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_NONETWORKBUTTON,
		LoadStringResource(IDS_TOOLSDLG_READ_CUSTOM_TOOLS_FILTER), this,
		MainFrame()->m_osVer.dwMajorVersion < 5 ? OPENFILENAME_SIZE_VERSION_400 : sizeof(OPENFILENAME)); 
	
	TCHAR buf[LONGPATH+1];

	lstrcpy(buf, LoadStringResource(IDS_BKMK_EXPORT_DEFAULT_FILE));  

    fDlg.m_ofn.lpstrFile= buf; 
	fDlg.m_ofn.nMaxFile= LONGPATH; 

	// Set the dlg caption
    CString title = LoadStringResource(IDS_BKMKSDLG_READ_BKMKS_TITLE);
	fDlg.m_ofn.lpstrTitle = title;
	// We dont need no stinking file title
	fDlg.m_ofn.lpstrFileTitle=NULL;
	
	// Set the initial directory
	fDlg.m_ofn.lpstrInitialDir=GET_P4REGPTR()->GetTempDir();

	// Set the user defined filter
	TCHAR customFilterBuf[512] = _T("");
	fDlg.m_ofn.lpstrCustomFilter= customFilterBuf;
	fDlg.m_ofn.nMaxCustFilter=512;

	CString errorTxt;
	int retcode=fDlg.DoModal();

	if(retcode == IDOK)
	{
		CString filename = fDlg.GetPathName();
		HANDLE hImportFile;

		if ((hImportFile=CreateFile(filename, GENERIC_READ, 
					FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0)) == INVALID_HANDLE_VALUE)
		{
			errorTxt.FormatMessage(IDS_TOOLSDLG_READ_CUSTOM_TOOLS_READ_ERROR_s, filename);
		}
		else
		{
			int bkmknbr;
			for (bkmknbr=MAX_BOOKMARKS; bkmknbr--; )
			{
				if (!m_BkMkMenuName[bkmknbr].IsEmpty())
					break;
			}
			DWORD NumberOfBytesRead;
			DWORD fsize = GetFileSize(hImportFile, NULL);
			HGLOBAL hText= ::GlobalAlloc(GMEM_SHARE | GMEM_ZEROINIT, fsize+4);
			LPTSTR pStr= (LPTSTR) ::GlobalLock( hText );
			LPTSTR p;

			if (ReadFile(hImportFile, pStr, fsize, &NumberOfBytesRead, NULL))
			{
				int i, n;
#ifdef UNICODE
				if (*pStr == 0xFEFF)
					 pStr++;
				else
				{
					HGLOBAL h= ::GlobalAlloc(GMEM_SHARE | GMEM_ZEROINIT, fsize*2+4);
					LPWSTR pUTF= (LPWSTR) ::GlobalLock( h );
					MultiByteToWideChar(CP_ACP, 0, (LPCSTR)pStr, -1, pUTF, fsize*2+4);
					pStr = pUTF;
					::GlobalUnlock( hText );
					::GlobalFree( hText );
					hText = h;
				}
#else
				if ((unsigned char)*pStr == (unsigned char)0xFF 
				 && (unsigned char)*(pStr+1) == (unsigned char)0xFE)
				{
					AfxMessageBox(IDS_UNABLE_TO_IMPORT_UNICODE_FILE);
					::GlobalUnlock( hText );
					::GlobalFree( hText );
					CloseHandle(hImportFile);
					return;
				}
#endif
				TCHAR header[] = _T("<P4Win Bookmarks>");
				if (_tcsncmp(header, pStr, (sizeof(header)-1)/sizeof(TCHAR)))
				{
					CString msg;
					msg.FormatMessage(IDS_MISSING_HDR_ON_IMPORT, CString(pStr).Left(60));
					if (IDYES != AfxMessageBox(msg, MB_YESNO|MB_ICONQUESTION))
					{
						::GlobalUnlock( hText );
						::GlobalFree( hText );
						CloseHandle(hImportFile);
						return;
					}
				}
				else
				{
					pStr += sizeof(header)/sizeof(TCHAR);
					while (*pStr < ' ' && *pStr)
						*pStr++;
				}
				while (*pStr)
				{
					if (++bkmknbr >= MAX_BOOKMARKS)
					{
						errorTxt.FormatMessage(IDS_BKMKSDLG_READ_BKMKS_TOO_MANY_BKMKS_s, pStr);
						break;
					}
					if (*pStr == _T('#'))
					{
						m_BkMkIsSubMenu[bkmknbr] = foundHdr = TRUE;
						p = ++pStr;
						while (*pStr != _T('\r'))
						{
							if ((unsigned)*pStr < (unsigned)_T(' '))
								*pStr = _T(' ');
							pStr++;
						}
						if (m_1stSubmenu > bkmknbr)
							m_1stSubmenu = bkmknbr;
					}
					else
					{
						if (!foundHdr)
						{
							CString msg;
							msg.FormatMessage(IDS_MISSING_HDR_ON_IMPORT, CString(pStr).Left(60));
							if (IDYES != AfxMessageBox(msg, MB_YESNO|MB_ICONQUESTION))
							{
								::GlobalUnlock( hText );
								::GlobalFree( hText );
								CloseHandle(hImportFile);
								return;
							}
							foundHdr = TRUE;
						}
						m_BkMkIsSubMenu[bkmknbr] = FALSE;
						p = pStr;
						BOOL bGotHash = FALSE;
						BOOL bInQuote = *pStr == _T('\"') ? TRUE : FALSE;
						if (bInQuote)
							*pStr++;
						while (*pStr != _T('\r'))
						{
							if ((unsigned)*pStr < (unsigned)_T(' '))
								*pStr = _T(' ');
							if (!bInQuote)
							{
								if (!bGotHash && (*pStr == _T(' ')) && (*(pStr+1) == _T('#')))
									lstrcpy(pStr, pStr+1);
								if (!bGotHash && (*pStr == _T('#')))
								{
									*pStr = _T('\t');
									bGotHash = TRUE;
								}
							}
							else if (*pStr == _T('\"'))
								bInQuote = FALSE;
							pStr++;
						}
					}
					*pStr = _T('\0');
					if (*p)
						m_BkMkMenuName[bkmknbr] = p;
					while (*++pStr != _T('\n'))
						;
					++pStr;
					if (((n = m_BkMkMenuName[bkmknbr].FindOneOf(_T("@#"))) != -1)
					 && (((i = m_BkMkMenuName[bkmknbr].Find(_T('\t'))) == -1) || (n < i)))
					{
						CString txt;
						txt.FormatMessage(IDS_BKMK_INVALID_CHAR_s, m_BkMkMenuName[bkmknbr]);
						MainFrame()->AddToStatusLog(txt, SV_WARNING);
						m_BkMkMenuName[bkmknbr--].Empty();
					}
					else if (*p)
						++nbradded;
				}
				if (nbradded)
				{
					CString txt;
					txt.FormatMessage(IDS_BKMK_READ_BKMKS_n_BKMKS_ADDED_FROM_s, nbradded, filename);
					MainFrame()->AddToStatusLog(txt, SV_COMPLETION);
					LoadMenuItemList();
				}
			}
			else
				errorTxt.FormatMessage(IDS_TOOLSDLG_READ_CUSTOM_TOOLS_READ_ERROR_s, filename);
			::GlobalUnlock( hText );
			::GlobalFree( hText );
			CloseHandle(hImportFile);
		}
	}
	else if(retcode == IDCANCEL)  // an error
	{
		DWORD exError=CommDlgExtendedError();
		if(exError != 0)
			errorTxt.FormatMessage(IDS_EXTENDED_ERROR_n_IN_FILEDIALOG, exError);
	}
	else
	{
		DWORD error=GetLastError();
		if(error)
		{
			LPVOID lpMsgBuf;
			FormatMessage( 
				FORMAT_MESSAGE_ALLOCATE_BUFFER | 
				FORMAT_MESSAGE_FROM_SYSTEM | 
				FORMAT_MESSAGE_IGNORE_INSERTS,
				NULL,
				error,
				MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
				(LPTSTR) &lpMsgBuf,
				0,
				NULL 
			);
			errorTxt = (TCHAR *)lpMsgBuf;
		}
		else
			errorTxt=LoadStringResource(IDS_UNKNOWN_FILEDIALOG_ERROR);
	}

	if(errorTxt.GetLength() > 0)
		AfxMessageBox(errorTxt, MB_ICONSTOP);
}