X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2Fgenericgui%2FGuiEditor.cxx;h=7c06ea53b7e260e235a36f678c84b7aa1a54c4cc;hb=b68ec0b66862adf39404d95ceddc736d1cc97dcc;hp=45dc0e33b13bfe305a1d17a7fd5a40f000ebfb43;hpb=216c15bc1ec59372c7313d273cc0fa1d206a68d4;p=modules%2Fyacs.git diff --git a/src/genericgui/GuiEditor.cxx b/src/genericgui/GuiEditor.cxx index 45dc0e33b..7c06ea53b 100644 --- a/src/genericgui/GuiEditor.cxx +++ b/src/genericgui/GuiEditor.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2006-2014 CEA/DEN, EDF R&D +// Copyright (C) 2006-2019 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -269,7 +269,7 @@ void GuiEditor::CreateContainer() DEBTRACE("GuiEditor::CreateContainer"); SubjectProc *sproc = QtGuiContext::getQtCurrent()->getSubjectProc(); YASSERT(sproc); - SubjectContainer *scont = 0; + SubjectContainerBase *scont = 0; while (!scont) { std::stringstream name; @@ -281,6 +281,23 @@ void GuiEditor::CreateContainer() } } +void GuiEditor::CreateHPContainer() +{ + DEBTRACE("GuiEditor::CreateHPContainer"); + SubjectProc *sproc = QtGuiContext::getQtCurrent()->getSubjectProc(); + YASSERT(sproc); + SubjectContainerBase *scont = 0; + while (!scont) + { + std::stringstream name; + long newid = GuiContext::getCurrent()->getNewId(); + if (newid > 100000) break; + name.str(""); + name << "container" << newid; + scont = sproc->addHPContainer(name.str()); + } +} + void GuiEditor::CreateComponentInstance() { DEBTRACE("GuiEditor::CreateComponentInstance"); @@ -372,7 +389,7 @@ SubjectDataPort* GuiEditor::CreateOutputPort(SubjectElementaryNode* seNode, /*! * Subject shrink or expand, command from popup menu: needs a valid selection */ -void GuiEditor::shrinkExpand() { +void GuiEditor::shrinkExpand(Qt::KeyboardModifiers kbModifiers) { DEBTRACE("GuiEditor::shrinkExpand"); Subject* sub = QtGuiContext::getQtCurrent()->getSelectedSubject(); @@ -393,12 +410,14 @@ void GuiEditor::shrinkExpand() { return; }; - if (sni->isExpanded()) { - sni->setExpanded(false); - } else { - sni->setExpanded(true); - }; - sni->reorganizeShrinkExpand(); + ShrinkMode aShrinkMode = CurrentNode; + if (kbModifiers == Qt::ControlModifier) { + aShrinkMode = ElementaryNodes; + } else if (kbModifiers == (Qt::ShiftModifier|Qt::ControlModifier)) { + aShrinkMode = ChildrenNodes; + } + + sni->reorganizeShrinkExpand(aShrinkMode); sni->showOutScopeLinks(); sni->updateLinks(); } @@ -437,6 +456,8 @@ void GuiEditor::DeleteSubject(Subject* parent, toRemove->askRegisterUndoDestroy(); if(!parent->destroy(toRemove)) Message mess; + // Empty the clipboard in order to avoid the copy of a destroyed object. + QtGuiContext::getQtCurrent()->setSubjectToCopy(NULL); } void GuiEditor::CutSubject() @@ -695,7 +716,7 @@ void GuiEditor::showRedo(QWidget *parent) QString GuiEditor::asciiFilter(const QString & name) { DEBTRACE(name.toStdString()); - string aName = name.toAscii().data(); + string aName = name.toLatin1().data(); DEBTRACE(aName); for (int i=0; i < aName.size(); i++) {