示例#1
0
//========================================================================
int main( ) {


    ofGLFWWindowSettings settings;

    settings.width = 700;
    settings.height = 800;
    settings.setPosition(ofVec2f(0,0));
    settings.resizable = false;
    shared_ptr<ofAppBaseWindow> guiWindow = ofCreateWindow(settings);

    settings.width = 1280;  // 1920
    settings.height = 720;  // 1080
    settings.resizable = true;
    settings.setPosition( ofVec2f(1440, 0 ));
//    settings.windowMode = OF_FULLSCREEN;
    shared_ptr<ofAppBaseWindow> mainWindow = ofCreateWindow(settings);

    shared_ptr<GuiApp> guiApp(new GuiApp);
    shared_ptr<ofApp> mainApp(new ofApp);
    mainApp->gui = guiApp;

    ofRunApp(mainWindow, mainApp);
    ofRunApp(guiWindow, guiApp);
    ofRunMainLoop();


}
示例#2
0
//========================================================================
int main( ){
	ofGLFWWindowSettings settings;

	settings.width = 600;
	settings.height = 600;
	settings.setPosition(ofVec2f(300,0));
	settings.resizable = true;
	settings.numSamples = 8;
	shared_ptr<ofAppBaseWindow> mainWindow = ofCreateWindow(settings);

	settings.width = 300;
	settings.height = 300;
	settings.setPosition(ofVec2f(0,0));
	settings.resizable = false;
	settings.numSamples = 4;
	settings.shareContextWith = mainWindow;
	shared_ptr<ofAppBaseWindow> guiWindow = ofCreateWindow(settings);

	shared_ptr<ofApp> mainApp(new ofApp);
	shared_ptr<GuiApp> guiApp(new GuiApp);

	mainApp->gui = guiApp;
	mainApp->window = mainWindow;
	mainApp->gl = dynamic_pointer_cast<ofBaseGLRenderer>(mainWindow->renderer());

	ofRunApp(guiWindow, guiApp);
	ofRunApp(mainWindow, mainApp);
	ofRunMainLoop();

}
示例#3
0
Bug_Popout::Bug_Popout(DAQ::BugTask *task, QWidget *parent)
    : QWidget(parent), task(task), p(task->bugParams()), ap(task->allParams()), avgPower(0.0), nAvg(0), logBER(0.0), mut(QMutex::Recursive)
{
    hasMeta = false;

	ui = new Ui::Bug_Popout;
	ui->setupUi(this);	
	
	setupGraphs();
	
	if (p.hpf > 0) { ui->hpfChk->setChecked(true); ui->hpfSB->setValue(p.hpf); } else { ui->hpfChk->setChecked(false); }
	ui->snfChk->setChecked(p.snf);
	ui->statusLabel->setText("Startup...");
	
	Connect(ui->snfChk, SIGNAL(toggled(bool)), this, SLOT(filterSettingsChanged()));
	Connect(ui->hpfChk, SIGNAL(toggled(bool)), this, SLOT(filterSettingsChanged()));
    Connect(ui->hpfSB, SIGNAL(valueChanged(int)), this, SLOT(filterSettingsChanged()));
	
    setupAOPassThru();

	mainApp()->sortGraphsByElectrodeAct->setEnabled(false);
	
	lastStatusT = getTime();
	lastStatusBlock = -1;
	lastRate = 0.;

    QTimer *t = new QTimer(this);
    t->setInterval(250);
    t->setSingleShot(false);
    Connect(t, SIGNAL(timeout()), this, SLOT(updateDisplay()));
    t->start();

    plotThread = new Bug_MetaPlotThread(this,task->samplingRate(),task->pagedWriter());
    plotThread->start(QThread::LowPriority);
}
示例#4
0
文件: main.cpp 项目: nasymt/oscTester
//========================================================================
int main( ){
    //	ofSetupOpenGL(500,250,OF_WINDOW);			// <-------- setup the GL context
    //
    //	// this kicks off the running of my app
    //	// can be OF_WINDOW or OF_FULLSCREEN
    //	// pass in width and height too:
    //	ofRunApp(new ofApp());
    
    ofGLFWWindowSettings settings;
    settings.width = 500;
    settings.height = 250;
    settings.setPosition(ofVec2f(300,0));
    settings.resizable = true;
    shared_ptr<ofAppBaseWindow> mainWindow = ofCreateWindow(settings);
    
    settings.width = 300;
    settings.height = 300;
    settings.setPosition(ofVec2f(0,0));
    settings.resizable = false;
    // uncomment next line to share main's OpenGL resources with gui
    //settings.shareContextWith = mainWindow;
    shared_ptr<ofAppBaseWindow> guiWindow = ofCreateWindow(settings);
    guiWindow->setVerticalSync(false);
    
    shared_ptr<ofApp> mainApp(new ofApp);
    mainApp->setupMonitor();
    ofAddListener(guiWindow->events().draw,mainApp.get(),&ofApp::drawMonitor);
    
    ofRunApp(mainWindow, mainApp);
    ofRunMainLoop();
    
}
示例#5
0
void CimAcqImec::SETLBL( const QString &s )
{
    QMetaObject::invokeMethod(
        mainApp(), "runInitSetLabel",
        Qt::QueuedConnection,
        Q_ARG(QString, s) );
}
示例#6
0
//========================================================================
int main( ){
	ofGLFWWindowSettings settings;
	settings.width = 600;
	settings.height = 600;
	settings.setPosition(ofVec2f(300,0));
	settings.resizable = true;
	shared_ptr<ofAppBaseWindow> mainWindow = ofCreateWindow(settings);

	settings.width = 300;
	settings.height = 300;
	settings.setPosition(ofVec2f(0,0));
	settings.resizable = false;
	// uncomment next line to share main's OpenGL resources with gui
	//settings.shareContextWith = mainWindow;	
	shared_ptr<ofAppBaseWindow> guiWindow = ofCreateWindow(settings);
	guiWindow->setVerticalSync(false);

	shared_ptr<ofApp> mainApp(new ofApp);
	mainApp->setupGui();
	ofAddListener(guiWindow->events().draw,mainApp.get(),&ofApp::drawGui);

	ofRunApp(mainWindow, mainApp);
	ofRunMainLoop();

}
示例#7
0
文件: Util.cpp 项目: cculianu/SpikeGL
/// public global function.  I hate globals but necessary I guess
int getTaskReadFreqHz() 
{
	MainApp *app = mainApp();
	ConfigureDialogController *cfgctl = 0;
	if ( app 
		&& (cfgctl = app->configureDialogController())
		&& cfgctl->acceptedParams.lowLatency ){
		return DEF_TASK_READ_FREQ_HZ_*3;
	}
	return DEF_TASK_READ_FREQ_HZ_;
}
示例#8
0
void CmdSrvDlg::okBut()
{
    CmdSrvParams    pSave = p;

    p.iface         = cmdUI->ipLE->text();
    p.port          = cmdUI->portSB->value();
    p.timeout_ms    = cmdUI->toSB->value();
    p.enabled       = cmdUI->enabledGB->isChecked();

    if( startServer() ) {
        mainApp()->saveSettings();
        dynamic_cast<QDialog*>(cmdUI->buttonBox->parent())->accept();
    }
    else
        p = pSave;
}
示例#9
0
int main( ) {
#ifdef TARGET_OSX
    //this allows to embed all the data folder inside the app bundle.
    string newRoot = "../Resources/data/";
    ofEnableDataPath();
    ofSetDataPathRoot(newRoot);
#endif

    ofSetupOpenGL(1024,768,OF_WINDOW);

    shared_ptr<mainAppController> mainApp (new mainAppController);
    shared_ptr<BYBGui> gui (new BYBGui);
    mainApp->gui = gui;
    gui->controllerPtr = mainApp;

    ofDirectory dir;
    dir.allowExt("ttf");
    dir.allowExt("otf");
    dir.listDir("fonts");
    for (int i = 0; i < dir.size(); i++ ) {
        ofTrueTypeFont f;
        if(f.load(dir.getPath(i),12, true, true)) {
            gui->fonts[ofFilePath::removeExt(dir.getName(i))] = f;
            cout << "added Font: " << ofFilePath::removeExt(dir.getName(i)) << endl;
        }
        if(f.load(dir.getPath(i),25, true, true)) {
            gui->fonts[ofFilePath::removeExt(dir.getName(i)) + "_25"] = f;
        }
    }

    try {
        ofRunApp(mainApp);
    } catch(exception& e) {
        cout << e.what() << '\n';
    }
    catch (int param) {
        cout << "int exception";
    }
    catch (char param) {
        cout << "char exception";
    }
    catch (...) {
        cout << "default exception";
    }
}
示例#10
0
//========================================================================
int main( ){

//	ofInit();

	ofGLFWWindowSettings settings;

	settings.setSize(600, 600);
	settings.setPosition(ofVec2f(400, 40));
	settings.resizable = true;
	settings.numSamples = 8;
	ofMainLoop mainLoop;
	auto mainWindow = mainLoop.createWindow(settings);

	shared_ptr<ofApp> mainApp(new ofApp);
	mainApp->window = mainWindow;
	mainApp->gl = static_pointer_cast<ofGLRenderer>(mainWindow->renderer());
	mainLoop.run(mainWindow, mainApp);

	//-------------------------------

	settings.setSize(300, 300);
	settings.setPosition(ofVec2f(100, 40));
	settings.resizable = true;
	settings.numSamples = 8;
	ofMainLoop guiLoop;
	auto guiWindow = guiLoop.createWindow(settings);

	shared_ptr<GuiApp> guiApp(new GuiApp);
	guiApp->window = guiWindow;
	guiApp->gl = static_pointer_cast<ofGLRenderer>(guiWindow->renderer());
	guiLoop.run(guiWindow, guiApp);

	//-------------------------------

	while (!mainWindow->getWindowShouldClose()) {
		guiLoop.loopOnce();
		ofAppGLFWWindow::pollEvents();
		mainLoop.loopOnce();
		ofAppGLFWWindow::pollEvents();
	}
}
示例#11
0
void Bug_Popout::updateDisplay()
{
    QMutexLocker l(&mut);

    if (hasMeta) { // last iteration, update the labels with the "most recent" info
        const DAQ::BugTask::BlockMetaData & meta(lastMeta);

        ui->chipIdLbl->setText(QString::number(meta.chipID[DAQ::BugTask::FramesPerBlock-1]));
        ui->dataFoundLbl->setText(QString::number((meta.blockNum+1)*DAQ::BugTask::FramesPerBlock - (meta.missingFrameCount+meta.falseFrameCount)));
        ui->missingLbl->setText(QString::number(meta.missingFrameCount));
        ui->falseLbl->setText(QString::number(meta.falseFrameCount));
        ui->recVolLbl->setText(QString::number(avgPower,'f',3));
        ui->berLbl->setText(QString::number(logBER,'3',4));
        const quint64 samplesPerBlock = task->usbDataBlockSizeSamps();
        const double now = getTime(), diff = now - lastStatusT;
        if (diff >= 1.0) {
            lastRate = ((meta.blockNum-lastStatusBlock) * samplesPerBlock)/diff;
            lastStatusT = now;
            lastStatusBlock = meta.blockNum;
        }
        QString statusTxt = QString("Read %1 USB blocks (%2 MS) - %3 KS/sec").arg(meta.blockNum+1).arg((meta.blockNum*samplesPerBlock)/1e6,3,'f',2).arg(lastRate/1e3);
#ifdef Q_OS_WIN
        if (mainApp()->isDebugMode()) {
            // DEBUG MODE ONLY: show in status bar the delay/lag information from bug3 subprocess to here!
            u64 now = getAbsTimeNS();
            QString s;
            QTextStream ts(&s);
            ts << statusTxt << " -"
             /*<< " blk# " << meta.blockNum*/
               << " usb_lag: " << (double(qint64(now)-qint64(meta.creation_absTimeNS))/1e9) << "s"
               << " com_lag: " << (double(qint64(now)-qint64(meta.comm_absTimeNS))/1e9) << "s";
            ts.flush();
            statusTxt = s;
        }
#endif
        ui->statusLabel->setText(statusTxt);
        errgraph->update();
        vgraph->update();
    }
}
示例#12
0
void CmdSrvDlg::showStartupMessage()
{
    if( cmdServer || !p.enabled )
        return;

    int but = QMessageBox::critical(
        0,
        "CmdSrv Listen Error",
        QString(
        "Command server could not listen on (%1:%2).\n\n"
        "You can ignore this for now and select different settings\n"
        "later using the Options menu.\n\n"
        "(If mouse not working, actuate these buttons with keyboard.)"
        "            ")
        .arg( p.iface )
        .arg( p.port ),
        QMessageBox::Abort,
        QMessageBox::Ignore );

    if( but == QMessageBox::Abort )
        QMetaObject::invokeMethod( mainApp(), "quit", Qt::QueuedConnection );
}
示例#13
0
//========================================================================
int main( ){

//	ofGLWindowSettings settings;
//	settings.setGLVersion(3,2);
//	ofCreateWindow(settings);
    
    //classic
//    ofSetupOpenGL(1024, 576, OF_WINDOW);
//	ofRunApp(new ofApp());

    
    
    
    //multi
    ofGLFWWindowSettings settings;
    
    //mainWindow
    settings.width = 1024;
    settings.height = 512;
    settings.setPosition(ofVec2f(300,0));
    settings.resizable = true;
    shared_ptr<ofAppBaseWindow> mainWindow = ofCreateWindow(settings);
    
    //timelineWindow
    settings.width = 576;
    settings.height = 750;
    settings.setPosition(ofVec2f(0,0));
    settings.resizable = false;
    shared_ptr<ofAppBaseWindow> timelineWindow = ofCreateWindow(settings);
    
    shared_ptr<ofApp> mainApp(new ofApp);
    shared_ptr<TimelineApp> timelineApp(new TimelineApp);
    mainApp->timelineApp = timelineApp;
    
    ofRunApp(timelineWindow, timelineApp);
    ofRunApp(mainWindow, mainApp);
    ofRunMainLoop();

}
示例#14
0
//========================================================================
int main( ){
	ofGLFWWindowSettings settings;

    settings.setSize(600, 600);
	settings.setPosition(ofVec2f(300,0));
	settings.resizable = true;
	shared_ptr<ofAppBaseWindow> mainWindow = ofCreateWindow(settings);

    settings.setSize(300, 300);
	settings.setPosition(ofVec2f(0,0));
	settings.resizable = false;
	shared_ptr<ofAppBaseWindow> guiWindow = ofCreateWindow(settings);

	shared_ptr<ofApp> mainApp(new ofApp);
	shared_ptr<GuiApp> guiApp(new GuiApp);
	mainApp->gui = guiApp;

	ofRunApp(guiWindow, guiApp);
	ofRunApp(mainWindow, mainApp);
	ofRunMainLoop();

}
示例#15
0
bool CmdSrvDlg::startServer( bool isAppStartup )
{
    if( cmdServer ) {
        delete cmdServer;
        cmdServer = 0;
    }

    if( p.enabled ) {

        MainApp *app = mainApp();

        cmdServer = new CmdServer( app );

        if( !cmdServer->beginListening( p.iface, p.port, p.timeout_ms ) ) {

            if( !isAppStartup ) {

                QMessageBox::critical(
                    0,
                    "CmdSrv Listen Error",
                    QString(
                    "Command server could not listen on (%1:%2).")
                    .arg( p.iface )
                    .arg( p.port ) );
            }

            Error() << "Failed starting command server.";
            delete cmdServer;
            cmdServer = 0;
            return false;
        }
    }
    else
        Log() << "CmdSrv currently disabled.";

    return true;
}
示例#16
0
//========================================================================
int main( ) {
//	ofSetupOpenGL(1024,768,OF_WINDOW);			// <-------- setup the GL context

    // this kicks off the running of my app
    // can be OF_WINDOW or OF_FULLSCREEN
    // pass in width and height too:
//	ofRunApp(new ofApp());
    ofGLFWWindowSettings settings;
    settings.width = 1280;
    settings.height = 768;
    settings.setPosition(ofVec2f(0,0));
    settings.resizable = true;
    settings.title = "Main";
    shared_ptr<ofAppBaseWindow> mainWindow = ofCreateWindow(settings);

    settings.width = 800;
    settings.height = 600;
    settings.setPosition(ofVec2f(-800,0));
    settings.title = "Proj";
    settings.resizable = false;
    settings.decorated = false;
    settings.shareContextWith = mainWindow;
    // uncomment next line to share main's OpenGL resources with gui
    //settings.shareContextWith = mainWindow;
    shared_ptr<ofAppBaseWindow> projWindow = ofCreateWindow(settings);
    projWindow->setVerticalSync(false);

    shared_ptr<ofApp> mainApp(new ofApp);
//	mainApp->setupGui();
    ofAddListener(projWindow->events().draw,mainApp.get(),&ofApp::drawProj);
    mainApp->projWindow = projWindow;

    ofRunApp(mainWindow, mainApp);
    ofRunMainLoop();

}
示例#17
0
void Main_Msg::initMessenger( ConsoleWindow *cw )
{
    MainApp *app = mainApp();

// -----------
// Console log
// -----------

    this->cw    = cw;
    defLogColor = cw->textEdit()->textColor();

// -----------
// System tray
// -----------

    QMenu   *m = new QMenu( cw );
    m->addAction( app->act.shwHidConsAct );
    m->addAction( app->act.shwHidGrfsAct );
    m->addSeparator();
    m->addAction( app->act.aboutAct );
    m->addSeparator();
    m->addAction( app->act.quitAct );

    sysTray = new QSystemTrayIcon( this );
    sysTray->setContextMenu( m );
    sysTray->setIcon( app->windowIcon() );
    sysTray->show();

// ----------
// Status bar
// ----------

    QTimer *timer = new QTimer( this );
    ConnectUI( timer, SIGNAL(timeout()), this, SLOT(timedStatusBarUpdate()) );
    timer->start( 500 );
}
示例#18
0
//========================================================================
int main( ){

	ofSetLogLevel(OF_LOG_VERBOSE);
	
#ifdef TARGET_OPENGLES
	ofLogVerbose("enigmatikViewer") << "Running in rpi mode using OPENGL " << glGetString(GL_VERSION) << endl;
	// useful for later? http://ofxfenster.undef.ch/doc/structofAppEGLWindow_1_1Settings.html
	
	//ofSetCurrentRenderer(ofPtr<ofBaseRenderer>(new ofGLProgrammableRenderer()));
	//ofSetCurrentRenderer(ofGLProgrammableRenderer::TYPE);
	
	//ofAppEGLWindow::Settings settings;
	//settings.eglWindowOpacity = 127;
	//settings.frameBufferAttributes[EGL_DEPTH_SIZE]   = 0; // 0 bits for depth
	//settings.frameBufferAttributes[EGL_STENCIL_SIZE] = 0; // 0 bits for stencil
	//ofAppEGLWindow window(settings);
	//ofSetupOpenGL( 800,600, OF_WINDOW);
	// car rearview screen resolution: 320*240
	
	ofGLESWindowSettings windowSettings;
	windowSettings.width =320;
	windowSettings.height = 240;
	windowSettings.setGLESVersion(2);
	shared_ptr<ofAppBaseWindow> window = ofCreateWindow(windowSettings);
	
	// configure renderer
	//shared_ptr<ofBaseRenderer> renderer = new ofGLProgrammableRenderer(window.get());
	//renderer->setBackgroundAuto(false);
	//renderer->enableAntiAliasing();
	//ofSetCurrentRenderer(renderer);
	
#else
	
	//ofSetCurrentRenderer(ofGLProgrammableRenderer::TYPE);
	//ofAppGLFWWindow window;
	//ofSetupOpenGL(&window, 800,600, OF_WINDOW);// <-------- setup the GL context
	
	//ofPtr<ofBaseRenderer> renderer( new ofGLProgrammableRenderer(OF_WINDOW) );
	//renderer->setBackgroundAuto(false);
	//renderer->disableAntiAliasing();
	//ofSetCurrentRenderer(ofGLProgrammableRenderer::TYPE);
	
	#ifdef USE_PROGRAMMABLE_GL
		// we are using the programmable gl renderer.
	
		ofGLESWindowSettings windowSettings;
		//ofGLWindowSettings windowSettings;
		//ofGLFWWindowSettings windowSettings;
		windowSettings.width = 800;
		windowSettings.height = 600;
	
		windowSettings.setGLESVersion(2);
		//windowSettings.setGLVersion(3, 2);
		shared_ptr<ofAppBaseWindow> window = ofCreateWindow(windowSettings);
	
		// configure renderer
		ofGLProgrammableRenderer * renderer = new ofGLProgrammableRenderer( window.get() );
		renderer->setBackgroundAuto(false);
		renderer->enableAntiAliasing();
		ofSetCurrentRenderer(shared_ptr<ofBaseRenderer>((ofBaseRenderer*) renderer));
	
		ofLogVerbose("enigmatikViewer") << "Running in desktop mode using PROGRAMMABLE_GL " << glGetString(GL_VERSION) << endl;
	#else
	
		//ofGLESWindowSettings windowSettings;
		ofGLWindowSettings windowSettings;
		//ofGLFWWindowSettings windowSettings;
		windowSettings.width = 800;
		windowSettings.height = 600;
	
		windowSettings.setGLVersion(4, 1);
		shared_ptr<ofAppBaseWindow> window = ofCreateWindow(windowSettings);
		//ofDisableArbTex();
	#endif
	
#endif
	
	ofSetVerticalSync(false);
	ofEnableAlphaBlending(); // otherwise alpha channel is ignored by GL
	ofSetBackgroundColor(0,255,255,.5f);//ofColor(255,255,255,255));
	ofSetBackgroundAuto(false); // tmp
	
	shared_ptr<enigmatikViewer> mainApp(new enigmatikViewer );
	ofRunApp(window, mainApp);
	ofRunMainLoop();
}
示例#19
0
int main(int argc, char *argv[])
{
	qDebug() << "main";
	return mainApp(argc, argv);
}
示例#20
0
/// threadsafe
bool DataFile::openForWrite(const DAQ::Params & dp, const QString & filename_override) 
{
    QMutexLocker ml(&mut);

	const int nOnChans = dp.demuxedBitMap.count(true);
    if (!dp.aiChannels.size() || !nOnChans) {
        Error() << "DataFile::openForWrite Error cannot open a datafile with scansize of 0!";
        return false;
    }
    if (isOpen()) closeAndFinalize();

    QString outputFile = filename_override.length() ? filename_override : dp.outputFile;

    if (!QFileInfo(outputFile).isAbsolute())
        outputFile = mainApp()->outputDirectory() + "/" + outputFile; 
    
    Debug() << "outdir: " << mainApp()->outputDirectory() << " outfile: " << outputFile;
    
	dataFile.close();  metaFile.close();
    dataFile.setFileName(outputFile);
    metaFile.setFileName(metaFileForFileName(outputFile));

    if (!dataFile.open(QIODevice::WriteOnly|QIODevice::Truncate) ||
        !metaFile.open(QIODevice::WriteOnly|QIODevice::Truncate)) {
        Error() << "Failed to open either one or both of the data and meta files for " << outputFile;
        return false;
    }
    sha.Reset();
    params = Params();
    badData.clear();
    scanCt = 0;
    nChans = nOnChans;
    sRate = dp.srate;
    writeRateAvg = 0.;
    nWritesAvg = 0;
    nWritesAvgMax = /*unsigned(sRate/10.)*/10;
    if (!nWritesAvgMax) nWritesAvgMax = 1;
    params["outputFile"] = outputFile;
    params["dev"] = dp.dev;
	if (dp.dualDevMode) {
		params["dev2"] = dp.dev2;
		params["dualDevMode"] = true;
		params["secondDevIsAuxOnly"] = dp.secondDevIsAuxOnly;
	}
    params["devProductName"] = DAQ::GetProductName(dp.dev);
    params["nChans"] = nChans;
    params["sRateHz"] = sRate;
	range = dp.range;
	customRanges.clear();
	if (dp.customRanges.size()) {
		QString s = "";
		DAQ::Range r(1e9,-1e9);
		for (int i = 0; i < dp.customRanges.size(); ++i) {
			if (dp.demuxedBitMap[i]) {
				if (s.length()) s.append(",");
				const DAQ::Range & cr(dp.customRanges[i]);
				customRanges.push_back(cr);
				if (r.min > cr.min) r.min = cr.min;
				if (r.max < cr.max) r.max = cr.max;
				s.append(QString("%1:%2").arg(cr.min,0,'f',9).arg(cr.max,0,'f',9));
			}
		}
		params["customRanges"] = s;
		params["rangeMin"] = r.min;
		params["rangeMax"] = r.max;
	} else {
		params["rangeMin"] = range.min;
		params["rangeMax"] = range.max;
	}
    params["acqMode"] = DAQ::ModeToString(dp.mode);
    params["extClock"] = dp.extClock;
    params["aiString"] = dp.aiString;
    params["fastSettleTimeMS"] = dp.fastSettleTimeMS;
    params["auxGain"] = dp.auxGain;
    params["termination"] = DAQ::TermConfigToString(dp.aiTerm);
//	params["channelMapping2"] = dp.chanMap.toString();
	params["channelMapping2Terse"] = dp.chanMap.toTerseString(dp.demuxedBitMap);
	
    if (dp.usePD) {
        params["pdChan"] = dp.pdChan;
        params["pdThresh"] = dp.pdThresh;
		params["pdChanIsVirtual"] = dp.pdChanIsVirtual;
		params["pdThreshW"] = dp.pdThreshW;
		params["pdPassThruToAO"] = dp.pdPassThruToAO;
		params["pdStopTime"] = dp.pdStopTime;
    }
    if (dp.bug.enabled) {
        params["bug_errorTolerance"] = dp.bug.errTol;
        params["bug_hpfilt"] = dp.bug.hpf;
        params["bug_snfilt"] = dp.bug.snf;
        params["bug_clockEdge"] = dp.bug.clockEdge;
        params["bug_dataRate"] = dp.bug.rate;
    }
    params["acqStartEndMode"] = DAQ::AcqStartEndModeToString(dp.acqStartEndMode);
    if (dp.demuxedBitMap.count(false)) {
        params["saveChannelSubset"] = dp.subsetString;
    } else 
        params["saveChannelSubset"] = "ALL";
	mode = Output;
	
	chanDisplayNames.clear();
	if (dp.chanDisplayNames.size()) {
		QString str;
		int i = 0;
		for (QVector<QString>::const_iterator it = dp.chanDisplayNames.begin(); it < dp.chanDisplayNames.end(); ++it, ++i) {
			if (dp.demuxedBitMap[i]) {
				QString s(*it);
				s.replace(",", "");
				str = str + (str.length() ? "," : "") + s.trimmed();
				chanDisplayNames.push_back(*it);
			}
		}
		params["chanDisplayNames"] = str;
	}
	
    return true;
}
示例#21
0
#define STOPCHECK   if( isStopped() ) return false;


