本文整理汇总了C++中Application::GetTemplateManager方法的典型用法代码示例。如果您正苦于以下问题:C++ Application::GetTemplateManager方法的具体用法?C++ Application::GetTemplateManager怎么用?C++ Application::GetTemplateManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application
的用法示例。
在下文中一共展示了Application::GetTemplateManager方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Do
void OpMenuSave::Do(OpDescriptor* pOpDesc)
{
//First get the selected document
Document* pdocToSave=Document::GetSelected();
CCamDoc* pccamdocToSave = pdocToSave->GetOilDoc();
if (pdocToSave==NULL || pccamdocToSave==NULL)
{
ERROR2RAW("No default document!");
return;
}
//And we'll need a pointer to the application
Application* pCamelot = GetApplication();
CTemplateManager& TemplateManager( pCamelot->GetTemplateManager() );
//And put the default templates path in the dialog
PathName pathToPutInDialog = TemplateManager.GetTemplatesPath();
FileUtil::RecursiveCreateDirectory( pathToPutInDialog.GetPath() );
//Now create the dialog
SaveTemplateDialog dialogToDisplay(pathToPutInDialog);
//And show it
if (dialogToDisplay.ShowModal() == wxID_OK)
{
//Then get the path they specified, using this amazingly bad, confusing and
//undocumented file dialog code
//The "CString" reference should ideally go in Winoil
PathName pathToSaveTo;
dialogToDisplay.GetChosenFileName(&pathToSaveTo);
wxString cstrPathToSaveTo=pathToSaveTo.GetPath(FALSE);
dialogToDisplay.AppendExtension(&cstrPathToSaveTo);
String_256 strPathToSaveTo=cstrPathToSaveTo;
pathToSaveTo=strPathToSaveTo;
// Create the save file.
CCDiskFile file(pathToSaveTo, ios::out | ios::binary | ios::trunc);
// First find the filter.
Filter *pFilter = FindFilter ( FILTERID_NATIVE );
// Tell it to save attributes.
pFilter->SetSaveAttributes ( TRUE );
// Then save the image to the file.
Save ( pFilter, &file );
//Now, if we should make that path the default path
if (SaveTemplateDialog::m_fUseAsDefault)
{
if (pdocToSave->IsAnimated())
{
CTemplateManager::SetDefaultAnimationTemplate( strPathToSaveTo );
}
else
{
CTemplateManager::SetDefaultDrawingTemplate( strPathToSaveTo );
}
}
if (SaveTemplateDialog::m_fDefaultTemplatesFolder)
{
String_256 strDefaultPath = pathToSaveTo.GetLocation( TRUE );
CTemplateManager::SetTemplatesPath( strDefaultPath );
}
}
// Finished the operation
End();
}