Exemplo n.º 1
0
void CFileView::OnFileNew()
{
	CMultiDocTemplate* pUIDocTemplate = theApp.GetUIDocTemplate();
	CDocument* pDoc = pUIDocTemplate->OpenDocumentFile(NULL);
	CString strFilePath = CGlobalVariable::m_strProjectPath + pDoc->GetTitle() + _T(".xml");
	pDoc->DoSave(strFilePath);
	HTREEITEM hSelectedItem = m_wndFileView.GetSelectedItem();
	DWORD dwInfo = m_wndFileView.GetItemData(hSelectedItem);
	HTREEITEM hParent = (dwInfo != INFO_FILE) ? hSelectedItem : m_wndFileView.GetParentItem(hSelectedItem);
	HTREEITEM hNewItem = m_wndFileView.InsertItem(pDoc->GetTitle(), 2, 2, hParent);
	m_wndFileView.SetItemData(hNewItem, INFO_FILE);
	m_wndFileView.Expand(hParent, TVE_EXPAND);
}
Exemplo n.º 2
0
void OpConvertFileFormats::Do(OpDescriptor*)
{
	ERROR3 ("Please read the following comments BEFORE using this op!");	// comment this out to use the op

////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
	
	// set up the search path, file util allows us just to pass the path/*.xar
	String_256 SearchPath = TEXT ("d:\\clipart\\xara\\");		// YOU MUST CHANGE THIS PATH
	
	String_256 FileSpecifier = SearchPath;						// YOU MUST CHANGE THIS EXTENSION
				FileSpecifier += TEXT("*.art");
	String_256 FileSpecifier2 = TEXT("xar");					// YOU MUST CHANGE THIS EXTENSION

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

	BOOL ok = FileUtil::StartFindingFiles(&FileSpecifier);
	active = TRUE;
	String_256 Filename;
	while (ok)
	{
		// fileutil will give us the next filename
		ok = FileUtil::FindNextFile(&Filename);
		String_256 FilePath = SearchPath;
		FilePath += Filename;
		PathName Path (FilePath);

		if (ok)
		{
			CDocument* pDoc = theApp.OpenDocumentFile((TCHAR*)FilePath);
			if (pDoc!=NULL)
			{
				// Make sure that the files name is sensible
				theApp.MakeDocumentNative(pDoc, &Path);
				
				Path.SetType (FileSpecifier2);
				String_256 newPath = Path.GetPath ();
				pDoc->DoSave ((TCHAR*) newPath, TRUE);

				FileCloseAction ();
			}
		}
	}
	active = FALSE;
	FileUtil::StopFindingFiles ();
}