/*******************************************************************************
Function Name    : OnInitDialog
Input(s)         :
Output           :
Functionality    : This function will be called during initialization of dialog
                   box. This function will fill respective list controls
Member of        : CSigWatchAddDelDlg
Friend of        :  -
Author(s)        : Raja N
Date Created     : 25.03.2004
*******************************************************************************/
BOOL CSigWatchAddDelDlg::OnInitDialog()
{
    // Call parent's init function
    CDialog::OnInitDialog();
    // Populate the message name combo
    // Clear the content if any
    m_omCombMessage.ResetContent();
    // Create the Image List
    m_omImageList.Create(IDR_BMP_MSG_SIG_WATCH,
                         16,
                         1,
                         defCOLOR_WHITE);

    if (m_podTempCallerList != NULL)
    {
        UINT unNoOfMainEntries = (UINT)m_podTempCallerList->GetCount();

        if ( unNoOfMainEntries > 0 )
        {
            // Add every message name into the message list
            POSITION pos = m_podTempCallerList->GetHeadPosition();

            while (pos != NULL)
            {
                SMAINENTRY& sMainEntry = m_podTempCallerList->GetNext(pos);
                CString omMainEntryName = sMainEntry.m_omMainEntryName;
                CString omMainEntryId;
                omMainEntryId.Format(defSTR_MSG_ID_IN_HEX,sMainEntry.m_unMainEntryID);
                omMainEntryName = omMainEntryId + omMainEntryName;
                m_omCombMessage.AddString(omMainEntryName);
            }

            m_omCombMessage.SetCurSel(0);
            m_omListCtrlSignal.SetImageList(&m_omImageList, LVSIL_SMALL);
            // Create the first column. But this will not be shown
            m_omListCtrlSignal.InsertColumn( 0,
                                             STR_EMPTY,
                                             LVCFMT_LEFT,
                                             0); //Width is zero as this will
            //be updated in vUpdateUnSelSubEntryList
            // Populate the list with signal names
            vPopulateUnSelSubEntryList(unGetSelectedMainEntryID());
            m_omCombMessage.SetFocus();
        }
    }

    // Update Signal Watch List
    // Set the same image list to this control
    m_omListCtrlSignalWatch.SetImageList(&m_omImageList,LVSIL_SMALL);
    // Create Column for Signal Watch Lsit
    m_omListCtrlSignalWatch.InsertColumn( 0,
                                          STR_EMPTY,
                                          LVCFMT_LEFT,
                                          0);//Width is zero as this will
    //be updated in vPopulateSelSubEntryList
    vPopulateSelSubEntryList();
    vEnableDisableButtons();
    return FALSE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}
