/* *======================================================================================= * Name :cmdlg.cpp * * Author : VL Date :20/01/97 * * Description : show incoherence that are in member list *======================================================================================= * Modification -> Author : VL Date : 26/05/97 * Description : some bug corrected, and all objects are now reachable objects *======================================================================================= */ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ #include "stdafx.h" #include "Itf/CPARes.h" #include "Itf/CMDlg.h" #include "Itf/cpamworl.hpp" /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ #ifdef ACTIVE_EDITOR /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ #include "geo.h" #include "gli.h" #include "col.h" #define HieFriend #include "lst.hpp" #include "spo.h" #undef HieFriend #include "IncTUT.h" /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ /* *======================================================================================= * CCoherenceManagerDlg class function *======================================================================================= */ /* ---------------------------------------------------------------------------------------- Description : constructor ---------------------------------------------------------------------------------------- */ CCoherenceManagerDlg::CCoherenceManagerDlg(CWnd* pParent /*=NULL*/) : CDialog(CCoherenceManagerDlg::IDD, pParent) { int iCx, iCy; RECT stRect; m_bBitmapInit = FALSE; m_cMode = C_CM_Mode_cIncoherence; GetDesktopWindow()->GetWindowRect( &stRect ); iCx = stRect.right - stRect.left + 1; iCy = stRect.bottom - stRect.top + 1; m_stWindowPos.top = iCy / 2 - 100; m_stWindowPos.bottom = m_stWindowPos.top + 200; m_stWindowPos.left = iCx / 2 - 200; m_stWindowPos.right = m_stWindowPos.left + 400; } /* ---------------------------------------------------------------------------------------- Description : destructor ---------------------------------------------------------------------------------------- */ CCoherenceManagerDlg::~CCoherenceManagerDlg() { if (m_bBitmapInit) { for (char cBitmap = 0; cBitmap < 5; cBitmap ++) m_a_oBitmap[ cBitmap ].DeleteObject(); m_oBitmapList.DeleteImageList(); } } /* ---------------------------------------------------------------------------------------- Description : Data exchange ---------------------------------------------------------------------------------------- */ void CCoherenceManagerDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); } /* ---------------------------------------------------------------------------------------- Description : Message Map ---------------------------------------------------------------------------------------- */ BEGIN_MESSAGE_MAP(CCoherenceManagerDlg, CDialog) ON_NOTIFY(TCN_SELCHANGE, IDC_TAB, OnSelchangeTab ) ON_BN_CLICKED(IDC_RADIO_ALPHA, OnRadioAlpha) ON_BN_CLICKED(IDC_RADIO_INCOHERENCE, OnRadioIncoherence) ON_BN_CLICKED(IDC_RADIO_DLL, OnRadioDLL) ON_CBN_SELCHANGE(IDC_COMBO_DLLFATHER, OnComboDLLFatherSelChange) ON_CBN_SELCHANGE(IDC_COMBO_DLLINCOHERENCE, OnComboDLLIncoherenceSelChange) ON_CBN_SELCHANGE(IDC_COMBO_DLLCHILD, OnComboDLLChildSelChange) ON_WM_SIZE() ON_WM_SIZING() ON_WM_DESTROY() END_MESSAGE_MAP() /* ---------------------------------------------------------------------------------------- Description : Pre translate message ---------------------------------------------------------------------------------------- */ BOOL CCoherenceManagerDlg::PreTranslateMessage(MSG* pMsg) { BOOL bResult; if (pMsg->hwnd == m_a_stModeData[m_cMode].p_oTree->GetSafeHwnd() ) { CTreeCtrl *pTC = m_a_stModeData[m_cMode].p_oTree; TV_ITEM stItem; if ( pMsg->message == WM_LBUTTONDOWN) { bResult = CDialog::PreTranslateMessage( pMsg ); if ( (stItem.hItem = pTC->GetSelectedItem()) != NULL ) { stItem.mask = TVIF_HANDLE | TVIF_STATE | TVIF_PARAM; pTC->GetItem( &stItem ); if ( (stItem.lParam) && (LOWORD(pMsg->lParam) < 16) ) pTC->Expand( stItem.hItem, TVE_TOGGLE ); } return bResult; } else if (pMsg->message == WM_LBUTTONDBLCLK ) { if ( (stItem.hItem = pTC->GetSelectedItem()) != NULL ) { stItem.mask = TVIF_HANDLE | TVIF_STATE | TVIF_PARAM; pTC->GetItem( &stItem ); if ( (stItem.lParam) && (LOWORD(pMsg->lParam) >= 16) ) { if (m_cMode == C_CM_Mode_cChild) m_fn_vCallDLL( ((tdstChild *) stItem.lParam)->m_p_oChild ); else m_fn_vCallDLL( ((tdstFather *) stItem.lParam)->m_p_oFather ); } else pTC->Expand( stItem.hItem, TVE_TOGGLE ); return 1; } } else if (pMsg->message == WM_RBUTTONDOWN) { pMsg->message = WM_LBUTTONDOWN; bResult = CDialog::PreTranslateMessage(pMsg); if ( (stItem.hItem = pTC->GetSelectedItem()) != NULL ) { CMenu oPopMenu; POINT xPos; stItem.mask = TVIF_HANDLE | TVIF_STATE | TVIF_PARAM; pTC->GetItem( &stItem ); if (stItem.lParam != 0) { if (m_cMode == C_CM_Mode_cChild) m_p_oSelectedObject = ((tdstChild *) stItem.lParam)->m_p_oChild; else m_p_oSelectedObject = ((tdstFather *) stItem.lParam)->m_p_oFather; oPopMenu.CreatePopupMenu () ; // fill oPopMenu.AppendMenu( MF_STRING | ( (m_p_oSelectedObject == NULL )?MF_GRAYED:0) , 1 , "Call DLL" ) ; // display xPos.x = LOWORD(pMsg->lParam); xPos.y = HIWORD(pMsg->lParam); pTC->ClientToScreen(&xPos); TUT_M_vGetTutDll (); TUT_M_vRegisterMenu (this -> m_hWnd , oPopMenu . m_hMenu , xPos . x , xPos . y); oPopMenu.TrackPopupMenu ( TPM_LEFTALIGN|TPM_RIGHTBUTTON, xPos.x, xPos.y, this); oPopMenu.DestroyMenu (); } } } } return CDialog::PreTranslateMessage(pMsg); } /* ---------------------------------------------------------------------------------------- Description : OnCommand ---------------------------------------------------------------------------------------- */ BOOL CCoherenceManagerDlg::OnCommand(WPARAM wParam, LPARAM lParam) { switch(LOWORD(wParam)) { case 1: m_fn_vCallDLL( m_p_oSelectedObject ); break; default : return CDialog::OnCommand(wParam, lParam); } return TRUE; } /* ---------------------------------------------------------------------------------------- WM_DESTROY ---------------------------------------------------------------------------------------- */ void CCoherenceManagerDlg::OnDestroy() { GetWindowRect( &m_stWindowPos ); CDialog::OnDestroy(); } /* ---------------------------------------------------------------------------------------- WM_SIZING ---------------------------------------------------------------------------------------- */ void CCoherenceManagerDlg::OnSizing( UINT nSide, LPRECT lpRect ) { long lWidth = lpRect->right - lpRect->left + 1; long lHeight= lpRect->bottom - lpRect->top + 1; if (lWidth < 200) { switch (nSide) { case WMSZ_BOTTOMLEFT: case WMSZ_LEFT: case WMSZ_TOPLEFT: lpRect->left = lpRect->right - 200; break; case WMSZ_BOTTOMRIGHT: case WMSZ_RIGHT: case WMSZ_TOPRIGHT: lpRect->right = lpRect->left + 200; break; } } if (lHeight < 200) { switch (nSide) { case WMSZ_BOTTOM: case WMSZ_BOTTOMLEFT: case WMSZ_BOTTOMRIGHT: lpRect->bottom = lpRect->top + 200; break; case WMSZ_TOP: case WMSZ_TOPLEFT: case WMSZ_TOPRIGHT: lpRect->top = lpRect->bottom - 200; } } CDialog::OnSizing( nSide, lpRect ); } /* ---------------------------------------------------------------------------------------- WM_SIZE ---------------------------------------------------------------------------------------- */ void CCoherenceManagerDlg::OnSize(UINT nType, int cx, int cy) { /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ char cMode; /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ CDialog::OnSize(nType, cx, cy); if ( (nType != SIZE_MINIMIZED) && (GetDlgItem( IDC_STATIC_NOTHING ) != NULL) ) { /* * resizing Tab control */ GetDlgItem( IDC_TAB )->SetWindowPos( NULL, 5, 5, cx - 10, cy - 10, SWP_NOREDRAW | SWP_NOZORDER ); /* * resizing check boxes */ GetDlgItem( IDC_RADIO_ALPHA )->SetWindowPos( NULL, 10, cy - 45, (cx - 30) / 2, 12, SWP_NOREDRAW | SWP_NOZORDER ); GetDlgItem( IDC_RADIO_INCOHERENCE )->SetWindowPos( NULL, 10, cy - 28, (cx - 30) / 2, 12, SWP_NOREDRAW | SWP_NOZORDER ); GetDlgItem( IDC_RADIO_DLL )->SetWindowPos( NULL, (cx - 30) / 2 + 15, cy - 45, (cx - 30) / 2, 12, SWP_NOREDRAW | SWP_NOZORDER ); /* * resizing combo boxes and tree control */ for (cMode = 0; cMode < C_CM_cNumberOfModes; cMode++) { m_a_stModeData[ cMode ].p_oTree->SetWindowPos( NULL, 10, 30, cx - 20, cy - 80, SWP_NOREDRAW | SWP_NOZORDER ); m_a_stModeData[ cMode ].p_oCombo->SetWindowPos( NULL, (cx - 30) / 2 + 15, cy - 28, (cx - 30) / 2, 12, SWP_NOREDRAW | SWP_NOZORDER ); } /* * moving nothing static */ GetDlgItem( IDC_STATIC_NOTHING )->SetWindowPos( NULL, (cx / 2) - 40, (cy / 2) - 10, 80, 20, SWP_NOREDRAW | SWP_NOZORDER ); Invalidate(); } } /* ---------------------------------------------------------------------------------------- Description : functions to display list ---------------------------------------------------------------------------------------- */ void CCoherenceManagerDlg::m_fn_vFatherList( CFatherMap *_p_oMap, char cMode, char *szDLLName ) { /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ char szFather[200]; CTreeCtrl *pTC = m_a_stModeData[cMode].p_oTree; CComboBox *pCB = m_a_stModeData[cMode].p_oCombo; int iFatherImage = ( (cMode == C_CM_Mode_cIncoherence) ? 1 : 0); int iChildImage = ((cMode == C_CM_Mode_cIncoherence) ? 3 : 2); POSITION xPos; POSITION xPosList; HTREEITEM hFather; CPA_BaseObject *p_oObject; tdstFather *p_stFather; tdstLinkedChild *p_stLinkedChild; TV_ITEM stItem; char *szName; BOOL bReinitDllComboBox = !strcmp( szDLLName, C_szAllDLLName); /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ pTC->DeleteAllItems(); if (bReinitDllComboBox) { pCB->ResetContent(); pCB->AddString( C_szAllDLLName ); pCB->SetCurSel(0); } if (_p_oMap->IsEmpty()) { pTC->ShowWindow( FALSE ); GetDlgItem( IDC_STATIC_NOTHING )->ShowWindow( TRUE ); return; } pTC->ShowWindow(TRUE); GetDlgItem( IDC_STATIC_NOTHING )->ShowWindow( FALSE ); xPos = _p_oMap->GetStartPosition(); while ( xPos ) { _p_oMap->GetNextAssoc( xPos, p_oObject, p_stFather ); if ( (p_stFather == NULL) || (p_oObject == NULL) ) continue; if (bReinitDllComboBox) { if (pCB->FindStringExact( -1, p_oObject->GetEditor()->GetCurrentEditorName() ) == CB_ERR) pCB->AddString( p_oObject->GetEditor()->GetCurrentEditorName() ); } else { if ( strcmp(p_oObject->GetEditor()->GetCurrentEditorName(), szDLLName) ) continue; } // insert item in tree sprintf( szFather, "%s (%s)", p_oObject->GetName(), p_oObject->GetEditor()->GetCurrentEditorName() ); hFather = pTC->InsertItem( szFather ); stItem.hItem = hFather; stItem.iImage = iFatherImage; stItem.iSelectedImage = iFatherImage; stItem.mask = TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE ; stItem.lParam = (LPARAM) p_stFather; pTC->SetItem( &stItem ); // insert child xPosList = p_stFather->m_oChildList.GetHeadPosition(); while (xPosList) { p_stLinkedChild = p_stFather->m_oChildList.GetNext( xPosList ); if ( (p_stLinkedChild == NULL) || (p_stLinkedChild->m_p_stChild->m_p_oChild == NULL)) continue; sprintf ( szFather, "[%d] %s (%s)", p_stLinkedChild->m_ulLinkWeight, p_stLinkedChild->m_p_stChild->m_p_oChild->GetName(), p_stLinkedChild->m_p_stChild->m_p_oChild->GetEditor()->GetCurrentEditorName() ); pTC->InsertItem( szFather, iChildImage, iChildImage, hFather ); } // insert destroyed child xPosList = p_stFather->m_oDestroyedChildList.GetHeadPosition(); while (xPosList ) { szName = p_stFather->m_oDestroyedChildList.GetNext( xPosList ); pTC->InsertItem( szName, 4, 4, hFather ); } } // change order to the last used one switch (m_a_stModeData[ cMode ].cOrder ) { case C_cAlpha: m_fn_vSortAlpha( cMode ); break; case C_cIncoherence: m_fn_vSortIncoherence( cMode ); break; case C_cDLL: m_fn_vSortDLL( cMode ); break; } } /* ---------------------------------------------------------------------------------------- Description : functions to display list ---------------------------------------------------------------------------------------- */ void CCoherenceManagerDlg::m_fn_vChildList( CChildMap *_p_oMap, char cMode, char *szDLLName ) { /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ char szString[200]; CTreeCtrl *pTC = m_a_stModeData[cMode].p_oTree; CComboBox *pCB = m_a_stModeData[cMode].p_oCombo; int iFatherImage = ( (cMode == C_CM_Mode_cIncoherence) ? 1 : 0); int iChildImage = ((cMode == C_CM_Mode_cIncoherence) ? 3 : 2); POSITION xPos; POSITION xPosList; HTREEITEM hChild; CPA_BaseObject *p_oObject; tdstFather *p_stFather; tdstChild *p_stChild; TV_ITEM stItem; BOOL bReinitDllComboBox = !strcmp( szDLLName, C_szAllDLLName); /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ pTC->DeleteAllItems(); if (bReinitDllComboBox) { pCB->ResetContent(); pCB->AddString( C_szAllDLLName ); pCB->SetCurSel(0); } if (_p_oMap->IsEmpty()) { pTC->ShowWindow( FALSE ); GetDlgItem( IDC_STATIC_NOTHING )->ShowWindow( TRUE ); return; } pTC->ShowWindow(TRUE); GetDlgItem( IDC_STATIC_NOTHING )->ShowWindow( FALSE ); xPos = _p_oMap->GetStartPosition(); while ( xPos ) { _p_oMap->GetNextAssoc( xPos, p_oObject, p_stChild ); if ( (p_stChild == NULL) || (p_oObject == NULL) ) continue; if (bReinitDllComboBox) { if (pCB->FindStringExact( -1, p_oObject->GetEditor()->GetCurrentEditorName() ) == CB_ERR) pCB->AddString( p_oObject->GetEditor()->GetCurrentEditorName() ); } else { if ( strcmp(p_oObject->GetEditor()->GetCurrentEditorName(), szDLLName) ) continue; } // insert item in tree sprintf( szString, "%s (%s)", p_oObject->GetName(), p_oObject->GetEditor()->GetCurrentEditorName() ); hChild = pTC->InsertItem( szString ); stItem.hItem = hChild; stItem.iImage = iFatherImage; stItem.iSelectedImage = iFatherImage; stItem.mask = TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE ; stItem.lParam = (LPARAM) p_stChild; pTC->SetItem( &stItem ); // insert child xPosList = p_stChild->m_oFatherList.GetHeadPosition(); while (xPosList) { p_stFather = p_stChild->m_oFatherList.GetNext( xPosList ); if ( (p_stFather == NULL) || (p_stFather->m_p_oFather == NULL)) continue; sprintf ( szString, "%s (%s)", p_stFather->m_p_oFather->GetName(), p_stFather->m_p_oFather->GetEditor()->GetCurrentEditorName() ); pTC->InsertItem( szString, 0, 0, hChild ); } } // change order to the last used one switch (m_a_stModeData[ cMode ].cOrder ) { case C_cAlpha: m_fn_vSortAlpha( cMode ); break; case C_cIncoherence: m_fn_vSortIncoherence( cMode ); break; case C_cDLL: m_fn_vSortDLL( cMode ); break; } } /* *======================================================================================= * CCoherenceManagerDlg message handlers *======================================================================================= */ /* ---------------------------------------------------------------------------------------- Description : call DLL ---------------------------------------------------------------------------------------- */ //void CCoherenceManagerDlg::m_fn_vCallDLL(tdstFather *p_stFather) void CCoherenceManagerDlg::m_fn_vCallDLL(CPA_BaseObject *_p_oObject) { m_oReachObjList.RemoveAll(); //m_oReachObjList.AddTail( (CPA_BaseObject *) p_stFather->m_p_oFather); m_oReachObjList.AddTail( _p_oObject ); //p_stFather->m_p_oFather->GetMainWorld()->fn_bActivateEditor( p_stFather->m_p_oFather->GetEditor(), &m_oReachObjList ); _p_oObject->GetMainWorld()->fn_bActivateEditor( _p_oObject->GetEditor(), &m_oReachObjList ); } /* ---------------------------------------------------------------------------------------- Description : handle BN_CLICKED message on IDC_RADIO_ALPHA ---------------------------------------------------------------------------------------- */ void CCoherenceManagerDlg::m_fn_vSortAlpha( char cMode ) { m_a_stModeData[ cMode ].p_oTree->SortChildren( NULL ); m_a_stModeData[ cMode ].cOrder = C_cAlpha; } void CCoherenceManagerDlg::OnRadioAlpha(void) { m_fn_vSortAlpha( m_cMode ); } /* ---------------------------------------------------------------------------------------- Description : handle BN_CLICKED message on IDC_RADIO_INCOHERENCE ---------------------------------------------------------------------------------------- */ int CALLBACK fn_iIncoherenceCompare(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) { tdstFather *p_stFather1 = (tdstFather *) lParam1; tdstFather *p_stFather2 = (tdstFather *) lParam2; return (p_stFather2->m_oChildList.GetCount() - p_stFather1->m_oChildList.GetCount()); } int CALLBACK fn_iNumberOfFathersCompare(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) { tdstChild *p_stChild1 = (tdstChild *) lParam1; tdstChild *p_stChild2 = (tdstChild *) lParam2; return (p_stChild2->m_oFatherList.GetCount() - p_stChild1->m_oFatherList.GetCount()); } void CCoherenceManagerDlg::m_fn_vSortIncoherence( char cMode ) { TV_SORTCB stSort; stSort.hParent = NULL; switch (m_cMode) { case C_CM_Mode_cIncoherence: case C_CM_Mode_cFather: stSort.lpfnCompare = fn_iIncoherenceCompare; break; case C_CM_Mode_cChild: stSort.lpfnCompare = fn_iNumberOfFathersCompare; break; } m_a_stModeData[cMode].p_oTree->SortChildrenCB( &stSort ); m_a_stModeData[cMode].cOrder = C_cIncoherence; } void CCoherenceManagerDlg::OnRadioIncoherence( void ) { m_fn_vSortIncoherence( m_cMode ); } /* ---------------------------------------------------------------------------------------- Description : handle BN_CLICKED message on IDC_RADIO_DLL ---------------------------------------------------------------------------------------- */ int CALLBACK fn_iFatherDLLCompare(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) { tdstFather *p_stFather1 = (tdstFather *) lParam1; tdstFather *p_stFather2 = (tdstFather *) lParam2; return strcmp(p_stFather1->m_p_oFather->GetEditor()->GetCurrentEditorName(), p_stFather2->m_p_oFather->GetEditor()->GetCurrentEditorName()); } int CALLBACK fn_iChildDLLCompare(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) { tdstChild *p_stChild1 = (tdstChild *) lParam1; tdstChild *p_stChild2 = (tdstChild *) lParam2; return strcmp(p_stChild1->m_p_oChild->GetEditor()->GetCurrentEditorName(), p_stChild2->m_p_oChild->GetEditor()->GetCurrentEditorName()); } void CCoherenceManagerDlg::m_fn_vSortDLL( char cMode ) { TV_SORTCB stSort; stSort.hParent = NULL; switch (m_cMode) { case C_CM_Mode_cIncoherence: case C_CM_Mode_cFather: stSort.lpfnCompare = fn_iFatherDLLCompare; break; case C_CM_Mode_cChild: stSort.lpfnCompare = fn_iChildDLLCompare; break; } m_a_stModeData[cMode].p_oTree->SortChildrenCB( &stSort ); m_a_stModeData[cMode].cOrder = C_cDLL; } void CCoherenceManagerDlg::OnRadioDLL(void) { m_fn_vSortDLL( m_cMode ); } /* ---------------------------------------------------------------------------------------- Description : CBN_SELCHANGE message for IDC_COMBO_DLLFATHER ---------------------------------------------------------------------------------------- */ void CCoherenceManagerDlg::OnComboDLLFatherSelChange(void) { char szDllName[100]; GetDlgItem(IDC_COMBO_DLLFATHER)->GetWindowText(szDllName, 100); m_fn_vFatherList( m_p_oFatherMap, 1 , szDllName ); } /* ---------------------------------------------------------------------------------------- Description : CBN_SELCHANGE message for IDC_COMBO_DLLINCOHERENCE ---------------------------------------------------------------------------------------- */ void CCoherenceManagerDlg::OnComboDLLIncoherenceSelChange(void) { char szDllName[100]; GetDlgItem(IDC_COMBO_DLLINCOHERENCE)->GetWindowText(szDllName, 100); m_fn_vFatherList( m_p_oIncoherenceMap, 0 , szDllName ); } /* ---------------------------------------------------------------------------------------- Description : CBN_SELCHANGE message for IDC_COMBO_DLLCHILD ---------------------------------------------------------------------------------------- */ void CCoherenceManagerDlg::OnComboDLLChildSelChange(void) { char szDllName[100]; GetDlgItem(IDC_COMBO_DLLCHILD)->GetWindowText(szDllName, 100); m_fn_vChildList( m_p_oChildMap, 2 , szDllName ); } /* ---------------------------------------------------------------------------------------- Description : TCN_SELCHANGE message ---------------------------------------------------------------------------------------- */ void CCoherenceManagerDlg::OnSelchangeTab(NMHDR* pNMHDR, LRESULT* pResult) { int iTab = ((CTabCtrl *) GetDlgItem( IDC_TAB ))->GetCurSel() ; BOOL bSomething; bSomething = m_a_stModeData[iTab].p_oTree->GetCount() > 0; // show new mode m_a_stModeData[ iTab ].p_oTree->ShowWindow( bSomething ); m_a_stModeData[ iTab ].p_oCombo->ShowWindow( bSomething ); GetDlgItem( IDC_STATIC_NOTHING )->ShowWindow( !bSomething ); GetDlgItem( IDC_RADIO_ALPHA )->ShowWindow( bSomething ); GetDlgItem( IDC_RADIO_INCOHERENCE )->ShowWindow( bSomething ); GetDlgItem( IDC_RADIO_DLL )->ShowWindow( bSomething ); if (bSomething ) { ((CButton *) GetDlgItem( IDC_RADIO_ALPHA ))->SetCheck( m_a_stModeData[iTab].cOrder == C_cAlpha ? 1 : 0 ); ((CButton *) GetDlgItem( IDC_RADIO_INCOHERENCE ))->SetCheck( m_a_stModeData[iTab].cOrder == C_cIncoherence ? 1 : 0 ); ((CButton *) GetDlgItem( IDC_RADIO_DLL ))->SetCheck( m_a_stModeData[iTab].cOrder == C_cDLL ? 1 : 0 ); GetDlgItem( IDC_RADIO_INCOHERENCE )->SetWindowText( m_a_stModeData[iTab].szOrderName ); } // hide old mode if (m_cMode != iTab ) { m_a_stModeData[ m_cMode ].p_oTree->ShowWindow( FALSE ); m_a_stModeData[ m_cMode ].p_oCombo->ShowWindow( FALSE ); // set new mode m_cMode = iTab; } *pResult = 0; } /* ---------------------------------------------------------------------------------------- Description : handle WM_INITDIALOG message ---------------------------------------------------------------------------------------- */ BOOL CCoherenceManagerDlg::OnInitDialog() { char szTitle[20]; TC_ITEM stItem; CTabCtrl *p_oTab = (CTabCtrl *) GetDlgItem( IDC_TAB ); char cMode; CDialog::OnInitDialog(); if ( !m_bBitmapInit ) { char cBitmap; m_a_oBitmap[0].LoadBitmap( IDB_BITMAP_FATHER ); m_a_oBitmap[1].LoadBitmap( IDB_BITMAP_INCOHERENCE ); m_a_oBitmap[2].LoadBitmap( IDB_BITMAP_CHILD ); m_a_oBitmap[3].LoadBitmap( IDB_BITMAP_DELETEDCHILD ); m_a_oBitmap[4].LoadBitmap( IDB_BITMAP_DESTROYEDCHILD ); m_oBitmapList.Create(16,16,TRUE, 5,5); for (cBitmap = 0; cBitmap < 5; cBitmap ++) m_oBitmapList.Add( &m_a_oBitmap[ cBitmap ], RGB(255,255,255) ); m_bBitmapInit = TRUE; } /* * Init Mode data */ m_a_stModeData[C_CM_Mode_cIncoherence].p_oTree = (CTreeCtrl *) GetDlgItem( IDC_TREE_INCOHERENCE ); m_a_stModeData[C_CM_Mode_cIncoherence].p_oCombo = (CComboBox *) GetDlgItem( IDC_COMBO_DLLINCOHERENCE ); m_a_stModeData[C_CM_Mode_cIncoherence].cOrder = C_cAlpha; strcpy( m_a_stModeData[C_CM_Mode_cIncoherence].szOrderName, "Number of incoherences" ); m_a_stModeData[C_CM_Mode_cFather].p_oTree = (CTreeCtrl *) GetDlgItem( IDC_TREE_FATHER ); m_a_stModeData[C_CM_Mode_cFather].p_oCombo = (CComboBox *) GetDlgItem( IDC_COMBO_DLLFATHER ); m_a_stModeData[C_CM_Mode_cFather].cOrder = C_cAlpha; strcpy( m_a_stModeData[C_CM_Mode_cFather].szOrderName, "Number of children" ); m_a_stModeData[C_CM_Mode_cChild].p_oTree = (CTreeCtrl *) GetDlgItem( IDC_TREE_CHILD ); m_a_stModeData[C_CM_Mode_cChild].p_oCombo = (CComboBox *) GetDlgItem( IDC_COMBO_DLLCHILD ); m_a_stModeData[C_CM_Mode_cChild].cOrder = C_cAlpha; strcpy( m_a_stModeData[C_CM_Mode_cChild].szOrderName, "Number of fathers" ); p_oTab->DeleteAllItems(); p_oTab->SetImageList( &m_oBitmapList ); stItem.mask = TCIF_TEXT | TCIF_IMAGE; stItem.pszText = szTitle; stItem.iImage = 1; strcpy( szTitle, "Invalid links" ); p_oTab->InsertItem( 0 , &stItem ); stItem.iImage = 0; strcpy( szTitle, "Father links" ); p_oTab->InsertItem( 1 , &stItem ); stItem.iImage = 2; strcpy( szTitle, "Child links" ); p_oTab->InsertItem( 2 , &stItem ); for (cMode = 0; cMode < C_CM_cNumberOfModes; cMode ++) m_a_stModeData[ cMode ].p_oTree->SetImageList( &m_oBitmapList, TVSIL_NORMAL ); m_fn_vFatherList( m_p_oIncoherenceMap, 0, C_szAllDLLName ); m_fn_vFatherList( m_p_oFatherMap, 1, C_szAllDLLName ); m_fn_vChildList( m_p_oChildMap, 2, C_szAllDLLName ); for (cMode = 0; cMode < C_CM_cNumberOfModes; cMode ++) { m_a_stModeData[ cMode ].p_oTree->ShowWindow( FALSE ); m_a_stModeData[ cMode ].p_oCombo->ShowWindow( FALSE ); } LRESULT lResult; p_oTab->SetCurSel( m_cMode ); OnSelchangeTab( NULL, &lResult ); MoveWindow( &m_stWindowPos ); return TRUE; } #endif //ACTIVE_EDITOR