📄 groupsdlg.cpp
字号:
// Restore focus to active view
CMDIChildWnd *pMDIChild =(CMDIChildWnd *)pDoc->mpMainFrame->MDIGetActive();
if(pMDIChild)
{
CView *cv =(CView *)pMDIChild->GetActiveView();
if( cv)
cv->SetFocus() ;
}
}
// CDialog::OnOK();
}
// this is the SelctAll button
void CGroupsDlg::OnSelectbrushes()
{
CGenEditDoc *pDoc = CGlobals::GetActiveDocument();
// Add all brushes/entities in the current group to the selected list
pDoc->SelectGroupBrushes (TRUE, pDoc->mCurrentGroup);
m_BrushList.SetSel( -1, TRUE );
OnOK();
}
void CGroupsDlg::OnDeselectbrushes()
{
CGenEditDoc *pDoc = CGlobals::GetActiveDocument();
// Remove all brushes/entities in the current group from the selected list
pDoc->SelectGroupBrushes (FALSE, pDoc->mCurrentGroup);
pDoc->ResetAllSelections();
m_BrushList.SetSel( -1, FALSE );
// close out an existing Property Dialog boxes
pDoc->mpMainFrame->HideAllPropDialogsBut(this);
OnOK();
}
void CGroupsDlg::SelectNone()
{
OnDeselectbrushes();
}
void CGroupsDlg::OnCancel()
{
CGenEditDoc *pDoc = CGlobals::GetActiveDocument();
UpdateGroups(pDoc);
}
// create a new brush group and add all currently-selected
// brushes and entities to the new group.
void CGroupsDlg::OnCreateNewGroup(void)
{
//AfxMessageBox("CreateNew Button is working");
CGenEditDoc *pDoc = CGlobals::GetActiveDocument();
int NewGroupId ;
NewGroupId = pDoc->MakeNewBrushGroup( this ) ;
if( NewGroupId != 0 )
{
m_Visible.SetCheck( TRUE ) ;
m_BrushLock.SetCheck( FALSE ) ;
OnOK( );
// UpdateTabDisplay( pDoc ) ;
// pDoc->mpMainFrame->UpdateActiveDoc() ;
pDoc->mpMainFrame->UpdateMainControls();
}
}/* CGroupsDlg::OnCreateNewGroup */
void CGroupsDlg::OnAddToCurrent(void)
{
CGenEditDoc *pDoc = CGlobals::GetActiveDocument();
pDoc->AddSelToGroup() ;
OnOK();
UpdateGroups(pDoc);
}
void CGroupsDlg::OnSelChangeGroupCombo()
{
CGenEditDoc *pDoc = CGlobals::GetActiveDocument();
// CComboBox *GCombo =(CComboBox *)GetDlgItem(IDC_GROUPCOMBO);
assert(m_cGroupCombo);
if (pDoc != NULL)
{
int Id = m_cGroupCombo.GetCurSel();
if (Id != LB_ERR)
{ // deselect all from current goup
OnDeselectbrushes(); // otherwise, craziness on Prop Panel
pDoc->mCurrentGroup = m_cGroupCombo.GetItemData(Id);
}
// CHANGE! 03/24/97 John Moore
// Go ahead and reset the currentbrush
pDoc->CurBrush = pDoc->BTemplate;
// End of CHANGE
// Be very careful when speccing flags for UpdateAllViews()
// The wrong flags at the wrong time will totally screw things up
pDoc->UpdateAllViews(UAV_ALL3DVIEWS, NULL);
// Update the Toolbar // NOT HERE! G3DC
// pDoc->mpMainFrame->LoadGroupComboBox() ;
}
// deslect all brushes, otherwise bursh/entity/face editing is chaotic
UpdateGroups(pDoc);
// deselect all from goup we just switched to
OnDeselectbrushes(); // otherwise, craziness on Prop Panel
}/* CGroupsDlg::OnSelChangeGroupCombo */
void CGroupsDlg::OnVisible()
{
OnOK();
}
// removed selected brushes/entities from current group
void CGroupsDlg::OnRemovefromcurrent(void)
{
CGenEditDoc *pDoc = CGlobals::GetActiveDocument();
pDoc->RemovesSelFromGroup() ;
OnOK();
UpdateGroups(pDoc);
}
void CGroupsDlg::OnBrushlock()
{
int c ;
if( m_BrushLock.GetCheck () )
{
// If ANY items in the group are selected, select them all
c = m_BrushList.GetSelCount() ;
if( c > 0 )
{
OnSelectbrushes() ;
}
// Then disable the LB until the user unlocks the group
m_BrushList.EnableWindow( FALSE ) ;
}
else
{
m_BrushList.EnableWindow( TRUE ) ;
}
OnOK();
}/* CGroupsDlg::OnBrushlock */
void CGroupsDlg::OnSelchangeBrushlist()
{
int c ;
int i ;
Brush * b;
CEntity * pEnt;
char szBuffer[64]; // Should have a limit for entity/brush name
geBoolean bChanged = FALSE ; // You get selchanges on cursor movements that don't change selection...
CGenEditDoc *pDoc = CGlobals::GetActiveDocument();
if (pDoc == NULL)
return;
/*
if (pDoc->mModeTool != ID_GENERALSELECT)
{
pDoc->DoGeneralSelect();
int nState = pDoc->mpMainFrame->m_wndBrushToolBar.GetToolBarCtrl().GetState(ID_GENERALSELECT);
pDoc->mpMainFrame->m_wndBrushToolBar.GetToolBarCtrl().SetState(ID_GENERALSELECT, nState | TBSTATE_CHECKED);
}
*/ c = m_BrushList.GetCount() ;
if( c > 0 )
{
for( i=0; i<c; i++ )
{
m_BrushList.GetText( i, szBuffer ) ;
if( szBuffer[1] == 'B' )
{
b = (Brush *)m_BrushList.GetItemData( i );
if( m_BrushList.GetSel( i ) )
{ // User says brush should be selected
if( pDoc->BrushIsSelected( b ) == GE_FALSE )
{
pDoc->DoBrushSelection( b, brushSelToggle ) ;
bChanged = GE_TRUE ;
}
}
else
{ // User says don't select
if( pDoc->BrushIsSelected( b ) == GE_TRUE )
{
pDoc->DoBrushSelection( b, brushSelToggle ) ;
bChanged = GE_TRUE ;
}
}
}// Item is Brush
else if( szBuffer[1] == 'E' )
{
pEnt = (CEntity *)m_BrushList.GetItemData( i );
if( m_BrushList.GetSel( i ) )
{
if( pEnt->IsSelected() == GE_FALSE )
{ // User says entity should be selected
pDoc->DoEntitySelection( pEnt ) ;
bChanged = GE_TRUE ;
}
}
else
{
if( pEnt->IsSelected() == GE_TRUE )
{ // User says entity should not be selected
pDoc->DoEntitySelection( pEnt ) ;
// int CurrentSelection = m_BrushList.GetCurSel();
// pDoc->SetSelectedEntity(CurrentSelection);
// pDoc->UpdateSelected();
bChanged = GE_TRUE ;
}
}
}// Item is Entity
}// Loop thru Listbox
}// There are items in the Listbox
if( bChanged )
{ pDoc->UpdateSelected(); // calls UpdateMainControls()
// Be very careful when speccing flags for UpdateAllViews()
// The wrong flags at the wrong time will totally screw things up
// thes options are necessary in order for Face attributes to work right
// g3dc tuning if (pDoc->mAdjustMode == ADJUST_MODE_BRUSH)
// pDoc->UpdateAllViews( UAV_ALLVIEWS | REBUILD_QUICK, NULL );
// else
pDoc->UpdateAllViews(UAV_ALL3DVIEWS, NULL);
}
}/* CGroupsDlg::OnSelchangeBrushlist */
void CGroupsDlg::UpdateGroupSelection( void )
{
#if 1
// #pragma message ("Group selection stuff badly farkled")
#else
int c ;
int i ;
Brush * b;
CEntity * pEnt;
char szBuffer[64]; // Should have a limit for entity/brush name
BOOL bSelect ;
CGenEditDoc *pDoc = CGlobals::GetActiveDocument();
c = m_BrushList.GetCount() ;
if( c > 0 )
{
for( i=0; i<c; i++ )
{
m_BrushList.GetText( i, szBuffer ) ;
if( szBuffer[1] == 'B' )
{
b = (Brush *)m_BrushList.GetItemData( i );
if( Brush_GetGroupId(b) == pDoc->mCurrentGroup )
{
bSelect = pDoc->BrushIsSelected( b ) ;
m_BrushList.SetSel( i, bSelect );
}
}// Item is Brush
else if( szBuffer[1] == 'E' )
{
pEnt = (CEntity *)m_BrushList.GetItemData( i );
if( pEnt->GetGroupId () == pDoc->mCurrentGroup )
{
bSelect = pEnt->IsSelected() ;
m_BrushList.SetSel( i, bSelect );
}
}// Item is Entity
}// Loop thru Listbox
}// There are items in the Listbox
#endif
}/* CGroupsDlg::UpdateGroupSelection */
void CGroupsDlg::OnRemovegroup()
{
CGenEditDoc *pDoc = CGlobals::GetActiveDocument();
GroupIterator gi;
GroupListType *Groups = Level_GetGroups (pDoc->pLevel);
BrushList *BList = Level_GetBrushes (pDoc->pLevel);
CEntityArray *Entities = Level_GetEntities (pDoc->pLevel);
// Nuke the current group
Group_RemoveFromList (Groups, pDoc->mCurrentGroup, BList, Entities);
// Find another group for our current one
pDoc->mCurrentGroup = Group_GetFirstId( Groups, &gi ) ;
pDoc->SetModifiedFlag() ;
m_BrushList.ResetContent() ;
UpdateGroups(pDoc);
// LoadComboBox( );
}/* CGroupsDlg::OnRemovegroup */
//LRESULT CGroupsDlg::OnChangeColor( WPARAM wParam, LPARAM lParam )
LONG CGroupsDlg::OnChangeColor( LPARAM lParam, WPARAM wParam ) // new g3dc
{
CGenEditDoc *pDoc = CGlobals::GetActiveDocument();
COLORREF color ;
GE_RGBA geColor ;
GroupListType *Groups = Level_GetGroups (pDoc->pLevel);
color = m_ColorButton.GetColor() ;
geColor.r = GetRValue( color ) ;
geColor.g = GetGValue( color ) ;
geColor.b = GetBValue( color ) ;
Group_SetColor ( Groups, pDoc->mCurrentGroup, &geColor ) ;
pDoc->SetModifiedFlag() ;
// Be very careful when speccing flags for UpdateAllViews()
// The wrong flags at the wrong time will totally screw things up
pDoc->UpdateAllViews(UAV_ALL3DVIEWS, NULL);
return TRUE ;
wParam;
lParam;
}/* CGroupsDlg::OnChangeColor */
void CGroupsDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
// otherwise color button disappears after app switching, or Minimize/Maximize
m_ColorButton.RedrawWindow();
// Do not call CDialog::OnPaint() for painting messages
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -