Beispiel #1
0
void CTxMsgListView::vUpdateMsgListDisplay(sTXCANMSGDETAILS sMsgDetail,
        INT nCurrentIndex)
{
    CString omStrMsgID( "" );
    CString omStrMsgData( "" );
    CString omStrMsgType( "" );
    CString omStrDLC( "" );
    CString omStrChannel( "" );
    INT nIndex           = -1;
    UINT unImageID       = 0;
    CString omStrFormat( "" );
    CString omStrMsgName( "" );
    // Set Edit flag to TRUE
    m_bInitDlg = TRUE;

    // format the message data length
    // Get the base and accordingly change the format for Format function of
    // CString class.
    if( TRUE == CTxMsgManager::s_TxFlags.nGetFlagStatus(TX_HEX) )
    {
        omStrMsgID.Format(defFORMAT_MSGID_HEX,sMsgDetail.m_sTxMsg.m_unMsgID);
        omStrFormat = defFORMAT_DATA_HEX;
    }
    else
    {
        omStrMsgID.Format( defFORMAT_MSGID_DECIMAL,
                           sMsgDetail.m_sTxMsg.m_unMsgID );
        omStrFormat = defFORMAT_DATA_DECIMAL;
    }    // Message Details View
    CTxMsgDetailsView* pomDetailsView = nullptr;
    CMsgSignal* pDBptr = nullptr;
    pomDetailsView = (CTxMsgDetailsView*)pomGetDetailsViewPointer();
    if (nullptr != pomDetailsView)
    {
        pDBptr =  pomDetailsView->m_pouDBPtr;
    }
    CString omStrUpdatedMsgLength = "";
    // See if the msg ID is in the database
    // If yes load appropriate image
    if (nullptr != pDBptr)
    {
        omStrMsgName =
            pDBptr->omStrGetMessageNameFromMsgCode(sMsgDetail.m_sTxMsg.m_unMsgID);
        //omStrUpdatedMsgLength = pDBptr->omStrGetMessageLengthFromMsgCode(sMsgDetail.m_sTxMsg.m_unMsgID);
    }
    if ( omStrMsgName.IsEmpty() == FALSE )
    {
        unImageID = 1;// Database Image
        // Add message Name with the entry
        omStrMsgID += " [" +
                      pDBptr->omStrGetMessageNameFromMsgCode(sMsgDetail.m_sTxMsg.m_unMsgID )
                      + "]";
    }
    else
    {
        unImageID = 2;// Non-Database image
    }

    // Format channel ID
    omStrChannel.Format("%d", sMsgDetail.m_sTxMsg.m_ucChannel );

    // Format Message Type
    omStrFormat.Insert(omStrFormat.GetLength(),defEMPTY_CHAR);
    CString omStrTemp = "";

    for(INT i=0; i<sMsgDetail.m_sTxMsg.m_ucDataLen; i++)
    {
        omStrTemp.Format(omStrFormat,sMsgDetail.m_sTxMsg.m_ucData[i]);
        omStrMsgData +=  omStrTemp;
    }
    // Format the Message type
    if(sMsgDetail.m_sTxMsg.m_ucEXTENDED == TRUE)
    {
        omStrMsgType = defMSGID_EXTENDED;
    }
    else
    {
        omStrMsgType = defMSGID_STD;
    }
    if(sMsgDetail.m_sTxMsg.m_ucRTR == TRUE)
    {
        omStrMsgType += defMSGID_RTR;
    }
    // Format the DLC
    omStrDLC.Format("%d",sMsgDetail.m_sTxMsg.m_ucDataLen);
    // Get the current count if this is new items and insert it
    // as new item. Otherwise set the current item text.
    if(nCurrentIndex == -1)
    {
        INT nCount = m_omLctrMsgList.GetItemCount();
        if(nCount != -1 )
        {
            nIndex = m_omLctrMsgList.
                     InsertItem(nCount,omStrMsgID,unImageID);
        }
    }
    else
    {
        LVITEM sItem;
        sItem.mask      = LVIF_IMAGE;
        sItem.iItem     = nCurrentIndex;
        sItem.iSubItem  = defMAIN_ITEM;
        sItem.iImage    = unImageID;
        m_omLctrMsgList.
        SetItemText(nCurrentIndex,defMAIN_ITEM,omStrMsgID);
        m_omLctrMsgList.SetItem(&sItem);
        nIndex = nCurrentIndex;
    }
    // Set the list control item with string formatted for each column.
    if(nIndex != -1 )
    {
        // Update Channel ID
        m_omLctrMsgList.SetItemText( nIndex,
                                     defSUBITEM_MSGDETAILS_CHANNEL_ID,
                                     omStrChannel );
        // Update Message Type
        m_omLctrMsgList.SetItemText( nIndex,
                                     defSUBITEM_MSGDETAILS_TYPE,
                                     omStrMsgType );
        // Update Message Length
        m_omLctrMsgList.SetItemText( nIndex,
                                     defSUBITEM_MSGDETAILS_DLC,
                                     omStrDLC );
        // Update Data Bytes with Dirty Flag
        if( sMsgDetail.m_bIsMsgDirty == TRUE &&
                unImageID == 1 &&
                sMsgDetail.m_sTxMsg.m_ucDataLen > 0 )
        {
            omStrMsgData +=defASSETRIC;
        }
        m_omLctrMsgList.SetItemText( nIndex,
                                     defSUBITEM_MSGDETAILS_DATA,
                                     omStrMsgData);
        // Update Check box status
        m_omLctrMsgList.SetCheck( nIndex, sMsgDetail.m_bEnabled );
    }

    // Set Edit flag to FALSE
    m_bInitDlg = FALSE;
}
Beispiel #2
0
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 );

    }
}
Beispiel #3
0
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();
                        }
                    }
                }
            }
        }
    }
}
Beispiel #4
0
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();
                            }
                        }

                    }
                }
            }
        }
    }
}
Beispiel #5
0
void updateRollingCntCheckSum(PSTXCANMSGLIST  psTxMsgList)
{
	unsigned char tmp,m(0),k(0);
	int startbit(0), rlmax(0), checkbyte(0),roolcnt(0),checksum(0),i(0),j(0),s(0),rlbs(0); 
#if 0
	CTxMsgDetailsView* pomDetailsView = nullptr;

	if (psTxMsgList == nullptr)
	{
		return;
	}
	pomDetailsView = ( CTxMsgDetailsView* )pomGetDetailsViewPointer();
	if (pomDetailsView!= nullptr && !(pomDetailsView->m_enRollChk.GetCheck()))
	{
		return;
	}
#endif
	if (!psTxMsgList->m_bEnRollCntCheck)
	{
		return;
	}
	rlmax = psTxMsgList->m_rollCntMax;
	s = psTxMsgList->m_rollCntStartBit;
	i = rlmax;
	if (rlmax > 0)
	{
		while (i)
		{
			i = i >> 1;
			rlbs++;
			k = 1 << rlbs;
		}
		j = (s%8);
		for(i=(s%8)+ rlbs -1;i>=s%8;i--)
		{
			m |= (1<<(i));
		}
		tmp = (psTxMsgList->m_sTxMsgDetails.m_sTxMsg.m_ucData[s/8]);
		roolcnt = tmp & m;
		roolcnt = roolcnt >> (s%8);
		if(roolcnt++ >= rlmax)
		{
			roolcnt = 0;
		}
		roolcnt = roolcnt << (s%8);
		k = ~m; 
		tmp &= k; 
		tmp |= roolcnt;
		psTxMsgList->m_sTxMsgDetails.m_sTxMsg.m_ucData[s/8] = tmp;
	}
	checkbyte = psTxMsgList->m_checkSumByte;
	for(int i = 0; i < 8; i++)
	{
		if (i == checkbyte)
		{
			continue;
		}
		if ((psTxMsgList->m_checkSumType == 0) || (psTxMsgList->m_checkSumType == 1))
		{
			checksum += psTxMsgList->m_sTxMsgDetails.m_sTxMsg.m_ucData[i];
		} 
	}
	if(psTxMsgList->m_checkSumType == 1)
	{
		checksum ^= 0xff;
	}
	psTxMsgList->m_sTxMsgDetails.m_sTxMsg.m_ucData[checkbyte] = checksum;
}
Beispiel #6
0
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;
}
Beispiel #7
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();
                }
            }
        }
    }
}