📄 templatesdlg.cpp
字号:
m_cylinder_template_btn.EnableWindow(FALSE);
m_stairs_template_btn.EnableWindow(FALSE);
m_arch_template_btn.EnableWindow(FALSE);
m_cone_template_btn.EnableWindow(FALSE);
m_prefabButton.EnableWindow(FALSE);
m_prefabList.EnableWindow(FALSE);
m_currentPrefabName.EnableWindow(FALSE);
m_entitiesButton.EnableWindow (FALSE);
m_entitiesCombo.EnableWindow(FALSE);
m_templateApplyBtn.EnableWindow(FALSE);
m_skyBtn.EnableWindow(FALSE);
// disable object placement button
// m_PlaceObjectButton.EnableWindow( FALSE );
}
// Restore focus to active view
CMDIChildWnd *pMDIChild =(CMDIChildWnd *)pDoc->mpMainFrame->MDIGetActive();
if(pMDIChild)
{
CView *cv =(CView *)pMDIChild->GetActiveView();
if( cv)
cv->SetFocus();
}
return true;
}
void CTemplatesDlg::OnButtonSphere()
{
// AfxMessageBox("Sphere Template Button Selected");
// m_pDoc = CGlobals::GetActiveDocument();
if (m_pDoc->mpMainFrame->m_createSpheroidDialog.m_hWnd == NULL) // post 0.55
m_pDoc->CreateSpheroid();
}
void CTemplatesDlg::OnButtonCube()
{
// AfxMessageBox("Cube Template Button Selected");
// m_pDoc = CGlobals::GetActiveDocument();
if (m_pDoc->mpMainFrame->m_createBoxDialog.m_hWnd == NULL) // post 0.55
m_pDoc->CreateCube();
}
void CTemplatesDlg::OnButtonCylinder()
{
// AfxMessageBox("Cylinder Template Button Selected");
// m_pDoc = CGlobals::GetActiveDocument();
if (m_pDoc->mpMainFrame->m_createCylDialog.m_hWnd == NULL) // post 0.55
m_pDoc->CreateCylinder();
}
void CTemplatesDlg::OnButtonStairs()
{
// AfxMessageBox("Stairs Template Button Selected");
// m_pDoc = CGlobals::GetActiveDocument();
if (m_pDoc->mpMainFrame->m_createStaircaseDialog.m_hWnd == NULL) // post 0.55
m_pDoc->CreateStaircase();
}
void CTemplatesDlg::OnButtonCone()
{
// AfxMessageBox("Cone Template Button Selected");
// m_pDoc = CGlobals::GetActiveDocument();
if (m_pDoc->mpMainFrame->m_createConeDialog.m_hWnd == NULL) // post 0.55
m_pDoc->CreateCone();
}
void CTemplatesDlg::OnButtonArch()
{
// AfxMessageBox("Arch Template Button Selected");
// m_pDoc = CGlobals::GetActiveDocument();
if (m_pDoc->mpMainFrame->m_createArchDialog.m_hWnd == NULL) // post 0.55
m_pDoc->CreateArch();
}
/*
void CTemplatesDlg::SetupPrefabList()
{
// add object names to the object combo box
// int NumObjectsAdded = 0; // counts the number of library objects that were added to
// the combo box
char ObjectsDir[MAX_PATH];
const char *pObjDir;
CString strObjectsDir;
BOOL FileWasFound;
char Name[MAX_PATH];
WIN32_FIND_DATA FindData;
HANDLE FindHandle;
const Prefs *pPrefs = (CGlobals::GetActiveDocument())->GetPrefs();
// m_pDoc = CGlobals::GetActiveDocument;
// Prefs = m_pDoc->GetPrefs ();
// get Objects directory from INI
pObjDir = Prefs_GetObjectsDir (pPrefs);
::FilePath_AppendName (pObjDir, "*.3dt", ObjectsDir);
m_prefabList.ResetContent();
FindHandle = ::FindFirstFile (ObjectsDir, &FindData);
FileWasFound = (FindHandle != INVALID_HANDLE_VALUE);
while (FileWasFound)
{
::FilePath_GetName (FindData.cFileName, Name);
m_prefabList.AddString (Name);
FileWasFound = ::FindNextFile (FindHandle, &FindData);
}
::FindClose (FindHandle);
if (m_prefabList.SetCurSel (0) == CB_ERR)
{
// couldn't set it...probably nothing in there
// EnablePlaceObjectButton (FALSE);
}
}
*/
void CTemplatesDlg::OnSelchangePrefabList()
{
m_iCurrentPrefab = m_prefabList.GetCurSel();
}
void CTemplatesDlg::OnDblclkPrefabList()
{
OnPrefabBtn();
}
void CTemplatesDlg::OnPrefabBtn()
{
m_iCurrentPrefab = m_prefabList.GetCurSel ();
if (m_iCurrentPrefab != LB_ERR)
{
m_prefabList.GetText(m_iCurrentPrefab, m_sCurrentTemplateName);
m_currentPrefabName.SetWindowText(m_sCurrentTemplateName);
}
// set this so the normal brush templates will know that they
// were not the most recent template tool chosen
m_pDoc->m_currentTemplateName = "PreFab";
CWnd *mainWnd = AfxGetApp()->GetMainWnd();
ASSERT( mainWnd );
// tell the GenEdit doc to create a template entity for the user to specify the location
// of the objects with
// m_pDoc = CGlobals::GetActiveDocument();
m_pDoc->CreateObjectTemplate();
// clear the Properties Panel
m_pDoc->mpMainFrame->HideAllPropDialogsBut(this);
}
geBoolean CTemplatesDlg::GetCurrentTemplateName (char *pTemplateName)
{
m_iCurrentPrefab = m_prefabList.GetCurSel ();
if (m_iCurrentPrefab != LB_ERR)
{
m_prefabList.GetText(m_iCurrentPrefab, pTemplateName);
return GE_TRUE;
}
return GE_FALSE;
}
void CTemplatesDlg::OnEntityBtn()
{
// int Cur;
// Entity button was clicked
// Get current entity type from combo box and create one...
m_iCurrentEntity = m_entitiesCombo.GetCurSel ();
if (m_iCurrentEntity != LB_ERR)
{
m_pDoc->m_currentTemplateName = "Entity";
char EntityName[_MAX_PATH];
// CWnd *LastView;
m_entitiesCombo.GetLBText (m_iCurrentEntity, EntityName);
/*
We create a "light" entity as the template entity.
In future, we'll have a "template" entity.
*/
// m_pDoc = CGlobals::GetActiveDocument();
m_pDoc->CreateEntity ("light");//EntityName);
/*LastView = m_pParent->LastView;
if ((LastView != NULL) && ::IsWindow (LastView->m_hWnd))
{
LastView->SetFocus ();
}
*/ // clear the Properties Panel
m_pDoc->mpMainFrame->HideAllPropDialogsBut(this);
}
}
void CTemplatesDlg::OnSelchangeEntitiesCombo()
{
m_iCurrentEntity = m_entitiesCombo.GetCurSel ();
m_pDoc->m_currentTemplateName = "Prefab";
}
geBoolean CTemplatesDlg::GetCurrentEntityName(char *pEntityName)
{
m_iCurrentEntity = m_entitiesCombo.GetCurSel ();
if (m_iCurrentEntity != LB_ERR)
{
m_entitiesCombo.GetLBText (m_iCurrentEntity, pEntityName);
return GE_TRUE;
}
return GE_FALSE;
}
void CTemplatesDlg::OnSkybutton()
{
// post 0.5 release
// sets command panel tab to Textures, so we can browse textures
// while we set our sky
if (m_pDoc->mpMainFrame->m_CommandDialogBar)
{
CTabCtrl* pCommandPanelTabCtrl =
(CTabCtrl*)m_pDoc->mpMainFrame->m_CommandDialogBar.GetDlgItem(IDC_COMMAND_TAB);
pCommandPanelTabCtrl->SetCurSel((MAINFRM_COMMANDPANEL_TAB)MAINFRM_COMMANDPANEL_TEXTURES);
m_pDoc->mpMainFrame->SetCommandPanelTab(MAINFRM_COMMANDPANEL_TEXTURES);
}
// CSkyDialog m_dSky; // post 0.5 release. now classwide
// m_dSky.DoModal(); // post 0.5 release. now modeless
// post 0.5 release. Create modeless sky dialog box
if (!m_dSky)
{
m_dSky.Create(IDD_SKYDIALOG, m_pDoc->mpMainFrame);
m_dSky.BringWindowToTop();
m_dSky.ShowWindow(SW_SHOW);
}
// post 0.5 release. sky dialog's internal OnOK() destroys
// the sky dialog
}
void CTemplatesDlg::OnTemplateApply()
{
// m_pDoc = CGlobals::GetActiveDocument();
m_pDoc->AddBrushToWorld();
}
void CTemplatesDlg::OnCancel()
{
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -