⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 triggerdef.c

📁 可编程器件厂商Xilinx的手持式逻辑分析仪的逻辑设计
💻 C
📖 第 1 页 / 共 4 页
字号:
/*============================================================================*/
/* Filename:    TriggerDef.c                                                  */
/*                                                                            */
/* Description: This file contains the functions that receive and handle the  */
/*              events generated by the TrigDef Form of the PocketAnalyser    */
/*              application.                                                  */
/*                                                                            */
/* Required Header File(s): PalmOS.h                                          */
/*                          PocketAnalyzerRsc.h                               */
/*                          Globals.h                                         */
/*                                                                            */
/* Function List:                                                             */
/*      TrigDefHandleEvent                                                    */
/*                          This function is the event handler for the        */
/*                          TrigDef Form.  It checks each event and calls the */
/*                          appropriate function(s) to respond to it.         */
/*      TrigDefDoCommand                                                      */
/*                          This function handles all of the menu events from */
/*                          the TrigDef Form Menu.                            */
/*                                                                            */
/*============================================================================*/
/* COPYRIGHT (C) 2001                                                         */
/* NowTech, LLC                                                               */
/* Knoxville, TN                                                              */
/*                                                                            */
/* ALL RIGHTS RESERVED                                                        */
/*                                                                            */
/* This software and all information and ideas contained within are the sole  */
/* property of NowTech, LLC and are confidential.  Neither this software nor  */
/* any part nor any information contained in it may be disclosed or furnished */
/* to others without the prior written consent of NowTech, LLC.               */
/*                                                                            */
/*============================================================================*/

/*============================================================================*/
/* System Level Include Files:                                                */
/*============================================================================*/
#include <PalmOS.h>

/*============================================================================*/
/* Project Specific Include Files:                                            */
/*============================================================================*/
#include "PocketAnalyzerRsc.h"
#include "GlobalDefs.h"
#include "SpringBoardIO.h"

/*============================================================================*/
/* Define any data structures that are used exclusively by the functions      */
/* local to this source file.                                                 */
/*============================================================================*/
/***** None *****/

/*============================================================================*/
/* Define all constants used by the functions in this source file.            */
/*============================================================================*/
/***** None *****/

/*============================================================================*/
/* Define all variables which must have project global scope.  All variables  */
/* defined in this section will be accessible by all functions in all source  */
/* files in this project and must have a corresponding extern statement in    */
/* the GlobalDefs.h include file.                                             */
/*============================================================================*/
/***** None *****/

/*============================================================================*/
/* Define all variables which must have source file global scope but not have */
/* project wide scope.  These variables must be defined with the "static"     */
/* type qualifier so that the variables scope will be limited to only the     */
/* functions in this source file.                                             */
/*============================================================================*/
static AppPrefsType TrigPrefs;

/*============================================================================*/
/* Define the function prototypes for all local functions.  The prototypes    */
/* for all global functions should be defined in the GlobalDefs.h include     */
/* file.                                                                      */
/*============================================================================*/
void TrigDefFormInit (FormPtr);
void DisplayProbeState (Boolean);
Boolean TrigDefDoCommand (UInt16);


