#ifndef SHDESIGNERVIEW_H
#define SHDESIGNERVIEW_H

#include "blockview.h"
#include "core.h"


class SHDesignerView: public BlockView {
	Q_OBJECT
public:
	explicit SHDesignerView(QWidget * parent = 0);
	~SHDesignerView();
	
	QByteArray save();
	void load(const QByteArray & data);
	
	void setUniqueName(BlockItem * block);
	void traceBus(QPoint scene_pos_from, QPoint scene_pos_to, BlockBusItem * bus);
	
protected:
	virtual void dragEnterEvent(QDragEnterEvent * e);
	virtual void dragMoveEvent(QDragMoveEvent * e);
	virtual void dragLeaveEvent(QDragLeaveEvent * e);
	virtual void dropEvent(QDropEvent * e);
	virtual void loadBus(BlockBusItem * bus) {SHCORE->databaseStorage().loadBus(bus);}
	virtual void copyBlocks(QList<BlockItem * > items, QPointF offset);
	virtual void copyBuses(QList<BlockBusItem * > items, QPointF offset);
	
public slots:
	void changedDB();
	void updateFileWatcher();
	
signals:
	void changedScheme();
	void newBlockRequest(int id, int source, QPoint view_pos);
	
};

#endif // SHDESIGNERVIEW_H
