1 #ifndef QC_APPLICATIONWINDOW_H
2 #define QC_APPLICATIONWINDOW_H
6 #include "rs_document.h"
7 #include "qc_dialogfactory.h"
8 #include "qc_graphicview.h"
9 #include "qc_mdiwindow.h"
10 #include "qg_actionhandler.h"
11 //#include "qg_actionfactory.h"
12 #include "qg_blockwidget.h"
13 #include "qg_layerwidget.h"
14 #include "qg_mainwindowinterface.h"
15 #include "qg_recentfiles.h"
16 #include "qg_pentoolbar.h"
17 #include "cadtoolbar.h"
18 #include "commandwidget.h"
19 #include "librarywidget.h"
22 #include "qs_scripter.h"
23 #include <qsproject.h>
27 #include "rs_simulationcontrols.h"
31 * Main application window. Hold together document, view and controls.
33 * @author James L. Hammons
34 * @author Andrew Mustun
36 class QC_ApplicationWindow: public QMainWindow, public QG_MainWindowInterface
41 QC_ApplicationWindow();
42 ~QC_ApplicationWindow();
50 void updateRecentFilesMenu();
53 bool queryExit(bool force);
55 /** Catch hotkey for giving focus to command line. */
56 virtual void keyPressEvent(QKeyEvent* e);
57 virtual void keyReleaseEvent(QKeyEvent * e);
61 void finishSplashScreen();
66 void slotFocusCommandLine();
67 void slotError(const QString & msg);
69 // void slotWindowActivated(QWidget * w);
70 void slotWindowActivated(QMdiSubWindow * w);
71 void slotWindowsMenuAboutToShow();
72 // void slotWindowsMenuActivated(int);
73 void slotWindowsMenuActivated(QAction *);
74 void slotTileHorizontal();
75 void slotTileVertical();
77 void slotPenChanged(RS_Pen p);
79 /** generates a new document for a graphic. */
80 QC_MDIWindow * slotFileNew(RS_Document * doc = NULL);
81 /** opens a document */
84 * opens a recent file document
85 * @param id File Menu id of the file
87 // void slotFileOpenRecent(int id);
88 void slotFileOpenRecent(void);
90 * opens the given file.
92 void slotFileOpen(const QString & fileName, RS2::FormatType type);
93 /** saves a document */
95 /** saves a document under a different filename*/
96 void slotFileSaveAs();
97 /** exports the document as bitmap */
98 void slotFileExport();
99 bool slotFileExport(const QString & name, const QString & format,
100 QSize size, bool black, bool bw = false);
101 /** closes the current file */
102 void slotFileClose();
103 /** closing the current file */
104 void slotFileClosing();
105 /** prints the current file */
106 void slotFilePrint();
107 /** shows print preview of the current file */
108 void slotFilePrintPreview(bool on);
109 /** exits the application */
112 /** forces to quit QCad (demo) */
113 void slotFileDemoQuit();
115 /** toggle the grid */
116 void slotViewGrid(bool toggle);
117 /** toggle the draft mode */
118 void slotViewDraft(bool toggle);
119 /** toggle the statusbar */
120 void slotViewStatusBar(bool toggle);
121 /** toggle the layerlist */
122 //void slotViewLayerList(bool toggle);
123 /** toggle the blocklist */
124 //void slotViewBlockList(bool toggle);
125 /** toggle the command line */
126 //void slotViewCommandLine(bool toggle);
127 /** toggle the option toolbar */
128 //void slotViewOptionToolbar(bool toggle);
130 //void slotBlocksEdit();
131 void slotOptionsGeneral();
133 void slotScriptOpenIDE();
134 void slotScriptRun();
136 void slotRunStartScript();
137 void slotRunScript();
138 void slotRunScript(const QString & name);
140 void slotInsertBlock();
141 void slotInsertBlock(const QString & name);
143 /** shows an about dlg*/
144 void slotHelpAbout();
145 void slotHelpManual();
147 /** dumps entities to file */
148 void slotTestDumpEntities(RS_EntityContainer * d = NULL);
149 /** dumps undo info to stdout */
150 void slotTestDumpUndo();
151 /** updates all inserts */
152 void slotTestUpdateInserts();
153 /** draws some random lines */
154 void slotTestDrawFreehand();
155 /** inserts a test block */
156 void slotTestInsertBlock();
157 /** inserts a test ellipse */
158 void slotTestInsertEllipse();
159 /** inserts a test text */
160 void slotTestInsertText();
161 /** inserts a test image */
162 void slotTestInsertImage();
164 void slotTestUnicode();
165 /** math experimental */
166 void slotTestMath01();
167 /** resizes window to 640x480 for screen shots */
168 void slotTestResize640();
169 /** resizes window to 640x480 for screen shots */
170 void slotTestResize800();
171 /** resizes window to 640x480 for screen shots */
172 void slotTestResize1024();
175 void gridChanged(bool on);
176 void draftChanged(bool on);
177 void printPreviewChanged(bool on);
178 void windowsChanged(bool windowsLeft);
181 static QC_ApplicationWindow * getAppWindow();
182 QMdiArea * getWorkspace();
183 QC_MDIWindow * getMDIWindow();
184 virtual RS_GraphicView * getGraphicView();
185 virtual RS_Document * getDocument();
186 virtual void createNewDocument(const QString & fileName = QString::null, RS_Document * doc = NULL);
187 // virtual Q3MainWindow * getMainWindow();
188 virtual QMainWindow * GetMainWindow();
189 virtual QG_ActionHandler * getActionHandler();
190 virtual void showSimulationControls();
192 //virtual QToolBar* createToolBar(const QString& name);
193 //virtual void addToolBarButton(QToolBar* tb);
196 * @return Pointer to the qsa object.
199 QSProject * getQSAProject();
206 * Implementation from QG_MainWindowInterface.
208 virtual void setFocus2();
211 void closeEvent(QCloseEvent *);
212 virtual void mouseReleaseEvent(QMouseEvent * e);
215 /** Pointer to the application window (this). */
216 static QC_ApplicationWindow * appWindow;
218 /** Workspace for MDI */
219 QMdiArea * workspace;
221 /** Dialog factory */
222 QC_DialogFactory * dialogFactory;
224 /** Layer list widget */
225 QG_LayerWidget * layerWidget;
226 /** Block list widget */
227 QG_BlockWidget * blockWidget;
228 /** Library browser widget */
229 LibraryWidget * libraryWidget;
231 /** CAM Simulation panel */
232 RS_SimulationControls * simulationControls;
235 /** Layer list dock widget */
236 // Q3DockWindow * layerDockWindow;
237 QDockWidget * layerDockWindow;
238 /** Block list dock widget */
239 // Q3DockWindow * blockDockWindow;
240 QDockWidget * blockDockWindow;
241 /** Library list dock widget */
242 // Q3DockWindow * libraryDockWindow;
243 QDockWidget * libraryDockWindow;
245 /** Simulation controls dock widget */
246 // Q3DockWindow * simulationDockWindow;
247 QDockWidget * simulationDockWindow;
251 CommandWidget * commandWidget;
252 // Q3DockWindow * commandDockWindow;
253 QDockWidget * commandDockWindow;
255 /** Coordinate widget */
256 CoordinateWidget * coordinateWidget;
258 MouseWidget * mouseWidget;
259 /** Selection Status */
260 SelectionWidget * selectionWidget;
262 /** Option widget for individual tool options */
263 // Q3ToolBar * optionWidget;
264 QToolBar * optionWidget;
266 /** Recent files list */
267 QG_RecentFiles * recentFiles;
269 /** Action handler. */
270 QG_ActionHandler * actionHandler;
273 /** Scripting interface. */
274 QS_Scripter * scripter;
283 /** the main toolbars */
284 QToolBar * fileToolBar;
285 QToolBar * editToolBar;
286 QToolBar * zoomToolBar;
288 // Toolbar for selecting the current pen
289 QG_PenToolBar * penToolBar;
290 // Toolbar for CAD tools
291 CadToolBar * cadToolBar;
293 //No. QAssistantClient * assistant;
295 QAction * scriptOpenIDE;
298 QAction * helpAboutApp;
299 QAction * helpManual;
301 QAction * testDumpEntities;
302 QAction * testDumpUndo;
303 QAction * testUpdateInserts;
304 QAction * testDrawFreehand;
305 QAction * testInsertBlock;
306 QAction * testInsertText;
307 QAction * testInsertImage;
308 QAction * testUnicode;
309 QAction * testInsertEllipse;
311 QAction * testMath01;
313 QAction * testResize640;
314 QAction * testResize800;
315 QAction * testResize1024;