-void GroupScene::createConnectionItem(InterfaceItem *iface1, InterfaceItem *iface2) {
- ConnectionItem* conn = new ConnectionItem(iface1,iface2, dispatcher, params, groupItem);
+SourceItem *GroupScene::createSourceItem(AbstractBlock *block) {
+
+ SourceItem* item = new SourceItem(block,dispatcher,params);
+ // adding item to the scene
+ addItem(item);
+ item->setZValue(1);
+ // add item from the QList
+ sourceItems.append(item);
+ // center the new block
+ QPointF groupPos = groupItem->pos();
+ QPointF newPos(groupPos.x()-item->getTotalWidth()-50, groupPos.y());
+ newPos = newPos-item->getOriginPoint();
+ item->moveTo(newPos);
+ return item;
+}
+
+void GroupScene::addSourceItem(SourceItem* item) {
+ // add item from the QList
+ sourceItems.append(item);
+}
+
+void GroupScene::removeSourceItem(SourceItem* item) {
+ // remove item from the viewport
+ removeItem(item);
+ // remove item from the QList
+ sourceItems.removeAll(item);
+}
+
+void GroupScene::createConnectionItem(InterfaceItem *iface1, InterfaceItem *iface2, bool withinGroup) {
+ ConnectionItem* conn = NULL;
+ if (withinGroup) {
+ conn = new ConnectionItem(iface1,iface2, dispatcher, params, groupItem);
+ }
+ else {
+ conn = new ConnectionItem(iface1,iface2, dispatcher, params, NULL);
+ addItem(conn);
+ }