00001 /* 00002 Copyright (C) 2000,2001 Stefan Duffner 00003 00004 This program is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU General Public License 00006 as published by the Free Software Foundation; either version 2 00007 of the License, or any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 */ 00018 00019 #ifndef MAINWINDOW_H 00020 #define MAINWINDOW_H 00021 00022 #include <qmainwindow.h> 00023 #include <qmenubar.h> 00024 #include <qpopupmenu.h> 00025 #include <qmessagebox.h> 00026 #include <qtabdialog.h> 00027 #include <qtoolbutton.h> 00028 #include <qcursor.h> 00029 00030 #include "ScrollView.h" 00031 #include "DocStatus.h" 00032 #include "StateManager.h" 00033 #include "MachineManager.h" 00034 #include "TransitionManager.h" 00035 #include "Options.h" 00036 #include "Edit.h" 00037 #include "OptGeneralDlgImpl.h" 00038 #include "OptDisplayDlgImpl.h" 00039 00040 00041 //class QTranslator; 00042 class QToolBar; 00043 class Project; 00044 class FileIO; 00045 class StatusBar; 00046 class PrintManager; 00047 class Simulator; 00048 class MainControl; 00049 class ICheck; 00050 00058 class MainWindow : public QMainWindow 00059 { 00060 Q_OBJECT 00061 public: 00062 MainWindow(QObject* parent=0, const char* name=0); 00063 ~MainWindow(); 00064 00066 Options* getOptions() { return &doc_options; }; 00068 ScrollView* getScrollView() { return wscroll; }; 00070 StatusBar* getStatusBar() { return statusbar; }; 00072 OptGeneralDlgImpl* getOptGeneral() { return opt_general; }; 00074 OptDisplayDlgImpl* getOptDisplay() { return opt_display; }; 00076 void setLanguage(QString s) { language = s; 00077 opt_general->setLanguage(language);}; 00079 QString getLanguage() { return language; }; 00080 00081 // void repaintView() { wscroll->viewport()->repaint(); }; 00083 bool shiftPressed() { return shift_pressed; }; 00085 bool controlPressed() { return control_pressed; }; 00086 00088 Project* project; 00090 StateManager* statemanager; 00092 MachineManager* machinemanager; 00094 TransitionManager* transmanager; 00096 FileIO* fileio; 00098 PrintManager* printmanager; 00099 00101 int getMode() { return doc_status.getMode(); }; 00102 00104 bool aboutToClose; 00105 00106 private: 00107 void keyPressEvent(QKeyEvent* ); 00108 void keyReleaseEvent(QKeyEvent* ); 00109 void closeEvent(QCloseEvent* ); 00110 void focusInEvent(QFocusEvent* ); 00111 00112 void createToolBar(); 00113 void destroyToolBar(); 00114 00116 MainControl* control; 00118 ScrollView* wscroll; 00120 QMenuBar* menubar; 00122 QPopupMenu* menu_file; 00124 QPopupMenu* menu_export; 00126 QPopupMenu* menu_edit; 00128 QPopupMenu* menu_view; 00130 QPopupMenu* menu_machine; 00132 QPopupMenu* menu_state; 00134 QPopupMenu* menu_trans; 00136 QPopupMenu* menu_help; 00138 QPopupMenu* menu_mru; 00140 QPopupMenu* cmenu_state; 00142 QPopupMenu* cmenu_trans; 00144 QPopupMenu* cmenu_sview; 00146 QToolBar* toolbar; 00148 QPixmap* pappicon; 00150 QPixmap* pnew; 00152 QPixmap* popen; 00154 QPixmap* pzoomin; 00156 QPixmap* pzoomout; 00158 QToolButton* tbnew; 00160 QToolButton* tbopen; 00162 QToolButton* tbsave; 00164 QToolButton* tbprint; 00166 QToolButton* tbundo; 00168 QToolButton* tbcut; 00170 QToolButton* tbcopy; 00172 QToolButton* tbpaste; 00174 QToolButton* tbselect; 00176 QToolButton* tbzoom; 00178 QToolButton* tbstatenew; 00180 QToolButton* tbtransnew; 00182 QToolButton* tbmachinesim; 00184 QToolButton* tbzoomin; 00186 QToolButton* tbzoomout; 00188 QToolButton* tbtransstraighten; 00190 QIconSet* saveset; 00192 QIconSet* printset; 00194 QIconSet* undoset; 00196 QIconSet* cutset; 00198 QIconSet* copyset; 00200 QIconSet* pasteset; 00202 QIconSet* selset; 00204 QIconSet* zoomset; 00206 QIconSet* statenewset; 00208 QIconSet* transnewset; 00210 QIconSet* transstraightenset; 00212 QIconSet* machinesimset; 00214 QCursor* zoomCursor; 00215 00216 // menu item IDs 00217 // file 00218 int id_open; 00219 int id_save; 00220 int id_saveas; 00221 int id_print; 00222 int id_close; 00223 int id_export; 00224 int id_export_ahdl; 00225 int id_export_vhdl; 00226 int id_export_verilog; 00227 int id_export_kiss; 00228 int id_export_stlat; 00229 int id_export_sthtml; 00230 00231 // edit 00232 int id_undo; 00233 int id_cut; 00234 int id_copy; 00235 int id_paste; 00236 int id_delete; 00237 int id_select; 00238 int id_selectall; 00239 int id_deselectall; 00240 00241 // view 00242 int id_zoom; 00243 int id_zoomin; 00244 int id_zoomout; 00245 int id_zoom100; 00246 int id_viewmoore; 00247 int id_viewmealyin; 00248 int id_viewmealyout; 00249 int id_viewgrid; 00250 00251 // machine 00252 int id_machineedit; 00253 int id_machinesim; 00254 int id_machineicheck; 00255 00256 // state 00257 int id_editstate; 00258 int id_newstate; 00259 int id_setinitial; 00260 int id_setend; 00261 00262 // transition 00263 int id_edittrans; 00264 int id_newtrans; 00265 int id_trans_straight; 00266 00267 00268 // context menu item IDs 00269 // state 00270 int id_ceditstate; 00271 int id_csetinitial; 00272 int id_csetend; 00273 int id_csundo; 00274 int id_cscut; 00275 int id_cscopy; 00276 int id_csdelete; 00277 00278 // transition 00279 int id_cedittrans; 00280 int id_ctrans_straight; 00281 int id_ctundo; 00282 int id_ctcut; 00283 int id_ctcopy; 00284 int id_ctdelete; 00285 00286 00288 QMessageBox* mb_changed; 00290 StatusBar* statusbar; 00292 DocStatus doc_status; 00294 Options doc_options; 00296 Edit* edit; 00297 00299 QTabDialog* tabdialog; 00301 OptGeneralDlgImpl* opt_general; 00303 OptDisplayDlgImpl* opt_display; 00304 00306 Simulator* simulator; 00308 ICheck* ichecker; 00309 00311 bool shift_pressed; 00313 bool control_pressed; 00314 00316 bool bcut; 00318 QString language; 00320 QCursor previous_viewcursor; 00321 00322 signals: 00324 void allSelected(); 00326 void objectsPasted(); 00328 void quitWindow(MainWindow*); 00330 void updateStatusZoom(int ); 00331 00332 public slots: 00333 void refreshMRU(); 00334 void setMode(int ); 00335 void repaintViewport(); 00336 void updateAll(); 00337 void updatePaste(); 00338 void updateMenuBar(); 00339 void updateTitleBar(); 00340 void updateStatusBar(); 00341 00342 void menuItemActivated(int id); 00343 void editMenuAboutToShow(); 00344 void showContextState(); 00345 void showContextTrans(); 00346 void showContext(); 00347 00348 void sbMessage(QString s); 00349 void sbMessage(QString s, int t); 00350 void setWaitCursor(); 00351 void setPreviousCursor(); 00352 00353 void fileNew(); 00354 void fileOpen(); 00355 bool fileSave(); 00356 bool fileSaveAs(); 00357 bool fileExportAHDL(); 00358 bool fileExportVHDL(); 00359 bool fileExportVerilog(); 00360 bool fileExportKISS(); 00361 bool fileExportSTLatex(); 00362 bool fileExportSTHTML(); 00363 void filePrint(); 00364 bool fileClose(); 00365 void fileQuit(); 00366 00367 void fileOpenRecent(QString fileName); 00368 void fileOpenRecent0(); 00369 void fileOpenRecent1(); 00370 void fileOpenRecent2(); 00371 void fileOpenRecent3(); 00372 void fileOpenRecent4(); 00373 void fileOpenRecent5(); 00374 void fileOpenRecent6(); 00375 void fileOpenRecent7(); 00376 void fileOpenRecent8(); 00377 void fileOpenRecent9(); 00378 00379 void editUndo(); 00380 void editCut(); 00381 void editCopy(); 00382 void editPaste(); 00383 void editDelete(); 00384 void editSelect(); 00385 void editSelectAll(); 00386 void editDeselectAll(); 00387 void editOptions(); 00388 00389 void viewMooreOutputs(); 00390 void viewMealyInputs(); 00391 void viewMealyOutputs(); 00392 void viewGrid(); 00393 void viewZoom(); 00394 void viewZoomIn(); 00395 void viewZoomOut(); 00396 void viewZoom100(); 00397 00398 void machineEdit(); 00399 void machineSimulate(); 00400 void machineICheck(); 00401 00402 void stateNew(); 00403 void stateEdit(); 00404 void stateSetInitial(); 00405 void stateSetEnd(); 00406 00407 void transNew(); 00408 void transEdit(); 00409 void transStraighten(); 00410 00411 void helpAbout(); 00412 void helpAboutQt(); 00413 }; 00414 00415 00416 #endif