1 #ifndef __APPLICATIONWINDOW_H__
2 #define __APPLICATIONWINDOW_H__
6 #include "rs_document.h"
7 #include "qc_dialogfactory.h"
9 #include "qg_actionhandler.h"
10 #include "qg_blockwidget.h"
11 #include "qg_layerwidget.h"
12 #include "qg_mainwindowinterface.h"
13 #include "qg_pentoolbar.h"
14 #include "cadtoolbar.h"
15 #include "commandwidget.h"
16 #include "librarywidget.h"
19 #include "qs_scripter.h"
20 #include <qsproject.h>
24 #include "rs_simulationcontrols.h"
30 * Main application window. Hold together document, view and controls.
32 * @author James Hammons
33 * @author Andrew Mustun
35 class ApplicationWindow: public QMainWindow, public QG_MainWindowInterface
51 bool queryExit(bool force);
53 /** Catch hotkey for giving focus to command line. */
54 virtual void keyPressEvent(QKeyEvent* e);
55 virtual void keyReleaseEvent(QKeyEvent * e);
59 void finishSplashScreen();
64 void slotFocusCommandLine();
65 void slotError(const QString & msg);
67 void slotWindowActivated(QMdiSubWindow * w);
68 void slotWindowsMenuAboutToShow();
69 void slotWindowsMenuActivated(QAction *);
70 void slotTileHorizontal();
71 void slotTileVertical();
73 void slotPenChanged(RS_Pen p);
75 /** generates a new document for a graphic. */
76 MDIWindow * slotFileNew(RS_Document * doc = NULL);
77 /** opens a document */
80 * opens a recent file document
81 * @param id File Menu id of the file
83 void slotFileOpenRecent(void);
85 * opens the given file.
87 void slotFileOpen(const QString & fileName, RS2::FormatType type);
88 /** saves a document */
90 /** saves a document under a different filename*/
91 void slotFileSaveAs();
92 /** exports the document as bitmap */
93 void slotFileExport();
94 bool slotFileExport(const QString & name, const QString & format,
95 QSize size, bool black, bool bw = false);
96 /** closes the current file */
98 /** closing the current file */
99 void slotFileClosing();
100 /** prints the current file */
101 void slotFilePrint();
102 /** shows print preview of the current file */
103 void slotFilePrintPreview(bool on);
104 /** exits the application */
107 /** forces to quit QCad (demo) */
108 void slotFileDemoQuit();
110 /** toggle the grid */
111 void slotViewGrid(bool toggle);
112 /** toggle the draft mode */
113 void slotViewDraft(bool toggle);
114 /** toggle the statusbar */
115 void slotViewStatusBar(bool toggle);
116 /** toggle the layerlist */
117 //void slotViewLayerList(bool toggle);
118 /** toggle the blocklist */
119 //void slotViewBlockList(bool toggle);
120 /** toggle the command line */
121 //void slotViewCommandLine(bool toggle);
122 /** toggle the option toolbar */
123 //void slotViewOptionToolbar(bool toggle);
125 //void slotBlocksEdit();
126 void slotOptionsGeneral();
128 void slotScriptOpenIDE();
129 void slotScriptRun();
131 void slotRunStartScript();
132 void slotRunScript();
133 void slotRunScript(const QString & name);
135 void slotInsertBlock();
136 void slotInsertBlock(const QString & name);
138 /** shows an about dlg*/
139 void slotHelpAbout();
140 void slotHelpManual();
142 /** dumps entities to file */
143 void slotTestDumpEntities(RS_EntityContainer * d = NULL);
144 /** dumps undo info to stdout */
145 void slotTestDumpUndo();
146 /** updates all inserts */
147 void slotTestUpdateInserts();
148 /** draws some random lines */
149 void slotTestDrawFreehand();
150 /** inserts a test block */
151 void slotTestInsertBlock();
152 /** inserts a test ellipse */
153 void slotTestInsertEllipse();
154 /** inserts a test text */
155 void slotTestInsertText();
156 /** inserts a test image */
157 void slotTestInsertImage();
159 void slotTestUnicode();
160 /** math experimental */
161 void slotTestMath01();
162 /** resizes window to 640x480 for screen shots */
163 void slotTestResize640();
164 /** resizes window to 640x480 for screen shots */
165 void slotTestResize800();
166 /** resizes window to 640x480 for screen shots */
167 void slotTestResize1024();
170 void gridChanged(bool on);
171 void draftChanged(bool on);
172 void printPreviewChanged(bool on);
173 void windowsChanged(bool windowsLeft);
176 static ApplicationWindow * getAppWindow();
177 QMdiArea * getWorkspace();
178 MDIWindow * getMDIWindow();
179 virtual GraphicView * getGraphicView();
180 virtual RS_Document * getDocument();
181 virtual void createNewDocument(const QString & fileName = QString::null, RS_Document * doc = NULL);
182 virtual QMainWindow * GetMainWindow();
183 virtual QG_ActionHandler * getActionHandler();
184 virtual void showSimulationControls();
186 //virtual QToolBar* createToolBar(const QString& name);
187 //virtual void addToolBarButton(QToolBar* tb);
190 * @return Pointer to the qsa object.
193 QSProject * getQSAProject();
200 * Implementation from QG_MainWindowInterface.
202 virtual void setFocus2();
205 void closeEvent(QCloseEvent *);
206 virtual void mouseReleaseEvent(QMouseEvent * e);
209 /** Pointer to the application window (this). */
210 static ApplicationWindow * appWindow;
212 /** Workspace for MDI */
213 QMdiArea * workspace;
215 /** Dialog factory */
216 QC_DialogFactory * dialogFactory;
218 /** Layer list widget */
219 QG_LayerWidget * layerWidget;
220 /** Block list widget */
221 QG_BlockWidget * blockWidget;
222 /** Library browser widget */
223 LibraryWidget * libraryWidget;
225 /** CAM Simulation panel */
226 RS_SimulationControls * simulationControls;
229 /** Layer list dock widget */
230 QDockWidget * layerDockWindow;
231 /** Block list dock widget */
232 QDockWidget * blockDockWindow;
233 /** Library list dock widget */
234 QDockWidget * libraryDockWindow;
236 /** Simulation controls dock widget */
237 QDockWidget * simulationDockWindow;
241 CommandWidget * commandWidget;
242 QDockWidget * commandDockWindow;
244 /** Coordinate widget */
245 CoordinateWidget * coordinateWidget;
247 MouseWidget * mouseWidget;
248 /** Selection Status */
249 SelectionWidget * selectionWidget;
251 /** Option widget for individual tool options */
252 QToolBar * optionWidget;
254 /** Recent files list */
255 RecentFiles * recentFiles;
257 /** Action handler. */
258 QG_ActionHandler * actionHandler;
261 /** Scripting interface. */
262 QS_Scripter * scripter;
271 /** the main toolbars */
272 QToolBar * fileToolBar;
273 QToolBar * editToolBar;
274 QToolBar * zoomToolBar;
276 // Toolbar for selecting the current pen
277 QG_PenToolBar * penToolBar;
278 // Toolbar for CAD tools
279 CadToolBar * cadToolBar;
281 //No. QAssistantClient * assistant;
283 QAction * scriptOpenIDE;
286 QAction * helpAboutApp;
287 QAction * helpManual;
289 QAction * testDumpEntities;
290 QAction * testDumpUndo;
291 QAction * testUpdateInserts;
292 QAction * testDrawFreehand;
293 QAction * testInsertBlock;
294 QAction * testInsertText;
295 QAction * testInsertImage;
296 QAction * testUnicode;
297 QAction * testInsertEllipse;
299 QAction * testMath01;
301 QAction * testResize640;
302 QAction * testResize800;
303 QAction * testResize1024;
306 #endif // __APPLICATIONWINDOW_H__