# HG changeset patch # User insilmaril # Date 1267816508 0 # Node ID 32f499cbe874c27cb5447abcb3fbff6b92ad02a0 # Parent 1a72c8f24c6ebc8c9044cbe91877517cf73b77a9 Fixed changelog diff -r 1a72c8f24c6e -r 32f499cbe874 main.cpp --- a/main.cpp Tue Dec 01 11:06:41 2009 +0000 +++ b/main.cpp Fri Mar 05 19:15:08 2010 +0000 @@ -1,117 +1,69 @@ -#include -#include -#include - -#include "settings.h" -#include "options.h" -#include "mainwindow.h" - -#include "icons/vym-48x48.xpm" -#include "icons/vym-editor.xpm" +#include #include "flagrowobj.h" +#include "mainwindow.h" +#include "options.h" +#include "settings.h" +#include "version.h" + +#if defined(Q_OS_WIN32) +#define WIN32_LEAN_AND_MEAN +#include +#endif // Global variables TextEditor *textEditor; // used in Constr. of LinkableMapObj // initialized in mainwindow +QString vymName; +QString vymVersion; +QString vymBuildDate; +QString vymCodeName; Main *mainWindow; // used in BranchObj::select() -MapEditor *clipboardME; +QString tmpVymDir; // All temp files go there, created in mainwindow +QString clipboardDir; // Clipboard used in all mapEditors +QString clipboardFile; // Clipboard used in all mapEditors +QDir vymBaseDir; // Containing all styles, scripts, images, ... +QDir lastImageDir; +QDir lastFileDir; +#if defined(Q_OS_WIN32) +QDir vymInstallDir; +#endif +QString iconPath; // Pointing to icons used for toolbars +QString flagsPath; // Pointing to flags +bool clipboardEmpty; +bool debug; // global debugging flag 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; +Settings settings ("InSilmaril","vym"); // Organization, Application name -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; +ImageIO imageIO; int statusbarTime=3500; -int main(int argc, char** argv) +int main(int argc, char* argv[]) { + //Q_INIT_RESOURCE (application); + QApplication app(argc,argv); + vymName=__VYM_NAME; + vymVersion=__VYM_VERSION; + vymBuildDate=__VYM_BUILD_DATE; + vymCodeName=__VYM_CODENAME; - // 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.add ("debug", Option::Switch, "d", "debug"); + options.add ("version", Option::Switch, "v","version"); + options.add ("local", Option::Switch, "l", "local"); + options.add ("help", Option::Switch, "h", "help"); + options.add ("quit", Option::Switch, "q", "quit"); + options.add ("run", Option::String, "r", "run"); + options.add ("test", Option::String, "t", "test"); options.setHelpText ( "VYM - View Your Mind\n" "--------------------\n\n" @@ -121,50 +73,136 @@ "http://www.InSilmaril.de/vym\n"); if (options.parse()) { - cout << endl << options.getHelpText()<setIcon (QPixmap (vym_editor_xpm)); - if (textEditor->showWithMain()) textEditor->show(); + textEditor->setIcon (QPixmap (iconPath+"vym-editor.png")); - clipboardME = new MapEditor(); - clipboardME->resize (800,600); - clipboardME->setCaption("VYM - clipboard"); - clipboardME->hide(); + // Initialize mainwindow +#if defined(Q_OS_WIN32) + Main m(0, 0, (Qt::Window | Qt::MSWindowsOwnDC)); +#else + Main m; +#endif - // Initialize mainwindow after Mapeditors (because of Flags) - Main m; //m.resize(m.sizeHint()); - m.setIcon (QPixmap (vym_logo_xpm)); + m.setIcon (QPixmap (iconPath+"vym.png")); m.show(); m.fileNew(); m.loadCmdLine(); - // For benchmarking we may want to quit immediatly after drawing + // Run script + if (options.isOn ("run")) + { + QString script; + QString fn=options.getArg ("run"); + if ( !fn.isEmpty() ) + { + QFile f( fn ); + if ( !f.open( QIODevice::ReadOnly ) ) + { + QMessageBox::warning(0, + QObject::tr("Error"), + QObject::tr("Couldn't open %1.\n").arg(fn)); + return 0; + } + + QTextStream ts( &f ); + script= ts.read(); + f.close(); + m.setScript (script); + m.runScriptEverywhere (script); + } + } + + // For benchmarking we may want to quit instead of entering event loop if (options.isOn ("quit")) { return 0; @@ -174,4 +212,3 @@ return app.exec(); } - diff -r 1a72c8f24c6e -r 32f499cbe874 tex/vym.changelog --- a/tex/vym.changelog Tue Dec 01 11:06:41 2009 +0000 +++ b/tex/vym.changelog Fri Mar 05 19:15:08 2010 +0000 @@ -1,12 +1,12 @@ ------------------------------------------------------------------- -Mon Nov 30 19:34:51 CET 2009 - uwe +Mon Nov 30 19:34:51 CET 2009 - uwedr@suse.de - Version: 1.12.6 - Bugfix: Selection rectangle not always shown, forcing update of QGraphicsScene now. ------------------------------------------------------------------- -Mon Nov 16 10:03:52 CET 2009 - uwe@insilmaril.de +Mon Nov 16 10:03:52 CET 2009 - uwedr@suse.de - Version: 1.12.5 - Bugfix: Crash after switching back to a map, where the mapcenter