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