/*******************************************************************************
Function Name    : OnBtnAddAllSubEntries
Input(s)         :  -
Output           :  -
Functionality    : This function will be called by framework when the user
                   selects "Add All" button.This will call "vAddSelSubEntries"
                   to add all the signals
Member of        : CSigWatchAddDelDlg
Friend of        :  -
Author(s)        : Raja N
Date Created     : 25.03.2004
Modification By  : 
Modification on  : 
*******************************************************************************/
void CSigWatchAddDelDlg::OnBtnAddAllSubEntries() 
{
    // Add only the selected signals
    vAddSelSubEntries(TRUE);
    // Update button status
    vEnableDisableButtons();
}
/*******************************************************************************
Function Name    : OnBtnAddAllSubEntries
Input(s)         :  -
Output           :  -
Functionality    : This function will be called by framework when the user
                   selects "Add All" button.This will call "vAddSelSubEntries"
                   to add all the signals
Member of        : CMainSubListDlg
Friend of        :  -
Author(s)        : Raja N
Date Created     : 25.03.2004
Modification By  : 
Modification on  : 
*******************************************************************************/
void CMainSubListDlg::OnBtnAddAllSubEntries() 
{
    // Add only the selected signals
    vAddSelSubEntries(TRUE);
    // Update button status
    vEnableDisableButtons();
}
Example #4
0
/*******************************************************************************
  Function Name  : OnButtonSelect
  Input(s)       : -
  Output         : -
  Functionality  : This function will add the selected hardware in to the
                   selected hardware list.
  Member of      : CHardwareListing
  Author(s)      : Raja N
  Date Created   : 25.2.2005
  Modifications  :
*******************************************************************************/
void CHardwareListing::OnButtonSelect()
{
    int nSelected = m_nSelectedItem;
    // Insert the selected item in to the selected list
    int nItem = m_omSelectedHwList.GetItemCount();
    CString omStrChannel;//(STR_EMPTY);
    CString omStrHardware;
    int nArrayIndex = -1;
    // Get the data
    // Format channel information
    omStrChannel.Format( defSTR_CHANNEL_NAME_FORMAT,
                         defSTR_CHANNEL_NAME,
                         nItem + 1 );
    // Get the Hardware name
    omStrHardware = m_omHardwareList.GetItemText( nSelected, 0 );
    // Get the array index
    nArrayIndex = (INT)m_omHardwareList.GetItemData( nSelected );
    int nImageIndex = defDISCONNECTED_IMAGE_INDEX;
    // Insert the new item in to the selected list
    m_omSelectedHwList.InsertItem( nItem, omStrChannel, nImageIndex );
    // Set the Hardware Name
    m_omSelectedHwList.SetItemText( nItem, 1, omStrHardware );
    // Set the array index
    m_omSelectedHwList.SetItemData( nItem, nArrayIndex );
    // Remove the item from the list
    m_omHardwareList.DeleteItem( nSelected );
    //Sort Hardware Items
    vSortHardwareItems();
    // Set the focus to the first item
    m_omHardwareList.SetItemState( 0,
                                   LVIS_SELECTED | LVIS_FOCUSED,
                                   LVIS_SELECTED | LVIS_FOCUSED );
    // Update Button Status
    vEnableDisableButtons();
}
/*******************************************************************************
Function Name    : OnSelChangeMessageName
Input(s)         :
Output           :
Functionality    : This function will be called by framework when the message
                   name combo box selection got changed. This will update the
                   Signal Names List control
Member of        : CWaveformSelectionDlg
Friend of        :  -
Author(s)        : Raja N
Date Created     : 25.03.2004
Modification By  :
Modification on  :
*******************************************************************************/
void CWaveformSelectionDlg::OnSelChangeMessageName()
{
    UINT nMsgID=unGetSelectedMainEntryID();
    m_fDefAmplitude=m_pWaveDataHandler->fGetMsgIDDefaultValue(nMsgID);
    vPopulateUnSelSubEntryList(unGetSelectedMainEntryID());
    vEnableDisableButtons();
    UpdateData(FALSE);
}
Example #6
0
/******************************************************************************
  Function Name   : OnItemchangedLstcSelectedHwList
  Input(s)        : Address of an NM_LISTVIEW structure that identifies
                    the item that has changed and specifies its previous
                    and new states
  Output          : -
  Functionality   : This function will be called by the framework when the
                    user selects an item from the selected Hw List. This will
                    UI buttons status based on the current selection
  Member of       : CHardwareListingCAN
  Author(s)       : Raja N
  Date Created    : 08.09.2004
  Modifications   :
******************************************************************************/
void CHardwareListingCAN::OnItemchangedLstcSelectedHwList( NMHDR* pNMHDR,
        LRESULT* pResult)
{
    //NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
	CComboBox* pEditBaudRateCAN = (CComboBox*)GetDlgItem(IDC_CAN_EDIT_BAUD_RATE);
	CComboBox* pEditBaudRateCANFD = (CComboBox*)GetDlgItem(IDC_CANFD_EDIT_BAUD_RATE);
	if(nullptr!=pEditBaudRateCAN )
	{
		pEditBaudRateCAN ->EnableWindow(TRUE);
	}
    // Update UI Buttons
    NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
    // If it is a selection change update the hardware details
    if(pNMListView->uNewState & LVIS_SELECTED)
    {
        // Get the selected Item index
        UINT nSelectedItem = pNMListView->iItem;
		m_nLastSelection = pNMListView->iItem;
        // Update selected Hw details
        vUpdateHwDetails( (INT)m_omSelectedHwList.GetItemData( nSelectedItem ) );
		std::string omSelectedItem = m_omSelectedHwList.GetItemText( nSelectedItem, 0);
		std::map<std::string, bool>::iterator itr = m_mapChannelToCANFDStatus.find(omSelectedItem);
		if(m_mapChannelToCANFDStatus.end() !=  itr)
		{
			m_chkCANFD.EnableWindow(itr->second);
		}
		vFillControllerConfigDetails();
    }
	else if( pNMListView->uChanged  == LVIF_STATE &&
		pNMListView->uOldState == LVIS_SELECTED )
	{
		UpdateData( TRUE );
		vValidateBaudRate();
		vUpdateControllerDetails();
	}
	if(m_omSelectedHwList.GetSelectedCount() == 0)
	{
		if(nullptr!=pEditBaudRateCAN)
		{
			pEditBaudRateCAN ->EnableWindow(FALSE);
		}
		if(nullptr!=pEditBaudRateCANFD)
		{
			pEditBaudRateCANFD ->EnableWindow(FALSE);
		}
		m_chkCANFD.SetCheck(BST_UNCHECKED);
		m_chkCANFD.EnableWindow(FALSE);
		m_omEditBaudRate.SetSel(0, -1);
		m_omEditBaudRate.Clear();
		m_omCANFDEditBaudRate.SetSel(0, -1);
		m_omCANFDEditBaudRate.Clear();
    }
    vEnableDisableButtons();
    *pResult = 0;
}
/*******************************************************************************
Function Name    : OnDblclkUnSelSubEntryList
Input(s)         : NMHDR* pNMHDR, LRESULT* pResult - Handler parameter
Output           :  -
Functionality    : This function will be called by framework when the user 
                   double clicks on Signal List box. This will call 
                   "vAddSelectedSignals" to add the selected entry and will
                   update the button status by calling "vEnableDisableButtons"
Member of        : CSigWatchAddDelDlg
Friend of        :  -
Author(s)        : Raja N
Date Created     : 25.03.2004
Modifications    : Raja N
                 : 14.04.2004. Modifications as per Code Review.
*******************************************************************************/
void CSigWatchAddDelDlg::OnDblclkUnSelSubEntryList(NMHDR* /*pNMHDR*/, LRESULT* pResult) 
{
    if(m_omListCtrlSignal.GetSelectedCount() != 0)
    {
        // Add Selected Signal
        vAddSelSubEntries(FALSE);
        // Update button status
        vEnableDisableButtons();
    }
    *pResult = 0;
}
Example #8
0
/*******************************************************************************
  Function Name  : OnButtonRemove
  Input(s)       : -
  Output         : -
  Functionality  : This function will remove the selected item from the selected
                   hardware list. This will also insert the same in to the
                   available list
  Member of      : CHardwareListing
  Author(s)      : Raja N
  Date Created   : 21.2.2005
  Modifications  : Raja N on 17.03.2005
                   Added code to change channel ID of rest of items when a
                   channel is deleted from the selected channel list
*******************************************************************************/
void CHardwareListing::OnButtonRemove()
{
    // Get the selected item from the list
    POSITION sPos = m_omSelectedHwList.GetFirstSelectedItemPosition();
    if( sPos != NULL )
    {
        int nSelectedItem = m_omSelectedHwList.GetNextSelectedItem(sPos);
        int nArrayIndex = (INT)m_omSelectedHwList.GetItemData( nSelectedItem );
        int nImageIndex;

        nImageIndex = defDISCONNECTED_IMAGE_INDEX;

        // Insert this item in to the available list
        // Calculate new item index
        int nItemCount = m_omHardwareList.GetItemCount();
        // Insert the new entry
        m_omHardwareList.InsertItem( nItemCount,
                                     m_omSelectedHwList.GetItemText( nSelectedItem, 1),
                                     nImageIndex );
        // Set the hardware list index as item data.
        m_omHardwareList.SetItemData( nItemCount, nArrayIndex );

        //Sort Hardware Items
        vSortHardwareItems();


        // Remove the item from the selected list
        m_omSelectedHwList.DeleteItem( nSelectedItem );
        // Change the channel text approp.
        int nItem = m_omSelectedHwList.GetItemCount();
        // Check whether update is required or not
        if( nSelectedItem < nItem )
        {
            // Format string
            CString omStrChannel;
            int nItemsToUpdate = nItem - nSelectedItem;
            // Loopt through list of items
            for( int nIndex = 0; nIndex < nItemsToUpdate; nIndex++ )
            {
                // Update format string
                omStrChannel.Format( defSTR_CHANNEL_NAME_FORMAT,
                                     defSTR_CHANNEL_NAME,
                                     nSelectedItem + nIndex + 1 );
                // Update Text
                m_omSelectedHwList.SetItemText( nSelectedItem + nIndex,
                                                0,
                                                omStrChannel );
            }
        }
        // Update UI button status
        vEnableDisableButtons();
    }
}
/*******************************************************************************
Function Name    : OnBtnAddSubEntries
Input(s)         :  -
Output           :  -
Functionality    : This function will be called by framework when the user
                   selects "Add" button. This will call "vAddSelSubEntries" to
                   add the selected sub entries
Member of        : CWaveformSelectionDlg
Friend of        :  -
Author(s)        : Raja N
Date Created     : 25.03.2004
Modifications    : Raja N
                 : 14.04.2004. Modifications as per Code Review.
*******************************************************************************/
void CWaveformSelectionDlg::OnBtnAddSubEntries()
{
    sWaveformInfo objWaveInfo;
    m_pWaveDataHandler->vGetDefaultSignalWaveValues(objWaveInfo);
    DefineUpdateWave(&m_omListCtrlSignal, unGetSelectedMainEntryID(),
                     m_omListCtrlSignal.GetItemText(m_omListCtrlSignal.GetSelectionMark() , 0),
                     objWaveInfo);
    vPopulateUnSelSubEntryList(unGetSelectedMainEntryID());
    vPopulateSelSubEntryList();
    // Update button status
    vEnableDisableButtons();
}
Example #10
0
/*******************************************************************************
  Function Name  : OnButtonSelect
  Input(s)       : -
  Output         : -
  Functionality  : This function will add the selected hardware in to the
                   selected hardware list.
  Member of      : CHardwareListingCAN
  Author(s)      : Raja N
  Date Created   : 25.2.2005
  Modifications  :
*******************************************************************************/
void CHardwareListingCAN::vMoveItemToSelectedList()
{
	POSITION sPos = m_omHardwareList.GetFirstSelectedItemPosition();
    // Insert the selected item in to the selected list
	if( nullptr!=sPos )
	{
		int nSelected = m_omHardwareList.GetNextSelectedItem(sPos);
    int nItem = m_omSelectedHwList.GetItemCount();
    CString omStrChannel;//("");
    CString omStrHardware;
    int nArrayIndex = -1;
    // Get the data
    // Format channel information
    omStrChannel.Format( defSTR_CHANNEL_NAME_FORMAT,
                         defSTR_CHANNEL_NAME,
                         nItem + 1 );
    // Get the Hardware name
    omStrHardware = m_omHardwareList.GetItemText( nSelected, 0 );
    // Get the array index
    nArrayIndex = (INT)m_omHardwareList.GetItemData( nSelected );
    int nImageIndex = defDISCONNECTED_IMAGE_INDEX;
    // Insert the new item in to the selected list
		m_omSelectedHwList.InsertItem( nItem, omStrHardware, nImageIndex );
    // Set the Hardware Name
		m_omSelectedHwList.SetItemText( nItem, 1, omStrChannel);
    // Set the array index
    m_omSelectedHwList.SetItemData( nItem, nArrayIndex );

		InitializeControllerDetails(nItem);
    // Remove the item from the list
    m_omHardwareList.DeleteItem( nSelected );

    //Sort Hardware Items
    vSortHardwareItems();

    // Set the focus to the first item
		m_omHardwareList.SetItemState(nSelected,
                                   LVIS_SELECTED | LVIS_FOCUSED,
                                   LVIS_SELECTED | LVIS_FOCUSED );
		m_omSelectedHwList.SetItemState(nItem,
			LVIS_SELECTED | LVIS_FOCUSED,
			LVIS_SELECTED | LVIS_FOCUSED );
    // Update Button Status
    vEnableDisableButtons();
	}
	else
	{
		m_omHardwareList.SetItemState(0,
			LVIS_SELECTED | LVIS_FOCUSED,
			LVIS_SELECTED | LVIS_FOCUSED );
	}
}
Example #11
0
/******************************************************************************
  Function Name   : OnItemchangedHWList
  Input(s)        : Address of an NM_LISTVIEW structure that identifies
                    the item that has changed and specifies its previous
                    and new states
  Output          : -
  Functionality   : This function will be called by the framework when the
                    user selects an item from the Hw List. This will update
                    selected Hw details
  Member of       : CHardwareListing
  Author(s)       : Raja N
  Date Created    : 08.09.2004
  Modifications   : Raja N on 14.03.2005, Modified to get item data for getting
                    actual index.
******************************************************************************/
void CHardwareListing::OnItemchangedHWList(NMHDR* pNMHDR, LRESULT* pResult)
{
	NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
	// If it is a selection change update the hardware details
	if(pNMListView->uNewState & LVIS_SELECTED){
		// Get the selected Item index
		m_nSelectedItem = pNMListView->iItem;
		// Update selected Hw details
		vUpdateHwDetails( (INT)m_omHardwareList.GetItemData( m_nSelectedItem ) );
	}
	// Update Button Status
	vEnableDisableButtons();
	*pResult = 0;
}
Example #12
0
void CHardwareListing::OnNMClickLstcSelectedHwList(NMHDR* pNMHDR, LRESULT* pResult)
{
	//NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
	// Update UI Buttons
	NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
	// If it is a selection change update the hardware details
	INT nSelectedItem = pNMListView->iItem;
	if(nSelectedItem > -1){
		// Update selected Hw details
		vUpdateHwDetails( (INT)m_omSelectedHwList.GetItemData( nSelectedItem ) );
	}
	vEnableDisableButtons();
	*pResult = 0;
}
/*******************************************************************************
Function Name    : OnBtnDelSubEntires
Input(s)         :  -
Output           :  -
Functionality    : This function will be called by framework when the user
                   selects "Delete" button. This will call
                   "vDeleteSelectedSignals" to delete the selected signals. If
                   the user selectes all the signals it will do delete all.
Member of        : CSigWatchAddDelDlg
Friend of        :  -
Author(s)        : Raja N
Date Created     : 25.03.2004
Modification By  : 
Modification on  : 
*******************************************************************************/
void CSigWatchAddDelDlg::OnBtnDelSubEntires() 
{
    BOOL bDeleteAll = FALSE;
    // Check the selection count and if that is equal to total number just 
    // all. No need to process the data
    if(static_cast<int>(m_omListCtrlSignalWatch.GetSelectedCount()) ==
            m_omListCtrlSignalWatch.GetItemCount())
    {
        bDeleteAll = TRUE;
    }

    // Now call the delete function
    vDelSelSubEntries(bDeleteAll);
    vEnableDisableButtons();
}
Example #14
0
/*******************************************************************************
  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    : OnDblclkUnSelSubEntryList
Input(s)         : NMHDR* pNMHDR, LRESULT* pResult - Handler parameter
Output           :  -
Functionality    : This function will be called by framework when the user
                   double clicks on Signal List box. This will call
                   "vAddSelectedSignals" to add the selected entry and will
                   update the button status by calling "vEnableDisableButtons"
Member of        : CWaveformSelectionDlg
Friend of        :  -
Author(s)        : Raja N
Date Created     : 25.03.2004
Modifications    : Raja N
                 : 14.04.2004. Modifications as per Code Review.
*******************************************************************************/
void CWaveformSelectionDlg::OnDblclkUnSelSubEntryList(NMHDR* /*pNMHDR*/, LRESULT* pResult)
{
    if(m_omListCtrlSignal.GetSelectedCount() != 0)
    {
        sWaveformInfo objWaveInfo;
        m_pWaveDataHandler->vGetDefaultSignalWaveValues(objWaveInfo);
        DefineUpdateWave(&m_omListCtrlSignal, unGetSelectedMainEntryID(),
                         m_omListCtrlSignal.GetItemText(m_omListCtrlSignal.GetSelectionMark() , 0),
                         objWaveInfo);
        vPopulateUnSelSubEntryList(unGetSelectedMainEntryID());
        vPopulateSelSubEntryList();
        // Update button status
        vEnableDisableButtons();
    }
    *pResult = 0;
}
/**
 * \req RS_19_03 It shall be possible to add / remove any log file from the input data source set
 *
 * This function will be called when user selects Add button.
 * This will show file selection dialog to select replay file
 * and if the selection is valid this will add the selected file
 * in to the replay file list.
 */
