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 MapEditor *clipboardME;
25 FlagRowObj *systemFlagsDefault; // used to copy from in LinkableMapObj
26 FlagRowObj *standardFlagsDefault;
29 // (QActionGroup could not be "enabled")
30 QPtrList <QAction> actionListBranches;
32 // Actions which change sometimes
33 QAction *actionFileSave;
34 QAction *actionFilePrint;
35 QAction *actionEditUndo;
36 QAction *actionEditCopy;
37 QAction *actionEditCut;
38 QAction *actionEditPaste;
39 QAction *actionEditMoveUp;
40 QAction *actionEditMoveDown;
41 QAction *actionEditToggleScroll;
42 QAction *actionEditOpenURL;
43 QAction *actionEditURL;
44 QAction *actionEditHeading2URL;
45 QAction *actionEditBugzilla2URL;
46 QAction *actionEditOpenVymLink;
47 QAction *actionEditVymLink;
48 QAction *actionEditDeleteVymLink;
49 QAction *actionEditMapInfo;
50 QAction *actionEditHeading;
51 QAction *actionEditDelete;
52 QAction *actionEditAddBranch;
53 QAction *actionEditAddBranchHere;
54 QAction *actionEditAddBranchAbove;
55 QAction *actionEditAddBranchBelow;
56 QAction *actionEditRemoveBranchHere;
57 QAction *actionEditRemoveChilds;
58 QAction *actionEditImportAdd;
59 QAction *actionEditImportReplace;
60 QAction *actionEditSaveBranch;
61 QAction *actionEditSelectFirst;
62 QAction *actionEditSelectLast;
63 QAction *actionEditLoadImage;
64 QAction *actionEditToggleFloatExport;
66 QAction *actionFormatColor;
67 QAction *actionFormatPickColor;
68 QAction *actionFormatColorBranch;
69 QAction *actionFormatColorSubtree;
70 QAction *actionFormatBackColor;
71 QAction *actionFormatLinkColorHint;
72 QAction *actionFormatLinkColor;
74 QActionGroup *actionGroupModModes;
75 QAction *actionModModeColor;
76 QAction *actionModModeLink;
77 QAction *actionModModeCopy;
79 QActionGroup *actionGroupFormatFrameTypes;
80 QAction *actionFormatFrameNone;
81 QAction *actionFormatFrameRectangle;
83 QActionGroup *actionGroupFormatLinkStyles;
84 QAction *actionFormatLinkStyleLine;
85 QAction *actionFormatLinkStyleParabel;
86 QAction *actionFormatLinkStylePolyLine;
87 QAction *actionFormatLinkStylePolyParabel;
89 QAction *actionViewToggleNoteEditor;
91 QAction *actionSettingsAutoselectHeading;
92 QAction *actionSettingsAutoselectText;
93 QAction *actionSettingsPasteNewHeading;
94 QAction *actionSettingsAutoedit;
95 QAction *actionSettingsUseDelKey;
96 QAction *actionSettingsUseFlagGroups;
98 QPopupMenu *branchContextMenu;
99 QPopupMenu *branchAddContextMenu;
100 QPopupMenu *branchRemoveContextMenu;
101 QPopupMenu *branchLinksContextMenu;
102 QPopupMenu *branchLinksContextMenuDup;
103 QPopupMenu *floatimageContextMenu;
104 QPopupMenu *saveImageFormatMenu;
105 QPopupMenu *canvasContextMenu;
106 QPopupMenu *lastMapsMenu;
107 QPopupMenu *exportMenu;
108 QPopupMenu *exportImageFormatMenu;
114 int statusbarTime=3500;
116 int main(int argc, char** argv)
118 QApplication app(argc,argv);
120 QMimeSourceFactory *factory = QMimeSourceFactory::defaultFactory();
121 factory->setPixmap("vym_logo", QPixmap(vym_logo_xpm));
122 qInitNetworkProtocols();
124 // Use /usr/share/vym or /usr/local/share/vym or .
126 shareDir.setPath ("/usr/share/vym");
127 if (!shareDir.exists())
128 shareDir.setPath ("/usr/local/share/vym");
129 if (!shareDir.exists())
130 shareDir.setPath(".");
132 // Initialize translations
133 QTranslator translator (0);
134 translator.load( QString("vym_")+QTextCodec::locale(), shareDir.path() + "/lang");
135 app.installTranslator( &translator );
137 // Initializing the row of system flags
138 // is done in first call to MapEditor(),
139 // because we need at least one canvas first
140 systemFlagsDefault=NULL;
141 standardFlagsDefault=NULL;
143 // Reading and initializing options commandline options
144 options.add ("version", SwitchOption, "v","version");
145 options.add ("help", SwitchOption, "h", "help");
146 options.add ("quit", SwitchOption, "q", "quit");
147 options.add ("test", StringOption, "t", "test");
148 options.setHelpText (
149 "VYM - View Your Mind\n"
150 "--------------------\n\n"
151 "Information about vym can be found in vym.pdf,\n"
152 "which should be part of the vym package.\n"
153 "It is also available at the project homepage:\n\n"
154 "http://www.InSilmaril.de/vym\n");
157 cout << endl << options.getHelpText()<<endl;
161 if (options.isOn ("version"))
163 cout << "vym version "<<__VYM_VERSION__
164 <<" (c) 2004 Uwe Drechsel - "
165 <<__BUILD_DATE__<<endl;
170 if (options.isOn ("help"))
172 cout << options.getHelpText()<<endl;
176 if (options.isOn ("test"))
178 // FIXME testing string option only
179 cout << "Testing: "<<options.getArg("test")<< endl;
182 // Initialize window of TextEditor
183 textEditor = new TextEditor();
184 textEditor->setIcon (QPixmap (vym_editor_xpm));
185 if (textEditor->showWithMain()) textEditor->show();
187 clipboardME = new MapEditor();
188 clipboardME->resize (800,600);
189 clipboardME->setCaption("VYM - clipboard");
192 // Initialize mainwindow after Mapeditors (because of Flags)
194 //m.resize(m.sizeHint());
195 m.setIcon (QPixmap (vym_logo_xpm));
200 // For benchmarking we may want to quit immediatly after drawing
201 if (options.isOn ("quit"))
206 QObject::connect( &app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) );