1 #include <qapplication.h>
3 #include <qtranslator.h>
6 #include <qtextcodec.h>
10 #include "mainwindow.h"
12 #include "icons/vym-48x48.xpm"
13 #include "icons/vym-editor.xpm"
15 #include "flagrowobj.h"
18 TextEditor *textEditor; // used in Constr. of LinkableMapObj
19 // initialized in mainwindow
21 Main *mainWindow; // used in BranchObj::select()
22 MapEditor *clipboardME;
23 FlagRowObj *systemFlagsDefault; // used to copy from in LinkableMapObj
24 FlagRowObj *standardFlagsDefault;
27 // (QActionGroup could not be "enabled")
28 QPtrList <QAction> actionListBranches;
30 // Actions which change sometimes
31 QAction *actionFileSave;
32 QAction *actionFilePrint;
33 QAction *actionEditUndo;
34 QAction *actionEditCopy;
35 QAction *actionEditCut;
36 QAction *actionEditPaste;
37 QAction *actionEditMoveUp;
38 QAction *actionEditMoveDown;
39 QAction *actionEditToggleScroll;
40 QAction *actionEditOpenURL;
41 QAction *actionEditURL;
42 QAction *actionEditHeading2URL;
43 QAction *actionEditBugzilla2URL;
44 QAction *actionEditOpenVymLink;
45 QAction *actionEditVymLink;
46 QAction *actionEditDeleteVymLink;
47 QAction *actionEditMapInfo;
48 QAction *actionEditHeading;
49 QAction *actionEditDelete;
50 QAction *actionEditAddBranch;
51 QAction *actionEditAddBranchHere;
52 QAction *actionEditAddBranchAbove;
53 QAction *actionEditAddBranchBelow;
54 QAction *actionEditRemoveBranchHere;
55 QAction *actionEditRemoveChilds;
56 QAction *actionEditImportAdd;
57 QAction *actionEditImportReplace;
58 QAction *actionEditSaveBranch;
59 QAction *actionEditSelectFirst;
60 QAction *actionEditSelectLast;
61 QAction *actionEditLoadImage;
62 QAction *actionEditToggleFloatExport;
64 QAction *actionFormatColor;
65 QAction *actionFormatPickColor;
66 QAction *actionFormatColorBranch;
67 QAction *actionFormatColorSubtree;
68 QAction *actionFormatBackColor;
69 QAction *actionFormatLinkColorHint;
70 QAction *actionFormatLinkColor;
72 QActionGroup *actionGroupModModes;
73 QAction *actionModModeColor;
74 QAction *actionModModeLink;
75 QAction *actionModModeCopy;
77 QActionGroup *actionGroupFormatFrameTypes;
78 QAction *actionFormatFrameNone;
79 QAction *actionFormatFrameRectangle;
81 QActionGroup *actionGroupFormatLinkStyles;
82 QAction *actionFormatLinkStyleLine;
83 QAction *actionFormatLinkStyleParabel;
84 QAction *actionFormatLinkStylePolyLine;
85 QAction *actionFormatLinkStylePolyParabel;
87 QAction *actionViewToggleNoteEditor;
89 QAction *actionSettingsAutoselectHeading;
90 QAction *actionSettingsAutoselectText;
91 QAction *actionSettingsPasteNewHeading;
92 QAction *actionSettingsAutoedit;
93 QAction *actionSettingsUseDelKey;
94 QAction *actionSettingsUseFlagGroups;
96 QPopupMenu *branchContextMenu;
97 QPopupMenu *branchAddContextMenu;
98 QPopupMenu *branchRemoveContextMenu;
99 QPopupMenu *branchLinksContextMenu;
100 QPopupMenu *branchLinksContextMenuDup;
101 QPopupMenu *floatimageContextMenu;
102 QPopupMenu *saveImageFormatMenu;
103 QPopupMenu *canvasContextMenu;
104 QPopupMenu *lastMapsMenu;
105 QPopupMenu *exportMenu;
106 QPopupMenu *exportImageFormatMenu;
112 int statusbarTime=3500;
114 int main(int argc, char** argv)
116 QApplication app(argc,argv);
119 // Use /usr/share/vym or /usr/local/share/vym or .
121 shareDir.setPath ("/usr/share/vym");
122 if (!shareDir.exists())
123 shareDir.setPath ("/usr/local/share/vym");
124 if (!shareDir.exists())
125 shareDir.setPath(".");
127 // Initialize translations
128 QTranslator translator (0);
129 translator.load( QString("vym_")+QTextCodec::locale(), shareDir.path() + "/lang");
130 app.installTranslator( &translator );
132 // Initializing the row of system flags
133 // is done in first call to MapEditor(),
134 // because we need at least one canvas first
135 systemFlagsDefault=NULL;
136 standardFlagsDefault=NULL;
138 // Reading and initializing options commandline options
139 options.add ("version", SwitchOption, "v","version");
140 options.add ("help", SwitchOption, "h", "help");
141 options.add ("quit", SwitchOption, "q", "quit");
142 options.add ("test", StringOption, "t", "test");
143 options.setHelpText (
144 "VYM - View Your Mind\n"
145 "--------------------\n\n"
146 "Information about vym can be found in vym.pdf,\n"
147 "which should be part of the vym package.\n"
148 "It is also available at the project homepage:\n\n"
149 "http://www.InSilmaril.de/vym\n");
152 cout << endl << options.getHelpText()<<endl;
156 if (options.isOn ("version"))
158 cout << "vym version "<<__VYM_VERSION__
159 <<" (c) 2004 Uwe Drechsel - "
160 <<__BUILD_DATE__<<endl;
165 if (options.isOn ("help"))
167 cout << options.getHelpText()<<endl;
171 if (options.isOn ("test"))
173 // FIXME testing string option only
174 cout << "Testing: "<<options.getArg("test")<< endl;
177 // Initialize window of TextEditor
178 textEditor = new TextEditor();
179 textEditor->setIcon (QPixmap (vym_editor_xpm));
180 if (textEditor->showWithMain()) textEditor->show();
182 clipboardME = new MapEditor();
183 clipboardME->resize (800,600);
184 clipboardME->setCaption("VYM - clipboard");
187 // Initialize mainwindow after Mapeditors (because of Flags)
189 //m.resize(m.sizeHint());
190 m.setIcon (QPixmap (vym_logo_xpm));
195 // For benchmarking we may want to quit immediatly after drawing
196 if (options.isOn ("quit"))
201 QObject::connect( &app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) );