void CReplayFileConfigDlg::OnBtnAddFile()
{
    // Throw File selection dialog to choose replay log file
    DWORD dwFlags =
        OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_EXTENSIONDIFFERENT;
    CFileDialog omFileDlg( TRUE,
                           defSTR_LOG_FILE_EXTENSION,
                           NULL,
                           dwFlags,
                           defLOG_FILTER,
                           NULL );
    //Set the caption
    omFileDlg.m_ofn.lpstrTitle = _(defSTR_REPLAY_FILE_SELECTION_TITLE);
    // Show File open dialog
    if( omFileDlg.DoModal() == IDOK )
    {
        CReplayFile ouNewReplayFile;
        // Assign the file name and leave the rest to default
        ouNewReplayFile.m_omStrFileName = omFileDlg.GetPathName();
        // Add the data in to the replay file data list
        m_rouManager.m_omReplayFiles.Add( ouNewReplayFile );
        // Insert this new item in to the list
        // Avoid UI update
        m_bUpdating = TRUE;
        // Get the size of the list
        int nIndex = m_omLstcReplayFiles.GetItemCount();
        // Insert at the end
        m_omLstcReplayFiles.InsertItem( nIndex, ouNewReplayFile.m_omStrFileName,
                                        defREPLAY_FILE_IMAGE_INDEX );
        // Update the checkbox status
        m_omLstcReplayFiles.SetCheck( nIndex, ouNewReplayFile.m_bEnabled );
        // This is the first item then enable Replay File components
        if( nIndex == 0 )
        {
            vEnableDisableButtons();
        }
        // Set the selection to this new item
        // Enable UI Update
        m_bUpdating = FALSE;
        m_omLstcReplayFiles.SetItemState( nIndex,
                                          LVIS_SELECTED | LVIS_FOCUSED,
                                          LVIS_SELECTED | LVIS_FOCUSED );
    }
}
void CWaveformSelectionDlg::OnNMDblclkLstcSignalWatch(NMHDR* /*pNMHDR*/, LRESULT *pResult)
{
    // Get the selected signal Name
    sWaveformInfo objWaveInfo;
    CString strSignalName;
    UINT nMsgID = (UINT)-1;
    vInterPretSignalNameMsgID(m_omListCtrlSignalWatch.GetItemText(
                                  m_omListCtrlSignalWatch.GetSelectionMark() , 0), strSignalName, nMsgID);
    m_pWaveDataHandler->bGetSignalWavePatternDetails(nMsgID, strSignalName, objWaveInfo);

    DefineUpdateWave(&m_omListCtrlSignalWatch, nMsgID, strSignalName, objWaveInfo);

    vPopulateUnSelSubEntryList(unGetSelectedMainEntryID());
    vPopulateSelSubEntryList();
    // Update button status
    vEnableDisableButtons();

    *pResult = 0;
}
/**
 * \return FALSE - If focus is set to Any UI control explicitly
 *
 * Initialises dialog's UI components
 */
