Salome HOME
SALOME PAL V1_4_1
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI_Port.cxx
index 335d05063864f6cd5d7e766bc273024b5be38768..40fbd64ba49dd5d4939065d07e0115ac3856293c 100644 (file)
@@ -70,7 +70,15 @@ SUPERVGUI_Port::SUPERVGUI_Port(QWidget* parent, SUPERVGUI_Main* m, SUPERV_Port p
     mySketchItem = popup->insertItem(tr("MSG_SKETCH_LINK"), this, SLOT(sketchLink()));
     popup->insertSeparator();
   }
-  if (port->IsInLine()) {
+  //for Loop Node: enable "Delete" popup item only for the input port 
+  if ( ( port->IsInLine() 
+        && 
+        ( port->Node()->Kind()!=SUPERV::EndLoopNode )
+         &&
+         !( port->Node()->Kind()==SUPERV::LoopNode && !port->IsInput() )
+       )
+       ||
+       ( port->IsEndSwitch() && port->IsInput())) {
     myDelItem = popup->insertItem(tr("ITM_DEL_PORT"), this, SLOT(deletePort()));    
   }
   connect(this, SIGNAL(MousePress(QMouseEvent*)), this, SLOT(showPopup(QMouseEvent*)));  
@@ -335,10 +343,16 @@ void SUPERVGUI_PortOut::updateStudy() {
 
 void SUPERVGUI_PortOut::toStudy() {
     Trace("SUPERVGUI_PortOut::toStudy")
-      if (!main->isFromStudy()) {
-       if (main->addStudy()) main->setAsFromStudy(true);
-      }
-    if (!main->getStudy()->getStudyDocument()->GetProperties()->IsLocked()) study = !study;
+
+    if (main->getStudy()->getStudyDocument()->GetProperties()->IsLocked()) {
+      QMessageBox::warning(QAD_Application::getDesktop(), tr("WRN_WARNING"), tr("WRN_STUDY_LOCKED"));
+      return;
+    }
+
+    if (!main->isFromStudy()) {
+      if (main->addStudy()) main->setAsFromStudy(true);
+    }
+    study = !study;
     sync();
 }
 
@@ -395,7 +409,7 @@ void SUPERVGUI_PortOut::deleteLinks() {
 
 
 
-//***********************************************************
+// ----------------------------
 // Input Port of EndSwitch Node
 // ----------------------------
 SUPERVGUI_PortInESNode::SUPERVGUI_PortInESNode(QWidget* parent, SUPERVGUI_Main* m, SUPERV_Port p)
@@ -406,9 +420,9 @@ SUPERVGUI_PortInESNode::SUPERVGUI_PortInESNode(QWidget* parent, SUPERVGUI_Main*
 
   bool editing = port->IsInput() && ( !port->IsLinked() ); //main->isEditable();
   if ((!port->IsGate())  && editing ) {
-    psc = popup->insertItem(tr("MSG_SETVALUE"),      this, SLOT(setInput()));
+    psc = popup->insertItem(tr("MSG_SETVALUE"),this, SLOT(setInput()));
   }
-  browser = popup->insertItem(tr("MSG_BROWSE"),         this, SLOT(browse()));
+  browser = popup->insertItem(tr("MSG_BROWSE"),this, SLOT(browse()));
 }
 
 SUPERVGUI_PortInESNode::~SUPERVGUI_PortInESNode() {