From ba259e92d52389c6acdca997e379785a15551ee0 Mon Sep 17 00:00:00 2001 From: asv Date: Mon, 7 Feb 2005 06:27:21 +0000 Subject: [PATCH] Fixed for bug PAL7960: calling Editing() in Main was moved "closer" to certain actions (in AddNode, only when "Add node" button is pressed but not before dialog was opened, etc.). --- src/SUPERVGUI/SUPERVGUI_Clipboard.cxx | 13 ++++++++++--- src/SUPERVGUI/SUPERVGUI_Main.cxx | 10 +++++----- src/SUPERVGUI/SUPERVGUI_Service.cxx | 8 ++++++-- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/SUPERVGUI/SUPERVGUI_Clipboard.cxx b/src/SUPERVGUI/SUPERVGUI_Clipboard.cxx index d286581..4f20f9f 100644 --- a/src/SUPERVGUI/SUPERVGUI_Clipboard.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Clipboard.cxx @@ -136,9 +136,12 @@ QStringList getAllFunctions( SUPERV::Graph_var dataflow ) { void SUPERVGUI_Clipboard::pasteNode() { Trace("SUPERVGUI_Main::pasteNode"); SUPERV::CNode_var aNode = getCopyNode(); - if ( !CORBA::is_nil( aNode ) ) { + SUPERVGUI_Main* aMain = Supervision.getMain(); + if ( !CORBA::is_nil( aNode ) && aMain ) { - SUPERV::Graph_var dataflow = Supervision.getMain()->getDataflow(); + aMain->Editing(); // PAL6170: GUI->Engine: setting "Editing" flag, why here? -> PAL7960 + + SUPERV::Graph_var dataflow = aMain->getDataflow(); switch ( aNode->Kind() ) { @@ -361,7 +364,11 @@ void SUPERVGUI_Clipboard::pasteNode() { void SUPERVGUI_Clipboard::pastePort( SUPERVGUI_CanvasNode* node ) { SUPERV::Port_var aPort = getCopyPort(); - if ( !CORBA::is_nil(aPort) ) { + SUPERVGUI_Main* aMain = Supervision.getMain(); + if ( !CORBA::is_nil(aPort) && aMain ) { + + aMain->Editing(); // PAL6170: GUI->Engine: setting "Editing" flag, why here? -> PAL7960 + SUPERV::INode_var aNode = node->getInlineNode(); if (!CORBA::is_nil(aNode)) { QString aName = aPort->Name(); diff --git a/src/SUPERVGUI/SUPERVGUI_Main.cxx b/src/SUPERVGUI/SUPERVGUI_Main.cxx index 6facd78..d69ac8f 100644 --- a/src/SUPERVGUI/SUPERVGUI_Main.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Main.cxx @@ -335,14 +335,15 @@ void SUPERVGUI_Main::insertFile() { Trace("SUPERVGUI_Main::insertFile"); if ((SUPERV_isNull(dataflow))) return; - Editing(); // PAL6170: GUI->Engine: setting "Editing" flag - QString f = QAD_FileDlg::getFileName(QAD_Application::getDesktop(), "", "*.xml", tr("MSG_GRAPH_INSERT"), true); - if (!f.isEmpty()) { + if ( !f.isEmpty() ) { // not Cancel, but "OK" was pressed with valid file name + + Editing(); // PAL6170: GUI->Engine: setting "Editing" flag, why here? -> see 7960 + if (dataflow->Import(f.latin1())) { if (myCurrentView == CANVASTABLE) { myArray->destroy(); @@ -607,8 +608,7 @@ void SUPERVGUI_Main::addNode() { kill(); } - Editing(); // PAL6170: GUI->Engine: setting "Editing" flag - + //Editing(); // PAL6170: GUI->Engine: setting "Editing" flag, commented: PAL7960 Supervision.getBrowser()->choose(); } diff --git a/src/SUPERVGUI/SUPERVGUI_Service.cxx b/src/SUPERVGUI/SUPERVGUI_Service.cxx index 2bd8191..953784f 100644 --- a/src/SUPERVGUI/SUPERVGUI_Service.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Service.cxx @@ -945,9 +945,13 @@ SUPERVGUI_EditPythonDlg::SUPERVGUI_EditPythonDlg( bool isLoop ) * PS theEndNode is passed only for Loop and Switch nodes (EndLoop and EndSwitch) */ void SUPERVGUI_Service::addNode( SUPERV::CNode_var theNode, SUPERV::INode_var theEndNode, int& theX, int& theY ) { - if ( !CORBA::is_nil( theNode ) ) { + SUPERVGUI_Main* aMain = Supervision.getMain(); + + if ( !CORBA::is_nil( theNode ) && aMain ) { + + aMain->Editing(); // PAL6170: GUI->Engine: setting "Editing" flag, why here? -> PAL7960 + int cx, cy; //to appear a new node in the top-left corner of the current viewport - SUPERVGUI_Main* aMain = Supervision.getMain(); //2.8 point of improvements: Adding node to graph window with taking into account zoom factor QWMatrix aWM = aMain->getCanvasView()->worldMatrix(); -- 2.39.2