BOOL CReplayFileConfigDlg::OnInitDialog()
{
    CDialog::OnInitDialog();
    // Create Image List used in UI List
    bCreateImageList();
    // Create Replay Files UI List
    vCreateReplayFileList();
    // To Create Replay Components
    vCreateReplayCopms();
    // Init Replay Components
    vInitReplayCopms();
    // Init Replay List
    vInitReplayFileList();
    // Update Button Status
    vEnableDisableButtons();

    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}
/*******************************************************************************
Function Name    : OnBtnDelSubEntires
Input(s)         :  -
Output           :  -
Functionality    : This function will be called by framework when the user
                   selects "Delete" button. This will call
                   "vDeleteSelectedSignals" to delete the selected signals. If
                   the user selectes all the signals it will do delete all.
Member of        : CWaveformSelectionDlg
Friend of        :  -
Author(s)        : Raja N
Date Created     : 25.03.2004
Modification By  :
Modification on  :
*******************************************************************************/
void CWaveformSelectionDlg::OnBtnDelSubEntires()
{
    BOOL bDeleteAll = FALSE;
    // Check the selection count and if that is equal to total number just
    // all. No need to process the data
    if(static_cast<int>(m_omListCtrlSignalWatch.GetSelectedCount()) ==
            m_omListCtrlSignalWatch.GetItemCount())
    {
        bDeleteAll = TRUE;
    }

    CString strSignalName;
    UINT nMsgID = (UINT)-1;
    vInterPretSignalNameMsgID(m_omListCtrlSignalWatch.GetItemText(
                                  m_omListCtrlSignalWatch.GetSelectionMark() , 0), strSignalName, nMsgID);
    m_pWaveDataHandler->bRemoveSignalFromDefinedWavesList(nMsgID, strSignalName);
    vPopulateUnSelSubEntryList(unGetSelectedMainEntryID());
    vPopulateSelSubEntryList();
    vEnableDisableButtons();
}
/**
 * \req RS_19_03 It shall be possible to add / remove any log file from the input data source set
 *
 * This functuion will handle Delete button event. This will get
 * delete conformation from the user and will remove the
 * selected replay file from the list if user conforms.
 */
