📄 mainfrm.cpp
字号:
HideAllTabsBut(MAINFRM_COMMANDPANEL_MODELS);
}
break ;
case MAINFRM_COMMANDPANEL_GROUPS:
{
HideAllTabsBut(MAINFRM_COMMANDPANEL_GROUPS);
}
break;
/* case MAINFRM_COMMANDPANEL_OBJECTS:
{
HideAllTabsBut(MAINFRM_COMMANDPANEL_OBJECTS);
}
break;
case MAINFRM_COMMANDPANEL_LISTS :
{
HideAllTabsBut(MAINFRM_COMMANDPANEL_LISTS);
}
break;
*/
}
}
//==========================================================================================
// CMainFrame::OnNotify
// Called by: Messaging -- when command panel tab is selected with mouse
// Calls:
// Parameters:
// Returns:
// Purpose: Handles tab selection messages from CommandPanel
//==========================================================================================
BOOL CMainFrame::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
LPNMHDR pHeader;
int idCtrl, idTab ;
pHeader = (LPNMHDR)lParam;
// this code handles CommandPanel tab selections
idCtrl = (int)wParam ;
if( IDC_COMMAND_TAB == idCtrl && TCN_SELCHANGE == pHeader->code )
{
idTab = (MAINFRM_COMMANDPANEL_TAB)TabCtrl_GetCurSel( pHeader->hwndFrom);
SetCommandPanelTab((MAINFRM_COMMANDPANEL_TAB)idTab);
}
// check to see if the user selected the templates tab. This is needed
// since the templates tab gets disabled when the user picks the
// GENERALSELECT button. This little routine enables the templates tab
// when the user selects it and changes the mode back to Templates mode.
if (idCtrl == IDC_COMMAND_TAB && pHeader->code != TCN_SELCHANGING)
{
idTab = (MAINFRM_COMMANDPANEL_TAB)TabCtrl_GetCurSel( pHeader->hwndFrom);
if (idTab == MAINFRM_COMMANDPANEL_TEMPLATES)
{
SetCommandPanelTab((MAINFRM_COMMANDPANEL_TAB)idTab);
}
}
if (pHeader != NULL)
{
// child frame sends a WM_SETFOCUS notification when it gets the focus
if (pHeader->code == WM_SETFOCUS)
{
;
// UpdateMainControls(); // causes endless set focus loop when Properties panel
// is closed or undocked
}
}
return CMDIFrameWnd::OnNotify (wParam, lParam, pResult);
}
//==========================================================================================
// CMainFrame::OnCommandPanel
// Called by: Menu
// Calls:
// Parameters:
// Returns:
// Purpose: shows or hides command panel
//==========================================================================================
void CMainFrame::OnCommandPanel()
{
CControlBar* pBar = (CControlBar*)&m_CommandDialogBar ;
if(pBar)
{
ShowControlBar( pBar, (pBar->GetStyle() & WS_VISIBLE) == 0, FALSE ) ;
}
}
//==========================================================================================
// CMainFrame::OnUpdateCommandPanel
// Called by: Menu
// Calls:
// Parameters:
// Returns:
// Purpose: places or removes check mark on menu item
//==========================================================================================
void CMainFrame::OnUpdateCommandPanel(CCmdUI* pCmdUI)
{
CControlBar* pBar = (CControlBar*)&m_CommandDialogBar ;
if (pBar != NULL)
{
pCmdUI->SetCheck((pBar->GetStyle() & WS_VISIBLE) != 0);
}
}
// END COMMAND PANEL / TAB CODE
// ****************************************************************************************
// BEGIN TEXTURES CODE
/*
//==========================================================================================
// CMainFrame::GetCurrentTexture
// Called by: Nothing OBSOLETE
// Calls:
// Parameters:
// Returns:
// Purpose:
//==========================================================================================
const char *CMainFrame::GetCurrentTexture()
{
return m_TexturesTab.GetCurrentTexture(); // GenEdit - Classic
}
*/
//==========================================================================================
// CMainFrame::UpdateTextures
// Called by: CGenEditDoc::OnLeveloptions() only after txl source change
// Calls:
// Parameters:
// Returns:
// Purpose:
//==========================================================================================
void CMainFrame::UpdateTextures (void)
{
m_TexturesTab.m_TxlibChanged = true;
if (m_eCurrentTab == MAINFRM_COMMANDPANEL_TEXTURES)
{
UpdateMainControls ();
}
}
// END TEXTURES CODE
// ***************************************************************************************
// START MODELS DIALOG CODE
//==========================================================================================
// CMainFrame::UpdateSelectedModel
// Called by:
// Calls:
// Parameters:
// Returns:
// Purpose:
//==========================================================================================
void CMainFrame::UpdateSelectedModel( int MoveRotate, geVec3d const *pVecDelta)
{
if (&m_ModelsTab != NULL)
{
m_ModelsTab.UpdateSelectedModel( MoveRotate, pVecDelta );
}
}
/*
//==========================================================================================
// CMainFrame::UpdateModelsDialog
// Called by:
// Calls:
// Parameters:
// Returns:
// Purpose:
//==========================================================================================
void CMainFrame::UpdateModelsDialog(void)
{
if (&m_ModelsTab != NULL)
{
// CGenEditDoc *pDoc;
pDoc = this->GetCurrentDoc ();
if(pDoc)
{
m_ModelsTab.Update (pDoc, Level_GetModelInfo (pDoc->pLevel));
}
}
}
*/
// END MODELS DIALOG CODE
// ************************************************************************************************
// START STATUSBAR CODE
//=====================================================================================================================
// CMainFrame::CreateStatusBar
// Called by: CMainFrame::OnCreate
// Calls:
// Parameters:void
// Returns: BOOL
// Purpose:
//=====================================================================================================================
BOOL CMainFrame::CreateStatusBar()
{
int SProgressPane, SLockPane, SelInfoPane, WorldPosPane, CursorInfoPane, GridPane,
SnapPane, pane_width;
UINT SProgressFlags, SLockFlags, SelInfoFlags, WorldPosFlags, CursorInfoFlags,
GridFlags, SnapFlags, pane_id, pane_style;
CStatusBar *pStatusBar;
// create the status bar. Use default Creat() params, get no messages
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return FALSE;
}
// setup a pointer to the statusbar
pStatusBar = &m_wndStatusBar;
// assign indicators to panes
SProgressPane = pStatusBar->CommandToIndex(ID_SEPARATOR);
SLockPane = pStatusBar->CommandToIndex(ID_INDICATOR_SLOCK);
SelInfoPane = pStatusBar->CommandToIndex(ID_INDICATOR_SELINFO);
WorldPosPane = pStatusBar->CommandToIndex(ID_INDICATOR_WORLDPOS);
CursorInfoPane = pStatusBar->CommandToIndex(ID_INDICATOR_CURSORINFO);
GridPane = pStatusBar->CommandToIndex(ID_INDICATOR_GRID);
SnapPane = pStatusBar->CommandToIndex(ID_INDICATOR_SNAP);
// set pane styles
// put the progress control at the message pane
SProgressFlags = pStatusBar->GetPaneStyle(SProgressPane);
SProgressFlags |= SBPS_NOBORDERS; // add to default styles flags
pStatusBar->SetPaneStyle(SProgressPane, SProgressFlags);
pStatusBar->GetPaneInfo( ID_SEPARATOR_PANE, pane_id, pane_style, pane_width );
pStatusBar->SetPaneInfo( ID_SEPARATOR_PANE, pane_id, pane_style, 110);
SLockFlags = pStatusBar->GetPaneStyle(SLockPane);
SLockFlags |= SBPS_NOBORDERS; // add to default styles flags
pStatusBar->SetPaneStyle(SLockPane, SLockFlags);
pStatusBar->GetPaneInfo( ID_SLOCK_PANE, pane_id, pane_style, pane_width );
pStatusBar->SetPaneInfo( ID_SLOCK_PANE, pane_id, pane_style, 110); // set width
SelInfoFlags = pStatusBar->GetPaneStyle(SelInfoPane);
SelInfoFlags |= SBPS_NOBORDERS ;
pStatusBar->SetPaneStyle(SelInfoPane, SelInfoFlags);
pStatusBar->GetPaneInfo( ID_SELINFO_PANE, pane_id, pane_style, pane_width );
pStatusBar->SetPaneInfo( ID_SELINFO_PANE, pane_id, pane_style, 110);
WorldPosFlags = pStatusBar->GetPaneStyle(WorldPosPane);
WorldPosFlags |= SBPS_NOBORDERS;
pStatusBar->SetPaneStyle(WorldPosPane, WorldPosFlags);
pStatusBar->GetPaneInfo( ID_WORLDPOS_PANE, pane_id, pane_style, pane_width );
pStatusBar->SetPaneInfo( ID_WORLDPOS_PANE, pane_id, pane_style, 110);
CursorInfoFlags = pStatusBar->GetPaneStyle(CursorInfoPane);
CursorInfoFlags |= SBPS_NOBORDERS;
pStatusBar->SetPaneStyle(CursorInfoPane, CursorInfoFlags);
pStatusBar->GetPaneInfo( ID_CURSORINFO_PANE, pane_id, pane_style, pane_width );
pStatusBar->SetPaneInfo( ID_CURSORINFO_PANE, pane_id, pane_style, 110);
GridFlags = pStatusBar->GetPaneStyle(GridPane);
GridFlags |= SBPS_NOBORDERS;
pStatusBar->SetPaneStyle(GridPane, GridFlags);
SnapFlags = pStatusBar->GetPaneStyle(SnapPane);
SnapFlags |= SBPS_NOBORDERS;
pStatusBar->SetPaneStyle(SnapPane, SnapFlags);
// set font
pStatusBar->SetFont(&CGlobals::m_ControlBarFont);
// bring to top so controlbars don't block it
m_wndStatusBar.BringWindowToTop();
return TRUE;
}
//==========================================================================================
// CMainFrame::OnUpdateSLock
// Called by: messaging
// Calls:
// Parameters:
// Returns:
// Purpose: updates status bar
//==========================================================================================
#pragma warning (disable:4100)
void CMainFrame::OnUpdateSLock(CCmdUI *pCmdUI)
{
pDoc = this->GetCurrentDoc ();
if (pDoc != NULL)
{
if (pDoc->IsSelectionLocked())
{
m_wndStatusBar.SetPaneText(ID_SLOCK_PANE, "SLOCK");
}
else
{
m_wndStatusBar.SetPaneText(ID_SLOCK_PANE, "");
}
return;
}
m_wndStatusBar.SetPaneText(ID_SLOCK_PANE, "");
}
#pragma warning (default:4100)
//==========================================================================================
// CMainFrame::OnUpdateSelInfo
// Called by: messaging
// Calls:
// Parameters:
// Returns:
// Purpose: updates status bar
//==========================================================================================
void CMainFrame::OnUpdateSelInfo(CCmdUI *pCmdUI)
{
CString Text = "0 items selected";
pCmdUI->Enable();
pDoc = this->GetCurrentDoc ();
if(pDoc)
{
CString etxt, btxt, ftxt;
int NumSelFaces = SelFaceList_GetSize (pDoc->pSelFaces);
int NumSelBrushes = SelBrushList_GetSize (pDoc->pSelBrushes);
etxt.Format("Ent: %d", pDoc->NumSelEntities);
btxt.Format(" Brsh: %d", NumSelBrushes);
ftxt.Format(" Face: %d", NumSelFaces);
Text.Format("%s%s%s",
pDoc->NumSelEntities ? etxt.GetBuffer(64) : "",
NumSelBrushes ? btxt.GetBuffer(64) : "",
NumSelFaces ? ftxt.GetBuffer(64) : "");
switch (pDoc->mAdjustMode)
{
case ADJUST_MODE_BRUSH :
Text = "BRUSHMODE:"+Text;
break;
case ADJUST_MODE_FACE :
Text = "FACEMODE:"+Text;
break;
default :
assert (0); // can't happen??
// pCmdUI->SetText( Text);
break;
}
}
pCmdUI->SetText (Text) ;
}
//==========================================================================================
// CMainFrame::OnUpdateCursorInfo
// Called by: messaging
// Calls:
// Parameters:
// Returns:
// Purpose: updates status bar
//==========================================================================================
void CMainFrame::OnUpdateCursorInfo(CCmdUI *pCmdUI)
{
char info[256];
pCmdUI->Enable();
pDoc = this->GetCurrentDoc ();
if (pDoc != NULL)
{
pDoc->GetCursorInfo(info, 15);
pCmdUI->SetText( info );
return;
}
pCmdUI->SetText( "" );
}
//==========================================================================================
// CMainFrame::OnUpdateWorldPos
// Called by: messaging
// Calls:
// Parameters:
// Returns:
// Purpose: updates status bar
//==================================================================
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -