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 bool isCurrentProject; // true if a projet is currently open
\r
108 int sceneMode; // takes values from MODE_XXX
\r
109 CursorState cursorState;
\r
110 EditState editState; // takes values from EDIT_STATE_XXX
\r
112 bool isRstClkShown;
\r
114 Graph* createGraph();
\r
115 void destroyGraph();
\r
116 inline Graph* getGraph() { return graph; }
\r
117 GroupBlock* addGroupBlock(); // adding an empty GroupBlock to the current group
\r
118 FunctionalBlock* addFunctionalBlock(int idCategory, int idBlock); // adding a functional block to current group
\r
119 FunctionalBlock* duplicateFunctionalBlock(FunctionalBlock* block); // adding a copy of a functional block to current group
\r
124 QDomElement openProjectFile(const QString& projectFileName) throw(Exception);
\r
125 void loadProject(QDomElement root);
\r
127 void loadBlastConfiguration(QString confFile) throw(Exception);
\r
128 void loadReferencesFromXml() throw(Exception);
\r
129 void loadReferencesFromLib() throw(Exception);
\r
130 void saveReferencesToLib() throw(Exception);
\r
132 void loadImplementationsFromXml() throw(Exception);
\r
133 void loadImplementationsFromLib() throw(Exception);
\r
134 void saveImplementationsToLib() throw(Exception);
\r
136 void addAvailableBlock(ReferenceBlock *block);
\r
137 void parametersValidation();
\r
138 void connectionsValidation();
\r
139 QList<AbstractBlock *> getBlocksToConfigure();
\r
141 void updateToolbar();
\r
144 ReferenceBlock* searchBlockByXml(QString xmlName);
\r
145 ReferenceBlock* searchBlockByMd5(QString sumMd5);
\r
147 void save(QString confFile);
\r
150 QString projectPath;
\r
153 Graph* graph; // the graph model of blocks
\r
154 Dispatcher* dispatcher;
\r
155 GroupScene* topScene;
\r
156 GroupScene* currentScene;
\r
158 void setArrowPathes();
\r
161 GroupScene* searchSceneById(int id, GroupScene* scene);
\r
162 BoxItem* searchBlockItemById(int id, GroupScene* scene);
\r
163 GroupItem* searchGroupItemById(int id, GroupScene* scene);
\r
164 InterfaceItem* searchInterfaceItemById(int id, GroupScene *scene);
\r
166 void validateXmlFile(const QString& xmlFileName, const QString& xsdFileName, XmlFileType fileType) throw(Exception);
\r
167 bool validate(QFile& fileXml, QFile& fileSchema);
\r
172 #endif // __PARAMETERS_H__
\r