void CReplayFileConfigDlg::OnBtnDeleteFile()
{
    if( m_nSelecetedNamedLogIndex != -1 &&
            m_nSelecetedNamedLogIndex < m_rouManager.m_omReplayFiles.GetSize() )
    {
        // Ask user about file delete
        int nResult = AfxMessageBox( _(defSTR_DELETE_CONFORMATION),
                                     MB_YESNO|MB_ICONQUESTION ) ;
        if ( nResult == IDYES )
        {
            // Avoid UI update
            m_bUpdating = TRUE;
            // Remove the item from the list
            m_omLstcReplayFiles.DeleteItem( m_nSelecetedNamedLogIndex );
            // Remove the item from data list
            m_rouManager.m_omReplayFiles.RemoveAt( m_nSelecetedNamedLogIndex );
            // Set the focus to the next available item
            int nSize = m_omLstcReplayFiles.GetItemCount();
            if( m_nSelecetedNamedLogIndex > ( nSize - 1 ) )
            {
                m_nSelecetedNamedLogIndex = nSize - 1;
            }
            // Enable UI Update
            m_bUpdating = TRUE;
            if( m_nSelecetedNamedLogIndex != -1 )
            {
                // Set the selection
                m_omLstcReplayFiles.SetItemState( m_nSelecetedNamedLogIndex,
                                                  LVIS_SELECTED | LVIS_FOCUSED,
                                                  LVIS_SELECTED | LVIS_FOCUSED );
            }
            else
            {
                // Update Button Status
                vEnableDisableButtons();
            }
        }
    }
}
/*******************************************************************************
Function Name    : OnBtnDelAllSignal
Input(s)         :  -
Output           :  -
Functionality    : This function will be called by framework when the user
                   selects "Delete All" button. This will call
                   "vDeleteSelectedSignals" to delete all the signals.
Member of        : CMainSubListDlg
Friend of        :  -
Author(s)        : Raja N
Date Created     : 25.03.2004
Modification By  : 
Modification on  : 
*******************************************************************************/
void CMainSubListDlg::OnBtnDelAllSubEntires() 
{
    vDelSelSubEntries(TRUE);
    vEnableDisableButtons();
}
/*******************************************************************************
Function Name    : OnInitDialog
Input(s)         :
Output           :
Functionality    : This function will be called during initialization of dialog
                   box. This function will fill respective list controls
Member of        : CWaveformSelectionDlg
Friend of        :  -
Author(s)        : Raja N
Date Created     : 25.03.2004
*******************************************************************************/
BOOL CWaveformSelectionDlg::OnInitDialog()
{
    // Call parent's init function
    CDialog::OnInitDialog();

    // Populate the message name combo
    // Clear the content if any
    m_omCombMessage.ResetContent();
    // Create the Image List
    m_omImageList.Create(IDR_BMP_MSG_SIG_WATCH,16,1, defCOLOR_WHITE);

    CStringArray arrMsgIDsList;
    m_pWaveDataHandler->vGetCompleteMsgList(arrMsgIDsList);
    for(int i = 0; i<arrMsgIDsList.GetSize(); i++)
    {
        m_omCombMessage.AddString(arrMsgIDsList.GetAt(i));
    }
    m_omCombMessage.SetCurSel(0);
    m_omCombMessage.SetFocus();

    m_omListCtrlSignal.SetImageList(&m_omImageList, LVSIL_SMALL);
    // Create the first column. But this will not be shown
    m_omListCtrlSignal.InsertColumn( 0, STR_EMPTY, LVCFMT_LEFT,
                                     0); //Width is zero as this will
    //be updated in vUpdateUnSelSubEntryList
    // Populate the list with signal names
    vPopulateUnSelSubEntryList(unGetSelectedMainEntryID());

    UINT nMsgID = unGetSelectedMainEntryID();
    m_fDefAmplitude = m_pWaveDataHandler->fGetMsgIDDefaultValue(nMsgID);

    // Update Signal Watch List
    // Set the same image list to this control
    m_omListCtrlSignalWatch.SetImageList(&m_omImageList,LVSIL_SMALL);
    // Create Column for Signal Watch Lsit
    m_omListCtrlSignalWatch.InsertColumn( 0,
                                          STR_EMPTY,
                                          LVCFMT_LEFT,
                                          0);//Width is zero as this will
    //be updated in vPopulateSelSubEntryList
    vPopulateSelSubEntryList();
    vEnableDisableButtons();

    // Channels
    m_omMsgChannel.ResetContent();
    // Add All Channels as first item
    m_omMsgChannel.AddString(defSTR_SELECTION_ALL);
    for (UINT Index = 1; Index <= m_nHardware; Index++)
    {
        CString omStr;
        // Format Channel ID String Say 1,2,...
        omStr.Format(defFORMAT_MSGID_DECIMAL, Index);
        m_omMsgChannel.AddString(omStr);
    }
    m_omMsgChannel.SetCurSel(1); //Make Channel 1 default.

    //Temporarily disable the channel selection feature.
    m_omMsgChannel.EnableWindow(FALSE);
    GetDlgItem(IDC_STATIC_CHANNEL)->EnableWindow(FALSE);

    UpdateData(FALSE);


    return FALSE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}
