Changeset 82 for tools


Ignore:
Timestamp:
07/07/09 16:00:56 (15 years ago)
Author:
ogrimm
Message:
Slight GUI improvements
Location:
tools/ddd
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • tools/ddd/Functions.cpp

    r81 r82  
    1919void ddd::OpenDatafile() {
    2020 
     21  if(Socket->state() == QAbstractSocket::ConnectedState) { // do not execute if socket is open
     22    MakeConnection();
     23  }
     24
    2125  CloseDatafile();      // Close previous file if open
    2226
    2327  // Write run header to temporary file 
     28  ftruncate(fileno(Tmpfile),0);
    2429  rewind(Tmpfile);
    2530  switch (RD->OpenDataFile(FilenameBox->text().toAscii().data(), Tmpfile)) {
     
    5156  M0Start->setEnabled(true);
    5257  M0Stop->setEnabled(true);
    53   EventNo->setValue(1);
    5458  EventNo->setRange(1, RD->RHeader->Events);
    55   M0Start->setValue(0);
    56   M0Stop->setValue((RD->RHeader->Samples)-1);
    5759  M0Start->setRange(0,(RD->RHeader->Samples)-1); 
    5860  M0Stop->setRange(0,(RD->RHeader->Samples)-1);
    59   ChannelNo->setValue(0);
    6061  ChannelNo->setRange(0, RD->RHeader->NChannels*RD->RHeader->NChips-1);
    61   BoardNo->setValue(0);
    6262  BoardNo->setRange(0, RD->RHeader->NBoards-1);
    6363  DisplayEvent();
     
    8686 
    8787  // Read event
     88  ftruncate(fileno(Tmpfile),0);
    8889  rewind(Tmpfile);
    8990  if (RD->ReadEvent(EventNo->value(), Tmpfile) != CTX_OK) {
     
    251252      ManualDisconnect = false;
    252253
    253       OpenAction->setEnabled(false);     
    254       FilenameBox->setEnabled(false);
    255       LoadButton->setEnabled(false);
    256254      FilenameBox->clear();
    257255      CloseDatafile();
     
    330328}
    331329
     330// +++ Reset graph axes to autoscale when fully unzoomed +++
     331void ddd::HandleZoom(const QwtDoubleRect &) {
     332  if(Zoomer->zoomRectIndex() == 0) {
     333    Graph->setAxisAutoScale(QwtPlot::xBottom);
     334    Graph->setAxisAutoScale(QwtPlot::yLeft);
     335  }
     336}
     337
    332338// +++ Disconnect from socket +++
    333339void ddd::GotDisconnected() {
     
    339345
    340346  GetButton->setEnabled(false);
    341   FilenameBox->setEnabled(true);
    342   OpenAction->setEnabled(true);   
    343   LoadButton->setEnabled(true);
    344347  ChannelNo->setEnabled(false);
    345348  BoardNo->setEnabled(false);
     
    402405     "1. Reading and displaying the content of a raw data file written by the drsdaq program\n"
    403406     "2. Acquiring and displaying online data from a running drsdaq program via the socket interface\n\n"
    404      "With an established socket connection, displaying of raw data files is disabled.");
     407     "With an established socket connection, displaying of raw data files is disabled.\n\n"
     408     "Navigation in signal display: Left mouse button to zoom, right to unzoom fully, middle to unzoom one level. Left mouse button plus shift key to pan.\n"
     409     "When unzoomed, the axes are rescaled automatically.");
     410
    405411   Message.setWindowTitle("ddd Help");
    406412   Message.exec();
     
    410416  QMessageBox::about(this, "ddd About","DRS Data Display\n\n"
    411417    "Written by Oliver Grimm, IPP, ETH Zurich\n"
     418    "Event display by Quirin Weitzel.\n\n"
    412419    "This version compiled "__DATE__".\n\n"
    413420    "Graphical user interface implemented with Qt.\n"
  • tools/ddd/GUI.cpp

    r81 r82  
    102102  Graph->setAutoReplot(true);
    103103  Graph->setCanvasBackground(QColor(Qt::yellow));
    104   Graph->setToolTip("Left mouse button to zoom (+Shift to pan)");
    105104  Zoomer = new QwtPlotZoomer(QwtPlot::xBottom,QwtPlot::yLeft,Graph->canvas());
     105  connect(Zoomer, SIGNAL(zoomed(const QwtDoubleRect &)), this, SLOT(HandleZoom(const QwtDoubleRect &)));
    106106  Panner = new QwtPlotPanner(Graph->canvas());
    107107  Panner->setMouseButton(Qt::LeftButton, Qt::ShiftModifier);
     
    112112  Signal->attach(Graph);
    113113  Signal->setStyle(QwtPlotCurve::Steps);
    114 
    115   AutoscaleBox = new QCheckBox("Autoscale", Central);
    116   AutoscaleBox->setFont(QFont("Times", 10, QFont::Bold));
    117   AutoscaleBox->setToolTip("Scale axes automatically");
    118 
    119   GraphLayout = new QVBoxLayout;
    120   GraphLayout->addWidget(Graph);
    121   GraphLayout->addWidget(AutoscaleBox);
    122114
    123115  // Text boxes for run and event header
     
    246238  M0Stop = new QSpinBox(M0Window);
    247239  M0Stop->setEnabled(false);
     240  M0Stop->setRange(0,1023);
     241  M0Stop->setValue(1023);
    248242  connect(M0Stop, SIGNAL(valueChanged(int)), this, SLOT(DisplayEvent(int)));
    249243  M0Stop->setToolTip("Last bin/sample of time window");
  • tools/ddd/GUI.h

    r81 r82  
    2929
    3030    QPushButton *GetButton, *SocketButton, *Connect, *M0Display;
    31     QCheckBox *ContinuousBox, *AutoscaleBox;
     31    QCheckBox *ContinuousBox;
    3232    QToolButton *LoadButton;
    3333    QLineEdit *FilenameBox, *IPAddress, *Command, *PixelID;
     
    3939    QAction *OpenAction, *ConnectAction;
    4040    QGridLayout *SocketLayout, *MainLayout, *M0Layout;
    41     QVBoxLayout *GraphLayout;
    4241    QFormLayout *CommandLayout, *PortLayout, *AddressLayout, *FormLayout, *SpinLayout, *M0StartLayout, *M0StopLayout;
    4342   
     
    7372    void ReadFromSocket();
    7473    void GotDisconnected();
     74    void HandleZoom(const QwtDoubleRect &);
    7575    void TranslatePixelID();
    7676   
Note: See TracChangeset for help on using the changeset viewer.