enum BorderType { NoBorder = 0, BorderEast, BorderNorth, BorderWest, BorderSouth, CornerSouthEast, Title};
enum ChangeType { Resize = 0, InterfaceMove };
+ enum LockType { NoLock = 0, Position = 1, Dimension = 2, Interfaces = 4, Names = 8};
- AbstractBoxItem(AbstractBlock *_refBlock, Dispatcher *_dispatcher, Parameters *_params, QGraphicsItem* parent = Q_NULLPTR);
- AbstractBoxItem(Dispatcher *_dispatcher, Parameters *_params, QGraphicsItem* parent = Q_NULLPTR);
+ AbstractBoxItem(AbstractBlock *_refBlock, Dispatcher *_dispatcher, Parameters *_params, LockType _lock = NoLock, QGraphicsItem* parent = Q_NULLPTR);
+ AbstractBoxItem(Dispatcher *_dispatcher, Parameters *_params, LockType _lock = NoLock, QGraphicsItem* parent = Q_NULLPTR);
virtual ~AbstractBoxItem();
void setWishboneVisible(bool b);
void setDimension(int x, int y);
inline void setCurrentInterface(InterfaceItem* iface) { currentInterface = iface; }
+ inline void setLock(int _lock) { lock = _lock; }
+ inline void lockPosition() { lock = lock | Position; }
+ inline void unlockPosition() { lock = (lock&Position)^lock; }
+ inline void lockDimension() { lock = lock | Dimension; }
+ inline void unlockDimension() { lock = (lock&Dimension)^lock; }
+ inline void lockInterfaces() { lock = lock | Interfaces; }
+ inline void unlockInterfaces() { lock = (lock&Interfaces)^lock; }
+ inline void lockNames() { lock = lock | Names; }
+ inline void unlockNames() { lock = (lock&Names)^lock; }
// testers
virtual bool isBoxItem();
inline bool isRstClkVisible(){ return rstClkVisible;}
inline bool isWishboneVisible(){ return wishboneVisible;}
bool isInterfaces(int orientation) const;
-
+ inline bool isPositionLock() { return (lock&Position)!=0?true:false; }
+ inline bool isDimensionLock() { return (lock&Dimension)!=0?true:false; }
+ inline bool isInterfacesLock() { return (lock&Interfaces)!=0?true:false; }
+ inline bool isNamesLock() { return (lock&Names)!=0?true:false; }
// others
QRectF boundingRectInScene();
virtual void nameChanged() = 0; // called when an interface or box name have changed
int ifaceMargin; // the margin around each side of interfaces' name
QPointF originPoint; // the left-top point that is the origin of the bounding box, in the item coordinates
+ int lock;
bool selected;
bool rstClkVisible; //! true if clock/reset interfaces are visible
bool wishboneVisible; //! true if wishbone interfaces are visible