Example #23
0
/*******************************************************************************
  Function Name  : OnButtonRemove
  Input(s)       : -
  Output         : -
  Functionality  : This function will remove the selected item from the selected
                   hardware list. This will also insert the same in to the
                   available list
  Member of      : CHardwareListingCAN
  Author(s)      : Raja N
  Date Created   : 21.2.2005
  Modifications  : Raja N on 17.03.2005
                   Added code to change channel ID of rest of items when a
                   channel is deleted from the selected channel list
*******************************************************************************/
void CHardwareListingCAN::vMoveItemFromSelectedList()
{
    // Get the selected item from the list
    POSITION sPos = m_omSelectedHwList.GetFirstSelectedItemPosition();
	if( nullptr!=sPos )
    {
        int nSelectedItem = m_omSelectedHwList.GetNextSelectedItem(sPos);
        int nArrayIndex = (INT)m_omSelectedHwList.GetItemData( nSelectedItem );
        int nImageIndex;

        nImageIndex = defDISCONNECTED_IMAGE_INDEX;

        // Insert this item in to the available list
        // Calculate new item index
        int nItemCount = m_omHardwareList.GetItemCount();
        // Insert the new entry
        m_omHardwareList.InsertItem( nItemCount,
			m_omSelectedHwList.GetItemText( nSelectedItem, 0),
                                     nImageIndex );
        // Set the hardware list index as item data.
        m_omHardwareList.SetItemData( nItemCount, nArrayIndex );

		int nSelectedItemCount = m_omSelectedHwList.GetItemCount();
        //Sort Hardware Items
        vSortHardwareItems();
		if (m_pControllerDetails != nullptr)
		{
			for (int nIndex = nSelectedItem; nIndex<nSelectedItemCount - 1; nIndex++)
			{
				m_pControllerDetails[nIndex] = m_pControllerDetails[nIndex + 1];
			}
		}
		
		UpdateData(FALSE);
//Set the values over the UI
		if (m_pControllerDetails != nullptr)
		{
			m_omEditBaudRate.SetWindowText(m_pControllerDetails[nSelectedItem].m_omStrBaudrate.c_str());
			CString omCANFDDataBitRate;
			m_chkCANFD.EnableWindow(m_pControllerDetails[nSelectedItem].m_bSupportCANFD);
			m_chkCANFD.SetCheck(m_pControllerDetails[nSelectedItem].m_bcanFDEnabled);
			CButton* pChkCANFD = (CButton*)GetDlgItem(IDC_CHECK_CANFD);
			if (nullptr != pChkCANFD)
			{
				if (pChkCANFD->GetCheck() == BST_CHECKED)
				{
					omCANFDDataBitRate.Format("%u", m_pControllerDetails[nSelectedItem].m_unDataBitRate);
					m_omCANFDEditBaudRate.SetWindowText(omCANFDDataBitRate);
				}
			}
		}
		UpdateData(TRUE);
        // Remove the item from the selected list
        m_omSelectedHwList.DeleteItem( nSelectedItem );
        // Change the channel text approp.
        int nItem = m_omSelectedHwList.GetItemCount();
        // Check whether update is required or not
        if( nSelectedItem < nItem )
        {
            // Format string
            CString omStrChannel;
            int nItemsToUpdate = nItem - nSelectedItem;
            // Loopt through list of items
            for( int nIndex = 0; nIndex < nItemsToUpdate; nIndex++ )
            {
                // Update format string
                omStrChannel.Format( defSTR_CHANNEL_NAME_FORMAT,
                                     defSTR_CHANNEL_NAME,
                                     nSelectedItem + nIndex + 1 );
                // Update Text
                m_omSelectedHwList.SetItemText( nSelectedItem + nIndex,
					1,
                                                omStrChannel );
            }
        }
		m_omSelectedHwList.SetItemState( nSelectedItem,
			LVIS_SELECTED | LVIS_FOCUSED,
			LVIS_SELECTED | LVIS_FOCUSED );
        // Update UI button status
        vEnableDisableButtons();
    }
	else
	{
		m_omSelectedHwList.SetItemState( 0,
			LVIS_SELECTED | LVIS_FOCUSED,
			LVIS_SELECTED | LVIS_FOCUSED );
	}
}
/*******************************************************************************
Function Name    : OnBtnDelAllSignal
Input(s)         :  -
Output           :  -
Functionality    : This function will be called by framework when the user
                   selects "Delete All" button. This will call
                   "vDeleteSelectedSignals" to delete all the signals.
Member of        : CSigWatchAddDelDlg
Friend of        :  -
Author(s)        : Raja N
Date Created     : 25.03.2004
Modification By  : 
Modification on  : 
*******************************************************************************/
void CSigWatchAddDelDlg::OnBtnDelAllSubEntires() 
{
    vDelSelSubEntries(TRUE);
    vEnableDisableButtons();
}
/*******************************************************************************
Function Name    : OnSelChangeMessageName
Input(s)         : 
Output           : 
Functionality    : This function will be called by framework when the message 
                   name combo box selection got changed. This will update the 
                   Signal Names List control
Member of        : CSigWatchAddDelDlg
Friend of        :  -
Author(s)        : Raja N
Date Created     : 25.03.2004
Modification By  : 
Modification on  : 
*******************************************************************************/
void CSigWatchAddDelDlg::OnSelChangeMessageName() 
{

    vPopulateUnSelSubEntryList(unGetSelectedMainEntryID());
    vEnableDisableButtons();
}
/*******************************************************************************
Function Name    : OnRClickSignal
Input(s)         : NMHDR* pNMHDR, LRESULT* pResult - Handler parameter
Output           :  -
Functionality    : This function will be called by framework when the user 
                   clicks the right mouse button in Signal List box. This will
                   popup the menu item. The irrevelent menu items will be
                   disabled. If there is not item in the list box the popup menu
                   will not be displayed.
Member of        : CSigWatchAddDelDlg
Friend of        :  -
Author(s)        : Raja N
Date Created     : 25.03.2004
Modification By  : 
Modification on  : 
*******************************************************************************/
void CSigWatchAddDelDlg::OnRClickUnSelSubEntryList(NMHDR* /*pNMHDR*/, LRESULT* pResult) 
{
    CMenu omCtxMenu;
    CPoint point(0,0);

    // Enable buttons in sysn with menu
    vEnableDisableButtons();

    GetCursorPos(&point);
    // Popup only if there is something in the list
    if( m_omListCtrlSignal.GetItemCount() > 0)
    {
        if (omCtxMenu.LoadMenu(IDM_MENU_SIGNAL_WATCH))
        {
            CMenu* pomCtxMenu = omCtxMenu.GetSubMenu(2);

            if (pomCtxMenu != NULL)
            {
                UINT unSelCount;
                unSelCount = m_omListCtrlSignal.GetSelectedCount();
                // Disable Delete Operations
                pomCtxMenu->EnableMenuItem(IDM_SIGNALDLG_DELETE,
                                            MF_DISABLED | MF_GRAYED);

                pomCtxMenu->EnableMenuItem(IDM_SIGNALDLG_DELETEALL,
                                            MF_DISABLED | MF_GRAYED);
                if(unSelCount == 0)
                {
                    // Disable selection operations
                    pomCtxMenu->EnableMenuItem(IDM_SIGNALDLG_ADD,
                                                MF_DISABLED | MF_GRAYED);
                }
                // Enable Signal Details only if one item got selected
                if(unSelCount == 1)
                {
                    // Copy the Message Name and Signal Name for Signal Details
                    m_omCSAData.RemoveAll();
                    // Message Name First
                    CString omMainEntry;
                    m_omCombMessage.GetWindowText(omMainEntry);
                    m_omCSAData.Add(omMainEntry);
                    // Signal Name Next
                    POSITION pos = 
                        m_omListCtrlSignal.GetFirstSelectedItemPosition();
                    UINT unIndex = m_omListCtrlSignal.GetNextSelectedItem(pos);
            
                    m_omCSAData.Add(m_omListCtrlSignal.GetItemText(unIndex,0));
                }
                // Multiple Selection
                else
                {
                    // Disable Details Menu Item
                    pomCtxMenu->EnableMenuItem(IDM_SIGNALDLG_SIGNALDETAILS,
                                                MF_DISABLED | MF_GRAYED);
                }
                
                pomCtxMenu->TrackPopupMenu(TPM_RIGHTBUTTON | TPM_LEFTALIGN,
                                       point.x, point.y,
                                       this);
            }
        }
    }   
    
    *pResult = 0;
}
/*******************************************************************************
Function Name    : OnInitDialog
Input(s)         : 
Output           : 
Functionality    : This function will be called during initialization of dialog
                   box. This function will fill respective list controls
Member of        : CMainSubListDlg
Friend of        :  -
Author(s)        : Raja N
Date Created     : 25.03.2004
*******************************************************************************/
BOOL CMainSubListDlg::OnInitDialog() 
{
    // Call parent's init function
    CDialog::OnInitDialog();    

    //Display title name
    SetWindowText((LPCTSTR)m_sGuiParams.m_acTitleName);
    //Dislay Main List name
    CWnd* pWnd = GetDlgItem(IDC_EDIT_MAINLIST_NAME);
    if (pWnd != NULL)
    {
        pWnd->SetWindowText((LPCTSTR)m_sGuiParams.m_acMainListName);
    }
    //Dislay Unselected List name
    pWnd = GetDlgItem(IDC_EDIT_UNSELLIST_NAME);
    if (pWnd != NULL)
    {
        pWnd->SetWindowText((LPCTSTR)m_sGuiParams.m_acUnSelListName);
    }
    //Dislay Selected List name
    pWnd = GetDlgItem(IDC_EDIT_SELLIST_NAME);
    if (pWnd != NULL)
    {
        pWnd->SetWindowText((LPCTSTR)m_sGuiParams.m_acSelListName);
    }
    // Populate the message name combo
    // Clear the content if any
    m_omCombMessage.ResetContent();
    if (m_podTempCallerList != NULL)
    {
        UINT unNoOfMainEntries = (UINT)m_podTempCallerList->GetCount();
    
        if ( unNoOfMainEntries > 0 )
        {		
		    // Add every message name into the message list
            POSITION pos = m_podTempCallerList->GetHeadPosition();
            while (pos != NULL)
            {
                SMAINENTRY& sMainEntry = m_podTempCallerList->GetNext(pos);
                CString omMainEntryName = sMainEntry.m_omMainEntryName;
                CString omMainEntryId = "";

                if (m_sGuiParams.m_bCombine == TRUE)
                {
                    omMainEntryId.Format(defSTR_MSG_ID_IN_HEX,sMainEntry.m_unMainEntryID);
                    omMainEntryName = omMainEntryId + omMainEntryName;
                }
				
				m_omCombMessage.AddString(omMainEntryName);
            }
            m_omCombMessage.SetCurSel(0);
            
            m_omListCtrlSignal.SetImageList(m_sGuiParams.m_pomImageList, LVSIL_SMALL);
            
            // Create the first column. But this will not be shown
            m_omListCtrlSignal.InsertColumn( 0, 
                                                STR_EMPTY, 
                                                LVCFMT_LEFT,
                                                0); //Width is zero as this will 
                                            //be updated in vUpdateUnSelSubEntryList
            
            // Populate the list with signal names
            vPopulateUnSelSubEntryList(unGetSelectedMainEntryID());
            m_omCombMessage.SetFocus();
        }
    }
    
    // Update Signal Watch List
    // Set the same image list to this control
    m_omListCtrlSignalWatch.SetImageList(m_sGuiParams.m_pomImageList,LVSIL_SMALL);
    // Create Column for Signal Watch Lsit
    m_omListCtrlSignalWatch.InsertColumn( 0,
                                     STR_EMPTY,
                                     LVCFMT_LEFT,
                                     0);//Width is zero as this will 
                                        //be updated in vPopulateSelSubEntryList
    vPopulateSelSubEntryList();
    vEnableDisableButtons();

    return FALSE;  // return TRUE unless you set the focus to a control
                  // EXCEPTION: OCX Property Pages should return FALSE
}