From 16426000ed88e138569d3bd92ec5e2b789ba2e56 Mon Sep 17 00:00:00 2001 From: asv Date: Mon, 31 Jan 2005 08:02:23 +0000 Subject: [PATCH] Fix for bug PAL7854: Editing() method is called on Main and Graph_Impl not BEFORE run() and stepBystep() commands, but inside of them. And if the dataflow is being executed - then it is NOT called. --- src/SUPERVGUI/SUPERVGUI.cxx | 66 +++++++++++++++----------------- src/SUPERVGUI/SUPERVGUI_Main.cxx | 47 ++++++----------------- src/SUPERVGUI/SUPERVGUI_Main.h | 3 +- 3 files changed, 42 insertions(+), 74 deletions(-) diff --git a/src/SUPERVGUI/SUPERVGUI.cxx b/src/SUPERVGUI/SUPERVGUI.cxx index 811600d..a294f89 100644 --- a/src/SUPERVGUI/SUPERVGUI.cxx +++ b/src/SUPERVGUI/SUPERVGUI.cxx @@ -478,62 +478,56 @@ bool SUPERVGUI::createDataflow( const NEW_DF_MODE mode ) { } void SUPERVGUI::reloadDataflow() { - Trace("SUPERVGUI::reloadDataflow") - if (main==0) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_RELOAD")); - } else { - main->sync(); - }; + Trace("SUPERVGUI::reloadDataflow"); + if ( main ) + main->sync(); + else + QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_RELOAD")); } void SUPERVGUI::runDataflow() { - Trace("SUPERVGUI::runDataflow") - if (main==0) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_RUN")); - } else { - main->Editing(); // PAL6170: GUI->Engine: setting "Editing" flag - main->run(); - }; + Trace("SUPERVGUI::runDataflow"); + if ( main ) + main->run( /*andSuspend=*/false ); + else + QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_RUN")); } void SUPERVGUI::stepByStep() { - Trace("SUPERVGUI::stepByStep") - if (main==0) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_RUN")); - } else { - main->Editing(); // PAL6170: GUI->Engine: setting "Editing" flag - main->startExecute(); - } + Trace("SUPERVGUI::stepByStep"); + if ( main ) + main->run( /*andSuspend=*/true ); + else + QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_RUN")); } void SUPERVGUI::killDataflow() { - Trace("SUPERVGUI::killDataflow") - if (main==0) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_KILL")); - } else { - main->kill(); - }; + Trace("SUPERVGUI::killDataflow"); + if ( main ) + main->kill(); + else + QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_KILL")); } void SUPERVGUI::suspendResumeDataflow() { - Trace("SUPERVGUI::suspendResumeDataflow") - if (main==0) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_SUSPEND")); - } else { - main->suspendResume(); - }; + Trace("SUPERVGUI::suspendResumeDataflow"); + if ( main ) + main->suspendResume(); + else + QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_SUSPEND")); } void SUPERVGUI::showComponents() { Trace("SUPERVGUI::showComponents"); - if (main==0) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_ADD")); - } else { - if (main->isEditable()) + if ( main ) { + if ( main->isEditable() ) main->addNode(); else QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOTEDITABLE")); } + else + QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_ADD")); + } diff --git a/src/SUPERVGUI/SUPERVGUI_Main.cxx b/src/SUPERVGUI/SUPERVGUI_Main.cxx index e731746..af9d705 100644 --- a/src/SUPERVGUI/SUPERVGUI_Main.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Main.cxx @@ -489,12 +489,17 @@ void SUPERVGUI_Main::onSubGraphClosed(QAD_StudyFrame* theStudyFrame) } } -void SUPERVGUI_Main::run() { +void SUPERVGUI_Main::run( const bool andSuspend ) { Trace("SUPERVGUI_Main::run"); - if ((SUPERV_isNull(dataflow))) return; + if ( SUPERV_isNull(dataflow) ) + return; - if (dataflow->IsEditing()) { - if (!dataflow->IsValid()) { + if ( dataflow->IsEditing() ) { // not currently Executing + + // asv 31.01.05 : fix for PAL7854, Editing moved from SUPERVGUI.cxx runDataflow(), stepByStep() to here.. + Editing(); // remove old executor, update GUI (all nodes to "No Status") + + if ( !dataflow->IsValid() ) { QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_DF_NOTVALID")); } else if (!dataflow->IsExecutable()) { @@ -505,7 +510,8 @@ void SUPERVGUI_Main::run() { } else { myRunTime = QDateTime::currentDateTime(); - if ( !dataflow->Run() ) { + const bool result = andSuspend ? dataflow->Start() : dataflow->Run(); + if ( !result ) { QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_DF_BADEXECUTE")); if ( dataflow->State() == SUPERV::ErrorState ) { kill(); @@ -522,37 +528,6 @@ void SUPERVGUI_Main::run() { } - -void SUPERVGUI_Main::startExecute() { - Trace("SUPERVGUI_Main::startExecute"); - if ((SUPERV_isNull(dataflow))) return; - - if (dataflow->IsEditing()) { - if (!dataflow->IsValid()) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_DF_NOTVALID")); - } - else if (!dataflow->IsExecutable()) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_DF_NOTEXECUTABLE")); - } - else if (myCanvasView->isAnyLinkCreating()) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CRL_NOTCOMPLETE")); - } - else { - myRunTime = QDateTime::currentDateTime(); - if (!dataflow->Start()) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_DF_BADEXECUTE")); - } - else { - myThread->startThread(tr("MSG_GRAPH_STARTED")); - } - } - } - else { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_DF_RUNNING")); - } -} - - void SUPERVGUI_Main::kill() { Trace("SUPERVGUI_Main::kill"); if ((SUPERV_isNull(dataflow))) diff --git a/src/SUPERVGUI/SUPERVGUI_Main.h b/src/SUPERVGUI/SUPERVGUI_Main.h index 134bbb5..db76c9c 100644 --- a/src/SUPERVGUI/SUPERVGUI_Main.h +++ b/src/SUPERVGUI/SUPERVGUI_Main.h @@ -58,8 +58,7 @@ class SUPERVGUI_Main: public SUPERVGraph_View { SUPERVGUI_Main(SUPERVGraph_ViewFrame*, QAD_Desktop*, SUPERV_Graph); virtual ~SUPERVGUI_Main(); - void run(); - void startExecute(); + void run( const bool andSuspend ); void kill(); void suspendResume(); //void stopRestart(); -- 2.39.2