From 59cec9385614841e78e6a5e5cc7813f15ed3bede Mon Sep 17 00:00:00 2001 From: mkr Date: Mon, 23 Jan 2006 08:55:06 +0000 Subject: [PATCH] Additional fix for PAL8060 (restore ports values if ports' name and ports' type were not changed). --- src/SUPERVGUI/SUPERVGUI_ManagePortsDlg.cxx | 29 +++++++++++++++++----- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/SUPERVGUI/SUPERVGUI_ManagePortsDlg.cxx b/src/SUPERVGUI/SUPERVGUI_ManagePortsDlg.cxx index 10eafd7..cd81664 100644 --- a/src/SUPERVGUI/SUPERVGUI_ManagePortsDlg.cxx +++ b/src/SUPERVGUI/SUPERVGUI_ManagePortsDlg.cxx @@ -340,6 +340,8 @@ void SUPERVGUI_ManagePortsDlg::accept() { // oldPorts list should be filtered to include only Input Ports. // But I'll filter Gate-s as well.. bool isAnyLinked = false; // check if any port from old ports is linked + // map PortName <-> (PortType, PortInputValue) for non linked input ports, which have input + QMap< QString, QPair< QString,QString > > InNameInput; QObjectList portsToRemove; while ( (obj = it.current()) != 0 ) { ++it; @@ -350,6 +352,10 @@ void SUPERVGUI_ManagePortsDlg::accept() { // check if port has a link (output porst of Loop node are also checked) if ( !aPort->IsGate() && aPort->IsLinked() && !isAnyLinked) isAnyLinked = true; + // check if input port has an input value + if ( !aPort->IsGate() && aPort->IsInput() && aPort->HasInput() ) + InNameInput.insert( QString(aPort->Name()), + QPair(QString(aPort->Type()),QString(aPort->ToString())) ); } delete oldPorts; // delete the list, not the objects @@ -404,12 +410,23 @@ void SUPERVGUI_ManagePortsDlg::accept() { for ( i = 0; i < myInList->count(); i++ ) { item = (PortListItem*)myInList->item( i ); aPort = aINode->InPort( item->PortName.latin1(), item->PortType.latin1() ); - myNode->createPort( aPort.in() ); - - // mkr : PAL8060 - if ( !InPortsL.isEmpty() && !OutPortsL.isEmpty() ) - // create links for those input ports, which had links earlier - createLinkEngine( aPort, InPortsL, OutPortsL ); + if ( InNameInput.contains( item->PortName ) + && + item->PortType.compare(InNameInput[item->PortName].first) == 0 ) { + // i.e. aPort is input and had a value (not linked!) + // if ports' name and type didn't change and ports had an input value => set this value again + SUPERVGUI* aSupMod = SUPERVGUI::Supervision(); + if ( aSupMod ) + aPort->Input( aSupMod->getEngine()->StringValue( InNameInput[item->PortName].second ) ); + myNode->createPort( aPort.in() ); + } + else { + myNode->createPort( aPort.in() ); + // mkr : PAL8060 + if ( !InPortsL.isEmpty() && !OutPortsL.isEmpty() ) + // create links for those input ports, which had links earlier + createLinkEngine( aPort, InPortsL, OutPortsL ); + } } if ( isLoop ) { -- 2.39.2