-#include "SourceItem.h"
+#include "StimuliItem.h"
#include "GroupScene.h"
#include "ConnectionItem.h"
#include "InterfaceItem.h"
#include "Graph.h"
-SourceItem::SourceItem(AbstractBlock *_refBlock,
+StimuliItem::StimuliItem(AbstractBlock *_refBlock,
Dispatcher *_dispatcher,
Parameters *_params) throw(Exception) : AbstractBoxItem( _refBlock, _dispatcher, _params) {
//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;
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);
}
}
-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);
update();
}
-void SourceItem::updateMinimumSize() {
+void StimuliItem::updateMinimumSize() {
int maxSouth = 0;
int maxNorth = 0;
/* updateGeometry() :
*/
-bool SourceItem::updateGeometry(ChangeType type) {
+bool StimuliItem::updateGeometry(ChangeType type) {
currentPosition = pos();
//cout << "current pos of block: " << currentPosition.x() << "," << currentPosition.y() << endl;
return false;
}
-void SourceItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
+void StimuliItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
if(params->editState == Parameters::EditBlockMove) {
QPointF absPos = currentPosition + originPoint;
}
}
-void SourceItem::mousePressEvent(QGraphicsSceneMouseEvent *event) {
+void StimuliItem::mousePressEvent(QGraphicsSceneMouseEvent *event) {
QPointF pos = event->pos();
qreal x = pos.x();
}
}
-void SourceItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
+void StimuliItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
//setZValue(zValue()-100);
QGraphicsItem::mouseReleaseEvent(event);
}
-void SourceItem::hoverMoveEvent(QGraphicsSceneHoverEvent * event) {
+void StimuliItem::hoverMoveEvent(QGraphicsSceneHoverEvent * event) {
QPointF pos = event->pos();
qreal x = pos.x();
}
-void SourceItem::contextMenuEvent(QGraphicsSceneContextMenuEvent * event) {
+void StimuliItem::contextMenuEvent(QGraphicsSceneContextMenuEvent * event) {
event->accept();
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){
}
}
-void SourceItem::load(QDomElement funcElement) throw(Exception) {
+void StimuliItem::load(QDomElement funcElement) throw(Exception) {
bool ok = false;
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.
*/
updateGeometry(Resize);
}
-void SourceItem::save(QXmlStreamWriter &writer) {
+void StimuliItem::save(QXmlStreamWriter &writer) {
writer.writeStartElement("source_item");