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