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;
95 QPopupMenu *branchContextMenu;
96 QPopupMenu *branchAddContextMenu;
97 QPopupMenu *branchRemoveContextMenu;
98 QPopupMenu *branchLinksContextMenu;
99 QPopupMenu *branchLinksContextMenuDup;
100 QPopupMenu *floatimageContextMenu;
101 QPopupMenu *saveImageFormatMenu;
102 QPopupMenu *canvasContextMenu;
103 QPopupMenu *lastMapsMenu;
104 QPopupMenu *exportMenu;
105 QPopupMenu *exportImageFormatMenu;
111 int statusbarTime=3500;
113 int main(int argc, char** argv)
115 QApplication app(argc,argv);
118 // Use /usr/share/vym or /usr/local/share/vym or .
120 shareDir.setPath ("/usr/share/vym");
121 if (!shareDir.exists())
122 shareDir.setPath ("/usr/local/share/vym");
123 if (!shareDir.exists())
124 shareDir.setPath(".");
126 // Initialize translations
127 QTranslator translator (0);
128 translator.load( QString("vym_")+QTextCodec::locale(), shareDir.path() + "/lang");
129 app.installTranslator( &translator );
131 // Initializing the row of system flags
132 // is done in first call to MapEditor(),
133 // because we need at least one canvas first
134 systemFlagsDefault=NULL;
135 standardFlagsDefault=NULL;
137 // Reading and initializing options commandline options
138 options.add ("version", SwitchOption, "v","version");
139 options.add ("help", SwitchOption, "h", "help");
140 options.add ("quit", SwitchOption, "q", "quit");
141 options.add ("test", StringOption, "t", "test");
142 options.setHelpText (
143 "VYM - View Your Mind\n"
144 "--------------------\n\n"
145 "Information about vym can be found in vym.pdf,\n"
146 "which should be part of the vym package.\n"
147 "It is also available at the project homepage:\n\n"
148 "http://www.InSilmaril.de/vym\n");
151 cout << endl << options.getHelpText()<<endl;
155 if (options.isOn ("version"))
157 cout << "vym version "<<__VYM_VERSION__
158 <<" (c) 2004 Uwe Drechsel - "
159 <<__BUILD_DATE__<<endl;
164 if (options.isOn ("help"))
166 cout << options.getHelpText()<<endl;
170 if (options.isOn ("test"))
172 // FIXME testing string option only
173 cout << "Testing: "<<options.getArg("test")<< endl;
176 // Initialize window of TextEditor
177 textEditor = new TextEditor();
178 textEditor->setIcon (QPixmap (vym_editor_xpm));
179 if (textEditor->showWithMain()) textEditor->show();
181 clipboardME = new MapEditor();
182 clipboardME->resize (800,600);
183 clipboardME->setCaption("VYM - clipboard");
186 // Initialize mainwindow after Mapeditors (because of Flags)
188 //m.resize(m.sizeHint());
189 m.setIcon (QPixmap (vym_logo_xpm));
194 // For benchmarking we may want to quit immediatly after drawing
195 if (options.isOn ("quit"))
200 QObject::connect( &app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) );