/******************************************************************************* Function Name : OnLvnItemchangedListSignals Input(s) : NMHDR *pNMHDR, LRESULT *pResult Output : - Functionality : This function handles the LVN_ITEMCHANGED event for signals list control IDC_LIST_SIGNALS Member of : CSigGrphConfigDlg Author(s) : ArunKumar K Date Created : 27-10-2010 Modifications : *******************************************************************************/ void CSigGrphConfigDlg::OnLvnItemchangedListSignals(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; podList = &(m_pMainFrame->m_odGraphList[m_omCmbBusType.GetCurSel()]); // Update Element Details if( podList != NULL ) { if( hSelItem < podList->m_omElementList.GetSize() ) { vSetElementDetails(podList->m_omElementList[ hSelItem ] ); } else { AfxMessageBox( defSTR_ELEMENT_NOT_FOUND, MB_ICONSTOP); } } } } // Update UI Controls vEnableDisableControls(); *pResult = 0; }
/******************************************************************************* Function Name : OnCbnSelchangeComboBusType Input(s) : - Output : - Functionality : This function handles the selection change event for Combobox IDC_COMBO_BUS_TYPE. Member of : CSigGrphConfigDlg Author(s) : ArunKumar K Date Created : 27-10-2010 Modifications : *******************************************************************************/ void CSigGrphConfigDlg::OnCbnSelchangeComboBusType() { // Update UI with changes vPopulateElementList(); // Update UI Controls vEnableDisableControls(); }
/******************************************************************************* Function Name : OnBnClickedBtnConfigure Input(s) : - Output : - Functionality : This function handles the button click event for Configure button IDC_BTN_CONFIGURE. Member of : CSigGrphConfigDlg Author(s) : ArunKumar K Date Created : 27-10-2010 Modifications : *******************************************************************************/ void CSigGrphConfigDlg::OnBnClickedBtnConfigure() { CElementSelection omConfig(m_nHardware); omConfig.m_pMainFrame = m_pMainFrame; omConfig.m_eBusType = (eTYPE_BUS)m_omCmbBusType.GetCurSel(); //int nElemCount = m_pMainFrame->m_odGraphList[omConfig.m_eBusType].m_omElementList.GetSize(); if( omConfig.DoModal() == IDOK ) { // Update UI with changes vPopulateElementList(); // Update Controls vEnableDisableControls(); } }
/******************************************************************************* Function Name : vHandleConfigFileChange Input(s) : lParam, wParam - Not Used Output : - Functionality : Handles connection change event. Initialised graph and list control members Member of : CGraphLeftView Author(s) : Raja N Date Created : 09/12/2004 Modifications : *******************************************************************************/ LRESULT CGraphLeftView::vHandleConfigFileChange( WPARAM /*wParam*/, LPARAM /*lParam*/) { // Update List Control vPopulateElementList(); // Update UI Controls vEnableDisableControls(); if ( m_pDMGraphCtrl ) { // Remove All items in the control m_pDMGraphCtrl->ClearGraph(); } // Add Elements in to the graph control vPopulateGraphControl(); return 0; }
/******************************************************************************* 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(); }
void CConfigMsgLogDlg::OnLvnItemchangedLogBlockLst(NMHDR* pNMHDR, LRESULT* pResult) { NM_LISTVIEW* pNMListView = (NM_LISTVIEW*) pNMHDR; // Update Log File Components if ((pNMListView->uChanged != LVIF_TEXT) && (m_bUpdatingUI == FALSE)) { // Selected & Focused if (pNMListView->uNewState == (LVIS_FOCUSED | LVIS_SELECTED)) { // Update selection m_nLogIndexSel = pNMListView->iItem; // Update selected Log file details vUpdate_GUI_From_Datastore((USHORT) m_nLogIndexSel); if(m_bLogON) { m_bEditingON = FALSE; GetDlgItem(IDC_CHECK_RESET_TIMESTAMP)->EnableWindow(FALSE); } else { m_bEditingON = TRUE; } } else if (pNMListView->uNewState & MASK_CHECK_UNCHECK) { //ASSERT(m_nLogIndexSel == pNMListView->iItem); vUpdate_Datastore_From_GUI((USHORT) pNMListView->iItem, IDC_LOGBLOCK_LST); } else { m_bEditingON = FALSE; // Update Button Status vEnableDisableControls(FALSE); EnablingMaxNumEdit(); GetDlgItem(IDC_CHECK_RESET_TIMESTAMP)->EnableWindow(FALSE); } } *pResult = 0; }
void CConfigMsgLogDlg::OnBnClickedCbtnRemovelog(void) { m_bUpdatingUI = TRUE; RemoveLoggingBlock((USHORT) m_nLogIndexSel); m_omListLogFiles.DeleteItem(m_nLogIndexSel); m_bUpdatingUI = FALSE; if (GetLoggingBlockCount() > 0) { m_nLogIndexSel = 0; m_omListLogFiles.SetItemState(m_nLogIndexSel, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); } else { m_nLogIndexSel = -1; vEnableDisableControls(FALSE); } ASSERT(GetLoggingBlockCount() == m_omListLogFiles.GetItemCount()); }
BOOL CConfigMsgLogDlg::OnInitDialog() { CDialog::OnInitDialog(); m_ChkbEnableLogOnConnect.SetCheck(m_bLogOnConnect == TRUE? BST_CHECKED : BST_UNCHECKED); m_odStartMsgID.vSetConfigData(IDC_EDIT_STARTMSGID); m_odStopMsgID.vSetConfigData(IDC_EDIT_STOPMSGID); m_odStartMsgID.vSetBase(BASE_HEXADECIMAL); m_odStopMsgID.vSetBase(BASE_HEXADECIMAL); m_odStartMsgID.vSetSigned(false); m_odStopMsgID.vSetSigned(false); vCreateFileList(); InitialiseWindow(); USHORT LogBlocks = GetLoggingBlockCount(); if (LogBlocks > 0) { for (USHORT i = 0; i < LogBlocks; i++) { SLOGINFO sLogObject; HANDLE hFind; WIN32_FIND_DATA FindData; CStdioFile omStdiofile; GetLoggingBlock(i, sLogObject); // check for valid log file CString strTempLog = sLogObject.m_sLogFileName; hFind = FindFirstFile(strTempLog, &FindData); if(hFind == INVALID_HANDLE_VALUE )//file not found { DWORD dError = GetLastError(); if(dError == ERROR_FILE_NOT_FOUND)//file not found { BOOL bFileOpen = omStdiofile.Open(strTempLog, CFile::modeCreate | CFile::modeWrite | CFile::typeBinary); if(bFileOpen == TRUE)///file created, add in the list { omStdiofile.Close(); AddNewItem_GUI(sLogObject, i); } else //not a valid file { RemoveLoggingBlock(i--); //remove the old log data LogBlocks = GetLoggingBlockCount(); //refresh the log count } } else //not a valid filepath / file folder is removed { RemoveLoggingBlock(i--); //remove the old log data LogBlocks = GetLoggingBlockCount(); //refresh the log count } } else ///file found add in the list { AddNewItem_GUI(sLogObject, i); } } m_nLogIndexSel = 0; if(m_omListLogFiles.GetItemCount() > 0 )//check for log files exists { m_omListLogFiles.SetItemState(m_nLogIndexSel, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); } else { vEnableDisableControls(FALSE);//disable controls if no log files exists } } else { vEnableDisableControls(FALSE); } SetWindowText(m_strCurrWndText); if (m_bLogON) { vEnableDisableControls(FALSE); if(m_omListLogFiles.GetItemCount()>0) { vUpdate_GUI_From_Datastore(0); } GetDlgItem(IDC_CBTN_ADDLOG)->EnableWindow(FALSE); GetDlgItem(IDC_CHECK_RESET_TIMESTAMP)->EnableWindow(FALSE); GetDlgItem(IDC_EDIT_NO_OF_FILES)->EnableWindow(FALSE); GetWindowText(m_strCurrWndText); m_strCurrWndText+=_(" - Read Only as Logging is ON"); SetWindowText(m_strCurrWndText); // If Logging is on GetDlgItem(IDOK)->EnableWindow(FALSE); m_unDispUpdateTimerId = SetTimer(600, 600, nullptr); } else { // If Logging is on GetDlgItem(IDOK)->EnableWindow(TRUE); } // Hide or show the Filters button in the dialog based on the protocol GetDlgItem(IDC_LOG_FILTER)->ShowWindow(SW_SHOWNORMAL); /*if (J1939 == m_eCurrBus) { GetDlgItem(IDC_LOG_FILTER)->ShowWindow(0); }*/ return TRUE; }
void CConfigMsgLogDlg::vUpdate_GUI_From_Datastore(USHORT usIndex) { SLOGINFO sLogStruct; SLOGTRIGGER& sTrigger = sLogStruct.m_sLogTrigger; if (GetLoggingBlock(usIndex, sLogStruct) == S_OK) { vEnableDisableControls(!m_bLogON); EnablingAdvSettings(!m_bLogON); } else { vEnableDisableControls(FALSE); EnablingAdvSettings(FALSE); return; } m_omListLogFiles.SetCheck(usIndex, sLogStruct.m_bEnabled); (GetDlgItem(IDC_EDIT_LOGFILEPATH))->SetWindowText(sLogStruct.m_sLogFileName); SetGUIFromTimeMode(sLogStruct.m_eLogTimerMode); SetGUIFromChannel(sLogStruct.m_ChannelSelected); int CheckBox = (DEC == sLogStruct.m_eNumFormat) ? IDC_RBTN_DECIMAL : IDC_RBTN_HEX; CheckRadioButton(IDC_RBTN_DECIMAL, IDC_RBTN_HEX, CheckBox); CheckBox = (APPEND_MODE == sLogStruct.m_eFileMode) ? IDC_RBTN_APPEND : IDC_RBTN_OVERWRITE; CheckRadioButton(IDC_RBTN_APPEND, IDC_RBTN_OVERWRITE, CheckBox); if(sLogStruct.m_eLogTimerMode == TIME_MODE_ABSOLUTE) { m_ChkbResetTimeStamp.EnableWindow(1); } else { m_ChkbResetTimeStamp.EnableWindow(0); } if(sLogStruct.m_bResetAbsTimeStamp == TRUE) { m_ChkbResetTimeStamp.SetCheck(1); } else { m_ChkbResetTimeStamp.SetCheck(0); } if (sTrigger.m_unTriggerType != NONE) { if (sTrigger.m_unTriggerType == BOTH) // Start and stop trigger edit { // control CheckDlgButton(IDC_CHKB_STARTTRIGGER, BST_CHECKED); CheckDlgButton(IDC_CHKB_STOPTRIGGER, BST_CHECKED); m_odStartMsgID.vSetValue((__int64) sTrigger.m_unStartID); m_odStopMsgID.vSetValue((__int64) sTrigger.m_unStopID); } else { if (sTrigger.m_unTriggerType == START) // Start trigger edit control { CheckDlgButton(IDC_CHKB_STARTTRIGGER, BST_CHECKED); m_odStartMsgID.vSetValue((__int64) sTrigger.m_unStartID); } else { vUpdateControl(IDC_CHKB_STARTTRIGGER, CHECKBOX, CActionFlag::ENABLE_CTRL); vUpdateControl(IDC_EDIT_STARTMSGID, EDITCTRL, CActionFlag::CLEAR_CTRL); } if (sTrigger.m_unTriggerType == STOP) // Stop trigger edit control { CheckDlgButton(IDC_CHKB_STOPTRIGGER, BST_CHECKED); m_odStopMsgID.vSetValue((__int64) sTrigger.m_unStopID); } else { vUpdateControl(IDC_CHKB_STOPTRIGGER, CHECKBOX, CActionFlag::ENABLE_CTRL); vUpdateControl(IDC_EDIT_STOPMSGID, EDITCTRL, CActionFlag::CLEAR_CTRL); } } } else { // Start trigger check box control: clear CheckDlgButton(IDC_CHKB_STARTTRIGGER, BST_UNCHECKED); // Stop trigger check box control: clear CheckDlgButton(IDC_CHKB_STOPTRIGGER, BST_UNCHECKED); // Start trigger edit control: clear and disable vEnableDisableControl(IDC_EDIT_STARTMSGID, EDITCTRL, FALSE); // Stop trigger edit control: clear and disable vEnableDisableControl(IDC_EDIT_STOPMSGID, EDITCTRL, FALSE); } // Retaining Advanced Settings if(sLogStruct.m_sLogAdvStngs.m_bIsLogOnMesurement == TRUE) { CheckDlgButton(IDC_CHKB_ON_TRANSMISSION, BST_CHECKED); } else { CheckDlgButton(IDC_CHKB_ON_TRANSMISSION, BST_UNCHECKED); } if(sLogStruct.m_sLogAdvStngs.m_bIsLogOnSize == TRUE) { CheckDlgButton(IDC_CHKB_LOG_FILE_SIZE, BST_CHECKED); } else { CheckDlgButton(IDC_CHKB_LOG_FILE_SIZE, BST_UNCHECKED); } if(sLogStruct.m_sLogAdvStngs.m_bIsLogOnTime == TRUE) { CheckDlgButton(IDC_CHKB_LOG_ON_TIME, BST_CHECKED); } else { CheckDlgButton(IDC_CHKB_LOG_ON_TIME, BST_UNCHECKED); } EnablingMaxNumEdit(); GetDlgItem(IDC_EDIT_FILE_SIZE)->SetWindowText(sLogStruct.m_sLogAdvStngs.m_omSizeInMB); GetDlgItem(IDC_EDIT_HOURS)->SetWindowText(sLogStruct.m_sLogAdvStngs.m_omLogTimeHrs); GetDlgItem(IDC_EDIT_MINUTES)->SetWindowText(sLogStruct.m_sLogAdvStngs.m_omLogTimeMins); GetDlgItem(IDC_EDIT_NO_OF_FILES)->SetWindowText(sLogStruct.m_sLogAdvStngs.m_omMaxNoOfLogFiles); GetDlgItem(IDC_EDIT_LOG_COMMENT)->SetWindowText(sLogStruct.m_sLogAdvStngs.m_omLogComment);//arun }
BOOL CConfigMsgLogDlg::OnInitDialog() { CDialog::OnInitDialog(); m_ChkbEnableLogOnConnect.SetCheck(m_bLogOnConnect == TRUE? BST_CHECKED : BST_UNCHECKED); m_odStartMsgID.vSetConfigData(IDC_EDIT_STARTMSGID); m_odStopMsgID.vSetConfigData(IDC_EDIT_STOPMSGID); m_odStartMsgID.vSetBase(BASE_HEXADECIMAL); m_odStopMsgID.vSetBase(BASE_HEXADECIMAL); m_odStartMsgID.vSetSigned(false); m_odStopMsgID.vSetSigned(false); vCreateFileList(); //Load channel combo box m_omComboChannel.ResetContent(); if (NULL != GetICANDIL()) { LPARAM lParam = 0; if (S_OK == GetICANDIL()->DILC_GetControllerParams(lParam, NULL, NUMBER_HW)) { m_unChannelCount = (UINT)lParam; } } m_omComboChannel.InsertString(0, _("ALL")); for (UINT i = 1; i <= m_unChannelCount; i++) { CString omChannel; omChannel.Format("%d", i); m_omComboChannel.InsertString(i, omChannel.GetBuffer(MAX_PATH)); } m_omComboChannel.SetCurSel(0); USHORT LogBlocks = GetLoggingBlockCount(); if (LogBlocks > 0) { for (USHORT i = 0; i < LogBlocks; i++) { SLOGINFO sLogObject; HANDLE hFind; WIN32_FIND_DATA FindData; CStdioFile omStdiofile; GetLoggingBlock(i, sLogObject); // check for valid log file CString strTempLog = sLogObject.m_sLogFileName; hFind = FindFirstFile(strTempLog, &FindData); if(hFind == INVALID_HANDLE_VALUE )//file not found { DWORD dError = GetLastError(); if(dError == ERROR_FILE_NOT_FOUND)//file not found { BOOL bFileOpen = omStdiofile.Open(strTempLog, CFile::modeCreate | CFile::modeWrite | CFile::typeBinary); if(bFileOpen == TRUE)///file created, add in the list { omStdiofile.Close(); AddNewItem_GUI(sLogObject, i); } else //not a valid file { RemoveLoggingBlock(i--); //remove the old log data LogBlocks = GetLoggingBlockCount(); //refresh the log count } } else //not a valid filepath / file folder is removed { RemoveLoggingBlock(i--); //remove the old log data LogBlocks = GetLoggingBlockCount(); //refresh the log count } } else ///file found add in the list { AddNewItem_GUI(sLogObject, i); } } m_nLogIndexSel = 0; if(m_omListLogFiles.GetItemCount() > 0 )//check for log files exists { m_omListLogFiles.SetItemState(m_nLogIndexSel, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); } else { vEnableDisableControls(FALSE);//disable controls if no log files exists } } else { vEnableDisableControls(FALSE); } SetWindowText(m_strCurrWndText); if (m_bLogON) { vEnableDisableControls(FALSE); if(m_omListLogFiles.GetItemCount()>0) { vUpdate_GUI_From_Datastore(0); } GetDlgItem(IDC_CBTN_ADDLOG)->EnableWindow(FALSE); GetDlgItem(IDC_CHECK_RESET_TIMESTAMP)->EnableWindow(FALSE); GetWindowText(m_strCurrWndText); m_strCurrWndText+=_(" - Read Only as Logging is ON"); //SetWindowText(m_strCurrWndText); // PTV [1.6.4] // If Logging is on GetDlgItem(IDOK)->EnableWindow(FALSE); // PTV [1.6.4] SetWindowText(""); m_unDispUpdateTimerId = SetTimer(600, 600, NULL); } else { // PTV [1.6.4] // If Logging is on GetDlgItem(IDOK)->EnableWindow(TRUE); // PTV [1.6.4] } // Hide or show the Filters button in the dialog based on the protocol if (CAN == m_eCurrBus) { GetDlgItem(IDC_LOG_FILTER)->ShowWindow(1); } else if (J1939 == m_eCurrBus) { GetDlgItem(IDC_LOG_FILTER)->ShowWindow(0); } return TRUE; }
void CConfigMsgLogDlg::vUpdate_GUI_From_Datastore(USHORT usIndex) { SLOGINFO sLogStruct; SLOGTRIGGER& sTrigger = sLogStruct.m_sLogTrigger; if (GetLoggingBlock(usIndex, sLogStruct) == S_OK) { vEnableDisableControls(!m_bLogON); } else { vEnableDisableControls(FALSE); return; } m_omListLogFiles.SetCheck(usIndex, sLogStruct.m_bEnabled); (GetDlgItem(IDC_EDIT_LOGFILEPATH))->SetWindowText(sLogStruct.m_sLogFileName); SetGUIFromTimeMode(sLogStruct.m_eLogTimerMode); SetGUIFromChannel(sLogStruct.m_ChannelSelected); int CheckBox = (DEC == sLogStruct.m_eNumFormat) ? IDC_RBTN_DECIMAL : IDC_RBTN_HEX; CheckRadioButton(IDC_RBTN_DECIMAL, IDC_RBTN_HEX, CheckBox); CheckBox = (APPEND_MODE == sLogStruct.m_eFileMode) ? IDC_RBTN_APPEND : IDC_RBTN_OVERWRITE; CheckRadioButton(IDC_RBTN_APPEND, IDC_RBTN_OVERWRITE, CheckBox); if(sLogStruct.m_eLogTimerMode == TIME_MODE_ABSOLUTE) { m_ChkbResetTimeStamp.EnableWindow(1); } else { m_ChkbResetTimeStamp.EnableWindow(0); } if(sLogStruct.m_bResetAbsTimeStamp == TRUE) { m_ChkbResetTimeStamp.SetCheck(1); } else { m_ChkbResetTimeStamp.SetCheck(0); } if (sTrigger.m_unTriggerType != NONE) { if (sTrigger.m_unTriggerType == BOTH) // Start and stop trigger edit { // control CheckDlgButton(IDC_CHKB_STARTTRIGGER, BST_CHECKED); CheckDlgButton(IDC_CHKB_STOPTRIGGER, BST_CHECKED); m_odStartMsgID.vSetValue((__int64) sTrigger.m_unStartID); m_odStopMsgID.vSetValue((__int64) sTrigger.m_unStopID); } else { if (sTrigger.m_unTriggerType == START) // Start trigger edit control { CheckDlgButton(IDC_CHKB_STARTTRIGGER, BST_CHECKED); m_odStartMsgID.vSetValue((__int64) sTrigger.m_unStartID); } else { vUpdateControl(IDC_CHKB_STARTTRIGGER, CHECKBOX, CActionFlag::ENABLE_CTRL); vUpdateControl(IDC_EDIT_STARTMSGID, EDITCTRL, CActionFlag::CLEAR_CTRL); } if (sTrigger.m_unTriggerType == STOP) // Stop trigger edit control { CheckDlgButton(IDC_CHKB_STOPTRIGGER, BST_CHECKED); m_odStopMsgID.vSetValue((__int64) sTrigger.m_unStopID); } else { vUpdateControl(IDC_CHKB_STOPTRIGGER, CHECKBOX, CActionFlag::ENABLE_CTRL); vUpdateControl(IDC_EDIT_STOPMSGID, EDITCTRL, CActionFlag::CLEAR_CTRL); } } } else { // Start trigger check box control: clear CheckDlgButton(IDC_CHKB_STARTTRIGGER, BST_UNCHECKED); // Stop trigger check box control: clear CheckDlgButton(IDC_CHKB_STOPTRIGGER, BST_UNCHECKED); // Start trigger edit control: clear and disable vEnableDisableControl(IDC_EDIT_STARTMSGID, EDITCTRL, FALSE); // Stop trigger edit control: clear and disable vEnableDisableControl(IDC_EDIT_STOPMSGID, EDITCTRL, FALSE); } }