X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/3bcfe4df6fdde086eb1b59f7a0173358170174a1:/SourceItem.cpp..8fb3c55ee009a11db5e1c08a4cfb286979412745:/StimuliItem.cpp?ds=sidebyside diff --git a/SourceItem.cpp b/StimuliItem.cpp similarity index 95% rename from SourceItem.cpp rename to StimuliItem.cpp index 0229e7f..dff5247 100644 --- a/SourceItem.cpp +++ b/StimuliItem.cpp @@ -1,4 +1,4 @@ -#include "SourceItem.h" +#include "StimuliItem.h" #include "GroupScene.h" #include "ConnectionItem.h" #include "InterfaceItem.h" @@ -15,7 +15,7 @@ #include "Graph.h" -SourceItem::SourceItem(AbstractBlock *_refBlock, +StimuliItem::StimuliItem(AbstractBlock *_refBlock, Dispatcher *_dispatcher, Parameters *_params) throw(Exception) : AbstractBoxItem( _refBlock, _dispatcher, _params) { @@ -39,7 +39,7 @@ SourceItem::SourceItem(AbstractBlock *_refBlock, //cout << "pos in group: " << x() << "," << y() << endl; } -SourceItem::SourceItem(Dispatcher *_dispatcher, Parameters *_params) throw(Exception) : AbstractBoxItem(_dispatcher, _params) { +StimuliItem::StimuliItem(Dispatcher *_dispatcher, Parameters *_params) throw(Exception) : AbstractBoxItem(_dispatcher, _params) { refBlock = NULL; currentBorder = NoBorder; @@ -52,10 +52,10 @@ SourceItem::SourceItem(Dispatcher *_dispatcher, Parameters *_params) throw(Excep boxHeight = params->defaultBlockHeight; } -SourceItem::~SourceItem() { +StimuliItem::~StimuliItem() { } -void SourceItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { +void StimuliItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { QPen pen(Qt::black, 3); if(selected) pen.setColor(Qt::red); @@ -71,16 +71,16 @@ void SourceItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option } } -void SourceItem::moveTo(QPointF dest) { +void StimuliItem::moveTo(QPointF dest) { setPos(dest); currentPosition = dest; } -bool SourceItem::isSourceItem() { +bool StimuliItem::isStimuliItem() { return true; } -void SourceItem::nameChanged() { +void StimuliItem::nameChanged() { QFontMetrics fmId(params->defaultBlockFont); @@ -91,7 +91,7 @@ void SourceItem::nameChanged() { update(); } -void SourceItem::updateMinimumSize() { +void StimuliItem::updateMinimumSize() { int maxSouth = 0; int maxNorth = 0; @@ -149,7 +149,7 @@ void SourceItem::updateMinimumSize() { /* updateGeometry() : */ -bool SourceItem::updateGeometry(ChangeType type) { +bool StimuliItem::updateGeometry(ChangeType type) { currentPosition = pos(); //cout << "current pos of block: " << currentPosition.x() << "," << currentPosition.y() << endl; @@ -212,7 +212,7 @@ bool SourceItem::updateGeometry(ChangeType type) { return false; } -void SourceItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { +void StimuliItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { if(params->editState == Parameters::EditBlockMove) { QPointF absPos = currentPosition + originPoint; @@ -303,7 +303,7 @@ void SourceItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { } } -void SourceItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { +void StimuliItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { QPointF pos = event->pos(); qreal x = pos.x(); @@ -366,7 +366,7 @@ void SourceItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { } } -void SourceItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { +void StimuliItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { //setZValue(zValue()-100); @@ -415,7 +415,7 @@ void SourceItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { QGraphicsItem::mouseReleaseEvent(event); } -void SourceItem::hoverMoveEvent(QGraphicsSceneHoverEvent * event) { +void StimuliItem::hoverMoveEvent(QGraphicsSceneHoverEvent * event) { QPointF pos = event->pos(); qreal x = pos.x(); @@ -485,7 +485,7 @@ void SourceItem::hoverMoveEvent(QGraphicsSceneHoverEvent * event) { } -void SourceItem::contextMenuEvent(QGraphicsSceneContextMenuEvent * event) { +void StimuliItem::contextMenuEvent(QGraphicsSceneContextMenuEvent * event) { event->accept(); @@ -539,17 +539,17 @@ void SourceItem::contextMenuEvent(QGraphicsSceneContextMenuEvent * event) { if(selectedAction == NULL) return ; if (selectedAction == removeAction) { - dispatcher->removeSourceItem(Dispatcher::Design, this); + dispatcher->removeStimuliItem(Dispatcher::Design, this); } else if (selectedAction == duplicateAction) { - dispatcher->duplicateSourceItem(Dispatcher::Design, this); + dispatcher->duplicateStimuliItem(Dispatcher::Design, this); } else if(selectedAction == renameAction){ if(ifaceItem != NULL) { dispatcher->renameInterface(Dispatcher::Design, ifaceItem); } else { - dispatcher->renameSourceBlock(Dispatcher::Design, this); + dispatcher->renameStimuliItem(Dispatcher::Design, this); } } else if(selectedAction == showProperties){ @@ -563,7 +563,7 @@ void SourceItem::contextMenuEvent(QGraphicsSceneContextMenuEvent * event) { } } -void SourceItem::load(QDomElement funcElement) throw(Exception) { +void StimuliItem::load(QDomElement funcElement) throw(Exception) { bool ok = false; @@ -614,7 +614,7 @@ void SourceItem::load(QDomElement funcElement) throw(Exception) { reference = referenceMd5; } - FunctionalBlock* functionalBlock = params->getGraph()->createSourceBlock(reference); + FunctionalBlock* functionalBlock = params->getGraph()->createStimuliBlock(reference); /* NB: createSourceBlock creates all interfaces from the reference, which is annoying when reading bif_iface tags. Thus interface are all removed. */ @@ -706,7 +706,7 @@ void SourceItem::load(QDomElement funcElement) throw(Exception) { updateGeometry(Resize); } -void SourceItem::save(QXmlStreamWriter &writer) { +void StimuliItem::save(QXmlStreamWriter &writer) { writer.writeStartElement("source_item");