Fixed changelog release-1-12-maintained
authorinsilmaril
Fri Mar 05 19:15:08 2010 +0000 (2010-03-05)
branchrelease-1-12-maintained
changeset 7932f499cbe874
parent 78 1a72c8f24c6e
child 80 5c5b4464b24f
Fixed changelog
main.cpp
tex/vym.changelog
     1.1 --- a/main.cpp	Tue Dec 01 11:06:41 2009 +0000
     1.2 +++ b/main.cpp	Fri Mar 05 19:15:08 2010 +0000
     1.3 @@ -1,117 +1,69 @@
     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 +#include <QApplication>
    1.15  
    1.16  #include "flagrowobj.h"
    1.17 +#include "mainwindow.h"
    1.18 +#include "options.h"
    1.19 +#include "settings.h"
    1.20 +#include "version.h"
    1.21 +
    1.22 +#if defined(Q_OS_WIN32)
    1.23 +#define WIN32_LEAN_AND_MEAN
    1.24 +#include <windows.h>
    1.25 +#endif
    1.26  
    1.27  // Global variables
    1.28  TextEditor *textEditor;			// used in Constr. of LinkableMapObj
    1.29  								// initialized in mainwindow
    1.30 +QString vymName;
    1.31 +QString vymVersion;
    1.32 +QString vymBuildDate;
    1.33 +QString vymCodeName;
    1.34  
    1.35  Main *mainWindow;				// used in BranchObj::select()								
    1.36 -MapEditor *clipboardME;			
    1.37 +QString tmpVymDir;				// All temp files go there, created in mainwindow
    1.38 +QString clipboardDir;			// Clipboard used in all mapEditors
    1.39 +QString clipboardFile;			// Clipboard used in all mapEditors
    1.40 +QDir vymBaseDir;				// Containing all styles, scripts, images, ...
    1.41 +QDir lastImageDir;
    1.42 +QDir lastFileDir;
    1.43 +#if defined(Q_OS_WIN32)
    1.44 +QDir vymInstallDir;
    1.45 +#endif
    1.46 +QString iconPath;				// Pointing to icons used for toolbars
    1.47 +QString flagsPath;				// Pointing to flags
    1.48 +bool clipboardEmpty;			
    1.49 +bool debug;						// global debugging flag
    1.50  FlagRowObj *systemFlagsDefault;	// used to copy from in LinkableMapObj
    1.51  FlagRowObj *standardFlagsDefault;
    1.52  
    1.53 -// Actions which change sometimes
    1.54 -QAction *actionFileSave;
    1.55 -QAction *actionFilePrint;
    1.56 -QAction *actionEditUndo;
    1.57 -QAction *actionEditCopy;
    1.58 -QAction *actionEditCut;
    1.59 -QAction *actionEditPaste;
    1.60 -QAction *actionEditMoveUp;
    1.61 -QAction *actionEditMoveDown;
    1.62 -QAction *actionEditToggleScroll;
    1.63 -QAction *actionEditOpenURL;
    1.64 -QAction *actionEditURL;
    1.65 -QAction *actionEditHeading2URL;
    1.66 -QAction *actionEditBugzilla2URL;
    1.67 -QAction *actionEditOpenVymLink;
    1.68 -QAction *actionEditVymLink;
    1.69 -QAction *actionEditDeleteVymLink;
    1.70 -QAction *actionEditMapInfo;
    1.71 -QAction *actionEditHeading;
    1.72 -QAction *actionEditDelete;
    1.73 -QAction *actionEditAddBranch;
    1.74 -QAction *actionEditAddBranchAbove;
    1.75 -QAction *actionEditAddBranchBelow;
    1.76 -QAction *actionEditImportAdd;
    1.77 -QAction *actionEditImportReplace;
    1.78 -QAction *actionEditSaveBranch;
    1.79 -QAction *actionEditSelectFirst;
    1.80 -QAction *actionEditSelectLast;
    1.81 -QAction *actionEditLoadImage;
    1.82 -QAction *actionEditToggleFloatExport;
    1.83  
    1.84 -QAction *actionFormatColor;		
    1.85 -QAction *actionFormatPickColor;		
    1.86 -QAction *actionFormatColorBranch;
    1.87 -QAction *actionFormatColorSubtree;
    1.88 -QAction *actionFormatBackColor;
    1.89 -QAction *actionFormatLinkColorHint;
    1.90 -QAction *actionFormatLinkColor;		
    1.91 +Settings settings ("InSilmaril","vym"); // Organization, Application name
    1.92  
    1.93 -QActionGroup *actionGroupFormatFrameTypes;
    1.94 -QAction *actionFormatFrameNone;
    1.95 -QAction *actionFormatFrameRectangle;
    1.96 -
    1.97 -QActionGroup *actionGroupFormatLinkStyles;
    1.98 -QAction *actionFormatLinkStyleLine;
    1.99 -QAction *actionFormatLinkStyleParabel;
   1.100 -QAction *actionFormatLinkStylePolyLine;
   1.101 -QAction *actionFormatLinkStylePolyParabel;
   1.102 -
   1.103 -QAction *actionViewToggleNoteEditor;
   1.104 -
   1.105 -QAction *actionSettingsAutoselectHeading;
   1.106 -QAction *actionSettingsAutoselectText;
   1.107 -QAction *actionSettingsPasteNewHeading;
   1.108 -QAction *actionSettingsAutoedit;
   1.109 -QAction *actionSettingsUseDelKey;
   1.110 -
   1.111 -QPopupMenu *branchContextMenu;
   1.112 -QPopupMenu *floatimageContextMenu;
   1.113 -QPopupMenu *saveImageFormatMenu;
   1.114 -QPopupMenu *canvasContextMenu;
   1.115 -QPopupMenu *lastMapsMenu;
   1.116 -QPopupMenu *exportMenu;
   1.117 -QPopupMenu *exportImageFormatMenu;
   1.118 -
   1.119 -
   1.120 -Settings settings;
   1.121  Options options;
   1.122 +ImageIO imageIO;
   1.123  
   1.124  int statusbarTime=3500;
   1.125  
   1.126 -int main(int argc, char** argv)
   1.127 +int main(int argc, char* argv[])
   1.128  {
   1.129 +	//Q_INIT_RESOURCE (application);
   1.130 +
   1.131      QApplication app(argc,argv);
   1.132  
   1.133 +	vymName=__VYM_NAME;
   1.134 +	vymVersion=__VYM_VERSION;
   1.135 +	vymBuildDate=__VYM_BUILD_DATE;
   1.136 +	vymCodeName=__VYM_CODENAME;
   1.137  
   1.138 -	// Initialize translations
   1.139 -	QTranslator translator (0);
   1.140 -	translator.load( "vym_de", "." );
   1.141 -    app.installTranslator( &translator );
   1.142 -
   1.143 -	// Initializing the row of system flags
   1.144 -	// is done in first call to MapEditor(),
   1.145 -	// because we need at least one canvas first
   1.146 -	systemFlagsDefault=NULL;
   1.147 -	standardFlagsDefault=NULL;
   1.148  
   1.149  	// Reading and initializing options commandline options
   1.150 -	options.add ("version", SwitchOption, "v","version");
   1.151 -	options.add ("help", SwitchOption, "h", "help");
   1.152 -	options.add ("quit", SwitchOption, "q", "quit");
   1.153 -	options.add ("test", StringOption, "t", "test");
   1.154 +	options.add ("debug", Option::Switch, "d", "debug");
   1.155 +	options.add ("version", Option::Switch, "v","version");
   1.156 +	options.add ("local", Option::Switch, "l", "local");
   1.157 +	options.add ("help", Option::Switch, "h", "help");
   1.158 +	options.add ("quit", Option::Switch, "q", "quit");
   1.159 +	options.add ("run", Option::String, "r", "run");
   1.160 +	options.add ("test", Option::String, "t", "test");
   1.161  	options.setHelpText (
   1.162  		"VYM - View Your Mind\n"
   1.163  		"--------------------\n\n"
   1.164 @@ -121,50 +73,136 @@
   1.165  		"http://www.InSilmaril.de/vym\n");
   1.166  	if (options.parse())
   1.167  	{
   1.168 -		cout << endl << options.getHelpText()<<endl;
   1.169 +		cout << endl << qPrintable( options.getHelpText())<<endl;
   1.170  		return 1;
   1.171  	}
   1.172  
   1.173 +	debug=options.isOn ("debug");
   1.174 +
   1.175  	if (options.isOn ("version"))
   1.176  	{
   1.177 -		cout << "vym version "<<__VYM_VERSION__
   1.178 -			<<"  (c) 2004 Uwe Drechsel - "
   1.179 -			<<__BUILD_DATE__<<endl;
   1.180 +		cout << "VYM - View Your Mind (c) 2004-2007 Uwe Drechsel "  << endl
   1.181 +			<<"   Version: "<<__VYM_VERSION <<endl
   1.182 +			<<"Build date: "<<__VYM_BUILD_DATE << endl
   1.183 +			<<"  "<<__VYM_CODENAME<<endl;
   1.184  			
   1.185  		return 0;	
   1.186  	}		
   1.187  	
   1.188 +	// Use /usr/share/vym or /usr/local/share/vym or . ?
   1.189 +	// First try options
   1.190 +	if (options.isOn ("local"))
   1.191 +	{
   1.192 +		vymBaseDir.setPath (vymBaseDir.currentDirPath());
   1.193 +	} else
   1.194 +	// then look for environment variable
   1.195 +	if (getenv("VYMHOME")!=0)
   1.196 +	{
   1.197 +		vymBaseDir.setPath (getenv("VYMHOME"));
   1.198 +	} else
   1.199 +	// ok, let's find my way on my own
   1.200 +	{
   1.201 +		#if defined (Q_OS_MACX)
   1.202 +			vymBaseDir.setPath(vymBaseDir.currentDirPath() +"/vym.app/Contents/Resources");
   1.203 +
   1.204 +        #elif defined (Q_OS_WIN32)
   1.205 +            QString basePath;
   1.206 +
   1.207 +            wchar_t wbuf[512];
   1.208 +            if (GetModuleFileName(NULL, wbuf, 512))
   1.209 +            {
   1.210 +                QString mfn(QString::fromWCharArray(wbuf));
   1.211 +                mfn.replace('\\', '/');
   1.212 +                if (mfn.endsWith("/bin/vym.exe", Qt::CaseInsensitive))
   1.213 +                {
   1.214 +                    mfn.chop(12);
   1.215 +                    basePath = mfn;
   1.216 +                }
   1.217 +            }
   1.218 +
   1.219 +            if (basePath.isEmpty())
   1.220 +                basePath = vymBaseDir.currentDirPath();
   1.221 +
   1.222 +            vymInstallDir.setPath(basePath);
   1.223 +            vymBaseDir.setPath(basePath + "/share/vym");
   1.224 +
   1.225 +		#else
   1.226 +			vymBaseDir.setPath ("/usr/share/vym");
   1.227 +			if (!vymBaseDir.exists())
   1.228 +			{
   1.229 +				vymBaseDir.setPath ("/usr/local/share/vym");
   1.230 +				if (!vymBaseDir.exists())
   1.231 +					vymBaseDir.setPath(vymBaseDir.currentDirPath() );
   1.232 +			}		
   1.233 +		#endif
   1.234 +	}
   1.235 +
   1.236 +	iconPath=vymBaseDir.path()+"/icons/";
   1.237 +	flagsPath=vymBaseDir.path()+"/flags/";
   1.238 +
   1.239 +	// Some directories
   1.240 +	lastImageDir=QDir().current();
   1.241 +	lastFileDir=QDir().current();
   1.242 +
   1.243  	if (options.isOn ("help"))
   1.244  	{
   1.245 -		cout << options.getHelpText()<<endl;
   1.246 +		cout << qPrintable (options.getHelpText())<<endl;
   1.247  		return 0;	
   1.248  	}	
   1.249  
   1.250 -	if (options.isOn ("test"))
   1.251 -	{
   1.252 -		// FIXME testing string option only
   1.253 -		cout << "Testing: "<<options.getArg("test")<< endl;
   1.254 -	}	
   1.255 +	// Initialize translations
   1.256 +	QTranslator translator (0);
   1.257 +	translator.load( QString("vym_")+QTextCodec::locale(), vymBaseDir.path() + "/lang");
   1.258 +    app.installTranslator( &translator );
   1.259 +
   1.260 +	// Initializing the row of system flags
   1.261 +	// is done in first call to MapEditor(),
   1.262 +	// because we need at least one canvas first
   1.263 +	systemFlagsDefault=NULL;
   1.264 +	standardFlagsDefault=NULL;
   1.265  
   1.266  	// Initialize window of TextEditor
   1.267  	textEditor = new TextEditor();
   1.268 -	textEditor->setIcon (QPixmap (vym_editor_xpm));
   1.269 -	if (textEditor->showWithMain()) textEditor->show();
   1.270 +	textEditor->setIcon (QPixmap (iconPath+"vym-editor.png"));
   1.271  
   1.272 -	clipboardME = new MapEditor();
   1.273 -	clipboardME->resize (800,600);
   1.274 -	clipboardME->setCaption("VYM - clipboard");
   1.275 -	clipboardME->hide();
   1.276 +	// Initialize mainwindow 
   1.277 +#if defined(Q_OS_WIN32)
   1.278 +    Main m(0, 0, (Qt::Window | Qt::MSWindowsOwnDC));
   1.279 +#else
   1.280 +    Main m;
   1.281 +#endif
   1.282  
   1.283 -	// Initialize mainwindow after Mapeditors (because of Flags)
   1.284 -    Main m;
   1.285  	//m.resize(m.sizeHint());
   1.286 -	m.setIcon (QPixmap (vym_logo_xpm));
   1.287 +	m.setIcon (QPixmap (iconPath+"vym.png"));
   1.288  	m.show();
   1.289  	m.fileNew();
   1.290  	m.loadCmdLine();
   1.291  
   1.292 -	// For benchmarking we may want to quit immediatly after drawing
   1.293 +	// Run script
   1.294 +	if (options.isOn ("run"))
   1.295 +	{
   1.296 +		QString script;
   1.297 +		QString fn=options.getArg ("run");
   1.298 +		if ( !fn.isEmpty() )
   1.299 +		{
   1.300 +			QFile f( fn );
   1.301 +			if ( !f.open( QIODevice::ReadOnly ) )
   1.302 +			{
   1.303 +				QMessageBox::warning(0, 
   1.304 +					QObject::tr("Error"),
   1.305 +					QObject::tr("Couldn't open %1.\n").arg(fn));
   1.306 +				return 0;
   1.307 +			}	
   1.308 +
   1.309 +			QTextStream ts( &f );
   1.310 +			script= ts.read();
   1.311 +			f.close();
   1.312 +			m.setScript (script);
   1.313 +			m.runScriptEverywhere (script);
   1.314 +		}
   1.315 +	}		
   1.316 +	
   1.317 +	// For benchmarking we may want to quit instead of entering event loop
   1.318  	if (options.isOn ("quit"))
   1.319  	{
   1.320  		return 0;
   1.321 @@ -174,4 +212,3 @@
   1.322  
   1.323      return app.exec();
   1.324  }
   1.325 -
     2.1 --- a/tex/vym.changelog	Tue Dec 01 11:06:41 2009 +0000
     2.2 +++ b/tex/vym.changelog	Fri Mar 05 19:15:08 2010 +0000
     2.3 @@ -1,12 +1,12 @@
     2.4  -------------------------------------------------------------------
     2.5 -Mon Nov 30 19:34:51 CET 2009 - uwe
     2.6 +Mon Nov 30 19:34:51 CET 2009 - uwedr@suse.de
     2.7  
     2.8  - Version: 1.12.6
     2.9  - Bugfix: Selection rectangle not always shown, forcing update of
    2.10            QGraphicsScene now.
    2.11  
    2.12  -------------------------------------------------------------------
    2.13 -Mon Nov 16 10:03:52 CET 2009 - uwe@insilmaril.de
    2.14 +Mon Nov 16 10:03:52 CET 2009 - uwedr@suse.de
    2.15  
    2.16  - Version: 1.12.5
    2.17  - Bugfix: Crash after switching back to a map, where the mapcenter