mainwindow.h
author insilmaril
Wed, 20 Jun 2007 11:58:47 +0000
changeset 526 eacf1b165d2d
parent 514 497fab7d1404
child 527 f19bbd639726
permissions -rw-r--r--
Added center function
     1 #ifndef MAINWINDOW_H 
     2 #define MAINWINDOW_H
     3 
     4 #include <QMainWindow>
     5 
     6 #include "branchpropwindow.h"
     7 #include "file.h"
     8 #include "findwindow.h"
     9 #include "historywindow.h"
    10 #include "mapeditor.h"
    11 #include "simplescripteditor.h"
    12 #include "texteditor.h"
    13 #include "xml.h"
    14 
    15 class Main : public QMainWindow 
    16 {
    17     Q_OBJECT
    18 
    19 public:
    20 	/*! Modifier modes are used when CTRL together with a mouse button is pressed */
    21 	enum ModMode {
    22 		ModModeNone,	//!< Unused
    23 		ModModeColor,	//!< Pick color from object
    24 		ModModeCopy,	//!< Copy object
    25 		ModModeXLink	//!< Create a XLink (XLinkObj) from selected object
    26 		};
    27 
    28     Main(QWidget* parent=0, const char* name=0, Qt::WFlags f=0);
    29     ~Main();
    30 	void loadCmdLine();
    31 	void statusMessage (const QString &);
    32 
    33 public slots:
    34     void fileNew();
    35     void fileNewCopy();
    36 
    37 protected:
    38 	void closeEvent( QCloseEvent* );
    39 
    40 private:
    41     void setupFileActions();
    42     void setupEditActions();
    43     void setupFormatActions();
    44     void setupViewActions();
    45     void setupModeActions();
    46     void setupWindowActions();
    47     void setupFlagActions();
    48     void setupSettingsActions();
    49     void setupTestActions();
    50     void setupHelpActions();
    51     void setupContextMenus();
    52 	void setupRecentMapsMenu();
    53     void setupMacros();
    54 	void hideEvent (QHideEvent * );
    55 	void showEvent (QShowEvent * );
    56 	MapEditor* currentMapEditor() const;
    57     
    58 private slots:
    59 	void editorChanged(QWidget*);
    60 
    61     ErrorCode fileLoad(QString ,const LoadMode &);
    62     void fileLoad(const LoadMode &);
    63     void fileLoad();
    64 	void fileLoadRecent();
    65 	void addRecentMap (const QString &);
    66     void fileSave(MapEditor*, const SaveMode & );
    67     void fileSave();
    68 public slots:	
    69     void fileSave(MapEditor *);	// autosave from MapEditor
    70 private slots:	
    71     void fileSaveAs(const SaveMode &);
    72     void fileSaveAs();
    73     void fileImportKDEBookmarks();
    74     void fileImportFirefoxBookmarks();
    75     void fileImportMM();
    76     void fileImportDir();
    77     void fileExportXML();
    78     void fileExportXHTML();
    79     void fileExportImage();
    80     void fileExportASCII();
    81     void fileExportCSV();
    82     void fileExportLaTeX();
    83     void fileExportKDEBookmarks();
    84     void fileExportTaskjuggler();
    85     void fileExportOOPresentation();
    86     void fileCloseMap();
    87     void filePrint();
    88     void fileExitVYM();
    89 
    90 public slots:
    91     void editUndo();	
    92     void editRedo();	
    93 	void gotoHistoryStep (int);
    94 private slots:	
    95     void editCopy();	
    96     void editPaste();	
    97     void editCut();	
    98     void editOpenFindWindow();
    99 	void editFind(QString);
   100 	void editFindChanged();
   101 private:
   102 	void openTabs(QStringList);
   103 public slots:
   104 	void editOpenURL();
   105 	void editOpenURLTab();
   106 private slots:
   107 	void editOpenMultipleURLTabs();
   108 	void editURL();
   109 	void editHeading2URL();
   110 	void editBugzilla2URL();
   111 	void editFATE2URL();
   112 	void openVymLinks(const QStringList &);
   113 	void editVymLink();
   114 	void editOpenMultipleVymLinks();
   115     void editHeadingFinished();
   116 public slots:
   117     void editHeading();
   118 	void editOpenVymLink();
   119 private slots:
   120 	void editDeleteVymLink();
   121 	void editToggleHideExport();
   122 	void editMapInfo();
   123     void editMoveUp();	
   124     void editMoveDown();	
   125     void editToggleScroll();
   126     void editUnscrollChilds();
   127     void editNewBranch();
   128     void editNewBranchBefore();
   129     void editNewBranchAbove();
   130     void editNewBranchBelow();
   131     void editImportAdd();
   132     void editImportReplace();
   133     void editSaveBranch();
   134     void editDeleteKeepChilds();
   135     void editDeleteChilds();
   136     void editDeleteSelection();
   137     void editUpperBranch();
   138     void editLowerBranch();
   139     void editLeftBranch();
   140     void editRightBranch();
   141     void editFirstBranch();
   142     void editLastBranch();
   143     void editLoadImage();
   144     void editSaveImage();
   145     void editFollowXLink (QAction *);
   146     void editEditXLink (QAction *);
   147 
   148     void formatSelectColor();
   149     void formatPickColor();
   150     void colorChanged(QColor);
   151     void formatColorBranch();
   152     void formatColorSubtree();
   153 	void formatLinkStyleLine();
   154 	void formatLinkStyleParabel();
   155 	void formatLinkStylePolyLine();
   156 	void formatLinkStylePolyParabel();
   157     void formatSelectBackColor();
   158     void formatSelectBackImage();
   159     void formatSelectLinkColor();
   160     void formatSelectSelectionColor();
   161     void formatToggleLinkColorHint();
   162 	void formatHideLinkUnselected();
   163 
   164     void viewZoomReset();
   165     void viewZoomIn();
   166     void viewZoomOut();
   167     void viewCenter();
   168 
   169 public slots:
   170 	bool settingsPDF();
   171 	bool settingsURL();
   172 	void settingsMacroDir();
   173 	void settingsToggleDelKey();
   174 	void settingsUndoLevels();
   175 	void settingsAutosaveToggle();
   176 	void settingsAutosaveTime();
   177 
   178 	void windowToggleNoteEditor();
   179 	void windowToggleHistory();
   180 	void windowToggleProperty();
   181 	void updateHistory(SimpleSettings &);
   182 	void windowToggleAntiAlias();
   183 	void windowToggleSmoothPixmap();
   184 	void updateNoteFlag();
   185 	void updateSatellites(MapEditor *);
   186 	void updateActions();
   187 	ModMode getModMode();
   188 	bool autoEdit();
   189 	bool autoSelectHeading();
   190 	bool useFlagGroups();
   191 	void setScript(const QString &);
   192 	void runScript(const QString &);
   193 	void runScriptEverywhere (const QString &);
   194 
   195 private slots:
   196 	void windowNextEditor();
   197 	void windowPreviousEditor();
   198 	void windowShowNoteEditor();
   199 	void windowHideNoteEditor();
   200 
   201 	void standardFlagChanged();
   202 
   203     void testFunction();
   204     void testCommand();
   205 
   206     void helpDoc();
   207     void helpDemo();
   208     void helpAbout();
   209     void helpAboutQT();
   210 
   211 	void callMacro ();
   212 
   213 private:
   214 	QTabWidget *tabWidget;
   215 	FindWindow *findWindow;
   216 	QProcess *procBrowser;
   217 
   218 	QStringList imageTypes;
   219 
   220 	QLineEdit *lineedit;	// to enter headings of branches
   221 	QString prevSelection;
   222 
   223 	HistoryWindow *historyWindow;
   224 
   225 	BranchPropertyWindow *branchPropertyWindow;
   226 	SimpleScriptEditor *scriptEditor;
   227 
   228 	QList <QAction*> actionListBranches;
   229 
   230 	QColor currentColor;
   231 
   232 	QMenu *recentFilesMenu;
   233 	enum { MaxRecentFiles = 9 };
   234     QAction *recentFileActions[MaxRecentFiles];
   235 
   236     QAction *macroActions[12];
   237 	QStringList macro;
   238 
   239 	QAction* actionFileSave;
   240 	QAction* actionFilePrint;
   241 	QAction* actionEditUndo;
   242 	QAction* actionEditRedo;
   243 	QAction *actionEditCopy;
   244 	QAction *actionEditCut;
   245 	QAction *actionEditPaste;
   246 	QAction *actionEditMoveUp;
   247 	QAction *actionEditMoveDown;
   248 	QAction *actionEditToggleScroll;
   249 	QAction* actionEditOpenURL;
   250 	QAction* actionEditOpenURLTab;
   251 	QAction* actionEditOpenMultipleURLTabs;
   252 	QAction* actionEditURL;
   253 	QAction* actionEditHeading2URL;
   254 	QAction* actionEditBugzilla2URL;
   255 	QAction* actionEditFATE2URL;
   256 	QAction *actionEditOpenVymLink;
   257 	QAction *actionEditOpenMultipleVymLinks;
   258 	QAction *actionEditVymLink;
   259 	QAction *actionEditDeleteVymLink;
   260 	QAction *actionEditToggleHideExport;
   261 	QAction *actionEditMapInfo;
   262 	QAction *actionEditHeading;
   263 	QAction *actionEditDelete;
   264 	QAction *actionEditAddBranch;
   265 	QAction *actionEditAddBranchBefore;
   266 	QAction *actionEditAddBranchAbove;
   267 	QAction *actionEditAddBranchBelow;
   268 	QAction *actionEditDeleteKeepChilds;
   269 	QAction *actionEditDeleteChilds;
   270 	QAction *actionEditImportAdd;
   271 	QAction *actionEditImportReplace;
   272 	QAction *actionEditSaveBranch;
   273 	QAction *actionEditSelectFirst;
   274 	QAction *actionEditSelectLast;
   275 	QAction *actionEditLoadImage;
   276 
   277 	QAction* actionFormatColor;
   278 	QAction* actionFormatPickColor;
   279 	QAction* actionFormatColorBranch;
   280 	QAction* actionFormatColorSubtree;
   281 	QAction* actionFormatLinkColorHint;
   282 	QAction* actionFormatBackColor;
   283 	QAction* actionFormatBackImage;
   284 	QAction* actionFormatLinkColor;
   285 	QAction* actionFormatSelectionColor;
   286 
   287 	QActionGroup* actionGroupModModes;
   288 	QAction* actionModModeColor;
   289 	QAction* actionModModeXLink;
   290 	QAction* actionModModeCopy;
   291 
   292 	QActionGroup *actionGroupFormatFrameTypes;
   293 
   294 
   295 	QActionGroup *actionGroupFormatLinkStyles;
   296 	QAction *actionFormatLinkStyleLine;
   297 	QAction *actionFormatLinkStyleParabel;
   298 	QAction *actionFormatLinkStylePolyLine;
   299 	QAction *actionFormatLinkStylePolyParabel;
   300 	QAction *actionFormatHideLinkUnselected;
   301 
   302 	QAction *actionViewToggleNoteEditor;
   303 	QAction *actionViewToggleHistoryWindow;
   304 	QAction *actionViewTogglePropertyWindow;
   305 	QAction *actionViewToggleAntiAlias;
   306 	QAction *actionViewToggleSmoothPixmapTransform;
   307 	QAction* actionViewCenter;
   308 
   309 	QAction* actionSettingsAutoEdit;
   310 	QAction* actionSettingsAutoSelectHeading;
   311 	QAction* actionSettingsAutoSelectText;
   312 	QAction* actionSettingsUseDelKey;
   313 	QAction* actionSettingsUseFlagGroups;
   314 	QAction* actionSettingsUseHideExport;
   315 	QAction* actionSettingsAutosaveToggle;
   316 	QAction* actionSettingsAutosaveTime;
   317 };
   318 
   319 
   320 #endif
   321