X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/14cd6d834ab531525a51c6a6992583b3e9143e02..4327c2b8817b627249d98d889835726217c81a4e:/Dispatcher.h?ds=inline diff --git a/Dispatcher.h b/Dispatcher.h index 807c3bb..425c158 100644 --- a/Dispatcher.h +++ b/Dispatcher.h @@ -15,7 +15,7 @@ class GroupScene; class AbstractBoxItem; class GroupItem; class BoxItem; -class SourceItem; +class StimuliItem; class ConnectionItem; class InterfaceItem; class GroupBlock; @@ -36,57 +36,74 @@ using namespace Qt; class Dispatcher { public: + /*! + * \brief The Context enum + * Some methods are called while creating a design from scratch or when loading + * a desgin from a project file previously saved. Thus, their behavior may change + * according to the situation. Context is used to specifiy the situation. + * Must be always specified. + */ + enum Context {AnyContext = 0, Design = 1, Load = 2 }; + Dispatcher(Parameters* _params, MainWindow* _window); GroupWidget* loadProject(const QString& filename); - inline int getNumberOfScenes() { return groupList.length(); } - - void unselectAllItems(int direction=0); - void setCurrentGroupWidget(GroupWidget *win); - void changeConnectionMode(int mode = -1); - - - GroupWidget* createTopScene(); - GroupWidget* createChildScene(GroupWidget* parentWidget, BoxItem* upperItemOfGroupItem = NULL); - void destroyScene(GroupScene* scene); - void showRaiseWindow(BoxItem *item); - void showRstClkIface(AbstractBoxItem *item); - void showWishboneIface(AbstractBoxItem *item); - GroupWidget *addNewEmptyGroup(GroupScene *scene, bool show = true); - void addNewFullGroup(); - inline GroupWidget* getCurrentGroup() { return currentGroup; } - - inline void setSceneCounter(int value) { sceneCounter = value;} bool isCurrentProject; -public slots: - - // graph ops - QMap getAllGroupNames(); - void generateVHDL() throw(Exception); - - // scene ops + /************************** + * scene ops + *************************/ + // getters GroupScene* getSceneById(int id); GroupScene* getSceneByName(QString name); BoxItem* getBoxItemById(int id); GroupItem* getGroupItemById(int id); InterfaceItem* getInterfaceItemById(int id); - - - // block ops - BoxItem* addBlock(int idCategory, int idBlock, int idScene); - void removeBoxItem(BoxItem* item); - void duplicateBoxItem(BoxItem* item); - void renameFunctionalBlock(BoxItem* item); - void generateBlockVHDL(BoxItem* item); - void renameGroupBlock(GroupItem* item); - void renameSourceBlock(SourceItem* item); - void removeSourceItem(SourceItem* item); - void duplicateSourceItem(SourceItem* item); + inline GroupWidget* getCurrentGroup() { return currentGroupWidget; } + inline int getNumberOfScenes() { return groupList.length(); } + // setters + void showRaiseWindow(Context context, BoxItem *item); + void showRstClkIface(Context context, AbstractBoxItem *item); + void showWishboneIface(Context context, AbstractBoxItem *item); + void unselectAllItems(Context context, int direction=0); + void setCurrentGroupWidget(Context context, GroupWidget *win); + void changeConnectionMode(Context context, int mode = -1); + void setSceneCounter(Context context, int value); + // testers + // others + GroupWidget* createTopScene(Context context, double mainClock = 0.0); + GroupWidget* createChildScene(Context context, GroupWidget* parentWidget, BoxItem* upperItemOfGroupItem = NULL); + void destroyScene(Context context, GroupScene* scene); + GroupWidget *addNewEmptyGroup(Context context, GroupScene *scene, bool show = true); + void addNewFullGroup(Context context); + + /************************** + * graph ops + *************************/ + // getters + QMap getAllGroupNames(); + // setters + // testers + // others + void generateVHDL(Context context) throw(Exception); + + /************************** + * block ops + *************************/ + void addBlock(Context context, int idCategory, int idBlock, int idScene, QHash clkRstToGen ); + void addClkRstGenBlock(Context context, double frequency); + void removeBoxItem(Context context, BoxItem* item); + void duplicateBoxItem(Context context, BoxItem* item); + void renameFunctionalBlock(Context context, BoxItem* item); + void generateBlockVHDL(Context context, BoxItem* item); + void renameGroupBlock(Context context, GroupItem* item); + void renameStimuliItem(Context context, StimuliItem* item); + void removeStimuliItem(Context context, StimuliItem* item); + void duplicateStimuliItem(Context context, StimuliItem* item); // interface ops @@ -99,7 +116,7 @@ public slots: * connect to group in the contextual menu. * Thus, parameter item is always owned by a BoxItem */ - void connectInterToGroup(InterfaceItem* item); + void connectInterToGroup(Context context, InterfaceItem* item); /*! * \brief removeFunctionalInterface * \param item item is always owned by a BoxItem @@ -108,7 +125,7 @@ public slots: * to a BoxItem that represents a functional block and has a multiplicity > 1) and chooses remove in the contextual menu. * Thus, parameter item is always owned by a BoxItem */ - void removeFunctionalInterface(InterfaceItem* item); + void removeFunctionalInterface(Context context, InterfaceItem* item); /*! * \brief removeGroupInterface * \param item item is always owned by a GroupItem @@ -117,22 +134,26 @@ public slots: * to a GroupItem and if it is connected only to an inner interface) and chooses remove in the contextual menu. * Thus, parameter item is always owned by a GroupItem */ - void removeGroupInterface(InterfaceItem* item); - void duplicateInterfaceItem(InterfaceItem* item); - void showProperties(InterfaceItem *inter); - void renameInterface(InterfaceItem* item); - void showPatterns(InterfaceItem* item); - void showModifier(InterfaceItem* item); - void removeModifier(InterfaceItem* item); + void removeGroupInterface(Context context, InterfaceItem* item); + void duplicateInterfaceItem(Context context, InterfaceItem* item); + void showProperties(Context context, InterfaceItem *inter); + void renameInterface(Context context, InterfaceItem* item); + void showPatterns(Context context, InterfaceItem* item); + void showModifier(Context context, InterfaceItem* item); + void removeModifier(Context context, InterfaceItem* item); // connection ops - bool createConnection(InterfaceItem *iface1, InterfaceItem *iface2, bool visible = true); - void removeAllBlockConnections(AbstractBoxItem *item); - void removeConnection(ConnectionItem *conn); + bool createConnection(Context context, InterfaceItem *iface1, InterfaceItem *iface2, bool visible = true); + void removeAllBlockConnections(Context context, AbstractBoxItem *item); + void removeConnection(Context context, ConnectionItem *conn); + void connectBoxItemClock(Context context, BoxItem* item, QString clkName, int idGen = 0) throw(Exception); + void connectBoxItemReset(Context context, BoxItem* item, QString rstName, int idGen = 0) throw(Exception); + void connectStimuliItemClock(Context context, StimuliItem* item, QString clkName, int idGen = 0) throw(Exception); + void connectStimuliItemReset(Context context, StimuliItem* item, QString rstName, int idGen = 0) throw(Exception); // analysis ops - void findGraphModifications(FunctionalBlock* block); // find modif so that block has compatible inputs + void findGraphModifications(Context context, FunctionalBlock* block); // find modif so that block has compatible inputs // others void showBlocksLibrary(); @@ -148,8 +169,8 @@ private: // attributes that corresponds to the views MainWindow* mainWindow; QList groupList; - GroupWidget* currentGroup; - GroupWidget *topGroup; + GroupWidget* currentGroupWidget; + GroupWidget *topGroupWidget; static int sceneCounter; };