Example #1
0
/* --------------------------------------------------------------------- */
int main(int argc, char *argv[])
{
  int	n;
  Arg	args[6];

  Initialize();
  ProcessArgs(argv);
  ReadConfigFile();

  AutoScale();

  if (!Interactive)
    PrintPS((Widget)NULL, (XtPointer)NULL, (XtPointer)NULL);
  else
    {
    AppShell = XtAppInitialize(&appContext, APP_CLASS, NULL, 0, &argc, argv,
                                fallback_resources, NULL, 0);

    XtGetApplicationResources(AppShell, (caddr_t) &iv, resources,
                                XtNumber(resources), NULL, 0);

    n = 0;
    MainShell = XtCreatePopupShell("topLevelShell",
                                topLevelShellWidgetClass, AppShell, args, n);

    MainWindow = CreateMainWindow(MainShell);

    n = 0;
    ControlShell = XtCreatePopupShell("controlShell",
                                topLevelShellWidgetClass, AppShell, args, n);

    CreateControlWindow(ControlShell);

    CreateErrorBox(AppShell);
    CreateQueryBox(AppShell);
    CreateWarningBox(AppShell);
    CreateFileSelectionBox(AppShell);

    if (NumberDataFiles > 0)
      NewDataFile((Widget)NULL, (XtPointer)NULL, (XtPointer)NULL);

    OpenControlWindow(NULL, NULL, NULL);
    XtManageChild(MainWindow);
    XtPopup(XtParent(MainWindow), XtGrabNone);

    if (RealTime)
      XtAppAddTimeOut(appContext, 1000, UpdateDataRT, NULL);

    XtAppMainLoop(appContext);
    }

  return(0);

}	/* END MAIN */
Example #2
0
ControlPannel::ControlPannel(QWidget *parent) :
    QWidget(parent)
{

    m_isStop=false;
    m_Trigger=SOFT;
    m_is2Channel=false;
    m_hasHardWareTrigger=false;

    Grid_Main=new QGridLayout;
    Grid_Trigger=new QGridLayout;
    Grid_Offset=new QGridLayout;
    Grid_Scale=new QGridLayout;
    Grid_Other=new QGridLayout;
    Grid_UsrFunc=new QGridLayout;
    Grid_AcDc=new QGridLayout;

    //Group_Main = new QGroupBox("Scope Control");
    Group_Trigger= new QGroupBox("Trigger");
    Group_Offset= new QGroupBox("Offset");
    Group_Scale= new QGroupBox("Scale");
    Group_Other= new QGroupBox("Other");
    Group_UsrFunc=new QGroupBox("Usr Func");
    Group_AcDc=new QGroupBox("AC/DC");

    Button_Stop= new QPushButton("Stop");
    Button_FFT= new QPushButton("Perform FFT");
    Button_Trigger = new QPushButton("Trigger OFF");
    Button_Auto = new QPushButton("Auto");
    Button_Channel = new QPushButton("Set Ch2 ON");

    RadioB_Range1= new QRadioButton("1-1000 ns");
    RadioB_Range2= new QRadioButton("1-1000 us");
    RadioB_Range3= new QRadioButton("1-1000 ms");
    RadioB_Range1->setChecked(true);

    RadioB_AC= new QRadioButton("AC");
    RadioB_DC= new QRadioButton("DC");
    RadioB_AC->setChecked(true);


    CheckBox_F1 = new QCheckBox("Usr F1");
    CheckBox_F2 = new QCheckBox("Usr F2");
    CheckBox_F3 = new QCheckBox("Usr F3");
    CheckBox_F4 = new QCheckBox("Usr F4");
    CheckBox_F5 = new QCheckBox("Usr F5");
    CheckBox_F6 = new QCheckBox("Usr F6");


    Scroll_Knob= new QwtKnob;
    //Scroll_Knob->setTotalAngle(1);
    Scroll_Knob->setNumTurns(30);
    Scroll_Knob->setMarkerStyle(QwtKnob::Tick);
    Scroll_Knob->setScale(0,30000);
    Scroll_Knob->setScaleStepSize(100);
    Scroll_Knob->setTotalSteps(3000);
    Scroll_Knob->setFixedSize(150,150);


    //Trigger
    Slid_V_Trigger = new QSlider(Qt::Vertical);
    Slid_V_Trigger->setMinimum(-350);
    Slid_V_Trigger->setMaximum(350);
    Grid_Trigger->addWidget(Slid_V_Trigger,0,0);

    Group_Trigger->setLayout(Grid_Trigger);


    //Offset
    Slid_V_Offset= new QSlider(Qt::Vertical);
    Slid_V_Offset->setMinimum(-350);
    Slid_V_Offset->setMaximum(350);
    Slid_V_Offset->setTickPosition(QSlider::TicksBothSides);
    Slid_V_Offset->setTickInterval(35);
    Slid_H_Offset= new QSlider(Qt::Horizontal);
    Slid_H_Offset->setMinimum(-350);
    Slid_H_Offset->setMaximum(350);
    //Channel 2
    Slid_V_Offset2= new QSlider(Qt::Vertical);
    Slid_V_Offset2->setMinimum(-350);
    Slid_V_Offset2->setMaximum(350);
    Slid_V_Offset2->setTickPosition(QSlider::TicksBothSides);
    Slid_V_Offset2->setTickInterval(35);
    Slid_V_Offset2->setEnabled(false);



    Grid_Offset->addWidget(new QLabel("Ch1"),0,0);
    Grid_Offset->addWidget(new QLabel("Ch2"),0,1);
    Grid_Offset->addWidget(Slid_V_Offset,1,0);
    Grid_Offset->addWidget(Slid_V_Offset2,1,1);
    Grid_Offset->addWidget(Slid_H_Offset,0,2);
    Grid_Offset->addWidget(Scroll_Knob,1,2);


    Group_Offset->setLayout(Grid_Offset);

    //Scale
    Slid_V_Scale= new QSlider(Qt::Vertical);
    Slid_V_Scale->setMinimum(1);
    Slid_V_Scale->setMaximum(100);
    Slid_V_Scale->setSingleStep(1);
    Slid_H_Scale= new QSlider(Qt::Horizontal);
    Slid_H_Scale->setMinimum(1);
    Slid_H_Scale->setMaximum(1000);
    Slid_H_Scale->setSingleStep(1);
    //channel 2
    Slid_V_Scale2= new QSlider(Qt::Vertical);
    Slid_V_Scale2->setMinimum(1);
    Slid_V_Scale2->setMaximum(100);
    Slid_V_Scale2->setSingleStep(1);
    Slid_V_Scale2->setEnabled(false);


    Grid_Scale->addWidget(new QLabel("Ch1"),0,0);
    Grid_Scale->addWidget(new QLabel("Ch2"),0,1);
    Grid_Scale->addWidget(Slid_V_Scale,1,0);
    Grid_Scale->addWidget(Slid_V_Scale2,1,1);
    Grid_Scale->addWidget(Slid_H_Scale,0,2);


    Grid_Range = new QGridLayout;
    Grid_Range->addWidget(RadioB_Range1,1,0);
    Grid_Range->addWidget(RadioB_Range2,2,0);
    Grid_Range->addWidget(RadioB_Range3,3,0);


    Group_Range= new QGroupBox("Range");
    Group_Range->setLayout(Grid_Range);

    Grid_Scale->addWidget(Group_Range,1,2);

    Group_Scale->setLayout(Grid_Scale);


    Grid_Other->addWidget(Button_Stop,0,1);
    Grid_Other->addWidget(Button_FFT,1,1);
    Grid_Other->addWidget(Button_Trigger,2,1);
    Grid_Other->addWidget(Button_Auto,3,1);
    Grid_Other->addWidget(Button_Channel,4,1);



    Group_Other->setLayout(Grid_Other);

    Grid_UsrFunc->addWidget(CheckBox_F1,0,0);
    Grid_UsrFunc->addWidget(CheckBox_F2,1,0);
    Grid_UsrFunc->addWidget(CheckBox_F3,2,0);
    Grid_UsrFunc->addWidget(CheckBox_F4,3,0);
    Grid_UsrFunc->addWidget(CheckBox_F5,4,0);
    Grid_UsrFunc->addWidget(CheckBox_F6,5,0);


    Group_UsrFunc->setLayout(Grid_UsrFunc);

    Grid_AcDc->addWidget(RadioB_AC,0,0);
    Grid_AcDc->addWidget(RadioB_DC,1,0);

    Group_AcDc->setLayout(Grid_AcDc);

    Grid_Main->addWidget(Group_Trigger,0,0);
    Grid_Main->addWidget(Group_Other,0,1);
    Grid_Main->addWidget(Group_Offset,1,0);
    Grid_Main->addWidget(Group_Scale,1,1);
    Grid_Main->addWidget(Group_UsrFunc,0,2);
    Grid_Main->addWidget(Group_AcDc,1,2);

    setLayout(Grid_Main);

    setFixedSize(500,400);


    connect(RadioB_AC,SIGNAL(clicked()),this,SLOT(slot_ACDCChanged()));
    connect(RadioB_DC,SIGNAL(clicked()),this,SLOT(slot_ACDCChanged()));


    connect(Slid_V_Trigger,SIGNAL(valueChanged(int)),this,SIGNAL(TriggerLevelChanged(int)));
    connect(Slid_V_Offset,SIGNAL(valueChanged(int)),this,SIGNAL(OffsetYChanged(int)));
    connect(Slid_V_Offset2,SIGNAL(valueChanged(int)),this,SIGNAL(OffsetYChanged2(int)));
    connect(Slid_H_Offset,SIGNAL(valueChanged(int)),this,SIGNAL(OffsetXChanged(int)));
    connect(Slid_V_Scale,SIGNAL(valueChanged(int)),this,SIGNAL(ScaleYChanged(int)));
    connect(Slid_V_Scale2,SIGNAL(valueChanged(int)),this,SIGNAL(ScaleYChanged2(int)));
    connect(Slid_H_Scale,SIGNAL(valueChanged(int)),this,SLOT(slot_ScaleXChanged(int)));

    connect(Button_Stop,SIGNAL(clicked()),this,SLOT(slot_StopRunButtonClicked()));
    connect(Button_FFT,SIGNAL(clicked()),this,SIGNAL(PerformFFT()));
    connect(Button_Trigger,SIGNAL(clicked()),this,SLOT(slot_TriggerChange()));


    connect(RadioB_Range1,SIGNAL(clicked()),this,SLOT(slot_RangeChanged()));
    connect(RadioB_Range2,SIGNAL(clicked()),this,SLOT(slot_RangeChanged()));
    connect(RadioB_Range3,SIGNAL(clicked()),this,SLOT(slot_RangeChanged()));


    connect(Slid_H_Offset,SIGNAL(valueChanged(int)),this,SLOT(slot_KnobNewValue(int)));
    connect(Scroll_Knob,SIGNAL(sliderMoved(double)),this,SLOT(slot_KnobChanged(double)));

    connect(Button_Auto,SIGNAL(clicked()),this,SIGNAL(AutoScale()));

    connect(Button_Channel,SIGNAL(clicked()),this,SLOT(slot_ChannelChanged()));

    connect(CheckBox_F1,SIGNAL(stateChanged(int)),this,SLOT(slot_FX_Changed(int)));
    connect(CheckBox_F2,SIGNAL(stateChanged(int)),this,SLOT(slot_FX_Changed(int)));
    connect(CheckBox_F3,SIGNAL(stateChanged(int)),this,SLOT(slot_FX_Changed(int)));
    connect(CheckBox_F4,SIGNAL(stateChanged(int)),this,SLOT(slot_FX_Changed(int)));
    connect(CheckBox_F5,SIGNAL(stateChanged(int)),this,SLOT(slot_FX_Changed(int)));
    connect(CheckBox_F6,SIGNAL(stateChanged(int)),this,SLOT(slot_FX_Changed(int)));
}