void CimAcqImec::SETLBL( const QString &s )
{
    QMetaObject::invokeMethod(
        mainApp(), "runInitSetLabel",
        Qt::QueuedConnection,
        Q_ARG(QString, s) );
}


void CimAcqImec::SETVAL( int val )
{
    QMetaObject::invokeMethod(
        mainApp(), "runInitSetValue",
        Qt::QueuedConnection,
        Q_ARG(int, val) );
}


void CimAcqImec::SETVALBLOCKING( int val )
{
    QMetaObject::invokeMethod(
        mainApp(), "runInitSetValue",
        Qt::BlockingQueuedConnection,
        Q_ARG(int, val) );
}


bool CimAcqImec::_open()
示例#22
0
int main() {
    
    int numWindows = 3;

    shared_ptr<ofApp> mainApp(new ofApp);

    vector< shared_ptr<ofAppBaseWindow> > windows;
    /*for(int i=0;i<numWindows;i++){
        
        ofGLFWWindowSettings settings;
        settings.width = 600;
        settings.height = 600;
        settings.setPosition(ofVec2f(1920*i+100,0));
        settings.resizable = true;
        if(i > 0){
            settings.shareContextWith = ofGetMainLoop()->getCurrentWindow();
        }

        shared_ptr<ofAppBaseWindow> win = ofCreateWindow(settings);
        
        win->setVerticalSync(false);
        win->setFullscreen(true);
        windows.push_back(win);
        //win.setMultiDisplayFullscreen(true); //this makes the fullscreen window span across all your monitors
        
        ofRunApp(windows[i], mainApp);

    }*/
    
    ofGLFWWindowSettings settings;
    settings.width = 600;
    settings.height = 600;
    settings.setPosition(ofVec2f(1600,0));
    settings.resizable = false;
    settings.decorated = false;
    settings.monitor = 1;
    
    shared_ptr<ofAppBaseWindow> win = ofCreateWindow(settings);
    
    win->setVerticalSync(false);
    win->setWindowTitle("Projector 1");
    windows.push_back(win);
    

    
    settings.width = 600;
    settings.height = 600;
    settings.setPosition(ofVec2f(1920,0));
    settings.resizable = false;
    settings.shareContextWith = ofGetMainLoop()->getCurrentWindow();
    
    shared_ptr<ofAppBaseWindow> win2 = ofCreateWindow(settings);
    win2->setWindowTitle("Projector 2+3");
    win2->setVerticalSync(false);
    windows.push_back(win2);

  /*
    win->setWindowPosition(1920, 0);
    win->setWindowShape(1920,  1200);
    
    win2->setWindowPosition(1920, 0);

    */
    mainApp->windows = windows;
    
    ofRunApp(windows[0], mainApp);
    ofRunApp(windows[1], mainApp);

    ofRunMainLoop();
}
示例#23
0
Bug_Popout::~Bug_Popout()
{
    if (plotThread) delete plotThread, plotThread = 0;
	mainApp()->sortGraphsByElectrodeAct->setEnabled(true);
	delete ui; ui = 0;
}
示例#24
0
Sha1Verifier::Sha1Verifier()
    : QObject(0), cons(0), prog(0), thread(0), worker(0)
{
// -----------
// Pick a file
// -----------

    cons = mainApp()->console();

    QString dataFile =
        QFileDialog::getOpenFileName(
            cons,
            "Select data file for SHA1 verification",
            mainApp()->runDir() );

    if( dataFile.isEmpty() )
        return;

    QFileInfo   fi( dataFile );
    KVParams    kvp;

// ---------------------
// Point fi at meta file
// ---------------------

    if( fi.suffix() != "meta" ) {

        fi.setFile( QString("%1/%2.meta")
                        .arg( fi.path() )
                        .arg( fi.completeBaseName() ) );
    }
    else
        dataFile.clear();

    if( !fi.exists() ) {

        QMessageBox::critical(
            cons,
            "Missing Meta File",
            QString("SHA1 needs a matching meta-file for\n[%1].")
                .arg( dataFile ) );

        return;
    }

// ------------------------------
// Get binary file from meta data
// ------------------------------

    if( !kvp.fromMetaFile( fi.filePath() ) ) {

        QMessageBox::critical(
            cons,
            QString("%1 Read Error.")
                .arg( fi.fileName() ),
            QString("SHA1 verifier could not read contents of\n[%1].")
                .arg( fi.fileName() ) );

        return;
    }

    if( !dataFile.length() )
        dataFile = kvp["fileName"].toString();

    mainApp()->makePathAbsolute( dataFile );

// --------------------------------------
// Disallow operation on current acq file
// --------------------------------------

    fi = QFileInfo( dataFile );

    if( mainApp()->getRun()->dfIsInUse( fi ) ) {

        QMessageBox::critical(
            cons,
            "Selected File In Use",
            "Cannot run SHA1 on the current data acquisition file." );

        return;
    }

// -----
// Begin
// -----

    prog = new QProgressDialog(
                QString("Verifying SHA1 hash of '%1'...")
                    .arg( fi.fileName() ),
                "Cancel",
                0, 100,
                cons );

    prog->setWindowFlags( prog->windowFlags()
        & ~(Qt::WindowContextHelpButtonHint
            | Qt::WindowCloseButtonHint) );

    thread  = new QThread;
    worker  = new Sha1Worker( dataFile, kvp );

    worker->moveToThread( thread );

    Connect( thread, SIGNAL(started()), worker, SLOT(run()) );

    Connect( worker, SIGNAL(progress(int)), prog, SLOT(setValue(int)) );
    Connect( prog, SIGNAL(canceled()), this, SLOT(cancel()) );
    Connect( worker, SIGNAL(result(int)), this, SLOT(result(int)) );

    Connect( worker, SIGNAL(destroyed()), thread, SLOT(quit()), Qt::DirectConnection );
    Connect( thread, SIGNAL(finished()), thread, SLOT(deleteLater()) );

    prog->show();
    thread->start();
}
示例#25
0
//========================================================================
int main( ){
    
    ofGLFWWindowSettings mainSettings;
    
    mainSettings.resizable = false;
    mainSettings.setGLVersion(4, 1);
    mainSettings.decorated = false;

    ofGLFWWindowSettings guiSettings;
    
    guiSettings.resizable = true;
    guiSettings.setGLVersion(4, 1);

    // Get screen widths and heights from Quartz Services
    // See https://developer.apple.com/library/mac/documentation/GraphicsImaging/Reference/Quartz_Services_Ref/index.html
    
    CGDisplayCount displayCount;
    CGDirectDisplayID displays[32];
    
    // Grab the active displays
    CGGetActiveDisplayList(32, displays, &displayCount);
    int numDisplays= displayCount;
    
    // print display info.
    cout<<numDisplays<<" display(s) detected."<<endl;
    
    for (int i = 0; i < displayCount; i++){
        cout << displays[i] << "\t(" << CGDisplayPixelsWide(displays[i]) << "x" << CGDisplayPixelsHigh(displays[i]) << ")"<< endl;
    }
    
    CGRect mainDisplayBounds= CGDisplayBounds ( displays[0] );

    if(numDisplays == 1 ){
        
        float divisions = 4.0;
        // one display: palce gui and mainWindow in a default arrangement
        
        mainSettings.width = round(mainDisplayBounds.size.width * (divisions-1) / divisions);
        mainSettings.height = round((mainSettings.width * (9.0 / 16.0)) / 2.0);
        mainSettings.setPosition(ofVec2f(round(mainDisplayBounds.size.width / divisions) ,mainDisplayBounds.origin.y));
        mainSettings.decorated = true;
        
        guiSettings.width = round(mainDisplayBounds.size.width - 100);
        guiSettings.height = mainDisplayBounds.size.height - 100;
        guiSettings.setPosition(ofVec2f(mainDisplayBounds.origin.x, mainDisplayBounds.origin.y + 80));

        cout << "configured default one display setup" << endl;
        
    } else if (numDisplays > 1){
        
        // two displays: palce resizeable gui on first and fill second with undecorated mainWindow - will also work with dual head configuraions for projectors

        guiSettings.width = mainDisplayBounds.size.width;
        guiSettings.height = mainDisplayBounds.size.height - 100;
        guiSettings.setPosition(ofVec2f(mainDisplayBounds.origin.x, mainDisplayBounds.origin.y));

        CGRect secondDisplayBounds= CGDisplayBounds ( displays[1] );
        
        mainSettings.width = secondDisplayBounds.size.width;
        mainSettings.height = secondDisplayBounds.size.height;
        mainSettings.setPosition(ofVec2f(secondDisplayBounds.origin.x,secondDisplayBounds.origin.y));
        
//        CGError e = CGDisplaySetStereoOperation(displays[1], true, true, kCGConfigureForAppOnly);
        
//        if(e == kCGErrorRangeCheck) cout << "no hardware stereo" << endl;
//        if(e == kCGErrorSuccess) cout << "hardware stereo" << endl;
        
        if (numDisplays > 2 ) {
            
            // three or more displays: palce resizeable gui on first and fill second and third with undecorated mainWindow, if they are same size.
            
            CGRect thirdDisplayBounds= CGDisplayBounds ( displays[2] );
            if(secondDisplayBounds.size.width == thirdDisplayBounds.size.width && secondDisplayBounds.size.height == thirdDisplayBounds.size.height){
               
                mainSettings.width = secondDisplayBounds.size.width * 2;
                mainSettings.setPosition(ofVec2f(1,1));
                cout << "configured default three display setup" << endl;

            }
        } else {
            cout << "configured default two display setup" << endl;
        }
    }
    
    shared_ptr<ofAppBaseWindow> mainWindow = ofCreateWindow(mainSettings);
    guiSettings.shareContextWith = mainWindow;

    shared_ptr<ofAppBaseWindow> guiWindow = ofCreateWindow(guiSettings);

    //guiWindow->setVerticalSync(false);
    
    shared_ptr<ofApp> mainApp(new ofApp);
    
    mainApp->setupGui(guiWindow, mainWindow);
    
    ofAddListener(guiWindow->events().draw,mainApp.get(),&ofApp::drawGui);
    
    // gui events to main app gui listener functions
    
#define guiEventMacro(NAME)  ofAddListener(guiWindow->events() . NAME , mainApp.get(), &ofApp::NAME ## Gui);

    guiEventMacro(keyPressed);
    guiEventMacro(keyReleased);
    guiEventMacro(mouseMoved);
    guiEventMacro(mouseDragged);
    guiEventMacro(mousePressed);
    guiEventMacro(mouseReleased);
    guiEventMacro(mouseEntered);
    guiEventMacro(mouseExited);
    guiEventMacro(windowResized);
    
    ofRunApp(mainWindow, mainApp);

    ofRunMainLoop();

}
示例#26
0
// not threadsafe
bool DataFile::openForReWrite(const DataFile & other, const QString & filename, const QVector<unsigned> & chanNumSubset)
{
	if (!other.isOpenForRead()) {
		Error() << "INTERNAL ERROR: First parameter to DataFile::openForReWrite() needs to be another DataFile that is opened for reading.";
		return false;
	}
	if (isOpen()) closeAndFinalize();
	
	QString outputFile (filename);
	if (!QFileInfo(outputFile).isAbsolute())
        outputFile = mainApp()->outputDirectory() + "/" + outputFile; 
    
    Debug() << "outdir: " << mainApp()->outputDirectory() << " outfile: " << outputFile;
    
	dataFile.close();  metaFile.close();
    dataFile.setFileName(outputFile);
    metaFile.setFileName(metaFileForFileName(outputFile));
	
    if (!dataFile.open(QIODevice::WriteOnly|QIODevice::Truncate) ||
        !metaFile.open(QIODevice::WriteOnly|QIODevice::Truncate)) {
        Error() << "Failed to open either one or both of the data and meta files for " << outputFile;
        return false;
    }
	
//    badData = other.badData;
    badData.clear();
	mode = Output;
	const int nOnChans = chanNumSubset.size();
	params = other.params;
	params["outputFile"] = outputFile;
    params.remove("badData"); // rebuild this as we write!
	scanCt = 0;
	nChans = nOnChans;
	sha.Reset();
	sRate = other.sRate;
	range = other.range;
    writeRateAvg = 0.;
    nWritesAvg = 0;
    nWritesAvgMax = /*unsigned(sRate/10.)*/10;
    if (!nWritesAvgMax) nWritesAvgMax = 1;
	// compute save channel subset fudge
	const QVector<unsigned> ocid = other.channelIDs();
	chanIds.clear();
	customRanges.clear();
	chanDisplayNames.clear();
	QString crStr(""), cdnStr("");
	foreach (unsigned i, chanNumSubset) {
		if (i < unsigned(ocid.size())) {
			chanIds.push_back(ocid[i]);
			if (i < (unsigned)other.customRanges.size()) customRanges.push_back(other.customRanges[i]);
			else customRanges.push_back(range);
			if (i < (unsigned)other.chanDisplayNames.size()) chanDisplayNames.push_back(other.chanDisplayNames[i]);
			else chanDisplayNames.push_back(QString("Ch ") + QString::number(i));
			crStr.append(QString("%3%1:%2").arg(customRanges.back().min,0,'f',9).arg(customRanges.back().max,0,'f',9).arg(crStr.length() ? "," : ""));
			if (cdnStr.length()) cdnStr.append(",");
			cdnStr.append(QString(chanDisplayNames.back()).replace(",",""));
		} else 
			Error() << "INTERNAL ERROR: The chanNumSubset passet to DataFile::openForRead must be a subset of channel numbers (indices, not IDs) to use in the rewrite.";
	}
	params["saveChannelSubset"] = ConfigureDialogController::generateAIChanString(chanIds);
	params["nChans"] = nChans;
	if (params.contains("chanDisplayNames")) params["chanDisplayNames"] = cdnStr;
	if (params.contains("customRanges")) params["customRanges"] = crStr;
	pd_chanId = other.pd_chanId;
	
	return true;
}
示例#27
0
文件: main_nix.cpp 项目: JLuc/scribus
int main(int argc, char *argv[])
{
	return mainApp(argc, argv);
}
示例#28
0
//--------------------------------------------------------------------------------------
// Entry point to the program. Initializes everything and goes into a message processing 
// loop. Idle time is used to render the scene.
//--------------------------------------------------------------------------------------
int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow)
{
    UNREFERENCED_PARAMETER(hPrevInstance);
    UNREFERENCED_PARAMETER(lpCmdLine);

#ifdef USE_CONSOLE_BACKEND
    AllocConsole();
    freopen("CONIN$", "r", stdin);
    freopen("CONOUT$", "w", stdout);
    freopen("CONOUT$", "w", stderr);
#endif

    // init
    if (FAILED(InitWindow(hInstance, nCmdShow)))
        return 0;

    if (FAILED(InitBackend(g_hWnd)))
    {
        CleanupBackend(g_hWnd);
        return 0;
    }

    ShowWindow(g_hWnd, SW_SHOW);
    SetForegroundWindow(g_hWnd);
    SetFocus(g_hWnd);

#ifdef USE_ANTTWBAR_BACKEND
    TwInit(TW_OPENGL, NULL);
#endif

#ifdef ANIMATE_BACKEND
    InitApp();
#else
    mainApp();
#endif

    // main loop
    static bool quit = false;
    MSG msg = { 0 };
    while (!quit)
    {
        if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE))
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
        if (msg.message == WM_QUIT)
        {
            quit = true;
        }
#ifdef ANIMATE_BACKEND
        else
        {
            RenderApp();
#ifdef USE_ANTTWBAR_BACKEND
            TwDraw();
#endif
            SwapBuffersBackend();
        }
#endif
    }

    // cleanup
#ifdef ANIMATE_BACKEND
    CleanupApp();
#endif
#ifdef USE_ANTTWBAR_BACKEND
    TwTerminate();
#endif
    CleanupBackend(g_hWnd);
    CleanupWindow();

    return (int)msg.wParam;
}