JNIEXPORT jint JNICALL Java_solver_fluctuat_Fluctuat_debugContinue (JNIEnv *, jclass, jlong fluctuat, jint count) { //There is a "bug" in Fluctuat v. 3.873 that POINT must be reset to NULL //before calling debugContinue POINT = NULL; return debugContinue((DebugInterface*)fluctuat, count, &POINT, &SOURCE, &LINE); }
void DGLMainWindow::createActions() { // create "QActions" - bindings between mainwindow clickable widgets, // and // local slots quitAct = new QAction(tr("&Quit"), this); quitAct->setShortcuts(QKeySequence::Quit); quitAct->setStatusTip(tr("Quit the application")); CONNASSERT(quitAct, SIGNAL(triggered()), this, SLOT(close())); quitAct->setShortcut(QKeySequence(Qt::ALT + Qt::Key_F4)); aboutAct = new QAction(tr("&About"), this); aboutAct->setStatusTip(tr("Show the application's About box")); CONNASSERT(aboutAct, SIGNAL(triggered()), this, SLOT(about())); aboutAct->setShortcut(QKeySequence(Qt::Key_F1)); newProjectAct = new QAction(tr("&New Project..."), this); newProjectAct->setStatusTip(tr("Created new debugging project")); CONNASSERT(newProjectAct, SIGNAL(triggered()), this, SLOT(newProject())); newProjectAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N)); openProjectAct = new QAction(tr("&Open Project..."), this); openProjectAct->setStatusTip(tr("Opens a debugging project")); CONNASSERT(openProjectAct, SIGNAL(triggered()), this, SLOT(openProject())); //TODO: implement openProjectAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O)); saveProjectAct = new QAction(tr("&Save Project"), this); saveProjectAct->setStatusTip(tr("Save a debugging project")); CONNASSERT(saveProjectAct, SIGNAL(triggered()), this, SLOT(saveProject())); //TODO: implement saveProjectAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S)); saveAsProjectAct = new QAction(tr("&Save Project As ..."), this); saveAsProjectAct->setStatusTip(tr("Save a debugging project as as a file ...")); CONNASSERT(saveAsProjectAct, SIGNAL(triggered()), this, SLOT(saveProjectAs())); //TODO: implement saveAsProjectAct->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_S)); projectProperiesAct = new QAction(tr("&Project properties..."), this); projectProperiesAct->setStatusTip(tr("Change properties of current project")); CONNASSERT(projectProperiesAct, SIGNAL(triggered()), this, SLOT(projectProperties())); closeProjectAct = new QAction(tr("&Close project"), this); closeProjectAct->setStatusTip(tr("Created new debugging project")); CONNASSERT(closeProjectAct, SIGNAL(triggered()), this, SLOT(closeProject())); debugStartAct = new QAction(tr("&Start debugging"), this); debugStartAct->setStatusTip(tr("Stop debugging.")); CONNASSERT(debugStartAct, SIGNAL(triggered()), this, SLOT(debugStart())); CONNASSERT(&m_controller, SIGNAL(setDisconnected(bool)), debugStartAct, SLOT(setVisible(bool))); debugStartAct->setShortcut(QKeySequence(Qt::Key_F5)); debugStopAct = new QAction(tr("Sto&p debugging"), this); debugStopAct->setStatusTip(tr("Stop debugging.")); CONNASSERT(debugStopAct, SIGNAL(triggered()), this, SLOT(debugStop())); CONNASSERT(&m_controller, SIGNAL(setConnected(bool)), debugStopAct, SLOT(setEnabled(bool))); debugStopAct->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_F5)); debugStopAct->setEnabled(false); debugTerminateAct = new QAction(tr("Terminate"), this); debugTerminateAct->setStatusTip(tr("Terminate debugged process.")); CONNASSERT(debugTerminateAct, SIGNAL(triggered()), this, SLOT(debugTerminate())); CONNASSERT(&m_controller, SIGNAL(setConnected(bool)), debugTerminateAct, SLOT(setEnabled(bool))); debugTerminateAct->setEnabled(false); debugContinueAct = new QAction(tr("&Continue"), this); debugContinueAct->setStatusTip(tr("Continue program execution")); CONNASSERT(debugContinueAct, SIGNAL(triggered()), &m_controller, SLOT(debugContinue())); CONNASSERT(&m_controller, SIGNAL(setConnected(bool)), debugContinueAct, SLOT(setVisible(bool))); CONNASSERT(&m_controller, SIGNAL(setBreaked(bool)), debugContinueAct, SLOT(setEnabled(bool))); debugContinueAct->setShortcut(QKeySequence(Qt::Key_F5)); debugContinueAct->setVisible(false); debugInterruptAct = new QAction(tr("&Break on next call"), this); debugInterruptAct->setStatusTip( tr("Break program execution on GL call")); CONNASSERT(debugInterruptAct, SIGNAL(triggered()), &m_controller, SLOT(debugInterrupt())); CONNASSERT(&m_controller, SIGNAL(setConnected(bool)), debugInterruptAct, SLOT(setEnabled(bool))); CONNASSERT(&m_controller, SIGNAL(setRunning(bool)), debugInterruptAct, SLOT(setEnabled(bool))); debugInterruptAct->setShortcut(QKeySequence(Qt::Key_F6)); debugInterruptAct->setEnabled(false); debugStepAct = new QAction(tr("&Step"), this); debugStepAct->setStatusTip(tr("Step one GL call")); CONNASSERT(debugStepAct, SIGNAL(triggered()), &m_controller, SLOT(debugStep())); CONNASSERT(&m_controller, SIGNAL(setConnected(bool)), debugStepAct, SLOT(setEnabled(bool))); CONNASSERT(&m_controller, SIGNAL(setBreaked(bool)), debugStepAct, SLOT(setEnabled(bool))); debugStepAct->setShortcut(QKeySequence(Qt::Key_F11)); debugStepAct->setEnabled(false); debugStepDrawCallAct = new QAction(tr("&Draw step"), this); debugStepDrawCallAct->setStatusTip(tr("Step one GL drawing call")); CONNASSERT(debugStepDrawCallAct, SIGNAL(triggered()), &m_controller, SLOT(debugStepDrawCall())); CONNASSERT(&m_controller, SIGNAL(setConnected(bool)), debugStepDrawCallAct, SLOT(setEnabled(bool))); CONNASSERT(&m_controller, SIGNAL(setBreaked(bool)), debugStepDrawCallAct, SLOT(setEnabled(bool))); debugStepDrawCallAct->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_F11)); debugStepDrawCallAct->setEnabled(false); debugStepFrameAct = new QAction(tr("&Frame step"), this); debugStepFrameAct->setStatusTip(tr("Step one GL frame")); CONNASSERT(debugStepFrameAct, SIGNAL(triggered()), &m_controller, SLOT(debugStepFrame())); CONNASSERT(&m_controller, SIGNAL(setConnected(bool)), debugStepFrameAct, SLOT(setEnabled(bool))); CONNASSERT(&m_controller, SIGNAL(setBreaked(bool)), debugStepFrameAct, SLOT(setEnabled(bool))); debugStepFrameAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F11)); debugStepFrameAct->setEnabled(false); addDeleteBreakPointsAct = new QAction(tr("&Breakpoints..."), this); addDeleteBreakPointsAct->setStatusTip(tr("Add or remove breakpoints")); CONNASSERT(addDeleteBreakPointsAct, SIGNAL(triggered()), this, SLOT(addDeleteBreakPoints())); addDeleteBreakPointsAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_B)); setBreakOnGLErrorAct = new QAction(tr("Break on GL error"), this); setBreakOnGLErrorAct->setStatusTip( tr("Break execution on GL error (glGetError() != GL_NO_ERROR)")); // this action has a state - it is checbox-like checkable DGLConfiguration& currentConfig = m_controller.getConfig(); setBreakOnGLErrorAct->setCheckable(true); setBreakOnGLErrorAct->setChecked(currentConfig.m_BreakOnGLError); CONNASSERT(setBreakOnGLErrorAct, SIGNAL(toggled(bool)), this, SLOT(setBreakOnWhatever(bool))); setBreakOnDebugOutputAct = new QAction(tr("Break on debug output"), this); setBreakOnDebugOutputAct->setStatusTip( tr("Break execution on debug output message")); // this action has a state - it is checbox-like checkable setBreakOnDebugOutputAct->setCheckable(true); setBreakOnDebugOutputAct->setChecked( currentConfig.m_BreakOnGLError); CONNASSERT(setBreakOnDebugOutputAct, SIGNAL(toggled(bool)), this, SLOT(setBreakOnWhatever(bool))); setBreakOnCompilerErrAct = new QAction(tr("Break on compiler/linker error"), this); setBreakOnCompilerErrAct->setStatusTip( tr("Break execution on debug GLSL compiler or linker error")); // this action has a state - it is checbox-like checkable setBreakOnCompilerErrAct->setCheckable(true); setBreakOnCompilerErrAct->setChecked( currentConfig.m_BreakOnCompilerError); CONNASSERT(setBreakOnCompilerErrAct, SIGNAL(toggled(bool)), this, SLOT(setBreakOnWhatever(bool))); // Only one color scheme can be choosed - put all related actions to // action // group setColorSchemeActGroup = new QActionGroup(this); // iterate through all color schemes. for each one create one action for (uint i = 0; i < DGLNUM_COLOR_SCHEMES; i++) { setColorSchemeActs[i] = new QAction(tr(dglColorSchemes[i].name), this); setColorSchemeActs[i]->setCheckable(true); setColorSchemeActs[i]->setActionGroup(setColorSchemeActGroup); setColorSchemeActs[i]->setStatusTip(tr("Set this color scheme")); // connect all color scheme actions to one mapper, so we can connect // it // later to only one signal m_SetColorSchemeSignalMapper.setMapping(setColorSchemeActs[i], i); CONNASSERT(setColorSchemeActs[i], SIGNAL(triggered()), &m_SetColorSchemeSignalMapper, SLOT(map())); } // mapper maps connected actions to one emitted signal by int parameter. // Connect this signal to "this" CONNASSERT(&m_SetColorSchemeSignalMapper, SIGNAL(mapped(int)), this, SLOT(setColorScheme(int))); configurationAct = new QAction(tr("Configuration..."), this); configurationAct->setStatusTip(tr("Configuration options")); CONNASSERT(configurationAct, SIGNAL(triggered()), this, SLOT(configure())); prepareAndroidAct = new QAction(tr("Prepare Android device..."), this); prepareAndroidAct->setStatusTip(tr("Installs " DGL_PRODUCT " on Android device")); CONNASSERT(prepareAndroidAct, SIGNAL(triggered()), this, SLOT(androidPrepare())); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), _has_unsaved_data(true), _current_file(""), _can_run(false), _is_running(false), _is_debug_input(false) { ui->setupUi(this); initStyles(); updateWindowTitle(); redoAvailable(false); undoAvailable(false); copyAvailable(false); _window = this; ui->debugRun->setVisible(false); ui->runWidget->setVisible(false); registerFileType(tr("Yad.Markov.File"), tr("Markov Algorithm File"), ".yad", 1); updateDebugMenu(); //Connect MainWindow menu connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(close())); connect(ui->actionUndo, SIGNAL(triggered()), this, SIGNAL(undo())); connect(ui->actionRedo, SIGNAL(triggered()), this, SIGNAL(redo())); connect(ui->actionSelect_All, SIGNAL(triggered()), this, SIGNAL(selectAll())); connect(ui->actionCopy, SIGNAL(triggered()), this, SIGNAL(copy())); connect(ui->actionPaste, SIGNAL(triggered()), this, SIGNAL(paste())); connect(ui->actionCut, SIGNAL(triggered()), this, SIGNAL(cut())); connect(ui->actionDelete, SIGNAL(triggered()), this, SIGNAL(deleteSelection())); connect(ui->actionNew, SIGNAL(triggered()), this, SIGNAL(newFile())); connect(ui->actionOpen, SIGNAL(triggered()), this, SIGNAL(open())); connect(ui->actionSave, SIGNAL(triggered()), this, SIGNAL(save())); connect(ui->actionSave_As, SIGNAL(triggered()), this, SIGNAL(saveAs())); connect(ui->actionTutorial, SIGNAL(triggered()), this, SLOT(tutorial())); connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(about())); //Connect InputWidget and HistoryManager HistoryManager* history_manager = HistoryManager::getInstance(); connect(ui->input, SIGNAL(addToHistory(QString)), history_manager, SLOT(addToHistory(QString))); connect(history_manager, SIGNAL(wordSelected(QString)), ui->input, SLOT(setInput(QString))); //Connect HistoryWidget and HistoryManager connect(ui->history, SIGNAL(inputWordSelected(QString)), history_manager, SIGNAL(wordSelected(QString))); connect(ui->history, SIGNAL(removeFromHistory(QString)), history_manager, SLOT(removeFromHistory(QString))); connect(history_manager, SIGNAL(historyChanged(QVector<QString>)), ui->history, SLOT(historyChanged(QVector<QString>))); //Connect MainWindows and FileManager FileManager* file_manager = FileManager::getInstance(); connect(this, SIGNAL(newFile()), file_manager, SLOT(newFile())); connect(this, SIGNAL(open()), file_manager, SLOT(open())); connect(this, SIGNAL(save()), file_manager, SLOT(save())); connect(this, SIGNAL(saveAs()), file_manager, SLOT(saveAs())); connect(file_manager, SIGNAL(hasUnsavedData(bool)), this, SLOT(hasUnsavedData(bool))); connect(file_manager, SIGNAL(fileNameChanged(QString)), this, SLOT(fileNameChanged(QString))); //Connect MainWindows and EditorWindowWidget connect(this, SIGNAL(undo()), ui->editorWindow, SLOT(undo())); connect(this, SIGNAL(redo()), ui->editorWindow, SLOT(redo())); connect(this, SIGNAL(selectAll()), ui->editorWindow, SLOT(selectAll())); connect(this, SIGNAL(copy()), ui->editorWindow, SLOT(copy())); connect(this, SIGNAL(paste()), ui->editorWindow, SLOT(paste())); connect(this, SIGNAL(cut()), ui->editorWindow, SLOT(cut())); connect(this, SIGNAL(deleteSelection()), ui->editorWindow, SLOT(deleteSelection())); connect(ui->editorWindow, SIGNAL(redoAvailable(bool)), this, SLOT(redoAvailable(bool))); connect(ui->editorWindow, SIGNAL(undoAvailable(bool)), this, SLOT(undoAvailable(bool))); connect(ui->editorWindow, SIGNAL(copyAvailable(bool)), this, SLOT(copyAvailable(bool))); //Connect InputWidget and MarkovRunManager MarkovRunManager* run_manager = MarkovRunManager::getInstance(); connect(ui->input, SIGNAL(run(QString)), run_manager, SLOT(runWithoutDebug(QString))); connect(ui->input, SIGNAL(runWithDebug(QString)), run_manager, SLOT(runWithDebug(QString))); connect(run_manager, SIGNAL(runWithoutDebugStarted(QString)), ui->input, SLOT(runStarted())); connect(ui->input, SIGNAL(runWithDebugStepByStep(QString)), run_manager, SLOT(runWithDebugStepByStep(QString))); connect(run_manager, SIGNAL(debugStarted(QString)), ui->input, SLOT(runStarted())); connect(run_manager, SIGNAL(runWithoutDebugFinishFail(QString,RunError,int)), ui->input, SLOT(runFinished())); connect(run_manager, SIGNAL(runWithoutDebugFinishSuccess(QString,QString,int)), ui->input, SLOT(runFinished())); connect(run_manager, SIGNAL(debugFinishFail(QString,RunError,int)), ui->input, SLOT(runFinished())); connect(run_manager, SIGNAL(debugFinishSuccess(QString,QString,int)), ui->input, SLOT(runFinished())); connect(run_manager, SIGNAL(canRunSourceCode(bool)), ui->input, SLOT(canRunAlgorithm(bool))); //Connect SourceCodeManager and EditorWindowWidget SourceCodeManager* source_manager = SourceCodeManager::getInstance(); connect(source_manager, SIGNAL(newSourceCodeWasLoaded(QString)), ui->editorWindow, SLOT(newSourceCode(QString))); connect(ui->editorWindow, SIGNAL(sourceCodeChanged(QString)), source_manager, SLOT(setSourceCode(QString))); //Connect InputWidget and FileManager connect(ui->input, SIGNAL(save()), file_manager, SLOT(save())); //Connect MarkovRunManager and EditorWindowWidget connect(ui->editorWindow, SIGNAL(canRun(bool)), run_manager, SLOT(setCanRunSourceCode(bool))); connect(ui->editorWindow, SIGNAL(markovAlgorithmChanged(MarkovAlgorithm)), run_manager, SLOT(setAlgorithm(MarkovAlgorithm))); //Connect SourceCodeManager and FileManager connect(file_manager, SIGNAL(newSourceCodeLoaded(QString)), source_manager, SLOT(setNewSourceCodeFromFile(QString))); connect(source_manager, SIGNAL(sourceCodeChanged(QString)), file_manager, SLOT(sourceCodeChanged())); //Connect FileManager and HistoryManager connect(file_manager, SIGNAL(newHistoryLoaded(QVector<QString>)), this, SLOT(newHistoryLoaded(QVector<QString>))); connect(history_manager, SIGNAL(historyChanged(QVector<QString>)), file_manager, SLOT(historyChanged())); //Connect RunWidget and MarkovRunManager connect(run_manager, SIGNAL(runWithoutDebugStarted(QString)), ui->runWidget, SLOT(runStarted(QString))); connect(run_manager, SIGNAL(runStepsMade(int)), ui->runWidget, SLOT(runStepsMade(int))); connect(run_manager, SIGNAL(runWithoutDebugFinishFail(QString,RunError,int)), ui->runWidget, SLOT(runFailed(QString,RunError,int))); connect(run_manager, SIGNAL(runWithoutDebugFinishSuccess(QString,QString,int)), ui->runWidget, SLOT(runSuccess(QString,QString,int))); connect(run_manager, SIGNAL(debugStarted(QString)), ui->runWidget, SLOT(hide())); //Connect DebugRunWidget and MarkovRunManager connect(ui->debugRun, SIGNAL(nextStepClicked()), run_manager, SLOT(debugNextStep())); connect(ui->debugRun, SIGNAL(continueClicked()), run_manager, SLOT(debugContinue())); connect(ui->debugRun, SIGNAL(stopClicked()), run_manager, SLOT(debugStop())); connect(run_manager, SIGNAL(debugStarted(QString)), ui->debugRun, SLOT(debugStarted(QString))); connect(run_manager, SIGNAL(debugFinishSuccess(QString,QString,int)), ui->debugRun, SLOT(debugSuccess(QString,QString,int))); connect(run_manager, SIGNAL(debugFinishFail(QString,RunError,int)), ui->debugRun, SLOT(debugFailed(QString,RunError,int))); connect(run_manager, SIGNAL(debugStepFinished(int,QString,QString,MarkovRule)), ui->debugRun, SLOT(debugStepFinished(int,QString,QString,MarkovRule))); connect(run_manager, SIGNAL(debugBreakPointReached(int)), ui->debugRun, SLOT(breakPointReached(int))); connect(run_manager, SIGNAL(runWithoutDebugStarted(QString)), ui->debugRun, SLOT(hide())); connect(run_manager, SIGNAL(debugFinishFail(QString,RunError,int)), ui->runWidget, SLOT(hide())); connect(run_manager, SIGNAL(runWithoutDebugFinishFail(QString,RunError,int)), ui->debugRun, SLOT(hide())); //Connect DebugRunWidget and EditorWindowWidget connect(ui->debugRun, SIGNAL(removeBreakPoint()), ui->editorWindow, SLOT(removeLineHighlight())); connect(ui->debugRun, SIGNAL(showBreakPoint(int)), ui->editorWindow, SLOT(showLineHighlight(int))); //Connect MarkovRunManager and EditorWindowWidget connect(ui->editorWindow, SIGNAL(breakPointAdded(int)), run_manager, SLOT(addBreakPoint(int))); connect(ui->editorWindow, SIGNAL(breakPointRemoved(int)), run_manager, SLOT(removeBreakPoint(int))); //Connect top menu connect(run_manager, SIGNAL(runWithoutDebugStarted(QString)), this, SLOT(runStarted())); connect(run_manager, SIGNAL(debugStarted(QString)), this, SLOT(runStarted())); connect(run_manager, SIGNAL(runWithoutDebugFinishFail(QString,RunError,int)), this, SLOT(runFinished())); connect(run_manager, SIGNAL(runWithoutDebugFinishSuccess(QString,QString,int)), this, SLOT(runFinished())); connect(run_manager, SIGNAL(debugFinishFail(QString,RunError,int)), this, SLOT(runFinished())); connect(run_manager, SIGNAL(debugFinishSuccess(QString,QString,int)), this, SLOT(runFinished())); connect(run_manager, SIGNAL(canRunSourceCode(bool)), this, SLOT(canRunAlgorithm(bool))); connect(run_manager, SIGNAL(debugBreakPointReached(int)), this, SLOT(debugInputStarted())); connect(run_manager, SIGNAL(debugStepFinished(int,QString,QString,MarkovRule)), this, SLOT(debugInputFinished())); connect(ui->actionRun, SIGNAL(triggered()), ui->input, SLOT(runCliked())); connect(ui->actionDebug, SIGNAL(triggered()), ui->input, SLOT(runWithDebugClicked())); connect(ui->actionNext_Step, SIGNAL(triggered()), run_manager, SLOT(debugNextStep())); connect(ui->actionContinue, SIGNAL(triggered()), run_manager, SLOT(debugContinue())); connect(ui->actionStop_Debug, SIGNAL(triggered()), run_manager, SLOT(debugStop())); connect(ui->actionDebug_Step_By_Step, SIGNAL(triggered()), ui->input, SLOT(runWithDebugStepByStepClicked())); //Read file to open from command line QStringList arguments = QCoreApplication::arguments(); if(arguments.size() >= 2) { QString file_name = arguments.at(1); FileManager::getInstance()->openFile(file_name); } else { source_manager->setNewSourceCodeFromFile(tr("//Alphabet\nT = {a, b}\n\n//Rules\nab -> a\na ->. b")); } }