📄 mainform.c
字号:
sbioReadBuffData (0, PlotData.TrigDataBuffOffset,
PlotData.bTrigInHiByte, PlotData.SmplData);
DrawPlotAreaGadget();
DrawBufferBarGadget();
if (AppPrefs.bAutoSweepMode == true)
StartAcquisition();
else
StopAcquisition();
}
}
break;
}
return bHandled;
}
/***********************************************************************
*
* FUNCTION: MainFormInit
*
* DESCRIPTION: This routine initializes the MainForm form.
*
* PARAMETERS: frm - pointer to the MainForm form.
*
* RETURNED: nothing
*
* REVISION HISTORY:
*
*
***********************************************************************/
static void MainFormInit (FormPtr pFrm)
{
/*========================================================================*/
/* Declare all local variables. */
/*========================================================================*/
ListPtr pLst;
Char* pLabel;
ControlPtr pCtl;
/*========================================================================*/
/* Set the timeout for the event loop query for a new event to 1/2 sec. */
/*========================================================================*/
EventLoopTimeout = evtWaitForever;
/*========================================================================*/
/* 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));
/*========================================================================*/
/* Set the Labels on the Channel Label buttons. */
/*========================================================================*/
CtlSetLabel (GetObjectPtr(frmMainCh0LabelButton),
AppPrefs.ChnlLabel[0]);
CtlSetLabel (GetObjectPtr(frmMainCh1LabelButton),
AppPrefs.ChnlLabel[1]);
CtlSetLabel (GetObjectPtr(frmMainCh2LabelButton),
AppPrefs.ChnlLabel[2]);
CtlSetLabel (GetObjectPtr(frmMainCh3LabelButton),
AppPrefs.ChnlLabel[3]);
CtlSetLabel (GetObjectPtr(frmMainCh4LabelButton),
AppPrefs.ChnlLabel[4]);
CtlSetLabel (GetObjectPtr(frmMainCh5LabelButton),
AppPrefs.ChnlLabel[5]);
CtlSetLabel (GetObjectPtr(frmMainCh6LabelButton),
AppPrefs.ChnlLabel[6]);
CtlSetLabel (GetObjectPtr(frmMainCh7LabelButton),
AppPrefs.ChnlLabel[7]);
/*========================================================================*/
/* If the AutoRun bit is set, then start an acquisition and make the stop */
/* button visible. Otherwise, make sure that the acquisition is stopped */
/* and the run button is visible. */
/*========================================================================*/
if (AppPrefs.bAutoSweepMode == true)
StartAcquisition();
else
StopAcquisition();
/*========================================================================*/
/* Set the event handler for both of the gadgets on the screen. */
/*========================================================================*/
FrmSetGadgetHandler (pFrm, FrmGetObjectIndex (pFrm, frmMainBufferBarGadget),
MainGadgetHandler);
}
/***********************************************************************
*
* FUNCTION: MainFormDoCommand
*
* DESCRIPTION: This routine performs the menu command specified.
*
* PARAMETERS: command - menu item id
*
* RETURNED: nothing
*
* REVISION HISTORY:
*
*
***********************************************************************/
static Boolean MainFormDoCommand(UInt16 command)
{
EventType event;
Boolean handled = false;
FormPtr pFrm;
switch (command)
{
case MainSetupRunMode:
MenuEraseStatus(0); /* Clear menu from display. */
FrmGotoForm (FrmRunModeForm);
handled = true;
break;
case MainSetupSetupTrigger:
MenuEraseStatus(0); /* Clear menu from display. */
FrmGotoForm (FrmTrigDefForm);
handled = true;
break;
case MainSetupEXIT:
event.eType = appStopEvent;
EvtAddEventToQueue(&event);
handled = true;
break;
case MainSetupSetTimebase:
MenuEraseStatus(0); /* Clear menu from display. */
FrmGotoForm (FrmTimebaseSelectForm);
handled = true;
break;
case MainSetupSelectChannels:
MenuEraseStatus(0); /* Clear menu from display. */
FrmGotoForm (FrmChnlSelectForm);
handled = true;
break;
case MainCursorsXOnOff:
handled = true;
break;
case MainCursorsOOnOff:
handled = true;
break;
case MainCursorsPositionX:
handled = true;
break;
case MainCursorsPositionO:
handled = true;
break;
case MainCursorsJumptoX:
handled = true;
break;
case MainCursorsJumptoO:
handled = true;
break;
case MainCursorsJumptoT:
handled = true;
break;
case MainCursorsDisplayCursorMeasurements:
MenuEraseStatus(0); /* Clear menu from display. */
pFrm = FrmInitForm (FrmCursorDataForm);
FrmDoDialog (pFrm);
FrmDeleteForm (pFrm);
handled = true;
break;
case MainOptionsPreferences:
MenuEraseStatus(0); /* Clear menu from display. */
FrmGotoForm (FrmPrefsForm);
handled = true;
break;
case MainOptionsHelp:
MenuEraseStatus(0); /* Clear menu from display. */
pFrm = FrmGetActiveForm();
FrmHelp (MainScreenHelpString);
handled = true;
break;
case MainOptionsAboutPocketAnalyzer:
MenuEraseStatus(0); /* Clear menu from display. */
pFrm = FrmInitForm (FrmAboutForm);
FrmDoDialog (pFrm); /* Display the About Box. */
FrmDeleteForm (pFrm);
handled = true;
break;
}
return handled;
}
/*============================================================================*/
/* Function: MainGadgetHandler */
/* Description: This routine is the event handler for all of the */
/* gadgets on the Main screen of the PocketAnalyzer */
/* application. */
/* */
/* Arguments: pGadget = Pointer to the gadget with the event. */
/* cmd = Event handler action code. */
/* pParam = Pointer to EventType structure. */
/* Returns: bHandled = Boolean indicating if the event has been */
/* properly handled. */
/* Globals affected: None */
/* Hardware affected: None */
/* */
/*============================================================================*/
/* Change History: */
/* */
/* ECO#: ? */
/* Change Date: dd-mmm-yyyy */
/* Changed By: ? */
/* Description of Change: ? */
/* */
/*============================================================================*/
Boolean MainGadgetHandler (struct FormGadgetType *pGadget,
UInt16 cmd, void *pParam)
{
/*========================================================================*/
/* Declare all local variables. */
/*========================================================================*/
Boolean bHandled = false;
EventType *pEvent;
switch (cmd)
{
/*====================================================================*/
/* Sent to active gadgets any time form is drawn or redrawn. */
/*====================================================================*/
case formGadgetDrawCmd:
DrawPlotAreaGadget();
DrawBufferBarGadget();
pGadget->attr.visible = true;
bHandled = true;
break;
/*====================================================================*/
/* Sent when form receives a gadget event. paramP points to */
/* EventType structure. */
/*====================================================================*/
case formGadgetHandleEventCmd:
pEvent = pParam;
/*================================================================*/
/* penDown in gadget抯 bounds. */
/*================================================================*/
if (pEvent->eType == frmGadgetEnterEvent)
{
PlotAreaGadgetTapped ();
bHandled = true;
}
/*================================================================*/
/* This event is sent by your application when it needs to send */
/* info to the gadget. */
/*================================================================*/
if (pEvent->eType == frmGadgetMiscEvent)
{
}
break;
/*====================================================================*/
/* Perform any cleanup prior to deletion. */
/*====================================================================*/
case formGadgetDeleteCmd:
break;
/*====================================================================*/
/* FrmHideObject takes care of this if you return false. */
/*====================================================================*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -