Legend:
- Unmodified
- Added
- Removed
-
tools/ddd/Functions.cpp
r109 r129 56 56 M0Start->setEnabled(true); 57 57 M0Stop->setEnabled(true); 58 PhysPipeAction->setEnabled(true); 58 59 EventNo->setRange(1, RD->RHeader->Events); 59 60 M0Start->setRange(0,(RD->RHeader->Samples)-1); … … 73 74 M0Start->setEnabled(false); 74 75 M0Stop->setEnabled(false); 76 PhysPipeAction->setEnabled(false); 75 77 RunHeaderDisplay->clear(); 76 78 EventHeaderDisplay->clear(); … … 85 87 if(Socket->state() == QAbstractSocket::ConnectedState) return; // do not execute if socket is open 86 88 89 if (PhysPipeAction->isChecked()) { 90 Graph->setAxisTitle(QwtPlot::xBottom, "Time from start of physical pipeline (ns)"); 91 } 92 else { 93 Graph->setAxisTitle(QwtPlot::xBottom, "Time from trigger (ns)"); 94 } 95 87 96 // Read event 88 97 ftruncate(fileno(Tmpfile),0); … … 112 121 for (unsigned int i=0; i<RD->RHeader->Samples; i++) { 113 122 x[i] = (double) (i/RD->BStruct[BoardNo->value()].NomFreq); 114 y[i] = (double) *((short *) (RD->Data + RD->RHeader->NBoards*RD->RHeader->NChips*sizeof(int)) + BoardNo->value()*RD->RHeader->NChips*RD->RHeader->NChannels * 115 RD->RHeader->Samples+ChannelNo->value()*RD->RHeader->Samples+i)*RD->BStruct[BoardNo->value()].ScaleFactor; 123 if (PhysPipeAction->isChecked()) { 124 y[(i + *((int *) RD->Data + BoardNo->value()*RD->RHeader->NChips+ChannelNo->value()/RD->RHeader->NChannels))%1024] = (double) *((short *) (RD->Data + RD->RHeader->NBoards*RD->RHeader->NChips*sizeof(int)) + BoardNo->value()*RD->RHeader->NChips*RD->RHeader->NChannels * RD->RHeader->Samples + ChannelNo->value()*RD->RHeader->Samples + i)*RD->BStruct[BoardNo->value()].ScaleFactor; 125 } 126 else { 127 y[i] = (double) *((short *) (RD->Data + RD->RHeader->NBoards*RD->RHeader->NChips*sizeof(int)) + BoardNo->value()*RD->RHeader->NChips*RD->RHeader->NChannels * RD->RHeader->Samples+ChannelNo->value()*RD->RHeader->Samples+(i))*RD->BStruct[BoardNo->value()].ScaleFactor; 128 } 116 129 } 117 130 … … 236 249 else { 237 250 if (RD->IsFileOpen() && QMessageBox::question(this, "ddd Request","Connecting will close current data file. Proceed?", 238 QMessageBox::No, QMessageBox::Yes) != QMessageBox::Yes) return; 251 QMessageBox::No, QMessageBox::Yes) != QMessageBox::Yes) return; 252 253 PhysPipeAction->setChecked(false); 254 239 255 Socket->connectToHost(IPAddress->text(),Port->value()); 240 256 Connect->setEnabled(false); // While waiting for connection, button not available … … 314 330 Signal->show(); 315 331 Zoomer->setZoomBase(Signal->boundingRect()); 332 Graph->setAxisTitle(QwtPlot::xBottom, "Time from trigger (ns)"); 316 333 } 317 334 delete[] x; delete[] y; … … 400 417 } 401 418 419 void ddd::MenuSaveASCII() { 420 QString Filename = QFileDialog::getSaveFileName(this, 421 "Filename", ".", "Text files (*.txt *.ascii *.asc);;All files (*)"); 422 if (Filename.length()>0) { 423 QFile File(Filename); 424 if (File.open(QFile::WriteOnly | QIODevice::Text | QFile::Truncate)) { 425 QTextStream Stream(&File); 426 for (int i=0; i<Signal->dataSize(); i++) { 427 Stream << Signal->y(i) << endl; 428 } 429 } 430 else { 431 QMessageBox::warning(this, "ddd Message","Could not write data to file.",QMessageBox::Ok); 432 } 433 } 434 } 435 402 436 void ddd::MenuHelp() { 403 437 QMessageBox Message; -
tools/ddd/GUI.cpp
r82 r129 98 98 // Plot area 99 99 Graph = new QwtPlot(Central); 100 Graph->setAxisTitle(QwtPlot::xBottom, "Time (ns)");101 100 Graph->setAxisTitle(QwtPlot::yLeft, "Signal (mV)"); 102 101 Graph->setAutoReplot(true); … … 157 156 SaveAction->setShortcut(Qt::CTRL + Qt::Key_S); 158 157 Menu->addAction("Print plot", this, SLOT(MenuPrint())); 158 Menu->addAction("Save waveform to ASCII", this, SLOT(MenuSaveASCII())); 159 Menu->addSeparator(); 160 PhysPipeAction = Menu->addAction("Plot physical pipeline", this, SLOT(DisplayEvent())); 161 PhysPipeAction->setCheckable(true); 162 PhysPipeAction->setEnabled(false); 159 163 Menu->addSeparator(); 160 164 ConnectAction = Menu->addAction("Connect", this, SLOT(MakeConnection())); -
tools/ddd/GUI.h
r82 r129 37 37 QTcpSocket *Socket; 38 38 QWidget *SocketWindow, *Central, *M0Window; 39 QAction *OpenAction, *ConnectAction ;39 QAction *OpenAction, *ConnectAction, *PhysPipeAction; 40 40 QGridLayout *SocketLayout, *MainLayout, *M0Layout; 41 41 QFormLayout *CommandLayout, *PortLayout, *AddressLayout, *FormLayout, *SpinLayout, *M0StartLayout, *M0StopLayout; … … 77 77 void MenuSave(); 78 78 void MenuPrint(); 79 void MenuSaveASCII(); 79 80 void MenuHelp(); 80 81 void MenuAbout();
Note:
See TracChangeset
for help on using the changeset viewer.