1 #ifndef __PARAMETERS_H__
\r
2 #define __PARAMETERS_H__
\r
10 #include <QtXmlPatterns>
\r
13 class BlockLibraryTree;
\r
14 class AbstractBlock;
\r
15 class ReferenceBlock;
\r
17 class FunctionalBlock;
\r
21 class InterfaceItem;
\r
24 #include "BlockImplementation.h"
\r
26 #include "Exception.h"
\r
29 // defines for current mode
\r
30 #define MODE_EDITION 1
\r
31 #define MODE_ADDBLOC 2
\r
32 #define MODE_ADDCONN 3
\r
35 using namespace std;
\r
42 enum Direction { NoDirection, East, North, West, South};
\r
44 /* state of cursorn:
\r
45 - CursorInBlock: cursor is within the main box of a block/group item
\r
46 - CursorOnBlockBorder: cursor is on a block/group item border
\r
47 - CursorOnInterface: cursor is on a block/group item Interface
\r
48 - CursorOnConnection: cursor is one a connection
\r
49 - CursorNowhere: none of the previous cases
\r
51 enum CursorState { CursorNowhere = 0, CursorInBlock, CursorInGroupTitle, CursorOnBorder, CursorOnInterface, CursorOnConnection };
\r
52 /* state of edition:
\r
55 enum EditState { EditNoOperation = 0, EditBlockMove, EditBlockResize, EditGroupMove, EditGroupResize, EditInterfaceMove, EditInterfaceDeselect, EditConnectionResize, EditStartConnection, EditCloseConnection, EditAbortConnection};
\r
57 enum XmlFileType { Configuration = 1, Reference, Implementation, Project };
\r
62 inline GroupScene* getCurrentScene() { return currentScene; }
\r
63 inline GroupScene* getTopScene() { return topScene; }
\r
66 inline void setTopScene(GroupScene* _topScene) { topScene = _topScene; }
\r
67 inline void setCurrentScene(GroupScene* _currentScene) { currentScene = _currentScene; }
\r
68 inline void setEditState(EditState state) { editState = state; }
\r
69 inline void setCursorState(CursorState state) { cursorState = state; }
\r
70 inline void setDispatcher(Dispatcher* _dispatcher) { dispatcher = _dispatcher;}
\r
72 /***************************************************
\r
73 attributes that are general to the application
\r
74 ***************************************************/
\r
75 BlockLibraryTree* categoryTree;
\r
76 QList<QString> refPathes;
\r
77 QList<QString> implPathes;
\r
78 QList<ReferenceBlock*> availableBlocks;
\r
79 QList<BlockImplementation*> availableImplementations;
\r
85 // defaults for vhdl
\r
88 // defaults for scene elements
\r
89 int defaultBlockWidth;
\r
90 int defaultBlockHeight;
\r
91 QFont defaultBlockFont;
\r
92 QString defaultBlockFontName;
\r
93 int defaultBlockFontSize;
\r
96 int arrowLineLength;
\r
97 QFont defaultIfaceFont;
\r
98 QString defaultIfaceFontName;
\r
99 int defaultIfaceFontSize;
\r
101 QPainterPath inArrow;
\r
102 QPainterPath outArrow;
\r
104 /***************************************************
\r
105 attributes that are specific for the current project
\r
106 ****************************************************/
\r
107 int sceneMode; // takes values from MODE_XXX
\r
108 CursorState cursorState;
\r
109 EditState editState; // takes values from EDIT_STATE_XXX
\r
111 bool isRstClkShown;
\r
113 Graph* createGraph();
\r
114 void destroyGraph();
\r
115 inline Graph* getGraph() { return graph; }
\r
116 GroupBlock* addGroupBlock(); // adding an empty GroupBlock to the current group
\r
117 FunctionalBlock* addFunctionalBlock(int idCategory, int idBlock); // adding a functional block to current group
\r
118 FunctionalBlock* duplicateFunctionalBlock(FunctionalBlock* block); // adding a copy of a functional block to current group
\r
123 QDomElement openProjectFile(const QString& projectFileName) throw(Exception);
\r
124 void loadProject(QDomElement root);
\r
126 void loadBlastConfiguration(QString confFile) throw(Exception);
\r
127 void loadReferencesFromXml() throw(Exception);
\r
128 void loadReferencesFromLib() throw(Exception);
\r
129 void saveReferencesToLib() throw(Exception);
\r
131 void loadImplementationsFromXml() throw(Exception);
\r
132 void loadImplementationsFromLib() throw(Exception);
\r
133 void saveImplementationsToLib() throw(Exception);
\r
135 void addAvailableBlock(ReferenceBlock *block);
\r
136 void parametersValidation();
\r
137 void connectionsValidation();
\r
138 QList<AbstractBlock *> getBlocksToConfigure();
\r
140 void updateToolbar();
\r
143 ReferenceBlock* searchBlockByXml(QString xmlName);
\r
144 ReferenceBlock* searchBlockByMd5(QString sumMd5);
\r
146 void save(QString confFile);
\r
149 QString projectPath;
\r
152 Graph* graph; // the graph model of blocks
\r
153 Dispatcher* dispatcher;
\r
154 GroupScene* topScene;
\r
155 GroupScene* currentScene;
\r
157 void setArrowPathes();
\r
160 GroupScene* searchSceneById(int id, GroupScene* scene);
\r
161 BoxItem* searchBlockItemById(int id, GroupScene* scene);
\r
162 GroupItem* searchGroupItemById(int id, GroupScene* scene);
\r
163 InterfaceItem* searchInterfaceItemById(int id, GroupScene *scene);
\r
165 void validateXmlFile(const QString& xmlFileName, const QString& xsdFileName, XmlFileType fileType) throw(Exception);
\r
166 bool validate(QFile& fileXml, QFile& fileSchema);
\r
171 #endif // __PARAMETERS_H__
\r