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
53 /** Catch hotkey for giving focus to command line. */
54 virtual void keyPressEvent(QKeyEvent * e);
55 virtual void keyReleaseEvent(QKeyEvent * e);
59 void finishSplashScreen();
63 void slotFocusCommandLine();
64 void slotError(const QString & msg);
66 void slotWindowActivated(QMdiSubWindow * w);
67 void slotWindowsMenuAboutToShow();
68 void slotWindowsMenuActivated(QAction *);
69 void slotTileHorizontal();
70 void slotTileVertical();
72 void slotPenChanged(Pen p);
74 /** generates a new document for a graphic. */
75 MDIWindow * slotFileNew(Document * doc = NULL);
76 /** opens a document */
78 /** opens a recent file document */
79 void slotFileOpenRecent(void);
80 /** opens the given file. */
81 void slotFileOpen(const QString & fileName, RS2::FormatType type);
82 /** saves a document */
84 /** saves a document under a different filename*/
85 void slotFileSaveAs();
86 /** exports the document as bitmap */
87 void slotFileExport();
88 bool slotFileExport(const QString & name, const QString & format,
89 QSize size, bool black, bool bw = false);
90 /** closes the current file */
92 /** closing the current file */
93 void slotFileClosing();
94 /** prints the current file */
96 /** shows print preview of the current file */
97 void slotFilePrintPreview(bool on);
98 /** exits the application */
101 /** toggle the grid */
102 void slotViewGrid(bool toggle);
103 /** toggle the draft mode */
104 void slotViewDraft(bool toggle);
105 /** toggle the statusbar */
106 void slotViewStatusBar(bool toggle);
108 void slotOptionsGeneral();
110 void slotScriptOpenIDE();
111 void slotScriptRun();
113 void slotRunStartScript();
114 void slotRunScript();
115 void slotRunScript(const QString & name);
117 void slotInsertBlock();
118 void slotInsertBlock(const QString & name);
120 /** shows an about dlg */
121 void slotHelpAbout();
122 void slotHelpManual();
124 /** dumps entities to file */
125 void slotTestDumpEntities(EntityContainer * d = NULL);
126 /** dumps undo info to stdout */
127 void slotTestDumpUndo();
128 /** updates all inserts */
129 void slotTestUpdateInserts();
130 /** draws some random lines */
131 void slotTestDrawFreehand();
132 /** inserts a test block */
133 void slotTestInsertBlock();
134 /** inserts a test ellipse */
135 void slotTestInsertEllipse();
136 /** inserts a test text */
137 void slotTestInsertText();
138 /** inserts a test image */
139 void slotTestInsertImage();
141 void slotTestUnicode();
142 /** math experimental */
143 void slotTestMath01();
144 /** resizes window to 640x480 for screen shots */
145 void slotTestResize640();
146 /** resizes window to 640x480 for screen shots */
147 void slotTestResize800();
148 /** resizes window to 640x480 for screen shots */
149 void slotTestResize1024();
152 // void gridChanged(bool on);
153 // void draftChanged(bool on);
154 // void printPreviewChanged(bool on);
155 void windowsChanged(bool);
158 static ApplicationWindow * getAppWindow();
159 QMdiArea * getWorkspace();
160 MDIWindow * getMDIWindow();
164 * @return Pointer to the qsa object.
166 QSProject * getQSAProject();
172 /** Implementation from QG_MainWindowInterface. */
173 virtual void setFocus2();
174 virtual GraphicView * getGraphicView();
175 virtual Document * getDocument();
176 virtual void createNewDocument(const QString & fileName = QString::null, Document * doc = NULL);
177 virtual void showSimulationControls();
180 void closeEvent(QCloseEvent *);
181 virtual void mouseReleaseEvent(QMouseEvent * e);
184 /** Pointer to the application window (this). */
185 static ApplicationWindow * appWindow;
187 /** Workspace for MDI */
188 QMdiArea * workspace;
190 /** Dialog factory */
191 QC_DialogFactory * dialogFactory;
193 /** Layer list widget */
194 LayerWidget * layerWidget;
195 /** Block list widget */
196 BlockWidget * blockWidget;
197 /** Library browser widget */
198 LibraryWidget * libraryWidget;
200 /** CAM Simulation panel */
201 RS_SimulationControls * simulationControls;
204 /** Layer list dock widget */
205 QDockWidget * layerDockWindow;
206 /** Block list dock widget */
207 QDockWidget * blockDockWindow;
208 /** Library list dock widget */
209 QDockWidget * libraryDockWindow;
211 /** Simulation controls dock widget */
212 QDockWidget * simulationDockWindow;
216 CommandWidget * commandWidget;
217 QDockWidget * commandDockWindow;
219 /** Coordinate widget */
220 CoordinateWidget * coordinateWidget;
222 MouseWidget * mouseWidget;
223 /** Selection Status */
224 SelectionWidget * selectionWidget;
226 /** Option widget for individual tool options */
227 QToolBar * optionWidget;
229 /** Recent files list */
230 RecentFiles * recentFiles;
232 /** Action handler. */
233 ActionHandler * actionHandler;
236 /** Scripting interface. */
237 QS_Scripter * scripter;
246 /** the main toolbars */
247 QToolBar * fileToolBar;
248 QToolBar * editToolBar;
249 QToolBar * zoomToolBar;
251 // Toolbar for selecting the current pen
252 PenToolBar * penToolBar;
253 // Toolbar for CAD tools
254 CadToolBar * cadToolBar;
256 QAction * scriptOpenIDE;
259 QAction * helpAboutApp;
260 QAction * helpManual;
262 QAction * testDumpEntities;
263 QAction * testDumpUndo;
264 QAction * testUpdateInserts;
265 QAction * testDrawFreehand;
266 QAction * testInsertBlock;
267 QAction * testInsertText;
268 QAction * testInsertImage;
269 QAction * testUnicode;
270 QAction * testInsertEllipse;
272 QAction * testMath01;
274 QAction * testResize640;
275 QAction * testResize800;
276 QAction * testResize1024;
279 #endif // __APPLICATIONWINDOW_H__