[Uml-devel] branches/work/soc-umbrello/umbrello
Andi Fischer
andi.fischer at hispeed.ch
Sun Apr 29 19:04:34 UTC 2012
SVN commit 1292273 by fischer:
Differences to trunk reduced.
M +23 -13 clipboard/umlclipboard.cpp
M +9 -0 umlscene.cpp
M +2 -4 umlscene.h
--- branches/work/soc-umbrello/umbrello/clipboard/umlclipboard.cpp #1292272:1292273
@@ -106,7 +106,6 @@
itemsSelected.clear();
//For each selected view select all the Actors, USe Cases and Concepts
//widgets in the ListView
- // [PORT]
foreach (UMLView* view, m_ViewList ) {
UMLObjectList objects = view->umlScene()->umlObjects();
foreach (UMLObject* o, objects ) {
@@ -537,7 +536,8 @@
return false;
}
- if( diagramType != UMLApp::app()->currentView()->umlScene()->type() ) {
+ UMLScene *currentScene = UMLApp::app()->currentView()->umlScene();
+ if( diagramType != currentScene->type() ) {
if( !checkPasteWidgets(widgets) ) {
while ( !assocs.isEmpty() ) {
delete assocs.takeFirst();
@@ -561,38 +561,48 @@
//now add any widget we are want to paste
bool objectAlreadyExists = false;
- // [PORT]
- UMLView *currentView = UMLApp::app()->currentView();
- // [PORT]
- currentView->umlScene()->beginPartialWidgetPaste();
+ currentScene->beginPartialWidgetPaste();
foreach ( UMLWidget* widget, widgets ) {
Uml::IDType oldId = widget->id();
Uml::IDType newId = idchanges->findNewID(oldId);
- if (currentView->umlScene()->findWidget(newId)) {
+ // how should findWidget find ::None id, which is returned for the first entry ?
+ if (currentScene->findWidget(newId)) {
uError() << "widget (oldID=" << ID2STR(oldId) << ", newID="
<< ID2STR(newId) << ") already exists in target view.";
widgets.removeAll(widget);
delete widget;
objectAlreadyExists = true;
- } else if (! currentView->umlScene()->addWidget(widget, true)) {
- currentView->umlScene()->endPartialWidgetPaste();
+ } else {
+ if (currentScene->type() == Uml::DiagramType::Activity ||
+ currentScene->type() == Uml::DiagramType::State) {
+ widget->setID(doc->assignNewID(widget->id()));
+ }
+ if (! currentScene->addWidget(widget, true)) {
+ currentScene->endPartialWidgetPaste();
return false;
}
}
+ }
//now paste the associations
foreach ( AssociationWidget* assoc, assocs ) {
- if (!currentView->umlScene()->addAssociation(assoc, true)) {
- currentView->umlScene()->endPartialWidgetPaste();
+ if (!currentScene->addAssociation(assoc, true)) {
+ currentScene->endPartialWidgetPaste();
return false;
}
}
+ currentScene->clearSelected();
+ currentScene->selectWidgets(widgets);
+ foreach ( AssociationWidget* assoc, assocs ) {
+ currentScene->selectWidgetsOfAssoc(assoc);
+ }
+
//Activate all the pasted associations and widgets
- currentView->umlScene()->activate();
- currentView->umlScene()->endPartialWidgetPaste();
+ currentScene->activate();
+ currentScene->endPartialWidgetPaste();
/*
UMLListView *listView = UMLApp::app()->listView();
--- branches/work/soc-umbrello/umbrello/umlscene.cpp #1292272:1292273
@@ -1622,6 +1622,15 @@
}
/**
+ * Selects all the widgets from a list.
+ */
+void UMLScene::selectWidgets(UMLWidgetList &widgets)
+{
+ foreach (UMLWidget* widget, widgets)
+ makeSelected(widget);
+}
+
+/**
* Paint diagram to the paint device
*/
void UMLScene::getDiagram(const UMLSceneRect &rect, QPixmap & diagram)
--- branches/work/soc-umbrello/umbrello/umlscene.h #1292272:1292273
@@ -181,9 +181,7 @@
void removeWidget(UMLWidget *o);
void setSelected(UMLWidget *w, UMLSceneMouseEvent *me);
-
UMLWidgetList selectedWidgets() const;
-
void clearSelected();
void moveSelectedBy(UMLSceneValue dX, UMLSceneValue dY);
@@ -297,6 +295,8 @@
void addObject(UMLObject *object);
void selectWidgets(UMLSceneValue px, UMLSceneValue py, UMLSceneValue qx, UMLSceneValue qy);
+ void selectWidgets(UMLWidgetList &widgets);
+ void selectWidgetsOfAssoc (AssociationWidget * a);
ObjectWidget * onWidgetLine(const UMLScenePoint &point) const;
ObjectWidget * onWidgetDestructionBox(const UMLScenePoint &point) const;
@@ -373,8 +373,6 @@
bool m_isMouseMovingItems;
bool isArrowMode();
- void selectWidgetsOfAssoc (AssociationWidget * a);
-
UMLSceneRect diagramRect();
void makeSelected(UMLWidget* uw);
More information about the umbrello-devel
mailing list