1 #ifndef __APPLICATIONWINDOW_H__
2 #define __APPLICATIONWINDOW_H__
7 #include "qc_dialogfactory.h"
9 #include "actionhandler.h"
10 #include "blockwidget.h"
11 #include "layerwidget.h"
12 #include "qg_mainwindowinterface.h"
13 #include "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 "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(Pen p);
75 /** generates a new document for a graphic. */
76 MDIWindow * slotFileNew(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 */
108 /** forces to quit QCad (demo) */
109 void slotFileDemoQuit();
112 /** toggle the grid */
113 void slotViewGrid(bool toggle);
114 /** toggle the draft mode */
115 void slotViewDraft(bool toggle);
116 /** toggle the statusbar */
117 void slotViewStatusBar(bool toggle);
118 /** toggle the layerlist */
119 //void slotViewLayerList(bool toggle);
120 /** toggle the blocklist */
121 //void slotViewBlockList(bool toggle);
122 /** toggle the command line */
123 //void slotViewCommandLine(bool toggle);
124 /** toggle the option toolbar */
125 //void slotViewOptionToolbar(bool toggle);
127 //void slotBlocksEdit();
128 void slotOptionsGeneral();
130 void slotScriptOpenIDE();
131 void slotScriptRun();
133 void slotRunStartScript();
134 void slotRunScript();
135 void slotRunScript(const QString & name);
137 void slotInsertBlock();
138 void slotInsertBlock(const QString & name);
140 /** shows an about dlg*/
141 void slotHelpAbout();
142 void slotHelpManual();
144 /** dumps entities to file */
145 void slotTestDumpEntities(EntityContainer * d = NULL);
146 /** dumps undo info to stdout */
147 void slotTestDumpUndo();
148 /** updates all inserts */
149 void slotTestUpdateInserts();
150 /** draws some random lines */
151 void slotTestDrawFreehand();
152 /** inserts a test block */
153 void slotTestInsertBlock();
154 /** inserts a test ellipse */
155 void slotTestInsertEllipse();
156 /** inserts a test text */
157 void slotTestInsertText();
158 /** inserts a test image */
159 void slotTestInsertImage();
161 void slotTestUnicode();
162 /** math experimental */
163 void slotTestMath01();
164 /** resizes window to 640x480 for screen shots */
165 void slotTestResize640();
166 /** resizes window to 640x480 for screen shots */
167 void slotTestResize800();
168 /** resizes window to 640x480 for screen shots */
169 void slotTestResize1024();
172 void gridChanged(bool on);
173 void draftChanged(bool on);
174 void printPreviewChanged(bool on);
175 void windowsChanged(bool windowsLeft);
178 static ApplicationWindow * getAppWindow();
179 QMdiArea * getWorkspace();
180 MDIWindow * getMDIWindow();
181 virtual GraphicView * getGraphicView();
182 virtual Document * getDocument();
183 virtual void createNewDocument(const QString & fileName = QString::null, Document * doc = NULL);
184 virtual QMainWindow * GetMainWindow();
185 virtual ActionHandler * getActionHandler();
186 virtual void showSimulationControls();
189 * @return Pointer to the qsa object.
192 QSProject * getQSAProject();
199 * Implementation from QG_MainWindowInterface.
201 virtual void setFocus2();
204 void closeEvent(QCloseEvent *);
205 virtual void mouseReleaseEvent(QMouseEvent * e);
208 /** Pointer to the application window (this). */
209 static ApplicationWindow * appWindow;
211 /** Workspace for MDI */
212 QMdiArea * workspace;
214 /** Dialog factory */
215 QC_DialogFactory * dialogFactory;
217 /** Layer list widget */
218 LayerWidget * layerWidget;
219 /** Block list widget */
220 BlockWidget * blockWidget;
221 /** Library browser widget */
222 LibraryWidget * libraryWidget;
224 /** CAM Simulation panel */
225 RS_SimulationControls * simulationControls;
228 /** Layer list dock widget */
229 QDockWidget * layerDockWindow;
230 /** Block list dock widget */
231 QDockWidget * blockDockWindow;
232 /** Library list dock widget */
233 QDockWidget * libraryDockWindow;
235 /** Simulation controls dock widget */
236 QDockWidget * simulationDockWindow;
240 CommandWidget * commandWidget;
241 QDockWidget * commandDockWindow;
243 /** Coordinate widget */
244 CoordinateWidget * coordinateWidget;
246 MouseWidget * mouseWidget;
247 /** Selection Status */
248 SelectionWidget * selectionWidget;
250 /** Option widget for individual tool options */
251 QToolBar * optionWidget;
253 /** Recent files list */
254 RecentFiles * recentFiles;
256 /** Action handler. */
257 ActionHandler * actionHandler;
260 /** Scripting interface. */
261 QS_Scripter * scripter;
270 /** the main toolbars */
271 QToolBar * fileToolBar;
272 QToolBar * editToolBar;
273 QToolBar * zoomToolBar;
275 // Toolbar for selecting the current pen
276 PenToolBar * penToolBar;
277 // Toolbar for CAD tools
278 CadToolBar * cadToolBar;
280 //No. QAssistantClient * assistant;
282 QAction * scriptOpenIDE;
285 QAction * helpAboutApp;
286 QAction * helpManual;
288 QAction * testDumpEntities;
289 QAction * testDumpUndo;
290 QAction * testUpdateInserts;
291 QAction * testDrawFreehand;
292 QAction * testInsertBlock;
293 QAction * testInsertText;
294 QAction * testInsertImage;
295 QAction * testUnicode;
296 QAction * testInsertEllipse;
298 QAction * testMath01;
300 QAction * testResize640;
301 QAction * testResize800;
302 QAction * testResize1024;
305 #endif // __APPLICATIONWINDOW_H__