123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517 |
- /* Copyright (c) 2002-2012 Croteam Ltd.
- This program is free software; you can redistribute it and/or modify
- it under the terms of version 2 of the GNU General Public License as published by
- the Free Software Foundation
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
- // DlgPgShadow.cpp : implementation file
- //
- #include "stdafx.h"
- #include "DlgPgShadow.h"
- #ifdef _DEBUG
- #undef new
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CDlgPgShadow property page
- IMPLEMENT_DYNCREATE(CDlgPgShadow, CPropertyPage)
- CDlgPgShadow::CDlgPgShadow() : CPropertyPage(CDlgPgShadow::IDD)
- {
- m_ctrlShadowColor.SetPickerType( CColoredButton::PT_MFC);
- //{{AFX_DATA_INIT(CDlgPgShadow)
- //}}AFX_DATA_INIT
- }
- CDlgPgShadow::~CDlgPgShadow()
- {
- }
- void CDlgPgShadow::DoDataExchange(CDataExchange* pDX)
- {
- if( theApp.m_bDisableDataExchange) return;
- CPropertyPage::DoDataExchange(pDX);
- // mark that property page has been modified
- SetModified( TRUE);
- // obtain document
- CWorldEditorDoc* pDoc = theApp.GetDocument();
- if( pDoc == NULL) return;
- // polygon mode must be on
- if( pDoc->GetEditingMode() != POLYGON_MODE) return;
- // get flags of control activity
- BOOL bSelectionExists = pDoc->m_selPolygonSelection.Count() != 0;
-
- // if dialog is recieving data and control window is valid
- if( (pDX->m_bSaveAndValidate == FALSE) && IsWindow( m_NoShadow.m_hWnd) )
- {
- // initialize combo boxes
- InitComboBoxes();
- // polygon controls exist if polygon selection exists
- m_bNoPlaneDiffusion.EnableWindow( bSelectionExists);
- m_bDarkCorners.EnableWindow( bSelectionExists);
- m_bDynamicLightsOnly.EnableWindow( bSelectionExists);
- m_bHasDirectionalShadows.EnableWindow( bSelectionExists);
- m_bHasPreciseShadows.EnableWindow( bSelectionExists);
- m_bHasDirectionalAmbient.EnableWindow( bSelectionExists);
- m_IsLightBeamPassable.EnableWindow( bSelectionExists);
- m_bDontReceiveShadows.EnableWindow( bSelectionExists);
- m_bNoDynamicLights.EnableWindow( bSelectionExists);
- m_NoShadow.EnableWindow( bSelectionExists);
- m_ctrlComboClusterSize.EnableWindow( bSelectionExists);
- m_comboShadowBlend.EnableWindow( bSelectionExists);
- m_ComboIllumination.EnableWindow( bSelectionExists);
- m_ctrlComboGradient.EnableWindow( bSelectionExists);
- GetDlgItem( IDC_STATIC_CLUSTER_SIZE)->EnableWindow( bSelectionExists);
- GetDlgItem( IDC_STATIC_ILLUMINATION)->EnableWindow( bSelectionExists);
- GetDlgItem( IDC_STATIC_GRADIENT)->EnableWindow( bSelectionExists);
- GetDlgItem( IDC_STATIC_SHADOW_COLOR)->EnableWindow( bSelectionExists);
- GetDlgItem( IDC_STATIC_SHADOW_BLEND)->EnableWindow( bSelectionExists);
- m_ctrlShadowColor.EnableWindow( bSelectionExists);
- // if selection exists, calculate tri-state value of attribute intersection
- if( bSelectionExists)
- {
- // get properties from first polygon
- UBYTE ubFirstIllumination;
- SBYTE sbFirstShadowClusterSize;
- UBYTE ubFirstShadowBlend;
- UBYTE ubFirstGradient;
- BOOL bSameIllumination = TRUE;
- BOOL bSameShadowClusterSize = TRUE;
- BOOL bSameShadowBlend = TRUE;
- BOOL bSameGradient = TRUE;
- ULONG ulFlagsOn = MAX_ULONG;
- ULONG ulFlagsOff = MAX_ULONG;
- INDEX iPolygon = 0;
- // for each of the selected polygons
- FOREACHINDYNAMICCONTAINER(pDoc->m_selPolygonSelection, CBrushPolygon, itbpo)
- {
- ulFlagsOn &= itbpo->bpo_ulFlags;
- ulFlagsOff &= ~itbpo->bpo_ulFlags;
- if( iPolygon == 0)
- {
- ubFirstIllumination = itbpo->bpo_bppProperties.bpp_ubIlluminationType;
- sbFirstShadowClusterSize = itbpo->bpo_bppProperties.bpp_sbShadowClusterSize;
- ubFirstShadowBlend = itbpo->bpo_bppProperties.bpp_ubShadowBlend;
- ubFirstGradient = itbpo->bpo_bppProperties.bpp_ubGradientType;
- m_ctrlShadowColor.SetColor( itbpo->bpo_colShadow);
- }
- else
- {
- if( m_ctrlShadowColor.GetColor() != itbpo->bpo_colShadow)
- {
- m_ctrlShadowColor.SetMixedColor();
- }
- if( itbpo->bpo_bppProperties.bpp_ubIlluminationType != ubFirstIllumination) bSameIllumination = FALSE;
- if( itbpo->bpo_bppProperties.bpp_sbShadowClusterSize != sbFirstShadowClusterSize) bSameShadowClusterSize = FALSE;
- if( itbpo->bpo_bppProperties.bpp_ubShadowBlend != ubFirstShadowBlend) bSameShadowBlend = FALSE;
- if( itbpo->bpo_bppProperties.bpp_ubGradientType != ubFirstGradient) bSameGradient = FALSE;
- }
- iPolygon++;
- }
- // apply flags to controls
- #define SET_TRI_STATE_TO_CTRL( ctrl, flag)\
- if((ulFlagsOn & flag) && !(ulFlagsOff & flag)) ctrl.SetCheck( 1);\
- else if(!(ulFlagsOn & flag) && (ulFlagsOff & flag)) ctrl.SetCheck( 0);\
- else ctrl.SetCheck( 2);
- SET_TRI_STATE_TO_CTRL( m_bHasDirectionalShadows, BPOF_HASDIRECTIONALLIGHT);
- SET_TRI_STATE_TO_CTRL( m_bHasPreciseShadows, BPOF_ACCURATESHADOWS);
- SET_TRI_STATE_TO_CTRL( m_bHasDirectionalAmbient, BPOF_HASDIRECTIONALAMBIENT);
- SET_TRI_STATE_TO_CTRL( m_bNoPlaneDiffusion, BPOF_NOPLANEDIFFUSION);
- SET_TRI_STATE_TO_CTRL( m_bDarkCorners, BPOF_DARKCORNERS);
- SET_TRI_STATE_TO_CTRL( m_bDynamicLightsOnly, BPOF_DYNAMICLIGHTSONLY);
- SET_TRI_STATE_TO_CTRL( m_IsLightBeamPassable, BPOF_DOESNOTCASTSHADOW);
- SET_TRI_STATE_TO_CTRL( m_bDontReceiveShadows, BPOF_DOESNOTRECEIVESHADOW);
- SET_TRI_STATE_TO_CTRL( m_bNoDynamicLights, BPOF_NODYNAMICLIGHTS);
- SET_TRI_STATE_TO_CTRL( m_NoShadow, BPOF_FULLBRIGHT);
- if( bSameIllumination)
- {
- for( INDEX iIllumination=0; iIllumination<m_ComboIllumination.GetCount(); iIllumination++)
- {
- INDEX iIlluminationData = m_ComboIllumination.GetItemData( iIllumination);
- if( iIlluminationData==ubFirstIllumination)
- {
- m_ComboIllumination.SetCurSel( iIllumination);
- break;
- }
- }
- }
- else m_ComboIllumination.SetCurSel(-1);
- if( bSameShadowClusterSize) m_ctrlComboClusterSize.SetCurSel( sbFirstShadowClusterSize+4);
- else m_ctrlComboClusterSize.SetCurSel(-1);
- if( bSameShadowBlend) m_comboShadowBlend.SetCurSel( ubFirstShadowBlend);
- else m_comboShadowBlend.SetCurSel(-1);
- if( bSameGradient) m_ctrlComboGradient.SetCurSel( ubFirstGradient);
- else m_ctrlComboGradient.SetCurSel(-1);
- }
- // mark that page is updated
- m_udPolygonSelection.MarkUpdated();
- }
- //{{AFX_DATA_MAP(CDlgPgShadow)
- DDX_Control(pDX, IDC_GRADIENT_COMBO, m_ctrlComboGradient);
- DDX_Control(pDX, IDC_DARK_CORNERS, m_bDarkCorners);
- DDX_Control(pDX, IDC_NO_DYNAMIC_LIGHTS, m_bNoDynamicLights);
- DDX_Control(pDX, IDC_IS_RECEIVING_SHADOWS, m_bDontReceiveShadows);
- DDX_Control(pDX, IDC_DYNAMIC_LIGHTS_ONLY, m_bDynamicLightsOnly);
- DDX_Control(pDX, IDC_HAS_DIRECTIONAL_AMBIENT, m_bHasDirectionalAmbient);
- DDX_Control(pDX, IDC_HAS_PRECISE_SHADOWS, m_bHasPreciseShadows);
- DDX_Control(pDX, IDC_NO_PLANE_DIFFUSION, m_bNoPlaneDiffusion);
- DDX_Control(pDX, IDC_HAS_DIRECTIONAL_SHADOWS, m_bHasDirectionalShadows);
- DDX_Control(pDX, IDC_NO_SHADOW, m_NoShadow);
- DDX_Control(pDX, IDC_IS_LIGHT_BEAM_PASSABLLE, m_IsLightBeamPassable);
- DDX_Control(pDX, ID_SHADOW_COLOR, m_ctrlShadowColor);
- DDX_Control(pDX, IDC_SHADOW_BLEND_COMBO, m_comboShadowBlend);
- DDX_Control(pDX, IDC_CLUSTER_SIZE_COMBO, m_ctrlComboClusterSize);
- DDX_Control(pDX, IDC_ILLUMINATION_COMBO, m_ComboIllumination);
- //}}AFX_DATA_MAP
- // if dialog is giving data
- if( pDX->m_bSaveAndValidate != FALSE)
- {
- BOOL bFindShadowLayers = FALSE;
- BOOL bOnlySelected = TRUE;
- // calculate bounding box for all polygons
- FLOATaabbox3D boxBoundingBoxPolygonSelection;
- FOREACHINDYNAMICCONTAINER(pDoc->m_selPolygonSelection, CBrushPolygon, itbpo)
- {
- boxBoundingBoxPolygonSelection |= itbpo->bpo_boxBoundingBox;
- if( m_comboShadowBlend.GetCurSel()!=-1) itbpo->bpo_bppProperties.bpp_ubShadowBlend = m_comboShadowBlend.GetCurSel();
- INDEX iItem = m_ComboIllumination.GetCurSel();
- if( iItem!=CB_ERR)
- {
- INDEX iIlluminationToSet = m_ComboIllumination.GetItemData( iItem);
- if( itbpo->bpo_bppProperties.bpp_ubIlluminationType != iIlluminationToSet)
- {
- itbpo->bpo_bppProperties.bpp_ubIlluminationType = (UBYTE) iIlluminationToSet;
- itbpo->bpo_smShadowMap.Uncache();
- itbpo->DiscardShadows();
- bFindShadowLayers = TRUE;
- bOnlySelected = FALSE;
- }
- }
- INDEX iShadowClusterSize = m_ctrlComboClusterSize.GetCurSel()-4;
- if( (m_ctrlComboClusterSize.GetCurSel()!=-1) &&
- (itbpo->bpo_bppProperties.bpp_sbShadowClusterSize != iShadowClusterSize) )
- {
- itbpo->bpo_bppProperties.bpp_sbShadowClusterSize = (SBYTE) iShadowClusterSize;
- // discard all shadow layers on the polygon.
- itbpo->bpo_smShadowMap.DiscardAllLayers();
- itbpo->InitializeShadowMap();
- bFindShadowLayers = TRUE;
- }
- INDEX iGradient = m_ctrlComboGradient.GetCurSel();
- if( iGradient!=CB_ERR)
- {
- if( itbpo->bpo_bppProperties.bpp_ubGradientType != iGradient)
- {
- itbpo->bpo_bppProperties.bpp_ubGradientType = (UBYTE) iGradient;
- itbpo->bpo_smShadowMap.DiscardAllLayers();
- itbpo->InitializeShadowMap();
- bFindShadowLayers = TRUE;
- }
- }
- // set polygon's flags acording witg given tri-state ctrl
- #define TRI_STATE_CTRL_TO_FLAGS( ctrl, flag, buncache, bdiscardshadows, bfindshadowlayers, bonlyselected)\
- if( (ctrl.GetCheck() == 1) && !(itbpo->bpo_ulFlags & flag) ) {\
- itbpo->bpo_ulFlags |= flag;\
- if( buncache) itbpo->bpo_smShadowMap.Uncache();\
- if( bdiscardshadows) itbpo->DiscardShadows();\
- bFindShadowLayers |= bfindshadowlayers;\
- bOnlySelected &= bonlyselected ;\
- } else if( (ctrl.GetCheck() == 0) && (itbpo->bpo_ulFlags & flag) ) {\
- itbpo->bpo_ulFlags &= ~flag;\
- if( buncache) itbpo->bpo_smShadowMap.Uncache();\
- if( bdiscardshadows) itbpo->DiscardShadows();\
- bFindShadowLayers |= bfindshadowlayers;\
- bOnlySelected &= bonlyselected ;\
- }
- TRI_STATE_CTRL_TO_FLAGS( m_bNoPlaneDiffusion, BPOF_NOPLANEDIFFUSION, TRUE, FALSE, FALSE, FALSE);
- TRI_STATE_CTRL_TO_FLAGS( m_bDarkCorners, BPOF_DARKCORNERS, TRUE, TRUE, TRUE, TRUE);
- TRI_STATE_CTRL_TO_FLAGS( m_bDynamicLightsOnly, BPOF_DYNAMICLIGHTSONLY, TRUE, FALSE, FALSE, FALSE);
- TRI_STATE_CTRL_TO_FLAGS( m_bHasDirectionalShadows, BPOF_HASDIRECTIONALLIGHT, TRUE, TRUE, TRUE, TRUE);
- TRI_STATE_CTRL_TO_FLAGS( m_bHasPreciseShadows, BPOF_ACCURATESHADOWS, TRUE, TRUE, TRUE, TRUE);
- TRI_STATE_CTRL_TO_FLAGS( m_bHasDirectionalAmbient, BPOF_HASDIRECTIONALAMBIENT, TRUE, FALSE, FALSE, FALSE);
- TRI_STATE_CTRL_TO_FLAGS( m_IsLightBeamPassable, BPOF_DOESNOTCASTSHADOW, TRUE, TRUE, TRUE, FALSE);
- TRI_STATE_CTRL_TO_FLAGS( m_bDontReceiveShadows, BPOF_DOESNOTRECEIVESHADOW, TRUE, TRUE, TRUE, TRUE);
- TRI_STATE_CTRL_TO_FLAGS( m_bNoDynamicLights, BPOF_NODYNAMICLIGHTS, FALSE, FALSE, FALSE, TRUE);
- TRI_STATE_CTRL_TO_FLAGS( m_NoShadow, BPOF_FULLBRIGHT, TRUE, TRUE, TRUE, TRUE);
- if( m_ctrlShadowColor.IsColorValid()) {
- itbpo->bpo_colShadow = m_ctrlShadowColor.GetColor();
- }
- }
- // if we should find shadow layers
- if( bFindShadowLayers)
- {
- pDoc->m_woWorld.FindShadowLayers( boxBoundingBoxPolygonSelection, bOnlySelected);
- }
- // mark that document is changed
- theApp.GetDocument()->SetModifiedFlag( TRUE);
- // redraw to show changes
- pDoc->UpdateAllViews( NULL);
- }
- }
- BEGIN_MESSAGE_MAP(CDlgPgShadow, CPropertyPage)
- //{{AFX_MSG_MAP(CDlgPgShadow)
- ON_CBN_SELCHANGE(IDC_CLUSTER_SIZE_COMBO, OnSelchangeShadowClusterSizeCombo)
- ON_CBN_SELCHANGE(IDC_ILLUMINATION_COMBO, OnSelchangeIlluminationCombo)
- ON_CBN_DROPDOWN(IDC_ILLUMINATION_COMBO, OnDropdownIlluminationCombo)
- ON_CBN_SELCHANGE(IDC_SHADOW_BLEND_COMBO, OnSelchangeShadowBlendCombo)
- ON_CBN_DROPDOWN(IDC_SHADOW_BLEND_COMBO, OnDropdownShadowBlendCombo)
- ON_CBN_DROPDOWN(IDC_CLUSTER_SIZE_COMBO, OnDropdownClusterSizeCombo)
- ON_WM_CONTEXTMENU()
- ON_CBN_DROPDOWN(IDC_GRADIENT_COMBO, OnDropdownGradientCombo)
- ON_CBN_SELCHANGE(IDC_GRADIENT_COMBO, OnSelchangeGradientCombo)
- ON_NOTIFY_EX( TTN_NEEDTEXT, 0, OnToolTipNotify )
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CDlgPgShadow message handlers
- void CDlgPgShadow::InitComboBoxes(void)
- {
- CWorldEditorDoc* pDoc = theApp.GetDocument();
- CTString strGradientName;
- CTString strIlluminationName;
- m_ComboIllumination.ResetContent();
- m_ctrlComboClusterSize.ResetContent();
- m_comboShadowBlend.ResetContent();
- m_ctrlComboGradient.ResetContent();
- // add all available illuminations
- for(INDEX iIllumination=0; iIllumination<MAX_UBYTE; iIllumination++)
- {
- strIlluminationName = pDoc->m_woWorld.wo_aitIlluminationTypes[iIllumination].it_strName;
- if(strIlluminationName == "") break;
- INDEX iAddedAs = m_ComboIllumination.AddString( CString(strIlluminationName));
- m_ComboIllumination.SetItemData( iAddedAs, (ULONG) iIllumination);
- }
- for(INDEX iBlend=0; iBlend<256; iBlend++)
- {
- CTString strBlendName = pDoc->m_woWorld.wo_atbTextureBlendings[iBlend].tb_strName;
- if( strBlendName != CTString("") ) m_comboShadowBlend.AddString( CString(strBlendName));
- }
- // none must exist
- m_ctrlComboGradient.AddString( L"None");
- // add gradients
- if( pDoc->m_selPolygonSelection.Count() != 0)
- {
- // obtain first polygon's brush
- CBrush3D *pbrBrush = NULL;
- pDoc->m_selPolygonSelection.Lock();
- if( !pDoc->m_selPolygonSelection.IsMember( pDoc->m_pbpoLastCentered))
- {
- pbrBrush = pDoc->m_selPolygonSelection[0].bpo_pbscSector->bsc_pbmBrushMip->bm_pbrBrush;
- }
- pDoc->m_selPolygonSelection.Unlock();
- BOOL bEnableGradient = TRUE;
- // for each of the selected polygons
- FOREACHINDYNAMICCONTAINER(pDoc->m_selPolygonSelection, CBrushPolygon, itbpo)
- {
- // disable gradient combo box if all polygons are not from same brush
- if( pbrBrush != itbpo->bpo_pbscSector->bsc_pbmBrushMip->bm_pbrBrush)
- {
- bEnableGradient = FALSE;
- break;
- }
- }
-
- // if gradient combo is enabled
- if( bEnableGradient)
- {
- // add gradients
- for(INDEX iGradient=0; iGradient<MAX_UBYTE; iGradient++)
- {
- CTString strGradientName = pbrBrush->br_penEntity->GetGradientName( iGradient);
- if( strGradientName == "") break;
- m_ctrlComboGradient.AddString( CString(strGradientName));
- }
- }
- }
- // add all available shadow cluster sizes
- m_ctrlComboClusterSize.AddString( L"3.125 cm");
- m_ctrlComboClusterSize.AddString( L"6.25 cm");
- m_ctrlComboClusterSize.AddString( L"12.5 cm");
- m_ctrlComboClusterSize.AddString( L"25 cm");
- m_ctrlComboClusterSize.AddString( L"0.5 m");
- m_ctrlComboClusterSize.AddString( L"1 m");
- m_ctrlComboClusterSize.AddString( L"2 m");
- m_ctrlComboClusterSize.AddString( L"4 m");
- m_ctrlComboClusterSize.AddString( L"8 m");
- m_ctrlComboClusterSize.AddString( L"16 m");
- m_ctrlComboClusterSize.AddString( L"32 m");
- m_ctrlComboClusterSize.AddString( L"64 m");
- m_ctrlComboClusterSize.AddString( L"128 m");
- m_ctrlComboClusterSize.AddString( L"256 m");
- m_ctrlComboClusterSize.AddString( L"512 m");
- m_ctrlComboClusterSize.AddString( L"1024 m");
- }
- BOOL CDlgPgShadow::OnIdle(LONG lCount)
- {
- CWorldEditorDoc* pDoc = theApp.GetDocument();
- if( (pDoc == NULL) || !IsWindow(m_hWnd) )
- {
- return TRUE;
- }
- // if selections have been changed (they are not up to date)
- if( !pDoc->m_chSelections.IsUpToDate( m_udPolygonSelection) )
- {
- // update dialog data
- UpdateData( FALSE);
- }
- return TRUE;
- }
- BOOL CDlgPgShadow::PreTranslateMessage(MSG* pMsg)
- {
- if(pMsg->message==WM_KEYDOWN && pMsg->wParam==VK_RETURN)
- {
- // move data from page to polygon
- UpdateData( TRUE);
- // the message is handled
- return TRUE;
- }
- return CPropertyPage::PreTranslateMessage(pMsg);
- }
- BOOL CDlgPgShadow::OnInitDialog()
- {
- EnableToolTips( TRUE);
- CPropertyPage::OnInitDialog();
- if( IsWindow( m_ComboIllumination.m_hWnd))
- {
- InitComboBoxes();
- }
- m_ctrlShadowColor.SetDialogPtr( this);
- m_bNoPlaneDiffusion.SetDialogPtr( this);
- m_bDarkCorners.SetDialogPtr( this);
- m_bDynamicLightsOnly.SetDialogPtr( this);
- m_bHasPreciseShadows.SetDialogPtr( this);
- m_bHasDirectionalAmbient.SetDialogPtr( this);
- m_bHasDirectionalShadows.SetDialogPtr( this);
- m_NoShadow.SetDialogPtr( this);
- m_IsLightBeamPassable.SetDialogPtr( this);
- m_bDontReceiveShadows.SetDialogPtr( this);
- m_bNoDynamicLights.SetDialogPtr( this);
- return TRUE;
- }
- void CDlgPgShadow::OnSelchangeShadowClusterSizeCombo()
- {
- // update dialog data (to reflect data change)
- UpdateData( TRUE);
- }
- void CDlgPgShadow::OnSelchangeIlluminationCombo()
- {
- UpdateData( TRUE);
- }
- void CDlgPgShadow::OnSelchangeShadowBlendCombo()
- {
- UpdateData( TRUE);
- }
- void CDlgPgShadow::OnSelchangeGradientCombo()
- {
- UpdateData( TRUE);
- }
- void CDlgPgShadow::OnDropdownIlluminationCombo()
- {
- m_ComboIllumination.SetDroppedWidth( 256);
- }
- void CDlgPgShadow::OnDropdownShadowBlendCombo()
- {
- m_comboShadowBlend.SetDroppedWidth( 256);
- }
- void CDlgPgShadow::OnDropdownClusterSizeCombo()
- {
- m_ctrlComboClusterSize.SetDroppedWidth( 256);
- }
- void CDlgPgShadow::OnDropdownGradientCombo()
- {
- m_ctrlComboGradient.SetDroppedWidth( 256);
- }
- void CDlgPgShadow::OnContextMenu(CWnd* pWnd, CPoint point)
- {
- CWorldEditorDoc* pDoc = theApp.GetActiveDocument();
-
- CMenu menu;
- if( pDoc->GetEditingMode() == POLYGON_MODE)
- {
- if( menu.LoadMenu(IDR_INFO_POLYGON_POPUP))
- {
- CMenu* pPopup = menu.GetSubMenu(0);
- if( pDoc->m_selPolygonSelection.Count() != 1)
- {
- menu.EnableMenuItem(ID_SET_AS_DEFAULT, MF_DISABLED|MF_GRAYED);
- }
- pPopup->TrackPopupMenu(TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_LEFTALIGN,
- point.x, point.y, this);
- }
- }
- }
- BOOL CDlgPgShadow::OnToolTipNotify( UINT id, NMHDR * pNMHDR, LRESULT * pResult )
- {
- TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pNMHDR;
- UINT nID =pNMHDR->idFrom;
- if (pTTT->uFlags & TTF_IDISHWND)
- {
- // idFrom is actually the HWND of the tool
- nID = ::GetDlgCtrlID((HWND)nID);
- if(nID)
- {
- pTTT->lpszText = MAKEINTRESOURCE(nID);
- pTTT->hinst = AfxGetResourceHandle();
- return(TRUE);
- }
- }
- return(FALSE);
- }
|