minor fixes in mmap2vym.xsl and repaired todo.vym (every includeImagesHor was set)
1 #include <qapplication.h>
3 #include <qtranslator.h>
6 #include <qtextcodec.h>
12 #include "mainwindow.h"
14 #include "icons/vym-48x48.xpm"
15 #include "icons/vym-128x128.xpm"
16 #include "icons/vym-editor.xpm"
18 #include "flagrowobj.h"
21 TextEditor *textEditor; // used in Constr. of LinkableMapObj
22 // initialized in mainwindow
24 Main *mainWindow; // used in BranchObj::select()
25 QString tmpVymDir; // All temp files go there, created in mainwindow
26 QString clipboardDir; // Clipboard used in all mapEditors
27 QDir vymBaseDir; // Containing all styles, scripts, images, ...
29 FlagRowObj *systemFlagsDefault; // used to copy from in LinkableMapObj
30 FlagRowObj *standardFlagsDefault;
33 // (QActionGroup could not be "enabled")
34 QPtrList <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 *actionEditURL;
49 QAction *actionEditHeading2URL;
50 QAction *actionEditBugzilla2URL;
51 QAction *actionEditFATE2URL;
52 QAction *actionEditOpenVymLink;
53 QAction *actionEditVymLink;
54 QAction *actionEditDeleteVymLink;
55 QAction *actionEditMapInfo;
56 QAction *actionEditHeading;
57 QAction *actionEditDelete;
58 QAction *actionEditAddBranch;
59 QAction *actionEditAddBranchHere;
60 QAction *actionEditAddBranchAbove;
61 QAction *actionEditAddBranchBelow;
62 QAction *actionEditRemoveBranchHere;
63 QAction *actionEditRemoveChilds;
64 QAction *actionEditImportAdd;
65 QAction *actionEditImportReplace;
66 QAction *actionEditSaveBranch;
67 QAction *actionEditSelectFirst;
68 QAction *actionEditSelectLast;
69 QAction *actionEditLoadImage;
70 QAction *actionEditToggleFloatExport;
72 QAction *actionFormatColor;
73 QAction *actionFormatPickColor;
74 QAction *actionFormatColorBranch;
75 QAction *actionFormatColorSubtree;
76 QAction *actionFormatBackColor;
77 QAction *actionFormatLinkColorHint;
78 QAction *actionFormatLinkColor;
80 QActionGroup *actionGroupModModes;
81 QAction *actionModModeColor;
82 QAction *actionModModeLink;
83 QAction *actionModModeCopy;
85 QActionGroup *actionGroupFormatFrameTypes;
86 QAction *actionFormatFrameNone;
87 QAction *actionFormatFrameRectangle;
89 QActionGroup *actionGroupFormatLinkStyles;
90 QAction *actionFormatIncludeImagesVer;
91 QAction *actionFormatIncludeImagesHor;
92 QAction *actionFormatHideLinkUnselected;
93 QAction *actionFormatLinkStyleLine;
94 QAction *actionFormatLinkStyleParabel;
95 QAction *actionFormatLinkStylePolyLine;
96 QAction *actionFormatLinkStylePolyParabel;
98 QAction *actionViewToggleNoteEditor;
100 QAction *actionSettingsAutoselectHeading;
101 QAction *actionSettingsAutoselectText;
102 QAction *actionSettingsPasteNewHeading;
103 QAction *actionSettingsAutoedit;
104 QAction *actionSettingsUseDelKey;
105 QAction *actionSettingsUseFlagGroups;
107 QPopupMenu *branchContextMenu;
108 QPopupMenu *branchAddContextMenu;
109 QPopupMenu *branchRemoveContextMenu;
110 QPopupMenu *branchLinksContextMenu;
111 QPopupMenu *branchLinksContextMenuDup;
112 QPopupMenu *floatimageContextMenu;
113 QPopupMenu *saveImageFormatMenu;
114 QPopupMenu *canvasContextMenu;
115 QPopupMenu *lastMapsMenu;
116 QPopupMenu *importMenu;
117 QPopupMenu *exportMenu;
118 QPopupMenu *exportImageFormatMenu;
124 int statusbarTime=3500;
126 int main(int argc, char** argv)
128 QApplication app(argc,argv);
130 QMimeSourceFactory *factory = QMimeSourceFactory::defaultFactory();
131 factory->setPixmap("vym_48x48", QPixmap(vym_48x48_xpm));
132 factory->setPixmap("vym_128x128", QPixmap(vym_128x128_xpm));
133 qInitNetworkProtocols();
135 // Use /usr/share/vym or /usr/local/share/vym or . ?
137 vymBaseDir.setPath ("/usr/share/vym");
138 if (!vymBaseDir.exists())
139 vymBaseDir.setPath ("/usr/local/share/vym");
140 if (!vymBaseDir.exists())
141 vymBaseDir.setPath(vymBaseDir.currentDirPath() );
143 // Initialize translations
144 QTranslator translator (0);
145 translator.load( QString("vym_")+QTextCodec::locale(), vymBaseDir.path() + "/lang");
146 app.installTranslator( &translator );
148 // Initializing the row of system flags
149 // is done in first call to MapEditor(),
150 // because we need at least one canvas first
151 systemFlagsDefault=NULL;
152 standardFlagsDefault=NULL;
154 // Reading and initializing options commandline options
155 options.add ("version", SwitchOption, "v","version");
156 options.add ("help", SwitchOption, "h", "help");
157 options.add ("quit", SwitchOption, "q", "quit");
158 options.add ("test", StringOption, "t", "test");
159 options.setHelpText (
160 "VYM - View Your Mind\n"
161 "--------------------\n\n"
162 "Information about vym can be found in vym.pdf,\n"
163 "which should be part of the vym package.\n"
164 "It is also available at the project homepage:\n\n"
165 "http://www.InSilmaril.de/vym\n");
168 cout << endl << options.getHelpText()<<endl;
172 if (options.isOn ("version"))
174 cout << "vym version "<<__VYM_VERSION
175 <<" (c) 2004 Uwe Drechsel - "
176 <<__BUILD_DATE<<endl;
181 if (options.isOn ("help"))
183 cout << options.getHelpText()<<endl;
187 if (options.isOn ("test"))
189 // FIXME testing string option only
190 cout << "Testing: "<<options.getArg("test")<< endl;
193 // Initialize window of TextEditor
194 textEditor = new TextEditor();
195 textEditor->setIcon (QPixmap (vym_editor_xpm));
196 if (textEditor->showWithMain()) textEditor->show();
198 // Initialize mainwindow
200 //m.resize(m.sizeHint());
201 m.setIcon (QPixmap (vym_48x48_xpm));
206 // For benchmarking we may want to quit immediatly after drawing
207 if (options.isOn ("quit"))
212 QObject::connect( &app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) );