1 #ifndef __APPLICATIONWINDOW_H__
2 #define __APPLICATIONWINDOW_H__
6 #include "rs_document.h"
7 #include "qc_dialogfactory.h"
8 #include "qc_graphicview.h"
10 #include "qg_actionhandler.h"
11 #include "qg_blockwidget.h"
12 #include "qg_layerwidget.h"
13 #include "qg_mainwindowinterface.h"
14 #include "qg_recentfiles.h"
15 #include "qg_pentoolbar.h"
16 #include "cadtoolbar.h"
17 #include "commandwidget.h"
18 #include "librarywidget.h"
21 #include "qs_scripter.h"
22 #include <qsproject.h>
26 #include "rs_simulationcontrols.h"
30 * Main application window. Hold together document, view and controls.
32 * @author James L. Hammons
33 * @author Andrew Mustun
35 class ApplicationWindow: public QMainWindow, public QG_MainWindowInterface
49 void updateRecentFilesMenu();
52 bool queryExit(bool force);
54 /** Catch hotkey for giving focus to command line. */
55 virtual void keyPressEvent(QKeyEvent* e);
56 virtual void keyReleaseEvent(QKeyEvent * e);
60 void finishSplashScreen();
65 void slotFocusCommandLine();
66 void slotError(const QString & msg);
68 void slotWindowActivated(QMdiSubWindow * w);
69 void slotWindowsMenuAboutToShow();
70 void slotWindowsMenuActivated(QAction *);
71 void slotTileHorizontal();
72 void slotTileVertical();
74 void slotPenChanged(RS_Pen p);
76 /** generates a new document for a graphic. */
77 MDIWindow * slotFileNew(RS_Document * doc = NULL);
78 /** opens a document */
81 * opens a recent file document
82 * @param id File Menu id of the file
84 void slotFileOpenRecent(void);
86 * opens the given file.
88 void slotFileOpen(const QString & fileName, RS2::FormatType type);
89 /** saves a document */
91 /** saves a document under a different filename*/
92 void slotFileSaveAs();
93 /** exports the document as bitmap */
94 void slotFileExport();
95 bool slotFileExport(const QString & name, const QString & format,
96 QSize size, bool black, bool bw = false);
97 /** closes the current file */
99 /** closing the current file */
100 void slotFileClosing();
101 /** prints the current file */
102 void slotFilePrint();
103 /** shows print preview of the current file */
104 void slotFilePrintPreview(bool on);
105 /** exits the application */
108 /** forces to quit QCad (demo) */
109 void slotFileDemoQuit();
111 /** toggle the grid */
112 void slotViewGrid(bool toggle);
113 /** toggle the draft mode */
114 void slotViewDraft(bool toggle);
115 /** toggle the statusbar */
116 void slotViewStatusBar(bool toggle);
117 /** toggle the layerlist */
118 //void slotViewLayerList(bool toggle);
119 /** toggle the blocklist */
120 //void slotViewBlockList(bool toggle);
121 /** toggle the command line */
122 //void slotViewCommandLine(bool toggle);
123 /** toggle the option toolbar */
124 //void slotViewOptionToolbar(bool toggle);
126 //void slotBlocksEdit();
127 void slotOptionsGeneral();
129 void slotScriptOpenIDE();
130 void slotScriptRun();
132 void slotRunStartScript();
133 void slotRunScript();
134 void slotRunScript(const QString & name);
136 void slotInsertBlock();
137 void slotInsertBlock(const QString & name);
139 /** shows an about dlg*/
140 void slotHelpAbout();
141 void slotHelpManual();
143 /** dumps entities to file */
144 void slotTestDumpEntities(RS_EntityContainer * d = NULL);
145 /** dumps undo info to stdout */
146 void slotTestDumpUndo();
147 /** updates all inserts */
148 void slotTestUpdateInserts();
149 /** draws some random lines */
150 void slotTestDrawFreehand();
151 /** inserts a test block */
152 void slotTestInsertBlock();
153 /** inserts a test ellipse */
154 void slotTestInsertEllipse();
155 /** inserts a test text */
156 void slotTestInsertText();
157 /** inserts a test image */
158 void slotTestInsertImage();
160 void slotTestUnicode();
161 /** math experimental */
162 void slotTestMath01();
163 /** resizes window to 640x480 for screen shots */
164 void slotTestResize640();
165 /** resizes window to 640x480 for screen shots */
166 void slotTestResize800();
167 /** resizes window to 640x480 for screen shots */
168 void slotTestResize1024();
171 void gridChanged(bool on);
172 void draftChanged(bool on);
173 void printPreviewChanged(bool on);
174 void windowsChanged(bool windowsLeft);
177 static ApplicationWindow * getAppWindow();
178 QMdiArea * getWorkspace();
179 MDIWindow * getMDIWindow();
180 virtual RS_GraphicView * getGraphicView();
181 virtual RS_Document * getDocument();
182 virtual void createNewDocument(const QString & fileName = QString::null, RS_Document * doc = NULL);
183 virtual QMainWindow * GetMainWindow();
184 virtual QG_ActionHandler * getActionHandler();
185 virtual void showSimulationControls();
187 //virtual QToolBar* createToolBar(const QString& name);
188 //virtual void addToolBarButton(QToolBar* tb);
191 * @return Pointer to the qsa object.
194 QSProject * getQSAProject();
201 * Implementation from QG_MainWindowInterface.
203 virtual void setFocus2();
206 void closeEvent(QCloseEvent *);
207 virtual void mouseReleaseEvent(QMouseEvent * e);
210 /** Pointer to the application window (this). */
211 static ApplicationWindow * appWindow;
213 /** Workspace for MDI */
214 QMdiArea * workspace;
216 /** Dialog factory */
217 QC_DialogFactory * dialogFactory;
219 /** Layer list widget */
220 QG_LayerWidget * layerWidget;
221 /** Block list widget */
222 QG_BlockWidget * blockWidget;
223 /** Library browser widget */
224 LibraryWidget * libraryWidget;
226 /** CAM Simulation panel */
227 RS_SimulationControls * simulationControls;
230 /** Layer list dock widget */
231 QDockWidget * layerDockWindow;
232 /** Block list dock widget */
233 QDockWidget * blockDockWindow;
234 /** Library list dock widget */
235 QDockWidget * libraryDockWindow;
237 /** Simulation controls dock widget */
238 QDockWidget * simulationDockWindow;
242 CommandWidget * commandWidget;
243 QDockWidget * commandDockWindow;
245 /** Coordinate widget */
246 CoordinateWidget * coordinateWidget;
248 MouseWidget * mouseWidget;
249 /** Selection Status */
250 SelectionWidget * selectionWidget;
252 /** Option widget for individual tool options */
253 QToolBar * optionWidget;
255 /** Recent files list */
256 QG_RecentFiles * recentFiles;
258 /** Action handler. */
259 QG_ActionHandler * actionHandler;
262 /** Scripting interface. */
263 QS_Scripter * scripter;
272 /** the main toolbars */
273 QToolBar * fileToolBar;
274 QToolBar * editToolBar;
275 QToolBar * zoomToolBar;
277 // Toolbar for selecting the current pen
278 QG_PenToolBar * penToolBar;
279 // Toolbar for CAD tools
280 CadToolBar * cadToolBar;
282 //No. QAssistantClient * assistant;
284 QAction * scriptOpenIDE;
287 QAction * helpAboutApp;
288 QAction * helpManual;
290 QAction * testDumpEntities;
291 QAction * testDumpUndo;
292 QAction * testUpdateInserts;
293 QAction * testDrawFreehand;
294 QAction * testInsertBlock;
295 QAction * testInsertText;
296 QAction * testInsertImage;
297 QAction * testUnicode;
298 QAction * testInsertEllipse;
300 QAction * testMath01;
302 QAction * testResize640;
303 QAction * testResize800;
304 QAction * testResize1024;
307 #endif // __APPLICATIONWINDOW_H__