insilmaril@0: #include insilmaril@0: #include insilmaril@0: #include insilmaril@90: #include insilmaril@90: #include insilmaril@0: insilmaril@0: #include "settings.h" insilmaril@0: #include "options.h" insilmaril@0: #include "mainwindow.h" insilmaril@0: insilmaril@0: #include "icons/vym-48x48.xpm" insilmaril@0: #include "icons/vym-editor.xpm" insilmaril@0: insilmaril@0: #include "flagrowobj.h" insilmaril@0: insilmaril@0: // Global variables insilmaril@0: TextEditor *textEditor; // used in Constr. of LinkableMapObj insilmaril@0: // initialized in mainwindow insilmaril@0: insilmaril@0: Main *mainWindow; // used in BranchObj::select() insilmaril@0: MapEditor *clipboardME; insilmaril@0: FlagRowObj *systemFlagsDefault; // used to copy from in LinkableMapObj insilmaril@0: FlagRowObj *standardFlagsDefault; insilmaril@0: insilmaril@0: // Actions which change sometimes insilmaril@0: QAction *actionFileSave; insilmaril@0: QAction *actionFilePrint; insilmaril@0: QAction *actionEditUndo; insilmaril@0: QAction *actionEditCopy; insilmaril@0: QAction *actionEditCut; insilmaril@0: QAction *actionEditPaste; insilmaril@0: QAction *actionEditMoveUp; insilmaril@0: QAction *actionEditMoveDown; insilmaril@0: QAction *actionEditToggleScroll; insilmaril@0: QAction *actionEditOpenURL; insilmaril@0: QAction *actionEditURL; insilmaril@0: QAction *actionEditHeading2URL; insilmaril@0: QAction *actionEditBugzilla2URL; insilmaril@0: QAction *actionEditOpenVymLink; insilmaril@0: QAction *actionEditVymLink; insilmaril@0: QAction *actionEditDeleteVymLink; insilmaril@0: QAction *actionEditMapInfo; insilmaril@0: QAction *actionEditHeading; insilmaril@0: QAction *actionEditDelete; insilmaril@0: QAction *actionEditAddBranch; insilmaril@0: QAction *actionEditAddBranchAbove; insilmaril@0: QAction *actionEditAddBranchBelow; insilmaril@0: QAction *actionEditImportAdd; insilmaril@0: QAction *actionEditImportReplace; insilmaril@0: QAction *actionEditSaveBranch; insilmaril@0: QAction *actionEditSelectFirst; insilmaril@0: QAction *actionEditSelectLast; insilmaril@0: QAction *actionEditLoadImage; insilmaril@0: QAction *actionEditToggleFloatExport; insilmaril@0: insilmaril@0: QAction *actionFormatColor; insilmaril@0: QAction *actionFormatPickColor; insilmaril@0: QAction *actionFormatColorBranch; insilmaril@0: QAction *actionFormatColorSubtree; insilmaril@0: QAction *actionFormatBackColor; insilmaril@0: QAction *actionFormatLinkColorHint; insilmaril@0: QAction *actionFormatLinkColor; insilmaril@0: insilmaril@89: QActionGroup *actionGroupModModes; insilmaril@89: QAction *actionModModeColor; insilmaril@89: QAction *actionModModeLink; insilmaril@93: QAction *actionModModeCopy; insilmaril@89: insilmaril@0: QActionGroup *actionGroupFormatFrameTypes; insilmaril@0: QAction *actionFormatFrameNone; insilmaril@0: QAction *actionFormatFrameRectangle; insilmaril@0: insilmaril@0: QActionGroup *actionGroupFormatLinkStyles; insilmaril@0: QAction *actionFormatLinkStyleLine; insilmaril@0: QAction *actionFormatLinkStyleParabel; insilmaril@0: QAction *actionFormatLinkStylePolyLine; insilmaril@0: QAction *actionFormatLinkStylePolyParabel; insilmaril@0: insilmaril@0: QAction *actionViewToggleNoteEditor; insilmaril@0: insilmaril@0: QAction *actionSettingsAutoselectHeading; insilmaril@0: QAction *actionSettingsAutoselectText; insilmaril@0: QAction *actionSettingsPasteNewHeading; insilmaril@0: QAction *actionSettingsAutoedit; insilmaril@0: QAction *actionSettingsUseDelKey; insilmaril@0: insilmaril@0: QPopupMenu *branchContextMenu; insilmaril@89: QPopupMenu *branchLinksContextMenu; insilmaril@94: QPopupMenu *branchLinksContextMenuDup; insilmaril@0: QPopupMenu *floatimageContextMenu; insilmaril@0: QPopupMenu *saveImageFormatMenu; insilmaril@0: QPopupMenu *canvasContextMenu; insilmaril@0: QPopupMenu *lastMapsMenu; insilmaril@0: QPopupMenu *exportMenu; insilmaril@0: QPopupMenu *exportImageFormatMenu; insilmaril@0: insilmaril@0: insilmaril@0: Settings settings; insilmaril@0: Options options; insilmaril@0: insilmaril@0: int statusbarTime=3500; insilmaril@0: insilmaril@0: int main(int argc, char** argv) insilmaril@0: { insilmaril@0: QApplication app(argc,argv); insilmaril@0: insilmaril@0: insilmaril@90: // Use /usr/share/vym or /usr/local/share/vym or . insilmaril@90: QDir shareDir; insilmaril@90: shareDir.setPath ("/usr/share/vym"); insilmaril@90: if (!shareDir.exists()) insilmaril@90: shareDir.setPath ("/usr/local/share/vym"); insilmaril@90: if (!shareDir.exists()) insilmaril@90: shareDir.setPath("."); insilmaril@90: insilmaril@0: // Initialize translations insilmaril@0: QTranslator translator (0); insilmaril@91: translator.load( QString("vym_")+QTextCodec::locale(), shareDir.path() + "/lang"); insilmaril@0: app.installTranslator( &translator ); insilmaril@0: insilmaril@0: // Initializing the row of system flags insilmaril@0: // is done in first call to MapEditor(), insilmaril@0: // because we need at least one canvas first insilmaril@0: systemFlagsDefault=NULL; insilmaril@0: standardFlagsDefault=NULL; insilmaril@0: insilmaril@0: // Reading and initializing options commandline options insilmaril@0: options.add ("version", SwitchOption, "v","version"); insilmaril@0: options.add ("help", SwitchOption, "h", "help"); insilmaril@0: options.add ("quit", SwitchOption, "q", "quit"); insilmaril@0: options.add ("test", StringOption, "t", "test"); insilmaril@0: options.setHelpText ( insilmaril@0: "VYM - View Your Mind\n" insilmaril@0: "--------------------\n\n" insilmaril@0: "Information about vym can be found in vym.pdf,\n" insilmaril@0: "which should be part of the vym package.\n" insilmaril@0: "It is also available at the project homepage:\n\n" insilmaril@0: "http://www.InSilmaril.de/vym\n"); insilmaril@0: if (options.parse()) insilmaril@0: { insilmaril@0: cout << endl << options.getHelpText()<setIcon (QPixmap (vym_editor_xpm)); insilmaril@0: if (textEditor->showWithMain()) textEditor->show(); insilmaril@0: insilmaril@0: clipboardME = new MapEditor(); insilmaril@0: clipboardME->resize (800,600); insilmaril@0: clipboardME->setCaption("VYM - clipboard"); insilmaril@0: clipboardME->hide(); insilmaril@0: insilmaril@0: // Initialize mainwindow after Mapeditors (because of Flags) insilmaril@0: Main m; insilmaril@0: //m.resize(m.sizeHint()); insilmaril@0: m.setIcon (QPixmap (vym_logo_xpm)); insilmaril@0: m.show(); insilmaril@0: m.fileNew(); insilmaril@0: m.loadCmdLine(); insilmaril@0: insilmaril@0: // For benchmarking we may want to quit immediatly after drawing insilmaril@0: if (options.isOn ("quit")) insilmaril@0: { insilmaril@0: return 0; insilmaril@0: } insilmaril@0: insilmaril@0: QObject::connect( &app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) ); insilmaril@0: insilmaril@0: return app.exec(); insilmaril@0: } insilmaril@0: