Initial import.
1 #include <qapplication.h>
3 #include <qtranslator.h>
7 #include "mainwindow.h"
9 #include "icons/vym-48x48.xpm"
10 #include "icons/vym-editor.xpm"
12 #include "flagrowobj.h"
15 TextEditor *textEditor; // used in Constr. of LinkableMapObj
16 // initialized in mainwindow
18 Main *mainWindow; // used in BranchObj::select()
19 MapEditor *clipboardME;
20 FlagRowObj *systemFlagsDefault; // used to copy from in LinkableMapObj
21 FlagRowObj *standardFlagsDefault;
23 // Actions which change sometimes
24 QAction *actionFileSave;
25 QAction *actionFilePrint;
26 QAction *actionEditUndo;
27 QAction *actionEditCopy;
28 QAction *actionEditCut;
29 QAction *actionEditPaste;
30 QAction *actionEditMoveUp;
31 QAction *actionEditMoveDown;
32 QAction *actionEditToggleScroll;
33 QAction *actionEditOpenURL;
34 QAction *actionEditURL;
35 QAction *actionEditHeading2URL;
36 QAction *actionEditBugzilla2URL;
37 QAction *actionEditOpenVymLink;
38 QAction *actionEditVymLink;
39 QAction *actionEditDeleteVymLink;
40 QAction *actionEditMapInfo;
41 QAction *actionEditHeading;
42 QAction *actionEditDelete;
43 QAction *actionEditAddBranch;
44 QAction *actionEditAddBranchAbove;
45 QAction *actionEditAddBranchBelow;
46 QAction *actionEditImportAdd;
47 QAction *actionEditImportReplace;
48 QAction *actionEditSaveBranch;
49 QAction *actionEditSelectFirst;
50 QAction *actionEditSelectLast;
51 QAction *actionEditLoadImage;
52 QAction *actionEditToggleFloatExport;
54 QAction *actionFormatColor;
55 QAction *actionFormatPickColor;
56 QAction *actionFormatColorBranch;
57 QAction *actionFormatColorSubtree;
58 QAction *actionFormatBackColor;
59 QAction *actionFormatLinkColorHint;
60 QAction *actionFormatLinkColor;
62 QActionGroup *actionGroupFormatFrameTypes;
63 QAction *actionFormatFrameNone;
64 QAction *actionFormatFrameRectangle;
66 QActionGroup *actionGroupFormatLinkStyles;
67 QAction *actionFormatLinkStyleLine;
68 QAction *actionFormatLinkStyleParabel;
69 QAction *actionFormatLinkStylePolyLine;
70 QAction *actionFormatLinkStylePolyParabel;
72 QAction *actionViewToggleNoteEditor;
74 QAction *actionSettingsAutoselectHeading;
75 QAction *actionSettingsAutoselectText;
76 QAction *actionSettingsPasteNewHeading;
77 QAction *actionSettingsAutoedit;
78 QAction *actionSettingsUseDelKey;
80 QPopupMenu *branchContextMenu;
81 QPopupMenu *floatimageContextMenu;
82 QPopupMenu *saveImageFormatMenu;
83 QPopupMenu *canvasContextMenu;
84 QPopupMenu *lastMapsMenu;
85 QPopupMenu *exportMenu;
86 QPopupMenu *exportImageFormatMenu;
92 int statusbarTime=3500;
94 int main(int argc, char** argv)
96 QApplication app(argc,argv);
99 // Initialize translations
100 QTranslator translator (0);
101 translator.load( "vym_de", "." );
102 app.installTranslator( &translator );
104 // Initializing the row of system flags
105 // is done in first call to MapEditor(),
106 // because we need at least one canvas first
107 systemFlagsDefault=NULL;
108 standardFlagsDefault=NULL;
110 // Reading and initializing options commandline options
111 options.add ("version", SwitchOption, "v","version");
112 options.add ("help", SwitchOption, "h", "help");
113 options.add ("quit", SwitchOption, "q", "quit");
114 options.add ("test", StringOption, "t", "test");
115 options.setHelpText (
116 "VYM - View Your Mind\n"
117 "--------------------\n\n"
118 "Information about vym can be found in vym.pdf,\n"
119 "which should be part of the vym package.\n"
120 "It is also available at the project homepage:\n\n"
121 "http://www.InSilmaril.de/vym\n");
124 cout << endl << options.getHelpText()<<endl;
128 if (options.isOn ("version"))
130 cout << "vym version "<<__VYM_VERSION__
131 <<" (c) 2004 Uwe Drechsel - "
132 <<__BUILD_DATE__<<endl;
137 if (options.isOn ("help"))
139 cout << options.getHelpText()<<endl;
143 if (options.isOn ("test"))
145 // FIXME testing string option only
146 cout << "Testing: "<<options.getArg("test")<< endl;
149 // Initialize window of TextEditor
150 textEditor = new TextEditor();
151 textEditor->setIcon (QPixmap (vym_editor_xpm));
152 if (textEditor->showWithMain()) textEditor->show();
154 clipboardME = new MapEditor();
155 clipboardME->resize (800,600);
156 clipboardME->setCaption("VYM - clipboard");
159 // Initialize mainwindow after Mapeditors (because of Flags)
161 //m.resize(m.sizeHint());
162 m.setIcon (QPixmap (vym_logo_xpm));
167 // For benchmarking we may want to quit immediatly after drawing
168 if (options.isOn ("quit"))
173 QObject::connect( &app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) );