/******************************************************************************* Function Name : OnBnClickedCheckAutoUpdate Input(s) : - Output : - Functionality : This checkbox updates the content automaticallyan stores it in global store Member of : CTxFunctionsView Author(s) : Ashwin. R. Uchil Date Created : 28.5.2012 Modifications : *******************************************************************************/ void CTxFunctionsView::OnBnClickedCheckAutoUpdate() { CTxMsgBlocksView* pBlocksView = (CTxMsgBlocksView*)pomGetBlocksViewPointer(); if (NULL != pBlocksView) { if (NULL == pBlocksView->m_psMsgBlockList) { GetDlgItem(IDC_BTN_UPDATE)->EnableWindow(FALSE); } else { GetDlgItem(IDC_BTN_UPDATE)->EnableWindow(TRUE); } } else { GetDlgItem(IDC_BTN_UPDATE)->EnableWindow(FALSE); } if((m_CheckBoxAutoUpdate.GetCheck() == BST_CHECKED)) { vAccessButtonApply(); CTxWndDataStore::ouGetTxWndDataStoreObj().m_bAutoSavedEnabled = true; //CTxMsgManager::s_bDelayBetweenBlocksOnly = true; if (NULL != pBlocksView) { UINT unTimerVal; CString csTimerVal; pBlocksView->GetDlgItemText(IDC_EDIT_BLOCK_TRG_TIMER_VAL, csTimerVal); unTimerVal = (UINT)atol(csTimerVal.GetBuffer(0)); CTxWndDataStore::ouGetTxWndDataStoreObj().m_unTimeDelayBtwnMsgBlocks = unTimerVal; CTxMsgManager::s_unTimeDelayBtnMsgBlocks = unTimerVal; //set the status of delay between blocks if(pBlocksView->m_omDelayBtwnBlocks.GetCheck() == BST_CHECKED) { CTxMsgManager::s_bDelayBetweenBlocksOnly = true; CTxWndDataStore::ouGetTxWndDataStoreObj().m_bDelayBetweenMsgBlocks = true; pBlocksView->m_bDelayBtnBlocks = true; } else { CTxMsgManager::s_bDelayBetweenBlocksOnly = false; CTxWndDataStore::ouGetTxWndDataStoreObj().m_bDelayBetweenMsgBlocks = false; pBlocksView->m_bDelayBtnBlocks = false; } } } else { CTxWndDataStore::ouGetTxWndDataStoreObj().m_bAutoSavedEnabled = false; //CTxMsgManager::s_bDelayBetweenBlocksOnly = false; } }
/******************************************************************************* 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));*/ } }
void CTxFunctionsView::OnButtonApply() { SetUpdateBtnChanges(); //save the values of delay between blocks UINT unTimerVal; CString csTimerVal; CTxMsgBlocksView* pomBlockView = NULL; pomBlockView = (CTxMsgBlocksView*)pomGetBlocksViewPointer(); if(pomBlockView) { pomBlockView->GetDlgItemText(IDC_EDIT_BLOCK_TRG_TIMER_VAL, csTimerVal); if(((CButton*) pomBlockView->GetDlgItem(IDC_CHECK_MSG_BLOCK_DELAY))->GetCheck() == BST_CHECKED) { CTxWndDataStore::ouGetTxWndDataStoreObj().m_bDelayBetweenMsgBlocks = true; CTxMsgManager::s_bDelayBetweenBlocksOnly = true; pomBlockView->m_bDelayBtnBlocks = true; } else { CTxWndDataStore::ouGetTxWndDataStoreObj().m_bDelayBetweenMsgBlocks = false; CTxMsgManager::s_bDelayBetweenBlocksOnly = false; pomBlockView->m_bDelayBtnBlocks = false; } } unTimerVal = (UINT)atol(csTimerVal.GetBuffer(0)); CTxWndDataStore::ouGetTxWndDataStoreObj().m_unTimeDelayBtwnMsgBlocks = unTimerVal; CTxMsgManager::s_unTimeDelayBtnMsgBlocks = unTimerVal; this->SetFocus(); // The following block of code can be enabled if message to be transmitted in following scenario : // Message transmission is ON, Empty block is present. Added a message to the // empty block and Update button is selected /*if(CTxMsgManager::s_TxFlags.nGetFlagStatus(TX_SENDMESG)) { CTxMsgBlocksView* pBlocksView = (CTxMsgBlocksView*)pomGetBlocksViewPointer(); PSMSGBLOCKLIST psMsgCurrentBlock = NULL; if (NULL != pomBlockView) { psMsgCurrentBlock = pomBlockView->psGetMsgBlockPointer( pomBlockView->m_nSelectedMsgBlockIndex, pomBlockView->m_psMsgBlockList ); // If no msg is present at the start of msg transmission and if the // user adds a one or more msg and selects the update button, then send the new msg if(psMsgCurrentBlock->m_unMsgCount >= 1) { CTxMsgManager::s_podGetTxMsgManager()->vStartTransmission(0); } } }*/ }
void CTxFunctionsView::OnInvokeClose() { CTxMsgBlocksView* pBlocksView = (CTxMsgBlocksView*)pomGetBlocksViewPointer(); bool bUnChanged = true; if(m_CheckBoxAutoUpdate.GetCheck() == BST_CHECKED) //setting will already be saved so exit { return; } if(pBlocksView != NULL) { PSMSGBLOCKLIST psMsgBlock = NULL; psMsgBlock = pBlocksView->psGetMsgBlockPointer( 0, pBlocksView->m_psMsgBlockList ); if(psMsgBlock != NULL) { bUnChanged = CTxWndDataStore::ouGetTxWndDataStoreObj().nCompareBlockLists(psMsgBlock); if(pBlocksView->m_bDelayBtnBlocks != CTxWndDataStore::ouGetTxWndDataStoreObj().m_bDelayBetweenMsgBlocks) { bUnChanged = false; } CString omstrData; pBlocksView->m_omTimeDelayBtwnBlocks.GetWindowTextA(omstrData); if(atoi(omstrData.GetBuffer(0)) != CTxWndDataStore::ouGetTxWndDataStoreObj().m_unTimeDelayBtwnMsgBlocks) { bUnChanged = false; } } else if(CTxWndDataStore::ouGetTxWndDataStoreObj().psReturnMsgBlockPointer()!= NULL) { bUnChanged = false; } if(bUnChanged == true) { return; } } if( bUnChanged == false) //if there are any changes, then save it. { if( AfxMessageBox( defSTR_TX_SAVE_CONFIRMATION, MB_YESNO | MB_ICONQUESTION ) == IDYES ) { // Save Changes OnButtonApply(); } } }
void CTxFunctionsView::vReloadData() { // Get Other View Ponters CTxMsgBlocksView* pomBlockView = NULL; CTxMsgListView* pomlistView = NULL; CTxMsgDetailsView* pomDetailsView = NULL; // Fetch pointers from Tx Child Frame pomBlockView = ( CTxMsgBlocksView* )pomGetBlocksViewPointer(); pomlistView = ( CTxMsgListView* )pomGetListViewPointer(); pomDetailsView = ( CTxMsgDetailsView* )pomGetDetailsViewPointer(); if( pomBlockView != NULL && pomlistView != NULL && pomDetailsView != NULL ) { // Clear all data pomBlockView->m_omLctrMsgBlockName.DeleteAllItems(); pomlistView->m_omLctrMsgList.DeleteAllItems(); pomDetailsView->m_omLctrSigList.DeleteAllItems(); // Set this flag to avoid processing item change messages during init pomBlockView->m_bInitDlg = TRUE; pomlistView->m_bInitDlg = TRUE; //Clear the existing memory CTxWndDataStore::ouGetTxWndDataStoreObj().vReleaseMultiMsgInfo( pomBlockView->m_psMsgBlockList ); pomBlockView->m_psMsgBlockList = NULL; /*vRelease( TX_SEND_MULTI_MSGS, (void**)&(pomBlockView->m_psMsgBlockList) );*/ // Get the message block count. No memory allocation is required. UINT* punCount = &( pomBlockView->m_unMsgBlockCount ); CTxWndDataStore::ouGetTxWndDataStoreObj().bGetTxData(TX_MSG_BLOCK_COUNT, (void**)&punCount); // Make a local copy of the data structure // The local copy will be used to manipulate message frame details // Memory allocation will be done in the CConfigDetails class. // Get the pointer only if there m_unMsgBlockCount>0 if( pomBlockView->m_unMsgBlockCount > 0 ) { CTxWndDataStore::ouGetTxWndDataStoreObj().bGetTxData( TX_SEND_MULTI_MSGS, (void**)&(pomBlockView->m_psMsgBlockList) ); } if( pomBlockView->m_unMsgBlockCount == 0 ) { pomBlockView->vEnableControls(FALSE); /*pomBlockView->m_omButtonTxAllFrame.EnableWindow(FALSE);*/ pomBlockView->m_omComboAllMsgs.EnableWindow(FALSE); pomlistView->m_omButtonDeleteAllMsg.EnableWindow(FALSE); pomlistView->m_omButtonDeleteSelMsg.EnableWindow(FALSE); } else { pomlistView->m_omButtonDeleteAllMsg. EnableWindow(!CTxMsgManager::s_TxFlags.nGetFlagStatus(TX_SENDMESG) ); } PSMSGBLOCKLIST psCurrentMsgBlock = NULL; CString omStr = STR_EMPTY; psCurrentMsgBlock = pomBlockView->m_psMsgBlockList; // Disable AllTxMessage check box // This will be updated in the function vDisplayMsgBlockDetails // Disabling it here will avoid enabling the control when no blocks or // messages are present pomBlockView->m_omComboAllMsgs.EnableWindow(FALSE); /*pomBlockView->m_omButtonTxAllFrame.EnableWindow( FALSE );*/ for(UINT i = 0; i< pomBlockView->m_unMsgBlockCount; i++) { omStr = STR_EMPTY; if(psCurrentMsgBlock != NULL ) { pomBlockView->m_omLctrMsgBlockName.InsertItem( i, psCurrentMsgBlock->m_acStrBlockName); if(psCurrentMsgBlock->m_bType == TRUE) { pomBlockView->m_omLctrMsgBlockName.SetItemText( i, defSUBITEM_MSGBLOCK_TYPE, defMSG_CYCLIC ); } else { pomBlockView->m_omLctrMsgBlockName.SetItemText( i, defSUBITEM_MSGBLOCK_TYPE, defMSG_MONOSHOT ); } // Use Macros to find the type // Timer? if( IS_TIME_TRIGGERED(psCurrentMsgBlock->m_ucTrigger) ) { omStr.Format( defSTR_TIMER_VAL_FMT_SPECIFIER, psCurrentMsgBlock->m_unTimeInterval ); omStr += defMESSAGE_TRIG_MS; if( IS_KEY_TRIGGERED(psCurrentMsgBlock->m_ucTrigger) ) { omStr += defSTR_MSG_BLOCK_TRIGGER_SEPRATOR; } } // Key ? if( IS_KEY_TRIGGERED(psCurrentMsgBlock->m_ucTrigger) ) { CString omStrKeyVal; omStrKeyVal.Format( defSTR_KEY_VAL_FMT_SPECIFIER, psCurrentMsgBlock->m_ucKeyValue ); omStr += omStrKeyVal; } pomBlockView->m_omLctrMsgBlockName.SetItemText( i, defSUBITEM_MSGBLOCK_TRG_VAL, omStr ); pomBlockView->m_omLctrMsgBlockName.SetCheck( i, psCurrentMsgBlock->m_bActive ); psCurrentMsgBlock = psCurrentMsgBlock->m_psNextMsgBlocksList; } } // Clear Init Flag pomBlockView->m_bInitDlg = FALSE; pomlistView->m_bInitDlg = FALSE; pomBlockView->m_omLctrMsgBlockName.SetItemState( pomBlockView->m_nSelectedMsgBlockIndex, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED ); // Clear the Modified Flag pomBlockView->m_bModified = FALSE; // Disable Update Button m_omButtonApply.EnableWindow( FALSE ); } }
void CTxMsgListView::OnDeleteAllMsg() { CTxMsgBlocksView* pomBlocksView = nullptr; pomBlocksView = ( CTxMsgBlocksView*)pomGetBlocksViewPointer(); CTxMsgDetailsView* pomDetailsView = nullptr; pomDetailsView = (CTxMsgDetailsView*)pomGetDetailsViewPointer(); CTxFunctionsView* pomFunctionsView = nullptr; pomFunctionsView = (CTxFunctionsView*)pomGetFunctionsViewPointer(); if( pomBlocksView != nullptr && pomDetailsView != nullptr && pomFunctionsView != nullptr ) { // give a warning message before deleting it. if ( AfxMessageBox( _(defDEL_ALL_MSG_FRAME), MB_YESNO|MB_ICONQUESTION) == IDYES) { // check for valid message block selection index. if( pomBlocksView->m_nSelectedMsgBlockIndex != -1) { BOOL bDeleted = FALSE; PSMSGBLOCKLIST psMsgCurrentBlock = nullptr; // Get the current message block pointer. psMsgCurrentBlock = pomBlocksView->psGetMsgBlockPointer( pomBlocksView->m_nSelectedMsgBlockIndex, pomBlocksView->m_psMsgBlockList ); if(psMsgCurrentBlock != nullptr ) { // Call function to delete all message and clear the list // control if the delete is successfull. bDeleted = bDeleteAllMsgFromBlock(psMsgCurrentBlock); if(bDeleted == TRUE ) { m_omLctrMsgList.DeleteAllItems(); //Disable Delete All button m_omButtonDeleteAllMsg.EnableWindow(FALSE); m_omButtonDeleteSelMsg.EnableWindow(FALSE); if(pomFunctionsView->m_CheckBoxAutoUpdate.GetCheck() == BST_UNCHECKED) { pomFunctionsView->m_omButtonApply.EnableWindow(TRUE); } // Update Add button status pomDetailsView->vEnableAddButton( TRUE ); // Update Modified Flag pomBlocksView->m_bModified = TRUE; } m_omButtonSendMsg.EnableWindow(FALSE); //changes added to update the Global in case of autoupdate CTxFunctionsView* pView = ( CTxFunctionsView* )pomGetFunctionsViewPointer(); if( pView != nullptr ) { if(pView->m_CheckBoxAutoUpdate.GetCheck() == BST_CHECKED) { pView->vAccessButtonApply(); this->SetFocus(); } } } } } } }
void CTxMsgListView::OnDeleteSelectedMsg() { CTxMsgBlocksView* pomBlocksView = nullptr; pomBlocksView = ( CTxMsgBlocksView*)pomGetBlocksViewPointer(); CTxMsgDetailsView* pomDetailsView = nullptr; pomDetailsView = (CTxMsgDetailsView*)pomGetDetailsViewPointer(); CTxFunctionsView* pomFunctionsView = nullptr; pomFunctionsView = (CTxFunctionsView*)pomGetFunctionsViewPointer(); if( pomBlocksView != nullptr && pomDetailsView != nullptr && pomFunctionsView != nullptr ) { if ( AfxMessageBox( _(defDEL_SEL_MSG_FRAME), MB_YESNO|MB_ICONQUESTION) == IDYES) { if(m_nSelectedMsgIndex != -1) { if(pomBlocksView->m_nSelectedMsgBlockIndex != -1 ) { PSMSGBLOCKLIST psCurrentMsgBlock = nullptr; psCurrentMsgBlock = pomBlocksView->psGetMsgBlockPointer( pomBlocksView->m_nSelectedMsgBlockIndex, pomBlocksView->m_psMsgBlockList); if(psCurrentMsgBlock != nullptr ) { BOOL bReturn = FALSE; bReturn = bDeleteMsgFromBlock(psCurrentMsgBlock); if(bReturn == TRUE ) { if(pomFunctionsView->m_CheckBoxAutoUpdate.GetCheck() == BST_UNCHECKED) pomFunctionsView->m_omButtonApply. EnableWindow(TRUE); pomDetailsView->vEnableAddButton( TRUE ); // Update Modified Flag pomBlocksView->m_bModified = TRUE; } // Set the focus to list control back if it is not empty // Shift the selection to item under fucus as selection // deos not move up if an selected item is deleted. m_nSelectedMsgIndex = m_omLctrMsgList.GetNextItem(-1,LVIS_FOCUSED); if(m_nSelectedMsgIndex != -1 ) { m_omLctrMsgList.SetItemState( m_nSelectedMsgIndex, LVIS_SELECTED, LVIS_SELECTED); } //changes added to update the Global in case of autoupdate CTxFunctionsView* pView = ( CTxFunctionsView* )pomGetFunctionsViewPointer(); if( pView != nullptr ) { if(pView->m_CheckBoxAutoUpdate.GetCheck() == BST_CHECKED) { pView->vAccessButtonApply(); /*this->SetFocus();*/ m_omLctrMsgList.SetFocus(); } } } } } } } }
void CTxMsgListView::OnSendSelectedMsg() { PSTXSELMSGDATA psTxCanMsg = nullptr; UINT unTotalSelection = m_omLctrMsgList.GetSelectedCount(); CTxMsgBlocksView* pomBlocksView = nullptr; pomBlocksView = ( CTxMsgBlocksView*)pomGetBlocksViewPointer(); if( pomBlocksView != nullptr ) { // Get the total selected count. if(unTotalSelection > 0 ) { // create the pointer and check if it has created successfully. psTxCanMsg = new STXSELMSGDATA; if(psTxCanMsg != nullptr ) { // Fill the structure and create memory for array of message // frame to be transmitted. psTxCanMsg->m_unCount = unTotalSelection; psTxCanMsg->m_psTxMsg = new STCAN_MSG[unTotalSelection]; if(psTxCanMsg->m_psTxMsg != nullptr ) { // get the current message block PSMSGBLOCKLIST psMsgBlock = nullptr; psMsgBlock = pomBlocksView->psGetMsgBlockPointer( pomBlocksView->m_nSelectedMsgBlockIndex, pomBlocksView->m_psMsgBlockList ); if(psMsgBlock != nullptr ) { PSTXCANMSGLIST psTxMsgList = nullptr; INT nCurrentIndex = -1; // Get the message which is selected for transmission // Since selection may be random so get the selection // index one by one and get the pointer for that message // frame . After that copy it to the structure. for(UINT i =0 ; i<unTotalSelection; i++) { nCurrentIndex = m_omLctrMsgList.GetNextItem( nCurrentIndex, LVNI_SELECTED ); // If failure to get the index then assign Invalid // message ID to avoid any problem in transmission. if(nCurrentIndex != -1 ) { psTxMsgList = psGetMsgDetailPointer ( nCurrentIndex, psMsgBlock ); updateRollingCntCheckSum(psTxMsgList); if(psTxMsgList != nullptr ) { memcpy( &(psTxCanMsg->m_psTxMsg[i]), &(psTxMsgList->m_sTxMsgDetails.m_sTxMsg), sizeof(STCAN_MSG) ); } else { psTxCanMsg->m_psTxMsg[i].m_unMsgID = static_cast <UINT> (-1); } } else { psTxCanMsg->m_psTxMsg[i].m_unMsgID = static_cast <UINT> (-1 ); } } g_bStopSelectedMsgTx = FALSE; // Get handle of thread and assign it to pulic data // member in app class. This will be used to terminate // the thread. CWinThread* pomThread = nullptr ; pomThread = AfxBeginThread( CTxMsgManager::s_unSendSelectedMsg, psTxCanMsg ); if(pomThread != nullptr && CTxMsgManager::s_sUtilThread.m_hThread == nullptr ) { CTxMsgManager::s_sUtilThread.m_hThread = pomThread->m_hThread; } } } } } } }
void CTxMsgListView::OnItemchangedLstcMsgDetails(NMHDR* pNMHDR, LRESULT* pResult) { NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; CTxMsgBlocksView* pomBlocksView = nullptr; pomBlocksView = ( CTxMsgBlocksView*)pomGetBlocksViewPointer(); if( pomBlocksView != nullptr && m_bInitDlg == FALSE ) { // Get new state of the list control items // and check for if it is selected and focused. UINT unCurrentState = pNMListView->uNewState & defMASK_LIST_CTRL; if(pNMListView->uNewState & (LVIS_FOCUSED|LVIS_SELECTED) ) { if((TRUE == CTxMsgManager::s_TxFlags.nGetFlagStatus(TX_CONNECTED)) && (pNMListView->uNewState & LVIS_SELECTED)) //&& (pNMListView->uNewState&LVIS_FOCUSED)) { m_omButtonSendMsg.EnableWindow(TRUE); } if(FALSE == CTxMsgManager::s_TxFlags.nGetFlagStatus(TX_SENDMESG)) { m_omButtonDeleteSelMsg.EnableWindow(!CTxMsgManager::s_TxFlags.nGetFlagStatus(TX_SENDMESG)); m_omButtonDeleteAllMsg.EnableWindow(!CTxMsgManager::s_TxFlags.nGetFlagStatus(TX_SENDMESG)); } } else if(pNMListView->uChanged == LVIF_STATE) { //Check for the count UINT unCount = m_omLctrMsgList.GetItemCount(); if ( unCount <= 0) { m_omButtonDeleteAllMsg.EnableWindow(FALSE); } if(!(pNMListView->uNewState & defMASK_CHECK_UNCHECK)) { m_omButtonSendMsg.EnableWindow(FALSE); m_omButtonDeleteSelMsg.EnableWindow(FALSE); } } if( pNMListView->uChanged == LVIF_STATE ) { PSTXCANMSGLIST psTxMsgList = nullptr ; PSMSGBLOCKLIST psMsgBlock = nullptr ; // check if the item is focused and selected. unCurrentState = pNMListView->uNewState &(LVIS_FOCUSED |LVIS_SELECTED); psMsgBlock = pomBlocksView->psGetMsgBlockPointer( pomBlocksView->m_nSelectedMsgBlockIndex, pomBlocksView->m_psMsgBlockList ); // If yes, update message information for newly selected item. if(unCurrentState != FALSE) { psTxMsgList = psGetMsgDetailPointer( pNMListView->iItem, psMsgBlock ); m_nSelectedMsgIndex = pNMListView->iItem; if(psTxMsgList != nullptr ) { CTxMsgDetailsView* pView = (CTxMsgDetailsView*) pomGetDetailsViewPointer(); if( pView != nullptr ) { pView->vSetValues((psTxMsgList)); // Insert Signal List Update Code Here pView->bUpdateSignalList( psTxMsgList->m_sTxMsgDetails.m_sTxMsg ); pView->vEnableAddButton( TRUE ); // Clear error message if any pView->bSetStatusText(""); psMsgBlock->m_bModified = true; } } } else { m_nSelectedMsgIndex = -1; } } if( pNMListView->uNewState & defMASK_CHECK_UNCHECK ) { PSTXCANMSGLIST psTxMsgList = nullptr ; PSMSGBLOCKLIST psMsgBlock = nullptr ; psMsgBlock = pomBlocksView->psGetMsgBlockPointer( pomBlocksView->m_nSelectedMsgBlockIndex, pomBlocksView->m_psMsgBlockList ); psTxMsgList = psGetMsgDetailPointer(pNMListView->iItem,psMsgBlock); m_nSelectedMsgIndex = pNMListView->iItem ; //pNMListView->uNewState = (LVIS_FOCUSED|LVIS_SELECTED); //Ashwin changes for selecting the item during unchecking int nChecked = 0, nUnCkecked = 0; for(int nCnt =0; nCnt< m_omLctrMsgList.GetItemCount(); nCnt++) { if(m_omLctrMsgList.GetCheck(nCnt) == TRUE) { nChecked++; } else if(m_omLctrMsgList.GetCheck(nCnt) == FALSE) { nUnCkecked++; } m_omLctrMsgList.SetItemState(nCnt, 0, LVIS_SELECTED); } if(nChecked == m_omLctrMsgList.GetItemCount()) { vCheckHeaderCtrl(true); } else if(nUnCkecked == m_omLctrMsgList.GetItemCount()) { vCheckHeaderCtrl(false); } m_omLctrMsgList.SetItemState(pNMListView->iItem, LVIS_SELECTED, LVIS_SELECTED);//LVIS_SELECTED if(psTxMsgList != nullptr ) { int nCurrentState = m_omLctrMsgList.GetCheck(pNMListView->iItem); CTxFunctionsView* pView = (CTxFunctionsView*) pomGetFunctionsViewPointer(); if( pView != nullptr ) { if( nCurrentState != psTxMsgList->m_sTxMsgDetails.m_bEnabled ) { psTxMsgList->m_sTxMsgDetails.m_bEnabled = nCurrentState; psTxMsgList->m_bModified = true; // Enable Update Button if(pView->m_CheckBoxAutoUpdate.GetCheck() == BST_UNCHECKED) { pView->m_omButtonApply.EnableWindow(); } psMsgBlock->m_bModified = true; } } else { m_omLctrMsgList.SetCheck( pNMListView->iItem, psTxMsgList->m_sTxMsgDetails.m_bEnabled ); } if( pView != nullptr ) { if(pView->m_CheckBoxAutoUpdate.GetCheck() == BST_CHECKED) { pView->vAccessButtonApply(); this->SetFocus(); } } } } } *pResult = 0; }
void CTxMsgListView::vSetMessageCheckValue(BOOL bCheck) { // Get Other View Pointers // Blocks View CTxMsgBlocksView* pomBlocksView = nullptr; pomBlocksView = ( CTxMsgBlocksView*)pomGetBlocksViewPointer(); // Message Details View CTxMsgDetailsView* pomDetailsView = nullptr; pomDetailsView = (CTxMsgDetailsView*)pomGetDetailsViewPointer(); // Functions view CTxFunctionsView* pomFunctionsView = nullptr; pomFunctionsView = (CTxFunctionsView*)pomGetFunctionsViewPointer(); // If all pointers are valid if( pomBlocksView != nullptr && pomDetailsView != nullptr && pomFunctionsView != nullptr ) { // If selected message block index is valid if(pomBlocksView->m_nSelectedMsgBlockIndex != -1 ) { PSMSGBLOCKLIST psCurrentMsgBlock = nullptr; // Get current block pointer psCurrentMsgBlock = pomBlocksView->psGetMsgBlockPointer( pomBlocksView->m_nSelectedMsgBlockIndex, pomBlocksView->m_psMsgBlockList ); psCurrentMsgBlock->m_bModified = true; // Get the message list PSTXCANMSGLIST psMsgList = psCurrentMsgBlock->m_psTxCANMsgList; int nIndex = 0; // Set programmed UI update to TRUE BOOL bModified = FALSE; m_bInitDlg = TRUE; // Update check box status of all messages in this list while(psMsgList != nullptr ) { if( psMsgList->m_sTxMsgDetails.m_bEnabled != bCheck ) { // Update message list psMsgList->m_sTxMsgDetails.m_bEnabled = bCheck; psMsgList->m_bModified = true; // Update UI Control m_omLctrMsgList.SetCheck( nIndex, bCheck ); // Update Modified flag bModified = TRUE; } // Go to Next Node psMsgList = psMsgList->m_psNextMsgDetails; // Increment list item index count nIndex++; } // Set programmed UI update to FALSE m_bInitDlg = FALSE; // Enable Update button only if data got modified if( bModified == TRUE ) { // If data is modified then update apply button if(pomFunctionsView->m_CheckBoxAutoUpdate.GetCheck() == BST_UNCHECKED) { pomFunctionsView->m_omButtonApply.EnableWindow(); } } } } }