More undo/redo commands. Undo debug output still enabled
1 #include <QApplication>
9 #include <QActionGroup>
13 #include "mainwindow.h"
14 #include "flagrowobj.h"
17 TextEditor *textEditor; // used in Constr. of LinkableMapObj
18 // initialized in mainwindow
20 Main *mainWindow; // used in BranchObj::select()
21 QString tmpVymDir; // All temp files go there, created in mainwindow
22 QString clipboardDir; // Clipboard used in all mapEditors
23 QDir vymBaseDir; // Containing all styles, scripts, images, ...
26 QString iconPath; // Pointing to icons used for toolbars
27 QString flagsPath; // Pointing to flags
29 FlagRowObj *systemFlagsDefault; // used to copy from in LinkableMapObj
30 FlagRowObj *standardFlagsDefault;
33 // (QActionGroup could not be "enabled")
34 Q3PtrList <QAction> actionListBranches;
36 // Actions which change sometimes
37 QAction *actionFileSave;
38 QAction *actionFilePrint;
39 QAction *actionEditUndo;
40 QAction *actionEditRedo;
41 QAction *actionEditCopy;
42 QAction *actionEditCut;
43 QAction *actionEditPaste;
44 QAction *actionEditMoveUp;
45 QAction *actionEditMoveDown;
46 QAction *actionEditToggleScroll;
47 QAction *actionEditOpenURL;
48 QAction *actionEditOpenURLTab;
49 QAction *actionEditOpenMultipleURLTabs;
50 QAction *actionEditURL;
51 QAction *actionEditHeading2URL;
52 QAction *actionEditBugzilla2URL;
53 QAction *actionEditFATE2URL;
54 QAction *actionEditOpenVymLink;
55 QAction *actionEditOpenMultipleVymLinks;
56 QAction *actionEditVymLink;
57 QAction *actionEditToggleHideExport;
58 QAction *actionEditDeleteVymLink;
59 QAction *actionEditMapInfo;
60 QAction *actionEditHeading;
61 QAction *actionEditDelete;
62 QAction *actionEditAddBranch;
63 QAction *actionEditAddBranchHere;
64 QAction *actionEditAddBranchAbove;
65 QAction *actionEditAddBranchBelow;
66 QAction *actionEditRemoveBranchKeepChilds;
67 QAction *actionEditRemoveChilds;
68 QAction *actionEditImportAdd;
69 QAction *actionEditImportReplace;
70 QAction *actionEditSaveBranch;
71 QAction *actionEditSelectFirst;
72 QAction *actionEditSelectLast;
73 QAction *actionEditLoadImage;
75 QAction *actionFormatColor;
76 QAction *actionFormatPickColor;
77 QAction *actionFormatColorBranch;
78 QAction *actionFormatColorSubtree;
79 QAction *actionFormatBackColor;
80 QAction *actionFormatLinkColorHint;
81 QAction *actionFormatLinkColor;
83 QActionGroup *actionGroupModModes;
84 QAction *actionModModeColor;
85 QAction *actionModModeLink;
86 QAction *actionModModeCopy;
88 QActionGroup *actionGroupFormatFrameTypes;
89 QAction *actionFormatFrameNone;
90 QAction *actionFormatFrameRectangle;
92 QActionGroup *actionGroupFormatLinkStyles;
93 QAction *actionFormatIncludeImagesVer;
94 QAction *actionFormatIncludeImagesHor;
95 QAction *actionFormatHideLinkUnselected;
96 QAction *actionFormatLinkStyleLine;
97 QAction *actionFormatLinkStyleParabel;
98 QAction *actionFormatLinkStylePolyLine;
99 QAction *actionFormatLinkStylePolyParabel;
101 QAction *actionViewToggleNoteEditor;
102 QAction *actionViewToggleHistoryWindow;
104 QAction *actionSettingsAutoselectHeading;
105 QAction *actionSettingsAutoselectText;
106 QAction *actionSettingsAutoedit;
107 QAction *actionSettingsUseDelKey;
108 QAction *actionSettingsUseFlagGroups;
109 QAction *actionSettingsUseHideExport;
112 QMenu* branchContextMenu;
113 QMenu* branchAddContextMenu;
114 QMenu* branchRemoveContextMenu;
115 QMenu* branchLinksContextMenu;
116 QMenu* branchXLinksContextMenuEdit;
117 QMenu* branchXLinksContextMenuFollow;
118 QMenu* floatimageContextMenu;
119 QMenu* canvasContextMenu;
120 QMenu* fileLastMapsMenu;
121 QMenu* fileImportMenu;
122 QMenu* fileExportMenu;
125 Settings settings ("InSilmaril","vym"); // Organization, Application name
130 int statusbarTime=3500;
132 int main(int argc, char** argv)
134 //FIXME Q_INIT_RESOURCE (application);
136 QApplication app(argc,argv);
139 // Reading and initializing options commandline options
140 options.add ("version", SwitchOption, "v","version");
141 options.add ("local", SwitchOption, "l", "local");
142 options.add ("help", SwitchOption, "h", "help");
143 options.add ("quit", SwitchOption, "q", "quit");
144 options.add ("test", StringOption, "t", "test");
145 options.setHelpText (
146 "VYM - View Your Mind\n"
147 "--------------------\n\n"
148 "Information about vym can be found in vym.pdf,\n"
149 "which should be part of the vym package.\n"
150 "It is also available at the project homepage:\n\n"
151 "http://www.InSilmaril.de/vym\n");
154 cout << endl << options.getHelpText().ascii()<<endl;
158 if (options.isOn ("version"))
160 cout << "vym version "<<__VYM_VERSION
161 <<" (c) 2004-2006 Uwe Drechsel - "
162 <<__BUILD_DATE<<endl;
167 // Use /usr/share/vym or /usr/local/share/vym or . ?
169 if (options.isOn ("local"))
171 vymBaseDir.setPath (vymBaseDir.currentDirPath());
173 // then look for environment variable
174 if (getenv("VYMHOME")!=0)
176 vymBaseDir.setPath (getenv("VYMHOME"));
178 // ok, let's find my way on my own
180 vymBaseDir.setPath ("/usr/share/vym");
181 if (!vymBaseDir.exists())
183 vymBaseDir.setPath ("/usr/local/share/vym");
184 if (!vymBaseDir.exists())
185 vymBaseDir.setPath(vymBaseDir.currentDirPath() );
189 iconPath=vymBaseDir.path()+"/icons/";
190 flagsPath=vymBaseDir.path()+"/flags/";
193 lastImageDir=QDir().current();
194 lastFileDir=QDir().current();
196 if (options.isOn ("help"))
198 cout << options.getHelpText().ascii()<<endl;
202 q3InitNetworkProtocols();
205 // Initialize translations
206 QTranslator translator (0);
207 translator.load( QString("vym_")+QTextCodec::locale(), vymBaseDir.path() + "/lang");
208 app.installTranslator( &translator );
210 // Initializing the row of system flags
211 // is done in first call to MapEditor(),
212 // because we need at least one canvas first
213 systemFlagsDefault=NULL;
214 standardFlagsDefault=NULL;
216 // Initialize window of TextEditor
217 textEditor = new TextEditor();
218 textEditor->setIcon (QPixmap (iconPath+"vym-editor.png"));
219 if (textEditor->showWithMain()) textEditor->show();
221 // Initialize mainwindow
223 //m.resize(m.sizeHint());
224 m.setIcon (QPixmap (iconPath+"vym-48x48.png"));
229 // For benchmarking we may want to quit immediatly after drawing
230 if (options.isOn ("quit"))
235 QObject::connect( &app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) );