1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/main.cpp Mon Oct 06 12:28:25 2008 +0000
1.3 @@ -0,0 +1,177 @@
1.4 +#include <qapplication.h>
1.5 +#include <qpixmap.h>
1.6 +#include <qtranslator.h>
1.7 +
1.8 +#include "settings.h"
1.9 +#include "options.h"
1.10 +#include "mainwindow.h"
1.11 +
1.12 +#include "icons/vym-48x48.xpm"
1.13 +#include "icons/vym-editor.xpm"
1.14 +
1.15 +#include "flagrowobj.h"
1.16 +
1.17 +// Global variables
1.18 +TextEditor *textEditor; // used in Constr. of LinkableMapObj
1.19 + // initialized in mainwindow
1.20 +
1.21 +Main *mainWindow; // used in BranchObj::select()
1.22 +MapEditor *clipboardME;
1.23 +FlagRowObj *systemFlagsDefault; // used to copy from in LinkableMapObj
1.24 +FlagRowObj *standardFlagsDefault;
1.25 +
1.26 +// Actions which change sometimes
1.27 +QAction *actionFileSave;
1.28 +QAction *actionFilePrint;
1.29 +QAction *actionEditUndo;
1.30 +QAction *actionEditCopy;
1.31 +QAction *actionEditCut;
1.32 +QAction *actionEditPaste;
1.33 +QAction *actionEditMoveUp;
1.34 +QAction *actionEditMoveDown;
1.35 +QAction *actionEditToggleScroll;
1.36 +QAction *actionEditOpenURL;
1.37 +QAction *actionEditURL;
1.38 +QAction *actionEditHeading2URL;
1.39 +QAction *actionEditBugzilla2URL;
1.40 +QAction *actionEditOpenVymLink;
1.41 +QAction *actionEditVymLink;
1.42 +QAction *actionEditDeleteVymLink;
1.43 +QAction *actionEditMapInfo;
1.44 +QAction *actionEditHeading;
1.45 +QAction *actionEditDelete;
1.46 +QAction *actionEditAddBranch;
1.47 +QAction *actionEditAddBranchAbove;
1.48 +QAction *actionEditAddBranchBelow;
1.49 +QAction *actionEditImportAdd;
1.50 +QAction *actionEditImportReplace;
1.51 +QAction *actionEditSaveBranch;
1.52 +QAction *actionEditSelectFirst;
1.53 +QAction *actionEditSelectLast;
1.54 +QAction *actionEditLoadImage;
1.55 +QAction *actionEditToggleFloatExport;
1.56 +
1.57 +QAction *actionFormatColor;
1.58 +QAction *actionFormatPickColor;
1.59 +QAction *actionFormatColorBranch;
1.60 +QAction *actionFormatColorSubtree;
1.61 +QAction *actionFormatBackColor;
1.62 +QAction *actionFormatLinkColorHint;
1.63 +QAction *actionFormatLinkColor;
1.64 +
1.65 +QActionGroup *actionGroupFormatFrameTypes;
1.66 +QAction *actionFormatFrameNone;
1.67 +QAction *actionFormatFrameRectangle;
1.68 +
1.69 +QActionGroup *actionGroupFormatLinkStyles;
1.70 +QAction *actionFormatLinkStyleLine;
1.71 +QAction *actionFormatLinkStyleParabel;
1.72 +QAction *actionFormatLinkStylePolyLine;
1.73 +QAction *actionFormatLinkStylePolyParabel;
1.74 +
1.75 +QAction *actionViewToggleNoteEditor;
1.76 +
1.77 +QAction *actionSettingsAutoselectHeading;
1.78 +QAction *actionSettingsAutoselectText;
1.79 +QAction *actionSettingsPasteNewHeading;
1.80 +QAction *actionSettingsAutoedit;
1.81 +QAction *actionSettingsUseDelKey;
1.82 +
1.83 +QPopupMenu *branchContextMenu;
1.84 +QPopupMenu *floatimageContextMenu;
1.85 +QPopupMenu *saveImageFormatMenu;
1.86 +QPopupMenu *canvasContextMenu;
1.87 +QPopupMenu *lastMapsMenu;
1.88 +QPopupMenu *exportMenu;
1.89 +QPopupMenu *exportImageFormatMenu;
1.90 +
1.91 +
1.92 +Settings settings;
1.93 +Options options;
1.94 +
1.95 +int statusbarTime=3500;
1.96 +
1.97 +int main(int argc, char** argv)
1.98 +{
1.99 + QApplication app(argc,argv);
1.100 +
1.101 +
1.102 + // Initialize translations
1.103 + QTranslator translator (0);
1.104 + translator.load( "vym_de", "." );
1.105 + app.installTranslator( &translator );
1.106 +
1.107 + // Initializing the row of system flags
1.108 + // is done in first call to MapEditor(),
1.109 + // because we need at least one canvas first
1.110 + systemFlagsDefault=NULL;
1.111 + standardFlagsDefault=NULL;
1.112 +
1.113 + // Reading and initializing options commandline options
1.114 + options.add ("version", SwitchOption, "v","version");
1.115 + options.add ("help", SwitchOption, "h", "help");
1.116 + options.add ("quit", SwitchOption, "q", "quit");
1.117 + options.add ("test", StringOption, "t", "test");
1.118 + options.setHelpText (
1.119 + "VYM - View Your Mind\n"
1.120 + "--------------------\n\n"
1.121 + "Information about vym can be found in vym.pdf,\n"
1.122 + "which should be part of the vym package.\n"
1.123 + "It is also available at the project homepage:\n\n"
1.124 + "http://www.InSilmaril.de/vym\n");
1.125 + if (options.parse())
1.126 + {
1.127 + cout << endl << options.getHelpText()<<endl;
1.128 + return 1;
1.129 + }
1.130 +
1.131 + if (options.isOn ("version"))
1.132 + {
1.133 + cout << "vym version "<<__VYM_VERSION__
1.134 + <<" (c) 2004 Uwe Drechsel - "
1.135 + <<__BUILD_DATE__<<endl;
1.136 +
1.137 + return 0;
1.138 + }
1.139 +
1.140 + if (options.isOn ("help"))
1.141 + {
1.142 + cout << options.getHelpText()<<endl;
1.143 + return 0;
1.144 + }
1.145 +
1.146 + if (options.isOn ("test"))
1.147 + {
1.148 + // FIXME testing string option only
1.149 + cout << "Testing: "<<options.getArg("test")<< endl;
1.150 + }
1.151 +
1.152 + // Initialize window of TextEditor
1.153 + textEditor = new TextEditor();
1.154 + textEditor->setIcon (QPixmap (vym_editor_xpm));
1.155 + if (textEditor->showWithMain()) textEditor->show();
1.156 +
1.157 + clipboardME = new MapEditor();
1.158 + clipboardME->resize (800,600);
1.159 + clipboardME->setCaption("VYM - clipboard");
1.160 + clipboardME->hide();
1.161 +
1.162 + // Initialize mainwindow after Mapeditors (because of Flags)
1.163 + Main m;
1.164 + //m.resize(m.sizeHint());
1.165 + m.setIcon (QPixmap (vym_logo_xpm));
1.166 + m.show();
1.167 + m.fileNew();
1.168 + m.loadCmdLine();
1.169 +
1.170 + // For benchmarking we may want to quit immediatly after drawing
1.171 + if (options.isOn ("quit"))
1.172 + {
1.173 + return 0;
1.174 + }
1.175 +
1.176 + QObject::connect( &app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) );
1.177 +
1.178 + return app.exec();
1.179 +}
1.180 +