/*============================================================================*/
/* Function:            TrigDefHandleEvent                                    */
/* Description:         This routine is the event handler for the TrigDef     */
/*                      Form of the PocketAnalyzer application.               */
/*                                                                            */
/* Arguments:           pEvent = a pointer to an EventType structure          */
/* Returns:             bHandled = TRUE if the event is handled and should    */
/*                                 not be passed to a higher level handler.   */
/*                                 FALSE if the event was not handled and     */
/*                                 should be passed to the next higher level  */
/*                                 handler.                                   */
/* Globals affected:    None                                                  */
/* Hardware affected:   None                                                  */
/*                                                                            */
/*============================================================================*/
/* Change History:                                                            */
/*                                                                            */
/* ECO#:  ?                                                                   */
/* Change Date:  dd-mmm-yyyy                                                  */
/* Changed By:   ?                                                            */
/* Description of Change:  ?                                                  */
/*                                                                            */
/*============================================================================*/
Boolean TrigDefHandleEvent(EventPtr pEvent)
{
    /*========================================================================*/
    /* Declare all local variables.                                           */
    /*========================================================================*/
    static  UInt32 uiProbeStateTickCount = 0;
    Boolean bHandled = false;
    FormPtr pFrm;
    UInt16  ButtonPressed;
    Char    NewChnlLabel[4];
    ListPtr pLst;
    UInt16  index;
    UInt16  id;

    /*========================================================================*/
    /* Check the event type to see how to respond.                            */
    /*========================================================================*/
    switch (pEvent->eType)
        {
        case menuEvent:
            return TrigDefDoCommand(pEvent->data.menu.itemID);
            break;

        case frmOpenEvent:
            pFrm = FrmGetActiveForm();
            TrigDefFormInit (pFrm);
            FrmDrawForm (pFrm);
            bHandled = true;
            break;

        case ctlSelectEvent:
            switch (pEvent->data.ctlSelect.controlID)
            {
                /*============================================================*/
                /* The user has accepted all changes, therefore copy the      */
                /* working copy of the preferences back to the applications   */
                /* preferences to save all of the changes.  Then return to    */
                /* the main application screen.                               */
                /*============================================================*/
                case frmTrigDefDoneButton:
                    /*========================================================*/
                    /* Get the setting for moving to the trigger.             */
                    /*========================================================*/
                    pFrm = FrmGetActiveForm();
                    index = FrmGetControlGroupSelection
                            (pFrm, TriggerDefinitionFormGroupID);
                    id = FrmGetObjectId (pFrm, index);
                    if (id == frmTrigDefGo2TrigOnRunCheckbox)
                        TrigPrefs.bGotoTrigOnRun = true;
                    else
                        TrigPrefs.bGotoTrigOnRun = false;

                    /*========================================================*/
                    /* Get the amount of pre-trigger.                         */
                    /*========================================================*/
                    pLst = GetObjectPtr (frmTrigDefPreTriggerList);
                    TrigPrefs.PreTrigger = LstGetSelection (pLst);

                    /*========================================================*/
                    /* Save the user's changes and then return to the Main    */
                    /* Form.                                                  */
                    /*========================================================*/
                    CopyAppPrefs (&AppPrefs, &TrigPrefs);
                    FrmGotoForm (FrmMainForm);
                    bHandled = true;
                    break;

                /*============================================================*/
                /* The user has cancelled all changes, therefore do not save  */
                /* the changes but return to the main application screen.     */
                /*============================================================*/
                case frmTrigDefCancelButton:
                    FrmGotoForm (FrmMainForm);
                    bHandled = true;
                    break;

                case frmTrigDefCh7LabelButton:
                    ButtonPressed = FrmCustomResponseAlert (ChnlLabelChangeAlert,
                                    "7", NULL, NULL, NewChnlLabel, 4, NULL);
                    if (ButtonPressed == 0)
                    {
                        StrCopy (TrigPrefs.ChnlLabel[7], NewChnlLabel);
                        CtlSetLabel (GetObjectPtr(frmTrigDefCh7LabelButton),
                                         TrigPrefs.ChnlLabel[7]);
                    }
                    bHandled = true;
                    break;
                case frmTrigDefCh6LabelButton:
                    ButtonPressed = FrmCustomResponseAlert (ChnlLabelChangeAlert,
                                    "6", NULL, NULL, NewChnlLabel, 4, NULL);
                    if (ButtonPressed == 0)
                    {
                        StrCopy (TrigPrefs.ChnlLabel[6], NewChnlLabel);
                        CtlSetLabel (GetObjectPtr(frmTrigDefCh6LabelButton),
                                         TrigPrefs.ChnlLabel[6]);
                    }
                    bHandled = true;
                    break;
                case frmTrigDefCh5LabelButton:
                    ButtonPressed = FrmCustomResponseAlert (ChnlLabelChangeAlert,
                                    "5", NULL, NULL, NewChnlLabel, 4, NULL);
                    if (ButtonPressed == 0)
                    {
                        StrCopy (TrigPrefs.ChnlLabel[5], NewChnlLabel);
                        CtlSetLabel (GetObjectPtr(frmTrigDefCh5LabelButton),
                                         TrigPrefs.ChnlLabel[5]);
                    }
                    bHandled = true;
                    break;
                case frmTrigDefCh4LabelButton:
                    ButtonPressed = FrmCustomResponseAlert (ChnlLabelChangeAlert,
                                    "4", NULL, NULL, NewChnlLabel, 4, NULL);
                    if (ButtonPressed == 0)
                    {
                        StrCopy (TrigPrefs.ChnlLabel[4], NewChnlLabel);
                        CtlSetLabel (GetObjectPtr(frmTrigDefCh4LabelButton),
                                         TrigPrefs.ChnlLabel[4]);
                    }
                    bHandled = true;
                    break;
                case frmTrigDefCh3LabelButton:
                    ButtonPressed = FrmCustomResponseAlert (ChnlLabelChangeAlert,
                                    "3", NULL, NULL, NewChnlLabel, 4, NULL);
                    if (ButtonPressed == 0)
                    {
                        StrCopy (TrigPrefs.ChnlLabel[3], NewChnlLabel);
                        CtlSetLabel (GetObjectPtr(frmTrigDefCh3LabelButton),
                                         TrigPrefs.ChnlLabel[3]);
                    }
                    bHandled = true;
                    break;
                case frmTrigDefCh2LabelButton:
                    ButtonPressed = FrmCustomResponseAlert (ChnlLabelChangeAlert,
                                    "2", NULL, NULL, NewChnlLabel, 4, NULL);
                    if (ButtonPressed == 0)
                    {
                        StrCopy (TrigPrefs.ChnlLabel[2], NewChnlLabel);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -