?? mainform.c
字號:
/*============================================================================*/
/* Filename: MainForm.c */
/* */
/* Description: This file contains the functions that receive and handle the */
/* events generated by the Main Form of the PocketAnalyzer */
/* application. */
/* */
/* Required Header File(s): PalmOS.h */
/* PocketAnalyzerRsc.h */
/* Globals.h */
/* */
/* Function List: */
/* MainFormHandleEvent This function is the event handler for the Main */
/* Form. It checks each event and calls the */
/* appropriate function(s) to respond to it. */
/* MainFormDoCommand This function handles all of the menu events from */
/* Main 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. */
/*============================================================================*/
/***** None *****/
/*============================================================================*/
/* Define the function prototypes for all local functions. The prototypes */
/* for all global functions should be defined in the GlobalDefs.h include */
/* file. */
/*============================================================================*/
void MainFormInit (FormPtr);
Boolean MainFormDoCommand (UInt16);
void GetPlotSpacing (UInt8, UInt8*, UInt8*, UInt8*, UInt8*);
void PlotAreaGadgetTapped (void);
/*============================================================================*/
/* Function: MainFormHandleEvent */
/* Description: This routine is the event handler for the Main 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 MainFormHandleEvent (EventPtr pEvent)
{
/*========================================================================*/
/* Declare all local variables. */
/*========================================================================*/
Boolean bHandled = false;
FormPtr pFrm;
UInt16 ButtonPressed;
Char NewChnlLabel[4];
ListPtr pLst;
Char* pLabel;
ControlPtr pCtl;
sbioRunStateType RunState;
/*========================================================================*/
/* Check the event type to see how to respond. */
/*========================================================================*/
switch (pEvent->eType)
{
case menuEvent:
return MainFormDoCommand(pEvent->data.menu.itemID);
break;
case frmOpenEvent:
pFrm = FrmGetActiveForm();
MainFormInit (pFrm);
FrmDrawForm (pFrm);
bHandled = true;
break;
/*====================================================================*/
/* Get the user's Timebase selection from the list popup. */
/*====================================================================*/
case popSelectEvent:
if (pEvent->data.popSelect.selection != pEvent->data.popSelect.priorSelection)
{
AppPrefs.Timebase = pEvent->data.popSelect.selection;
/*============================================================*/
/* Set the Timescale in both the list and the selector. */
/*============================================================*/
pLst = GetObjectPtr (frmMainTimeScaleList);
LstSetSelection (pLst, AppPrefs.Timebase);
pLabel = LstGetSelectionText (pLst, AppPrefs.Timebase);
pCtl = GetObjectPtr (frmMainTimeScalePopTrigger);
CtlSetLabel (pCtl, pLabel);
FrmShowObject (pFrm, FrmGetObjectIndex (pFrm,
frmMainTimeScalePopTrigger));
/*============================================================*/
/* Refresh the graph display reflecting the new settings. */
/*============================================================*/
DrawPlotAreaGadget();
DrawBufferBarGadget();
}
bHandled = true;
break;
case ctlSelectEvent:
switch (pEvent->data.ctlSelect.controlID)
{
case frmMainCh7LabelButton:
ButtonPressed = FrmCustomResponseAlert (ChnlLabelChangeAlert,
"7", NULL, NULL, NewChnlLabel, 4, NULL);
if (ButtonPressed == 0)
{
StrCopy (AppPrefs.ChnlLabel[7], NewChnlLabel);
CtlSetLabel (GetObjectPtr(frmMainCh7LabelButton),
AppPrefs.ChnlLabel[7]);
}
bHandled = true;
break;
case frmMainCh6LabelButton:
ButtonPressed = FrmCustomResponseAlert (ChnlLabelChangeAlert,
"6", NULL, NULL, NewChnlLabel, 4, NULL);
if (ButtonPressed == 0)
{
StrCopy (AppPrefs.ChnlLabel[6], NewChnlLabel);
CtlSetLabel (GetObjectPtr(frmMainCh6LabelButton),
AppPrefs.ChnlLabel[6]);
}
bHandled = true;
break;
case frmMainCh5LabelButton:
ButtonPressed = FrmCustomResponseAlert (ChnlLabelChangeAlert,
"5", NULL, NULL, NewChnlLabel, 4, NULL);
if (ButtonPressed == 0)
{
StrCopy (AppPrefs.ChnlLabel[5], NewChnlLabel);
CtlSetLabel (GetObjectPtr(frmMainCh5LabelButton),
AppPrefs.ChnlLabel[5]);
}
bHandled = true;
break;
case frmMainCh4LabelButton:
ButtonPressed = FrmCustomResponseAlert (ChnlLabelChangeAlert,
"4", NULL, NULL, NewChnlLabel, 4, NULL);
if (ButtonPressed == 0)
{
StrCopy (AppPrefs.ChnlLabel[4], NewChnlLabel);
CtlSetLabel (GetObjectPtr(frmMainCh4LabelButton),
AppPrefs.ChnlLabel[4]);
}
bHandled = true;
break;
case frmMainCh3LabelButton:
ButtonPressed = FrmCustomResponseAlert (ChnlLabelChangeAlert,
"3", NULL, NULL, NewChnlLabel, 4, NULL);
if (ButtonPressed == 0)
{
StrCopy (AppPrefs.ChnlLabel[3], NewChnlLabel);
CtlSetLabel (GetObjectPtr(frmMainCh3LabelButton),
AppPrefs.ChnlLabel[3]);
}
bHandled = true;
break;
case frmMainCh2LabelButton:
ButtonPressed = FrmCustomResponseAlert (ChnlLabelChangeAlert,
"2", NULL, NULL, NewChnlLabel, 4, NULL);
if (ButtonPressed == 0)
{
StrCopy (AppPrefs.ChnlLabel[2], NewChnlLabel);
CtlSetLabel (GetObjectPtr(frmMainCh2LabelButton),
AppPrefs.ChnlLabel[2]);
}
bHandled = true;
break;
case frmMainCh1LabelButton:
ButtonPressed = FrmCustomResponseAlert (ChnlLabelChangeAlert,
"1", NULL, NULL, NewChnlLabel, 4, NULL);
if (ButtonPressed == 0)
{
StrCopy (AppPrefs.ChnlLabel[1], NewChnlLabel);
CtlSetLabel (GetObjectPtr(frmMainCh1LabelButton),
AppPrefs.ChnlLabel[1]);
}
bHandled = true;
break;
case frmMainCh0LabelButton:
ButtonPressed = FrmCustomResponseAlert (ChnlLabelChangeAlert,
"0", NULL, NULL, NewChnlLabel, 4, NULL);
if (ButtonPressed == 0)
{
StrCopy (AppPrefs.ChnlLabel[0], NewChnlLabel);
CtlSetLabel (GetObjectPtr(frmMainCh0LabelButton),
AppPrefs.ChnlLabel[0]);
}
bHandled = true;
break;
case frmMainStartGraphicButton:
StartAcquisition();
break;
case frmMainStopGraphicButton:
StopAcquisition();
break;
}
break;
case nilEvent:
if (PlotData.AcquisitionInProcess == true)
{
sbioReadRunState (&RunState);
if (RunState.bRunStop == false)
{
PlotData.TrigDataBuffOffset = RunState.uiTrigOffset;
PlotData.bTrigInHiByte = RunState.bTrigWordHiByte;
PlotData.AcquisitionInProcess = false;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -