/******************************************************************************* Function Name : OnInitialUpdate Input(s) : - Output : - Functionality : Initialised UI Controls for the first time show Member of : CGraphLeftView Author(s) : Raja N Date Created : 09/12/2004 Modifications : *******************************************************************************/ void CGraphLeftView::OnInitialUpdate() { // Call parent class to do init CFormView::OnInitialUpdate(); // Create List Control m_omSignalList.DeleteAllItems(); // Enable grid lines and full row selection m_omSignalList.SetExtendedStyle( LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT ); m_omSignalList.InsertColumn( defCOL_CATOGORY_INDEX, _(defSTR_LIST_HEADING_CATOGORY) ); m_omSignalList.SetColumnWidth( defCOL_CATOGORY_INDEX, defCOL_CATOGORY_WIDTH ); m_omSignalList.InsertColumn( defCOL_ELEMENT_INDEX, _(defSTR_LIST_HEADING_ELEMENT) ); m_omSignalList.SetColumnWidth( defCOL_ELEMENT_INDEX, defCOL_ELEMENT_WIDTH); m_omSignalList.InsertColumn( defCOL_TYPE_INDEX, _(defSTR_LIST_HEADING_TYPE) ); m_omSignalList.SetColumnWidth( defCOL_TYPE_INDEX, defCOL_TYPE_WIDTH ); mParentWnd = (CGraphChildFrame*)(pomGetParentWindow()); // Remove Automatic Text from the color popup // Register this to child window CWnd* pWnd = nullptr; pWnd = pomGetParentWindow(); if( pWnd != nullptr ) { // Register view pointer (static_cast<CGraphChildFrame*>(pWnd))->m_pomLeftView = this; // Get Graph Control Pointer m_pDMGraphCtrl = (static_cast<CGraphChildFrame*>(pWnd))->m_pDMGraphCtrl; } }
/******************************************************************************* Function Name : OnInitialUpdate Input(s) : - Output : - Functionality : This function will be called by the framework during initial show of this view. This function will register iteself in to parent window class so that other views shall access it. Member of : CTxFunctionsView Author(s) : Raja N Date Created : 26.4.2005 Modifications : *******************************************************************************/ void CTxFunctionsView::OnInitialUpdate() { CFormView::OnInitialUpdate(); // Update View pointer in to the child frame // Get Child Window Pointer CWnd* pWnd = NULL; // Get Parent window pointer pWnd = pomGetParentWindow(); // Update view pointer if( pWnd != NULL ) { // Register this view pointer ((CTxMsgChildFrame*)pWnd)->vSetTxMsgViewPointers( eTxMsgFunctionsView, this ); } // Disable Update Button m_omButtonApply.EnableWindow( FALSE ); if(CTxWndDataStore::ouGetTxWndDataStoreObj().m_bAutoSavedEnabled) { m_CheckBoxAutoUpdate.SetCheck(BST_CHECKED); GetDlgItem(IDC_BTN_UPDATE)->EnableWindow(FALSE); OnBnClickedCheckAutoUpdate(); //call this function exclusively } else { m_CheckBoxAutoUpdate.SetCheck(BST_UNCHECKED); GetDlgItem(IDC_BTN_UPDATE)->EnableWindow(TRUE); } }
/******************************************************************************* Function Name : OnInitialUpdate Input(s) : - Output : FALSE - If focus is set to Any UI control explicitly Functionality : Initialises dialog's UI components Member of : CGraphBottomView Author(s) : Raja N Date Created : 10/12/2004 Modifications : Raja N on 15.12.2004, Added code to check graph control proper load by checking the window handle *******************************************************************************/ void CGraphBottomView::OnInitialUpdate() { // Call Parent windows Update CFormView::OnInitialUpdate(); // Load Icons from direction buttons m_omBtnUp.SetIcon(AfxGetApp()->LoadIcon(MAKEINTRESOURCE(IDI_ICON_UP))); m_omBtnDown.SetIcon(AfxGetApp()->LoadIcon(MAKEINTRESOURCE(IDI_ICON_DOWN))); m_omBtnLeft.SetIcon(AfxGetApp()->LoadIcon(MAKEINTRESOURCE(IDI_ICON_LEFT))); m_omBtnRight.SetIcon(AfxGetApp()->LoadIcon(MAKEINTRESOURCE(IDI_ICON_RIGHT))); //CGraphList * podList = NULL; CGraphChildFrame* pParentWnd = NULL; pParentWnd = (CGraphChildFrame*)pomGetParentWindow(); pParentWnd->m_pomBottomView = this; // Get Graph Control Pointer m_pDMGraphCtrl = pParentWnd->m_pDMGraphCtrl; // If window handle is invalid then init pointer with NULL /*if( m_opDMGraphCtrl != NULL && IsWindow(m_opDMGraphCtrl->m_hWnd) == FALSE ) { m_opDMGraphCtrl = NULL; }*/ //Update initial values m_dblarrTime[0] = dRound(m_dblarrTime[0], 3); m_dblarrTime[1] = dRound(m_dblarrTime[1], 3); m_dblDeltaTime = dRound(m_dblDeltaTime , 3); // Create List Control m_lstSignalDetails.DeleteAllItems(); //Set List Control styles m_lstSignalDetails.SetExtendedStyle (LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT ); //Create Columns vCreateColumns(); }
/******************************************************************************* Function Name : vEnableDisableControls Input(s) : - Output : - Functionality : This function will update UI control as per the selection in the element UI list and connection status Member of : CGraphLeftView Author(s) : Raja N Date Created : 09/12/2004 Modifications : *******************************************************************************/ void CGraphLeftView::vEnableDisableControls() { CGraphList* podList = NULL; CGraphChildFrame* pParentWnd = NULL; pParentWnd = (CGraphChildFrame*)pomGetParentWindow(); if(pParentWnd != NULL) { podList = pParentWnd->pGetSignalListDetails(); } else { return; } // Update UI Elements if( podList != NULL ) { if( podList->m_omElementList.GetSize() > 0 && m_omSignalList.GetSelectedCount() > 0 ) { vEnableControls( TRUE ); } else { vEnableControls( FALSE ); } } //SGW Code commented by Arun 21-10-2010 }
/******************************************************************************* Function Name : OnBtnVisible Input(s) : - Output : - Functionality : This function will toggle the Visible property of the element This will also update global list Member of : CGraphLeftView Author(s) : Raja N Date Created : 09/12/2004 Modifications : *******************************************************************************/ void CGraphLeftView::OnBtnVisible() { CGraphElement odSelectedElement; // Get handle to selected message item int hSelItem = m_omSignalList.GetNextItem(-1, LVNI_SELECTED); if ( hSelItem != -1 ) { // Get Graph List from main frame CGraphList* podList = NULL; CGraphChildFrame* pParentWnd = NULL; pParentWnd = (CGraphChildFrame*)pomGetParentWindow(); if(pParentWnd != NULL) { podList = pParentWnd->pGetSignalListDetails(); } else { return; } // Update Element Details if( podList != NULL ) { if( hSelItem < podList->m_omElementList.GetSize() ) { odSelectedElement = podList->m_omElementList[ hSelItem ]; odSelectedElement.m_bVisible = !odSelectedElement.m_bVisible; podList->m_omElementList[ hSelItem ] = odSelectedElement; // Update Configuration Module //theApp.bSetData( SIGNAL_GRAPH_LIST, podList); // Update Button Text if( odSelectedElement.m_bVisible == TRUE ) { m_omBtnVisible.SetWindowText( defSTR_HIDE ); } else { m_omBtnVisible.SetWindowText( defSTR_SHOW ); } // Update Graph Control vUpdateGraphControl( defFROM_VISIBLE, odSelectedElement.m_bVisible ); } else { // Invalid Element. AfxMessageBox( defSTR_ELEMENT_NOT_FOUND, MB_ICONSTOP); } } } }
/******************************************************************************* Function Name : OnBtnEnable Input(s) : - Output : - Functionality : This function will toggle the Enable property of the element. This will also update global list Member of : CGraphLeftView Author(s) : Raja N Date Created : 09/12/2004 Modifications : *******************************************************************************/ void CGraphLeftView::OnBtnEnable() { CGraphElement odSelectedElement; // Get handle to selected message item int hSelItem = m_omSignalList.GetNextItem(-1, LVNI_SELECTED); if ( hSelItem != -1 ) { // Get graph list from main frame CGraphList* podList = nullptr; CGraphChildFrame* pParentWnd = nullptr; pParentWnd = static_cast<CGraphChildFrame*>(pomGetParentWindow()); if(pParentWnd != nullptr) { podList = pParentWnd->pGetSignalListDetails(); } else { return; } // Update Element Details if( podList != nullptr ) { if( hSelItem < podList->m_omElementList.GetSize() ) { odSelectedElement = podList->m_omElementList[ hSelItem ]; odSelectedElement.m_bEnabled = !odSelectedElement.m_bEnabled; podList->m_omElementList[ hSelItem ] = odSelectedElement; // Update Configuration Module //theApp.bSetData( SIGNAL_GRAPH_LIST, podList); // Update Button Text if( odSelectedElement.m_bEnabled == TRUE ) { m_omBtnEnable.SetWindowText( _(defSTR_DISABLE) ); } else { m_omBtnEnable.SetWindowText( _(defSTR_ENABLE) ); } // Update Graph Control vUpdateGraphControl( defFROM_ENABLE, odSelectedElement.m_bEnabled ); } else { // Invalid element found AfxMessageBox( _(defSTR_ELEMENT_NOT_FOUND), MB_ICONSTOP); } } } }
/******************************************************************************* Function Name : vApplyChanges Input(s) : Output : Functionality : This function is used to apply changes in the global shared memory Member of : CTxFunctionsView Friend of : - Author(s) : Raja N Date Created : 19.07.2004 Modification By : Modification on : *******************************************************************************/ void CTxFunctionsView::vApplyChanges() { // Get Other view pointers CTxMsgBlocksView* pomBlockView = NULL; CTxMsgListView* pomListView = NULL; pomBlockView = (CTxMsgBlocksView*)pomGetBlocksViewPointer(); pomListView = (CTxMsgListView* )pomGetListViewPointer(); if( pomBlockView != NULL && pomListView != NULL ) { PSMSGBLOCKLIST psMsgBlock = NULL; psMsgBlock = pomBlockView->psGetMsgBlockPointer( pomBlockView->m_nSelectedMsgBlockIndex, pomBlockView->m_psMsgBlockList ); // Update the last selected message block details in case user has // modified it. if(psMsgBlock != NULL ) { pomBlockView->vUpdateMsgBlockDetials(psMsgBlock); psMsgBlock->m_bModified = true; } // Set the value in configuration class. CTxWndDataStore::ouGetTxWndDataStoreObj().bSetTxData( TX_MSG_BLOCK_COUNT, (void*)&(pomBlockView->m_unMsgBlockCount) ); // Data is set only if messagae block count is more then zero. if( pomBlockView->m_unMsgBlockCount > 0 ) { CTxWndDataStore::ouGetTxWndDataStoreObj().bSetTxData( TX_MSG_UPDATE, (void*)(pomBlockView->m_psMsgBlockList) ); // Allocate memory for globle list BOOL bAllocateMemory = CTxMsgManager::s_podGetTxMsgManager()->bAllocateMemoryForGlobalTxList(); // Update Message List if(bAllocateMemory == TRUE ) { CTxMsgManager::s_podGetTxMsgManager()->vAssignMsgBlockList(); } } //Save Window position CTxMsgChildFrame* pTxWnd = (CTxMsgChildFrame*)pomGetParentWindow(); // Update view pointer if( pTxWnd != NULL ) { // Register this view pointer pTxWnd->vUpdateWndCo_Ords(); } /* CString csTimeDelay; ((CEdit*)pomBlockView->GetDlgItem(IDC_EDIT_BLOCK_TRG_TIMER_VAL))->GetWindowTextA(csTimeDelay); CTxMsgManager::s_unTimeDelayBtnMsgBlocks = atol(csTimeDelay.GetBuffer(0));*/ } }
/******************************************************************************* Function Name : OnBtnClose Input(s) : - Output : - Functionality : This button handler will be called during Close button press. This function will send WM_CLOSE message to close Tx Child window. Member of : CTxFunctionsView Author(s) : Raja N Date Created : 25.4.2005 Modifications : *******************************************************************************/ void CTxFunctionsView::OnBtnClose() { // Get Child Frame Pointer CWnd* pWnd = NULL; pWnd = pomGetParentWindow(); // Post close message if( pWnd != NULL ) { // This will invoked the InvokeClose function ((CTxMsgChildFrame*)pWnd)->PostMessage( WM_CLOSE ); } }
/******************************************************************************* Function Name : vUpdateSignalData Input(s) : - Output : - Functionality : This function will update signal data based on cursor details. Member of : CGraphBottomView Author(s) : ArunKumar K Date Created : 22/12/2010 Modifications : ArunKumar K, 24/12/2010 Made the dblDiff to contain only modulus of difference. *******************************************************************************/ void CGraphBottomView::vUpdateSignalData() { if ( m_pDMGraphCtrl == NULL ) { return; } CGraphChildFrame* pParentWnd = NULL; pParentWnd = (CGraphChildFrame*)pomGetParentWindow(); double dblValue1 = 0, dblValue2 = 0, dblDiff; CString strValue1, strValue2, strDiffVal; if( m_dblarrTime[0] == 0 && m_dblarrTime[1] == 0 ) { for( int nIndex = 0; nIndex < m_lstSignalDetails.GetItemCount(); nIndex++) { m_lstSignalDetails.SetItemText( nIndex, 3, STR_EMPTY); //Cursor 1 value m_lstSignalDetails.SetItemText( nIndex, 4, STR_EMPTY); //Cursor 2 value m_lstSignalDetails.SetItemText( nIndex, 5, STR_EMPTY); //Difference value } return; } for( int nIndex = 0; nIndex < m_lstSignalDetails.GetItemCount(); nIndex++) { dblValue1 = 0; dblValue2 = 0; m_pDMGraphCtrl->GetElementValueAtCursor( (short)nIndex, m_dblarrTime[0], &dblValue1); m_pDMGraphCtrl->GetElementValueAtCursor( (short)nIndex, m_dblarrTime[1], &dblValue2); dblDiff = dblValue2 - dblValue1; if( dblDiff < 0) { dblDiff = -dblDiff; } dRound(dblValue1, 3); dRound(dblValue2, 3); dRound(dblDiff, 3); strValue1.Format( _T("%.3lf") ,dblValue1); strValue2.Format( _T("%.3lf") ,dblValue2); strDiffVal.Format(_T("%.3lf") ,dblDiff); m_lstSignalDetails.SetItemText( nIndex, 3, strValue1); //Cursor 1 value m_lstSignalDetails.SetItemText( nIndex, 4, strValue2); //Cursor 2 value m_lstSignalDetails.SetItemText( nIndex, 5, strDiffVal); //Difference value } }
/******************************************************************************* Function Name : pomGetDetailsViewPointer Input(s) : - Output : CWnd * - Pointer to CTxMsgDetailsView or NULL incase of failure Functionality : This function will return CTxMsgDetailsView pointer. This will get child window pointer to get view pointer. Member of : CTxFunctionsView Author(s) : Raja N Date Created : 25.4.2005 Modifications : *******************************************************************************/ CWnd* CTxFunctionsView::pomGetDetailsViewPointer() const { CWnd* pView = NULL; // Get Child Frame Pointer CWnd* pWnd = NULL; pWnd = pomGetParentWindow(); // Get View Pointer if( pWnd != NULL ) { pView = ((CTxMsgChildFrame*)pWnd)->pomGetTxMsgViewPointers( eTxMsgMessageDetailsView ); } // Return view pointer return pView; }
CWnd* CTxMsgListView::pomGetFunctionsViewPointer() const { CWnd* pView = nullptr; // Get Child Frame Pointer CWnd* pWnd = nullptr; pWnd = pomGetParentWindow(); // Get View Pointer if( pWnd != nullptr ) { pView = ((CTxMsgChildFrame*)pWnd)->pomGetTxMsgViewPointers( eTxMsgFunctionsView ); } // Return View pointer return pView; }
/******************************************************************************* Function Name : vHandleConnectionStatusChange Input(s) : bConnectionStatus - Status of the tool connection. TRUE if the tool is going to connected state Output : - Functionality : This function will handle connect event. This will disable not supported UI controls if the tool is going to connected state. This will also set the graph to Run mode. The update timer will be started during connect state. During disconnect this function will bring back the graph control to normal mode and will kill the update timer. Member of : CGraphBottomView Author(s) : Raja N Date Created : 10/12/2004 Modifications : Raja N on 14.12.2004, Implemented review comments *******************************************************************************/ void CGraphBottomView::vHandleConnectionStatusChange(BOOL bConnectStatus) { // Tool is going to connect state vEnableDisableButtons( bConnectStatus ); CGraphChildFrame* pParentWnd = NULL; pParentWnd = (CGraphChildFrame*)pomGetParentWindow(); //Update Graph right view CGraphRightView* pRightView = (CGraphRightView*)pParentWnd->pomGetRightTopViewPointer(); pRightView->vHandleConnectionStatusChange(bConnectStatus); // Create/ Delete Update Timer if( bConnectStatus == TRUE ) { // Go To Run Mode //m_podGraphControl->GoToRunMode(); CGraphList* podList = NULL; if(pParentWnd != NULL) { pParentWnd->m_pomBottomView = this; } if(pParentWnd != NULL) { podList = pParentWnd->pGetSignalListDetails(); } else { return; } //int nTimeDelay = podList->m_odGraphParameters.m_nRefreshRate; //nTimerID = SetTimer( defUPDATE_TIMER_ID , nTimeDelay, NULL ); } else { // Go To Normal Mode //m_podGraphControl->GoToNormalMode(); // Check for valid timer handle if( nTimerID != 0 ) { // Kill Display Update Timer KillTimer( nTimerID ); } } }
/******************************************************************************* Function Name : OnItemchangedListSignals Input(s) : pNMHDR - Pointer to the list item struct pResult - Pointer to the result value Output : - Functionality : This function will update line type, line color, point type, point color, enable and visible properties of the selected graph element Member of : CGraphLeftView Author(s) : Raja N Date Created : 09/12/2004 Modifications : *******************************************************************************/ void CGraphLeftView::OnItemchangedListSignals(NMHDR* pNMHDR, LRESULT* /*pResult*/) { NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; // Process only selection change message if(pNMListView->uNewState == ( LVIS_FOCUSED |LVIS_SELECTED ) ) { // Get handle to selected message item int hSelItem = pNMListView->iItem; if ( hSelItem != -1 ) { // Update selected element deteils CGraphList* podList = NULL; CGraphChildFrame* pParentWnd = NULL; pParentWnd = (CGraphChildFrame*)pomGetParentWindow(); if(pParentWnd != NULL) { podList = pParentWnd->pGetSignalListDetails(); } else { return; } // Update Element Details if( podList != NULL ) { if( hSelItem < podList->m_omElementList.GetSize() ) { vSetElementDetails(podList->m_omElementList[ hSelItem ] ); vUpdateGraphControl( defFRM_ELEMENT_SELECTION, hSelItem ); } else { AfxMessageBox( defSTR_ELEMENT_NOT_FOUND, MB_ICONSTOP); } } //SGW Code commented by Arun 21-10-2010 } } // Update UI Controls vEnableDisableControls(); }
/******************************************************************************* Function Name : vSaveChangedInToConfig Input(s) : - Output : - Functionality : Updated Global Env attributes and save the changes in config module Member of : CGraphBottomView Author(s) : Raja N Date Created : 10/12/2004 Modifications : *******************************************************************************/ void CGraphBottomView::vSaveChangedInToConfig() { CGraphList * podList = NULL; CGraphChildFrame* pParentWnd = NULL; pParentWnd = (CGraphChildFrame*)pomGetParentWindow(); if(pParentWnd != NULL) podList = pParentWnd->pGetSignalListDetails(); else return; CGraphParameters * pEnv = &(podList->m_odGraphParameters); if( pEnv != NULL ) { pEnv->m_nAction = m_nAction; pEnv->m_nActiveAxis = m_nAxis; } }
/******************************************************************************* Function Name : OnBtnGrid Input(s) : - Output : - Functionality : This function will toggle grid lines. This will use graph control's ShowGrid property. Member of : CGraphBottomView Author(s) : Raja N Date Created : 10/12/2004 Modifications : Raja N on 14.12.2004, Review comments implemented *******************************************************************************/ void CGraphBottomView::OnBtnGrid() { CGraphList* podList = NULL; CGraphChildFrame* pParentWnd = NULL; pParentWnd = (CGraphChildFrame*)pomGetParentWindow(); if(pParentWnd != NULL) { podList = pParentWnd->pGetSignalListDetails(); } else { return; } if( podList != NULL) { CGraphParameters* pEnv = &(podList->m_odGraphParameters); if( pEnv != NULL ) { // Toggle grid property pEnv->m_bShowGrid = !pEnv->m_bShowGrid; // Update Graph Control if ( m_pDMGraphCtrl !=NULL ) { CComPtr<IDMGraphAxis> spAxisX; m_pDMGraphCtrl->get_Axis( HorizontalX, &spAxisX); spAxisX->put_ShowGrid(pEnv->m_bShowGrid ? VARIANT_TRUE : VARIANT_FALSE); CComPtr<IDMGraphAxis> spAxisY; m_pDMGraphCtrl->get_Axis( VerticalY, &spAxisY); spAxisY->put_ShowGrid(pEnv->m_bShowGrid ? VARIANT_TRUE : VARIANT_FALSE); } // Update Button Text vSetShowButtonState( pEnv->m_bShowGrid ); // Pass Some Pointer to avoid assertion //theApp.bSetData( SIGNAL_GRAPH_LIST, pEnv); } } }
/******************************************************************************* Function Name : OnBtnConfigure Input(s) : - Output : - Functionality : This function will shoe element configuration dialog to show and change view style parameters. Member of : CGraphBottomView Author(s) : Raja N Date Created : 10/12/2004 Modifications : *******************************************************************************/ void CGraphBottomView::OnBtnConfigure() { // Create configuration dialog and show it CGraphConfiguration omGraphConf; CGraphList * podList = NULL; CGraphChildFrame* pParentWnd = NULL; pParentWnd = (CGraphChildFrame*)pomGetParentWindow(); if(pParentWnd != NULL) podList = pParentWnd->pGetSignalListDetails(); else return; CGraphParameters par; //omGraphConf.vSetValues(podList->m_odGraphParameters); omGraphConf.m_pGraphList = podList; omGraphConf.m_pDMGraphCtrl = m_pDMGraphCtrl; omGraphConf.DoModal(); }
/******************************************************************************* Function Name : OnSelchangeComboType Input(s) : - Output : - Functionality : This function will be called by the framework if the item selection in the combobox got changed. This will update the selection in the global list and inm graph control Member of : CGraphLeftView Author(s) : Raja N Date Created : 09/12/2004 Modifications : *******************************************************************************/ void CGraphLeftView::OnSelchangeComboType() { UpdateData(); CGraphElement odSelectedElement; // Get handle to selected message item int hSelItem = m_omSignalList.GetNextItem(-1, LVNI_SELECTED); if ( hSelItem != -1 ) { CGraphList* podList = NULL; CGraphChildFrame* pParentWnd = NULL; pParentWnd = (CGraphChildFrame*)pomGetParentWindow(); if(pParentWnd != NULL) { podList = pParentWnd->pGetSignalListDetails(); } else { return; } // Update Element Details if( podList != NULL ) { if( hSelItem < podList->m_omElementList.GetSize() ) { odSelectedElement = podList->m_omElementList[ hSelItem ]; odSelectedElement.m_nLineType = m_nLineType; podList->m_omElementList[ hSelItem ] = odSelectedElement; vUpdateGraphControl( defFROM_LINE_TYPE, m_nLineType ); } else { AfxMessageBox( defSTR_ELEMENT_NOT_FOUND, MB_ICONSTOP); } } } }
/******************************************************************************* Function Name : OnInitialUpdate Input(s) : - Output : - Functionality : Initialises UI components Member of : CGraphRightView Author(s) : Raja N Date Created : 12/12/2004 Modifications : *******************************************************************************/ void CGraphRightView::OnInitialUpdate() { // Call parent class handler CFormView::OnInitialUpdate(); AfxEnableControlContainer(); m_pParentWnd = (CGraphChildFrame*)pomGetParentWindow(); //Get the CWnd reference to the DMGraph ActiveX control m_pWndGraphCtrl = GetDlgItem(IDC_DMGRAPH_CTRL); LPUNKNOWN pUnk = m_pWndGraphCtrl->GetControlUnknown(); pUnk->QueryInterface(IID_IDMGraphCtrl, (void**) &m_pDMGraphCtrl); if ( m_pDMGraphCtrl !=nullptr ) { m_pParentWnd->m_pDMGraphCtrl = m_pDMGraphCtrl; } else { m_pParentWnd->m_pDMGraphCtrl = nullptr; } m_pParentWnd->m_pomRightView = this; }
/******************************************************************************* Function Name : OnSelchangeComboSymbol Input(s) : - Output : - Functionality : This function will be called by the framework if the item selection in the combobox got changed. This will update the selection in the global list and inm graph control Member of : CGraphLeftView Author(s) : Raja N Date Created : 09/12/2004 Modifications : *******************************************************************************/ void CGraphLeftView::OnSelchangeComboSymbol() { UpdateData(); CGraphElement odSelectedElement; // Get handle to selected message item int hSelItem = m_omSignalList.GetNextItem(-1, LVNI_SELECTED); if ( hSelItem != -1 ) { CGraphList* podList = nullptr; CGraphChildFrame* pParentWnd = nullptr; pParentWnd = static_cast<CGraphChildFrame*>(pomGetParentWindow()); if(pParentWnd != nullptr) { podList = pParentWnd->pGetSignalListDetails(); } else { return; } // Update Element Details if( podList != nullptr ) { odSelectedElement = podList->m_omElementList[ hSelItem ]; odSelectedElement.m_nPointType = m_nSymbolType; podList->m_omElementList[ hSelItem ] = odSelectedElement; vUpdateGraphControl( defFROM_POINT_TYPE, m_nSymbolType ); } else { AfxMessageBox( _(defSTR_ELEMENT_NOT_FOUND), MB_ICONSTOP); } } }
/******************************************************************************* Function Name : vPopulateGraphControl Input(s) : - Output : - Functionality : This function initializes graph control with list of elements This function will be called from init and during connect. Member of : CGraphLeftView Author(s) : Raja N Date Created : 09/12/2004 Modifications : Raja N on 11.03.2005 Added channel information to statistics parameters. This will be used in report generation Arunkumar K on 25.07.2011 Commented the ClearGraph() function. *******************************************************************************/ void CGraphLeftView::vPopulateGraphControl() { if( m_pDMGraphCtrl != NULL ) { // Get Element List from Main Frame CGraphList* podList = NULL; CGraphChildFrame* pParentWnd = NULL; pParentWnd = (CGraphChildFrame*)pomGetParentWindow(); if (pParentWnd != NULL) { podList = pParentWnd->pGetSignalListDetails(); } else { ASSERT(FALSE); } CGraphElement odTemp; if ( podList != NULL ) { UINT unMsgID = 0; CString omStrName; int nItemCount = (int)podList->m_omElementList.GetSize(); // Get Buffer Size int nBufferSize = podList->m_odGraphParameters.m_nBufferSize; CComPtr<IDMGraphCollection> spGraphCollection; HRESULT hr = m_pDMGraphCtrl->get_Elements(&spGraphCollection); if(FAILED(hr)) { return; } // Add items to the list for ( int nIndex = 0; nIndex < nItemCount; nIndex++ ) { odTemp = podList->m_omElementList[ nIndex ]; CComPtr<IDispatch> spDispatch; //adds to the end and makes it selected hr = spGraphCollection->Add(&spDispatch); CComPtr<IDMGraphElement> spElement; hr = GetCurrentElement(m_pDMGraphCtrl, &spElement); // Insert element name // If this is stat parameter then append the channel ID // prefix with the name if ( odTemp.m_nValueType == eSTAT_PARAM ) { CString omStrChannel; omStrChannel.Format( defSTR_CHANNEL_NAME_FORMAT, defSTR_CHANNEL_NAME, odTemp.m_nFrameFormat ); // Prefix channel information with the stat // parameter omStrChannel += defSPACE_STR + odTemp.m_omStrElementName; _bstr_t bstrChannel = omStrChannel; spElement->put_Name(bstrChannel.GetBSTR()); } else { // Add only the Signal name _bstr_t bstrElementName = odTemp.m_omStrElementName; spElement->put_Name(bstrElementName.GetBSTR()); } // Insert Line Color spElement->put_LineColor((OLE_COLOR)odTemp.m_nLineColor); // Insert Line Type spElement->put_LineType((LineType)odTemp.m_nLineType); // Sample Point Type spElement->put_PointSymbol((SymbolType)odTemp.m_nPointType); // Set The Symbol Type to Sold. Hardcoded spElement->put_SolidPoint(VARIANT_TRUE); // Sample point type spElement->put_PointColor((OLE_COLOR)odTemp.m_nPointColor); // Visiblity param spElement->put_Show(odTemp.m_bVisible ? VARIANT_TRUE : VARIANT_FALSE); } // Set the last item as Selected m_omSignalList.SetItemState( nItemCount - 1, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED ); } } }
/******************************************************************************* Function Name : OnColorChange Input(s) : lparam - Not Used wparam - ID of the control Output : - Functionality : This function processes Color change event posted from the CColorPopup dialog. This function updates global list value as per the current selection Member of : CLeftView Author(s) : Raja N Date Created : 09/12/2004 Modifications : *******************************************************************************/ LRESULT CGraphLeftView::OnColorChange(WPARAM /*wparam*/, LPARAM lparam) { CGraphElement odSelectedElement; // Get handle to selected message item int hSelItem = m_omSignalList.GetNextItem(-1, LVNI_SELECTED); if ( hSelItem != -1 ) { CGraphList* podList = NULL; CGraphChildFrame* pParentWnd = NULL; pParentWnd = (CGraphChildFrame*)pomGetParentWindow(); if(pParentWnd != NULL) { podList = pParentWnd->pGetSignalListDetails(); } else { return 0; } // Update Element Details if( podList != NULL ) { if( hSelItem < podList->m_omElementList.GetSize() ) { odSelectedElement = podList->m_omElementList[ hSelItem ]; // Switch the Control ID switch( lparam ) { // Update Line Color case IDC_LINE_COLOR: odSelectedElement.m_nLineColor = m_omLineColor.GetColour(); // Update List member podList->m_omElementList[ hSelItem ] = odSelectedElement; // Update UI List Color m_omSignalList.SetItemData( hSelItem, odSelectedElement.m_nLineColor ); // Update Control vUpdateGraphControl( defFROM_LINE_COLOR, odSelectedElement.m_nLineColor ); ((CGraphBottomView*)pParentWnd->m_pomBottomView) ->vInsertSignalData(); ((CGraphBottomView*)pParentWnd->m_pomBottomView) ->vUpdateSignalData(); break; // Update Sample point color case IDC_POINT_COLOR: odSelectedElement.m_nPointColor = m_omPointColor.GetColour(); // Update list member podList->m_omElementList[ hSelItem ] = odSelectedElement; // Update Control vUpdateGraphControl( defFROM_POINT_COLOR, odSelectedElement.m_nPointColor ); break; default: ASSERT( FALSE ); } } else { AfxMessageBox( defSTR_ELEMENT_NOT_FOUND, MB_ICONSTOP); } } } return 0; }
void CTransmitMsgEthernet::OnInitialUpdate() { CHAR caColumnName[defMESSAGE_BLOCK_COLUMN][defSTRING_SIZE] = { defMESSAGE_BLOCK_NAME, defMESSAGE_BLOCK_TRIGGER, defMESSAGE_BLOCK_TRIG_VAL }; CFormView::OnInitialUpdate(); m_bUpdating = FALSE; CWnd* pParentWnd = NULL; // Get Parent window pointer pParentWnd = pomGetParentWindow(); // Update view pointer if( pParentWnd != NULL ) { // Register this view pointer ((CTxMsgChildFrame*)pParentWnd)->m_pEthernetTransmitMsgView = this; } ResizeParentToFit(FALSE); ResizeParentToFit(TRUE); m_bInitDone = TRUE; // MDI child need this //************added by anish********************** RECT rListCtrlRect; INT nTotalColunmSize = 0; INT nTotalStrLengthPixel = 0; INT nColumnSize = 0; //vInitSignalListCtrl(); //Setup the list control to add the messages. m_omHeaderList.SubclassDlgItem(IDC_LSTC_HDR_CONFIG, this); m_omHeaderList.SetExtendedStyle( LVS_EX_FULLROWSELECT | LVS_EX_SUBITEMIMAGES | LVS_EX_GRIDLINES); CWnd* pWnd = m_omHeaderList.GetWindow(GW_CHILD); ASSERT(pWnd != NULL); CRect rctList; m_omHeaderList.GetWindowRect(&rctList); int nColWidth = rctList.Width() - 2; int colwidths[] = { 10, 10, 10, 7, 7, 4, 20 }; int total_cx = 0; TCHAR* acColData[]= { _T("Packet Name"), _T("Source MAC"), _T("Destination Mac"), _T("Protocol"), _T("Repetition"), _T("Key"), _T("DLC") }; LVCOLUMN lvcolumn; memset(&lvcolumn, 0, sizeof(lvcolumn)); lvcolumn.mask = LVCF_FMT | LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH; // Associate Header control Image List if( m_omHeaderImageList.m_hImageList == NULL ) { m_omHeaderImageList.Create( IDR_BMP_CHECKBOX, 16, 1, RGB(0,0,255) ); } // Set the Image List // Only if it is sucessfully created if( m_omHeaderImageList.m_hImageList != NULL ) { m_omHeaderList.SetImageList(&m_omHeaderImageList, LVSIL_SMALL); CHeaderCtrl* pHeader = m_omHeaderList.GetHeaderCtrl(); if( pHeader != NULL ) { pHeader->SetImageList( &m_omHeaderImageList ); HDITEM hditem; hditem.mask = HDI_IMAGE | HDI_FORMAT; if( pHeader->GetItem(0, &hditem ) == TRUE ) { hditem.fmt |= HDF_IMAGE; hditem.iImage = 0; pHeader->SetItem(0, &hditem ); //pHeader->SetItem(6, &hditem ); } } } m_hTransmitWnd = m_hWnd; //add columns //ColumnProperty ouProperty; //ouProperty.bMovable = true; for (int i = 0; i < (sizeof (acColData) / sizeof acColData[0]); i++) { // Column formating if (( i == FIRST_COL )) //4 col - Cycle No 6-DataLen , 7 - DataBytes { lvcolumn.fmt = LVCFMT_LEFT ; } else { lvcolumn.fmt = LVCFMT_CENTER; } lvcolumn.pszText = acColData[i]; lvcolumn.cchTextMax = (int)strlen(acColData[i]); lvcolumn.iSubItem = i; lvcolumn.cx = (acColData[i + 1] == NULL) ? nColWidth - total_cx - 2 : (nColWidth * colwidths[i]) / 64; total_cx += lvcolumn.cx; //ouProperty.bMovable = true; if ( i== FIFTH_COL|| i == SEVENTH_COL ) { //ouProperty.bMovable = false; } m_omHeaderList.InsertColumn(i, &lvcolumn); } m_hTransmitWnd = m_hWnd; int nConfigChannel = CTxEthernetDataStore::ouGetTxEthernetDataStoreObj().m_nChannelsConfigured; CString strChannel; UpdateTxView(CTxEthernetDataStore::ouGetTxEthernetDataStoreObj().m_nChannelsConfigured); m_bInitDone = FALSE; if ( CTxEthernetDataStore::ouGetTxEthernetDataStoreObj().m_eBusStatus == BUS_CONNECTED) { vChangeDelButtonStatus(false); } else { vChangeDelButtonStatus(true); } UpdateTxView(CTxEthernetDataStore::ouGetTxEthernetDataStoreObj().m_nChannelsConfigured); }
/******************************************************************************* Function Name : vPopulateElementList Input(s) : - Output : - Functionality : This function will read global element list and will update element UI list control Member of : CGraphLeftView Author(s) : Raja N Date Created : 09/12/2004 Modifications : Raja N on 11.3.2005 Added Channel information for statistics parameters in the Type column *******************************************************************************/ void CGraphLeftView::vPopulateElementList() { // Get Element List CGraphList* podList = NULL; // Remove All items in the list m_omSignalList.DeleteAllItems(); // Get List pointer CGraphChildFrame* pParentWnd = NULL; pParentWnd = (CGraphChildFrame*)pomGetParentWindow(); if(pParentWnd != NULL) { podList = pParentWnd->pGetSignalListDetails(); } else { return; } CGraphElement odTemp; if( podList != NULL ) { UINT unMsgID = 0; CString omStrName; int nItemCount = (int)podList->m_omElementList.GetSize(); // Add items to the list for( int nIndex = 0; nIndex < nItemCount; nIndex++ ) { odTemp = podList->m_omElementList[ nIndex ]; // Statistics Parameter if( odTemp.m_nValueType == eSTAT_PARAM ) { // Insert Category m_omSignalList.InsertItem( nIndex, defSTR_STATISTICS_NAME); // Insert element name m_omSignalList.SetItemText( nIndex, 1, odTemp.m_omStrElementName ); // Insert Channel String CString omStrChannel; omStrChannel.Format( defSTR_CHANNEL_NAME_FORMAT, defSTR_CHANNEL_NAME, odTemp.m_nFrameFormat ); m_omSignalList.SetItemText( nIndex, 2, omStrChannel ); // Set Color of the entry m_omSignalList.SetItemData( nIndex, odTemp.m_nLineColor ); } else { unMsgID = odTemp.m_nMsgID; // Get Message Name omStrName = odTemp.m_strMsgName; // Add Element Catogory m_omSignalList.InsertItem( nIndex, omStrName ); // Add Element Name m_omSignalList.SetItemText( nIndex, 1, odTemp.m_omStrElementName ); // Set Color of the entry m_omSignalList.SetItemData( nIndex, odTemp.m_nLineColor ); // Add Value Type if( odTemp.m_nValueType == eRAW_VALUE ) { m_omSignalList.SetItemText( nIndex, 2, defSTR_RAW_VALUE ); } else { m_omSignalList.SetItemText( nIndex, 2, defSTR_PHY_VALUE ); } } } } }
/******************************************************************************* Function Name : vHandleConnectionStatusChange Input(s) : bConnect - TRUE if the tool is connected, FALSE otherwise Output : - Functionality : Handles connection change event. Initialised graph control Member of : CGraphLeftView Author(s) : Raja N Date Created : 09/12/2004 Modifications : Arunkumar K on 25/07/2011 Added ClearGraph() function call. *******************************************************************************/ void CGraphLeftView::vHandleConnectionStatusChange(BOOL bConnect) { if( bConnect && m_pDMGraphCtrl) { // Remove All items in the control m_pDMGraphCtrl->ClearGraph(); // Set X,Y Range double dXMin,dXMax, dYMin, dYMax; m_pDMGraphCtrl->GetRange(&dXMin, &dXMax, &dYMin, &dYMax); dYMin = 0.0; dYMax = 100.0; m_pDMGraphCtrl->SetRange(defDEFAULT_XRANGE_MIN, defDEFAULT_XRANGE_MAX, dYMin, dYMax); } BOOL bEnable = !bConnect; // Update Local Instance m_bConnectionStatus = bConnect; // Update Configuration Controls if(bEnable) { CGraphList* podList = NULL; CGraphChildFrame* pParentWnd = NULL; pParentWnd = (CGraphChildFrame*)pomGetParentWindow(); if(pParentWnd != NULL) { podList = pParentWnd->pGetSignalListDetails(); } else { ASSERT(FALSE); } // Update UI Elements if( podList != NULL ) { if( podList->m_omElementList.GetSize() > 0 && m_omSignalList.GetSelectedCount() > 0 ) { vEnableControls( bEnable ); } } } else { vEnableControls( bEnable ); } // Disable Configure button CWnd* pWnd = NULL; pWnd = GetDlgItem( IDC_BTN_CONFIGURE ); if( pWnd != NULL ) { pWnd->EnableWindow( bEnable ); } if( bConnect == TRUE ) { // Add Elements in to the graph control vPopulateGraphControl(); } }
/******************************************************************************* Function Name : vInitGraphControl Input(s) : - Output : - Functionality : This function will initialise graph control. This will set viewstyle parameters of the graph control Member of : CGraphBottomView Author(s) : Raja N Date Created : 10/12/2004 Modifications : *******************************************************************************/ void CGraphBottomView::vInitGraphControl() { CGraphList* podList = NULL; CGraphChildFrame* pParentWnd = NULL; pParentWnd = (CGraphChildFrame*)pomGetParentWindow(); if(pParentWnd != NULL) { podList = pParentWnd->pGetSignalListDetails(); } else { return; } if( podList != NULL ) { CGraphParameters* pEnv = &podList->m_odGraphParameters; if( pEnv != NULL ) { // Init Active Axis m_nAxis = pEnv->m_nActiveAxis; // Init Active Action m_nAction = pEnv->m_nAction; // Set Show Grid Action vSetShowButtonState( pEnv->m_bShowGrid ); // Set Graph Params if( m_pDMGraphCtrl != NULL ) { // Set Axis Color m_pDMGraphCtrl->put_AxisColor((OLE_COLOR)pEnv->m_nAxisColor); // Set Plot Area Color m_pDMGraphCtrl->put_PlotAreaColor((OLE_COLOR)pEnv->m_nPlotAreaColor); // Set Grid Color m_pDMGraphCtrl->put_GridColor((OLE_COLOR)pEnv->m_nGridColor); // Set Frame Style m_pDMGraphCtrl->put_FrameStyle((FrameStyle)pEnv->m_nFrameStyle); // Set Frame Color m_pDMGraphCtrl->put_ControlFrameColor((OLE_COLOR)pEnv->m_nFrameColor); // Set Grid Lines Count CComPtr<IDMGraphAxis> spAxisX; m_pDMGraphCtrl->get_Axis( HorizontalX, &spAxisX); spAxisX->put_GridNumber((short)pEnv->m_nXGridLines); CComPtr<IDMGraphAxis> spAxisY; m_pDMGraphCtrl->get_Axis( VerticalY, &spAxisY); spAxisY->put_GridNumber((short)pEnv->m_nYGridLines); // Set Show Grid spAxisX->put_ShowGrid(pEnv->m_bShowGrid ? VARIANT_TRUE : VARIANT_FALSE); spAxisY->put_ShowGrid(pEnv->m_bShowGrid ? VARIANT_TRUE : VARIANT_FALSE); // Set Format String spAxisX->put_Format( CComBSTR(defSTR_X_AXIS_FORMAT) ); spAxisY->put_Format( CComBSTR(defSTR_Y_AXIS_FORMAT) ); // Set X,Y Range double dXMin,dXMax, dYMin, dYMax; m_pDMGraphCtrl->GetRange(&dXMin, &dXMax, &dYMin, &dYMax); dYMax = 100.0; m_pDMGraphCtrl->SetRange(defDEFAULT_XRANGE_MIN, defDEFAULT_XRANGE_MAX, dYMin, dYMax); //Set the caption BSTR bstrCaption(L"Graph Display - CAN"); m_pDMGraphCtrl->put_Caption(bstrCaption); } // Update Local DDX Variables UpdateData( FALSE ); // Update Axis and action vSetAction(); } } }
void CTxMsgListView::OnInitialUpdate() { CFormView::OnInitialUpdate(); // Initialise window pointer in the Tx child window CTxMsgChildFrame* pomChildFrame = (CTxMsgChildFrame* )pomGetParentWindow(); // Update View Pointer if( pomChildFrame != nullptr ) { pomChildFrame->vSetTxMsgViewPointers( eTxMsgMessageListView, this ); } // set Init flag to TRUE m_bInitDlg = TRUE; // Init Message List Control CRect rListCtrlRect; CHAR caColumnName[defMESSAGE_FRAME_COLUMN][defSTRING_SIZE] = { defMESSAGE_ID, defSTR_CHANNEL_NAME, defMESSAGE_TYPE, defMESSSAGE_DLC, defMESSAGE_DATA_BYTES }; //Calculate the total size of all column header m_omLctrMsgList.GetWindowRect( &rListCtrlRect); int nTotalColunmSize = rListCtrlRect.right - rListCtrlRect.left; int nTotalStrLengthPixel = 0; int i; //i declared outside the for loop for( i=0; i<defMESSAGE_FRAME_COLUMN; i++) { nTotalStrLengthPixel += m_omLctrMsgList.GetStringWidth(caColumnName[i]) ; } //Insert each column name after calculating the size for the same. INT nFormat = 0; for(i=0; i<defMESSAGE_FRAME_COLUMN; i++) { int nColumnSize = m_omLctrMsgList.GetStringWidth(_(caColumnName[i])) ; nColumnSize += (nTotalColunmSize-nTotalStrLengthPixel)/defMESSAGE_FRAME_COLUMN; nFormat = LVCFMT_CENTER; // Switch Column Index switch( i ) { case defMESSAGE_FRAME_COLUMN - 1 : // Data Bytes Column nColumnSize += static_cast <INT>(4.25*defDATA_BYTES_EXTRA); nFormat = LVCFMT_LEFT; break; case 0: // Message ID / Name Column. Don't alter this column break; case 1: // Channels Column nColumnSize -= static_cast <INT>(2.2*defDATA_BYTES_EXTRA); break; default: // Others nColumnSize -= static_cast <INT>(1.1*defDATA_BYTES_EXTRA ); } // Insert the column in to the list m_omLctrMsgList.InsertColumn(i,_(caColumnName[i]), nFormat, nColumnSize); } // Set extended property // Enable Check box m_omLctrMsgList.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES ); // Associate image list to the list item // Create only onece if( m_omImageList.m_hImageList == nullptr ) { m_omImageList.Create( IDR_BMP_MSGSGDB, defSIGNAL_ICON_SIZE, 1, WHITE_COLOR ); } // Set the Image List // Only if it is sucessfully created if( m_omImageList.m_hImageList != nullptr ) { m_omLctrMsgList.SetImageList( &m_omImageList, LVSIL_SMALL); } // Associate Header control Image List if( m_omHeaderImageList.m_hImageList == nullptr ) { m_omHeaderImageList.Create( IDR_BMP_CHECKBOX, defSIGNAL_ICON_SIZE, 1, BLUE_COLOR ); } // Set the Image List // Only if it is sucessfully created if( m_omHeaderImageList.m_hImageList != nullptr ) { CHeaderCtrl* pHeader = m_omLctrMsgList.GetHeaderCtrl(); if( pHeader != nullptr ) { pHeader->SetImageList( &m_omHeaderImageList ); HDITEM hditem; hditem.mask = HDI_IMAGE | HDI_FORMAT; if( pHeader->GetItem(0, &hditem ) == TRUE ) { hditem.fmt |= HDF_IMAGE; hditem.iImage = 0; pHeader->SetItem(0, &hditem ); } } } m_omButtonSendMsg.EnableWindow(FALSE); m_omButtonDeleteSelMsg.EnableWindow(FALSE); // Set the selection to the first item m_omLctrMsgList.SetItemState( 0, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED ); m_bInitDlg = FALSE; }