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