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-editor.xpm"
17 #include "flagrowobj.h"
20 TextEditor *textEditor; // used in Constr. of LinkableMapObj
21 // initialized in mainwindow
23 Main *mainWindow; // used in BranchObj::select()
24 QString tmpVymDir; // All temp files go there, created in mainwindow
25 QString clipboardDir; // Clipboard used in all mapEditors
27 FlagRowObj *systemFlagsDefault; // used to copy from in LinkableMapObj
28 FlagRowObj *standardFlagsDefault;
31 // (QActionGroup could not be "enabled")
32 QPtrList <QAction> actionListBranches;
34 // Actions which change sometimes
35 QAction *actionFileSave;
36 QAction *actionFilePrint;
37 QAction *actionEditUndo;
38 QAction *actionEditRedo;
39 QAction *actionEditCopy;
40 QAction *actionEditCut;
41 QAction *actionEditPaste;
42 QAction *actionEditMoveUp;
43 QAction *actionEditMoveDown;
44 QAction *actionEditToggleScroll;
45 QAction *actionEditOpenURL;
46 QAction *actionEditURL;
47 QAction *actionEditHeading2URL;
48 QAction *actionEditBugzilla2URL;
49 QAction *actionEditFATE2URL;
50 QAction *actionEditOpenVymLink;
51 QAction *actionEditVymLink;
52 QAction *actionEditDeleteVymLink;
53 QAction *actionEditMapInfo;
54 QAction *actionEditHeading;
55 QAction *actionEditDelete;
56 QAction *actionEditAddBranch;
57 QAction *actionEditAddBranchHere;
58 QAction *actionEditAddBranchAbove;
59 QAction *actionEditAddBranchBelow;
60 QAction *actionEditRemoveBranchHere;
61 QAction *actionEditRemoveChilds;
62 QAction *actionEditImportAdd;
63 QAction *actionEditImportReplace;
64 QAction *actionEditSaveBranch;
65 QAction *actionEditSelectFirst;
66 QAction *actionEditSelectLast;
67 QAction *actionEditLoadImage;
68 QAction *actionEditToggleFloatExport;
70 QAction *actionFormatColor;
71 QAction *actionFormatPickColor;
72 QAction *actionFormatColorBranch;
73 QAction *actionFormatColorSubtree;
74 QAction *actionFormatBackColor;
75 QAction *actionFormatLinkColorHint;
76 QAction *actionFormatLinkColor;
78 QActionGroup *actionGroupModModes;
79 QAction *actionModModeColor;
80 QAction *actionModModeLink;
81 QAction *actionModModeCopy;
83 QActionGroup *actionGroupFormatFrameTypes;
84 QAction *actionFormatFrameNone;
85 QAction *actionFormatFrameRectangle;
87 QActionGroup *actionGroupFormatLinkStyles;
88 QAction *actionFormatIncludeImagesVer;
89 QAction *actionFormatIncludeImagesHor;
90 QAction *actionFormatHideLinkUnselected;
91 QAction *actionFormatLinkStyleLine;
92 QAction *actionFormatLinkStyleParabel;
93 QAction *actionFormatLinkStylePolyLine;
94 QAction *actionFormatLinkStylePolyParabel;
96 QAction *actionViewToggleNoteEditor;
98 QAction *actionSettingsAutoselectHeading;
99 QAction *actionSettingsAutoselectText;
100 QAction *actionSettingsPasteNewHeading;
101 QAction *actionSettingsAutoedit;
102 QAction *actionSettingsUseDelKey;
103 QAction *actionSettingsUseFlagGroups;
105 QPopupMenu *branchContextMenu;
106 QPopupMenu *branchAddContextMenu;
107 QPopupMenu *branchRemoveContextMenu;
108 QPopupMenu *branchLinksContextMenu;
109 QPopupMenu *branchLinksContextMenuDup;
110 QPopupMenu *floatimageContextMenu;
111 QPopupMenu *saveImageFormatMenu;
112 QPopupMenu *canvasContextMenu;
113 QPopupMenu *lastMapsMenu;
114 QPopupMenu *exportMenu;
115 QPopupMenu *exportImageFormatMenu;
121 int statusbarTime=3500;
123 int main(int argc, char** argv)
125 QApplication app(argc,argv);
127 QMimeSourceFactory *factory = QMimeSourceFactory::defaultFactory();
128 factory->setPixmap("vym_logo", QPixmap(vym_logo_xpm));
129 qInitNetworkProtocols();
131 // Use /usr/share/vym or /usr/local/share/vym or .
133 shareDir.setPath ("/usr/share/vym");
134 if (!shareDir.exists())
135 shareDir.setPath ("/usr/local/share/vym");
136 if (!shareDir.exists())
137 shareDir.setPath(".");
139 // Initialize translations
140 QTranslator translator (0);
141 translator.load( QString("vym_")+QTextCodec::locale(), shareDir.path() + "/lang");
142 app.installTranslator( &translator );
144 // Initializing the row of system flags
145 // is done in first call to MapEditor(),
146 // because we need at least one canvas first
147 systemFlagsDefault=NULL;
148 standardFlagsDefault=NULL;
150 // Reading and initializing options commandline options
151 options.add ("version", SwitchOption, "v","version");
152 options.add ("help", SwitchOption, "h", "help");
153 options.add ("quit", SwitchOption, "q", "quit");
154 options.add ("test", StringOption, "t", "test");
155 options.setHelpText (
156 "VYM - View Your Mind\n"
157 "--------------------\n\n"
158 "Information about vym can be found in vym.pdf,\n"
159 "which should be part of the vym package.\n"
160 "It is also available at the project homepage:\n\n"
161 "http://www.InSilmaril.de/vym\n");
164 cout << endl << options.getHelpText()<<endl;
168 if (options.isOn ("version"))
170 cout << "vym version "<<__VYM_VERSION__
171 <<" (c) 2004 Uwe Drechsel - "
172 <<__BUILD_DATE__<<endl;
177 if (options.isOn ("help"))
179 cout << options.getHelpText()<<endl;
183 if (options.isOn ("test"))
185 // FIXME testing string option only
186 cout << "Testing: "<<options.getArg("test")<< endl;
189 // Initialize window of TextEditor
190 textEditor = new TextEditor();
191 textEditor->setIcon (QPixmap (vym_editor_xpm));
192 if (textEditor->showWithMain()) textEditor->show();
194 // Initialize mainwindow
196 //m.resize(m.sizeHint());
197 m.setIcon (QPixmap (vym_logo_xpm));
202 // For benchmarking we may want to quit immediatly after drawing
203 if (options.isOn ("quit"))
208 QObject::connect( &app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) );