First compilation on QT4 qt4-port
authorinsilmaril
Tue, 06 Jun 2006 14:58:11 +0000
branchqt4-port
changeset 2608f976aa7bb
parent 1 9eb7767c2dfa
child 3 6a0342b3c519
First compilation on QT4
aboutdialog.cpp
aboutdialog.h
branchobj.cpp
branchobj.h
demos/todo.vym
exportoofiledialog.cpp
exportoofiledialog.h
exports.cpp
exportxhtmldialog.ui.h
file.cpp
file.h
findwindow.cpp
findwindow.h
flagobj.cpp
flagobj.h
flagrowobj.cpp
flagrowobj.h
floatimageobj.cpp
floatimageobj.h
floatobj.cpp
floatobj.h
frameobj.cpp
frameobj.h
headingobj.cpp
headingobj.h
imageobj.cpp
imageobj.h
imports.cpp
linkablemapobj.cpp
linkablemapobj.h
main.cpp
mainwindow.cpp
mainwindow.h
mapcenterobj.cpp
mapcenterobj.h
mapeditor.cpp
mapeditor.h
mapobj.cpp
mapobj.h
misc.cpp
options.cpp
options.h
ornamentedobj.cpp
ornamentedobj.h
process.h
selection.h
texteditor.cpp
texteditor.h
version.h
vym.pro
warningdialog.ui.h
xlinkobj.cpp
xlinkobj.h
xml.cpp
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/aboutdialog.cpp	Tue Jun 06 14:58:11 2006 +0000
     1.3 @@ -0,0 +1,208 @@
     1.4 +#include <qmime.h>
     1.5 +#include <q3process.h>
     1.6 +//Added by qt3to4:
     1.7 +#include <Q3VBoxLayout>
     1.8 +#include <Q3Frame>
     1.9 +
    1.10 +#include "aboutdialog.h"
    1.11 +#include "version.h"
    1.12 +#include "settings.h"
    1.13 +#include "mainwindow.h"
    1.14 +
    1.15 +
    1.16 +extern Main *mainWindow;
    1.17 +extern Settings settings;
    1.18 +extern QString iconPath;
    1.19 +
    1.20 +AboutDialog::AboutDialog( QWidget *parent, const char *name)
    1.21 +    : QDialog( parent, name)
    1.22 +{
    1.23 + 
    1.24 +    mainLayout=new QVBoxLayout( this, 10);
    1.25 +
    1.26 +    tabs=new QTabWidget (this);
    1.27 +    credits=new AboutTextBrowser (tabs,"credits");
    1.28 +
    1.29 +    credits->setText (
    1.30 +	"<center><img src=\""+iconPath+"vym-128x128.png\"></center>"
    1.31 +	"<h3><center>VYM - View Your Mind </h3>"
    1.32 +	"<p align=\"center\"> A tool to put the things you have got in your mind into a map.</p>"
    1.33 +	"<p align=\"center\"> (c) by Uwe Drechsel (<a href=\"mailto:vym@InSilmaril.de\">vym@InSilmaril.de</a>)</p>"
    1.34 +	"<p align=\"center\"> Version " __VYM_VERSION" - " __BUILD_DATE"</p>"
    1.35 +	"<ul>"
    1.36 +	"<li> Contact</li>"
    1.37 +		"<ul>"
    1.38 +			"<li> vym homepage:<br> <a href=\"http://www.InSilmaril.de/vym\">"
    1.39 +			"http://www.InSilmaril.de/vym</a></li>"
    1.40 +			"<li> Project homepage on Sourceforge:<br> <a href=\"http://sourceforge.net/projects/vym/\">"
    1.41 +			"http://sourceforge.net/projects/vym/</a></li>"
    1.42 +			"<li> Mailinglists are also on Sourceforge:"
    1.43 +				"<ul>"
    1.44 +					"<li>Please ask general questions about vym  on "
    1.45 +				"<a href=\"mailto:vym-forum@lists.sourceforge.net\">vym-forum</a></li>"
    1.46 +				"<li>Subscribe/Unsubscribe and archives can be found  <a href=\"https://sourceforge.net/mail/?group_id=127802\">here</a></li>"
    1.47 +				"</ul>"
    1.48 +		"</ul>"		
    1.49 +	"<li> Credits " 
    1.50 +	"<ul>"
    1.51 +	"<li>Matt from <a href=\"http://www.satbp.com\">www.satbp.com</a> for <a href=\"http://www.taskjuggler.org\">Taskjuggler</a> export</li>"
    1.52 +	"<li>Jakob Hilmer for image drag and drop, &quot;About vym&quot; window patch </li>"
    1.53 +	"<li>Thomas Schraitle for the stylesheet  used for XHTML-export </li>"
    1.54 +	"<li>Debianization by Christoph Thielecke and Steffen Joeris</li>"
    1.55 +	"<li>Clemens Kraus for HTML-export "
    1.56 +	"<a href=\"http://www.clemens-kraus.de\">(www.clemens-kraus.de)</a></li>"
    1.57 +	"<li>Ken Wimer and Olaf Hering for Mac support</li>"
    1.58 +	"</ul>"
    1.59 +	"</li>");
    1.60 +    credits->setFrameStyle( Q3Frame::Panel | Q3Frame::Plain );
    1.61 +    tabs->addTab (credits,"Credits");
    1.62 +
    1.63 +    license=new AboutTextBrowser (tabs,"license");
    1.64 +	//license->setTextFormat (PlainText);
    1.65 +    license->setText (
    1.66 +	"<h3>VYM - View Your Mind</h3>"
    1.67 +    "<p>Copyright (C) 2004-2005  Uwe Drechsel</p>"  
    1.68 +
    1.69 +    "<p>This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.</p>"
    1.70 +
    1.71 +    "<p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License below for more details.</p>"
    1.72 +
    1.73 +	"<p>In addition, as a special exception, Uwe Drechsel gives permission to link the code of this program with the QT libraries from trolltech.com (or with modified versions of QT that use the same license as QT), and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than QT. If you modify this file, you may extend this exception to your version of the file, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.</p> "
    1.74 +
    1.75 +	"<p>Uwe Drechsel can be contacted at <a href=\"mailto:vym@insilmaril.de\">vym@insilmaril.de</a></p>"
    1.76 +
    1.77 +	"<hr>"
    1.78 +
    1.79 + "<p align=\"center\">GNU GENERAL PUBLIC LICENSE<br>"
    1.80 +"Version 2, June 1991</p>"
    1.81 +
    1.82 +"<p align=\"center\">Copyright (C) 1989, 1991 Free Software Foundation, Inc.  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA</p>"
    1.83 +	 
    1.84 +"<p align=\"center\"> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.</p>"
    1.85 +
    1.86 +"<p align=\"center\">Preamble</p>"
    1.87 +
    1.88 +"<p>The licenses for most software are designed to take away your freedom to share and change it.  By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.  This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it.  (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.)  You can apply it to your programs, too.</p>"
    1.89 +
    1.90 +"<p>When we speak of free software, we are referring to freedom, not price.  Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.</p>"
    1.91 +
    1.92 +"<p>  To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights.  These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.</p>"
    1.93 +
    1.94 +"<p>  For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have.  You must make sure that they, too, receive or can get the source code.  And you must show them these terms so they know their rights.</p>"
    1.95 +
    1.96 +"<p>  We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.</p>"
    1.97 +
    1.98 +"<p>  Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software.  If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.</p>"
    1.99 +
   1.100 +"<p>  Finally, any free program is threatened constantly by software patents.  We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary.  To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.</p>"
   1.101 +
   1.102 +"<p>  The precise terms and conditions for copying, distribution and modification follow.</p>"
   1.103 +
   1.104 +"<p align=\"center\">		    GNU GENERAL PUBLIC LICENSE</p>"
   1.105 +"<p align=\"center\">   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</p>"
   1.106 +
   1.107 +"<p>  0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License.  The \"Program\", below, refers to any such program or work, and a \"work based on the Program\" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language.  (Hereinafter, translation is included without limitation in the term \"modification\".)  Each licensee is addressed as \"you\".</p>"
   1.108 +
   1.109 +"<p>Activities other than copying, distribution and modification are not covered by this License; they are outside its scope.  The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program).  Whether that is true depends on what the Program does.</p>"
   1.110 +
   1.111 +"<p>  1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.</p>"
   1.112 +
   1.113 +"<p>You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.</p>"
   1.114 +
   1.115 +"<p>  2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:"
   1.116 +"<ol type=\"a\">"
   1.117 +	"<li> You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.</li>"
   1.118 +
   1.119 +    "<li> You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.</li>"
   1.120 +
   1.121 +    "<li> If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License.  (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)</li>"
   1.122 +"</ol>"
   1.123 +"</p>"
   1.124 +
   1.125 +"<p>These requirements apply to the modified work as a whole.  If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works.  But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.</p>"
   1.126 +
   1.127 +"<p>Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.</p>"
   1.128 +
   1.129 +"<p>In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.</p>"
   1.130 +
   1.131 +"<p>  3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:" "<ol type=\"a\">"
   1.132 +
   1.133 +"    <li> Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,</li>"
   1.134 +
   1.135 +"    <li> Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,</li>"
   1.136 +
   1.137 +"    <li> Accompany it with the information you received as to the offer to distribute corresponding source code.  (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)</li>"
   1.138 +"</ol></p>"
   1.139 +
   1.140 +"<p>The source code for a work means the preferred form of the work for making modifications to it.  For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable.  However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.</p>"
   1.141 +
   1.142 +"<p>If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.</p>"
   1.143 +
   1.144 +"<p>  4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License.  Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License.  However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.</p>"
   1.145 +
   1.146 +"<p>  5. You are not required to accept this License, since you have not signed it.  However, nothing else grants you permission to modify or distribute the Program or its derivative works.  These actions are prohibited by law if you do not accept this License.  Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.</p>"
   1.147 +
   1.148 +"<p>  6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions.  You may not impose any further restrictions on the recipients' exercise of the rights granted herein.  You are not responsible for enforcing compliance by third parties to this License.</p>"
   1.149 +
   1.150 +"<p>  7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License.  If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all.  For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.</p>"
   1.151 +
   1.152 +"<p>If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.</p>"
   1.153 +
   1.154 +"<p>It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices.  Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.</p>"
   1.155 +
   1.156 +"<p>This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.</p>"
   1.157 +
   1.158 +"<p>  8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded.  In such case, this License incorporates the limitation as if written in the body of this License.</p>"
   1.159 +
   1.160 +"<p>  9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time.  Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.</p>"
   1.161 +
   1.162 +"<p>Each version is given a distinguishing version number.  If the Program specifies a version number of this License which applies to it and \"any later version\", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation.  If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.</p>"
   1.163 +
   1.164 +"<p>  10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission.  For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this.  Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.</p>"
   1.165 +
   1.166 +"<p align=\"center\">NO WARRANTY</p>"
   1.167 +
   1.168 +"<p>  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</p>"
   1.169 +
   1.170 +"<p>  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</p>"
   1.171 +
   1.172 +"<p align=\"center\">END OF TERMS AND CONDITIONS</p>"
   1.173 +	
   1.174 +	);
   1.175 +    credits->setFrameStyle( Q3Frame::Panel | Q3Frame::Plain );
   1.176 +    tabs->addTab (license,"License");
   1.177 +
   1.178 +    mainLayout->addWidget (tabs);
   1.179 +    tabs->showPage (credits);
   1.180 +
   1.181 +    okbutton =new QPushButton (this,"okbutton");
   1.182 +    okbutton->setText (tr("Ok"));
   1.183 +    okbutton->setMaximumSize (QSize (50,30));
   1.184 +    okbutton->setAutoDefault (true);
   1.185 +    mainLayout->addWidget( okbutton); 
   1.186 +
   1.187 +    connect( okbutton, SIGNAL( clicked() ), this, SLOT( accept() ) );
   1.188 +}
   1.189 +
   1.190 +AboutTextBrowser::AboutTextBrowser(QWidget *parent, const char *name)
   1.191 +    : Q3TextBrowser(parent, name)
   1.192 +{
   1.193 +    
   1.194 +}
   1.195 +
   1.196 +void AboutTextBrowser::setSource(const QString &name)
   1.197 +{
   1.198 +    Q3MimeSourceFactory *factory = Q3MimeSourceFactory::defaultFactory();
   1.199 +    const QMimeSource *data = factory->data(name);
   1.200 +    if (data) {
   1.201 +	Q3TextBrowser::setSource(name);
   1.202 +    } else {
   1.203 +	Q3Process *proc = new Q3Process( this );
   1.204 +	proc->addArgument( settings.readEntry("/vym/mainwindow/readerURL" ));
   1.205 +	proc->addArgument( name);
   1.206 +	
   1.207 +	if ( !proc->start() ) 
   1.208 +	    if (mainWindow->settingsURL() ) 
   1.209 +		setSource(name);
   1.210 +    }
   1.211 +}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/aboutdialog.h	Tue Jun 06 14:58:11 2006 +0000
     2.3 @@ -0,0 +1,41 @@
     2.4 +#ifndef ABOUTDIALOG_H
     2.5 +#define ABOUTDIALOG_H
     2.6 +
     2.7 +#include <qtabwidget.h>
     2.8 +#include <q3textbrowser.h>
     2.9 +#include <qlayout.h>
    2.10 +#include <qdialog.h>
    2.11 +#include <qpushbutton.h>
    2.12 +#include <qstring.h>
    2.13 +
    2.14 +class AboutTextBrowser;
    2.15 +/////////////////////////////////////////////////////////////////////////////
    2.16 +class AboutDialog :public QDialog
    2.17 +{
    2.18 +	Q_OBJECT
    2.19 +
    2.20 +public:
    2.21 +	AboutDialog(QWidget* parent = 0, const char* name = 0);
    2.22 +
    2.23 +private:
    2.24 +	QTabWidget *tabs;
    2.25 +	AboutTextBrowser *credits;
    2.26 +	AboutTextBrowser *license;
    2.27 +
    2.28 +	QLayout *mainLayout;
    2.29 +	QLayout *topLayout;
    2.30 +	QLayout *bottomLayout;
    2.31 +	QPushButton *okbutton;
    2.32 +	
    2.33 +};
    2.34 +
    2.35 +class AboutTextBrowser : public Q3TextBrowser
    2.36 +{
    2.37 +  Q_OBJECT;
    2.38 + public:
    2.39 +  AboutTextBrowser(QWidget *parent, const char *name = 0);
    2.40 + public slots:
    2.41 +   void setSource(const QString &name);
    2.42 +};
    2.43 +
    2.44 +#endif
     3.1 --- a/branchobj.cpp	Sun Jan 30 12:58:47 2005 +0000
     3.2 +++ b/branchobj.cpp	Tue Jun 06 14:58:11 2006 +0000
     3.3 @@ -24,13 +24,14 @@
     3.4      depth=-1;
     3.5  }
     3.6  
     3.7 -BranchObj::BranchObj (QCanvas* c):OrnamentedObj (c)
     3.8 +BranchObj::BranchObj (Q3Canvas* c):OrnamentedObj (c)
     3.9  {
    3.10  //    cout << "Const BranchObj (c)  called from MapCenterObj (c)\n";
    3.11 +	parObj=NULL;
    3.12      canvas=c;
    3.13  }
    3.14  
    3.15 -BranchObj::BranchObj (QCanvas* c, LinkableMapObj* p):OrnamentedObj (c)
    3.16 +BranchObj::BranchObj (Q3Canvas* c, LinkableMapObj* p):OrnamentedObj (c)
    3.17  {
    3.18  //    cout << "Const BranchObj (c,p)\n";
    3.19      canvas=c;
    3.20 @@ -47,16 +48,18 @@
    3.21  
    3.22  BranchObj::~BranchObj ()
    3.23  {
    3.24 -    //cout << "Destr BranchObj\n";
    3.25 +//	cout << "Destr BranchObj of "<<this<<endl;
    3.26  	// Check, if this branch was the last child to be deleted
    3.27  	// If so, unset the scrolled flags
    3.28  
    3.29  	BranchObj *po=(BranchObj*)(parObj);
    3.30 +	BranchObj *bo;
    3.31  	if (po)
    3.32  	{
    3.33 -		BranchObj *bo=((BranchObj*)(parObj))->getLastBranch();
    3.34 +		bo=((BranchObj*)(parObj))->getLastBranch();
    3.35  		if (!bo) po->unScroll();
    3.36  	}
    3.37 +	clear();
    3.38  }
    3.39  
    3.40  bool BranchObj::operator< ( const BranchObj & other )
    3.41 @@ -69,7 +72,7 @@
    3.42      return angle == other.angle;
    3.43  }
    3.44  
    3.45 -int BranchObjPtrList::compareItems ( QPtrCollection::Item i, QPtrCollection::Item j)
    3.46 +int BranchObjPtrList::compareItems ( Q3PtrCollection::Item i, Q3PtrCollection::Item j)
    3.47  {
    3.48  	// Make sure PtrList::find works
    3.49  	if (i==j) return 0;
    3.50 @@ -82,17 +85,15 @@
    3.51  
    3.52  void BranchObj::init () 
    3.53  {
    3.54 -    branch.setAutoDelete (true);
    3.55 +    branch.setAutoDelete (false);
    3.56      floatimage.setAutoDelete (true);
    3.57 +    xlink.setAutoDelete (false);
    3.58  
    3.59 -	absPos=getRandPos();
    3.60 -	absPos+=parObj->getChildPos();
    3.61 -
    3.62 -    // TODO This should be done in TextObj later
    3.63 -    QFont font("Sans Serif,8,-1,5,50,0,0,0,0,0");
    3.64 -//    font.setPointSize(12);
    3.65 -   heading->setFont(font );
    3.66 -//    heading->setText(QObject::tr("new branch"));
    3.67 +	if (parObj)
    3.68 +	{
    3.69 +		absPos=getRandPos();
    3.70 +		absPos+=parObj->getChildPos();
    3.71 +	}
    3.72  
    3.73      lastSelectedBranch=-1;
    3.74  
    3.75 @@ -101,8 +102,8 @@
    3.76  	scrolled=false;
    3.77  	tmpUnscrolled=false;
    3.78  
    3.79 -	url="";
    3.80 -	vymLink="";
    3.81 +	includeImagesVer=false;
    3.82 +	includeImagesHor=false;
    3.83  }
    3.84  
    3.85  void BranchObj::copy (BranchObj* other)
    3.86 @@ -125,9 +126,6 @@
    3.87  	tmpUnscrolled=other->tmpUnscrolled;
    3.88  	setVisibility (other->visible);
    3.89  
    3.90 -	url=other->url;
    3.91 -	vymLink=other->vymLink;
    3.92 -
    3.93  	angle=other->angle;
    3.94  
    3.95      positionBBox();
    3.96 @@ -135,8 +133,17 @@
    3.97  
    3.98  void BranchObj::clear() 
    3.99  {
   3.100 -	branch.clear();
   3.101  	floatimage.clear();
   3.102 +	while (!xlink.isEmpty())
   3.103 +		deleteXLink (xlink.first() );
   3.104 +
   3.105 +	BranchObj *bo;
   3.106 +	while (!branch.isEmpty())
   3.107 +	{
   3.108 +		bo=branch.first();
   3.109 +		branch.removeFirst();
   3.110 +		delete (bo);
   3.111 +	}
   3.112  }
   3.113  
   3.114  int BranchObj::getNum()
   3.115 @@ -149,7 +156,12 @@
   3.116  
   3.117  int BranchObj::getNum(BranchObj *bo)
   3.118  {
   3.119 -	return branch.findRef (bo);
   3.120 +	// keep current pointer in branch, 
   3.121 +	// otherwise save might fail
   3.122 +	int cur=branch.at();
   3.123 +	int ind=branch.findRef (bo);
   3.124 +	branch.at(cur);
   3.125 +	return ind;
   3.126  }
   3.127  
   3.128  int BranchObj::getFloatImageNum(FloatImageObj *fio)
   3.129 @@ -167,6 +179,11 @@
   3.130  	return floatimage.count();
   3.131  }
   3.132  
   3.133 +int BranchObj::countXLinks()
   3.134 +{
   3.135 +	return xlink.count();
   3.136 +}
   3.137 +
   3.138  void BranchObj::setParObjTmp(LinkableMapObj* lmo, QPoint m, int off)
   3.139  {
   3.140  	// Temporary link to lmo
   3.141 @@ -181,19 +198,10 @@
   3.142  	// ignore mapcenter and mainbranch
   3.143  	if (lmo->getDepth()<2) off=0;
   3.144  	if (off==0)
   3.145 -	{
   3.146  		link2ParPos=false;
   3.147 -		parObj=o;
   3.148 -	}	
   3.149  	else
   3.150 -	{	
   3.151  		link2ParPos=true;
   3.152 -		if (off>0)
   3.153 -			parObj=o->getParObj();
   3.154 -		else	
   3.155 -			parObj=o->getParObj();
   3.156 -		parObj=o;
   3.157 -	}		
   3.158 +	parObj=o;
   3.159  
   3.160  	depth=parObj->getDepth()+1;
   3.161  
   3.162 @@ -254,6 +262,7 @@
   3.163  		parObjTmpBuf=NULL;
   3.164  		depth=parObj->getDepth()+1;
   3.165  		setLinkStyle (getDefLinkStyle() );
   3.166 +		updateLink();
   3.167  	}		
   3.168  }
   3.169  
   3.170 @@ -350,6 +359,7 @@
   3.171  		standardFlags->setVisibility(v);
   3.172  		LinkableMapObj::setVisibility (v);
   3.173  		
   3.174 +		// Only change childs, if I am not scrolled
   3.175  		if (!scrolled && (depth < toDepth))
   3.176  		{
   3.177  			// Now go recursivly through all childs
   3.178 @@ -359,9 +369,11 @@
   3.179  			FloatImageObj *fio;
   3.180  			for (fio=floatimage.first(); fio; fio=floatimage.next())
   3.181  				fio->setVisibility (v);
   3.182 +			XLinkObj* xlo;
   3.183 +			for (xlo=xlink.first(); xlo;xlo=xlink.next() ) 
   3.184 +				xlo->setVisibility ();	
   3.185  		}
   3.186      } // depth <= toDepth	
   3.187 -	move (absPos.x(), absPos.y() );
   3.188  	requestReposition();
   3.189  }	
   3.190  
   3.191 @@ -376,25 +388,21 @@
   3.192  	// Overloaded from LinkableMapObj
   3.193  	// BranchObj can use color of heading
   3.194  
   3.195 -	if (mapEditor->getLinkColorHint()==HeadingColor)
   3.196 -		LinkableMapObj::setLinkColor (heading->getColor() );
   3.197 -	else	
   3.198 -		LinkableMapObj::setLinkColor ();
   3.199 +	if (mapEditor)
   3.200 +		if (mapEditor->getLinkColorHint()==HeadingColor)
   3.201 +			LinkableMapObj::setLinkColor (heading->getColor() );
   3.202 +		else	
   3.203 +			LinkableMapObj::setLinkColor ();
   3.204  }
   3.205  
   3.206 -void BranchObj::setColor (QColor col, bool colorChilds)
   3.207 +void BranchObj::setColorChilds (QColor col)
   3.208  {
   3.209 -    heading->setColor(col);
   3.210 -	setLinkColor();
   3.211 -    if (colorChilds) 
   3.212 -    {
   3.213 -		BranchObj *bo;
   3.214 -		for (bo=branch.first(); bo; bo=branch.next() )
   3.215 -			bo->setColor(col,colorChilds);
   3.216 -    }	
   3.217 +	OrnamentedObj::setColor (col);
   3.218 +	BranchObj *bo;
   3.219 +	for (bo=branch.first(); bo; bo=branch.next() )
   3.220 +		bo->setColorChilds(col);
   3.221  }
   3.222  
   3.223 -
   3.224  BranchObj* BranchObj::first()
   3.225  {
   3.226  	itLast=NULL;	
   3.227 @@ -521,10 +529,20 @@
   3.228  	itLast=it;
   3.229  }
   3.230  
   3.231 +void BranchObj::positionContents()
   3.232 +{
   3.233 +	FloatImageObj *fio;
   3.234 +    for (fio=floatimage.first(); fio; fio=floatimage.next() )
   3.235 +		fio->reposition();
   3.236 +	OrnamentedObj::positionContents();
   3.237 +}
   3.238  
   3.239  void BranchObj::move (double x, double y)
   3.240  {
   3.241  	OrnamentedObj::move (x,y);
   3.242 +	FloatImageObj *fio;
   3.243 +    for (fio=floatimage.first(); fio; fio=floatimage.next() )
   3.244 +		fio->reposition();
   3.245      positionBBox();
   3.246  }
   3.247  
   3.248 @@ -536,12 +554,12 @@
   3.249  void BranchObj::moveBy (double x, double y)
   3.250  {
   3.251  	OrnamentedObj::moveBy (x,y);
   3.252 -    positionBBox();
   3.253      BranchObj* b;
   3.254      for (b=branch.first(); b;b=branch.next() ) 
   3.255  		b->moveBy (x,y);
   3.256 +    positionBBox();
   3.257  }
   3.258 -
   3.259 +	
   3.260  void BranchObj::moveBy (QPoint p)
   3.261  {
   3.262  	moveBy (p.x(), p.y());
   3.263 @@ -550,30 +568,25 @@
   3.264  
   3.265  void BranchObj::positionBBox()
   3.266  {
   3.267 -
   3.268 -    heading->positionBBox();
   3.269 -	systemFlags->positionBBox();
   3.270 -	standardFlags->positionBBox();
   3.271 -	// It seems that setting x,y also affects width,height
   3.272 -	int w_old=bbox.width();
   3.273 -	int h_old=bbox.height();
   3.274 -    bbox.setX (absPos.x() );
   3.275 -	bbox.setY (absPos.y() );
   3.276 -	bbox.setWidth(w_old);
   3.277 -	bbox.setHeight(h_old);
   3.278 -
   3.279 -
   3.280 +	QPoint ap=getAbsPos();
   3.281 +	bbox.moveTopLeft (ap);
   3.282 +	positionContents();
   3.283  	setSelBox();
   3.284  
   3.285  	// set the frame
   3.286  	frame->setRect(QRect(bbox.x(),bbox.y(),bbox.width(),bbox.height() ) );
   3.287 +
   3.288 +	// Update links to other branches
   3.289 +	XLinkObj *xlo;
   3.290 +    for (xlo=xlink.first(); xlo; xlo=xlink.next() )
   3.291 +		xlo->updateXLink();
   3.292  }
   3.293  
   3.294  void BranchObj::calcBBoxSize()
   3.295  {
   3.296      QSize heading_r=heading->getSize();
   3.297 -    int heading_w=static_cast <int> (heading_r.width() );
   3.298 -    int heading_h=static_cast <int> (heading_r.height() );
   3.299 +    int heading_w=(int) heading_r.width() ;
   3.300 +    int heading_h=(int) heading_r.height() ;
   3.301      QSize sysflags_r=systemFlags->getSize();
   3.302  	int sysflags_h=sysflags_r.height();
   3.303  	int sysflags_w=sysflags_r.width();
   3.304 @@ -589,11 +602,73 @@
   3.305  	h=max (sysflags_h,stanflags_h);
   3.306  	h=max (h,heading_h);
   3.307  
   3.308 +	// Save the dimension of flags and heading
   3.309 +	ornamentsBBox.setSize ( QSize(w,h));
   3.310 +
   3.311 +	// clickBox includes Flags and Heading
   3.312 +    clickBox.setSize (ornamentsBBox.size() );
   3.313 +
   3.314 +	// Floatimages 
   3.315 +	QPoint rp;
   3.316 +	FloatImageObj *foi;
   3.317 +
   3.318 +	topPad=botPad=leftPad=rightPad=0;
   3.319 +	if (includeImagesVer || includeImagesHor)
   3.320 +	{
   3.321 +		if (countFloatImages()>0)
   3.322 +		{
   3.323 +			for (foi=floatimage.first(); foi; foi=floatimage.next() )
   3.324 +			{
   3.325 +				rp=foi->getRelPos();
   3.326 +				if (includeImagesVer)
   3.327 +				{
   3.328 +					if (rp.y() < 0) 
   3.329 +						topPad=max (topPad,-rp.y()-h);
   3.330 +					if (rp.y()+foi->height() > 0)
   3.331 +						botPad=max (botPad,rp.y()+foi->height());
   3.332 +				}		
   3.333 +				if (includeImagesHor)
   3.334 +				{
   3.335 +					if (orientation==OrientRightOfCenter)
   3.336 +					{
   3.337 +						if (-rp.x()-w > 0) 
   3.338 +							leftPad=max (leftPad,-rp.x()-w);
   3.339 +						if (rp.x()+foi->width() > 0)
   3.340 +							rightPad=max (rightPad,rp.x()+foi->width());
   3.341 +					} else
   3.342 +					{
   3.343 +						if (rp.x()< 0) 
   3.344 +							leftPad=max (leftPad,-rp.x());
   3.345 +						if (rp.x()+foi->width() > w)
   3.346 +							rightPad=max (rightPad,rp.x()+foi->width()-w);
   3.347 +					}
   3.348 +				}		
   3.349 +			}	
   3.350 +		}	
   3.351 +		h+=topPad+botPad;
   3.352 +		w+=leftPad+rightPad;
   3.353 +	}
   3.354 +
   3.355 +	// Frame thickness
   3.356      w+=frame->getBorder();
   3.357      h+=frame->getBorder();
   3.358 +	
   3.359 +	// Finally set size
   3.360      bbox.setSize (QSize (w,h));
   3.361  }
   3.362  
   3.363 +void BranchObj::setDockPos()
   3.364 +{
   3.365 +	if (getOrientation()==OrientLeftOfCenter )
   3.366 +    {
   3.367 +		childPos=QPoint (ornamentsBBox.bottomLeft().x(), ornamentsBBox.bottomLeft().y() );
   3.368 +		parPos=QPoint (ornamentsBBox.bottomRight().x(),ornamentsBBox.bottomRight().y() );
   3.369 +    } else
   3.370 +    {
   3.371 +		childPos=QPoint (ornamentsBBox.bottomRight().x(), ornamentsBBox.bottomRight().y() );
   3.372 +		parPos=QPoint (ornamentsBBox.bottomLeft().x(),ornamentsBBox.bottomLeft().y() );
   3.373 +    }
   3.374 +}
   3.375  LinkableMapObj* BranchObj::findMapObj(QPoint p, LinkableMapObj* excludeLMO)
   3.376  {
   3.377  	// Search branches
   3.378 @@ -606,89 +681,67 @@
   3.379      }
   3.380  	
   3.381  	// Search myself
   3.382 -    if (inBBox (p) && (this != excludeLMO) && isVisibleObj() ) 
   3.383 +    if (inBox (p) && (this != excludeLMO) && isVisibleObj() ) 
   3.384  		return this;
   3.385  
   3.386  	// Search float images
   3.387  	FloatImageObj *foi;
   3.388      for (foi=floatimage.first(); foi; foi=floatimage.next() )
   3.389 -		if (foi->inBBox(p) && (foi != excludeLMO) && foi->getParObj()!= excludeLMO) return foi;
   3.390 +		if (foi->inBox(p) && 
   3.391 +			(foi != excludeLMO) && 
   3.392 +			foi->getParObj()!= excludeLMO &&
   3.393 +			foi->isVisibleObj() 
   3.394 +		) return foi;
   3.395  
   3.396      return NULL;
   3.397  }
   3.398  
   3.399  void BranchObj::setHeading(QString s)
   3.400  {
   3.401 -    // Adjusting font size
   3.402 -    QFont font=heading->getFont();
   3.403 -	if (depth==0)
   3.404 -		font.setPointSize(16);
   3.405 -	else	
   3.406 -		if (depth>1) 
   3.407 -			font.setPointSize(10);
   3.408 -		else
   3.409 -			font.setPointSize(12);
   3.410 -    heading->setFont(font);
   3.411      heading->setText(s);	// set new heading
   3.412  	calcBBoxSize();			// recalculate bbox
   3.413      positionBBox();			// rearrange contents
   3.414  	requestReposition();
   3.415  }
   3.416  
   3.417 -void BranchObj::setURL(QString s)
   3.418 +void BranchObj::setHideTmp (HideTmpMode mode)
   3.419  {
   3.420 -	url=s;
   3.421 -	if (!url.isEmpty())
   3.422 -		systemFlags->activate("url");
   3.423 -	else	
   3.424 -		systemFlags->deactivate("url");
   3.425 -	calcBBoxSize();			// recalculate bbox
   3.426 -    positionBBox();			// rearrange contents
   3.427 -	forceReposition();
   3.428 +	if (mode==HideExport && hasHiddenExportParent(this))
   3.429 +	{
   3.430 +		setVisibility (false);
   3.431 +		hidden=true;
   3.432 +	}else
   3.433 +	{
   3.434 +		if (hasScrolledParent(this))
   3.435 +			setVisibility (false);
   3.436 +		else
   3.437 +			setVisibility (true);
   3.438 +		hidden=false;
   3.439 +	}	
   3.440 +
   3.441 +    BranchObj *bo;
   3.442 +    for (bo=branch.first(); bo; bo=branch.next() )
   3.443 +		bo->setHideTmp (mode);
   3.444  }
   3.445  
   3.446 -QString BranchObj::getURL()
   3.447 +bool BranchObj::hasHiddenExportParent(BranchObj *start)
   3.448  {
   3.449 -	return url;
   3.450 -}
   3.451 +	// Calls parents recursivly to
   3.452 +	// find out, if we are temp. hidden
   3.453  
   3.454 -void BranchObj::setVymLink(QString s)
   3.455 -{
   3.456 -	if (!s.isEmpty())
   3.457 -	{
   3.458 -		// We need the relative (from loading) 
   3.459 -		// or absolute path (from User event)
   3.460 -		// and build the absolute path.
   3.461 -		// Note: If we have relative, use path of
   3.462 -		// current map to build absolute path
   3.463 -		QDir d(s);
   3.464 -		if (!d.path().startsWith ("/"))
   3.465 -		{
   3.466 -			QString p=mapEditor->getDestPath();
   3.467 -			int i=p.findRev("/",-1);
   3.468 -			d.setPath(p.left(i)+"/"+s);
   3.469 -			d.convertToAbs();
   3.470 -		}
   3.471 -		vymLink=d.path();
   3.472 -		systemFlags->activate("vymLink");
   3.473 -	}	
   3.474 -	else	
   3.475 -	{
   3.476 -		systemFlags->deactivate("vymLink");
   3.477 -		vymLink="";
   3.478 -	}	
   3.479 -	calcBBoxSize();			// recalculate bbox
   3.480 -    positionBBox();			// rearrange contents
   3.481 -	forceReposition();
   3.482 -}
   3.483 +	if (hideExport) return true;
   3.484  
   3.485 -QString BranchObj::getVymLink()
   3.486 -{
   3.487 -	return vymLink;
   3.488 +	BranchObj* bo=(BranchObj*)(parObj);
   3.489 +	if (bo) 
   3.490 +		return bo->hasHiddenExportParent(start);
   3.491 +	else
   3.492 +		return false;
   3.493  }
   3.494  
   3.495  QString BranchObj::saveToDir (const QString &tmpdir,const QString &prefix, const QPoint& offset)
   3.496  {
   3.497 +	if (hidden) return "";
   3.498 +
   3.499      QString s,a;
   3.500  	QString scrolledAttr;
   3.501  	if (scrolled) 
   3.502 @@ -696,21 +749,6 @@
   3.503  	else
   3.504  		scrolledAttr="";
   3.505  
   3.506 -	QString posAttr;
   3.507 -	if (depth<2) posAttr=
   3.508 -		attribut("absPosX",QString().setNum(absPos.x(),10)) +
   3.509 -		attribut("absPosY",QString().setNum(absPos.y(),10)); 
   3.510 -	else
   3.511 -		posAttr="";
   3.512 -
   3.513 -	QString urlAttr;
   3.514 -	if (!url.isEmpty())
   3.515 -		urlAttr=attribut ("url",url);
   3.516 -
   3.517 -	QString vymLinkAttr;
   3.518 -	if (!vymLink.isEmpty())
   3.519 -		vymLinkAttr=attribut ("vymLink",convertToRel(mapEditor->getDestPath(),vymLink) );
   3.520 -
   3.521  	QString frameAttr;
   3.522  	if (frame->getFrameType()!=NoFrame)
   3.523  		frameAttr=attribut ("frameType",frame->getFrameTypeName());
   3.524 @@ -730,11 +768,24 @@
   3.525  	} else
   3.526  		areaAttr="";
   3.527  	
   3.528 -    s=beginElement ("branch" +scrolledAttr +posAttr +urlAttr +vymLinkAttr +frameAttr +areaAttr);
   3.529 +	// Providing an ID for a branch makes export to XHTML easier
   3.530 +	QString idAttr;
   3.531 +	if (countXLinks()>0)
   3.532 +		idAttr=attribut ("id",getSelectString());
   3.533 +	else
   3.534 +		idAttr="";
   3.535 +
   3.536 +    s=beginElement ("branch" 
   3.537 +		+getOrnAttr() 
   3.538 +		+scrolledAttr 
   3.539 +		+frameAttr 
   3.540 +		+areaAttr 
   3.541 +		+idAttr 
   3.542 +		+getIncludeImageAttr() );
   3.543      incIndent();
   3.544  
   3.545  	// save heading
   3.546 -    s=s+valueElement("heading", getHeading(),
   3.547 +    s+=valueElement("heading", getHeading(),
   3.548  		attribut ("textColor",QColor(heading->getColor()).name()));
   3.549  
   3.550  	// save names of flags set
   3.551 @@ -748,17 +799,120 @@
   3.552      BranchObj *bo;
   3.553      for (bo=branch.first(); bo; bo=branch.next() )
   3.554  		s+=bo->saveToDir(tmpdir,prefix,offset);
   3.555 -    decIndent();
   3.556  
   3.557  	// Save FloatImages
   3.558  	FloatImageObj *fio;
   3.559  	for (fio=floatimage.first(); fio; fio=floatimage.next() )
   3.560 -		s+=fio->saveToDir (tmpdir,prefix);
   3.561 +		s+=fio->saveToDir (tmpdir,prefix,offset);
   3.562  
   3.563 +	// Save XLinks
   3.564 +	XLinkObj *xlo;
   3.565 +	//FIXME exponential increase in xlinks...
   3.566 +	QString ol;	// old link
   3.567 +	QString cl;	// current link
   3.568 +    for (xlo=xlink.first(); xlo; xlo=xlink.next() )
   3.569 +	{
   3.570 +		cl=xlo->saveToDir();
   3.571 +		if (cl!=ol)
   3.572 +		{
   3.573 +			s+=cl;
   3.574 +			ol=cl;
   3.575 +		} else
   3.576 +		{
   3.577 +			qWarning (QString("Ignoring of duplicate xLink in %1").arg(getHeading()));
   3.578 +		}
   3.579 +	}	
   3.580 +
   3.581 +    decIndent();
   3.582      s+=endElement   ("branch");
   3.583      return s;
   3.584  }
   3.585  
   3.586 +void BranchObj::addXLink (XLinkObj *xlo)
   3.587 +{
   3.588 +	xlink.append (xlo);
   3.589 +	
   3.590 +}
   3.591 +
   3.592 +void BranchObj::removeXLinkRef (XLinkObj *xlo)
   3.593 +{
   3.594 +	xlink.remove (xlo);
   3.595 +}
   3.596 +
   3.597 +void BranchObj::deleteXLink(XLinkObj *xlo)
   3.598 +{
   3.599 +	xlo->deactivate();
   3.600 +	if (!xlo->isUsed()) delete (xlo);
   3.601 +}
   3.602 +
   3.603 +void BranchObj::deleteXLinkAt (int i)
   3.604 +{
   3.605 +	XLinkObj *xlo=xlink.at(i);
   3.606 +	xlo->deactivate();
   3.607 +	if (!xlo->isUsed()) delete(xlo);
   3.608 +}
   3.609 +
   3.610 +XLinkObj* BranchObj::XLinkAt (int i)
   3.611 +{
   3.612 +	return xlink.at(i);
   3.613 +}
   3.614 +
   3.615 +int BranchObj::countXLink()
   3.616 +{
   3.617 +	return xlink.count();
   3.618 +}
   3.619 +
   3.620 +
   3.621 +BranchObj* BranchObj::XLinkTargetAt (int i)
   3.622 +{
   3.623 +	if (xlink.at(i))
   3.624 +		return xlink.at(i)->otherBranch (this);
   3.625 +	else
   3.626 +		return NULL;
   3.627 +}
   3.628 +
   3.629 +void BranchObj::setIncludeImagesVer(bool b)
   3.630 +{
   3.631 +	includeImagesVer=b;
   3.632 +	calcBBoxSize();
   3.633 +	positionBBox();
   3.634 +	requestReposition();
   3.635 +	//FIXME undo needed
   3.636 +}
   3.637 +
   3.638 +bool BranchObj::getIncludeImagesVer()
   3.639 +{
   3.640 +	return includeImagesVer;
   3.641 +}
   3.642 +
   3.643 +void BranchObj::setIncludeImagesHor(bool b)
   3.644 +{
   3.645 +	includeImagesHor=b;
   3.646 +	calcBBoxSize();
   3.647 +	positionBBox();
   3.648 +	requestReposition();
   3.649 +	//FIXME undo needed
   3.650 +}
   3.651 +
   3.652 +bool BranchObj::getIncludeImagesHor()
   3.653 +{
   3.654 +	return includeImagesHor;
   3.655 +}
   3.656 +
   3.657 +QString BranchObj::getIncludeImageAttr()
   3.658 +{
   3.659 +	QString a;
   3.660 +	if (includeImagesVer)
   3.661 +		a=attribut ("incImgV","true");
   3.662 +	else
   3.663 +		a=attribut ("incImgV","false");
   3.664 +	if (includeImagesHor)
   3.665 +		a+=attribut ("incImgH","true");
   3.666 +	else
   3.667 +		a+=attribut ("incImgH","false");
   3.668 +	return a;	
   3.669 +}
   3.670 +
   3.671  LinkableMapObj* BranchObj::addFloatImage ()
   3.672  {
   3.673  	FloatImageObj *newfi=new FloatImageObj (canvas,this);
   3.674 @@ -767,8 +921,11 @@
   3.675  		newfi->setVisibility (false);
   3.676  	else	
   3.677  		newfi->setVisibility(visible);
   3.678 +	calcBBoxSize();
   3.679 +	positionBBox();
   3.680  	requestReposition();
   3.681  	return newfi;
   3.682 +	//FIXME undo needed
   3.683  }
   3.684  
   3.685  LinkableMapObj* BranchObj::addFloatImage (FloatImageObj *fio)
   3.686 @@ -780,8 +937,11 @@
   3.687  		newfi->setVisibility (false);
   3.688  	else	
   3.689  		newfi->setVisibility(visible);
   3.690 +	calcBBoxSize();
   3.691 +	positionBBox();
   3.692  	requestReposition();
   3.693  	return newfi;
   3.694 +	// FIMXE undo needed
   3.695  }
   3.696  
   3.697  FloatImageObj* BranchObj::getFirstFloatImage ()
   3.698 @@ -802,7 +962,10 @@
   3.699  void BranchObj::removeFloatImage (FloatImageObj *fio)
   3.700  {
   3.701  	floatimage.remove (fio);
   3.702 +	calcBBoxSize();
   3.703 +	positionBBox();
   3.704  	requestReposition();
   3.705 +	// FIMXE undo needed
   3.706  }
   3.707  
   3.708  void BranchObj::savePosInAngle ()
   3.709 @@ -817,19 +980,40 @@
   3.710  	}
   3.711  }
   3.712  
   3.713 +void BranchObj::setDefAttr (BranchModification mod)
   3.714 +{
   3.715 +	int fontsize;
   3.716 +	switch (depth)
   3.717 +	{
   3.718 +		case 0: fontsize=16; break;
   3.719 +		case 1: fontsize=12; break;
   3.720 +		default: fontsize=10; break;
   3.721 +	}	
   3.722 +
   3.723 +	setLinkColor ();
   3.724 +	setLinkStyle(getDefLinkStyle());
   3.725 +	QFont font("Sans Serif,8,-1,5,50,0,0,0,0,0");
   3.726 +	font.setPointSize(fontsize);
   3.727 +	heading->setFont(font );
   3.728 +
   3.729 +	if (mod==NewBranch)
   3.730 +		setColor (((BranchObj*)(parObj))->getColor());
   3.731 +	
   3.732 +	calcBBoxSize();
   3.733 +}
   3.734 +
   3.735  BranchObj* BranchObj::addBranch()
   3.736  {
   3.737      BranchObj* newbo=new BranchObj(canvas,this);
   3.738      branch.append (newbo);
   3.739      newbo->setParObj(this);
   3.740 -    newbo->setColor(getColor(),false);	
   3.741 -    newbo->setLinkColor();	
   3.742 +	newbo->setDefAttr(NewBranch);
   3.743      newbo->setHeading ("new");
   3.744 -	newbo->setLinkStyle (newbo->getDefLinkStyle());
   3.745  	if (scrolled)
   3.746  		newbo->setVisibility (false);
   3.747  	else	
   3.748  		newbo->setVisibility(visible);
   3.749 +	newbo->updateLink();	
   3.750  	requestReposition();
   3.751  	return newbo;
   3.752  }
   3.753 @@ -840,16 +1024,27 @@
   3.754      branch.append (newbo);
   3.755      newbo->copy(bo);
   3.756      newbo->setParObj(this);
   3.757 -	newbo->setHeading (newbo->getHeading());	// adjust fontsize to depth
   3.758 -	newbo->setLinkStyle (newbo->getDefLinkStyle());
   3.759 +	newbo->setDefAttr(MovedBranch);
   3.760  	if (scrolled)
   3.761  		newbo->setVisibility (false);
   3.762  	else	
   3.763  		newbo->setVisibility(bo->visible);
   3.764 +	newbo->updateLink();	
   3.765  	requestReposition();
   3.766  	return newbo;
   3.767  }
   3.768  
   3.769 +BranchObj* BranchObj::addBranchPtr(BranchObj* bo)
   3.770 +{
   3.771 +	branch.append (bo);
   3.772 +	bo->setParObj (this);
   3.773 +	bo->depth=depth+1;
   3.774 +	bo->setDefAttr(MovedBranch);
   3.775 +	if (scrolled) tmpUnscroll();
   3.776 +	setLastSelectedBranch (bo);
   3.777 +	return bo;
   3.778 +}
   3.779 +
   3.780  BranchObj* BranchObj::insertBranch(int pos)
   3.781  {
   3.782  	savePosInAngle();
   3.783 @@ -870,11 +1065,56 @@
   3.784  	return newbo;
   3.785  }
   3.786  
   3.787 +BranchObj* BranchObj::insertBranchPtr (BranchObj* bo, int pos)
   3.788 +{
   3.789 +	savePosInAngle();
   3.790 +	// Add new bo and resort branches
   3.791 +	bo->angle=pos-0.5;
   3.792 +	branch.append (bo);
   3.793 +	bo->setParObj (this);
   3.794 +	bo->depth=depth+1;
   3.795 +	bo->setDefAttr (MovedBranch);
   3.796 +	if (scrolled) tmpUnscroll();
   3.797 +	setLastSelectedBranch (bo);
   3.798 +	branch.sort();
   3.799 +	return bo;
   3.800 +}
   3.801 +
   3.802 +void BranchObj::removeBranchHere(BranchObj* borem)
   3.803 +{
   3.804 +	// This removes the branch bo from list, but 
   3.805 +	// inserts its childs at the place of bo
   3.806 +	BranchObj *bo;
   3.807 +	bo=borem->getLastBranch();
   3.808 +	int pos=borem->getNum();
   3.809 +	while (bo)
   3.810 +	{
   3.811 +		bo->moveBranchTo (this,pos+1);
   3.812 +		bo=borem->getLastBranch();
   3.813 +	}	
   3.814 +	removeBranch (borem);
   3.815 +}
   3.816 +
   3.817 +void BranchObj::removeChilds()
   3.818 +{
   3.819 +	clear();
   3.820 +}
   3.821 +
   3.822  void BranchObj::removeBranch(BranchObj* bo)
   3.823  {
   3.824      // if bo is not in branch remove returns false, we
   3.825      // don't care...
   3.826 -    branch.remove (bo);
   3.827 +	
   3.828 +    if (branch.remove (bo))
   3.829 +		delete (bo);
   3.830 +	else
   3.831 +		qWarning ("BranchObj::removeBranch tried to remove non existing branch?!\n");
   3.832 +	requestReposition();
   3.833 +}
   3.834 +
   3.835 +void BranchObj::removeBranchPtr(BranchObj* bo)
   3.836 +{
   3.837 +	branch.remove (bo);
   3.838  	requestReposition();
   3.839  }
   3.840  
   3.841 @@ -908,6 +1148,15 @@
   3.842      return branch.at(i);
   3.843  }
   3.844  
   3.845 +bool BranchObj::canMoveBranchUp() 
   3.846 +{
   3.847 +	if (!parObj) return false;
   3.848 +	BranchObj* par=(BranchObj*)parObj;
   3.849 +	if (this==par->getFirstBranch())
   3.850 +		return false;
   3.851 +	else
   3.852 +		return true;
   3.853 +}
   3.854  
   3.855  BranchObj* BranchObj::moveBranchUp(BranchObj* bo1) // move a branch up (modify myself)
   3.856  {
   3.857 @@ -923,6 +1172,16 @@
   3.858  		return branch.at(i);
   3.859  }
   3.860  
   3.861 +bool BranchObj::canMoveBranchDown() 
   3.862 +{
   3.863 +	if (!parObj) return false;
   3.864 +	BranchObj* par=(BranchObj*)parObj;
   3.865 +	if (this==par->getLastBranch())
   3.866 +		return false;
   3.867 +	else
   3.868 +		return true;
   3.869 +}
   3.870 +
   3.871  BranchObj* BranchObj::moveBranchDown(BranchObj* bo1)
   3.872  {
   3.873  	savePosInAngle();
   3.874 @@ -939,29 +1198,63 @@
   3.875  		return branch.at(i);
   3.876  }
   3.877  
   3.878 +BranchObj* BranchObj::moveBranchTo (BranchObj* dst, int pos)
   3.879 +{
   3.880 +	// Find current parent and 
   3.881 +	// remove pointer to myself there
   3.882 +	if (!dst) return NULL;
   3.883 +	BranchObj *par=(BranchObj*)(parObj);
   3.884 +	if (par)
   3.885 +		par->removeBranchPtr (this);
   3.886 +	else
   3.887 +		return NULL;
   3.888 +
   3.889 +	// Create new pointer to myself at dst
   3.890 +	if (pos<0||dst->getDepth()==0)
   3.891 +	{	
   3.892 +		// links myself as last branch at dst
   3.893 +		dst->addBranchPtr (this);
   3.894 +		updateLink();
   3.895 +		return this;
   3.896 +	} else
   3.897 +	{
   3.898 +		// inserts me at pos in parent of dst
   3.899 +		if (par)
   3.900 +		{
   3.901 +			BranchObj *bo=dst->insertBranchPtr (this,pos);
   3.902 +			bo->setDefAttr(MovedBranch);
   3.903 +			updateLink();
   3.904 +			return bo;
   3.905 +
   3.906 +		} else
   3.907 +			return NULL;
   3.908 +	}	
   3.909 +}
   3.910 +
   3.911  void BranchObj::alignRelativeTo (QPoint ref)
   3.912  {
   3.913 -/* FIXME testing
   3.914 -	if (!getHeading().isEmpty())
   3.915 -		cout << "BO::alignRelTo "<<getHeading()<<endl;
   3.916 -	else	
   3.917 -		cout << "BO::alignRelTo  ???"<<endl;
   3.918 -	cout << "  d="<<depth<<endl;
   3.919 -*/	
   3.920  	int th = bboxTotal.height();	
   3.921 +// TODO testing
   3.922 +/*
   3.923 +	cout << "BO::alignRelTo "<<getHeading()<<endl;
   3.924 +	cout << "  d="<<depth<<
   3.925 +		"  ref="<<ref<<
   3.926 +//		"  bbox.topLeft="<<bboxTotal.topLeft()<<
   3.927 +		"  absPos="<<absPos<<
   3.928 +//		"  pad="<<topPad<<","<<botPad<<","<<leftPad<<","<<rightPad<<
   3.929 +		"  hidden="<<hidden<<
   3.930 +		"  th="<<th<<endl;
   3.931 +*/
   3.932  
   3.933  	// If I am the mapcenter or a mainbranch, reposition heading
   3.934  	if (depth<2)
   3.935 -	{
   3.936 -		move (absPos.x(),absPos.y());
   3.937 +	{	//FIXME ugly! optimize this   move for MCO needed to initially position text in box...
   3.938  		if (depth==1)
   3.939 -		{
   3.940  			// Calc angle to mapCenter if I am a mainbranch
   3.941  			// needed for reordering the mainbranches clockwise 
   3.942  			// around mapcenter 
   3.943  			angle=getAngle (QPoint ((int)(x() - parObj->getChildPos().x() ), 
   3.944  									(int)(y() - parObj->getChildPos().y() ) ) );
   3.945 -		}	
   3.946  	} 
   3.947  	else
   3.948      {
   3.949 @@ -970,29 +1263,25 @@
   3.950  		switch (orientation) 
   3.951  		{
   3.952  			case OrientLeftOfCenter:
   3.953 -				move (ref.x()-bbox.width(), ref.y() + (th-bbox.height())/2 );
   3.954 +				move (ref.x() - bbox.width(), ref.y() + (th-bbox.height())/2 );
   3.955  			break;
   3.956  			case OrientRightOfCenter:	
   3.957 -				move (ref.x(), ref.y() + (th-bbox.height())/2 );
   3.958 +				move (ref.x() , ref.y() + (th-bbox.height())/2  );
   3.959  			break;
   3.960  			default:
   3.961 -				cout <<"LMO::alignRelativeTo: oops, no orientation given...\n";
   3.962 +				qWarning ("LMO::alignRelativeTo: oops, no orientation given...");
   3.963  			break;
   3.964  		}		
   3.965      }		
   3.966  
   3.967 -	FloatImageObj *fio;
   3.968 -    for (fio=floatimage.first(); fio; fio=floatimage.next() )
   3.969 -		fio->reposition();
   3.970 -
   3.971  	if (scrolled) return;
   3.972  
   3.973      // Set reference point for alignment of childs
   3.974      QPoint ref2;
   3.975      if (orientation==OrientLeftOfCenter)
   3.976 -		ref2.setX(childPos.x() - linkwidth);
   3.977 +		ref2.setX(bbox.topLeft().x() - linkwidth);
   3.978      else	
   3.979 -		ref2.setX(childPos.x() + linkwidth);
   3.980 +		ref2.setX(bbox.topRight().x() + linkwidth);
   3.981  
   3.982  	if (depth==1)
   3.983  		ref2.setY(absPos.y()-(bboxTotal.height()-bbox.height())/2);
   3.984 @@ -1003,15 +1292,18 @@
   3.985      BranchObj *b;
   3.986      for (b=branch.first(); b; b=branch.next() )
   3.987      {	
   3.988 -		b->alignRelativeTo (ref2);
   3.989 -		ref2.setY(ref2.y() + b->getBBoxSizeWithChilds().height() );
   3.990 +		if (!b->isHidden())
   3.991 +		{
   3.992 +			b->alignRelativeTo (ref2);
   3.993 +			ref2.setY(ref2.y() + b->getBBoxSizeWithChilds().height() );
   3.994 +		}
   3.995      }
   3.996  }
   3.997  
   3.998  
   3.999  void BranchObj::reposition()
  3.1000  {	
  3.1001 -/* FIXME testing
  3.1002 +/* TODO testing only
  3.1003  	if (!getHeading().isEmpty())
  3.1004  		cout << "BO::reposition  "<<getHeading()<<endl;
  3.1005  	else	
  3.1006 @@ -1023,9 +1315,13 @@
  3.1007  		// changes its height,
  3.1008  		// all upper LMOs have to change, too.
  3.1009  		calcBBoxSizeWithChilds();
  3.1010 +		updateLink();	// This update is needed if the canvas is resized 
  3.1011 +						// due to excessive moving of a FIO
  3.1012 +
  3.1013  	    alignRelativeTo ( QPoint (absPos.x(),
  3.1014  			absPos.y()-(bboxTotal.height()-bbox.height())/2) );
  3.1015  		branch.sort();	
  3.1016 +		positionBBox();	// Reposition bbox and contents
  3.1017  	} else
  3.1018  	{
  3.1019  		// This is only important for moving branches:
  3.1020 @@ -1044,11 +1340,13 @@
  3.1021  
  3.1022  	BranchObj* b;
  3.1023  	for (b=branch.first();b ;b=branch.next() )
  3.1024 -		r=addBBox(b->getTotalBBox(),r);
  3.1025 +		if (!b->isHidden())
  3.1026 +			r=addBBox(b->getTotalBBox(),r);
  3.1027  
  3.1028  	FloatImageObj* fio;
  3.1029  	for (fio=floatimage.first();fio ;fio=floatimage.next() )
  3.1030 -		r=addBBox(fio->getTotalBBox(),r);
  3.1031 +		if (!fio->isHidden())
  3.1032 +			r=addBBox(fio->getTotalBBox(),r);
  3.1033  		
  3.1034  	return r;
  3.1035  }
  3.1036 @@ -1059,14 +1357,14 @@
  3.1037  }
  3.1038  
  3.1039  void BranchObj::calcBBoxSizeWithChilds()
  3.1040 -{
  3.1041 -	// This is called only from reposition and
  3.1042 +{	
  3.1043 +	// This is initially called only from reposition and
  3.1044  	// and only for mapcenter. So it won't be
  3.1045  	// called more than once for a single user 
  3.1046  	// action
  3.1047  	
  3.1048 +
  3.1049  	// Calculate size of LMO including all childs (to align them later)
  3.1050 -
  3.1051  	bboxTotal.setX(bbox.x() );
  3.1052  	bboxTotal.setY(bbox.y() );
  3.1053  
  3.1054 @@ -1078,6 +1376,22 @@
  3.1055  		return;
  3.1056  	}
  3.1057  	
  3.1058 +	if (hidden)
  3.1059 +	{
  3.1060 +		bboxTotal.setWidth (0);
  3.1061 +		bboxTotal.setHeight(0);
  3.1062 +		if (parObj)
  3.1063 +		{
  3.1064 +			bboxTotal.setX (parObj->x());
  3.1065 +			bboxTotal.setY (parObj->y());
  3.1066 +		} else
  3.1067 +		{
  3.1068 +			bboxTotal.setX (bbox.x());
  3.1069 +			bboxTotal.setY (bbox.y());
  3.1070 +		}
  3.1071 +		return;
  3.1072 +	}
  3.1073 +	
  3.1074  	QRect r(0,0,0,0);
  3.1075  	QRect br;
  3.1076  	// Now calculate recursivly
  3.1077 @@ -1087,11 +1401,14 @@
  3.1078  	BranchObj* b;
  3.1079  	for (b=branch.first();b ;b=branch.next() )
  3.1080  	{
  3.1081 -		b->calcBBoxSizeWithChilds();
  3.1082 -		br=b->getBBoxSizeWithChilds();
  3.1083 -		r.setWidth( max (br.width(), r.width() ));
  3.1084 -		r.setHeight(br.height() + r.height() );
  3.1085 -		if (br.y()<bboxTotal.y()) bboxTotal.setY(br.y());
  3.1086 +		if (!b->isHidden())
  3.1087 +		{
  3.1088 +			b->calcBBoxSizeWithChilds();
  3.1089 +			br=b->getBBoxSizeWithChilds();
  3.1090 +			r.setWidth( max (br.width(), r.width() ));
  3.1091 +			r.setHeight(br.height() + r.height() );
  3.1092 +			if (br.y()<bboxTotal.y()) bboxTotal.setY(br.y());
  3.1093 +		}
  3.1094  	}
  3.1095  	// Add myself and also
  3.1096  	// add width of link to sum if necessary
  3.1097 @@ -1099,12 +1416,21 @@
  3.1098  		bboxTotal.setWidth (bbox.width() + r.width() );
  3.1099  	else	
  3.1100  		bboxTotal.setWidth (bbox.width() + r.width() + linkwidth);
  3.1101 -	bboxTotal.setHeight(max (r.height(),  bbox.height() ) );
  3.1102 -//	frame->setRect(QRect(bbox.x(),bbox.y(),bbox.width(),bbox.height() ) );
  3.1103 +	
  3.1104 +	bboxTotal.setHeight(max (r.height(),  bbox.height()));
  3.1105  }
  3.1106  
  3.1107  void BranchObj::select()
  3.1108  {
  3.1109 +	// set Text in Editor	
  3.1110 +	textEditor->setText(note.getNote() );
  3.1111 +	QString fnh=note.getFilenameHint();
  3.1112 +	if (fnh!="")
  3.1113 +		textEditor->setFilenameHint(note.getFilenameHint() );
  3.1114 +	else	
  3.1115 +		textEditor->setFilenameHint(getHeading() );
  3.1116 +	textEditor->setFontHint (note.getFontHint() );
  3.1117 +
  3.1118      LinkableMapObj::select();
  3.1119  	// Tell parent that I am selected now:
  3.1120  	BranchObj* po=(BranchObj*)(parObj);
  3.1121 @@ -1114,13 +1440,6 @@
  3.1122  	// temporary unscroll, if we have scrolled parents somewhere
  3.1123  	if (parObj) ((BranchObj*)(parObj))->tmpUnscroll();
  3.1124  
  3.1125 -	// set Text in Editor	
  3.1126 -	textEditor->setText(note.getNote() );
  3.1127 -	textEditor->setFilename(note.getFilenameHint() );
  3.1128 -	textEditor->setFontHint (note.getFontHint() );
  3.1129 -	connect (textEditor, SIGNAL (textHasChanged() ), this, SLOT (updateNoteFlag() ) ); 
  3.1130 -	connect (textEditor, SIGNAL (fontSizeHasChanged() ), this, SLOT (updateNoteFlag() ) ); 
  3.1131 -
  3.1132  	// Show URL and link in statusbar
  3.1133  	QString status;
  3.1134  	if (!url.isEmpty()) status+="URL: "+url+"  ";
  3.1135 @@ -1128,13 +1447,7 @@
  3.1136  	if (!status.isEmpty()) mainWindow->statusMessage (status);
  3.1137  
  3.1138  	// Update Toolbar
  3.1139 -	standardFlags->updateToolBar();
  3.1140 -
  3.1141 -	// Update Browserbutton
  3.1142 -	if (!url.isEmpty())
  3.1143 -		actionEditOpenURL->setEnabled (true);
  3.1144 -	else	
  3.1145 -		actionEditOpenURL->setEnabled (false);
  3.1146 +	standardFlags->updateToolbar();
  3.1147  
  3.1148  	// Update actions in mapeditor
  3.1149  	mapEditor->updateActions();
  3.1150 @@ -1154,15 +1467,11 @@
  3.1151  	// reset temporary unscroll, if we have scrolled parents somewhere
  3.1152  	if (parObj) ((BranchObj*)(parObj))->resetTmpUnscroll();
  3.1153  
  3.1154 -	// Disconnect textEditor from this LMO
  3.1155 -	disconnect( textEditor, SIGNAL(textHasChanged()), 0, 0 );
  3.1156 -	disconnect( textEditor, SIGNAL (fontSizeHasChanged()),0,0 ); 
  3.1157 -
  3.1158  	// Erase content of editor 
  3.1159  	textEditor->setInactive();
  3.1160  
  3.1161  	// unselect all buttons in toolbar
  3.1162 -	standardFlagsDefault->updateToolBar();
  3.1163 +	standardFlagsDefault->updateToolbar();
  3.1164  }
  3.1165  
  3.1166  QString BranchObj::getSelectString()
  3.1167 @@ -1170,15 +1479,12 @@
  3.1168  	QString s;
  3.1169  	if (parObj)
  3.1170  	{
  3.1171 -		if (parObj->getDepth()==0)
  3.1172 +		if (depth==1)
  3.1173  			s= "bo:" + QString("%1").arg(getNum());
  3.1174  		else	
  3.1175  			s= ((BranchObj*)(parObj))->getSelectString() + ",bo:" + QString("%1").arg(getNum());
  3.1176  	} else
  3.1177 -	{
  3.1178  		s="mc:";
  3.1179 -	}
  3.1180 -	
  3.1181  	return s;
  3.1182  }
  3.1183  
     4.1 --- a/branchobj.h	Sun Jan 30 12:58:47 2005 +0000
     4.2 +++ b/branchobj.h	Tue Jun 06 14:58:11 2006 +0000
     4.3 @@ -4,18 +4,24 @@
     4.4  #include "floatimageobj.h"
     4.5  #include "linkablemapobj.h"
     4.6  #include "ornamentedobj.h"
     4.7 +#include "xlinkobj.h"
     4.8 +//Added by qt3to4:
     4.9 +#include <Q3PtrList>
    4.10  
    4.11 -class BranchObjPtrList : public QPtrList<BranchObj>
    4.12 +class BranchObjPtrList : public Q3PtrList<BranchObj>
    4.13  {
    4.14 -	virtual int compareItems (QPtrCollection::Item i, QPtrCollection::Item j);
    4.15 +	virtual int compareItems (Q3PtrCollection::Item i, Q3PtrCollection::Item j);
    4.16  };
    4.17  
    4.18 +enum BranchModification {NewBranch, MovedBranch};
    4.19 +enum HideTmpMode {HideNone, HideExport};
    4.20 +
    4.21  /////////////////////////////////////////////////////////////////////////////
    4.22  class BranchObj:public OrnamentedObj {
    4.23  public:
    4.24      BranchObj ();
    4.25 -    BranchObj (QCanvas*);
    4.26 -    BranchObj (QCanvas*, LinkableMapObj* parent);
    4.27 +    BranchObj (Q3Canvas*);
    4.28 +    BranchObj (Q3Canvas*, LinkableMapObj* parent);
    4.29      ~BranchObj ();
    4.30  	bool operator< ( const BranchObj & );
    4.31  	bool operator== ( const BranchObj & );
    4.32 @@ -27,6 +33,7 @@
    4.33  	virtual int getFloatImageNum(FloatImageObj*);		
    4.34  	virtual int countBranches();		
    4.35  	virtual int countFloatImages();		
    4.36 +	virtual int countXLinks();		
    4.37      virtual void setParObjTmp (LinkableMapObj*,QPoint,int);// Only for moving Obj around
    4.38  	virtual void unsetParObjTmp();			// reuse original ParObj
    4.39  
    4.40 @@ -40,27 +47,40 @@
    4.41  	virtual void setVisibility(bool,int);	// set visibility
    4.42      virtual void setVisibility(bool);	    // set vis. for w
    4.43  	virtual void setLinkColor();			// set the color of link
    4.44 -	virtual void setColor(QColor,bool);		// set the color of heading
    4.45 -
    4.46 +	virtual void setColorChilds(QColor);			// set the color of heading
    4.47  
    4.48  	BranchObj* first ();				// set Iterator to first LMO
    4.49  	BranchObj* next ();					// find next LMO after given one
    4.50  	BranchObj* getLastIterator();		// to interrupt and resume next iteration
    4.51  	void setLastIterator (BranchObj*);	// needed by next() 
    4.52  
    4.53 +	virtual void positionContents();
    4.54      virtual void move (double x,double y);
    4.55      virtual void move (QPoint);
    4.56      virtual void moveBy (double x,double y);
    4.57      virtual void moveBy (QPoint);
    4.58      virtual void positionBBox();
    4.59      virtual void calcBBoxSize();
    4.60 +	virtual void setDockPos();
    4.61      virtual LinkableMapObj* findMapObj(QPoint,LinkableMapObj*);	// find MapObj 
    4.62      virtual void setHeading (QString);
    4.63 -    virtual void setURL (QString);
    4.64 -    virtual QString getURL ();
    4.65 -    virtual void setVymLink (QString);
    4.66 -    virtual QString getVymLink ();
    4.67 +
    4.68 +	virtual void setHideTmp (HideTmpMode);
    4.69 +	virtual bool hasHiddenExportParent (BranchObj*);
    4.70 +
    4.71  	virtual QString saveToDir (const QString&,const QString&, const QPoint&);// Save data recursivly to tempdir
    4.72 +	virtual void addXLink (XLinkObj*);
    4.73 +	virtual void removeXLinkRef (XLinkObj*);// Remove ref in list
    4.74 +	virtual void deleteXLink (XLinkObj*);	// remove references and delete XLinkObj 
    4.75 +	virtual void deleteXLinkAt (int);		// remove references and delete XLinkObj 
    4.76 +	virtual XLinkObj* XLinkAt (int);		// return reference of XLinkObj 
    4.77 +	virtual int countXLink ();
    4.78 +	virtual BranchObj* XLinkTargetAt (int);
    4.79 +	void setIncludeImagesVer(bool);
    4.80 +	bool getIncludeImagesVer();
    4.81 +	void setIncludeImagesHor(bool);
    4.82 +	bool getIncludeImagesHor();
    4.83 +	QString getIncludeImageAttr();
    4.84  	virtual LinkableMapObj* addFloatImage();
    4.85  	virtual LinkableMapObj* addFloatImage(FloatImageObj*);
    4.86  	virtual void removeFloatImage(FloatImageObj*);
    4.87 @@ -68,21 +88,29 @@
    4.88      virtual FloatImageObj* getLastFloatImage();
    4.89  	virtual FloatImageObj* getFloatImageNum(const uint &);
    4.90  protected:	
    4.91 -	virtual void savePosInAngle();			// write pos in angle for resorting			
    4.92 +	virtual void savePosInAngle();					// write pos in angle for resorting			
    4.93 +	virtual void setDefAttr (BranchModification);	// set default attributes (font, size, ...)
    4.94  public:	
    4.95      virtual BranchObj* addBranch();
    4.96      virtual BranchObj* addBranch(BranchObj*);		// makes deep copy of BranchObj
    4.97 +    virtual BranchObj* addBranchPtr(BranchObj*);	// just adds pointer
    4.98      virtual BranchObj* insertBranch(int);
    4.99      virtual BranchObj* insertBranch(BranchObj*,int);
   4.100 +    virtual BranchObj* insertBranchPtr (BranchObj*,int);
   4.101 +    virtual void removeBranchHere(BranchObj*);  
   4.102 +    virtual void removeChilds();  
   4.103      virtual void removeBranch(BranchObj*);  
   4.104 +    virtual void removeBranchPtr (BranchObj*);  
   4.105      virtual void setLastSelectedBranch(BranchObj*);
   4.106      virtual BranchObj* getLastSelectedBranch();
   4.107      virtual BranchObj* getFirstBranch();
   4.108      virtual BranchObj* getLastBranch();
   4.109  	virtual BranchObj* getBranchNum(const uint &);
   4.110 +    virtual bool canMoveBranchUp();
   4.111      virtual BranchObj* moveBranchUp(BranchObj*);
   4.112 +    virtual bool canMoveBranchDown();
   4.113      virtual BranchObj* moveBranchDown(BranchObj*);
   4.114 -
   4.115 +    virtual BranchObj* moveBranchTo (BranchObj*, int);
   4.116      virtual void alignRelativeTo(const QPoint );
   4.117  	virtual void reposition();
   4.118  
   4.119 @@ -97,15 +125,17 @@
   4.120  protected:
   4.121  	static BranchObj* itLast;		// iterator for first(), next()
   4.122      BranchObjPtrList branch;		// all child branches
   4.123 -	QPtrList<FloatImageObj> floatimage;	// child images
   4.124 +	Q3PtrList<FloatImageObj> floatimage;	// child images
   4.125 +	Q3PtrList<XLinkObj> xlink;		// xlinks to other branches
   4.126  public:	
   4.127  	float angle;					// used in mainbranch to reorder mainbranches
   4.128  protected:	
   4.129      int lastSelectedBranch;			// for going deeper into tree
   4.130  	bool scrolled;					// true if all childs are scrolled and thus invisible
   4.131  	bool tmpUnscrolled;				// can only be true (temporary) for a scrolled subtree
   4.132 -	QString url;					// url to external doc
   4.133 -	QString vymLink;				// path to another map
   4.134 +	bool includeImagesVer;			// include floatimages in bbox vertically
   4.135 +	bool includeImagesHor;			// include floatimages in bbox horizontally
   4.136 +
   4.137  };
   4.138  
   4.139  
     5.1 Binary file demos/todo.vym has changed
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/exportoofiledialog.cpp	Tue Jun 06 14:58:11 2006 +0000
     6.3 @@ -0,0 +1,87 @@
     6.4 +#include <iostream>
     6.5 +
     6.6 +#include "exportoofiledialog.h"
     6.7 +
     6.8 +ExportOOFileDialog::ExportOOFileDialog():Q3FileDialog()
     6.9 +{
    6.10 +	init();
    6.11 +}
    6.12 +
    6.13 +ExportOOFileDialog::ExportOOFileDialog (QWidget * parent, const char* name, bool modal):Q3FileDialog(parent, name,modal)
    6.14 +{
    6.15 +	init();
    6.16 +}
    6.17 +
    6.18 +QString ExportOOFileDialog::selectedConfig()
    6.19 +{
    6.20 +	QStringList::Iterator itpath=configPaths.begin();
    6.21 +	QStringList::Iterator itf=filters.begin();
    6.22 +	while (itf != filters.end()) 
    6.23 +	{
    6.24 +		if (*itf==lastFilter) return *itpath;
    6.25 +		itpath++;	
    6.26 +		itf++;
    6.27 +    }
    6.28 +	qWarning ("ExportOOFileDialog::selectedConfig  No filter found!");
    6.29 +	return "";
    6.30 +}
    6.31 +
    6.32 +void ExportOOFileDialog::newConfigPath(const QString &s)
    6.33 +{
    6.34 +	lastFilter=s;
    6.35 +}
    6.36 +
    6.37 +QString ExportOOFileDialog::selectedFile()
    6.38 +{
    6.39 +	return Q3FileDialog::selectedFile();
    6.40 +}
    6.41 +
    6.42 +
    6.43 +void ExportOOFileDialog::addFilter(const QString &f)
    6.44 +{
    6.45 +	lastFilter=f;
    6.46 +	filters.append (f);
    6.47 +	Q3FileDialog::addFilter (f);
    6.48 +}
    6.49 +
    6.50 +void ExportOOFileDialog::init()
    6.51 +{
    6.52 +	setMode( Q3FileDialog::AnyFile );
    6.53 +	QDir d;
    6.54 +	d.setPath ("/usr/share/vym/exports");
    6.55 +	scanExportConfigs(d);
    6.56 +	d.setPath (d.homeDirPath()+"/.vym/exports");
    6.57 +	scanExportConfigs(d);
    6.58 +	d.setPath ("exports");
    6.59 +	scanExportConfigs(d);
    6.60 +
    6.61 +	connect (
    6.62 +		this,SIGNAL (filterSelected(const QString&)),
    6.63 +		this, SLOT( newConfigPath(const QString &)));
    6.64 +}
    6.65 +
    6.66 +void ExportOOFileDialog::scanExportConfigs(QDir dir)
    6.67 +{
    6.68 +	// Scan existing export configurations
    6.69 +	SimpleSettings set;
    6.70 +	QFile f;
    6.71 +	if (dir.exists())
    6.72 +	{
    6.73 +		// Traverse files
    6.74 +        QDir dir;
    6.75 +        dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
    6.76 +
    6.77 +        QFileInfoList list = dir.entryInfoList();
    6.78 +        for (int i = 0; i < list.size(); ++i) {
    6.79 +            QFileInfo fi = list.at(i);
    6.80 +
    6.81 +			if (fi.fileName().endsWith(".conf") )
    6.82 +			{
    6.83 +				configPaths.append (fi.absFilePath());
    6.84 +				set.clear();
    6.85 +				set.readSettings (fi.absFilePath());
    6.86 +				addFilter (set.readEntry("Name") + " (*.odp)");
    6.87 +			}		
    6.88 +        }
    6.89 +	}		
    6.90 +}
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/exportoofiledialog.h	Tue Jun 06 14:58:11 2006 +0000
     7.3 @@ -0,0 +1,32 @@
     7.4 +#ifndef EXPORTOOFILEDIALOG
     7.5 +#define EXPORTOOFILEDIALOG
     7.6 +
     7.7 +#include <q3filedialog.h>
     7.8 +#include <qstringlist.h>
     7.9 +
    7.10 +#include "settings.h"
    7.11 +
    7.12 +class ExportOOFileDialog:public Q3FileDialog
    7.13 +{
    7.14 +	Q_OBJECT
    7.15 +public:
    7.16 +	ExportOOFileDialog();
    7.17 +
    7.18 +	ExportOOFileDialog (QWidget * parent = 0, const char * name = 0, bool
    7.19 +	modal = false);
    7.20 +	QString selectedConfig();
    7.21 +	QString selectedFile();
    7.22 +	void addFilter(const QString &);
    7.23 +	 
    7.24 +private slots:
    7.25 +	void  newConfigPath (const QString&f);
    7.26 +
    7.27 +private:
    7.28 +	void init();
    7.29 +	void scanExportConfigs(QDir );
    7.30 +	QStringList configPaths;
    7.31 +	QStringList filters;
    7.32 +	QString lastFilter;
    7.33 +	
    7.34 +};
    7.35 +#endif
     8.1 --- a/exports.cpp	Sun Jan 30 12:58:47 2005 +0000
     8.2 +++ b/exports.cpp	Tue Jun 06 14:58:11 2006 +0000
     8.3 @@ -1,87 +1,103 @@
     8.4 +#include <q3filedialog.h>
     8.5 +#include <qmessagebox.h>
     8.6 +#include <q3process.h>
     8.7 +//Added by qt3to4:
     8.8 +#include <QTextStream>
     8.9 +
    8.10  #include "exports.h"
    8.11 +#include "file.h"
    8.12 +#include "linkablemapobj.h"
    8.13 +#include "misc.h"
    8.14 +#include "mainwindow.h"
    8.15 +#include "warningdialog.h"
    8.16 +#include "xsltproc.h"
    8.17  
    8.18 -#include "linkablemapobj.h"
    8.19 +extern Main *mainWindow;
    8.20 +extern QDir vymBaseDir;
    8.21  
    8.22  
    8.23 -Export::Export()
    8.24 +ExportBase::ExportBase()
    8.25  {
    8.26  	indentPerDepth="  ";
    8.27 +	// Create tmpdir
    8.28 +	tmpDir.setPath (makeUniqueDir("/tmp/vym-XXXXXX"));
    8.29  }
    8.30  
    8.31 -bool Export::setOutputDir(QString dirname)
    8.32 +ExportBase::~ExportBase()
    8.33  {
    8.34 -	outdir.setPath (dirname);
    8.35 -	if ( outdir.exists() )
    8.36 -	{
    8.37 -		// FIXME
    8.38 -		// ask for confirmation
    8.39 -		// then delete outdir
    8.40 -		return true;
    8.41 -	} else
    8.42 -	{
    8.43 -		// try to create directory
    8.44 -		//return outdir.mkdir (outdir.absPath());
    8.45 -		// FIXME
    8.46 -		return true;
    8.47 -	}
    8.48 +	// Remove tmpdir
    8.49 +	removeDir (tmpDir);
    8.50  }
    8.51  
    8.52 -void Export::setPath (const QString &p)
    8.53 +void ExportBase::setDir(const QString &p)
    8.54  {
    8.55 -	filepath=p;
    8.56 +	outputDir=p;
    8.57  }
    8.58  
    8.59 -void Export::setMapCenter(MapCenterObj *mc)
    8.60 +void ExportBase::setFile (const QString &p)
    8.61 +{
    8.62 +	outputFile=p;
    8.63 +}
    8.64 +
    8.65 +void ExportBase::setMapCenter(MapCenterObj *mc)
    8.66  {
    8.67  	mapCenter=mc;
    8.68  }
    8.69  
    8.70 -void Export::exportMap()
    8.71 +void ExportBase::setCaption (const QString &s)
    8.72  {
    8.73 -	QFile file (filepath);
    8.74 -	if ( !file.open( IO_WriteOnly ) )
    8.75 -	{
    8.76 -		// FIXME
    8.77 -		cout << "Export::exportMap  couldn't open "<<filepath<<endl;
    8.78 -		return;
    8.79 -	}
    8.80 -	QTextStream ts( &file );	// use LANG decoding here...
    8.81 -
    8.82 -	// Main loop over all branches
    8.83 -	QString s;
    8.84 -	QString actIndent("");
    8.85 -	int i;
    8.86 -	BranchObj *bo;
    8.87 -	bo=mapCenter->first();
    8.88 -	while (bo) 
    8.89 -	{
    8.90 -		// Make indentstring
    8.91 -		for (i=0;i<bo->getDepth();i++) actIndent+= indentPerDepth;
    8.92 -
    8.93 -		// Write heading
    8.94 -		//	write (actIndent + getSectionString(bo) + bo->getHeading()+ "\n");
    8.95 -		if (bo->getDepth()==1)
    8.96 -			ts << (getSectionString(bo) + bo->getHeading()+ "\n");
    8.97 -		else	
    8.98 -			ts << (actIndent + " - " + bo->getHeading()+ "\n");
    8.99 -		
   8.100 -		// If necessary, write note
   8.101 -		if (!bo->getNote().isEmpty())
   8.102 -		{
   8.103 -			ts << ("-------------------Begin of Note-----------------\n");
   8.104 -			ts << (bo->getNote());
   8.105 -			ts << ("\n");
   8.106 -			ts << ("-------------------End of Note-------------------\n");
   8.107 -		}
   8.108 -		
   8.109 -		bo=bo->next();
   8.110 -		actIndent="";
   8.111 -	}
   8.112 -	file.close();
   8.113 +	caption=s;
   8.114  }
   8.115  
   8.116 -QString Export::getSectionString(BranchObj *bostart)
   8.117 +void ExportBase::addFilter(const QString &s)
   8.118  {
   8.119 +	filter=s;
   8.120 +}
   8.121 +
   8.122 +bool ExportBase::execDialog()
   8.123 +{
   8.124 +	if (mapCenter && mapCenter->getMapEditor())
   8.125 +	{
   8.126 +		Q3FileDialog *fd=new Q3FileDialog( mapCenter->getMapEditor(), caption);
   8.127 +		fd->addFilter (filter);
   8.128 +		fd->setCaption(caption);
   8.129 +		fd->setMode( Q3FileDialog::AnyFile );
   8.130 +		fd->show();
   8.131 +
   8.132 +		if ( fd->exec() == QDialog::Accepted )
   8.133 +		{
   8.134 +			if (QFile (fd->selectedFile()).exists() )
   8.135 +			{
   8.136 +				QMessageBox mb( __VYM,
   8.137 +					QObject::tr("The file %1 exists already.\nDo you want to overwrite it?").arg(fd->selectedFile()), 
   8.138 +				QMessageBox::Warning,
   8.139 +				QMessageBox::Yes | QMessageBox::Default,
   8.140 +				QMessageBox::Cancel | QMessageBox::Escape,
   8.141 +				Qt::NoButton );
   8.142 +				mb.setButtonText( QMessageBox::Yes, QObject::tr("Overwrite") );
   8.143 +				mb.setButtonText( QMessageBox::No, QObject::tr("Cancel"));
   8.144 +				ExportBase ex;
   8.145 +				switch( mb.exec() ) 
   8.146 +				{
   8.147 +					case QMessageBox::Yes:
   8.148 +						// save 
   8.149 +						break;;
   8.150 +					case QMessageBox::Cancel:
   8.151 +						// return, do nothing
   8.152 +						return false;
   8.153 +						break;
   8.154 +				}
   8.155 +			}
   8.156 +			outputFile=fd->selectedFile();
   8.157 +			return true;
   8.158 +		}
   8.159 +	}
   8.160 +	return false;
   8.161 +}
   8.162 +
   8.163 +QString ExportBase::getSectionString(BranchObj *bostart)
   8.164 +{
   8.165 +	// Make prefix like "2.5.3" for "bo:2,bo:5,bo:3"
   8.166  	QString r;
   8.167  	BranchObj *bo=bostart;
   8.168  	int depth=bo->getDepth();
   8.169 @@ -97,13 +113,24 @@
   8.170  		return r + " ";
   8.171  }
   8.172  
   8.173 -void Export::exportAsHTML()
   8.174 +
   8.175 +////////////////////////////////////////////////////////////////////////
   8.176 +void ExportASCII::doExport()
   8.177  {
   8.178 -	// FIXME  just testing...
   8.179 +	QFile file (outputFile);
   8.180 +	if ( !file.open( QIODevice::WriteOnly ) )
   8.181 +	{
   8.182 +		// FIXME experimental, testing
   8.183 +		qWarning ("ExportBase::exportXML  couldn't open "+outputFile);
   8.184 +		return;
   8.185 +	}
   8.186 +	QTextStream ts( &file );	// use LANG decoding here...
   8.187 +
   8.188  	// Main loop over all branches
   8.189  	QString s;
   8.190  	QString actIndent("");
   8.191  	int i;
   8.192 +	uint j;
   8.193  	BranchObj *bo;
   8.194  	bo=mapCenter->first();
   8.195  	while (bo) 
   8.196 @@ -111,22 +138,338 @@
   8.197  		// Make indentstring
   8.198  		for (i=0;i<bo->getDepth();i++) actIndent+= indentPerDepth;
   8.199  
   8.200 -		// Write heading
   8.201 -		write (actIndent + getSectionString(bo) + bo->getHeading()+ "\n");
   8.202 +		if (bo->getDepth()==0)
   8.203 +		{
   8.204 +			ts << (bo->getHeading()+ "\n");
   8.205 +			for (j=0;j<bo->getHeading().length();j++) ts<<"=";
   8.206 +			ts << "\n";
   8.207 +		} else 	if (bo->getDepth()==1)
   8.208 +			ts << ("\n"+getSectionString(bo) + bo->getHeading()+ "\n");
   8.209 +		else	if (bo->getDepth()==2)
   8.210 +			ts << (actIndent + " o " + bo->getHeading()+ "\n");
   8.211 +		else	
   8.212 +			ts << (actIndent + " - " + bo->getHeading()+ "\n");
   8.213  		
   8.214  		// If necessary, write note
   8.215  		if (!bo->getNote().isEmpty())
   8.216  		{
   8.217 -			write (bo->getNote());
   8.218 +			s =bo->getNoteASCII();
   8.219 +			s=s.replace ("\n","\n"+actIndent);
   8.220 +			ts << (s+"\n\n");
   8.221  		}
   8.222 -		
   8.223  		bo=bo->next();
   8.224  		actIndent="";
   8.225  	}
   8.226 +	file.close();
   8.227  }
   8.228  
   8.229 -void Export::write(QString s)
   8.230 +////////////////////////////////////////////////////////////////////////
   8.231 +void ExportKDEBookmarks::doExport() 
   8.232  {
   8.233 -	cout << s;
   8.234 +	MapEditor *me=NULL;
   8.235 +	if (mapCenter) me=mapCenter->getMapEditor();
   8.236 +	if (me)
   8.237 +	{
   8.238 +		WarningDialog dia;
   8.239 +		dia.setCancelButton (true);
   8.240 +		dia.setText(QObject::tr("Exporting the %1 bookmarks will overwrite\nyour existing bookmarks file.").arg("KDE"));
   8.241 +		dia.setCaption(QObject::tr("Warning: Overwriting %1 bookmarks").arg("KDE"));
   8.242 +		dia.setShowAgainName("/vym/warnings/overwriteKDEBookmarks");
   8.243 +		if (dia.exec()==QDialog::Accepted)
   8.244 +		{
   8.245 +			me->exportXML(tmpDir.path());
   8.246 +
   8.247 +			XSLTProc p;
   8.248 +			p.setInputFile (tmpDir.path()+"/"+me->getMapName()+".xml");
   8.249 +			p.setOutputFile (tmpDir.home().path()+"/.kde/share/apps/konqueror/bookmarks.xml");
   8.250 +			p.setXSLFile (vymBaseDir.path()+"/styles/vym2kdebookmarks.xsl");
   8.251 +			p.process();
   8.252 +
   8.253 +			QString ub=vymBaseDir.path()+"/scripts/update-bookmarks";
   8.254 +			Q3Process *proc = new Q3Process( );
   8.255 +			proc->addArgument(ub);
   8.256 +
   8.257 +			if ( !proc->start() ) 
   8.258 +			{
   8.259 +				QMessageBox::warning(0, 
   8.260 +					QObject::tr("Warning"),
   8.261 +					QObject::tr("Couldn't find script %1\nto notifiy Browsers of changed bookmarks.").arg(ub));
   8.262 +			}	
   8.263 +
   8.264 +
   8.265 +		}
   8.266 +	}
   8.267 +
   8.268  }
   8.269  
   8.270 +////////////////////////////////////////////////////////////////////////
   8.271 +void ExportFirefoxBookmarks::doExport() 
   8.272 +{
   8.273 +	MapEditor *me=NULL;
   8.274 +	if (mapCenter) me=mapCenter->getMapEditor();
   8.275 +	if (me)
   8.276 +	{
   8.277 +		WarningDialog dia;
   8.278 +		dia.setCancelButton (true);
   8.279 +		dia.setText(QObject::tr("Exporting the %1 bookmarks will overwrite\nyour existing bookmarks file.").arg("Firefox"));
   8.280 +		dia.setCaption(QObject::tr("Warning: Overwriting %1 bookmarks").arg("Firefox"));
   8.281 +		dia.setShowAgainName("/vym/warnings/overwriteImportBookmarks");
   8.282 +		if (dia.exec()==QDialog::Accepted)
   8.283 +		{
   8.284 +			me->exportXML(tmpDir.path());
   8.285 +
   8.286 +/*
   8.287 +			XSLTProc p;
   8.288 +			p.setInputFile (tmpDir.path()+"/"+me->getMapName()+".xml");
   8.289 +			p.setOutputFile (tmpDir.home().path()+"/.kde/share/apps/konqueror/bookmarks.xml");
   8.290 +			p.setXSLFile (vymBaseDir.path()+"/styles/vym2kdebookmarks.xsl");
   8.291 +			p.process();
   8.292 +
   8.293 +			QString ub=vymBaseDir.path()+"/scripts/update-bookmarks";
   8.294 +			QProcess *proc = new QProcess( );
   8.295 +			proc->addArgument(ub);
   8.296 +
   8.297 +			if ( !proc->start() ) 
   8.298 +			{
   8.299 +				QMessageBox::warning(0, 
   8.300 +					QObject::tr("Warning"),
   8.301 +					QObject::tr("Couldn't find script %1\nto notifiy Browsers of changed bookmarks.").arg(ub));
   8.302 +			}	
   8.303 +
   8.304 +*/
   8.305 +
   8.306 +		}
   8.307 +	}
   8.308 +}
   8.309 +
   8.310 +////////////////////////////////////////////////////////////////////////
   8.311 +void ExportTaskjuggler::doExport() 
   8.312 +{
   8.313 +	MapEditor *me=NULL;
   8.314 +	if (mapCenter) me=mapCenter->getMapEditor();
   8.315 +	if (me)
   8.316 +	{
   8.317 +		me->exportXML(tmpDir.path());
   8.318 +
   8.319 +		XSLTProc p;
   8.320 +		p.setInputFile (tmpDir.path()+"/"+me->getMapName()+".xml");
   8.321 +		p.setOutputFile (outputFile);
   8.322 +		p.setXSLFile (vymBaseDir.path()+"/styles/vym2taskjuggler.xsl");
   8.323 +		p.process();
   8.324 +	}
   8.325 +
   8.326 +}
   8.327 +
   8.328 +////////////////////////////////////////////////////////////////////////
   8.329 +void ExportLaTeX::doExport() 
   8.330 +{
   8.331 +	// Exports a map to a LaTex file.  
   8.332 +	// This file needs to be included 
   8.333 +	// or inported into a LaTex document
   8.334 +	// it will not add a preamble, or anything 
   8.335 +	// that makes a full LaTex document.
   8.336 +  QFile file (outputFile);
   8.337 +  if ( !file.open( QIODevice::WriteOnly ) ) {
   8.338 +	QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Could not write %1").arg(outputFile));
   8.339 +	mainWindow->statusMessage(QString(QObject::tr("Export failed.")));
   8.340 +    return;
   8.341 +  }
   8.342 +  QTextStream ts( &file );	// use LANG decoding here...
   8.343 +  ts.setEncoding (QTextStream::UnicodeUTF8); // Force UTF8
   8.344 +  
   8.345 +  // Main loop over all branches
   8.346 +  QString s;
   8.347 +  // QString actIndent("");
   8.348 +  // int i;
   8.349 +  BranchObj *bo;
   8.350 +  bo=mapCenter->first();
   8.351 +  while (bo) {
   8.352 +	if (bo->getDepth()==0);
   8.353 +	else if (bo->getDepth()==1) {
   8.354 +	  ts << ("\\chapter{" + bo->getHeading()+ "}\n");
   8.355 +	}
   8.356 +	else if (bo->getDepth()==2) {
   8.357 +	  ts << ("\\section{" + bo->getHeading()+ "}\n");
   8.358 +	}
   8.359 +	else if (bo->getDepth()==3) {
   8.360 +	  ts << ("\\subsection{" + bo->getHeading()+ "}\n");
   8.361 +	}
   8.362 +	else if (bo->getDepth()==4) {
   8.363 +	  ts << ("\\subsubsection{" + bo->getHeading()+ "}\n");
   8.364 +	}
   8.365 +	else {
   8.366 +	  ts << ("\\paragraph*{" + bo->getHeading()+ "}\n");
   8.367 +	}
   8.368 +	
   8.369 +	// If necessary, write note
   8.370 +	if (!bo->getNote().isEmpty()) {
   8.371 +	  ts << (bo->getNoteASCII());
   8.372 +	  ts << ("\n");
   8.373 +	}
   8.374 +    bo=bo->next();
   8.375 +   }
   8.376 +  file.close();
   8.377 +}
   8.378 +
   8.379 +////////////////////////////////////////////////////////////////////////
   8.380 +ExportOO::ExportOO()
   8.381 +{
   8.382 +	useSections=false;
   8.383 +}
   8.384 +
   8.385 +ExportOO::~ExportOO()
   8.386 +{
   8.387 +}	
   8.388 +
   8.389 +QString ExportOO::buildList (BranchObj *current)
   8.390 +{
   8.391 +    QString r;
   8.392 +    BranchObj *bo;
   8.393 +
   8.394 +    uint i=0;
   8.395 +    bo=current->getFirstBranch();
   8.396 +    if (bo)
   8.397 +    {
   8.398 +        // Start list
   8.399 +        r+="<text:list text:style-name=\"vym-list\">\n";
   8.400 +        while (bo)
   8.401 +        {
   8.402 +			r+="<text:list-item><text:p >";
   8.403 +			r+=quotemeta(bo->getHeading());
   8.404 +			// If necessary, write note
   8.405 +			if (!bo->getNote().isEmpty())
   8.406 +				r+=bo->getNoteOpenDoc();
   8.407 +			r+="</text:p>";
   8.408 +			r+=buildList (bo);	// recursivly add deeper branches
   8.409 +			r+="</text:list-item>\n";
   8.410 +			i++;
   8.411 +			bo=current->getBranchNum(i);
   8.412 +        }
   8.413 +        r+="</text:list>\n";
   8.414 +    }
   8.415 +    return r;
   8.416 +}
   8.417 +
   8.418 +
   8.419 +void ExportOO::exportPresentation()
   8.420 +{
   8.421 +	QString allPages;
   8.422 +
   8.423 +	// Insert new content
   8.424 +	content.replace ("<!-- INSERT TITLE -->",quotemeta(mapCenter->getHeading()));
   8.425 +	content.replace ("<!-- INSERT AUTHOR -->",quotemeta(mapCenter->getAuthor()));
   8.426 +
   8.427 +	QString	onePage;
   8.428 +	QString list;
   8.429 +	
   8.430 +	BranchObj *sectionBO=mapCenter->getFirstBranch();
   8.431 +    int i=0;
   8.432 +	BranchObj *pagesBO;
   8.433 +    int j=0;
   8.434 +
   8.435 +	// Walk sections
   8.436 +	while (sectionBO)
   8.437 +	{
   8.438 +		if (useSections)
   8.439 +		{
   8.440 +			// Add page with section title
   8.441 +			onePage=sectionTemplate;
   8.442 +			onePage.replace ("<!-- INSERT PAGE HEADING -->", quotemeta(sectionBO->getHeading() ) );
   8.443 +			allPages+=onePage;
   8.444 +		} else
   8.445 +		{
   8.446 +			i=-2;	// only use inner loop to 
   8.447 +			        // turn mainbranches into pages
   8.448 +			sectionBO=mapCenter;
   8.449 +		}
   8.450 +
   8.451 +		// Walk mainpages
   8.452 +		pagesBO=sectionBO->getFirstBranch();
   8.453 +		j=0;
   8.454 +		while (pagesBO)
   8.455 +		{
   8.456 +			// Add page with list of items
   8.457 +			onePage=pageTemplate;
   8.458 +			onePage.replace ("<!-- INSERT PAGE HEADING -->", quotemeta (pagesBO->getHeading() ) );
   8.459 +			list=buildList (pagesBO);
   8.460 +			onePage.replace ("<!-- INSERT LIST -->", list);
   8.461 +			allPages+=onePage;
   8.462 +			j++;
   8.463 +			pagesBO=sectionBO->getBranchNum(j);
   8.464 +		}
   8.465 +		i++;
   8.466 +		sectionBO=mapCenter->getBranchNum(i);
   8.467 +	}
   8.468 +	
   8.469 +	content.replace ("<!-- INSERT PAGES -->",allPages);
   8.470 +
   8.471 +	// Write modified content
   8.472 +	QFile f (contentFile);
   8.473 +    if ( !f.open( QIODevice::WriteOnly ) ) 
   8.474 +	{
   8.475 +		QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Could not write %1").arg(contentFile));
   8.476 +		mainWindow->statusMessage(QString(QObject::tr("Export failed.")));
   8.477 +		return;
   8.478 +    }
   8.479 +
   8.480 +    QTextStream t( &f );
   8.481 +    t << content;
   8.482 +    f.close();
   8.483 +
   8.484 +	// zip tmpdir to destination
   8.485 +	zipDir (tmpDir,outputFile);	
   8.486 +}
   8.487 +
   8.488 +bool ExportOO::setConfigFile (const QString &cf)
   8.489 +{
   8.490 +	configFile=cf;
   8.491 +	int i=cf.findRev ("/");
   8.492 +	if (i>=0) configDir=cf.left(i);
   8.493 +	SimpleSettings set;
   8.494 +	set.readSettings(configFile);
   8.495 +
   8.496 +	// set paths
   8.497 +	templateDir=configDir+"/"+set.readEntry ("Template");
   8.498 +
   8.499 +	QDir d (templateDir);
   8.500 +	if (!d.exists())
   8.501 +	{
   8.502 +		QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Check \"%1\" in\n%2").arg("Template="+set.readEntry ("Template")).arg(configFile));
   8.503 +		return false;
   8.504 +
   8.505 +	}
   8.506 +
   8.507 +	contentTemplateFile=templateDir+"content-template.xml";
   8.508 +	contentFile=tmpDir.path()+"/content.xml";
   8.509 +	pageTemplateFile=templateDir+"page-template.xml";
   8.510 +	sectionTemplateFile=templateDir+"section-template.xml";
   8.511 +
   8.512 +	if (set.readEntry("useSections").contains("yes"))
   8.513 +		useSections=true;
   8.514 +
   8.515 +	// Copy template to tmpdir
   8.516 +	system ("cp -r "+templateDir+"* "+tmpDir.path());
   8.517 +
   8.518 +	// Read content-template
   8.519 +	if (!loadStringFromDisk (contentTemplateFile,content))
   8.520 +	{
   8.521 +		QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Could not read %1").arg(contentTemplateFile));
   8.522 +		return false;
   8.523 +	}
   8.524 +
   8.525 +	// Read page-template
   8.526 +	if (!loadStringFromDisk (pageTemplateFile,pageTemplate))
   8.527 +	{
   8.528 +		QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Could not read %1").arg(pageTemplateFile));
   8.529 +		return false;
   8.530 +	}
   8.531 +	
   8.532 +	// Read section-template
   8.533 +	if (useSections && !loadStringFromDisk (sectionTemplateFile,sectionTemplate))
   8.534 +	{
   8.535 +		QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Could not read %1").arg(sectionTemplateFile));
   8.536 +		return false;
   8.537 +	}
   8.538 +	return true;
   8.539 +}
   8.540 +
     9.1 --- a/exportxhtmldialog.ui.h	Sun Jan 30 12:58:47 2005 +0000
     9.2 +++ b/exportxhtmldialog.ui.h	Tue Jun 06 14:58:11 2006 +0000
     9.3 @@ -1,3 +1,6 @@
     9.4 +//Added by qt3to4:
     9.5 +#include <QPixmap>
     9.6 +#include <QTextStream>
     9.7  /****************************************************************************
     9.8  ** ui.h extension file, included from the uic-generated form implementation.
     9.9  **
    9.10 @@ -9,22 +12,22 @@
    9.11  
    9.12  
    9.13  extern Settings settings;
    9.14 +extern QDir vymBaseDir;
    9.15 +extern Options options;
    9.16  
    9.17  void ExportXHTMLDialog::init()
    9.18  {
    9.19 -	dia=new ShowTextDialog ();
    9.20 -	xsltprocessor="xsltproc";
    9.21  	filepath="";
    9.22  	settingsChanged=false;
    9.23 +	scriptProc=new Process;
    9.24  }
    9.25  
    9.26  void ExportXHTMLDialog::readSettings()
    9.27  {
    9.28  
    9.29 -	dir=settings.readLocalEntry (filepath,"/vym/export/xhtml/exportDir","./" );
    9.30 +	dir=settings.readLocalEntry (filepath,"/vym/export/xhtml/exportDir",vymBaseDir.currentDirPath() );
    9.31  	lineEditDir->setText(dir);
    9.32  	
    9.33 -	
    9.34      if ( settings.readLocalEntry (filepath,"/vym/export/xhtml/useImage","yes")=="yes")
    9.35  		useImage=true;
    9.36  	else	
    9.37 @@ -63,12 +66,19 @@
    9.38  		showOutput=false;
    9.39  	outputButton->setChecked(showOutput);
    9.40  
    9.41 -	xsl=settings.readLocalEntry 
    9.42 -		(filepath,"/vym/export/xhtml/xsl","/usr/share/vym/styles/vym2xhtml.xsl");
    9.43 +	// For testing better use local styles
    9.44 +	if (options.isOn ("local"))
    9.45 +	{
    9.46 +		xsl=vymBaseDir.path()+"/styles/vym2xhtml.xsl";
    9.47 +		css=vymBaseDir.path()+"/styles/vym.css";
    9.48 +	} else
    9.49 +	{
    9.50 +		xsl=settings.readLocalEntry 
    9.51 +			(filepath,"/vym/export/xhtml/xsl","/usr/share/vym/styles/vym2xhtml.xsl");
    9.52 +		css=settings.readLocalEntry 
    9.53 +			(filepath,"/vym/export/xhtml/css","/usr/share/vym/styles/vym.css");	
    9.54 +	}
    9.55  	lineEditXSL->setText(xsl);
    9.56 -	
    9.57 -	css=settings.readLocalEntry 
    9.58 -		(filepath,"/vym/export/xhtml/css","/usr/share/vym/styles/vym.css");	
    9.59  	lineEditCSS->setText(css);
    9.60  	
    9.61  	prescript=settings.readLocalEntry
    9.62 @@ -83,17 +93,16 @@
    9.63  	{
    9.64  		QMessageBox::warning( 0, tr( "Warning" ),tr(
    9.65  		"The settings saved in the map "
    9.66 -		"would like to run scripts:\n\n") +
    9.67 -		prescript +"  "+postscript +"\n\n"+
    9.68 -		tr("Please check, if you really\n"
    9.69 -		"want to allow this in your system!"));
    9.70 +		"would like to run scripts:\n\n"
    9.71 +		"%1\n\n"
    9.72 +		"Please check, if you really\n"
    9.73 +		"want to allow this in your system!").arg(prescript+"  "+postscript));
    9.74  		
    9.75  	}
    9.76  }
    9.77  
    9.78  void ExportXHTMLDialog::destroy()
    9.79  {
    9.80 -	delete (dia);
    9.81  }
    9.82  
    9.83  void ExportXHTMLDialog::dirChanged()
    9.84 @@ -106,8 +115,8 @@
    9.85  
    9.86  void ExportXHTMLDialog::browseDirectoryPressed()
    9.87  {
    9.88 -   	QFileDialog fd( this, tr("VYM - Export HTML to directory"));
    9.89 -	fd.setMode (QFileDialog::DirectoryOnly);
    9.90 +   	Q3FileDialog fd( this, tr("VYM - Export HTML to directory"));
    9.91 +	fd.setMode (Q3FileDialog::DirectoryOnly);
    9.92  	fd.setCaption(tr("VYM - Export HTML to directory"));
    9.93  	fd.setModal (true);
    9.94  	fd.show();
    9.95 @@ -159,7 +168,7 @@
    9.96  
    9.97  void ExportXHTMLDialog::browseCSSPressed()
    9.98  {
    9.99 -   	QFileDialog fd( this, tr("VYM - Path to CSS file"));
   9.100 +   	Q3FileDialog fd( this, tr("VYM - Path to CSS file"));
   9.101  	fd.setModal (true);
   9.102  	fd.addFilter ("Cascading Stylesheet (*.css)");
   9.103  	fd.show();
   9.104 @@ -186,9 +195,9 @@
   9.105  
   9.106  void ExportXHTMLDialog::browseXSLPressed()
   9.107  {
   9.108 -   	QFileDialog fd( this, tr("VYM - Path to XSL file"));
   9.109 +   	Q3FileDialog fd( this, tr("VYM - Path to XSL file"));
   9.110  	fd.setModal (true);
   9.111 -	fd.addFilter ("Extensible Styleshee Language (*.xsl)");
   9.112 +	fd.addFilter ("Extensible Stylesheet Language (*.xsl)");
   9.113  	fd.show();
   9.114  
   9.115  	if ( fd.exec() == QDialog::Accepted )
   9.116 @@ -207,7 +216,7 @@
   9.117  
   9.118  void ExportXHTMLDialog::browsePreExportButtonPressed()
   9.119  {
   9.120 -	QFileDialog fd( this, tr("VYM - Path to pre export script"));
   9.121 +	Q3FileDialog fd( this, tr("VYM - Path to pre export script"));
   9.122  	fd.setModal (true);
   9.123  	fd.addFilter ("Scripts (*.sh *.pl *.py *.php)");
   9.124  	fd.show();
   9.125 @@ -223,7 +232,7 @@
   9.126  
   9.127  void ExportXHTMLDialog::browsePostExportButtonPressed()
   9.128  {
   9.129 -	QFileDialog fd( this, tr("VYM - Path to post export script"));
   9.130 +	Q3FileDialog fd( this, tr("VYM - Path to post export script"));
   9.131  	fd.setModal (true);
   9.132  	fd.addFilter ("Scripts (*.sh *.pl *.py *.php)");
   9.133  	fd.show();
   9.134 @@ -243,7 +252,6 @@
   9.135  	// (but don't save at destructor, which
   9.136  	// is called for "cancel", too)
   9.137  	settings.setLocalEntry (filepath,"/vym/export/xhtml/exportDir",dir);
   9.138 -
   9.139  	settings.setLocalEntry (filepath,"/vym/export/xhtml/prescript",prescript);
   9.140  	settings.setLocalEntry (filepath,"/vym/export/xhtml/postscript",postscript);
   9.141  
   9.142 @@ -266,19 +274,25 @@
   9.143  		settings.writeEntry ("/vym/export/xhtml/showOutput","yes");
   9.144  	else
   9.145  		settings.writeEntry ("/vym/export/xhtml/showOutput","no");	
   9.146 -		
   9.147 -	settings.setLocalEntry 
   9.148 -		(filepath,"/vym/export/xhtml/xsl",xsl);
   9.149 -	settings.setLocalEntry 
   9.150 -		(filepath,"/vym/export/xhtml/css",css);	
   9.151  
   9.152 -	//FIXME add option for url image (globe flag) here	
   9.153 -	if (true) 
   9.154 -	{	
   9.155 -		QPixmap pm (flag_url_xpm);
   9.156 -		pm.save (dir + "/flags/url.png","PNG");
   9.157 +	QString ipath;	
   9.158 +	ipath=vymBaseDir.path()+"/flags/flag-url-16x16.png";
   9.159 +	if (!options.isOn ("local"))
   9.160 +	{
   9.161 +		settings.setLocalEntry 
   9.162 +			(filepath,"/vym/export/xhtml/xsl",xsl);
   9.163 +		settings.setLocalEntry 
   9.164 +			(filepath,"/vym/export/xhtml/css",css);	
   9.165  	}
   9.166  
   9.167 +	// Provide a smaller URL-icon to improve Layout
   9.168 +	QPixmap pm;
   9.169 +	if (!pm.load(ipath,"PNG") )
   9.170 +		QMessageBox::warning( 0, tr( "Warning" ),tr("Could not open %1").arg(ipath));
   9.171 +		
   9.172 +		
   9.173 +	if(!pm.save (dir + "flags/flag-url-16x16.png","PNG"))
   9.174 +		QMessageBox::warning( 0, tr( "Warning" ),tr("Could not write %1").arg(ipath));
   9.175  	if (!saveSettingsInMap)
   9.176  		settings.clearLocal("/vym/export/xhtml");
   9.177  	else	
   9.178 @@ -288,12 +302,12 @@
   9.179  	// Copy CSS file
   9.180  	QFile css_src (css);
   9.181  	QFile css_dst (dir+"vym.css");
   9.182 -	if (!css_src.open ( IO_ReadOnly))
   9.183 -		QMessageBox::warning( 0, tr( "Warning" ),css +tr(" could not be opened!"));
   9.184 +	if (!css_src.open ( QIODevice::ReadOnly))
   9.185 +		QMessageBox::warning( 0, tr( "Warning" ),tr("Could not open %1").arg(css));
   9.186  	else
   9.187  	{
   9.188 -		if (!css_dst.open( IO_WriteOnly))
   9.189 -			QMessageBox::warning( 0, tr( "Warning" ), dir+"vym.css" +tr(" could not be opened!"));
   9.190 +		if (!css_dst.open( QIODevice::WriteOnly))
   9.191 +			QMessageBox::warning( 0, tr( "Warning" ), tr("Could not open %1").arg(dir+"vym.css"));
   9.192  		else
   9.193  		{	
   9.194  		
   9.195 @@ -308,52 +322,19 @@
   9.196  
   9.197  	if (!prescript.isEmpty()) runScript (prescript,dir+mapname+".xml");
   9.198  	
   9.199 -	Process *xsltProc=new Process ();
   9.200 -	xsltProc->clearArguments();
   9.201 -	xsltProc->addArgument (xsltprocessor);	
   9.202  	if (useImage)
   9.203 -	{
   9.204 -		xsltProc->addArgument ("--stringparam");
   9.205 -		xsltProc->addArgument ("imagemap");
   9.206 -		xsltProc->addArgument ("images/"+mapname+".png");
   9.207 -	}	
   9.208 +		p.addStringParam ("imagemap","images/"+mapname+".png");
   9.209  	if (useTextColor)
   9.210 -	{
   9.211 -		xsltProc->addArgument ("--stringparam");
   9.212 -		xsltProc->addArgument ("use.textcolor");
   9.213 -		xsltProc->addArgument ("1");
   9.214 -	}	
   9.215 -	xsltProc->addArgument ("--stringparam");
   9.216 -	xsltProc->addArgument ("mapname");
   9.217 -	xsltProc->addArgument (mapname+".vym");
   9.218 +		p.addStringParam ("use.textcolor","1");
   9.219 +	p.addStringParam ("mapname",mapname+".vym");
   9.220  	
   9.221 -	xsltProc->addArgument ("--output");
   9.222 -	xsltProc->addArgument (dir+mapname+".html");
   9.223 -	xsltProc->addArgument (xsl);
   9.224 -	xsltProc->addArgument (dir+mapname+".xml");
   9.225 -	dia->append ("vym is executing: \n" + xsltProc->arguments().join(" ") );	
   9.226 -	if (!xsltProc->start() )
   9.227 -	{
   9.228 -		QMessageBox::critical( 0, tr( "Critical Error" ),
   9.229 -					   tr("Couldn't start ") + xsltprocessor );
   9.230 -	} else
   9.231 -	{
   9.232 -		xsltProc->waitFinished();
   9.233 -		if (!xsltProc->normalExit() )
   9.234 -			QMessageBox::critical( 0, tr( "Critical Error" ),
   9.235 -			   xsltprocessor +" " +tr("didn't exit normally") +
   9.236 -			   xsltProc->getErrout() );
   9.237 -		else
   9.238 -			if (xsltProc->exitStatus()>0) showOutput=true;
   9.239 -			
   9.240 -	}	
   9.241 -	dia->append ("\n");
   9.242 -	dia->append (xsltProc->getErrout());
   9.243 -	dia->append (xsltProc->getStdout());
   9.244 -	
   9.245 +	p.setOutputFile (dir+mapname+".html");
   9.246 +	p.setInputFile (dir+mapname+".xml");
   9.247 +	p.setXSLFile (xsl);
   9.248 +	p.process();
   9.249 +
   9.250  	if (!postscript.isEmpty()) runScript (postscript,dir+mapname+".html");
   9.251  
   9.252 -	if (showOutput) dia->exec();
   9.253  }
   9.254  
   9.255  void ExportXHTMLDialog::setFilePath(const QString &s)
   9.256 @@ -387,26 +368,25 @@
   9.257  	spath.replace ("%f",fpath);
   9.258  	QStringList args=QStringList::split (' ',spath,false);
   9.259  		
   9.260 -	Process *scriptProc=new Process ();
   9.261  	scriptProc->clearArguments();
   9.262  	scriptProc->setArguments (args);	
   9.263 -	dia->append ("vym is executing: \n" + scriptProc->arguments().join(" ") );	
   9.264 +	p.addOutput ("vym is executing: \n" + scriptProc->arguments().join(" ") );	
   9.265  	if (!scriptProc->start() )
   9.266  	{
   9.267  		QMessageBox::critical( 0, tr( "Critical Error" ),
   9.268 -					   tr("Couldn't start ") + spath );
   9.269 +					   tr("Could not start %1").arg(spath) );
   9.270  	} else
   9.271  	{
   9.272  		scriptProc->waitFinished();
   9.273  		if (!scriptProc->normalExit() )
   9.274  			QMessageBox::critical( 0, tr( "Critical Error" ),
   9.275 -			   spath +" " +tr("didn't exit normally") +
   9.276 +			   tr("%1 didn't exit normally").arg(spath) +
   9.277  			   scriptProc->getErrout() );
   9.278  		else
   9.279  			if (scriptProc->exitStatus()>0) showOutput=true;
   9.280  			
   9.281  	}	
   9.282 -	dia->append ("\n");
   9.283 -	dia->append (scriptProc->getErrout());
   9.284 -	dia->append (scriptProc->getStdout());
   9.285 +	p.addOutput ("\n");
   9.286 +	p.addOutput (scriptProc->getErrout());
   9.287 +	p.addOutput (scriptProc->getStdout());
   9.288  }
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/file.cpp	Tue Jun 06 14:58:11 2006 +0000
    10.3 @@ -0,0 +1,305 @@
    10.4 +#include <qobject.h>
    10.5 +#include <qmessagebox.h>
    10.6 +//Added by qt3to4:
    10.7 +#include <QPixmap>
    10.8 +#include <QLabel>
    10.9 +#include <QTextStream>
   10.10 +#include <iostream>
   10.11 +
   10.12 +#include "file.h"
   10.13 +#include "process.h"
   10.14 +
   10.15 +
   10.16 +QString maskPath(QString p)
   10.17 +{
   10.18 +	// Change " " to "\ " to enable blanks in filenames
   10.19 +	p=p.replace(QChar('&'),"\\&");
   10.20 +	return p.replace(QChar(' '),"\\ ");
   10.21 +}
   10.22 +
   10.23 +QString convertToRel (const QString &src, const QString &dst)
   10.24 +{
   10.25 +	QString s=src;
   10.26 +	QString d=dst;
   10.27 +	int i;
   10.28 +
   10.29 +	if (s==d) 
   10.30 +	{
   10.31 +		// Special case, we just need the name of the file,
   10.32 +		// not the complete path
   10.33 +		i=d.findRev ("/");
   10.34 +		d=d.right (d.length()-i-1);
   10.35 +	} else
   10.36 +	{
   10.37 +		// Find relative path from src to dst
   10.38 +
   10.39 +		// Remove the first "/"
   10.40 +		if (s.section ("/",0,0).isEmpty()) 
   10.41 +		{
   10.42 +			s=s.right (s.length()-1);
   10.43 +			d=d.right (d.length()-1);
   10.44 +		}
   10.45 +		
   10.46 +		// remove identical left parts
   10.47 +		while (s.section("/",0,0) == d.section("/",0,0) ) 
   10.48 +		{
   10.49 +			i=s.find ("/");
   10.50 +			s=s.right (s.length()-i-1);
   10.51 +			d=d.right (d.length()-i-1);
   10.52 +		}
   10.53 +
   10.54 +		// Now take care of paths where we have to go back first
   10.55 +		int srcsep=s.count("/");
   10.56 +		int dstsep=d.count("/");
   10.57 +		if (srcsep <=  dstsep )
   10.58 +		{
   10.59 +			// find path to go up first and then back to dst
   10.60 +			i=1;
   10.61 +			while (i<=srcsep) 
   10.62 +			{
   10.63 +				d="../"+d;
   10.64 +				i++;
   10.65 +			}	
   10.66 +		}
   10.67 +	}	
   10.68 +	return d;
   10.69 +}
   10.70 +
   10.71 +QString makeUniqueDir (QString s)
   10.72 +{
   10.73 +	// Create unique directory e.g. s="/tmp/vym-XXXXXX"
   10.74 +
   10.75 +	// Convert QString to string first
   10.76 +	char *p;
   10.77 +	int bytes=s.length();
   10.78 +	p=(char*) malloc (bytes+1);
   10.79 +	int i;
   10.80 +	for (i=0;i<bytes;i++)
   10.81 +		p[i]=s.at(i).latin1();
   10.82 +	p[bytes]=0;	
   10.83 +	QString r=mkdtemp (p);
   10.84 +	free (p);
   10.85 +	return r;
   10.86 +}
   10.87 +
   10.88 +void removeDir(QDir d)
   10.89 +{
   10.90 +	if (d.path().left(4)!="/tmp")
   10.91 +	{
   10.92 +		// This _should_ not be necessary, but proved to be useful ;-)
   10.93 +		qWarning ("file.cpp::removeDir should remove "+d.path()+" - aborted.");
   10.94 +		return;
   10.95 +	}
   10.96 +
   10.97 +	// Traverse directories
   10.98 +	d.setFilter( QDir::Dirs| QDir::Hidden | QDir::NoSymLinks );
   10.99 +	QFileInfoList list = d.entryInfoList();
  10.100 +	QFileInfo fi;
  10.101 +
  10.102 +	for (int i = 0; i < list.size(); ++i) 
  10.103 +	{
  10.104 +		fi=list.at(i);
  10.105 +		if (fi.fileName() != "." && fi.fileName() != ".." )
  10.106 +		{
  10.107 +			if ( !d.cd(fi.fileName()) ) 
  10.108 +				qWarning ("removeDir() cannot find the directory "+fi.fileName());
  10.109 +			else 
  10.110 +			{
  10.111 +				// Recursively remove subdirs
  10.112 +				removeDir (d);
  10.113 +				d.cdUp();
  10.114 +			}
  10.115 +		}	
  10.116 +	}
  10.117 +
  10.118 +	// Traverse files
  10.119 +	d.setFilter( QDir::Files| QDir::Hidden | QDir::NoSymLinks );
  10.120 +	list = d.entryInfoList();
  10.121 +
  10.122 +	for (int i = 0; i < list.size(); ++i) 
  10.123 +	{
  10.124 +		fi=list.at(i);
  10.125 +		QFile (fi.filePath()).remove(); 
  10.126 +	}	
  10.127 +
  10.128 +	if (!d.rmdir(d.path()))
  10.129 +		qWarning ("removeDir("+d.path()+") failed!");
  10.130 +}		
  10.131 +
  10.132 +void makeSubDirs (const QString &s)
  10.133 +{
  10.134 +	QDir d(s);
  10.135 +	d.mkdir(s);
  10.136 +	d.mkdir ("images");	
  10.137 +	d.mkdir ("flags");	
  10.138 +}
  10.139 +
  10.140 +ErrorCode zipDir (const QDir &zipDir, const QString &zipName)
  10.141 +{
  10.142 +	ErrorCode err=success;
  10.143 +	
  10.144 +	// zip the temporary directory
  10.145 +	Process *zipProc=new Process ();
  10.146 +	zipProc->clearArguments();
  10.147 +	zipProc->setWorkingDirectory (QDir(zipDir));
  10.148 +	zipProc->addArgument ("zip");
  10.149 +	zipProc->addArgument ("-r");
  10.150 +	zipProc->addArgument (zipName);
  10.151 +	zipProc->addArgument (".");
  10.152 +
  10.153 +	if (!zipProc->start() )
  10.154 +	{	
  10.155 +		// zip could not be started
  10.156 +		QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
  10.157 +					   QObject::tr("Couldn't start zip to compress data."));
  10.158 +		err=aborted;
  10.159 +	} else
  10.160 +	{
  10.161 +		// zip could be started
  10.162 +		zipProc->waitFinished();
  10.163 +		if (!zipProc->normalExit() )
  10.164 +		{
  10.165 +			QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
  10.166 +						   QObject::tr("zip didn't exit normally")+
  10.167 +						   "\n" + zipProc->getErrout());
  10.168 +			err=aborted;
  10.169 +		} else
  10.170 +		{
  10.171 +			if (zipProc->exitStatus()>0)
  10.172 +			{
  10.173 +				QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
  10.174 +						   QString("zip exit code:  %1").arg(zipProc->exitStatus() )+
  10.175 +						   "\n" + zipProc->getErrout() );
  10.176 +				err=aborted;
  10.177 +			}
  10.178 +		}
  10.179 +	}	// zip could be started
  10.180 +	return err;	
  10.181 +}
  10.182 +
  10.183 +ErrorCode unzipDir (const QDir &zipDir, const QString &zipName)
  10.184 +{
  10.185 +	ErrorCode err=success;
  10.186 +
  10.187 +	// Try to unzip file
  10.188 +	Process *zipProc=new Process ();
  10.189 +	zipProc->clearArguments();
  10.190 +	zipProc->setWorkingDirectory (zipDir);
  10.191 +	zipProc->addArgument ("unzip");
  10.192 +	zipProc->addArgument ("-o");	// overwrite existing files!
  10.193 +	zipProc->addArgument (zipName );
  10.194 +	zipProc->addArgument ("-d");
  10.195 +	zipProc->addArgument (zipDir.path());
  10.196 +
  10.197 +	if (!zipProc->start() )
  10.198 +	{
  10.199 +		QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
  10.200 +					   QObject::tr("Couldn't start unzip to decompress data."));
  10.201 +		err=aborted;
  10.202 +		
  10.203 +	} else
  10.204 +	{
  10.205 +		zipProc->waitFinished();
  10.206 +		if (!zipProc->normalExit() )
  10.207 +		{
  10.208 +			QMessageBox::critical( 0,QObject::tr( "Critical Error" ),
  10.209 +						   QObject::tr("unzip didn't exit normally") +
  10.210 +						   zipProc->getErrout() );
  10.211 +			err=aborted;
  10.212 +		} else
  10.213 +		{
  10.214 +			if (zipProc->exitStatus()>0)
  10.215 +			{
  10.216 +				if (zipProc->exitStatus()==9)
  10.217 +					// no zipped file, but maybe .xml or old version? Try again.
  10.218 +					err=nozip;
  10.219 +				else	
  10.220 +				{
  10.221 +					QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
  10.222 +								   QString("unzip exit code:  %1").arg(zipProc->exitStatus() ) +
  10.223 +								   zipProc->getErrout() );
  10.224 +					err=aborted;
  10.225 +				}
  10.226 +			} 
  10.227 +		}
  10.228 +	}
  10.229 +	return err;	
  10.230 +}
  10.231 +
  10.232 +bool loadStringFromDisk (const QString &fname, QString &s)
  10.233 +{
  10.234 +	s="";
  10.235 +	QFile file ( fname);
  10.236 +	if ( !file.open( QIODevice::ReadOnly ) ) return false;
  10.237 +
  10.238 +	QTextStream ts( &file );
  10.239 +	ts.setEncoding (QTextStream::UnicodeUTF8);
  10.240 +	while ( !ts.atEnd() ) 
  10.241 +		s+=ts.readLine()+"\n"; 
  10.242 +	file.close();
  10.243 +	return true;
  10.244 +}
  10.245 +
  10.246 +bool saveStringToDisk (const QString &fname, const QString &s)
  10.247 +{
  10.248 +	QFile file( fname);
  10.249 +
  10.250 +	file.setName ( fname);
  10.251 +	if ( !file.open( QIODevice::WriteOnly ) ) 
  10.252 +	{
  10.253 +		file.close();
  10.254 +		return false;
  10.255 +	}	
  10.256 +
  10.257 +	// Write it finally, and write in UTF8, no matter what 
  10.258 +	QTextStream ts( &file );
  10.259 +	ts.setEncoding (QTextStream::UnicodeUTF8);
  10.260 +	ts << s;
  10.261 +	file.close();
  10.262 +	return true;
  10.263 +}
  10.264 +
  10.265 +
  10.266 +ImagePreview::ImagePreview (QWidget *par=0): QLabel (par)
  10.267 +{
  10.268 +	fdia=(Q3FileDialog*)par;
  10.269 +}
  10.270 +
  10.271 +void ImagePreview::previewUrl( const Q3Url &u )
  10.272 +{
  10.273 +    QString path = u.path();
  10.274 +    QPixmap pix( path );
  10.275 +    if ( pix.isNull() )
  10.276 +	{
  10.277 +		// Strange: If we have fd->setMode (QFileDialog::ExistingFiles)
  10.278 +		// in the filedialog, then there are 3 calls to previewURL 
  10.279 +		// for each selection. And only the first is the actual selected file
  10.280 +		// while the following 2 point to the directory above the current one.
  10.281 +		// So here's my workaround:
  10.282 +		
  10.283 +		if (fdia && fdia->selectedFiles().count()==0)
  10.284 +			setText( QObject::tr("This is not an image.") );
  10.285 +		if (fdia &&fdia->selectedFiles().count()>1)
  10.286 +			setText( QObject::tr("Sorry, no preview for\nmultiple selected files.") );
  10.287 +	}	
  10.288 +    else
  10.289 +	{
  10.290 +		float max_w=300;
  10.291 +		float max_h=300;
  10.292 +		float r;
  10.293 +		if (pix.width()>max_w)
  10.294 +		{
  10.295 +			r=max_w / pix.width();
  10.296 +			pix.resize(qRound(pix.width()*r), qRound(pix.height()*r));
  10.297 +			// FIXME not a resize, but a shrink/enlarge is needed here...
  10.298 +		}
  10.299 +		if (pix.height()>max_h)
  10.300 +		{
  10.301 +			r=max_h / pix.height();
  10.302 +			pix.resize(qRound(pix.width()*r), qRound(pix.height()*r));
  10.303 +			// FIXME not a resize, but a shrink/enlarge is needed here...
  10.304 +		}
  10.305 +        setPixmap( pix );
  10.306 +	}	
  10.307 +}
  10.308 +
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/file.h	Tue Jun 06 14:58:11 2006 +0000
    11.3 @@ -0,0 +1,36 @@
    11.4 +#ifndef FILE_H
    11.5 +#define FILE_H
    11.6 +
    11.7 +#include <qdir.h>
    11.8 +
    11.9 +enum LoadMode {NewMap,ImportAdd,ImportReplace};
   11.10 +enum SaveMode {PartOfMap,CompleteMap,UndoCommand};
   11.11 +enum ErrorCode {success,aborted,nozip};
   11.12 +
   11.13 +
   11.14 +/////////////////////////////////////////////////////////////////////////////
   11.15 +QString maskPath (QString );
   11.16 +QString convertToRel (const QString &,const QString &);
   11.17 +QString makeUniqueDir (QString);
   11.18 +void removeDir(QDir);
   11.19 +void makeSubDirs (const QString &);
   11.20 +ErrorCode zipDir (const QDir &,const QString&);
   11.21 +ErrorCode unzipDir (const QDir &,const QString&);
   11.22 +bool loadStringFromDisk (const QString &, QString &);
   11.23 +bool saveStringToDisk (const QString &, const QString &s);
   11.24 +
   11.25 +/////////////////////////////////////////////////////////////////////////////
   11.26 +#include <qlabel.h>
   11.27 +#include <q3filedialog.h>
   11.28 +#include <qpixmap.h>
   11.29 +
   11.30 +class ImagePreview : public QLabel, public Q3FilePreview
   11.31 +{
   11.32 +public:
   11.33 +    ImagePreview( QWidget * );
   11.34 +    void previewUrl( const Q3Url & );
   11.35 +protected:
   11.36 +	Q3FileDialog *fdia;
   11.37 +};
   11.38 +
   11.39 +#endif
    12.1 --- a/findwindow.cpp	Sun Jan 30 12:58:47 2005 +0000
    12.2 +++ b/findwindow.cpp	Tue Jun 06 14:58:11 2006 +0000
    12.3 @@ -1,21 +1,26 @@
    12.4  #include <qlineedit.h>
    12.5 +//Added by qt3to4:
    12.6 +#include <Q3HBoxLayout>
    12.7 +#include <Q3VBoxLayout>
    12.8 +#include <QLabel>
    12.9  
   12.10  #include "findwindow.h"
   12.11 +#include "version.h"
   12.12  
   12.13  
   12.14 -FindWindow::FindWindow(QWidget* parent, const char* name, WFlags f) 
   12.15 -	: QGroupBox( 0, Horizontal, "Find", parent, name )
   12.16 +FindWindow::FindWindow(QWidget* parent, const char* name) 
   12.17 +	: Q3GroupBox( 0, Qt::Horizontal, "Find", parent, name )
   12.18  
   12.19  {
   12.20 -	setCaption ("VYM - Find Text");
   12.21 +	setCaption (__VYM " - " +tr("Find Text"));
   12.22  	//resize (180,130);
   12.23  	move (130,130);
   12.24  
   12.25 -	setMargin( 100 );
   12.26 +	//FIXME not avail in QT4 setMargin( 100 );
   12.27  
   12.28 -    QVBoxLayout* box = new QVBoxLayout( layout() );
   12.29 +    Q3VBoxLayout* box = new Q3VBoxLayout( layout() );
   12.30      
   12.31 -    QHBoxLayout *row1 = new QHBoxLayout( box );
   12.32 +    Q3HBoxLayout *row1 = new Q3HBoxLayout( box );
   12.33      row1->setMargin( 10 );
   12.34  
   12.35      // Create a Label
   12.36 @@ -23,7 +28,7 @@
   12.37      row1->addWidget( label );
   12.38  
   12.39  	// Create LineEdit (here QComboBox)
   12.40 -    QHBoxLayout *row2 = new QHBoxLayout( box );
   12.41 +    Q3HBoxLayout *row2 = new Q3HBoxLayout( box );
   12.42      row2->setMargin( 10 );
   12.43      findcombo = new QComboBox( true, this );
   12.44  	findcombo->setMinimumWidth(150);
   12.45 @@ -35,7 +40,7 @@
   12.46      //findcombo->insertItem( "Normal", -1 );
   12.47  
   12.48  	// Create Buttons
   12.49 -    QHBoxLayout *row3 = new QHBoxLayout( box );
   12.50 +    Q3HBoxLayout *row3 = new Q3HBoxLayout( box );
   12.51      row3->setMargin( 10 );
   12.52  	clearbutton = new QPushButton (tr("Clear"),this);
   12.53  	connect ( clearbutton, SIGNAL( clicked() ), 
   12.54 @@ -46,7 +51,7 @@
   12.55  	row3->addItem(si1);
   12.56  	
   12.57  	cancelbutton = new QPushButton (tr("Cancel"),this);
   12.58 -	cancelbutton->setAccel (Key_Escape);
   12.59 +	cancelbutton->setAccel (Qt::Key_Escape);
   12.60  	connect ( cancelbutton, SIGNAL( clicked() ), 
   12.61  		this, SLOT( cancelPressed() ) );
   12.62  	row3->addWidget (cancelbutton);
    13.1 --- a/findwindow.h	Sun Jan 30 12:58:47 2005 +0000
    13.2 +++ b/findwindow.h	Tue Jun 06 14:58:11 2006 +0000
    13.3 @@ -1,20 +1,20 @@
    13.4  #ifndef FINDWINDOW_H 
    13.5  #define FINDWINDOW_H
    13.6  
    13.7 -#include <qmainwindow.h>
    13.8 +#include <q3mainwindow.h>
    13.9  #include <qcombobox.h>
   13.10  #include <qpushbutton.h>
   13.11 -#include <qgroupbox.h>
   13.12 +#include <q3groupbox.h>
   13.13  #include <qlayout.h>
   13.14  #include <qlabel.h>
   13.15  
   13.16  
   13.17 -class FindWindow : public QGroupBox
   13.18 +class FindWindow : public Q3GroupBox
   13.19  {
   13.20  	Q_OBJECT
   13.21  
   13.22  public:
   13.23 -	FindWindow (QWidget* parent=0, const char* namme=0, WFlags f=0);
   13.24 +	FindWindow (QWidget* parent=0, const char* namme=0);
   13.25  
   13.26  public slots:	
   13.27  	void popup();
   13.28 @@ -27,7 +27,7 @@
   13.29  	void somethingChanged();	// emit to mainwindow
   13.30  
   13.31  private:
   13.32 -	QGroupBox *findbox;
   13.33 +	Q3GroupBox *findbox;
   13.34  	QComboBox *findcombo;
   13.35  	QPushButton *clearbutton;
   13.36  	QPushButton *findbutton;
    14.1 --- a/flagobj.cpp	Sun Jan 30 12:58:47 2005 +0000
    14.2 +++ b/flagobj.cpp	Tue Jun 06 14:58:11 2006 +0000
    14.3 @@ -1,17 +1,19 @@
    14.4  #include "flagobj.h"
    14.5 +//Added by qt3to4:
    14.6 +#include <QPixmap>
    14.7  
    14.8  /////////////////////////////////////////////////////////////////
    14.9  // FlagObj
   14.10  /////////////////////////////////////////////////////////////////
   14.11  FlagObj::FlagObj()
   14.12  {
   14.13 -//    cout << "Const FlagObj ()\n";
   14.14 +//	cout << "Const FlagObj ()\n";
   14.15      init ();
   14.16  }
   14.17  
   14.18 -FlagObj::FlagObj(QCanvas* c):MapObj(c) 
   14.19 +FlagObj::FlagObj(Q3Canvas* c):MapObj(c) 
   14.20  {
   14.21 -//    cout << "Const FlagObj\n";
   14.22 +//	cout << "Const FlagObj  canvas="<<c<<endl;
   14.23      init ();
   14.24  }
   14.25  
   14.26 @@ -23,13 +25,14 @@
   14.27  FlagObj::~FlagObj()
   14.28  {
   14.29  //    cout << "Destr FlagObj  " << name << "\n";
   14.30 -	delete (icon);
   14.31 +	if (icon) delete (icon);
   14.32  }
   14.33  
   14.34  
   14.35  void FlagObj::init ()
   14.36  {
   14.37  	name="undefined";
   14.38 +	group="undefined";
   14.39  
   14.40  	icon=new ImageObj (canvas);
   14.41  	icon->move (absPos.x(), absPos.y() );
   14.42 @@ -41,6 +44,7 @@
   14.43  {
   14.44      MapObj::copy(other);
   14.45  	name=other->name;
   14.46 +	group=other->group;
   14.47  	tooltip=other->tooltip;
   14.48  	state=other->state;
   14.49  	icon->copy(other->icon);
   14.50 @@ -95,6 +99,16 @@
   14.51  	return name;
   14.52  }
   14.53  
   14.54 +void FlagObj::setGroup (const QString &n)
   14.55 +{
   14.56 +	group=n;
   14.57 +}
   14.58 +
   14.59 +const QString FlagObj::getGroup()
   14.60 +{
   14.61 +	return group;
   14.62 +}
   14.63 +
   14.64  void FlagObj::setToolTip(const QString &n)
   14.65  {
   14.66  	tooltip=n;
   14.67 @@ -182,8 +196,8 @@
   14.68  
   14.69  void FlagObj::positionBBox()
   14.70  {
   14.71 -    bbox.setX (absPos.x() );
   14.72 -    bbox.setY (absPos.y() );
   14.73 +    bbox.moveTopLeft (absPos );
   14.74 +    clickBox.moveTopLeft (absPos );
   14.75  }
   14.76  
   14.77  void FlagObj::calcBBoxSize()
   14.78 @@ -197,5 +211,6 @@
   14.79  	{
   14.80  		bbox.setSize (QSize(0,0));
   14.81  	}
   14.82 +	clickBox.setSize (bbox.size());
   14.83  }
   14.84  
    15.1 --- a/flagobj.h	Sun Jan 30 12:58:47 2005 +0000
    15.2 +++ b/flagobj.h	Tue Jun 06 14:58:11 2006 +0000
    15.3 @@ -2,8 +2,10 @@
    15.4  #define FLAGOBJ_H
    15.5  
    15.6  
    15.7 -#include <qcanvas.h>
    15.8 +#include <q3canvas.h>
    15.9  #include <qaction.h>
   15.10 +//Added by qt3to4:
   15.11 +#include <QPixmap>
   15.12  
   15.13  #include "mapobj.h"
   15.14  #include "imageobj.h"
   15.15 @@ -12,7 +14,7 @@
   15.16  class FlagObj:public MapObj {
   15.17  public:
   15.18      FlagObj ();
   15.19 -    FlagObj (QCanvas*);
   15.20 +    FlagObj (Q3Canvas*);
   15.21      FlagObj (FlagObj*);
   15.22      ~FlagObj ();
   15.23      virtual void init ();
   15.24 @@ -24,6 +26,8 @@
   15.25  	void load (const QPixmap&);
   15.26  	void setName (const QString&);
   15.27  	const QString getName ();
   15.28 +	void setGroup (const QString&);
   15.29 +	const QString getGroup();
   15.30  	void setToolTip(const QString&);
   15.31  	const QString getToolTip();
   15.32  	void setButton (QAction*);
   15.33 @@ -40,6 +44,7 @@
   15.34  	
   15.35  protected:	
   15.36  	QString name;
   15.37 +	QString group;
   15.38  	QString tooltip;
   15.39  	bool state;
   15.40  	bool used;
    16.1 --- a/flagrowobj.cpp	Sun Jan 30 12:58:47 2005 +0000
    16.2 +++ b/flagrowobj.cpp	Tue Jun 06 14:58:11 2006 +0000
    16.3 @@ -5,11 +5,11 @@
    16.4  /////////////////////////////////////////////////////////////////
    16.5  FlagRowObj::FlagRowObj()
    16.6  {
    16.7 -    cout << "Const FlagRowObj ()\n";
    16.8 +//    cout << "Const FlagRowObj ()\n";
    16.9      init ();
   16.10  }
   16.11  
   16.12 -FlagRowObj::FlagRowObj(QCanvas* c):MapObj(c) 
   16.13 +FlagRowObj::FlagRowObj(Q3Canvas* c):MapObj(c) 
   16.14  {
   16.15  //    cout << "Const FlagRowObj\n";
   16.16      init ();
   16.17 @@ -25,6 +25,7 @@
   16.18  {
   16.19      flag.setAutoDelete (true);
   16.20  	parentRow=NULL;
   16.21 +	showFlags=true;
   16.22  }
   16.23  
   16.24  void FlagRowObj::copy (FlagRowObj* other)
   16.25 @@ -86,8 +87,8 @@
   16.26  
   16.27  void FlagRowObj::positionBBox()
   16.28  {
   16.29 -    bbox.setX (absPos.x() );
   16.30 -    bbox.setY (absPos.y() );
   16.31 +    bbox.moveTopLeft(absPos );
   16.32 +    clickBox.moveTopLeft(absPos );
   16.33  }
   16.34  
   16.35  void FlagRowObj::calcBBoxSize()
   16.36 @@ -104,15 +105,16 @@
   16.37  		if (size.height() > boxsize.height() ) 
   16.38  			boxsize.setHeight(size.height() );
   16.39  	}
   16.40 -	bbox.setSize (QSize(boxsize.width(), boxsize.height() ));
   16.41 +	bbox.setSize (boxsize);
   16.42 +	clickBox.setSize (boxsize);
   16.43  }
   16.44  
   16.45  QString FlagRowObj::getFlagName (const QPoint &p)
   16.46  {
   16.47 -	if (!inBBox (p)) return "";
   16.48 +	if (!inBox (p)) return "";
   16.49  	FlagObj *fo;
   16.50  	for (fo=flag.first();fo; fo=flag.next() )
   16.51 -		if (fo->inBBox (p)) return fo->getName();
   16.52 +		if (fo->inBox (p)) return fo->getName();
   16.53  	return "";	
   16.54  
   16.55  	
   16.56 @@ -121,19 +123,14 @@
   16.57  bool FlagRowObj::isActive (const QString &foname)
   16.58  {
   16.59  	FlagObj *fo=findFlag (foname);
   16.60 -	if (parentRow)
   16.61 -	{
   16.62 -		if (fo)
   16.63 -			return fo->isActive();
   16.64 -		else
   16.65 -			qWarning ("FlagRowObj::isActive of "+name+" couldn't find "+foname);
   16.66 -			
   16.67 -	} else
   16.68 +	if (parentRow && fo)
   16.69 +		return fo->isActive();
   16.70 +	else
   16.71  		if (fo) return true;
   16.72  	return false;
   16.73  }
   16.74  
   16.75 -void FlagRowObj::toggle (const QString &foname)
   16.76 +void FlagRowObj::toggle (const QString &foname, bool exclusive)
   16.77  {
   16.78  	FlagObj *fo=findFlag (foname);
   16.79  	if (fo)
   16.80 @@ -150,6 +147,11 @@
   16.81  		{
   16.82  			fo=addFlag (fo);
   16.83  			fo->activate();
   16.84 +			if (exclusive) 
   16.85 +			{
   16.86 +				deactivateGroup (fo);
   16.87 +				updateToolbar();
   16.88 +			}
   16.89  		} else
   16.90  			qWarning ("FlagRowObj ("+name+")::toggle ("+foname+")  failed - could not find it in parentRow");
   16.91  	}	
   16.92 @@ -159,6 +161,8 @@
   16.93  
   16.94  void FlagRowObj::activate (const QString &foname)
   16.95  {
   16.96 +	// Note: "activate" is also called during loading of a map
   16.97 +	// Here we do not check for exclusive flags!
   16.98  	FlagObj *fo=findFlag (foname);
   16.99  	if (parentRow)
  16.100  	{
  16.101 @@ -171,9 +175,11 @@
  16.102  			{
  16.103  				fo=addFlag (fo);
  16.104  				fo->activate();
  16.105 -				fo->setVisibility (visible);
  16.106 +				if (showFlags) 
  16.107 +					fo->setVisibility (visible);
  16.108 +				else
  16.109 +					fo->setVisibility (false);
  16.110  				calcBBoxSize();
  16.111 -				positionBBox();
  16.112  			} else
  16.113  				qWarning ("FlagRowObj ("+name+")::activate ("+foname+")  failed - could not find it in parentRow");
  16.114  		}	
  16.115 @@ -190,6 +196,7 @@
  16.116  	}
  16.117  }
  16.118  
  16.119 +
  16.120  void FlagRowObj::deactivate (const QString &foname)
  16.121  {
  16.122  	FlagObj *fo=findFlag (foname);
  16.123 @@ -204,13 +211,27 @@
  16.124  	{
  16.125  		FlagObj *fo;
  16.126  		for (fo=flag.first();fo; fo=flag.next() )
  16.127 -		{
  16.128  			fo->deactivate();
  16.129 -		}
  16.130  	} else
  16.131  		qWarning ("FlagRowObj::deactivateAll mustn't be called for ordinary rows");
  16.132  }
  16.133  
  16.134 +void FlagRowObj::deactivateGroup (FlagObj *keepfo)
  16.135 +{
  16.136 +	// deactivate all flags in keepof, but keep keepfo [sic!]
  16.137 +	if (keepfo)
  16.138 +	{
  16.139 +		QString g=keepfo->getGroup();
  16.140 +		if (g!="undefined")
  16.141 +		{
  16.142 +			FlagObj *fo;
  16.143 +			for (fo=flag.first();fo; fo=flag.next() )
  16.144 +				if (g==fo->getGroup() && keepfo!=fo) 
  16.145 +					flag.remove(fo);
  16.146 +		}		
  16.147 +	}	
  16.148 +}
  16.149 +
  16.150  void FlagRowObj::setEnabled (bool b)
  16.151  {
  16.152  	// If we have no parent, we are the default FlagRowObj
  16.153 @@ -223,6 +244,11 @@
  16.154  	}
  16.155  }
  16.156  
  16.157 +void FlagRowObj::setShowFlags (bool b)
  16.158 +{
  16.159 +	showFlags=b;
  16.160 +}
  16.161 +
  16.162  void FlagRowObj::resetUsedCounter()
  16.163  {
  16.164  	FlagObj *fo;
  16.165 @@ -260,26 +286,28 @@
  16.166  	name=n;
  16.167  }
  16.168  
  16.169 -void FlagRowObj::makeToolbar (QMainWindow *w, const QString &n)
  16.170 +void FlagRowObj::makeToolbar (Q3MainWindow *w, const QString &n)
  16.171  {
  16.172 +	//Only make toolbar for the parentrow, not each row in branches
  16.173  	if (!parentRow)
  16.174  	{
  16.175  		// create bar and buttons
  16.176 -		QToolBar* tb = new QToolBar( w);
  16.177 +		Q3ToolBar* tb = new Q3ToolBar( w);
  16.178  		tb->setLabel (n);
  16.179  		QAction *a;
  16.180  		FlagObj *fo;
  16.181  		for (fo=flag.first();fo; fo=flag.next() )
  16.182  		{
  16.183  			a=new QAction (
  16.184 -				fo->getToolTip(),
  16.185 +// FIXME was in QT3:				fo->getToolTip(),
  16.186  				fo->getPixmap(),
  16.187  				fo->getName(),
  16.188 -				0,
  16.189 -				w,
  16.190 -				fo->getName()
  16.191 +//				0,
  16.192 +				w
  16.193 +//				fo->getName()
  16.194  			);
  16.195  			a->setToggleAction(true);
  16.196 +//			a->setTooltip (fo->getToolTip());
  16.197  			// FIXME should not be enabled by default, later in updateToolbar
  16.198  			a->setEnabled(true);
  16.199  			a->addTo (tb);
  16.200 @@ -288,10 +316,10 @@
  16.201  					w, SLOT( standardFlagChanged() ) );
  16.202  		}
  16.203  	} else
  16.204 -		qWarning ("FlagRowObj::makeToolbar mustn't be called for ordinary rows");
  16.205 +		qWarning ("FlagRowObj::makeToolbar must not be called for ordinary rows");
  16.206  }
  16.207  
  16.208 -void  FlagRowObj::updateToolBar()
  16.209 +void  FlagRowObj::updateToolbar()
  16.210  {
  16.211  	FlagObj *fo;
  16.212  	if (parentRow)
  16.213 @@ -301,7 +329,7 @@
  16.214  		// In parentRow activate all existing (==active) flags
  16.215  		for (fo=flag.first();fo; fo=flag.next() ) 
  16.216  			parentRow->activate(fo->getName());
  16.217 -		parentRow->updateToolBar();	
  16.218 +		parentRow->updateToolbar();	
  16.219  	} else
  16.220  	{
  16.221  		// We are the toolbar default
    17.1 --- a/flagrowobj.h	Sun Jan 30 12:58:47 2005 +0000
    17.2 +++ b/flagrowobj.h	Tue Jun 06 14:58:11 2006 +0000
    17.3 @@ -1,7 +1,9 @@
    17.4  #ifndef FLAGROWOBJ_H
    17.5  #define FLAGROWOBJ_H
    17.6  
    17.7 -#include <qmainwindow.h>
    17.8 +#include <q3mainwindow.h>
    17.9 +//Added by qt3to4:
   17.10 +#include <Q3PtrList>
   17.11  
   17.12  #include "mapobj.h"
   17.13  #include "flagobj.h"
   17.14 @@ -9,7 +11,7 @@
   17.15  class FlagRowObj:public QObject,public MapObj {
   17.16  public:
   17.17      FlagRowObj ();
   17.18 -    FlagRowObj (QCanvas*);
   17.19 +    FlagRowObj (Q3Canvas*);
   17.20      ~FlagRowObj ();
   17.21      virtual void init ();
   17.22      virtual void copy (FlagRowObj*);
   17.23 @@ -22,20 +24,23 @@
   17.24      virtual void calcBBoxSize();
   17.25  	virtual QString getFlagName (const QPoint &p);	// Find flag by position
   17.26  	bool isActive(const QString&);
   17.27 -	void toggle (const QString&);
   17.28 +	void toggle (const QString&,bool);
   17.29  	void activate(const QString&);
   17.30  	void deactivate(const QString&);
   17.31  	void deactivateAll();
   17.32 +	void deactivateGroup(FlagObj *);
   17.33  	void setEnabled (bool);
   17.34 +	void setShowFlags (bool);
   17.35  	void resetUsedCounter();
   17.36  	QString saveToDir (const QString &,const QString &,bool);
   17.37  	void setName (const QString&);			// prefix for exporting flags to dir
   17.38 -	void makeToolbar (QMainWindow*, const QString &);	// Create Toolbar buttons
   17.39 -	void updateToolBar();					// Update Toolbar buttons	
   17.40 +	void makeToolbar (Q3MainWindow*, const QString &);	// Create Toolbar buttons
   17.41 +	void updateToolbar();					// Update Toolbar buttons	
   17.42  private:	
   17.43  	FlagRowObj* parentRow;					// look for flags in this row
   17.44  	FlagObj* findFlag (const QString&);
   17.45 -    QPtrList <FlagObj> flag; 
   17.46 +    Q3PtrList <FlagObj> flag; 
   17.47  	QString name;
   17.48 +	bool showFlags;							// FloatObjects want to hide their flags
   17.49  };
   17.50  #endif
    18.1 --- a/floatimageobj.cpp	Sun Jan 30 12:58:47 2005 +0000
    18.2 +++ b/floatimageobj.cpp	Tue Jun 06 14:58:11 2006 +0000
    18.3 @@ -1,13 +1,14 @@
    18.4  #include "floatimageobj.h"
    18.5  #include "branchobj.h"
    18.6 -#include <math.h>
    18.7 +//Added by qt3to4:
    18.8 +#include <QPixmap>
    18.9  
   18.10  
   18.11  /////////////////////////////////////////////////////////////////
   18.12  // FloatImageObj
   18.13  /////////////////////////////////////////////////////////////////
   18.14  
   18.15 -int FloatImageObj::counter=0;		// make instance 
   18.16 +uint FloatImageObj::saveCounter=0;		// make instance 
   18.17  
   18.18  
   18.19  FloatImageObj::FloatImageObj ():FloatObj()
   18.20 @@ -18,7 +19,7 @@
   18.21      depth=-1;
   18.22  }
   18.23  
   18.24 -FloatImageObj::FloatImageObj (QCanvas* c):FloatObj(c)
   18.25 +FloatImageObj::FloatImageObj (Q3Canvas* c):FloatObj(c)
   18.26  {
   18.27   //   cout << "Const FloatImageObj (c)  called from MapCenterObj (c)\n";
   18.28      setParObj (this);	
   18.29 @@ -26,7 +27,7 @@
   18.30      depth=-1;
   18.31  }
   18.32  
   18.33 -FloatImageObj::FloatImageObj (QCanvas* c, LinkableMapObj* p):FloatObj(c,p)
   18.34 +FloatImageObj::FloatImageObj (Q3Canvas* c, OrnamentedObj* p):FloatObj(c,p)
   18.35  {
   18.36   //   cout << "Const FloatImageObj (c,p)\n";
   18.37      init();
   18.38 @@ -43,18 +44,26 @@
   18.39  	icon=new ImageObj (canvas);
   18.40  	icon->move (absPos.x(), absPos.y() );
   18.41  	icon->setVisibility (true);
   18.42 +	setZ (Z_FLOATIMG);
   18.43  	bbox.setSize (QSize(icon->size().width(), icon->size().height()));
   18.44 +	clickBox.setSize (QSize(icon->size().width(), icon->size().height()));
   18.45  	filename="";
   18.46  	originalFilename="no original name available";
   18.47  	filetype="";
   18.48  	saveInMap=true;
   18.49 +	useRelPos=true;
   18.50 +
   18.51 +	//Hide flags
   18.52 +	systemFlags->setShowFlags(false);
   18.53  }
   18.54  
   18.55  void FloatImageObj::copy (FloatImageObj* other)
   18.56  {					
   18.57  	FloatObj::copy (other);
   18.58  	icon->copy (other->icon);
   18.59 +	filetype=other->filetype;
   18.60  	filename=other->filename;
   18.61 +	originalFilename=other->originalFilename;
   18.62  	saveInMap=other->saveInMap;
   18.63      positionBBox();
   18.64  }
   18.65 @@ -67,7 +76,17 @@
   18.66  
   18.67  int FloatImageObj::z ()
   18.68  {
   18.69 -	return lrint (icon->z());
   18.70 +	return qRound (icon->z());
   18.71 +}
   18.72 +
   18.73 +void FloatImageObj::load (const QPixmap &pixmap)
   18.74 +{
   18.75 +  icon->load(pixmap);
   18.76 +  bbox.setSize (QSize(icon->size().width()+8, icon->size().height()+8));
   18.77 +  clickBox.setSize (QSize(icon->size().width()+8, icon->size().height()+8));
   18.78 +  positionBBox();
   18.79 +  filetype="PNG";
   18.80 +  filename="noname.png";
   18.81  }
   18.82  
   18.83  bool FloatImageObj::load (const QString &fn)
   18.84 @@ -77,7 +96,8 @@
   18.85  		bbox.setSize (QSize(icon->size().width()+8, icon->size().height()+8));
   18.86  		positionBBox();
   18.87  		filename=fn;
   18.88 -		filetype=QPixmap::imageFormat (fn);
   18.89 +//FIXME QT3 was		filetype=QPixmap::imageFormat (fn);
   18.90 +		setOriginalFilename (fn);
   18.91  		return true;
   18.92  	} else
   18.93  		return false;
   18.94 @@ -92,6 +112,10 @@
   18.95  void FloatImageObj::setOriginalFilename(const QString & fn)
   18.96  {
   18.97  	originalFilename=fn;
   18.98 +
   18.99 +	// Set short name, too. Search from behind:
  18.100 +	int i=originalFilename.findRev("/");
  18.101 +	if (i>=0) originalFilename=originalFilename.remove (0,i+1);
  18.102  }
  18.103  
  18.104  QString FloatImageObj::getOriginalFilename()
  18.105 @@ -101,7 +125,7 @@
  18.106  
  18.107  void FloatImageObj::setVisibility(bool v)
  18.108  {
  18.109 -    LinkableMapObj::setVisibility(v);
  18.110 +    OrnamentedObj::setVisibility(v);
  18.111  	if (v)
  18.112  	    icon->setVisibility(true);
  18.113  	else
  18.114 @@ -122,7 +146,7 @@
  18.115  
  18.116  void FloatImageObj::positionBBox()
  18.117  {
  18.118 -	// TODO
  18.119 +	clickBox=bbox;
  18.120  }
  18.121  
  18.122  void FloatImageObj::calcBBoxSize()
  18.123 @@ -130,14 +154,12 @@
  18.124  	// TODO
  18.125  }
  18.126  
  18.127 -QString FloatImageObj::saveToDir (const QString &tmpdir,const QString &prefix)
  18.128 +QString FloatImageObj::saveToDir (const QString &tmpdir,const QString &prefix, const QPoint &p)
  18.129  {
  18.130 -	counter++;
  18.131 +	if (hidden) return "";
  18.132  
  18.133 -	QString posAttr=
  18.134 -		attribut("relPosX",QString().setNum(relPos.x(),10)) +
  18.135 -		attribut("relPosY",QString().setNum(relPos.y(),10)); 
  18.136 -
  18.137 +	saveCounter++;
  18.138 +	
  18.139  	QString useOrientAttr;
  18.140  	if (useOrientation)
  18.141  		useOrientAttr=attribut ("useOrientation","true");
  18.142 @@ -164,24 +186,27 @@
  18.143  	if (filetype=="GIF")
  18.144  		filetype="PNG";
  18.145  		
  18.146 -	url="images/"+prefix+"image-" + QString().number(counter,10) + "." +filetype;
  18.147 +	url="images/"+prefix+"image-" + QString().number(saveCounter,10) + "." +filetype;
  18.148  
  18.149  	// And really save the image
  18.150  	icon->save (tmpdir + "/" + url, filetype);
  18.151 + 
  18.152 +	QString nameAttr=attribut ("orgName",originalFilename);
  18.153  
  18.154      return singleElement ("floatimage",  
  18.155 -		posAttr + 
  18.156 -		useOrientAttr + 
  18.157 -		saveInMapAttr + 
  18.158 -		exportAttr + 
  18.159 -		zAttr + 
  18.160 -		attribut ("href",QString ("file:")+url)
  18.161 +		getOrnAttr() 
  18.162 +		+useOrientAttr 
  18.163 +		+saveInMapAttr 
  18.164 +		+exportAttr  
  18.165 +		+zAttr  
  18.166 +		+attribut ("href",QString ("file:")+url)
  18.167 +		+nameAttr
  18.168  	);	
  18.169  }
  18.170  
  18.171  void FloatImageObj::resetSaveCounter()
  18.172  {
  18.173 -	counter=0;
  18.174 +	saveCounter=0;
  18.175  }
  18.176  
  18.177  
    19.1 --- a/floatimageobj.h	Sun Jan 30 12:58:47 2005 +0000
    19.2 +++ b/floatimageobj.h	Tue Jun 06 14:58:11 2006 +0000
    19.3 @@ -2,19 +2,22 @@
    19.4  #define FLOATIMAGEOBJ_H
    19.5  
    19.6  #include "floatobj.h"
    19.7 +//Added by qt3to4:
    19.8 +#include <QPixmap>
    19.9  
   19.10  /////////////////////////////////////////////////////////////////////////////
   19.11  class FloatImageObj:public FloatObj {
   19.12  public:
   19.13      FloatImageObj ();
   19.14 -    FloatImageObj (QCanvas*);
   19.15 -    FloatImageObj (QCanvas*, LinkableMapObj* parent);
   19.16 +    FloatImageObj (Q3Canvas*);
   19.17 +    FloatImageObj (Q3Canvas*, OrnamentedObj* parent);
   19.18      ~FloatImageObj ();
   19.19      virtual void init ();
   19.20      virtual void copy (FloatImageObj*);
   19.21  	virtual void setZ (const int&);
   19.22  	virtual int z();
   19.23  
   19.24 +	virtual void load (const QPixmap &);
   19.25  	virtual bool load (const QString &);
   19.26  	virtual void save (const QString &, const char *);
   19.27  	virtual void setOriginalFilename(const QString &);
   19.28 @@ -27,7 +30,7 @@
   19.29  	virtual QRect getTotalBBox();			// return BBox including childs			
   19.30  	virtual QRect getBBoxSizeWithChilds();	// return size of BBox including childs  
   19.31  	virtual void calcBBoxSizeWithChilds();	// calc size of  BBox including childs recursivly
   19.32 -	virtual QString saveToDir(const QString &,const QString&);
   19.33 +	virtual QString saveToDir(const QString &,const QString&, const QPoint &);
   19.34  	virtual void resetSaveCounter();
   19.35  	virtual QString getSelectString();
   19.36  
   19.37 @@ -35,7 +38,7 @@
   19.38  protected:
   19.39  	ImageObj *icon;
   19.40  	bool saveInMap;
   19.41 -	static int counter;			// numerate the files during saveToDir
   19.42 +	static uint saveCounter;	// numerate the files during saveToDir
   19.43  	QString filetype;
   19.44  	QString filename;
   19.45  	QString originalFilename;
    20.1 --- a/floatobj.cpp	Sun Jan 30 12:58:47 2005 +0000
    20.2 +++ b/floatobj.cpp	Tue Jun 06 14:58:11 2006 +0000
    20.3 @@ -6,7 +6,7 @@
    20.4  // FloatObj
    20.5  /////////////////////////////////////////////////////////////////
    20.6  
    20.7 -FloatObj::FloatObj ():LinkableMapObj() 
    20.8 +FloatObj::FloatObj ():OrnamentedObj() 
    20.9  {
   20.10  //    cout << "Const FloatObj ()\n";
   20.11      setParObj (this);	
   20.12 @@ -14,7 +14,7 @@
   20.13      depth=-1;
   20.14  }
   20.15  
   20.16 -FloatObj::FloatObj (QCanvas* c):LinkableMapObj(c)
   20.17 +FloatObj::FloatObj (Q3Canvas* c):OrnamentedObj(c)
   20.18  {
   20.19  //	cout << "Const FloatObj (c)  called from MapCenterObj (c)\n";
   20.20      setParObj (this);	
   20.21 @@ -22,7 +22,7 @@
   20.22      depth=-1;
   20.23  }
   20.24  
   20.25 -FloatObj::FloatObj (QCanvas* c, LinkableMapObj* p):LinkableMapObj (c)
   20.26 +FloatObj::FloatObj (Q3Canvas* c, LinkableMapObj* p):OrnamentedObj (c)
   20.27  {
   20.28  //    cout << "Const FloatObj (c,p)\n";
   20.29      setParObj (p);	
   20.30 @@ -38,39 +38,18 @@
   20.31  void FloatObj::init () 
   20.32  {
   20.33      setChildObj(this);
   20.34 -	relPos=getRandPos();
   20.35 -	useOrientation=true;
   20.36  	floatExport=true;
   20.37  	zPlane=Z_ICON;
   20.38 +	setLinkStyle (StyleParabel);
   20.39 +	setHideLinkUnselected(true);
   20.40  }
   20.41  
   20.42  void FloatObj::copy (FloatObj* other)
   20.43  {
   20.44  	LinkableMapObj::copy (other);
   20.45 -	relPos=other->relPos;
   20.46 -	useOrientation=other->useOrientation;
   20.47  	setVisibility (other->visible);
   20.48  }
   20.49  
   20.50 -void FloatObj::setRelPos()
   20.51 -{
   20.52 -	if (useOrientation)
   20.53 -	{
   20.54 -		if (parObj->getOrientation()==OrientLeftOfCenter)
   20.55 -			relPos.setX ( parObj->x() +parObj->width() - bbox.width() -absPos.x());
   20.56 -		else	
   20.57 -			relPos.setX (absPos.x() - parObj->x() );
   20.58 -	}
   20.59 -	else
   20.60 -		relPos.setX (absPos.x() - parObj->x() );
   20.61 -	relPos.setY (absPos.y() - parObj->y() );
   20.62 -}
   20.63 -
   20.64 -void FloatObj::setRelPos(const QPoint &p)
   20.65 -{
   20.66 -	relPos=p;
   20.67 -}
   20.68 -
   20.69  void FloatObj::setZ(const int &i)
   20.70  {
   20.71  	zPlane=i;
   20.72 @@ -81,16 +60,6 @@
   20.73  	return zPlane;
   20.74  }
   20.75  
   20.76 -
   20.77 -void FloatObj::setUseOrientation (const bool &b)
   20.78 -{	
   20.79 -	if (useOrientation!=b)
   20.80 -	{
   20.81 -		useOrientation=b;
   20.82 -		requestReposition();
   20.83 -	}	
   20.84 -}
   20.85 -
   20.86  void FloatObj::setFloatExport(const bool& b)
   20.87  {
   20.88  	floatExport=b;
   20.89 @@ -112,17 +81,15 @@
   20.90  	move (p.x(), p.y());
   20.91  }
   20.92  
   20.93 +void FloatObj::setDockPos()
   20.94 +{
   20.95 +	parPos=absPos;
   20.96 +	childPos=absPos;
   20.97 +}
   20.98 +
   20.99  void FloatObj::reposition()
  20.100  {
  20.101 -	if (useOrientation)
  20.102 -	{
  20.103 -		if (parObj->getOrientation()==OrientLeftOfCenter)
  20.104 -			move (parObj->x() - relPos.x() + parObj->width() - bbox.width(), parObj->y()+relPos.y());
  20.105 -		else	
  20.106 -			move (parObj->x()+relPos.x(), parObj->y()+relPos.y());
  20.107 -	}		
  20.108 -	else
  20.109 -		move (parObj->x()+relPos.x(), parObj->y()+relPos.y());
  20.110 +	move (parObj->getChildPos().x()+relPos.x(), parObj->getChildPos().y()+relPos.y());
  20.111  	updateLink();	
  20.112  }
  20.113  
  20.114 @@ -139,25 +106,11 @@
  20.115  void FloatObj::select()
  20.116  {
  20.117      LinkableMapObj::select();
  20.118 -	// Temporary draw the link while FO is selected
  20.119 -	if (style==StyleUndef) 
  20.120 -	{
  20.121 -		setLinkStyle(getDefLinkStyle());
  20.122 -		setLinkColor(parObj->getLinkColor());
  20.123 -	}	
  20.124 -
  20.125 -	// Update FloatExport switch in context menu
  20.126 -	if (floatExport)
  20.127 -		actionEditToggleFloatExport->setEnabled (true);
  20.128 -	else	
  20.129 -		actionEditToggleFloatExport->setEnabled (true);
  20.130 -
  20.131 -
  20.132 +	LinkableMapObj::setLinkColor(parObj->getLinkColor());
  20.133  }
  20.134  
  20.135  void FloatObj::unselect()
  20.136  {
  20.137  	LinkableMapObj::unselect();
  20.138 -	setLinkStyle (StyleUndef);
  20.139  }
  20.140  
    21.1 --- a/floatobj.h	Sun Jan 30 12:58:47 2005 +0000
    21.2 +++ b/floatobj.h	Tue Jun 06 14:58:11 2006 +0000
    21.3 @@ -1,43 +1,37 @@
    21.4  #ifndef FLOATOBJ_H
    21.5  #define FLOATOBJ_H
    21.6  
    21.7 -#include "linkablemapobj.h"
    21.8 +#include "ornamentedobj.h"
    21.9  
   21.10  /////////////////////////////////////////////////////////////////////////////
   21.11 -class FloatObj:public LinkableMapObj {
   21.12 +class FloatObj:public OrnamentedObj {
   21.13  public:
   21.14      FloatObj ();
   21.15 -    FloatObj (QCanvas*);
   21.16 -    FloatObj (QCanvas*, LinkableMapObj* parent);
   21.17 +    FloatObj (Q3Canvas*);
   21.18 +    FloatObj (Q3Canvas*, LinkableMapObj* parent);
   21.19      ~FloatObj ();
   21.20      virtual void init ();
   21.21      virtual void copy (FloatObj*);
   21.22  	virtual bool load (const QString&)=0;
   21.23 -	virtual void setRelPos();				// set relPos to current parentPos
   21.24 -	virtual void setRelPos(const QPoint&);	
   21.25  	virtual void setZ(const int&);		// set zPlane
   21.26  	virtual int z();
   21.27 -	virtual void setUseOrientation (const bool &);
   21.28  	virtual void setFloatExport (const bool &);
   21.29  	virtual bool getFloatExport ();
   21.30  
   21.31  	virtual void move (double,double);
   21.32  	virtual void move (QPoint);
   21.33 -
   21.34 +	virtual void setDockPos();
   21.35  	virtual void reposition();
   21.36  											
   21.37  	virtual QRect getTotalBBox();			// return BBox including childs			
   21.38  	virtual QRect getBBoxSizeWithChilds();	// return size of BBox including childs  
   21.39  
   21.40 -	virtual QString saveToDir(const QString &,const QString&)=0;
   21.41  	virtual void resetSaveCounter()=0;
   21.42  
   21.43  	virtual void select();
   21.44  	virtual void unselect();
   21.45  
   21.46  protected:
   21.47 -	QPoint relPos;
   21.48 -	bool useOrientation;		
   21.49  	bool floatExport;
   21.50  	int zPlane;
   21.51  };
    22.1 --- a/frameobj.cpp	Sun Jan 30 12:58:47 2005 +0000
    22.2 +++ b/frameobj.cpp	Tue Jun 06 14:58:11 2006 +0000
    22.3 @@ -11,7 +11,7 @@
    22.4      init ();
    22.5  }
    22.6  
    22.7 -FrameObj::FrameObj(QCanvas* c) :MapObj(c)
    22.8 +FrameObj::FrameObj(Q3Canvas* c) :MapObj(c)
    22.9  {
   22.10  //    cout << "Const FrameObj\n";
   22.11      init ();
   22.12 @@ -117,16 +117,13 @@
   22.13  				break;
   22.14  			case Rectangle:
   22.15  				border=10;
   22.16 -				rectFrame = new QCanvasRectangle (canvas);
   22.17 +				rectFrame = new Q3CanvasRectangle (canvas);
   22.18  				rectFrame->setZ(Z_FRAME);
   22.19  				rectFrame->setBrush( QColor("white") );
   22.20  				rectFrame->setPen( QPen(QColor("black") ));
   22.21 -				if (visible)
   22.22 -					rectFrame->show();
   22.23 -				else    
   22.24 -					rectFrame->hide();
   22.25  				break;
   22.26  		}
   22.27 +		setVisibility (visible);
   22.28  	}
   22.29  }
   22.30  
   22.31 @@ -141,6 +138,16 @@
   22.32  void FrameObj::setVisibility (bool v)
   22.33  {
   22.34      MapObj::setVisibility(v);
   22.35 -    setFrameType (type);    // changes on visibility depend on type...
   22.36 +	switch (type)
   22.37 +	{
   22.38 +		case NoFrame:
   22.39 +			break;
   22.40 +		case Rectangle:
   22.41 +			if (visible)
   22.42 +				rectFrame->show();
   22.43 +			else    
   22.44 +				rectFrame->hide();
   22.45 +			break;
   22.46 +	}
   22.47  }
   22.48  
    23.1 --- a/frameobj.h	Sun Jan 30 12:58:47 2005 +0000
    23.2 +++ b/frameobj.h	Tue Jun 06 14:58:11 2006 +0000
    23.3 @@ -8,7 +8,7 @@
    23.4  class FrameObj:public MapObj {
    23.5  public:
    23.6      FrameObj();
    23.7 -    FrameObj(QCanvas*);
    23.8 +    FrameObj(Q3Canvas*);
    23.9      ~FrameObj();
   23.10      void init();
   23.11      void clear();
   23.12 @@ -26,7 +26,7 @@
   23.13  
   23.14  protected:
   23.15      FrameType type;
   23.16 -    QCanvasRectangle* rectFrame;
   23.17 +    Q3CanvasRectangle* rectFrame;
   23.18      int border;									// distance text - frame
   23.19  };
   23.20  #endif
    24.1 --- a/headingobj.cpp	Sun Jan 30 12:58:47 2005 +0000
    24.2 +++ b/headingobj.cpp	Tue Jun 06 14:58:11 2006 +0000
    24.3 @@ -1,4 +1,5 @@
    24.4  #include "headingobj.h"
    24.5 +#include <qregexp.h>
    24.6  
    24.7  /////////////////////////////////////////////////////////////////
    24.8  // HeadingObj
    24.9 @@ -9,7 +10,7 @@
   24.10      init ();
   24.11  }
   24.12  
   24.13 -HeadingObj::HeadingObj(QCanvas* c) :MapObj(c)
   24.14 +HeadingObj::HeadingObj(Q3Canvas* c) :MapObj(c)
   24.15  {
   24.16  //    cout << "Const HeadingObj\n";
   24.17      init ();
   24.18 @@ -26,6 +27,7 @@
   24.19      textwidth=40;
   24.20      color=QColor ("black");
   24.21      font=QFont();
   24.22 +	heading="";
   24.23  }
   24.24  
   24.25  void HeadingObj::copy(HeadingObj *other)
   24.26 @@ -40,13 +42,15 @@
   24.27  void HeadingObj::move(double x, double y)
   24.28  {
   24.29      MapObj::move(x,y);
   24.30 +
   24.31      int h;	// height of a textline
   24.32      int ho;	// offset of height while drawing all lines
   24.33 +
   24.34      if (textline.first() )
   24.35  		h=textline.first()->boundingRect().height();
   24.36      else
   24.37  		h=2;
   24.38 -    QCanvasText *t;
   24.39 +    Q3CanvasText *t;
   24.40      ho=0;
   24.41      for (t=textline.first(); t; t=textline.next() )
   24.42      {
   24.43 @@ -76,7 +80,7 @@
   24.44  	// then no selection would be visible, thus we prevent it in ::setText()
   24.45  	if (!textline.isEmpty() )
   24.46  	{
   24.47 -		QCanvasText *t;
   24.48 +		Q3CanvasText *t;
   24.49  		for (t=textline.first(); t; t=textline.next() )
   24.50  		{
   24.51  			h+=t->boundingRect().height();
   24.52 @@ -87,14 +91,15 @@
   24.53      bbox.setSize (QSize(w,h));
   24.54  }
   24.55  
   24.56 -QCanvasText* HeadingObj::newLine(QString s)
   24.57 +Q3CanvasText* HeadingObj::newLine(QString s)
   24.58  {
   24.59 -    QCanvasText *t;
   24.60 -    t = new QCanvasText(canvas);
   24.61 +    Q3CanvasText *t;
   24.62 +    t = new Q3CanvasText(canvas);
   24.63      t->setFont (font);
   24.64      t->setColor (color);
   24.65      t->setZ(Z_TEXT);
   24.66      t->setText(s);
   24.67 +	t->setTextFlags(Qt::AlignLeft);
   24.68      t->show();
   24.69      return t;
   24.70  }
   24.71 @@ -114,15 +119,17 @@
   24.72      int j=0;	// index of last ws
   24.73  	int k=0;	// index of "<br>" or similar linebreak
   24.74  	int br=0;	// width of found break, e.g. for <br> it is 4
   24.75 +	QRegExp re("<br.*/>");
   24.76 +	re.setMinimal (true);
   24.77  
   24.78      // set the text and wrap lines
   24.79      while (s.length()>0)
   24.80      {
   24.81  		// ok, some people wanted manual linebreaks, here we go
   24.82 -		k=s.find ("<br>",i,false);
   24.83 +		k=re.search (s,i);
   24.84  		if (k>=0)
   24.85  		{
   24.86 -			br=4;
   24.87 +			br=re.cap(0).length();
   24.88  			i=k;
   24.89  		} else
   24.90  			i=s.find (" ",i,false);
   24.91 @@ -184,6 +191,7 @@
   24.92  		}		    
   24.93      }
   24.94  	setVisibility (visible);
   24.95 +	move (absPos.x(),absPos.y());
   24.96  	calcBBoxSize();
   24.97  }
   24.98  
   24.99 @@ -212,7 +220,7 @@
  24.100      if (color!=c)
  24.101      {
  24.102  		color=c;
  24.103 -		QCanvasText *t;
  24.104 +		Q3CanvasText *t;
  24.105  		for (t=textline.first(); t; t=textline.next() )
  24.106  			t->setColor(c);
  24.107      }	    
  24.108 @@ -226,7 +234,7 @@
  24.109  void HeadingObj::setVisibility (bool v)
  24.110  {
  24.111      MapObj::setVisibility(v);
  24.112 -    QCanvasText *t;
  24.113 +    Q3CanvasText *t;
  24.114      for (t=textline.first(); t; t=textline.next() )
  24.115  		if (v)
  24.116  			t->show();
    25.1 --- a/headingobj.h	Sun Jan 30 12:58:47 2005 +0000
    25.2 +++ b/headingobj.h	Tue Jun 06 14:58:11 2006 +0000
    25.3 @@ -2,11 +2,13 @@
    25.4  #define HEADINGOBJ_H
    25.5  
    25.6  #include "mapobj.h"
    25.7 +//Added by qt3to4:
    25.8 +#include <Q3PtrList>
    25.9  
   25.10  class HeadingObj:public MapObj {
   25.11  public:
   25.12      HeadingObj();
   25.13 -    HeadingObj(QCanvas*);
   25.14 +    HeadingObj(Q3Canvas*);
   25.15      virtual ~HeadingObj();
   25.16      virtual void init();
   25.17      virtual void copy(HeadingObj*);
   25.18 @@ -15,7 +17,7 @@
   25.19      virtual void positionBBox();
   25.20  	virtual void calcBBoxSize();
   25.21  private:
   25.22 -    QCanvasText* newLine(QString);				// generate new textline
   25.23 +    Q3CanvasText* newLine(QString);				// generate new textline
   25.24  public:    
   25.25      virtual void setText(QString);
   25.26      virtual QString text();
   25.27 @@ -30,7 +32,7 @@
   25.28  protected:
   25.29      QString heading;
   25.30      uint textwidth;								// width for formatting text
   25.31 -    QPtrList <QCanvasText> textline;			// a part of e.g. the parabel
   25.32 +    Q3PtrList <Q3CanvasText> textline;			// a part of e.g. the parabel
   25.33      QColor color;
   25.34      QFont font;
   25.35  };
    26.1 --- a/imageobj.cpp	Sun Jan 30 12:58:47 2005 +0000
    26.2 +++ b/imageobj.cpp	Tue Jun 06 14:58:11 2006 +0000
    26.3 @@ -1,10 +1,12 @@
    26.4  #include "imageobj.h"
    26.5 +//Added by qt3to4:
    26.6 +#include <QPixmap>
    26.7  
    26.8  /////////////////////////////////////////////////////////////////
    26.9  // ImageObj
   26.10  /////////////////////////////////////////////////////////////////
   26.11 -ImageObj::ImageObj( QCanvas *canvas )
   26.12 -    : QCanvasRectangle( canvas )
   26.13 +ImageObj::ImageObj( Q3Canvas *canvas )
   26.14 +    : Q3CanvasRectangle( canvas )
   26.15  {
   26.16  //	cout << "Const ImageObj (canvas)\n";
   26.17      setZ(Z_ICON);	
   26.18 @@ -39,7 +41,7 @@
   26.19  {
   26.20  	switch (type)
   26.21  	{
   26.22 -		case undef: qWarning("undef");break;
   26.23 +		case undef: qWarning("Warning: ImageObj::save() type=undef");break;
   26.24  		case qimage: image.save (fn,format,-1);break;
   26.25  		case qpixmap: pixmap.save (fn,format,-1);break;
   26.26  	}
   26.27 @@ -54,7 +56,7 @@
   26.28  	type=qimage;
   26.29  
   26.30  #if !defined(Q_WS_QWS)
   26.31 -    pixmap.convertFromImage(image, OrderedAlphaDither);
   26.32 +    pixmap.convertFromImage(image, Qt::OrderedAlphaDither);
   26.33  #endif
   26.34  	return true;
   26.35  }
   26.36 @@ -78,7 +80,7 @@
   26.37  {
   26.38  	type=qimage;
   26.39  	image=img;
   26.40 -    pixmap.convertFromImage(image, OrderedAlphaDither);
   26.41 +    pixmap.convertFromImage(image, Qt::OrderedAlphaDither);
   26.42  }
   26.43  
   26.44  QPixmap ImageObj::getPixmap()
   26.45 @@ -91,7 +93,7 @@
   26.46  // On Qt/Embedded, we can paint a QImage as fast as a QPixmap,
   26.47  // but on other platforms, we need to use a QPixmap.
   26.48  #if defined(Q_WS_QWS)
   26.49 -    p.drawImage( int(x()), int(y()), image, 0, 0, -1, -1, OrderedAlphaDither );
   26.50 +    p.drawImage( int(x()), int(y()), image, 0, 0, -1, -1, Qt::OrderedAlphaDither );
   26.51  #else
   26.52      p.drawPixmap( int(x()), int(y()), pixmap );
   26.53  #endif
    27.1 --- a/imageobj.h	Sun Jan 30 12:58:47 2005 +0000
    27.2 +++ b/imageobj.h	Tue Jun 06 14:58:11 2006 +0000
    27.3 @@ -2,17 +2,19 @@
    27.4  #define IMAGEOBJ_H
    27.5  
    27.6  #include <qimage.h>
    27.7 -#include <qcanvas.h>
    27.8 +#include <q3canvas.h>
    27.9  #include <qpainter.h>
   27.10 +//Added by qt3to4:
   27.11 +#include <QPixmap>
   27.12  
   27.13  #include "mapobj.h"
   27.14  
   27.15  enum ImageType {qimage,qpixmap,undef};
   27.16  
   27.17 -class ImageObj: public QCanvasRectangle
   27.18 +class ImageObj: public Q3CanvasRectangle
   27.19  {
   27.20  public:
   27.21 -    ImageObj( QCanvas *canvas );
   27.22 +    ImageObj( Q3Canvas *canvas );
   27.23      ~ImageObj();
   27.24  	virtual void copy (ImageObj*);
   27.25      virtual void setVisibility(bool);
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/imports.cpp	Tue Jun 06 14:58:11 2006 +0000
    28.3 @@ -0,0 +1,115 @@
    28.4 +#include <qmessagebox.h>
    28.5 +//Added by qt3to4:
    28.6 +#include <QTextStream>
    28.7 +
    28.8 +#include "file.h"
    28.9 +#include "imports.h"
   28.10 +#include "linkablemapobj.h"
   28.11 +#include "misc.h"
   28.12 +#include "mainwindow.h"
   28.13 +#include "xsltproc.h"
   28.14 +
   28.15 +extern Main *mainWindow;
   28.16 +extern QDir vymBaseDir;
   28.17 +
   28.18 +ImportBase::ImportBase()
   28.19 +{
   28.20 +	// Create tmpdir
   28.21 +	tmpDir.setPath (makeUniqueDir("/tmp/vym-XXXXXX"));
   28.22 +}
   28.23 +
   28.24 +
   28.25 +ImportBase::~ImportBase()
   28.26 +{
   28.27 +	// Remove tmpdir
   28.28 +	removeDir (tmpDir);
   28.29 +}
   28.30 +
   28.31 +void ImportBase::setDir(const QString &p)
   28.32 +{
   28.33 +	inputDir=p;
   28.34 +}
   28.35 +
   28.36 +void ImportBase::setFile (const QString &p)
   28.37 +{
   28.38 +	inputFile=p;
   28.39 +}
   28.40 +
   28.41 +void ImportBase::setMapCenter(MapCenterObj *mc)
   28.42 +{
   28.43 +	mapCenter=mc;
   28.44 +}
   28.45 +
   28.46 +bool ImportBase::transform()
   28.47 +{
   28.48 +	return true;
   28.49 +}
   28.50 +
   28.51 +QString ImportBase::getTransformedFile()
   28.52 +{
   28.53 +	return transformedFile;
   28.54 +}
   28.55 +
   28.56 +/////////////////////////////////////////////////
   28.57 +bool ImportKDEBookmarks::transform()
   28.58 +{
   28.59 +	transformedFile=tmpDir.path()+"/bookmarks.xml";
   28.60 +
   28.61 +	XSLTProc p;
   28.62 +	p.setInputFile (tmpDir.home().path()+"/.kde/share/apps/konqueror/bookmarks.xml");
   28.63 +	p.setOutputFile (transformedFile);
   28.64 +	p.setXSLFile (vymBaseDir.path()+"/styles/kdebookmarks2vym.xsl");
   28.65 +	p.process();
   28.66 +
   28.67 +	return true;
   28.68 +}
   28.69 +
   28.70 +
   28.71 +/////////////////////////////////////////////////
   28.72 +bool ImportFirefoxBookmarks::transform()
   28.73 +{
   28.74 +	transformedFile=tmpDir.path()+"/bookmarks.xml";
   28.75 +
   28.76 +	QStringList lines;
   28.77 +	QFile file( inputFile );
   28.78 +	if ( file.open( QIODevice::ReadOnly ) ) 
   28.79 +	{
   28.80 +		QTextStream stream( &file );
   28.81 +		while ( !stream.atEnd() ) 
   28.82 +			lines += stream.readLine(); // line of text excluding '\n'
   28.83 +		file.close();
   28.84 +	}
   28.85 +	// FIXME
   28.86 +	// Generate vym from broken bookmarks above...
   28.87 +
   28.88 +	return true;
   28.89 +}
   28.90 +
   28.91 +
   28.92 +/////////////////////////////////////////////////
   28.93 +bool ImportMM::transform()
   28.94 +{
   28.95 +	// try to unzip 
   28.96 +	if (success==unzipDir (tmpDir, inputFile))
   28.97 +	{
   28.98 +		
   28.99 +		// Set short name, too. Search from behind:
  28.100 +		transformedFile=inputFile;
  28.101 +		int i=transformedFile.findRev("/");
  28.102 +		if (i>=0) transformedFile=transformedFile.remove (0,i+1);
  28.103 +		transformedFile.replace(".mmap",".xml");
  28.104 +		transformedFile=tmpDir.path()+"/"+transformedFile;
  28.105 +
  28.106 +		XSLTProc p;
  28.107 +		p.setInputFile (tmpDir.path()+"/Document.xml");
  28.108 +		p.setOutputFile (transformedFile);
  28.109 +		p.setXSLFile (vymBaseDir.path()+"/styles/mmap2vym.xsl");
  28.110 +		p.process();
  28.111 +
  28.112 +		cout << "  xslt done"<<endl;
  28.113 +
  28.114 +		return true;
  28.115 +	} else
  28.116 +		return false;
  28.117 +	
  28.118 +}
    29.1 --- a/linkablemapobj.cpp	Sun Jan 30 12:58:47 2005 +0000
    29.2 +++ b/linkablemapobj.cpp	Tue Jun 06 14:58:11 2006 +0000
    29.3 @@ -1,10 +1,12 @@
    29.4 -//#include <math.h>
    29.5 +#include <math.h>
    29.6  
    29.7  #include "linkablemapobj.h"
    29.8  #include "branchobj.h"
    29.9  #include "mapeditor.h"
   29.10  
   29.11  #include "version.h"
   29.12 +//Added by qt3to4:
   29.13 +#include <Q3PointArray>
   29.14  
   29.15  
   29.16  /////////////////////////////////////////////////////////////////
   29.17 @@ -17,7 +19,7 @@
   29.18      init ();
   29.19  }
   29.20  
   29.21 -LinkableMapObj::LinkableMapObj(QCanvas* c) :MapObj(c)
   29.22 +LinkableMapObj::LinkableMapObj(Q3Canvas* c) :MapObj(c)
   29.23  {
   29.24  //    cout << "Const LinkableMapObj\n";
   29.25      init ();
   29.26 @@ -62,6 +64,7 @@
   29.27  void LinkableMapObj::init ()
   29.28  {
   29.29      depth=-1;	
   29.30 +	mapEditor=NULL;
   29.31      childObj=NULL;
   29.32      parObj=NULL;
   29.33      parObjTmpBuf=NULL;
   29.34 @@ -76,35 +79,45 @@
   29.35  	linkpos=LinkBottom;
   29.36      segment.setAutoDelete (TRUE);
   29.37      arcsegs=13;
   29.38 -	QPointArray pa(arcsegs*2+2);
   29.39 +	Q3PointArray pa(arcsegs*2+2);
   29.40      
   29.41 -    bottomline=new QCanvasLine(canvas);
   29.42 +    bottomline=new Q3CanvasLine(canvas);
   29.43      bottomline->setPen( QPen(linkcolor, 1) );
   29.44      bottomline->setZ(Z_LINK);
   29.45      bottomline->show();
   29.46  
   29.47      // Prepare showing the selection of a MapObj
   29.48 -    selbox = new QCanvasRectangle (canvas);
   29.49 +    selbox = new Q3CanvasRectangle (canvas);
   29.50      selbox->setZ(Z_SELBOX);
   29.51      selbox->setBrush( QColor(255,255,0) );
   29.52      selbox->setPen( QPen(QColor(255,255,0) ));
   29.53      selbox->hide();
   29.54      selected=false;
   29.55  
   29.56 +	hideLinkUnselected=false;
   29.57 +
   29.58 +	topPad=botPad=leftPad=rightPad=0;
   29.59 +
   29.60  	// initialize frame
   29.61  	frame = new FrameObj (canvas);
   29.62  	
   29.63  	repositionRequest=false;
   29.64 +
   29.65 +	// Rel Positions
   29.66 +	relPos=QPoint(0,0);
   29.67 +	useRelPos=false;
   29.68 +	useOrientation=true;
   29.69  }
   29.70  
   29.71  void LinkableMapObj::copy (LinkableMapObj* other)
   29.72  {
   29.73      MapObj::copy(other);
   29.74  	bboxTotal=other->bboxTotal;
   29.75 -//    linkwidth=other->linkwidth;		
   29.76 -
   29.77      setLinkStyle(other->style);
   29.78      setLinkColor (other->linkcolor);
   29.79 +	relPos=other->relPos;
   29.80 +	useOrientation=other->useOrientation;
   29.81 +
   29.82  }
   29.83  
   29.84  void LinkableMapObj::setChildObj(LinkableMapObj* o)
   29.85 @@ -126,8 +139,57 @@
   29.86  {
   29.87  }
   29.88  
   29.89 +bool LinkableMapObj::hasParObjTmp()
   29.90 +{
   29.91 +	if (parObjTmpBuf) return true;
   29.92 +	return false;
   29.93 +}
   29.94 +
   29.95 +void LinkableMapObj::setUseRelPos (const bool &b)
   29.96 +{
   29.97 +	useRelPos=b;
   29.98 +}
   29.99 +
  29.100 +void LinkableMapObj::setRelPos()
  29.101 +{
  29.102 +	if (parObj)
  29.103 +	{	
  29.104 +		relPos.setX (absPos.x() - parObj->getChildPos().x() );
  29.105 +		relPos.setY (absPos.y() - parObj->getChildPos().y() );
  29.106 +
  29.107 +		parObj->calcBBoxSize();
  29.108 +		parObj->requestReposition();
  29.109 +	}	
  29.110 +}
  29.111 +
  29.112 +void LinkableMapObj::setRelPos(const QPoint &p)
  29.113 +{
  29.114 +	relPos=p;
  29.115 +	if (parObj)
  29.116 +	{	parObj->calcBBoxSize();
  29.117 +		parObj->requestReposition();
  29.118 +	}	
  29.119 +}
  29.120 +
  29.121 +int LinkableMapObj::getTopPad()
  29.122 +{
  29.123 +	return topPad;
  29.124 +}
  29.125 +
  29.126 +int LinkableMapObj::getLeftPad()
  29.127 +{
  29.128 +	return leftPad;
  29.129 +}
  29.130 +
  29.131 +int LinkableMapObj::getRightPad()
  29.132 +{
  29.133 +	return rightPad;
  29.134 +}
  29.135 +
  29.136  LinkStyle LinkableMapObj::getDefLinkStyle ()
  29.137  {
  29.138 +	if (!mapEditor) return StyleUndef;
  29.139 +
  29.140  	LinkStyle ls=mapEditor->getLinkStyle();
  29.141  	switch (ls)
  29.142  	{
  29.143 @@ -157,6 +219,7 @@
  29.144  
  29.145  void LinkableMapObj::setLinkStyle(LinkStyle newstyle)
  29.146  {
  29.147 +	//if (newstyle=style) return;
  29.148  	delLink();
  29.149  		
  29.150  	style=newstyle;
  29.151 @@ -164,14 +227,14 @@
  29.152      if (childObj!=NULL && parObj != NULL)
  29.153      {
  29.154  		int i;
  29.155 -		QCanvasLine* cl;
  29.156 +		Q3CanvasLine* cl;
  29.157  		switch (style)
  29.158  		{
  29.159  			case StyleUndef:
  29.160  				bottomline->hide();
  29.161  				break;
  29.162  			case StyleLine: 
  29.163 -				l = new QCanvasLine(canvas);
  29.164 +				l = new Q3CanvasLine(canvas);
  29.165  				l->setPen( QPen(linkcolor, 1) );
  29.166  				l->setZ(Z_LINK);
  29.167  				if (visible)
  29.168 @@ -182,7 +245,7 @@
  29.169  			case StyleParabel:
  29.170  				for (i=0;i<arcsegs;i++)
  29.171  				{
  29.172 -					cl = new QCanvasLine(canvas);
  29.173 +					cl = new Q3CanvasLine(canvas);
  29.174  					cl->setPen( QPen(linkcolor, 1) );
  29.175  					cl->setPoints( 0,0,i*10,100);
  29.176  					cl->setZ(Z_LINK);
  29.177 @@ -195,7 +258,7 @@
  29.178  				pa0.resize (arcsegs+1);
  29.179  				break;
  29.180  			case StylePolyLine:	
  29.181 -				p = new QCanvasPolygon(canvas);
  29.182 +				p = new Q3CanvasPolygon(canvas);
  29.183  				p->setBrush( linkcolor );
  29.184  				p->setZ(Z_LINK);
  29.185  				if (visible)
  29.186 @@ -203,10 +266,9 @@
  29.187  				else
  29.188  					p->hide();
  29.189  				pa0.resize (3);
  29.190 -				// TODO
  29.191 -				// a bit awkward: draw the lines additionally to polygon, to avoid
  29.192 +				// TODO a bit awkward: draw the lines additionally to polygon, to avoid
  29.193  				// missing pixels, when polygon is extremly flat
  29.194 -				l = new QCanvasLine(canvas);
  29.195 +				l = new Q3CanvasLine(canvas);
  29.196  				l->setPen( QPen(linkcolor, 1) );
  29.197  				l->setZ(Z_LINK);
  29.198  				if (visible)
  29.199 @@ -215,7 +277,7 @@
  29.200  					l->hide();
  29.201  				break;
  29.202  			case StylePolyParabel:	
  29.203 -				p = new QCanvasPolygon(canvas);
  29.204 +				p = new Q3CanvasPolygon(canvas);
  29.205  				p->setBrush( linkcolor );
  29.206  				p->setZ(Z_LINK);
  29.207  				if (visible)
  29.208 @@ -226,13 +288,12 @@
  29.209  				pa1.resize (arcsegs+1);
  29.210  				pa2.resize (arcsegs+1);
  29.211  
  29.212 -				// TODO
  29.213 -				// a bit awkward: draw the lines additionally 
  29.214 +				// TODO a bit awkward: draw the lines additionally 
  29.215  				// to polygon, to avoid missing pixels, 
  29.216  				// if polygon is extremly flat
  29.217  				for (i=0;i<arcsegs;i++)
  29.218  				{
  29.219 -					cl = new QCanvasLine(canvas);
  29.220 +					cl = new Q3CanvasLine(canvas);
  29.221  					cl->setPen( QPen(linkcolor, 1) );
  29.222  					cl->setPoints( 0,0,i*10,100);
  29.223  					cl->setZ(Z_LINK);
  29.224 @@ -246,10 +307,7 @@
  29.225  			default: 
  29.226  				break;	
  29.227  		}	
  29.228 -	} else
  29.229 -	{
  29.230 -		cout << "Error: ChildObj or parObj == NULL in LinkableMapObj::setLinkStyle\n";
  29.231 -	}
  29.232 +	} 
  29.233  }
  29.234  
  29.235  LinkStyle LinkableMapObj::getLinkStyle()
  29.236 @@ -257,6 +315,18 @@
  29.237  	return style;
  29.238  }
  29.239  
  29.240 +void LinkableMapObj::setHideLinkUnselected(bool b)
  29.241 +{
  29.242 +	hideLinkUnselected=b;
  29.243 +	setVisibility (visible);
  29.244 +	updateLink();
  29.245 +}
  29.246 +
  29.247 +bool LinkableMapObj::getHideLinkUnselected()
  29.248 +{
  29.249 +	return hideLinkUnselected;
  29.250 +}
  29.251 +
  29.252  void LinkableMapObj::setLinkPos(LinkPos lp)
  29.253  {
  29.254  	linkpos=lp;
  29.255 @@ -272,14 +342,15 @@
  29.256  {
  29.257  	// Overloaded in BranchObj and childs
  29.258  	// here only set default color
  29.259 -	setLinkColor (mapEditor->getDefLinkColor());
  29.260 +	if (mapEditor)
  29.261 +		setLinkColor (mapEditor->getDefLinkColor());
  29.262  }
  29.263  
  29.264  void LinkableMapObj::setLinkColor(QColor col)
  29.265  {
  29.266  	linkcolor=col;
  29.267      bottomline->setPen( QPen(linkcolor, 1) );
  29.268 -	QCanvasLine *cl;
  29.269 +	Q3CanvasLine *cl;
  29.270  	switch (style)
  29.271  	{
  29.272  		case StyleLine:
  29.273 @@ -301,7 +372,6 @@
  29.274  		default:
  29.275  			break;
  29.276  	} // switch (style)	
  29.277 -	updateLink();
  29.278  }
  29.279  
  29.280  QColor LinkableMapObj::getLinkColor()
  29.281 @@ -332,32 +402,62 @@
  29.282  
  29.283  void LinkableMapObj::setVisibility (bool v)
  29.284  {
  29.285 +	Q3CanvasLine* cl;
  29.286  	MapObj::setVisibility (v);
  29.287 -	if (visible) 
  29.288 +	bool visnow=visible;
  29.289 +
  29.290 +	// We can hide the link, while object is not selected
  29.291 +	if (hideLinkUnselected && !selected)
  29.292 +		visnow=false;
  29.293 +
  29.294 +	if (visnow) 
  29.295  	{
  29.296  		bottomline->show();
  29.297 -		// FIXME lines and segments should be done in LMO?
  29.298 -		if (style==StyleLine && l) 
  29.299 +		switch (style)
  29.300  		{
  29.301 -			l->show();
  29.302 -		} else
  29.303 -		{
  29.304 -			QCanvasLine* cl;
  29.305 -			for (cl=segment.first(); cl; cl=segment.next() )
  29.306 -				cl->show();
  29.307 -		} 
  29.308 +			case StyleLine:
  29.309 +				if (l) l->show();
  29.310 +				break;
  29.311 +			case StyleParabel:	
  29.312 +				for (cl=segment.first(); cl; cl=segment.next() )
  29.313 +					cl->show();
  29.314 +				break;	
  29.315 +			case StylePolyLine:
  29.316 +				if (p) p->show();
  29.317 +				if (l) l->show();
  29.318 +				break;
  29.319 +			case StylePolyParabel:	
  29.320 +				for (cl=segment.first(); cl; cl=segment.next() )
  29.321 +					cl->show();
  29.322 +				if (p) p->show();
  29.323 +				break;
  29.324 +			default:
  29.325 +				break;
  29.326 +		}
  29.327  	} else 
  29.328  	{
  29.329  		bottomline->hide();
  29.330 -		if (style==StyleLine && l) 
  29.331 +		switch (style)
  29.332  		{
  29.333 -			l->hide();
  29.334 -		} else
  29.335 -		{
  29.336 -			QCanvasLine* cl;
  29.337 -			for (cl=segment.first(); cl; cl=segment.next() )
  29.338 -				cl->hide();
  29.339 -		} 
  29.340 +			case StyleLine:
  29.341 +				if (l) l->hide();
  29.342 +				break;
  29.343 +			case StyleParabel:	
  29.344 +				for (cl=segment.first(); cl; cl=segment.next() )
  29.345 +					cl->hide();
  29.346 +				break;	
  29.347 +			case StylePolyLine:
  29.348 +				if (p) p->hide();
  29.349 +				if (l) l->hide();
  29.350 +				break;
  29.351 +			case StylePolyParabel:	
  29.352 +				for (cl=segment.first(); cl; cl=segment.next() )
  29.353 +					cl->hide();
  29.354 +				if (p) p->hide();
  29.355 +				break;
  29.356 +			default:
  29.357 +				break;
  29.358 +		}
  29.359  	}	
  29.360  }
  29.361  
  29.362 @@ -370,12 +470,11 @@
  29.363      // 
  29.364      // sets:
  29.365      //	orientation
  29.366 -    //	childPos
  29.367 -    //	parPos
  29.368 -	//  offset
  29.369 +    //	childPos	(by calling setDockPos())
  29.370 +    //	parPos		(by calling setDockPos())
  29.371 +	//  bottomlineY
  29.372      //	drawing of the link itself
  29.373  
  29.374 -
  29.375  	// updateLink is called from move, but called from constructor we don't
  29.376  	// have parents yet...
  29.377  	if (style==StyleUndef) return;	
  29.378 @@ -387,10 +486,10 @@
  29.379  	switch (linkpos)
  29.380  	{
  29.381  		case LinkMiddle:
  29.382 -			offset=bbox.height() /2;
  29.383 +			bottomlineY=bbox.top()+bbox.height() /2;	// draw link to middle (of frame)
  29.384  			break;
  29.385  		default :
  29.386 -			offset=bbox.height()-1;			// draw link to bottom of bbox
  29.387 +			bottomlineY=bbox.bottom()-1;	// draw link to bottom of box
  29.388  			break;
  29.389  	}
  29.390  	
  29.391 @@ -431,23 +530,7 @@
  29.392  		reposition();
  29.393  	}
  29.394  	
  29.395 -    if (orientation==OrientLeftOfCenter )
  29.396 -    {
  29.397 -		childPos=QPoint (absPos.x(),absPos.y()+offset);
  29.398 -		parPos=QPoint (absPos.x()+ bbox.width(), absPos.y() + offset );
  29.399 -    } else
  29.400 -    {
  29.401 -		childPos=QPoint (absPos.x()+ bbox.width(), absPos.y() + offset ); 
  29.402 -		parPos=QPoint (absPos.x(),absPos.y()+offset);
  29.403 -    }
  29.404 -	/* FIXME
  29.405 -		cout << "      LMO::updateLink   absPos="<<absPos<<endl;
  29.406 -		cout << "      LMO::updateLink childPos="<<childPos<<endl;
  29.407 -		cout << "      LMO::updateLink   parPos="<<parPos<<endl;
  29.408 -		cout << "      LMO::updateLink   offset="<<offset<<endl;
  29.409 -		cout << "      LMO::updateLink   bbox.w="<<bbox.width()<<endl;
  29.410 -		cout << "      LMO::updateLink   bbox.h="<<bbox.height()<<endl;
  29.411 -	*/	
  29.412 +	setDockPos();
  29.413  
  29.414  	double p1x=parPos.x();	// Link is drawn from P1 to P2
  29.415  	double p1y=parPos.y();
  29.416 @@ -456,10 +539,10 @@
  29.417  	double vy=p2y - p1y;
  29.418  
  29.419  	// Draw the horizontal line below heading (from ChildPos to ParPos)
  29.420 -	bottomline->setPoints (lrint(childPos.x()),
  29.421 -		lrint(childPos.y()),
  29.422 -		lrint(p1x),
  29.423 -		lrint(p1y) );
  29.424 +	bottomline->setPoints (qRound(childPos.x()),
  29.425 +		qRound(childPos.y()),
  29.426 +		qRound(p1x),
  29.427 +		qRound(p1y) );
  29.428  
  29.429  	double a;	// angle
  29.430  	if (vx > -0.000001 && vx < 0.000001)
  29.431 @@ -467,9 +550,9 @@
  29.432  	else
  29.433  		a=atan( vy / vx );
  29.434  	// "turning point" for drawing polygonal links
  29.435 -	QPoint tp (-lrint(sin (a)*thickness_start), lrint(cos (a)*thickness_start));	
  29.436 +	QPoint tp (-qRound(sin (a)*thickness_start), qRound(cos (a)*thickness_start));	
  29.437  	
  29.438 -	QCanvasLine *cl;
  29.439 +	Q3CanvasLine *cl;
  29.440  
  29.441  	int i;
  29.442  
  29.443 @@ -477,10 +560,10 @@
  29.444  	switch (style)
  29.445  	{
  29.446  		case StyleLine:
  29.447 -			l->setPoints( lrint (parPos.x()),
  29.448 -				lrint(parPos.y()),
  29.449 -				lrint(p2x),
  29.450 -				lrint(p2y) );
  29.451 +			l->setPoints( qRound (parPos.x()),
  29.452 +				qRound(parPos.y()),
  29.453 +				qRound(p2x),
  29.454 +				qRound(p2y) );
  29.455  			break;	
  29.456  		case StyleParabel:	
  29.457  			parabel (pa0, p1x,p1y,p2x,p2y);
  29.458 @@ -492,15 +575,15 @@
  29.459  			}
  29.460  			break;
  29.461  		case StylePolyLine:
  29.462 -			pa0[0]=QPoint (lrint(p2x+tp.x()), lrint(p2y+tp.y()));
  29.463 -			pa0[1]=QPoint (lrint(p2x-tp.x()), lrint(p2y-tp.y()));
  29.464 -			pa0[2]=QPoint (lrint (parPos.x()), lrint(parPos.y()) );
  29.465 +			pa0[0]=QPoint (qRound(p2x+tp.x()), qRound(p2y+tp.y()));
  29.466 +			pa0[1]=QPoint (qRound(p2x-tp.x()), qRound(p2y-tp.y()));
  29.467 +			pa0[2]=QPoint (qRound (parPos.x()), qRound(parPos.y()) );
  29.468  			p->setPoints (pa0);
  29.469  			// here too, draw line to avoid missing pixels
  29.470 -			l->setPoints( lrint (parPos.x()),
  29.471 -				lrint(parPos.y()),
  29.472 -				lrint(p2x),
  29.473 -				lrint(p2y) );
  29.474 +			l->setPoints( qRound (parPos.x()),
  29.475 +				qRound(parPos.y()),
  29.476 +				qRound(p2x),
  29.477 +				qRound(p2y) );
  29.478  			break;
  29.479  		case StylePolyParabel:	
  29.480  			parabel (pa1, p1x,p1y,p2x+tp.x(),p2y+tp.y());
  29.481 @@ -534,6 +617,44 @@
  29.482      return parObj;
  29.483  }
  29.484  
  29.485 +LinkableMapObj* LinkableMapObj::findObjBySelect (QString s)
  29.486 +{
  29.487 +	LinkableMapObj *lmo=this;
  29.488 +	QString part;
  29.489 +	QString typ;
  29.490 +	QString num;
  29.491 +	while (!s.isEmpty() )
  29.492 +	{
  29.493 +		part=s.section(",",0,0);
  29.494 +		typ=part.left (3);
  29.495 +		num=part.right(part.length() - 3);
  29.496 +		if (typ=="mc:")
  29.497 +		{
  29.498 +			if (depth>0)
  29.499 +				return false;	// in a subtree there is no center
  29.500 +			else
  29.501 +				break;
  29.502 +		} else
  29.503 +			if (typ=="bo:")
  29.504 +				lmo=((BranchObj*)(lmo))->getBranchNum (num.toUInt());
  29.505 +			else
  29.506 +				if (typ=="fi:")
  29.507 +					lmo=((BranchObj*)(lmo))->getFloatImageNum (num.toUInt());
  29.508 +		if (!lmo) break;
  29.509 +		
  29.510 +		if (s.contains(","))
  29.511 +			s=s.right(s.length() - part.length() -1 );
  29.512 +		else	
  29.513 +			break;
  29.514 +	}
  29.515 +	return lmo;
  29.516 +}
  29.517 +
  29.518 +void LinkableMapObj::setDockPos()
  29.519 +{
  29.520 +	cout <<"LMO::setDockPos()\n";
  29.521 +}
  29.522 +
  29.523  QPoint LinkableMapObj::getChildPos()
  29.524  {
  29.525      return childPos;
  29.526 @@ -546,11 +667,26 @@
  29.527  
  29.528  QPoint LinkableMapObj::getRelPos()
  29.529  {
  29.530 +	return relPos;
  29.531 +/* FIXME not needed? relPos was moved in 1.7.10 from
  29.532 +   floatobj to linkablemapobj. Before we had:
  29.533 +	
  29.534  	if (!parObj) return QPoint (0,0);
  29.535      return QPoint(
  29.536  		absPos.x() - parObj->x(),
  29.537  		absPos.y() - parObj->y()
  29.538  	);
  29.539 +*/	
  29.540 +}
  29.541 +
  29.542 +
  29.543 +void LinkableMapObj::setUseOrientation (const bool &b)
  29.544 +{	
  29.545 +	if (useOrientation!=b)
  29.546 +	{
  29.547 +		useOrientation=b;
  29.548 +		requestReposition();
  29.549 +	}	
  29.550  }
  29.551  
  29.552  LinkOrient LinkableMapObj::getOrientation()
  29.553 @@ -583,11 +719,12 @@
  29.554  
  29.555  void LinkableMapObj::alignRelativeTo (QPoint ref)
  29.556  {
  29.557 +	// FIXME testing, seems not to be used right now...
  29.558 +	cout << "LMO::alignRelTo   ref="<<ref<<endl;
  29.559  }
  29.560  
  29.561  void LinkableMapObj::reposition()
  29.562  {
  29.563 -cout << "LMO::reposition  ???"<<endl;
  29.564  	if (depth==0)
  29.565  	{
  29.566  		// only calculate the sizes once. If the deepest LMO changes its height,
  29.567 @@ -626,14 +763,15 @@
  29.568  	// we want to block expensive repositioning, but just do it once at
  29.569  	// the end, thus check first:
  29.570  
  29.571 -	if (mapEditor->blockReposition()) return;
  29.572 +	if (mapEditor->isRepositionBlocked()) return;
  29.573  	
  29.574  	// Pass on the request to parental objects, if this hasn't been done yet
  29.575  	
  29.576  	if (parObj) 
  29.577  		parObj->forceReposition(); 
  29.578  	else 
  29.579 -		reposition(); }
  29.580 +		reposition(); 
  29.581 +}
  29.582  
  29.583  bool LinkableMapObj::repositionRequested()
  29.584  {
  29.585 @@ -643,9 +781,9 @@
  29.586  
  29.587  void LinkableMapObj::setSelBox()
  29.588  {
  29.589 -    selbox->setX (bbox.x() );
  29.590 -    selbox->setY (bbox.y() );
  29.591 -    selbox->setSize (bbox.width(), bbox.height() );
  29.592 +    selbox->setX (clickBox.x() );
  29.593 +    selbox->setY (clickBox.y() );
  29.594 +    selbox->setSize (clickBox.width(), clickBox.height() );
  29.595  }
  29.596  
  29.597  void LinkableMapObj::select()
  29.598 @@ -653,6 +791,8 @@
  29.599  	setSelBox();
  29.600      selected=true;
  29.601      selbox->show();
  29.602 +// FIXME not needed?	
  29.603 +	setVisibility (visible);
  29.604  }
  29.605  
  29.606  
  29.607 @@ -660,9 +800,11 @@
  29.608  {
  29.609      selected=false;
  29.610      selbox->hide();
  29.611 +	// Maybe we have to hide the link:
  29.612 +	setVisibility (visible);
  29.613  }
  29.614  
  29.615 -void LinkableMapObj::parabel (QPointArray &ya, double p1x, double p1y, double p2x, double p2y)
  29.616 +void LinkableMapObj::parabel (Q3PointArray &ya, double p1x, double p1y, double p2x, double p2y)
  29.617  
  29.618  {
  29.619  	double vx=p2x - p1x;	// V=P2-P1
  29.620 @@ -680,14 +822,22 @@
  29.621  		m=(vy / (vx*vx));
  29.622  	dx=vx/(arcsegs);
  29.623  	int i;
  29.624 -	ya.setPoint (0,QPoint (lrint(p1x),lrint(p1y)));
  29.625 +	ya.setPoint (0,QPoint (qRound(p1x),qRound(p1y)));
  29.626  	for (i=1;i<=arcsegs;i++)
  29.627  	{	
  29.628  		pnx=p1x+dx;
  29.629  		pny=m*(pnx-parPos.x())*(pnx-parPos.x())+parPos.y();
  29.630 -		ya.setPoint (i,QPoint (lrint(pnx),lrint(pny)));
  29.631 +		ya.setPoint (i,QPoint (qRound(pnx),qRound(pny)));
  29.632  		p1x=pnx;
  29.633  		p1y=pny;
  29.634  	}	
  29.635  }
  29.636  
  29.637 +QString LinkableMapObj::getLinkAttr ()
  29.638 +{
  29.639 +	if (hideLinkUnselected)
  29.640 +		return attribut ("hideLink","true");
  29.641 +	else
  29.642 +		return attribut ("hideLink","false");
  29.643 +	
  29.644 +}
    30.1 --- a/linkablemapobj.h	Sun Jan 30 12:58:47 2005 +0000
    30.2 +++ b/linkablemapobj.h	Tue Jun 06 14:58:11 2006 +0000
    30.3 @@ -5,6 +5,9 @@
    30.4  #include "noteobj.h"
    30.5  #include "headingobj.h"
    30.6  #include "flagrowobj.h"
    30.7 +//Added by qt3to4:
    30.8 +#include <Q3PointArray>
    30.9 +#include <Q3PtrList>
   30.10  
   30.11  #define MAX_DEPTH 999
   30.12  
   30.13 @@ -23,7 +26,7 @@
   30.14  	Q_OBJECT
   30.15  public:
   30.16      LinkableMapObj ();
   30.17 -    LinkableMapObj (QCanvas*);
   30.18 +    LinkableMapObj (Q3Canvas*);
   30.19      LinkableMapObj (LinkableMapObj*);
   30.20      ~LinkableMapObj ();
   30.21  	virtual void delLink();
   30.22 @@ -33,9 +36,22 @@
   30.23      virtual void setParObj (LinkableMapObj*);
   30.24      virtual void setParObjTmp (LinkableMapObj*,QPoint,int);	// Only for moving Obj around
   30.25  	virtual void unsetParObjTmp();						// reuse original ParObj
   30.26 +	virtual bool hasParObjTmp();
   30.27 +
   30.28 +	virtual void setUseRelPos (const bool&);
   30.29 +	virtual void setRelPos();				// set relPos to current parentPos
   30.30 +	virtual void setRelPos(const QPoint&);	
   30.31 +	virtual void setUseOrientation (const bool &);
   30.32 +
   30.33 +
   30.34 +	virtual int getTopPad();
   30.35 +	virtual int getLeftPad();
   30.36 +	virtual int getRightPad();
   30.37  	LinkStyle getDefLinkStyle();
   30.38      void setLinkStyle(LinkStyle);            
   30.39  	LinkStyle getLinkStyle();
   30.40 +	void setHideLinkUnselected(bool);
   30.41 +	bool getHideLinkUnselected();
   30.42  	void setLinkPos (LinkPos);
   30.43  	LinkPos getLinkPos ();
   30.44  
   30.45 @@ -51,6 +67,8 @@
   30.46  											// redraw link with given style
   30.47      LinkableMapObj* getChildObj();			// returns pointer to fromObj
   30.48      LinkableMapObj* getParObj();			// returns pointer to toObj
   30.49 +    virtual LinkableMapObj* findObjBySelect(QString s);	// find obj by selectstring
   30.50 +	virtual void setDockPos();				// sets childPos and parPos
   30.51      QPoint getChildPos();					// returns pos where childs dock
   30.52      QPoint getParPos();						// returns pos where parents dock
   30.53      QPoint getRelPos();						// get position relative to parent (or (0,0))
   30.54 @@ -75,9 +93,12 @@
   30.55      virtual void select();
   30.56      virtual void unselect();
   30.57  	virtual	QString getSelectString()=0;
   30.58 +	virtual QString saveToDir (const QString&,const QString&, const QPoint&)=0;// Save data to tempdir
   30.59  
   30.60  protected:
   30.61 -	void parabel(QPointArray &,double,double,double,double);	// Create Parabel connecting two points
   30.62 +	void parabel(Q3PointArray &,double,double,double,double);	// Create Parabel connecting two points
   30.63 +	QString getLinkAttr();
   30.64 +
   30.65      QPoint childPos;
   30.66      QPoint parPos;
   30.67  	bool link2ParPos;				// While moving around, sometimes link to parent
   30.68 @@ -90,24 +111,31 @@
   30.69      LinkableMapObj* childObj;
   30.70      LinkableMapObj* parObj;
   30.71      LinkableMapObj* parObjTmpBuf;	// temporary buffer the original parent
   30.72 -    int offset;                     // vertical offset of dockpos to pos
   30.73 +    int bottomlineY;                // vertical offset of dockpos to pos
   30.74  
   30.75  	int thickness_start;			// for StylePoly*	
   30.76 -    LinkStyle style;
   30.77 -	LinkPos linkpos;
   30.78 +    LinkStyle style;				// Current style
   30.79 +	LinkPos linkpos;				// Link at bottom of object or middle of height
   30.80      QColor linkcolor;               // Link color
   30.81 -    QCanvasLine* l;                 // line style
   30.82 -	QCanvasPolygon* p;				// poly styles
   30.83 +    Q3CanvasLine* l;                 // line style
   30.84 +	Q3CanvasPolygon* p;				// poly styles
   30.85      int arcsegs;                    // arc: number of segments
   30.86 -    QPtrList <QCanvasLine> segment; // a part of e.g. the parabel
   30.87 -	QPointArray pa0;				// For drawing of PolyParabel and PolyLine
   30.88 -	QPointArray pa1;				// For drawing of PolyParabel 
   30.89 -	QPointArray pa2;				// For drawing of PolyParabel	
   30.90 -    QCanvasLine* bottomline;        // on bottom of BBox
   30.91 +    Q3PtrList <Q3CanvasLine> segment; // a part of e.g. the parabel
   30.92 +	Q3PointArray pa0;				// For drawing of PolyParabel and PolyLine
   30.93 +	Q3PointArray pa1;				// For drawing of PolyParabel 
   30.94 +	Q3PointArray pa2;				// For drawing of PolyParabel	
   30.95 +    Q3CanvasLine* bottomline;        // on bottom of BBox
   30.96  	bool repositionRequest;			// 
   30.97  
   30.98  	bool selected;					// Used for marking the selection
   30.99 -	QCanvasRectangle* selbox;
  30.100 +	bool hideLinkUnselected;		// to hide links if unselected
  30.101 +	Q3CanvasRectangle* selbox;
  30.102  	FrameObj *frame;				// frame around object
  30.103 +	int topPad, botPad,
  30.104 +		leftPad, rightPad;          // padding within bbox
  30.105 +
  30.106 +	QPoint relPos;					// position relative to childPos of parent
  30.107 +	bool useRelPos;
  30.108 +	bool useOrientation;
  30.109  };
  30.110  #endif
    31.1 --- a/main.cpp	Sun Jan 30 12:58:47 2005 +0000
    31.2 +++ b/main.cpp	Tue Jun 06 14:58:11 2006 +0000
    31.3 @@ -1,14 +1,19 @@
    31.4  #include <qapplication.h>
    31.5  #include <qpixmap.h>
    31.6  #include <qtranslator.h>
    31.7 +#include <qdir.h>
    31.8 +#include <q3ptrlist.h>
    31.9 +#include <qtextcodec.h>
   31.10 +#include <q3network.h>
   31.11 +#include <qmime.h>
   31.12 +//Added by qt3to4:
   31.13 +#include <Q3PopupMenu>
   31.14 +#include <Q3ActionGroup>
   31.15  
   31.16  #include "settings.h"
   31.17  #include "options.h"
   31.18  #include "mainwindow.h"
   31.19  
   31.20 -#include "icons/vym-48x48.xpm"
   31.21 -#include "icons/vym-editor.xpm"
   31.22 -
   31.23  #include "flagrowobj.h"
   31.24  
   31.25  // Global variables
   31.26 @@ -16,14 +21,24 @@
   31.27  								// initialized in mainwindow
   31.28  
   31.29  Main *mainWindow;				// used in BranchObj::select()								
   31.30 -MapEditor *clipboardME;			
   31.31 +QString tmpVymDir;				// All temp files go there, created in mainwindow
   31.32 +QString clipboardDir;			// Clipboard used in all mapEditors
   31.33 +QDir vymBaseDir;				// Containing all styles, scripts, images, ...
   31.34 +QString iconPath;				// Pointing to icons used for toolbars
   31.35 +QString flagsPath;				// Pointing to flags
   31.36 +bool clipboardEmpty;			
   31.37  FlagRowObj *systemFlagsDefault;	// used to copy from in LinkableMapObj
   31.38  FlagRowObj *standardFlagsDefault;
   31.39  
   31.40 +// Lists of actions
   31.41 +// (QActionGroup could not be "enabled")
   31.42 +Q3PtrList <QAction> actionListBranches;
   31.43 +
   31.44  // Actions which change sometimes
   31.45  QAction *actionFileSave;
   31.46  QAction *actionFilePrint;
   31.47  QAction *actionEditUndo;
   31.48 +QAction *actionEditRedo;
   31.49  QAction *actionEditCopy;
   31.50  QAction *actionEditCut;
   31.51  QAction *actionEditPaste;
   31.52 @@ -31,25 +46,30 @@
   31.53  QAction *actionEditMoveDown;
   31.54  QAction *actionEditToggleScroll;
   31.55  QAction *actionEditOpenURL;
   31.56 +QAction *actionEditOpenURLTab;
   31.57  QAction *actionEditURL;
   31.58  QAction *actionEditHeading2URL;
   31.59  QAction *actionEditBugzilla2URL;
   31.60 +QAction *actionEditFATE2URL;
   31.61  QAction *actionEditOpenVymLink;
   31.62  QAction *actionEditVymLink;
   31.63 +QAction *actionEditToggleHideExport;
   31.64  QAction *actionEditDeleteVymLink;
   31.65  QAction *actionEditMapInfo;
   31.66  QAction *actionEditHeading;
   31.67  QAction *actionEditDelete;
   31.68  QAction *actionEditAddBranch;
   31.69 +QAction *actionEditAddBranchHere;
   31.70  QAction *actionEditAddBranchAbove;
   31.71  QAction *actionEditAddBranchBelow;
   31.72 +QAction *actionEditRemoveBranchKeepChilds;
   31.73 +QAction *actionEditRemoveChilds;
   31.74  QAction *actionEditImportAdd;
   31.75  QAction *actionEditImportReplace;
   31.76  QAction *actionEditSaveBranch;
   31.77  QAction *actionEditSelectFirst;
   31.78  QAction *actionEditSelectLast;
   31.79  QAction *actionEditLoadImage;
   31.80 -QAction *actionEditToggleFloatExport;
   31.81  
   31.82  QAction *actionFormatColor;		
   31.83  QAction *actionFormatPickColor;		
   31.84 @@ -59,31 +79,47 @@
   31.85  QAction *actionFormatLinkColorHint;
   31.86  QAction *actionFormatLinkColor;		
   31.87  
   31.88 -QActionGroup *actionGroupFormatFrameTypes;
   31.89 +Q3ActionGroup *actionGroupModModes;
   31.90 +QAction *actionModModeColor;
   31.91 +QAction *actionModModeLink;
   31.92 +QAction *actionModModeCopy;
   31.93 +
   31.94 +Q3ActionGroup *actionGroupFormatFrameTypes;
   31.95  QAction *actionFormatFrameNone;
   31.96  QAction *actionFormatFrameRectangle;
   31.97  
   31.98 -QActionGroup *actionGroupFormatLinkStyles;
   31.99 +Q3ActionGroup *actionGroupFormatLinkStyles;
  31.100 +QAction *actionFormatIncludeImagesVer;
  31.101 +QAction *actionFormatIncludeImagesHor;
  31.102 +QAction *actionFormatHideLinkUnselected;
  31.103  QAction *actionFormatLinkStyleLine;
  31.104  QAction *actionFormatLinkStyleParabel;
  31.105  QAction *actionFormatLinkStylePolyLine;
  31.106  QAction *actionFormatLinkStylePolyParabel;
  31.107  
  31.108  QAction *actionViewToggleNoteEditor;
  31.109 +QAction *actionViewToggleHistoryWindow;
  31.110  
  31.111  QAction *actionSettingsAutoselectHeading;
  31.112  QAction *actionSettingsAutoselectText;
  31.113  QAction *actionSettingsPasteNewHeading;
  31.114  QAction *actionSettingsAutoedit;
  31.115  QAction *actionSettingsUseDelKey;
  31.116 +QAction *actionSettingsUseFlagGroups;
  31.117 +QAction *actionSettingsUseHideExport;
  31.118  
  31.119 -QPopupMenu *branchContextMenu;
  31.120 -QPopupMenu *floatimageContextMenu;
  31.121 -QPopupMenu *saveImageFormatMenu;
  31.122 -QPopupMenu *canvasContextMenu;
  31.123 -QPopupMenu *lastMapsMenu;
  31.124 -QPopupMenu *exportMenu;
  31.125 -QPopupMenu *exportImageFormatMenu;
  31.126 +Q3PopupMenu *branchContextMenu;
  31.127 +Q3PopupMenu *branchAddContextMenu;
  31.128 +Q3PopupMenu *branchRemoveContextMenu;
  31.129 +Q3PopupMenu *branchLinksContextMenu;
  31.130 +Q3PopupMenu *branchLinksContextMenuDup;
  31.131 +Q3PopupMenu *floatimageContextMenu;
  31.132 +Q3PopupMenu *saveImageFormatMenu;
  31.133 +Q3PopupMenu *canvasContextMenu;
  31.134 +Q3PopupMenu *lastMapsMenu;
  31.135 +Q3PopupMenu *importMenu;
  31.136 +Q3PopupMenu *exportMenu;
  31.137 +Q3PopupMenu *exportImageFormatMenu;
  31.138  
  31.139  
  31.140  Settings settings;
  31.141 @@ -96,19 +132,9 @@
  31.142      QApplication app(argc,argv);
  31.143  
  31.144  
  31.145 -	// Initialize translations
  31.146 -	QTranslator translator (0);
  31.147 -	translator.load( "vym_de", "." );
  31.148 -    app.installTranslator( &translator );
  31.149 -
  31.150 -	// Initializing the row of system flags
  31.151 -	// is done in first call to MapEditor(),
  31.152 -	// because we need at least one canvas first
  31.153 -	systemFlagsDefault=NULL;
  31.154 -	standardFlagsDefault=NULL;
  31.155 -
  31.156  	// Reading and initializing options commandline options
  31.157  	options.add ("version", SwitchOption, "v","version");
  31.158 +	options.add ("local", SwitchOption, "l", "local");
  31.159  	options.add ("help", SwitchOption, "h", "help");
  31.160  	options.add ("quit", SwitchOption, "q", "quit");
  31.161  	options.add ("test", StringOption, "t", "test");
  31.162 @@ -121,45 +147,82 @@
  31.163  		"http://www.InSilmaril.de/vym\n");
  31.164  	if (options.parse())
  31.165  	{
  31.166 -		cout << endl << options.getHelpText()<<endl;
  31.167 +//FIXME QT3		cout << endl << options.getHelpText()<<endl;
  31.168  		return 1;
  31.169  	}
  31.170  
  31.171  	if (options.isOn ("version"))
  31.172  	{
  31.173 -		cout << "vym version "<<__VYM_VERSION__
  31.174 +		cout << "vym version "<<__VYM_VERSION
  31.175  			<<"  (c) 2004 Uwe Drechsel - "
  31.176 -			<<__BUILD_DATE__<<endl;
  31.177 +			<<__BUILD_DATE<<endl;
  31.178  			
  31.179  		return 0;	
  31.180  	}		
  31.181  	
  31.182 +	// Use /usr/share/vym or /usr/local/share/vym or . ?
  31.183 +	// First try options
  31.184 +	if (options.isOn ("local"))
  31.185 +	{
  31.186 +		vymBaseDir.setPath (vymBaseDir.currentDirPath());
  31.187 +	} else
  31.188 +	// then look for environment variable
  31.189 +	if (getenv("VYMHOME")!=0)
  31.190 +	{
  31.191 +		vymBaseDir.setPath (getenv("VYMHOME"));
  31.192 +	} else
  31.193 +	// ok, let's find my way on my own
  31.194 +	{
  31.195 +		vymBaseDir.setPath ("/usr/share/vym");
  31.196 +		if (!vymBaseDir.exists())
  31.197 +		{
  31.198 +			vymBaseDir.setPath ("/usr/local/share/vym");
  31.199 +			if (!vymBaseDir.exists())
  31.200 +				vymBaseDir.setPath(vymBaseDir.currentDirPath() );
  31.201 +		}		
  31.202 +	}
  31.203 +
  31.204 +	iconPath=vymBaseDir.path()+"/icons/";
  31.205 +	flagsPath=vymBaseDir.path()+"/flags/";
  31.206 +
  31.207  	if (options.isOn ("help"))
  31.208  	{
  31.209 -		cout << options.getHelpText()<<endl;
  31.210 +//FIXME QT3 		cout << options.getHelpText()<<endl;
  31.211  		return 0;	
  31.212  	}	
  31.213  
  31.214  	if (options.isOn ("test"))
  31.215  	{
  31.216  		// FIXME testing string option only
  31.217 -		cout << "Testing: "<<options.getArg("test")<< endl;
  31.218 +//FIXME QT3		cout << "Testing: "<<options.getArg("test")<< endl;
  31.219  	}	
  31.220  
  31.221 +
  31.222 +    Q3MimeSourceFactory *factory = Q3MimeSourceFactory::defaultFactory();
  31.223 +    factory->setPixmap("vym-128x128", QPixmap(iconPath+"vym-128x128.png"));
  31.224 +    q3InitNetworkProtocols();
  31.225 +
  31.226 +
  31.227 +	// Initialize translations
  31.228 +	QTranslator translator (0);
  31.229 +	translator.load( QString("vym_")+QTextCodec::locale(), vymBaseDir.path() + "/lang");
  31.230 +    app.installTranslator( &translator );
  31.231 +
  31.232 +	// Initializing the row of system flags
  31.233 +	// is done in first call to MapEditor(),
  31.234 +	// because we need at least one canvas first
  31.235 +	systemFlagsDefault=NULL;
  31.236 +	standardFlagsDefault=NULL;
  31.237 +
  31.238  	// Initialize window of TextEditor
  31.239  	textEditor = new TextEditor();
  31.240 -	textEditor->setIcon (QPixmap (vym_editor_xpm));
  31.241 +	textEditor->setIcon (QPixmap (iconPath+"vym-editor.png"));
  31.242  	if (textEditor->showWithMain()) textEditor->show();
  31.243  
  31.244 -	clipboardME = new MapEditor();
  31.245 -	clipboardME->resize (800,600);
  31.246 -	clipboardME->setCaption("VYM - clipboard");
  31.247 -	clipboardME->hide();
  31.248 -
  31.249 -	// Initialize mainwindow after Mapeditors (because of Flags)
  31.250 +	// Initialize mainwindow 
  31.251      Main m;
  31.252  	//m.resize(m.sizeHint());
  31.253 -	m.setIcon (QPixmap (vym_logo_xpm));
  31.254 +	m.setIcon (QPixmap (iconPath+"vym-48x48.png"));
  31.255  	m.show();
  31.256  	m.fileNew();
  31.257  	m.loadCmdLine();
    32.1 --- a/mainwindow.cpp	Sun Jan 30 12:58:47 2005 +0000
    32.2 +++ b/mainwindow.cpp	Tue Jun 06 14:58:11 2006 +0000
    32.3 @@ -7,61 +7,58 @@
    32.4  #include <qpainter.h>
    32.5  #include <qprinter.h>
    32.6  #include <qfile.h>
    32.7 -#include <qfiledialog.h>
    32.8 +#include <q3filedialog.h>
    32.9  #include <qcolor.h>
   32.10  #include <qcolordialog.h>
   32.11  #include <qbitmap.h>
   32.12  #include <qinputdialog.h>
   32.13 +//Added by qt3to4:
   32.14 +#include <Q3StrList>
   32.15 +#include <QPixmap>
   32.16 +#include <QCloseEvent>
   32.17 +#include <QShowEvent>
   32.18 +#include <QHideEvent>
   32.19 +#include <Q3PopupMenu>
   32.20 +#include <Q3ActionGroup>
   32.21 +#include <Q3PtrList>
   32.22 +//#include <qdatetime.h>			// for random seed
   32.23  
   32.24  
   32.25  #include <iostream>
   32.26 -#include <stdlib.h>
   32.27 +#include <cstdlib>
   32.28  #include <typeinfo>
   32.29  
   32.30 -#include "version.h"
   32.31 -
   32.32 -#include "icons/filenew.xpm"
   32.33 -#include "icons/fileopen.xpm"
   32.34 -#include "icons/filesave.xpm"
   32.35 -#include "icons/fileprint.xpm"
   32.36 -#include "icons/editundo.xpm"
   32.37 -//#include "icons/editredo.xpm"	// TODO
   32.38 -#include "icons/editcopy.xpm"
   32.39 -#include "icons/editcut.xpm"
   32.40 -#include "icons/editpaste.xpm"
   32.41 -#include "icons/editmoveup.xpm"
   32.42 -#include "icons/editmovedown.xpm"
   32.43 -#include "icons/formatcoloritem.xpm"
   32.44 -#include "icons/formatcolorbranch.xpm"
   32.45 -#include "icons/formatcolorpicker.xpm"
   32.46 -#include "icons/viewzoomreset.xpm"
   32.47 -#include "icons/viewzoomin.xpm"
   32.48 -#include "icons/viewzoomout.xpm"
   32.49 -#include "icons/vym-48x48.xpm"
   32.50 -#include "icons/flag-note.xpm"
   32.51 -#include "icons/flag-url.xpm"
   32.52 -#include "icons/flag-vymlink.xpm"	
   32.53 -#include "icons/flag-scrolled-right.xpm"
   32.54 -
   32.55 +#include "aboutdialog.h"
   32.56 +#include "exportoofiledialog.h"
   32.57 +#include "exports.h"
   32.58 +#include "exportxhtmldialog.h"
   32.59 +#include "file.h"
   32.60  #include "flagrowobj.h"
   32.61 -#include "texteditor.h"
   32.62 +#include "imports.h"
   32.63  #include "mapeditor.h"
   32.64 -#include "exporthtmldialog.h"
   32.65 -#include "exportxhtmldialog.h"
   32.66 -#include "showtextdialog.h"
   32.67 +#include "misc.h"
   32.68 +#include "options.h"
   32.69  #include "process.h"
   32.70  #include "settings.h"
   32.71 -#include "options.h"
   32.72 +#include "showtextdialog.h"
   32.73 +#include "texteditor.h"
   32.74 +#include "version.h"
   32.75  
   32.76  extern TextEditor *textEditor;
   32.77  extern Main *mainWindow;
   32.78 +extern QString tmpVymDir;
   32.79 +extern QString clipboardDir;
   32.80 +extern bool clipboardEmpty;
   32.81  extern int statusbarTime;
   32.82 -extern MapEditor *clipboardME;
   32.83  extern FlagRowObj* standardFlagsDefault;
   32.84 +extern FlagRowObj* systemFlagsDefault;
   32.85 +
   32.86 +extern Q3PtrList <QAction> actionListBranches;
   32.87  
   32.88  extern QAction* actionFileSave;
   32.89  extern QAction* actionFilePrint;
   32.90  extern QAction* actionEditUndo;
   32.91 +extern QAction* actionEditRedo;
   32.92  extern QAction *actionEditCopy;
   32.93  extern QAction *actionEditCut;
   32.94  extern QAction *actionEditPaste;
   32.95 @@ -69,25 +66,30 @@
   32.96  extern QAction *actionEditMoveDown;
   32.97  extern QAction *actionEditToggleScroll;
   32.98  extern QAction* actionEditOpenURL;
   32.99 +extern QAction* actionEditOpenURLTab;
  32.100  extern QAction* actionEditURL;
  32.101  extern QAction* actionEditHeading2URL;
  32.102  extern QAction* actionEditBugzilla2URL;
  32.103 +extern QAction* actionEditFATE2URL;
  32.104  extern QAction *actionEditOpenVymLink;
  32.105  extern QAction *actionEditVymLink;
  32.106  extern QAction *actionEditDeleteVymLink;
  32.107 +extern QAction *actionEditToggleHideExport;
  32.108  extern QAction *actionEditMapInfo;
  32.109  extern QAction *actionEditHeading;
  32.110  extern QAction *actionEditDelete;
  32.111  extern QAction *actionEditAddBranch;
  32.112 +extern QAction *actionEditAddBranchHere;
  32.113  extern QAction *actionEditAddBranchAbove;
  32.114  extern QAction *actionEditAddBranchBelow;
  32.115 +extern QAction *actionEditRemoveBranchKeepChilds;
  32.116 +extern QAction *actionEditRemoveChilds;
  32.117  extern QAction *actionEditImportAdd;
  32.118  extern QAction *actionEditImportReplace;
  32.119  extern QAction *actionEditSaveBranch;
  32.120  extern QAction *actionEditSelectFirst;
  32.121  extern QAction *actionEditSelectLast;
  32.122  extern QAction *actionEditLoadImage;
  32.123 -extern QAction *actionEditToggleFloatExport;
  32.124  
  32.125  extern QAction* actionFormatColor;
  32.126  extern QAction* actionFormatPickColor;
  32.127 @@ -96,18 +98,27 @@
  32.128  extern QAction* actionFormatLinkColorHint;
  32.129  extern QAction* actionFormatBackColor;
  32.130  extern QAction* actionFormatLinkColor;
  32.131 +extern QAction *actionFormatIncludeImagesVer;
  32.132 +extern QAction *actionFormatIncludeImagesHor;
  32.133  
  32.134 -extern QActionGroup *actionGroupFormatFrameTypes;
  32.135 +extern Q3ActionGroup* actionGroupModModes;
  32.136 +extern QAction* actionModModeColor;
  32.137 +extern QAction* actionModModeLink;
  32.138 +extern QAction* actionModModeCopy;
  32.139 +
  32.140 +extern Q3ActionGroup *actionGroupFormatFrameTypes;
  32.141  extern QAction *actionFormatFrameNone;
  32.142  extern QAction *actionFormatFrameRectangle;
  32.143  
  32.144 -extern QActionGroup *actionGroupFormatLinkStyles;
  32.145 +extern Q3ActionGroup *actionGroupFormatLinkStyles;
  32.146  extern QAction *actionFormatLinkStyleLine;
  32.147  extern QAction *actionFormatLinkStyleParabel;
  32.148  extern QAction *actionFormatLinkStylePolyLine;
  32.149  extern QAction *actionFormatLinkStylePolyParabel;
  32.150 +extern QAction *actionFormatHideLinkUnselected;
  32.151  
  32.152  extern QAction *actionViewToggleNoteEditor;
  32.153 +extern QAction *actionViewToggleHistoryWindow;
  32.154  
  32.155  extern QAction* actionSettingsAutoedit;
  32.156  extern QAction* actionSettingsAutoselectHeading;
  32.157 @@ -115,25 +126,31 @@
  32.158  extern QAction* actionSettingsAutoselectText;
  32.159  extern QAction* actionSettingsPasteNewHeading;
  32.160  extern QAction* actionSettingsUseDelKey;
  32.161 +extern QAction* actionSettingsUseFlagGroups;
  32.162 +extern QAction* actionSettingsUseHideExport;
  32.163  
  32.164 -extern QPopupMenu* branchContextMenu;
  32.165 -extern QPopupMenu* floatimageContextMenu;
  32.166 -extern QPopupMenu* saveImageFormatMenu;
  32.167 -extern QPopupMenu* canvasContextMenu;
  32.168 -extern QPopupMenu* lastMapsMenu;
  32.169 -extern QPopupMenu* exportMenu;
  32.170 -extern QPopupMenu* exportImageFormatMenu;
  32.171 +extern Q3PopupMenu* branchContextMenu;
  32.172 +extern Q3PopupMenu* branchAddContextMenu;
  32.173 +extern Q3PopupMenu* branchRemoveContextMenu;
  32.174 +extern Q3PopupMenu* branchLinksContextMenu;
  32.175 +extern Q3PopupMenu* branchLinksContextMenuDup;
  32.176 +extern Q3PopupMenu* floatimageContextMenu;
  32.177 +extern Q3PopupMenu* saveImageFormatMenu;
  32.178 +extern Q3PopupMenu* canvasContextMenu;
  32.179 +extern Q3PopupMenu* lastMapsMenu;
  32.180 +extern Q3PopupMenu* importMenu;
  32.181 +extern Q3PopupMenu* exportMenu;
  32.182 +extern Q3PopupMenu* exportImageFormatMenu;
  32.183  
  32.184  
  32.185  extern Settings settings;
  32.186  extern Options options;
  32.187 +extern QDir vymBaseDir;
  32.188 +extern QString iconPath;
  32.189 +extern QString flagsPath;
  32.190  
  32.191 -#if defined(Q_OS_LINUX)
  32.192 -extern void qt_wait_for_window_manager( QWidget* w );
  32.193 -#endif
  32.194 -
  32.195 -Main::Main(QWidget* parent, const char* name, WFlags f) :
  32.196 -    QMainWindow(parent,name,f)
  32.197 +Main::Main(QWidget* parent, const char* name, Qt::WFlags f) :
  32.198 +    Q3MainWindow(parent,name,f)
  32.199  {
  32.200  	mainWindow=this;
  32.201  
  32.202 @@ -146,6 +163,24 @@
  32.203  	        settings.readNumEntry( "/vym/mainwindow/geometry/posY", 100));
  32.204  
  32.205  
  32.206 +	// Create unique temporary directory
  32.207 +	tmpVymDir=makeUniqueDir ("/tmp/vym-XXXXXX");
  32.208 +
  32.209 +	// Create direcctory for clipboard
  32.210 +	clipboardDir=tmpVymDir+"/clipboard";
  32.211 +	QDir d(clipboardDir);
  32.212 +	d.mkdir (clipboardDir,true);
  32.213 +	makeSubDirs (clipboardDir);
  32.214 +	clipboardEmpty=true;
  32.215 +
  32.216 +	procBrowser=NULL;
  32.217 +
  32.218 +	// FIXME not used currently
  32.219 +	// Set random seed (random used for object IDs)
  32.220 +    // QTime t = QTime::currentTime();		// set random seed
  32.221 +    // srand( t.hour()*12+t.minute()*60+t.second()*60 );
  32.222 +
  32.223 +
  32.224  	// Initialize some settings, which are platform dependant
  32.225  	QString p,s;
  32.226  
  32.227 @@ -155,7 +190,7 @@
  32.228  			s=settings.readEntry (p,"konqueror");
  32.229  		#else
  32.230  			#if defined(Q_OS_MACX)
  32.231 -				s=settings.readEntry (p,"/Applications/Safari.app/Contents/MacOS/Safari");
  32.232 +				s=settings.readEntry (p,"/usr/bin/open");
  32.233  			#else
  32.234  				s=settings.readEntry (p,"mozilla");
  32.235  			#endif
  32.236 @@ -168,7 +203,7 @@
  32.237  			s=settings.readEntry (p,"acroread");
  32.238  		#else
  32.239  			#if defined(Q_OS_MACX)
  32.240 -				s=settings.readEntry (p,"/Applications/Safari.app/Contents/MacOS/Safari");
  32.241 +				s=settings.readEntry (p,"/usr/bin/open");
  32.242  			#else
  32.243  				s=settings.readEntry (p,"acroread");
  32.244  			#endif
  32.245 @@ -189,6 +224,7 @@
  32.246      setupEditActions();
  32.247      setupFormatActions();
  32.248      setupViewActions();
  32.249 +    setupModeActions();
  32.250  	setupFlagActions();
  32.251      setupSettingsActions();
  32.252  	setupContextMenus();
  32.253 @@ -200,10 +236,6 @@
  32.254  
  32.255      statusBar();
  32.256  
  32.257 -	// Create the default map into first tab
  32.258 -//	fileNew();
  32.259 -//	tabWidget->addTab (new MapEditor(tabWidget,true), "unnamed");
  32.260 -//	currentMapEditor()->show();
  32.261  
  32.262  	// Initialize Find window
  32.263  	findWindow=new FindWindow(NULL,"findwindow");
  32.264 @@ -212,6 +244,9 @@
  32.265  	connect (findWindow, SIGNAL( somethingChanged() ), 
  32.266  		this, SLOT(editFindChanged() ) );	
  32.267  
  32.268 +	// Connect TextEditor, so that we can update flags if text changes
  32.269 +	connect (textEditor, SIGNAL (textHasChanged() ), this, SLOT (updateNoteFlag()));
  32.270 +
  32.271  	updateGeometry();
  32.272  }
  32.273  
  32.274 @@ -223,29 +258,33 @@
  32.275  	settings.writeEntry( "/vym/mainwindow/geometry/posX", pos().x() );
  32.276  	settings.writeEntry( "/vym/mainwindow/geometry/posY", pos().y() );
  32.277  
  32.278 -	settings.writeEntry( "/vym/version/version", __VYM_VERSION__ );
  32.279 -	settings.writeEntry( "/vym/version/builddate", __BUILD_DATE__ );
  32.280 +	settings.writeEntry( "/vym/version/version", __VYM_VERSION );
  32.281 +	settings.writeEntry( "/vym/version/builddate", __BUILD_DATE );
  32.282  
  32.283  	settings.writeEntry( "/vym/mapeditor/editmode/autoselectheading",actionSettingsAutoselectHeading->isOn() );
  32.284  	settings.writeEntry( "/vym/mapeditor/editmode/autoselecttext",actionSettingsAutoselectText->isOn() );
  32.285  	settings.writeEntry( "/vym/mapeditor/editmode/pastenewheading",actionSettingsPasteNewHeading->isOn() );
  32.286  	settings.writeEntry( "/vym/mapeditor/editmode/autoedit",actionSettingsAutoedit->isOn() );
  32.287  	settings.writeEntry( "/vym/mapeditor/editmode/useDelKey",actionSettingsUseDelKey->isOn() );
  32.288 +	settings.writeEntry( "/vym/mapeditor/editmode/useFlagGroups",actionSettingsUseFlagGroups->isOn() );
  32.289 +	settings.writeEntry( "/vym/export/useHideExport",actionSettingsUseHideExport->isOn() );
  32.290  
  32.291  	QString s;
  32.292  	int maps=lastMaps.count();
  32.293  	settings.writeEntry( "/vym/lastMaps/number",maps );
  32.294  	for (int i=1;i<=maps;i++)
  32.295  	{
  32.296 -		QStringList::Iterator it = lastMaps.at(i-1);
  32.297  		s=QString("/vym/lastMaps/map-%1").arg(i);
  32.298  		if (!s.isEmpty() && i<=maxLastMaps) 
  32.299 -			settings.writeEntry (s, *it);
  32.300 +			settings.writeEntry (s, lastMaps.at(i-1));
  32.301  	}
  32.302  
  32.303  
  32.304  	// To make the texteditor save its settings, call the destructor
  32.305  	delete (textEditor);
  32.306 +
  32.307 +	// Remove temporary directory
  32.308 +	removeDir (QDir(tmpVymDir));
  32.309  }
  32.310  
  32.311  void Main::loadCmdLine()
  32.312 @@ -280,385 +319,622 @@
  32.313  // File Actions
  32.314  void Main::setupFileActions()
  32.315  {
  32.316 -    QToolBar *tb = new QToolBar( this );
  32.317 +    Q3ToolBar *tb = new Q3ToolBar( this );
  32.318      tb->setLabel( "File Actions" );
  32.319 -    QPopupMenu *menu = new QPopupMenu( this );
  32.320 +    Q3PopupMenu *menu = new Q3PopupMenu( this );
  32.321      menuBar()->insertItem( tr( "&File" ), menu );
  32.322  
  32.323  	// Keycodes:  /usr/lib64/qt3/include/qnamespace.h
  32.324  
  32.325      QAction *a;
  32.326 -    a = new QAction( tr( "New map" ), QPixmap( filenew_xpm ), tr( "&New..." ), CTRL + Key_N, this, "fileNew" );
  32.327 -    connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
  32.328 +    a = new QAction(QPixmap( iconPath+"filenew.png"), tr( "&New..." ),this);
  32.329 +	a->setStatusTip ( tr( "New map","File menu" ) );
  32.330 +	a->setShortcut ( Qt::CTRL + Qt::Key_N );
  32.331      a->addTo( tb );
  32.332      a->addTo( menu );
  32.333 +    connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
  32.334  	
  32.335 -    a = new QAction( tr( "Open" ), QPixmap( fileopen_xpm), tr( "&Open..." ), CTRL + Key_O, this, "fileOpen" );
  32.336 -    connect( a, SIGNAL( activated() ), this, SLOT( fileLoad() ) );
  32.337 +    a = new QAction( QPixmap( iconPath+"fileopen.png"), tr( "&Open..." ),this);
  32.338 +	a->setStatusTip (tr( "Open","File menu" ) );
  32.339 +	a->setShortcut ( Qt::CTRL + Qt::Key_O );
  32.340      a->addTo( tb );
  32.341      a->addTo( menu );
  32.342 +    connect( a, SIGNAL( activated() ), this, SLOT( fileLoad() ) );
  32.343  	
  32.344 -	lastMapsMenu = new QPopupMenu (this);
  32.345 +	lastMapsMenu = new Q3PopupMenu (this);
  32.346  
  32.347      menu->insertItem (tr("Open Recent"),lastMapsMenu );
  32.348      menu->insertSeparator();
  32.349  	
  32.350 -    a = new QAction( tr( "Save" ), QPixmap( filesave_xpm ), tr( "&Save..." ), CTRL + Key_S, this, "fileSave" );
  32.351 -    connect( a, SIGNAL( activated() ), this, SLOT( fileSave() ) );
  32.352 +    a = new QAction( QPixmap( iconPath+"filesave.png"), tr( "&Save..." ), this);
  32.353 +	a->setStatusTip ( tr( "Save" ));
  32.354 +	a->setShortcut (Qt::CTRL + Qt::Key_S );
  32.355      a->addTo( tb );
  32.356      a->addTo( menu );
  32.357 +    connect( a, SIGNAL( activated() ), this, SLOT( fileSave() ) );
  32.358  	actionFileSave=a;
  32.359  	
  32.360 -    a = new QAction( tr( "Save &As" ), QPixmap(), tr( "Save &As..." ), 0, this, "fileSaveAs" );
  32.361 +    a = new QAction( QPixmap(iconPath+"filesaveas.png"), tr( "Save &As..." ), this);
  32.362 +	a->setStatusTip (tr( "Save &As" ) );
  32.363 +    a->addTo( menu );
  32.364      connect( a, SIGNAL( activated() ), this, SLOT( fileSaveAs() ) );
  32.365 -    a->addTo( menu );
  32.366  
  32.367      menu->insertSeparator();
  32.368  
  32.369 -    a = new QAction( tr( "Import directory structure (experimental)" ), QPixmap(), tr( "Import Dir" ), 0, this, "export" );
  32.370 +	importMenu = new Q3PopupMenu (this);
  32.371 +    menu->insertItem (tr("Import"),importMenu );
  32.372 +
  32.373 +	a = new QAction(tr("KDE Bookmarks"), this);
  32.374 +	a->setStatusTip ( tr( "Import")+" "+tr("KDE Bookmarks" ));
  32.375 +	a->addTo (importMenu);
  32.376 +	connect( a, SIGNAL( activated() ), this, SLOT( fileImportKDEBookmarks() ) );
  32.377 +
  32.378 +    if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) 
  32.379 +	{
  32.380 +		a = new QAction( QPixmap(), tr("Firefox Bookmarks"),this);
  32.381 +		a->setStatusTip (tr( "Import")+" "+tr("Firefox Bookmarks" ) );
  32.382 +		a->addTo (importMenu);
  32.383 +		connect( a, SIGNAL( activated() ), this, SLOT( fileImportFirefoxBookmarks() ) );
  32.384 +	}	
  32.385 +
  32.386 +	a = new QAction("Mind Manager...",this);
  32.387 +	a->setStatusTip ( tr( "Import")+" Mind Manager"  );
  32.388 +	a->addTo (importMenu);
  32.389 +	connect( a, SIGNAL( activated() ), this, SLOT( fileImportMM() ) );
  32.390 +
  32.391 +    a = new QAction( tr( "Import Dir"+QString("...") ), this);
  32.392 +	a->setStatusTip (tr( "Import directory structure (experimental)" ) );
  32.393 +    a->addTo( importMenu);
  32.394      connect( a, SIGNAL( activated() ), this, SLOT( fileImportDir() ) );
  32.395 -    a->addTo( menu );
  32.396  
  32.397 -	exportMenu = new QPopupMenu (this);
  32.398 +	exportMenu = new Q3PopupMenu (this);
  32.399      menu->insertItem (tr("Export"),exportMenu );
  32.400  
  32.401      menu->insertSeparator();
  32.402  
  32.403  
  32.404 -    a = new QAction( tr( "Print" ), QPixmap( fileprint_xpm ), tr( "&Print..." ), CTRL + Key_P, this, "filePrint" );
  32.405 -    connect( a, SIGNAL( activated() ), this, SLOT( filePrint() ) );
  32.406 +    a = new QAction(QPixmap( iconPath+"fileprint.png"), tr( "&Print")+QString("..."), this);
  32.407 +	a->setStatusTip ( tr( "Print" ) );
  32.408 +	a->setShortcut (Qt::CTRL + Qt::Key_P );
  32.409      a->addTo( tb );
  32.410      a->addTo( menu );
  32.411 +    connect( a, SIGNAL( activated() ), this, SLOT( filePrint() ) );
  32.412  	actionFilePrint=a;
  32.413  
  32.414 -    a = new QAction( tr( "Close Map" ), QPixmap(), tr( "&Close Map" ), ALT + Key_C, this, "fileCloseMap" );
  32.415 +    a = new QAction( QPixmap(iconPath+"fileclose.png"), tr( "&Close Map" ), this);
  32.416 +	a->setStatusTip (tr( "Close Map" ) );
  32.417 +	a->setShortcut (Qt::ALT + Qt::Key_C );
  32.418 +    a->addTo( menu );
  32.419      connect( a, SIGNAL( activated() ), this, SLOT( fileCloseMap() ) );
  32.420 +
  32.421 +    a = new QAction(QPixmap(iconPath+"exit.png"), tr( "E&xit")+" "+__VYM, this);
  32.422 +	a->setStatusTip ( tr( "Exit")+" "+__VYM );
  32.423 +	a->setShortcut (Qt::CTRL + Qt::Key_Q );
  32.424      a->addTo( menu );
  32.425 -
  32.426 -    a = new QAction( tr( "Exit VYM" ), QPixmap(), tr( "E&xit VYM" ), CTRL + Key_Q, this, "fileExitVYM" );
  32.427      connect( a, SIGNAL( activated() ), this, SLOT( fileExitVYM() ) );
  32.428 -    a->addTo( menu );
  32.429  }
  32.430  
  32.431  
  32.432  //Edit Actions
  32.433  void Main::setupEditActions()
  32.434  {
  32.435 -    QToolBar *tb = new QToolBar( this );
  32.436 +    Q3ToolBar *tb = new Q3ToolBar( this );
  32.437      tb->setLabel( "Edit Actions" );
  32.438 -    QPopupMenu *menu = new QPopupMenu( this );
  32.439 +    Q3PopupMenu *menu = new Q3PopupMenu( this );
  32.440      menuBar()->insertItem( tr( "&Edit" ), menu );
  32.441  
  32.442      QAction *a;
  32.443 -    a = new QAction( tr( "Undo" ), QPixmap( editundo_xpm ), tr( "&Undo" ), CTRL + Key_Z, this, "editUndo" );
  32.444 +	QAction *alt;
  32.445 +    a = new QAction( QPixmap( iconPath+"undo.png"), tr( "&Undo" ),this);
  32.446      connect( a, SIGNAL( activated() ), this, SLOT( editUndo() ) );
  32.447 +	a->setStatusTip (tr( "Undo" ) );
  32.448 +	a->setShortcut ( Qt::CTRL + Qt::Key_Z );
  32.449  	a->setEnabled (false);
  32.450      a->addTo( tb );
  32.451      a->addTo( menu );
  32.452  	actionEditUndo=a;
  32.453 -    /*
  32.454 -    a = new QAction( tr( "Redo" ), QPixmap( editredo_xpm ), tr( "&Redo" ), CTRL + Key_Y, this, "editRedo" ); 
  32.455 -    connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) );
  32.456 -    a->addTo( tb );
  32.457 -    a->addTo( menu );
  32.458 -    */
  32.459 +    
  32.460 +    if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) 
  32.461 +	{
  32.462 +		a = new QAction( QPixmap( iconPath+"redo.png"), tr( "&Redo" ), this); 
  32.463 +		a->setStatusTip (tr( "Redo" ));
  32.464 +		a->setShortcut (Qt::CTRL + Qt::Key_Y );
  32.465 +		a->addTo( tb );
  32.466 +		a->addTo( menu );
  32.467 +		connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) );
  32.468 +	}
  32.469 +   
  32.470      menu->insertSeparator();
  32.471 -    a = new QAction( tr( "Copy" ), QPixmap( editcopy_xpm ), tr( "&Copy" ), CTRL + Key_C, this, "editCopy" );
  32.472 -    connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
  32.473 +    a = new QAction(QPixmap( iconPath+"editcopy.png"), tr( "&Copy" ), this);
  32.474 +	a->setStatusTip ( tr( "Copy" ) );
  32.475 +	a->setShortcut (Qt::CTRL + Qt::Key_C );
  32.476  	a->setEnabled (false);
  32.477      a->addTo( tb );
  32.478      a->addTo( menu );
  32.479 +    connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
  32.480  	actionEditCopy=a;
  32.481 -    a = new QAction( tr( "Cut" ), QPixmap( editcut_xpm ), tr( "Cu&t" ), CTRL + Key_X, this, "editCut" );
  32.482 -    connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
  32.483 +	
  32.484 +    a = new QAction(QPixmap( iconPath+"editcut.png" ), tr( "Cu&t" ), this);
  32.485 +	a->setStatusTip ( tr( "Cut" ) );
  32.486 +	a->setShortcut (Qt::CTRL + Qt::Key_X );
  32.487  	a->setEnabled (false);
  32.488      a->addTo( tb );
  32.489      a->addTo( menu );
  32.490  	actionEditCut=a;
  32.491 -    a = new QAction( tr( "Paste" ), QPixmap( editpaste_xpm ), tr( "&Paste" ), CTRL + Key_V, this, "editPaste" );
  32.492 +    connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
  32.493 +	
  32.494 +    a = new QAction(QPixmap( iconPath+"editpaste.png"), tr( "&Paste" ),this);
  32.495      connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) );
  32.496 +	a->setStatusTip ( tr( "Paste" ) );
  32.497 +	a->setShortcut ( Qt::CTRL + Qt::Key_V );
  32.498  	a->setEnabled (false);
  32.499      a->addTo( tb );
  32.500      a->addTo( menu );
  32.501  	actionEditPaste=a;
  32.502 -    a = new QAction( tr( "Move branch up" ), QPixmap( editmoveup_xpm ), tr( "Move up" ), Key_PageUp, this, "editMoveUp" );
  32.503 -    connect( a, SIGNAL( activated() ), this, SLOT( editMoveUp() ) );
  32.504 +
  32.505 +    a = new QAction(QPixmap(iconPath+"up.png" ), tr( "Move up" ), this);
  32.506 +	a->setStatusTip ( tr( "Move branch up" ) );
  32.507 +	a->setShortcut (Qt::Key_PageUp );
  32.508  	a->setEnabled (false);
  32.509      a->addTo( tb );
  32.510      a->addTo( menu );
  32.511 +    connect( a, SIGNAL( activated() ), this, SLOT( editMoveUp() ) );
  32.512  	actionEditMoveUp=a;
  32.513 -    a = new QAction( tr( "Move branch down" ), QPixmap( editmovedown_xpm ), tr( "Move down" ), Key_PageDown, this, "editMoveDown" );
  32.514 +
  32.515 +    a = new QAction( QPixmap( iconPath+"down.png"), tr( "Move down" ),this);
  32.516      connect( a, SIGNAL( activated() ), this, SLOT( editMoveDown() ) );
  32.517 +	a->setStatusTip (tr( "Move branch down" ) );
  32.518 +	a->setShortcut ( Qt::Key_PageDown );
  32.519  	a->setEnabled (false);
  32.520      a->addTo( tb );
  32.521      a->addTo( menu );
  32.522  	actionEditMoveDown=a;
  32.523 +	
  32.524  
  32.525 -    a = new QAction( tr( "Scroll branch" ), QPixmap(flag_scrolled_right_xpm), tr( "Scroll branch" ), Key_ScrollLock, this, "scroll" );
  32.526 +	a = new QAction( QPixmap(flagsPath+"flag-scrolled-right.png"), tr( "Scroll branch" ),this);
  32.527 +	a->setShortcut ( Qt::Key_ScrollLock );
  32.528 +	a->setStatusTip (tr( "Scroll branch" ) );
  32.529      connect( a, SIGNAL( activated() ), this, SLOT( editToggleScroll() ) );
  32.530 -	a->setEnabled (false);
  32.531 -    a->addTo( tb );
  32.532 +	alt = new QAction( QPixmap(flagsPath+"flag-scrolled-right.png"), tr( "Scroll branch" ), this);
  32.533 +	alt->setShortcut ( Qt::Key_S );
  32.534 +	alt->setStatusTip (tr( "Scroll branch" )); 
  32.535 +    connect( alt, SIGNAL( activated() ), this, SLOT( editToggleScroll() ) );
  32.536 +	#if defined(Q_OS_MACX)
  32.537 +		actionEditToggleScroll=alt;
  32.538 +	#else	
  32.539 +		actionEditToggleScroll=a;
  32.540 +	#endif	
  32.541 +	actionEditToggleScroll->setEnabled (false);
  32.542 +	actionEditToggleScroll->setToggleAction(true);
  32.543 +    actionEditToggleScroll->addTo( tb );
  32.544 +    actionEditToggleScroll->addTo( menu );
  32.545 +	actionListBranches.append(actionEditToggleScroll);
  32.546 +	
  32.547 +    a = new QAction( tr( "Unscroll all scrolled branches" ), this);
  32.548 +	a->setStatusTip (tr( "Unscroll all" ));
  32.549      a->addTo( menu );
  32.550 -	actionEditToggleScroll=a;
  32.551 -	
  32.552 -    a = new QAction( tr( "Unscroll all" ), QPixmap(), tr( "Unscroll all scrolled branches" ), 0, this, "scroll" );
  32.553      connect( a, SIGNAL( activated() ), this, SLOT( editUnScrollAll() ) );
  32.554 -    a->addTo( menu );
  32.555  	
  32.556      menu->insertSeparator();
  32.557  
  32.558 -	a = new QAction( tr( "Find" ), QPixmap(), tr( "Find" ), CTRL + Key_F, this, "find" );
  32.559 +	a = new QAction( QPixmap(iconPath+"find.png"), tr( "Find"+QString("...") ), this);
  32.560 +	a->setStatusTip (tr( "Find" ) );
  32.561 +	a->setShortcut (Qt::CTRL + Qt::Key_F );
  32.562 +    a->addTo( menu );
  32.563      connect( a, SIGNAL( activated() ), this, SLOT( editOpenFindWindow() ) );
  32.564 -    a->addTo( menu );
  32.565      
  32.566  	menu->insertSeparator();
  32.567  
  32.568 -	a = new QAction( tr( "Open URL" ), QPixmap(flag_url_xpm), tr( "Open URL" ), CTRL + Key_U, this, "url" );
  32.569 -    connect( a, SIGNAL( activated() ), this, SLOT( editOpenURL() ) );
  32.570 -    a->addTo( menu );
  32.571 +	a = new QAction( QPixmap(flagsPath+"flag-url.png"), tr( "Open URL" ), this);
  32.572 +	a->setShortcut (Qt::CTRL + Qt::Key_U );
  32.573 +	a->setShortcut (tr( "Open URL" ));
  32.574      a->addTo( tb );
  32.575  	a->setEnabled (false);
  32.576 +    connect( a, SIGNAL( activated() ), this, SLOT( editOpenURL() ) );
  32.577  	actionEditOpenURL=a;
  32.578  
  32.579 -	a = new QAction( tr( "Edit URL" ), QPixmap(), tr( "Edit URL" ), SHIFT + CTRL + Key_U, this, "url" );
  32.580 +	a = new QAction( tr( "Open URL in new tab" ), this);
  32.581 +	a->setStatusTip (tr( "Open URL in new tab" ));
  32.582 +	a->setShortcut (Qt::CTRL+Qt::Key_U );
  32.583 +	a->setEnabled (false);
  32.584 +    connect( a, SIGNAL( activated() ), this, SLOT( editOpenURLTab() ) );
  32.585 +	actionEditOpenURLTab=a;
  32.586 +
  32.587 +	a = new QAction(QPixmap(), tr( "Edit URL"+QString("...") ), this);
  32.588 +	a->setStatusTip ( tr( "Edit URL" ) );
  32.589 +	a->setShortcut (Qt::SHIFT + Qt::CTRL+Qt::Key_U );
  32.590 +	a->setEnabled (false);
  32.591 +	actionListBranches.append(a);
  32.592      connect( a, SIGNAL( activated() ), this, SLOT( editURL() ) );
  32.593 -    a->addTo( menu );
  32.594 -	a->setEnabled (false);
  32.595  	actionEditURL=a;
  32.596  	
  32.597 -	a = new QAction( tr( "Use heading of selected branch as URL" ), QPixmap(), tr( "Use heading for URL" ), 0, this, "heading2url" );
  32.598 +	a = new QAction( tr( "Use heading for URL" ), this);
  32.599 +	a->setStatusTip ( tr( "Use heading of selected branch as URL" ));
  32.600 +	a->setEnabled (false);
  32.601 +	actionListBranches.append(a);
  32.602      connect( a, SIGNAL( activated() ), this, SLOT( editHeading2URL() ) );
  32.603 -    a->addTo( menu );
  32.604 -	a->setEnabled (false);
  32.605  	actionEditHeading2URL=a;
  32.606      
  32.607 -	a = new QAction( tr( "Create URL to Bugzilla" ), QPixmap(), tr( "Create URL to Bugzilla" ), 0, this, "bugzilla2url" );
  32.608 +	a = new QAction(tr( "Create URL to Bugzilla" ), this);
  32.609 +	a->setStatusTip ( tr( "Create URL to Bugzilla" ));
  32.610 +	a->setEnabled (false);
  32.611 +	actionListBranches.append(a);
  32.612      connect( a, SIGNAL( activated() ), this, SLOT( editBugzilla2URL() ) );
  32.613 -	a->setEnabled (false);
  32.614  	actionEditBugzilla2URL=a;
  32.615      
  32.616 -	menu->insertSeparator();
  32.617 +	a = new QAction(tr( "Create URL to FATE" ), this);
  32.618 +	a->setStatusTip ( tr( "Create URL to FATE" ));
  32.619 +	a->setEnabled (false);
  32.620 +	actionListBranches.append(a);
  32.621 +    connect( a, SIGNAL( activated() ), this, SLOT( editFATE2URL() ) );
  32.622 +	actionEditFATE2URL=a;
  32.623  	
  32.624 -    a = new QAction( tr( "Jump to another vym map, if needed load it first" ), QPixmap(flag_vymlink_xpm), tr( "Jump to map" ), 0, this, "jumpMap" );
  32.625 -    connect( a, SIGNAL( activated() ), this, SLOT( editOpenVymLink() ) );
  32.626 -    a->addTo( menu );
  32.627 +    a = new QAction(QPixmap(flagsPath+"flag-vymlink.png"), tr( "Jump to map" ), this);
  32.628 +	a->setStatusTip ( tr( "Jump to another vym map, if needed load it first" ));
  32.629      a->addTo( tb );
  32.630  	a->setEnabled (false);
  32.631 +    connect( a, SIGNAL( activated() ), this, SLOT( editOpenVymLink() ) );
  32.632  	actionEditOpenVymLink=a;
  32.633  	
  32.634 -    a = new QAction( tr( "Edit link to another vym map" ), QPixmap(), tr( "Edit vym link" ), 0, this, "editLinkMap" );
  32.635 +    a = new QAction(tr( "Edit vym link"+QString("...") ), this);
  32.636 +	a->setEnabled (false);
  32.637 +	a->setStatusTip ( tr( "Edit link to another vym map" ));
  32.638      connect( a, SIGNAL( activated() ), this, SLOT( editVymLink() ) );
  32.639 -    a->addTo( menu );
  32.640 -	a->setEnabled (false);
  32.641 +	actionListBranches.append(a);
  32.642  	actionEditVymLink=a;
  32.643  
  32.644 -    a = new QAction( tr( "Delete link to another vym map" ), QPixmap(), tr( "Delete vym link" ), 0, this, "deleteLinkMap" );
  32.645 +    a = new QAction(tr( "Delete vym link" ),this);
  32.646 +	a->setStatusTip ( tr( "Delete link to another vym map" ));
  32.647 +	a->setEnabled (false);
  32.648      connect( a, SIGNAL( activated() ), this, SLOT( editDeleteVymLink() ) );
  32.649 -    a->addTo( menu );
  32.650 -	a->setEnabled (false);
  32.651  	actionEditDeleteVymLink=a;
  32.652  
  32.653 -	menu->insertSeparator();
  32.654 +    a = new QAction(QPixmap(flagsPath+"flag-hideexport.png"), tr( "Hide in exports" ), this);
  32.655 +	a->setStatusTip ( tr( "Hide object in exports" ) );
  32.656 +	a->setShortcut (Qt::Key_H );
  32.657 +	a->setToggleAction(true);
  32.658 +    a->addTo( tb );
  32.659 +	a->setEnabled (false);
  32.660 +    connect( a, SIGNAL( activated() ), this, SLOT( editToggleHideExport() ) );
  32.661 +	actionEditToggleHideExport=a;
  32.662  
  32.663 -    a = new QAction( tr( "Edit Map Info" ), QPixmap(), tr( "Edit Map Info" ), 0, this, "editMapInfo" );
  32.664 +    a = new QAction(tr( "Edit Map Info"+QString("...") ),this);
  32.665 +	a->setStatusTip ( tr( "Edit Map Info" ));
  32.666 +	a->setEnabled (true);
  32.667      connect( a, SIGNAL( activated() ), this, SLOT( editMapInfo() ) );
  32.668 -    a->addTo( menu );
  32.669 -	a->setEnabled (true);
  32.670  	actionEditMapInfo=a;
  32.671  
  32.672  	menu->insertSeparator();
  32.673  
  32.674      // Shortcuts to modify heading:
  32.675 -    a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_Enter, this, "editHeading" );
  32.676 +    a = new QAction(tr( "Edit heading" ),this);
  32.677 +	a->setStatusTip ( tr( "edit Heading" ));
  32.678 +	a->setShortcut ( Qt::Key_Enter );
  32.679 +    connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
  32.680 +	actionListBranches.append(a);
  32.681 +    a = new QAction( tr( "Edit heading" ), this);
  32.682 +	a->setStatusTip (tr( "edit Heading" ));
  32.683 +	a->setShortcut (Qt::Key_Return );
  32.684 +    connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
  32.685 +	actionListBranches.append(a);
  32.686 +	actionEditHeading=a;
  32.687 +    a = new QAction( tr( "Edit heading" ),this);
  32.688 +	a->setStatusTip (tr( "edit Heading" ));
  32.689 +	a->setShortcut ( Qt::Key_F2 );
  32.690      connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
  32.691  	a->setEnabled (false);
  32.692 -    a->addTo ( menu );
  32.693  	actionEditHeading=a;
  32.694 -    a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_Return, this, "editHeading" );
  32.695 -    connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
  32.696 -    //a->addTo ( menu );
  32.697 +	actionListBranches.append(a);
  32.698      
  32.699      // Shortcut to delete selection
  32.700 -    a = new QAction( tr( "Delete Selection" ),tr( "Delete Selection" ), Key_Delete, this, "deleteBranch" );
  32.701 +    a = new QAction( tr( "Delete Selection" ),this);
  32.702 +	a->setStatusTip (tr( "Delete Selection" ));
  32.703 +	a->setShortcut ( Qt::Key_Delete);
  32.704      connect( a, SIGNAL( activated() ), this, SLOT( editDeleteSelection() ) );
  32.705  	a->setEnabled (false);
  32.706 -    a->addTo ( menu );
  32.707  	actionEditDelete=a;
  32.708      
  32.709      // Shortcut to add branch
  32.710 +	alt = new QAction(tr( "Add branch as child" ), this);
  32.711 +	alt->setStatusTip ( tr( "Add a branch as child of selection" ));
  32.712 +	alt->setShortcut (Qt::Key_A);
  32.713 +    connect( alt, SIGNAL( activated() ), this, SLOT( editNewBranch() ) );
  32.714 +	a = new QAction(tr( "Add branch as child" ), this);
  32.715 +	a->setStatusTip ( tr( "Add a branch as child of selection" ));
  32.716 +	a->setShortcut (Qt::Key_Insert);	
  32.717 +	a->setEnabled (false);
  32.718 +    connect( a, SIGNAL( activated() ), this, SLOT( editNewBranch() ) );
  32.719 +	actionListBranches.append(a);
  32.720  	#if defined (Q_OS_MACX)
  32.721 -		a = new QAction( tr( "Add a branch as child of selection" ),tr( "Add branch as child" ), CTRL + Key_I, this, "newBranch" );
  32.722 -	#else
  32.723 -		a = new QAction( tr( "Add a branch as child of selection" ),tr( "Add branch as child" ), Key_Insert, this, "newBranch" );
  32.724 -	#endif
  32.725 -    connect( a, SIGNAL( activated() ), this, SLOT( editNewBranch() ) );
  32.726 +		// In OSX show different shortcut in menues, the keys work independtly always			
  32.727 +		actionEditAddBranch=alt;
  32.728 +	#else	
  32.729 +		actionEditAddBranch=a;
  32.730 +	#endif	
  32.731 +
  32.732 +    // Add branch by inserting it at selection
  32.733 +	a = new QAction(tr( "Add branch (insert)" ), this);
  32.734 +	a->setStatusTip ( tr( "Add a branch by inserting and making selection its child" ));
  32.735 +	a->setShortcut (Qt::ALT + Qt::Key_Insert );
  32.736 +    connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchHere() ) );
  32.737  	a->setEnabled (false);
  32.738 -    a->addTo ( menu );
  32.739 -	actionEditAddBranch=a;
  32.740 +	actionListBranches.append(a);
  32.741 +	actionEditAddBranchHere=a;
  32.742 +	a = new QAction(tr( "Add branch (insert)" ),this);
  32.743 +	a->setStatusTip ( tr( "Add a branch by inserting and making selection its child" ));
  32.744 +	a->setShortcut ( Qt::ALT + Qt::Key_A );
  32.745 +    connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchHere() ) );
  32.746 +	actionListBranches.append(a);
  32.747  
  32.748  	// Add branch above
  32.749 -    a = new QAction( tr( "Add a branch above selection" ),tr( "Add branch above" ), SHIFT+Key_Insert, this, "newBranch" );
  32.750 +    a = new QAction(tr( "Add branch above" ), this);
  32.751 +	a->setStatusTip ( tr( "Add a branch above selection" ));
  32.752 +	a->setShortcut (Qt::SHIFT+Qt::Key_Insert );
  32.753      connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchAbove() ) );
  32.754  	a->setEnabled (false);
  32.755 -    a->addTo ( menu );
  32.756 +	actionListBranches.append(a);
  32.757  	actionEditAddBranchAbove=a;
  32.758 +    a = new QAction(tr( "Add branch above" ), this);
  32.759 +	a->setStatusTip ( tr( "Add a branch above selection" ));
  32.760 +	a->setShortcut (Qt::SHIFT+Qt::Key_A );
  32.761 +    connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchAbove() ) );
  32.762 +	actionListBranches.append(a);
  32.763  
  32.764  	// Add branch below 
  32.765 -    a = new QAction( tr( "Add a branch below selection" ),tr( "Add branch below" ), CTRL +Key_Insert, this, "newBranch" );
  32.766 +    a = new QAction(tr( "Add branch below" ), this);
  32.767 +	a->setStatusTip ( tr( "Add a branch below selection" ));
  32.768 +	a->setShortcut (Qt::CTRL +Qt::Key_Insert );
  32.769      connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchBelow() ) );
  32.770  	a->setEnabled (false);
  32.771 -    a->addTo ( menu );
  32.772 +	actionListBranches.append(a);
  32.773  	actionEditAddBranchBelow=a;
  32.774 +    a = new QAction(tr( "Add branch below" ), this);
  32.775 +	a->setStatusTip ( tr( "Add a branch below selection" ));
  32.776 +	a->setShortcut (Qt::CTRL +Qt::Key_A );
  32.777 +    connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchBelow() ) );
  32.778 +	actionListBranches.append(a);
  32.779  
  32.780  	// Import at selection (adding to selection)
  32.781 -    a = new QAction( tr( "Add map at selection" ),tr( "Import (add)" ), 0, this, "importAdd" );
  32.782 +    a = new QAction( tr( "Add map (insert)" ),this);
  32.783 +	a->setStatusTip (tr( "Add map at selection" ));
  32.784      connect( a, SIGNAL( activated() ), this, SLOT( editImportAdd() ) );
  32.785  	a->setEnabled (false);
  32.786 -    a->addTo ( menu );
  32.787 +	actionListBranches.append(a);
  32.788  	actionEditImportAdd=a;
  32.789  
  32.790  	// Import at selection (replacing selection)
  32.791 -    a = new QAction( tr( "Replace selection with map" ),tr( "Import (replace)" ), 0, this, "importReplace" );
  32.792 +    a = new QAction( tr( "Add map (replace)" ), this);
  32.793 +	a->setStatusTip (tr( "Replace selection with map" ));
  32.794      connect( a, SIGNAL( activated() ), this, SLOT( editImportReplace() ) );
  32.795  	a->setEnabled (false);
  32.796 -    a->addTo ( menu );
  32.797 +	actionListBranches.append(a);
  32.798  	actionEditImportReplace=a;
  32.799  
  32.800  	// Save selection 
  32.801 -    a = new QAction( tr( "Save selction" ),tr( "Save selection" ), 0, this, "saveSelection" );
  32.802 +    a = new QAction( tr( "Save selection" ), this);
  32.803 +	a->setStatusTip (tr( "Save selection" ));
  32.804      connect( a, SIGNAL( activated() ), this, SLOT( editSaveBranch() ) );
  32.805  	a->setEnabled (false);
  32.806 -    a->addTo ( menu );
  32.807 +	actionListBranches.append(a);
  32.808  	actionEditSaveBranch=a;
  32.809  
  32.810 +	// Only remove branch, not its childs
  32.811 +    a = new QAction(tr( "Remove only branch " ), this);
  32.812 +	a->setStatusTip ( tr( "Remove only branch and keep its childs" ));
  32.813 +	a->setShortcut (Qt::ALT + Qt::Key_Delete );
  32.814 +    connect( a, SIGNAL( activated() ), this, SLOT( editRemoveBranchKeepChilds() ) );
  32.815 +	a->setEnabled (false);
  32.816 +	actionListBranches.append(a);
  32.817 +	actionEditRemoveBranchKeepChilds=a;
  32.818 +
  32.819 +	// Only remove childs of a branch
  32.820 +    a = new QAction( tr( "Remove childs" ), this);
  32.821 +	a->setStatusTip (tr( "Remove childs of branch" ));
  32.822 +	a->setShortcut (Qt::SHIFT + Qt::Key_Delete );
  32.823 +    connect( a, SIGNAL( activated() ), this, SLOT( editRemoveChilds() ) );
  32.824 +	a->setEnabled (false);
  32.825 +	actionListBranches.append(a);
  32.826 +	actionEditRemoveChilds=a;
  32.827 +
  32.828      // Shortcuts for navigating with cursor:
  32.829 -    a = new QAction( tr( "Select upper branch" ),tr( "Select upper branch" ), Key_Up, this, "upperBranch" );
  32.830 +    a = new QAction(tr( "Select upper branch" ), this);
  32.831 +	a->setStatusTip ( tr( "Select upper branch" ));
  32.832 +	a->setShortcut (Qt::Key_Up );
  32.833      connect( a, SIGNAL( activated() ), this, SLOT( editUpperBranch() ) );
  32.834 -    a = new QAction( tr( "Select lower branch" ),tr( "Select lower branch" ), Key_Down, this, "lowerBranch" );
  32.835 +    a = new QAction( tr( "Select lower branch" ),this);
  32.836 +	a->setStatusTip (tr( "Select lower branch" ));
  32.837 +	a->setShortcut ( Qt::Key_Down );
  32.838      connect( a, SIGNAL( activated() ), this, SLOT( editLowerBranch() ) );
  32.839 -    a = new QAction( tr( "Select left branch" ),tr( "Select left branch" ), Key_Left, this, "upperBranch" );
  32.840 +    a = new QAction(tr( "Select left branch" ), this);
  32.841 +	a->setStatusTip ( tr( "Select left branch" ));
  32.842 +	a->setShortcut (Qt::Key_Left );
  32.843      connect( a, SIGNAL( activated() ), this, SLOT( editLeftBranch() ) );
  32.844 -    a = new QAction( tr( "Select right branch" ),tr( "Select child branch" ), Key_Right, this, "rightBranch" );
  32.845 +    a = new QAction( tr( "Select child branch" ), this);
  32.846 +	a->setStatusTip (tr( "Select right branch" ));
  32.847 +	a->setShortcut (Qt::Key_Right);
  32.848      connect( a, SIGNAL( activated() ), this, SLOT( editRightBranch() ) );
  32.849 -    a = new QAction( tr( "Select first branch" ),tr( "Select first branch" ), Key_Home, this, "firstBranch" );
  32.850 +    a = new QAction( tr( "Select first branch" ), this);
  32.851 +	a->setStatusTip (tr( "Select first branch" ));
  32.852 +	a->setShortcut (Qt::Key_Home );
  32.853  	a->setEnabled (false);
  32.854      a->addTo ( menu );
  32.855 +	actionListBranches.append(a);
  32.856  	actionEditSelectFirst=a;
  32.857      connect( a, SIGNAL( activated() ), this, SLOT( editFirstBranch() ) );
  32.858 -    a = new QAction( tr( "Select last branch" ),tr( "Select last branch" ), Key_End, this, "lastBranch" );
  32.859 +    a = new QAction( tr( "Select last branch" ),this);
  32.860 +	a->setStatusTip (tr( "Select last branch" ));
  32.861 +	a->setShortcut ( Qt::Key_End );
  32.862      connect( a, SIGNAL( activated() ), this, SLOT( editLastBranch() ) );
  32.863  	a->setEnabled (false);
  32.864      a->addTo ( menu );
  32.865 +	actionListBranches.append(a);
  32.866  	actionEditSelectLast=a;
  32.867  
  32.868 -    a = new QAction( tr( "Add Image" ),tr( "Add Image" ), 0, this, "loadImage" );
  32.869 +    a = new QAction( tr( "Add Image" )+QString("..."), this);
  32.870 +	a->setStatusTip (tr( "Add Image" ));
  32.871      connect( a, SIGNAL( activated() ), this, SLOT( editLoadImage() ) );
  32.872  	actionEditLoadImage=a;
  32.873 +
  32.874  }
  32.875  
  32.876  // Format Actions
  32.877  void Main::setupFormatActions()
  32.878  {
  32.879 -    QPopupMenu *menu = new QPopupMenu( this );
  32.880 -    menuBar()->insertItem( tr( "&Format" ), menu );
  32.881 +    Q3PopupMenu *menu = new Q3PopupMenu( this );
  32.882 +    menuBar()->insertItem( tr( "F&ormat" ), menu );
  32.883  
  32.884 -    QToolBar *tb = new QToolBar( this );
  32.885 +    Q3ToolBar *tb = new Q3ToolBar( this );
  32.886      QAction *a;
  32.887      QPixmap pix( 16,16);
  32.888 -    pix.fill (black);
  32.889 -    actionFormatColor= new QAction( tr( "Set Color" ), pix, tr( "Set &Color" ), 0, this, "formatColor" );
  32.890 -    connect( actionFormatColor, SIGNAL( activated() ), this, SLOT( formatSelectColor() ) );
  32.891 -    actionFormatColor->addTo( tb );
  32.892 -    actionFormatColor->addTo( menu );
  32.893 -    a= new QAction( tr( "Pick color\nHint: You can pick a color from another branch and color using CTRL+Left Button" ), QPixmap(formatcolorpicker_xpm), tr( "Pic&k color" ), CTRL + Key_K, this, "pickColor" );
  32.894 +    pix.fill (Qt::black);
  32.895 +    a= new QAction(pix, tr( "Set &Color" )+QString("..."), this);
  32.896 +	a->setStatusTip ( tr( "Set Color" ));
  32.897 +    connect( a, SIGNAL( activated() ), this, SLOT( formatSelectColor() ) );
  32.898 +    a->addTo( tb );
  32.899 +    a->addTo( menu );
  32.900 +	actionFormatColor=a;
  32.901 +    a= new QAction( QPixmap(iconPath+"formatcolorpicker.png"), tr( "Pic&k color" ), this);
  32.902 +	a->setStatusTip (tr( "Pick color\nHint: You can pick a color from another branch and color using CTRL+Left Button" ) );
  32.903 +	a->setShortcut (Qt::CTRL + Qt::Key_K );
  32.904      connect( a, SIGNAL( activated() ), this, SLOT( formatPickColor() ) );
  32.905  	a->setEnabled (false);
  32.906      a->addTo( tb );
  32.907      a->addTo( menu );
  32.908 +	actionListBranches.append(a);
  32.909  	actionFormatPickColor=a;
  32.910 -    a= new QAction( tr( "Color branch" ), QPixmap(formatcoloritem_xpm), tr( "Color &branch" ), CTRL + Key_I, this, "colorItem" );
  32.911 +
  32.912 +    a= new QAction(QPixmap(iconPath+"formatcoloritem.png"), tr( "Color &branch" ), this);
  32.913 +	a->setStatusTip ( tr( "Color branch" ) );
  32.914 +	a->setShortcut (Qt::CTRL + Qt::Key_I);
  32.915      connect( a, SIGNAL( activated() ), this, SLOT( formatColorItem() ) );
  32.916  	a->setEnabled (false);
  32.917      a->addTo( tb );
  32.918      a->addTo( menu );
  32.919 +	actionListBranches.append(a);
  32.920  	actionFormatColorBranch=a;
  32.921 -    a= new QAction( tr( "Color Subtree" ), QPixmap(formatcolorbranch_xpm), tr( "Color sub&tree" ), CTRL + Key_T, this, "colorBranch" );
  32.922 +
  32.923 +    a= new QAction(QPixmap(iconPath+"formatcolorbranch.png"), tr( "Color sub&tree" ), this);
  32.924 +	a->setStatusTip ( tr( "Color Subtree" ));
  32.925 +	a->setShortcut (Qt::CTRL + Qt::Key_T);
  32.926      connect( a, SIGNAL( activated() ), this, SLOT( formatColorBranch() ) );
  32.927  	a->setEnabled (false);
  32.928      a->addTo( menu );
  32.929      a->addTo( tb );
  32.930 +	actionListBranches.append(a);
  32.931  	actionFormatColorSubtree=a;
  32.932  
  32.933      menu->insertSeparator();
  32.934 -	actionGroupFormatLinkStyles=new QActionGroup ( this, "formatLinkStyles");
  32.935 +	actionGroupFormatLinkStyles=new Q3ActionGroup ( this, "formatLinkStyles");
  32.936  	actionGroupFormatLinkStyles->setExclusive (true);
  32.937 -    a= new QAction( tr( "Line" ), QPixmap(), tr( "Linkstyle Line" ), 0, actionGroupFormatLinkStyles, "formatLinkStyleLine" );
  32.938 +    a= new QAction( tr( "Linkstyle Line" ), actionGroupFormatLinkStyles);
  32.939 +	a->setStatusTip (tr( "Line" ));
  32.940  	a->setToggleAction(true);
  32.941      connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStyleLine() ) );
  32.942  	actionFormatLinkStyleLine=a;
  32.943 -    a= new QAction( tr( "Line" ), QPixmap(), tr( "Linkstyle Parabel" ), 0, actionGroupFormatLinkStyles, "formatLinkStyleLine" );
  32.944 +    a= new QAction( tr( "Linkstyle Parabel" ), actionGroupFormatLinkStyles);
  32.945 +	a->setStatusTip (tr( "Line" ));
  32.946  	a->setToggleAction(true);
  32.947      connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStyleParabel() ) );
  32.948  	actionFormatLinkStyleParabel=a;
  32.949 -    a= new QAction( tr( "PolyLine" ), QPixmap(), tr( "Linkstyle Thick Line" ), 0, actionGroupFormatLinkStyles, "formatLinkStyleLine" );
  32.950 +    a= new QAction( tr( "Linkstyle Thick Line" ), actionGroupFormatLinkStyles );
  32.951 +	a->setStatusTip (tr( "PolyLine" ));
  32.952  	a->setToggleAction(true);
  32.953      connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStylePolyLine() ) );
  32.954  	actionFormatLinkStylePolyLine=a;
  32.955 -    a= new QAction( tr( "PolyParabel" ), QPixmap(), tr( "Linkstyle Thick Parabel" ), 0, actionGroupFormatLinkStyles, "formatLinkStylePolyParabel" );
  32.956 +    a= new QAction( tr( "Linkstyle Thick Parabel" ), actionGroupFormatLinkStyles);
  32.957 +	a->setStatusTip (tr( "PolyParabel" ) );
  32.958  	a->setToggleAction(true);
  32.959      connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStylePolyParabel() ) );
  32.960  	actionFormatLinkStylePolyParabel=a;
  32.961  	actionGroupFormatLinkStyles->addTo (menu);
  32.962  	
  32.963 -	actionGroupFormatFrameTypes=new QActionGroup ( this, "formatFrameTypes");
  32.964 +	actionGroupFormatFrameTypes=new Q3ActionGroup ( this, "formatFrameTypes");
  32.965  	actionGroupFormatFrameTypes->setExclusive (true);
  32.966 -    a = new QAction( tr( "No Frame" ),tr( "No Frame" ), 0, actionGroupFormatFrameTypes, "frameNone" );
  32.967 +    a = new QAction( tr( "No Frame" ), actionGroupFormatFrameTypes );
  32.968 +	a->setStatusTip (tr("No Frame"));
  32.969  	a->setToggleAction(true);
  32.970      connect( a, SIGNAL( activated() ), this, SLOT( formatFrameNone() ) );
  32.971  	actionFormatFrameNone=a;
  32.972 -    a = new QAction( tr( "Rectangle" ),tr( "Rectangle" ), 0, actionGroupFormatFrameTypes, "frameRectangle" );
  32.973 +    a = new QAction( tr( "Rectangle" ), actionGroupFormatFrameTypes);
  32.974 +	a->setStatusTip (tr( "Rectangle" ));
  32.975  	a->setToggleAction(true);
  32.976      connect( a, SIGNAL( activated() ), this, SLOT( formatFrameRectangle() ) );
  32.977  	actionFormatFrameRectangle=a;
  32.978  
  32.979 +    a = new QAction( tr( "Include images vertically" ),  actionFormatIncludeImagesVer);
  32.980 +	a->setStatusTip ( tr ("Include top and bottom position of images into branch"));
  32.981 +	a->setToggleAction(true);
  32.982 +    connect( a, SIGNAL( activated() ), this, SLOT( formatIncludeImagesVer() ) );
  32.983 +	actionFormatIncludeImagesVer=a;
  32.984 +
  32.985 +    a = new QAction( tr( "Include images horizontally" ),  actionFormatIncludeImagesHor );
  32.986 +	a->setStatusTip ( tr ("Include left and right position of images into branch"));
  32.987 +	a->setToggleAction(true);
  32.988 +    connect( a, SIGNAL( activated() ), this, SLOT( formatIncludeImagesHor() ) );
  32.989 +	actionFormatIncludeImagesHor=a;
  32.990 +
  32.991 +    a = new QAction( tr( "Hide link if object is not selected" ), actionFormatHideLinkUnselected);
  32.992 +	a->setStatusTip (tr( "Hide link" ));
  32.993 +	a->setToggleAction(true);
  32.994 +    connect( a, SIGNAL( activated() ), this, SLOT( formatHideLinkUnselected() ) );
  32.995 +	actionFormatHideLinkUnselected=a;
  32.996 +
  32.997      menu->insertSeparator();
  32.998 -    a= new QAction( tr( "Use same color for links and headings" ), QPixmap(), tr( "&Use color of heading for link" ), 0, this, "formatLinkColorHint" );
  32.999 +    a= new QAction( tr( "&Use color of heading for link" ),  this);
 32.1000 +	a->setStatusTip (tr( "Use same color for links and headings" ));
 32.1001  	a->setToggleAction(true);
 32.1002      connect( a, SIGNAL( activated() ), this, SLOT( formatToggleLinkColorHint() ) );
 32.1003  	a->addTo( menu );
 32.1004  	actionFormatLinkColorHint=a;
 32.1005 -    pix.fill (white);
 32.1006 -    actionFormatLinkColor= new QAction( tr( "Set Link Color" ), pix, tr( "Set &Link Color" ), 0, this, "formatLinkColor" );
 32.1007 -    connect( actionFormatLinkColor, SIGNAL( activated() ), this, SLOT( formatSelectLinkColor() ) );
 32.1008 -    actionFormatLinkColor->addTo( menu );
 32.1009 -    actionFormatBackColor= new QAction( tr( "Set Background Color" ), pix, tr( "Set &Background Color" ), 0, this, "formatBackColor" );
 32.1010 -    connect( actionFormatBackColor, SIGNAL( activated() ), this, SLOT( formatSelectBackColor() ) );
 32.1011 -    actionFormatBackColor->addTo( menu );
 32.1012 +
 32.1013 +    pix.fill (Qt::white);
 32.1014 +    a= new QAction( pix, tr( "Set &Link Color"+QString("...") ), this  );
 32.1015 +	a->setStatusTip (tr( "Set Link Color" ));
 32.1016 +    a->addTo( menu );
 32.1017 +    connect( a, SIGNAL( activated() ), this, SLOT( formatSelectLinkColor() ) );
 32.1018 +    actionFormatLinkColor=a;
 32.1019 +
 32.1020 +    a= new QAction( pix, tr( "Set &Background Color" )+QString("..."), this );
 32.1021 +	a->setStatusTip (tr( "Set Background Color" ));
 32.1022 +    a->addTo( menu );
 32.1023 +    connect( a, SIGNAL( activated() ), this, SLOT( formatSelectBackColor() ) );
 32.1024 +    actionFormatBackColor=a;
 32.1025  }
 32.1026  
 32.1027  // View Actions
 32.1028  void Main::setupViewActions()
 32.1029  {
 32.1030 -    QToolBar *tb = new QToolBar( this );
 32.1031 +    Q3ToolBar *tb = new Q3ToolBar( this );
 32.1032      tb->setLabel( "View Actions" );
 32.1033 -    QPopupMenu *menu = new QPopupMenu( this );
 32.1034 +    Q3PopupMenu *menu = new Q3PopupMenu( this );
 32.1035      menuBar()->insertItem( tr( "&View" ), menu );
 32.1036  
 32.1037      QAction *a;
 32.1038 -    a = new QAction( tr( "Zoom reset" ), QPixmap(viewzoomreset_xpm), tr( "reset Zoom" ), 0, this, "zoomReset" );
 32.1039 -    connect( a, SIGNAL( activated() ), this, SLOT(viewZoomReset() ) );
 32.1040 +    a = new QAction(QPixmap(iconPath+"viewmag-reset.png"), tr( "reset Zoom" ), this);
 32.1041 +	a->setStatusTip ( tr( "Zoom reset" ) );
 32.1042 +	a->setShortcut (Qt::CTRL + Qt::Key_0 );
 32.1043      a->addTo( tb );
 32.1044      a->addTo( menu );
 32.1045 -    a = new QAction( tr( "Zoom in" ), QPixmap(viewzoomin_xpm), tr( "Zoom in" ), CTRL + Key_Plus, this, "zoomIn" );
 32.1046 -    connect( a, SIGNAL( activated() ), this, SLOT(viewZoomIn() ) );
 32.1047 +    connect( a, SIGNAL( activated() ), this, SLOT(viewZoomReset() ) );
 32.1048 +	
 32.1049 +    a = new QAction( QPixmap(iconPath+"viewmag+.png"), tr( "Zoom in" ), this);
 32.1050 +	a->setStatusTip (tr( "Zoom in" ));
 32.1051 +	a->setShortcut (Qt::CTRL + Qt::Key_Plus);
 32.1052      a->addTo( tb );
 32.1053      a->addTo( menu );
 32.1054 -    a = new QAction( tr( "Zoom out" ), QPixmap(viewzoomout_xpm), tr( "Zoom out" ), CTRL + Key_Minus, this, "zoomOut" );
 32.1055 -    connect( a, SIGNAL( activated() ), this, SLOT( viewZoomOut() ) );
 32.1056 +    connect( a, SIGNAL( activated() ), this, SLOT(viewZoomIn() ) );
 32.1057 +	
 32.1058 +    a = new QAction( QPixmap(iconPath+"viewmag-.png"), tr( "Zoom out" ), this);
 32.1059 +	a->setStatusTip (tr( "Zoom out" ));
 32.1060 +	a->setShortcut (Qt::CTRL + Qt::Key_Minus );
 32.1061      a->addTo( tb );
 32.1062      a->addTo( menu );
 32.1063 -    a = new QAction( tr( "Toggle Note Editor" ), QPixmap(flag_note_xpm), tr( "Toggle Note Editor" ), CTRL + Key_E , this, "noteEditor" );
 32.1064 -    connect( a, SIGNAL( activated() ), this, SLOT(windowToggleNoteEditor() ) );
 32.1065 +    connect( a, SIGNAL( activated() ), this, SLOT( viewZoomOut() ) );
 32.1066 +
 32.1067 +
 32.1068 +    a = new QAction(QPixmap(flagsPath+"flag-note.png"), tr( "Show Note Editor" ),this);
 32.1069 +	a->setStatusTip ( tr( "Show Note Editor" ));
 32.1070 +	a->setShortcut ( Qt::CTRL + Qt::Key_E );
 32.1071  	a->setToggleAction(true);
 32.1072  	if (textEditor->showWithMain())
 32.1073  		a->setOn(true);
 32.1074 @@ -666,102 +942,348 @@
 32.1075  		a->setOn(false);
 32.1076      a->addTo( tb );
 32.1077      a->addTo( menu );
 32.1078 +    connect( a, SIGNAL( activated() ), this, SLOT(windowToggleNoteEditor() ) );
 32.1079  	actionViewToggleNoteEditor=a;
 32.1080 -    a = new QAction( tr( "&Next Window" ), QPixmap(), tr( "Next Window" ), ALT + Key_N , this, "nextWindow" );
 32.1081 +
 32.1082 +    a = new QAction(  tr( "Show history window" ),this );
 32.1083 +	a->setStatusTip ( tr( "Show history window" ));
 32.1084 +	a->setShortcut ( Qt::CTRL + Qt::Key_H  );
 32.1085 +	a->setToggleAction(false);
 32.1086 +    a->addTo( menu );
 32.1087 +    connect( a, SIGNAL( activated() ), this, SLOT(windowToggleHistory() ) );
 32.1088 +	actionViewToggleHistoryWindow=a;
 32.1089 +
 32.1090 +    a = new QAction(tr( "Next Window" ), this);
 32.1091 +	a->setStatusTip ( tr( "&Next Window" ) );
 32.1092 +	a->setShortcut (Qt::ALT + Qt::Key_N );
 32.1093 +    a->addTo( menu );
 32.1094      connect( a, SIGNAL( activated() ), this, SLOT(windowNextEditor() ) );
 32.1095 +
 32.1096 +    a = new QAction (tr( "Previous Window" ), this );
 32.1097 +	a->setStatusTip (tr( "&Previous Window" ));
 32.1098 +	a->setShortcut (Qt::ALT + Qt::Key_P );
 32.1099      a->addTo( menu );
 32.1100 -    a = new QAction( tr( "&Previous Window" ), QPixmap(), tr( "Previous Window" ), ALT + Key_P , this, "previousWindow" );
 32.1101      connect( a, SIGNAL( activated() ), this, SLOT(windowPreviousEditor() ) );
 32.1102 -    a->addTo( menu );
 32.1103 +}
 32.1104 +
 32.1105 +// Mode Actions
 32.1106 +void Main::setupModeActions()
 32.1107 +{
 32.1108 +    //QPopupMenu *menu = new QPopupMenu( this );
 32.1109 +    //menuBar()->insertItem( tr( "&Mode (using modifiers)" ), menu );
 32.1110 +
 32.1111 +    Q3ToolBar *tb = new Q3ToolBar( this );
 32.1112 +    tb->setLabel( tr ("Modes when using modifiers") );
 32.1113 +    QAction *a;
 32.1114 +	actionGroupModModes=new Q3ActionGroup ( this, "formatLinkStyles");
 32.1115 +	actionGroupModModes->setExclusive (true);
 32.1116 +    a= new QAction( QPixmap(iconPath+"modecolor.png"), tr( "Use modifier to color branches" ), actionGroupModModes);
 32.1117 +	a->setShortcut (Qt::Key_J);
 32.1118 +    a->setStatusTip ( tr( "Use modifier to color branches" ));
 32.1119 +	a->setToggleAction(true);
 32.1120 +	a->addTo (tb);
 32.1121 +	a->setOn(true);
 32.1122 +	actionModModeColor=a;
 32.1123 +	
 32.1124 +    a= new QAction( QPixmap(iconPath+"modecopy.png"), tr( "Use modifier to copy" ), actionGroupModModes );
 32.1125 +	a->setShortcut( Qt::Key_K); 
 32.1126 +    a->setStatusTip( tr( "Use modifier to copy" ));
 32.1127 +	a->setToggleAction(true);
 32.1128 +	a->addTo (tb);
 32.1129 +	actionModModeCopy=a;
 32.1130 +
 32.1131 +    a= new QAction(QPixmap(iconPath+"modelink.png"), tr( "Use modifier to draw xLinks" ), actionGroupModModes );
 32.1132 +	a->setShortcut (Qt::Key_L);
 32.1133 +    a->setStatusTip( tr( "Use modifier to draw xLinks" ));
 32.1134 +	a->setToggleAction(true);
 32.1135 +	a->addTo (tb);
 32.1136 +	actionModModeLink=a;
 32.1137  }
 32.1138  
 32.1139  // Flag Actions
 32.1140  void Main::setupFlagActions()
 32.1141  {
 32.1142 +	// Create System Flags
 32.1143 +	systemFlagsDefault = new FlagRowObj ();
 32.1144 +	systemFlagsDefault->setVisibility (false);
 32.1145 +	systemFlagsDefault->setName ("systemFlagsDef");
 32.1146 +
 32.1147 +	FlagObj *fo = new FlagObj ();
 32.1148 +	fo->load(QPixmap(flagsPath+"flag-note.png"));
 32.1149 +	fo->setName("note");
 32.1150 +	fo->setToolTip(tr("Note","Systemflag"));
 32.1151 +	systemFlagsDefault->addFlag (fo);	// makes deep copy
 32.1152 +
 32.1153 +	fo->load(QPixmap(flagsPath+"flag-url.png"));
 32.1154 +	fo->setName("url");
 32.1155 +	fo->setToolTip(tr("WWW Document (external)","Systemflag"));
 32.1156 +	systemFlagsDefault->addFlag (fo);
 32.1157 +	
 32.1158 +	fo->load(QPixmap(flagsPath+"flag-vymlink.png"));
 32.1159 +	fo->setName("vymLink");
 32.1160 +	fo->setToolTip(tr("Link to another vym map","Systemflag"));
 32.1161 +	systemFlagsDefault->addFlag (fo);	
 32.1162 +
 32.1163 +	fo->load(QPixmap(flagsPath+"flag-scrolled-right.png"));
 32.1164 +	fo->setName("scrolledright");
 32.1165 +	fo->setToolTip(tr("subtree is scrolled","Systemflag"));
 32.1166 +	systemFlagsDefault->addFlag (fo);
 32.1167 +	
 32.1168 +	fo->load(QPixmap(flagsPath+"flag-tmpUnscrolled-right.png"));
 32.1169 +	fo->setName("tmpUnscrolledright");
 32.1170 +	fo->setToolTip(tr("subtree is temporary scrolled","Systemflag"));
 32.1171 +	systemFlagsDefault->addFlag (fo);
 32.1172 +
 32.1173 +	fo->load(QPixmap(flagsPath+"flag-hideexport.png"));
 32.1174 +	fo->setName("hideInExport");
 32.1175 +	fo->setToolTip(tr("Hide object in exported maps","Systemflag"));
 32.1176 +	systemFlagsDefault->addFlag (fo);
 32.1177 +
 32.1178 +	// Create Standard Flags
 32.1179 +	standardFlagsDefault = new FlagRowObj ();
 32.1180 +	standardFlagsDefault->setVisibility (false);
 32.1181 +	standardFlagsDefault->setName ("standardFlagsDef");
 32.1182 +
 32.1183 +	fo->load(QPixmap(flagsPath+"flag-exclamationmark.png"));
 32.1184 +	fo->setName ("exclamationmark");
 32.1185 +	fo->setGroup("standard-mark");
 32.1186 +	fo->setToolTip(tr("Take care!","Standardflag"));
 32.1187 +	standardFlagsDefault->addFlag (fo);	// makes deep copy
 32.1188 +	
 32.1189 +	fo->load(QPixmap(flagsPath+"flag-questionmark.png"));
 32.1190 +	fo->setName("questionmark");
 32.1191 +	fo->setGroup("standard-mark");
 32.1192 +	fo->setToolTip(tr("Really?","Standardflag"));
 32.1193 +	standardFlagsDefault->addFlag (fo);	
 32.1194 +
 32.1195 +	fo->load(QPixmap(flagsPath+"flag-hook-green.png"));
 32.1196 +	fo->setName("hook-green");
 32.1197 +	fo->setGroup("standard-hook");
 32.1198 +	fo->setToolTip(tr("ok!","Standardflag"));
 32.1199 +	standardFlagsDefault->addFlag (fo);	
 32.1200 +
 32.1201 +	fo->load(QPixmap(flagsPath+"flag-cross-red.png"));
 32.1202 +	fo->setName("cross-red");
 32.1203 +	fo->setGroup("standard-hook");
 32.1204 +	fo->setToolTip(tr("Not ok!","Standardflag"));
 32.1205 +	standardFlagsDefault->addFlag (fo);	
 32.1206 +
 32.1207 +	fo->load(QPixmap(flagsPath+"flag-stopsign.png"));
 32.1208 +	fo->setName("stopsign");
 32.1209 +	fo->setToolTip(tr("This won't work!","Standardflag"));
 32.1210 +	standardFlagsDefault->addFlag (fo);	
 32.1211 +
 32.1212 +	fo->load(QPixmap(flagsPath+"flag-smiley-good.png"));
 32.1213 +	fo->setName("smiley-good");
 32.1214 +	fo->setGroup("standard-smiley");
 32.1215 +	fo->setToolTip(tr("Good","Standardflag"));
 32.1216 +	standardFlagsDefault->addFlag (fo);	
 32.1217 +
 32.1218 +	fo->load(QPixmap(flagsPath+"flag-smiley-sad.png"));
 32.1219 +	fo->setName("smiley-sad");
 32.1220 +	fo->setGroup("standard-smiley");
 32.1221 +	fo->setToolTip(tr("Bad","Standardflag"));
 32.1222 +	standardFlagsDefault->addFlag (fo);	
 32.1223 +
 32.1224 +	fo->load(QPixmap(flagsPath+"flag-smiley-omg.png"));
 32.1225 +	// Original omg.png (in KDE emoticons)
 32.1226 +	fo->setName("smiley-omg");
 32.1227 +	fo->setGroup("standard-smiley");
 32.1228 +	fo->setToolTip(tr("Oh no!","Standardflag"));
 32.1229 +	standardFlagsDefault->addFlag (fo);	
 32.1230 +
 32.1231 +	fo->load(QPixmap(flagsPath+"flag-kalarm.png"));
 32.1232 +	fo->setName("clock");
 32.1233 +	fo->setToolTip(tr("Time critical","Standardflag"));
 32.1234 +	standardFlagsDefault->addFlag (fo);	
 32.1235 +
 32.1236 +	fo->load(QPixmap(flagsPath+"flag-phone.png"));
 32.1237 +	fo->setName("phone");
 32.1238 +	fo->setToolTip(tr("Call...","Standardflag"));
 32.1239 +	standardFlagsDefault->addFlag (fo);	
 32.1240 +
 32.1241 +	fo->load(QPixmap(flagsPath+"flag-lamp.png"));
 32.1242 +	fo->setName("lamp");
 32.1243 +	fo->setToolTip(tr("Idea!","Standardflag"));
 32.1244 +	standardFlagsDefault->addFlag (fo);	
 32.1245 +
 32.1246 +	fo->load(QPixmap(flagsPath+"flag-arrow-up.png"));
 32.1247 +	fo->setName("arrow-up");
 32.1248 +	fo->setGroup("standard-arrow");
 32.1249 +	fo->setToolTip(tr("Important","Standardflag"));
 32.1250 +	standardFlagsDefault->addFlag (fo);	
 32.1251 +
 32.1252 +	fo->load(QPixmap(flagsPath+"flag-arrow-down.png"));
 32.1253 +	fo->setName("arrow-down");
 32.1254 +	fo->setGroup("standard-arrow");
 32.1255 +	fo->setToolTip(tr("Unimportant","Standardflag"));
 32.1256 +	standardFlagsDefault->addFlag (fo);	
 32.1257 +
 32.1258 +	fo->load(QPixmap(flagsPath+"flag-arrow-2up.png"));
 32.1259 +	fo->setName("2arrow-up");
 32.1260 +	fo->setGroup("standard-arrow");
 32.1261 +	fo->setToolTip(tr("Very important!","Standardflag"));
 32.1262 +	standardFlagsDefault->addFlag (fo);	
 32.1263 +
 32.1264 +	fo->load(QPixmap(flagsPath+"flag-arrow-2down.png"));
 32.1265 +	fo->setName("2arrow-down");
 32.1266 +	fo->setGroup("standard-arrow");
 32.1267 +	fo->setToolTip(tr("Very unimportant!","Standardflag"));
 32.1268 +	standardFlagsDefault->addFlag (fo);	
 32.1269 +
 32.1270 +	fo->load(QPixmap(flagsPath+"flag-thumb-up.png"));
 32.1271 +	fo->setName("thumb-up");
 32.1272 +	fo->setGroup("standard-thumb");
 32.1273 +	fo->setToolTip(tr("I like this","Standardflag"));
 32.1274 +	standardFlagsDefault->addFlag (fo);	
 32.1275 +
 32.1276 +	fo->load(QPixmap(flagsPath+"flag-thumb-down.png"));
 32.1277 +	fo->setName("thumb-down");
 32.1278 +	fo->setGroup("standard-thumb");
 32.1279 +	fo->setToolTip(tr("I like this","Standardflag"));
 32.1280 +	fo->setToolTip(tr("I do not like this","Standardflag"));
 32.1281 +	standardFlagsDefault->addFlag (fo);	
 32.1282 +	
 32.1283 +	fo->load(QPixmap(flagsPath+"flag-rose.png"));
 32.1284 +	fo->setName("rose");
 32.1285 +	fo->setToolTip(tr("Rose","Standardflag"));
 32.1286 +	standardFlagsDefault->addFlag (fo);	
 32.1287 +
 32.1288 +	fo->load(QPixmap(flagsPath+"flag-heart.png"));
 32.1289 +	fo->setName("heart");
 32.1290 +	fo->setToolTip(tr("I just love... ","Standardflag"));
 32.1291 +	standardFlagsDefault->addFlag (fo);	
 32.1292 +
 32.1293 +	fo->load(QPixmap(flagsPath+"flag-present.png"));
 32.1294 +	fo->setName("present");
 32.1295 +	fo->setToolTip(tr("Surprise!","Standardflag"));
 32.1296 +	standardFlagsDefault->addFlag (fo);	
 32.1297 +
 32.1298 +	fo->load(QPixmap(flagsPath+"flag-flash.png"));
 32.1299 +	fo->setName("flash");
 32.1300 +	fo->setToolTip(tr("Dangerous","Standardflag"));
 32.1301 +	standardFlagsDefault->addFlag (fo);	
 32.1302 +	
 32.1303 +	fo->load(QPixmap(flagsPath+"flag-info.png"));
 32.1304 +	// Original: xsldbg_output.png
 32.1305 +	fo->setName("info");
 32.1306 +	fo->setToolTip(tr("Info","Standardflag"));
 32.1307 +	standardFlagsDefault->addFlag (fo);	
 32.1308 +
 32.1309 +	fo->load(QPixmap(flagsPath+"flag-lifebelt.png"));
 32.1310 +	// Original khelpcenter.png
 32.1311 +	fo->setName("lifebelt");
 32.1312 +	fo->setToolTip(tr("This will help","Standardflag"));
 32.1313 +	standardFlagsDefault->addFlag (fo);	
 32.1314 +
 32.1315 +	delete (fo);
 32.1316 +
 32.1317  	standardFlagsDefault->makeToolbar(this, "Standard Flags");
 32.1318  }
 32.1319  
 32.1320  // Settings Actions
 32.1321  void Main::setupSettingsActions()
 32.1322  {
 32.1323 -    QPopupMenu *menu = new QPopupMenu( this );
 32.1324 +    Q3PopupMenu *menu = new Q3PopupMenu( this );
 32.1325      menuBar()->insertItem( tr( "&Settings" ), menu );
 32.1326  
 32.1327  	QAction *a;
 32.1328  
 32.1329  
 32.1330 -    a = new QAction( tr( "Set application to open pdf files" ), QPixmap(), tr( "Set application to open pdf files" ), 0, this, "setPDF" );
 32.1331 +    a = new QAction( tr( "Set application to open pdf files"), this);
 32.1332 +    a->setStatusTip ( tr( "Set application to open pdf files"));
 32.1333      connect( a, SIGNAL( activated() ), this, SLOT( settingsPDF() ) );
 32.1334      a->addTo( menu );
 32.1335  
 32.1336 -    a = new QAction( tr( "Set application to open an URL" ), QPixmap(), tr( "Set application to open an URL" ), 0, this, "setURL" );
 32.1337 +    a = new QAction( tr( "Set application to open external links"), this);
 32.1338 +    a->setStatusTip( tr( "Set application to open external links"));
 32.1339      connect( a, SIGNAL( activated() ), this, SLOT( settingsURL() ) );
 32.1340      a->addTo( menu );
 32.1341  
 32.1342      menu->insertSeparator();
 32.1343 -    a = new QAction( tr( "Edit branch after adding it" ), QPixmap(), tr( "Edit branch after adding it" ), 0, this, "autoedit" );
 32.1344 +    a = new QAction( tr( "Edit branch after adding it" ), this );
 32.1345 +    a->setStatusTip( tr( "Edit branch after adding it" ));
 32.1346  	a->setToggleAction(true);
 32.1347  	a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/autoedit",true) );
 32.1348      a->addTo( menu );
 32.1349  	actionSettingsAutoedit=a;
 32.1350  
 32.1351 -    a= new QAction( tr( "Select branch after adding it" ), QPixmap(), tr( "Select branch after adding it" ), 0, this, "autoselectheading" );
 32.1352 +    a= new QAction( tr( "Select branch after adding it" ), this );
 32.1353 +    a->setStatusTip( tr( "Select branch after adding it" ));
 32.1354  	a->setToggleAction(true);
 32.1355  	a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/autoselect",false) );
 32.1356      a->addTo( menu );
 32.1357  	actionSettingsAutoselectHeading=a;
 32.1358  	
 32.1359 -    a= new QAction( tr( "Select heading before editing" ), QPixmap(), tr( "Select existing heading" ), 0, this, "autoselectexistingtext" );
 32.1360 +    a= new QAction(tr( "Select existing heading" ), this);
 32.1361 +    a->setStatusTip( tr( "Select heading before editing" ));
 32.1362  	a->setToggleAction(true);
 32.1363  	a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/autoselectexistingtext",true) );
 32.1364      a->addTo( menu );
 32.1365  	actionSettingsAutoselectText=a;
 32.1366  	
 32.1367 -    a= new QAction( tr( "Enable pasting into new branch" ), QPixmap(), tr( "Enable pasting into new branch" ), 0, this, "pastenewheading" );
 32.1368 +    a= new QAction(tr( "pasting into new branch" ), this );
 32.1369 +    a->setStatusTip( tr( "Pasting into new branch" ));
 32.1370  	a->setToggleAction(true);
 32.1371  	a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/newheadingisempty",true) );
 32.1372      a->addTo( menu );
 32.1373  	actionSettingsPasteNewHeading=a;
 32.1374  	
 32.1375 -    a= new QAction( tr( "Enable Delete key for deleting branches" ), QPixmap(), tr( "Enable Delete key" ), 0, this, "delkey" );
 32.1376 +    a= new QAction( tr( "Delete key" ), this);
 32.1377 +    a->setStatusTip( tr( "Delete key for deleting branches" ));
 32.1378  	a->setToggleAction(true);
 32.1379  	a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/useDelKey",false) );
 32.1380      a->addTo( menu );
 32.1381 +    connect( a, SIGNAL( activated() ), this, SLOT( settingsToggleDelKey() ) );
 32.1382  	actionSettingsUseDelKey=a;
 32.1383 +
 32.1384 +    a= new QAction( tr( "Exclusive flags" ), this);
 32.1385 +    a->setStatusTip( tr( "Use exclusive flags in flag toolbars" ));
 32.1386 +	a->setToggleAction(true);
 32.1387 +	a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/useFlagGroups",true) );
 32.1388 +    a->addTo( menu );
 32.1389 +	actionSettingsUseFlagGroups=a;
 32.1390 +	
 32.1391 +    a= new QAction( tr( "Use hide flags" ), this);
 32.1392 +    a->setStatusTip( tr( "Use hide flag during exports " ));
 32.1393 +	a->setToggleAction(true);
 32.1394 +	a->setOn ( settings.readBoolEntry ("/vym/export/useHideExport",true) );
 32.1395 +    a->addTo( menu );
 32.1396 +	actionSettingsUseHideExport=a;
 32.1397  }
 32.1398  
 32.1399  // Test Actions
 32.1400  void Main::setupTestActions()
 32.1401  {
 32.1402 -    QPopupMenu *menu = new QPopupMenu( this );
 32.1403 +    Q3PopupMenu *menu = new Q3PopupMenu( this );
 32.1404      menuBar()->insertItem( tr( "&Test" ), menu );
 32.1405  
 32.1406      QAction *a;
 32.1407 -    a = new QAction( tr( "Test Flag" ), QPixmap(), tr( "test flag" ), 0, this, "flag" );
 32.1408 +    a = new QAction( tr( "test flag" ), this);
 32.1409 +    a->setStatusTip( tr( "Call test function" ));
 32.1410      connect( a, SIGNAL( activated() ), this, SLOT( testFunction() ) );
 32.1411      a->addTo( menu );
 32.1412 -
 32.1413 -	a = new QAction( tr( "Show Clipboard" ), QPixmap(), tr( "Show clipboard" ), 0, this, "clipboard" );
 32.1414 -    connect( a, SIGNAL( activated() ), this, SLOT( testShowClipboard() ) );
 32.1415 -    a->addTo( menu );
 32.1416  }
 32.1417  
 32.1418  // Help Actions
 32.1419  void Main::setupHelpActions()
 32.1420  {
 32.1421 -    QPopupMenu *menu = new QPopupMenu( this );
 32.1422 +    Q3PopupMenu *menu = new Q3PopupMenu( this );
 32.1423      menuBar()->insertItem( tr( "&Help" ), menu );
 32.1424  
 32.1425      QAction *a;
 32.1426 -    a = new QAction( tr( "Open VYM Documentation (pdf)" ), QPixmap(), tr( "Open VYM Documentation (pdf) " ), 0, this, "about" );
 32.1427 +    a = new QAction(  tr( "Open VYM Documentation (pdf) " ), this );
 32.1428 +    a->setStatusTip( tr( "Open VYM Documentation (pdf)" ));
 32.1429      connect( a, SIGNAL( activated() ), this, SLOT( helpDoc() ) );
 32.1430      a->addTo( menu );
 32.1431  
 32.1432 -    a = new QAction( tr( "Information about VYM" ), QPixmap(), tr( "About VYM" ), 0, this, "about" );
 32.1433 +    a = new QAction( tr( "About VYM" ), this);
 32.1434 +    a->setStatusTip( tr( "About VYM")+" "__VYM);
 32.1435      connect( a, SIGNAL( activated() ), this, SLOT( helpAbout() ) );
 32.1436      a->addTo( menu );
 32.1437  
 32.1438 -    a = new QAction( tr( "Information about QT toolkit" ), QPixmap(), tr( "About QT" ), 0, this, "about" );
 32.1439 +    a = new QAction( tr( "About QT" ), this);
 32.1440 +    a->setStatusTip( tr( "Information about QT toolkit" ));
 32.1441      connect( a, SIGNAL( activated() ), this, SLOT( helpAboutQT() ) );
 32.1442      a->addTo( menu );
 32.1443  }
 32.1444 @@ -772,44 +1294,89 @@
 32.1445  	QAction*a;
 32.1446  
 32.1447  	// Context Menu for branch or mapcenter
 32.1448 -	branchContextMenu =new QPopupMenu (this);
 32.1449 -	actionEditAddBranch->addTo ( branchContextMenu );
 32.1450 -	actionEditAddBranchAbove->addTo ( branchContextMenu );
 32.1451 -	actionEditAddBranchBelow->addTo ( branchContextMenu );
 32.1452 +	branchContextMenu =new Q3PopupMenu (this);
 32.1453 +
 32.1454 +		// Submenu "Add"
 32.1455 +		branchAddContextMenu =new Q3PopupMenu (this);
 32.1456 +		actionEditPaste->addTo ( branchAddContextMenu );
 32.1457 +		actionEditAddBranch->addTo ( branchAddContextMenu );
 32.1458 +		actionEditAddBranchHere->addTo ( branchAddContextMenu );
 32.1459 +		actionEditAddBranchAbove->addTo ( branchAddContextMenu );
 32.1460 +		actionEditAddBranchBelow->addTo ( branchAddContextMenu );
 32.1461 +		branchAddContextMenu->insertSeparator();	
 32.1462 +		actionEditLoadImage->addTo( branchAddContextMenu );
 32.1463 +		branchAddContextMenu->insertSeparator();	
 32.1464 +		actionEditImportAdd->addTo ( branchAddContextMenu );
 32.1465 +		actionEditImportReplace->addTo ( branchAddContextMenu );
 32.1466 +
 32.1467 +		// Submenu "Remove"
 32.1468 +		branchRemoveContextMenu =new Q3PopupMenu (this);
 32.1469 +		actionEditCut->addTo ( branchRemoveContextMenu );
 32.1470 +		actionEditDelete->addTo ( branchRemoveContextMenu );
 32.1471 +		actionEditRemoveBranchKeepChilds->addTo( branchRemoveContextMenu );
 32.1472 +		actionEditRemoveChilds->addTo( branchRemoveContextMenu );
 32.1473 +		
 32.1474 +	branchContextMenu->insertItem (tr("Add"),branchAddContextMenu);	
 32.1475 +	branchContextMenu->insertItem (tr("Remove"),branchRemoveContextMenu);	
 32.1476 +
 32.1477  	actionEditSaveBranch->addTo( branchContextMenu );
 32.1478 -	branchContextMenu->insertSeparator();	
 32.1479 -	actionEditImportAdd->addTo ( branchContextMenu );
 32.1480 -	actionEditImportReplace->addTo ( branchContextMenu );
 32.1481 +
 32.1482  	branchContextMenu->insertSeparator();	
 32.1483  	actionEditOpenURL->addTo ( branchContextMenu );
 32.1484 +	actionEditOpenURLTab->addTo ( branchContextMenu );
 32.1485  	actionEditURL->addTo ( branchContextMenu );
 32.1486  	actionEditHeading2URL->addTo ( branchContextMenu );
 32.1487 +	actionEditBugzilla2URL->addTo( branchContextMenu );
 32.1488      if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) 
 32.1489 -		actionEditBugzilla2URL->addTo( branchContextMenu );
 32.1490 +	{
 32.1491 +		actionEditFATE2URL->addTo( branchContextMenu );
 32.1492 +	}	
 32.1493  	branchContextMenu->insertSeparator();	
 32.1494  	actionEditOpenVymLink->addTo ( branchContextMenu );
 32.1495  	actionEditVymLink->addTo ( branchContextMenu );
 32.1496  	actionEditDeleteVymLink->addTo ( branchContextMenu );
 32.1497 -	branchContextMenu->insertSeparator();	
 32.1498 -	actionEditLoadImage->addTo( branchContextMenu );
 32.1499 -	branchContextMenu->insertSeparator();	
 32.1500 -	actionEditCopy->addTo( branchContextMenu );
 32.1501 -	actionEditCut->addTo( branchContextMenu );
 32.1502 -	actionEditPaste->addTo( branchContextMenu );
 32.1503 +	
 32.1504  	branchContextMenu->insertSeparator();	
 32.1505  	actionGroupFormatFrameTypes->addTo( branchContextMenu );
 32.1506  
 32.1507 +	branchContextMenu->insertSeparator();	
 32.1508 +	actionFormatIncludeImagesVer->addTo( branchContextMenu );
 32.1509 +	actionFormatIncludeImagesHor->addTo( branchContextMenu );
 32.1510 +	actionFormatHideLinkUnselected->addTo( branchContextMenu );
 32.1511 +
 32.1512 +	// Context Menu for links in a branch menu
 32.1513 +	// This will be populated "on demand" in MapEditor::updateActions
 32.1514 +	branchContextMenu->insertSeparator();	
 32.1515 +	branchLinksContextMenu =new Q3PopupMenu (this);
 32.1516 +	branchLinksContextMenuDup =new Q3PopupMenu (this);
 32.1517 +	branchContextMenu->insertItem (tr("Edit XLink"),branchLinksContextMenuDup);
 32.1518 +	connect( branchLinksContextMenuDup, SIGNAL( activated(int) ), this, SLOT( editEditXLink(int ) ) );
 32.1519 +
 32.1520 +	branchContextMenu->insertItem (tr("Goto XLink"),branchLinksContextMenu);
 32.1521 +	connect( branchLinksContextMenu, SIGNAL( activated(int) ), this, SLOT( editFollowXLink(int ) ) );
 32.1522 +	
 32.1523  	// Context menu for floatimage
 32.1524 -	floatimageContextMenu =new QPopupMenu (this);
 32.1525 -	saveImageFormatMenu=new QPopupMenu (this);
 32.1526 -	exportImageFormatMenu=new QPopupMenu (this);
 32.1527 +	floatimageContextMenu =new Q3PopupMenu (this);
 32.1528 +	saveImageFormatMenu=new Q3PopupMenu (this);
 32.1529 +	exportImageFormatMenu=new Q3PopupMenu (this);
 32.1530  
 32.1531 -	QStrList fmt = QImage::outputFormats();
 32.1532 +/* FIXME strange error
 32.1533 +    foreach (QByteArray format, QImageWriter::supportedImageFormats()) 
 32.1534 +	{
 32.1535 +        QString text = tr("%1...").arg(QString(format).toUpper());
 32.1536 +		saveImageFormatMenu->insertItem( text );
 32.1537 +		exportImageFormatMenu->insertItem( text );
 32.1538 +    }
 32.1539 +*/
 32.1540 +
 32.1541 +/* FIXME  not needed any longer
 32.1542 +	Q3StrList fmt = QImageWriter::supportedImageFormats();
 32.1543  	for (const char* f = fmt.first(); f; f = fmt.next()) 
 32.1544  	{
 32.1545  		saveImageFormatMenu->insertItem( f );
 32.1546  		exportImageFormatMenu->insertItem( f );
 32.1547  	}	
 32.1548 +*/	
 32.1549  	connect( saveImageFormatMenu, SIGNAL( activated(int) ), this, SLOT( editSaveImage(int ) ) );
 32.1550  	connect( exportImageFormatMenu, SIGNAL( activated(int) ), this, SLOT( fileExportImage(int ) ) );
 32.1551  	floatimageContextMenu->insertItem( tr("Save image"),saveImageFormatMenu );
 32.1552 @@ -819,39 +1386,48 @@
 32.1553  	actionEditCut->addTo( floatimageContextMenu );
 32.1554  
 32.1555  	floatimageContextMenu->insertSeparator();	
 32.1556 -    a = new QAction( tr( "Use for Export" ), QPixmap(), tr( "Use for Export"), 0, this, "useForExport" );
 32.1557 -	a->setToggleAction(true);
 32.1558 -    connect( a, SIGNAL( activated() ), this, SLOT( editToggleFloatExport() ) );
 32.1559 -    a->addTo( floatimageContextMenu);
 32.1560 -	actionEditToggleFloatExport=a;
 32.1561 +	actionFormatHideLinkUnselected->addTo( floatimageContextMenu );
 32.1562  
 32.1563 +	exportMenu->insertItem ( tr("Export as")+" Image",exportImageFormatMenu);
 32.1564  
 32.1565 +	a = new QAction( "Open Office"+QString("..."), this);
 32.1566 +	a->setStatusTip( tr( "Export in Open Document Format used e.g. in Open Office " ));
 32.1567 +	connect( a, SIGNAL( activated() ), this, SLOT( fileExportOOPresentation() ) );
 32.1568 +	a->addTo (exportMenu);
 32.1569  
 32.1570 -	// Context menu for exports
 32.1571 -	exportMenu->insertItem ( tr("Export map as image"),exportImageFormatMenu);
 32.1572 -
 32.1573 -    a = new QAction( tr( "Export as ASCII (still experimental)" ), QPixmap(), tr( "Export (ASCII)" ), 0, this, "exportASCII" );
 32.1574 -    connect( a, SIGNAL( activated() ), this, SLOT( fileExportASCII() ) );
 32.1575 +	a = new QAction(  "Webpage (XHTML)...",this );
 32.1576 +	a->setShortcut (Qt::ALT + Qt::Key_X);
 32.1577 +	a->setStatusTip ( tr( "Export as")+" webpage (XHTML)");
 32.1578 +    connect( a, SIGNAL( activated() ), this, SLOT( fileExportXHTML() ) );
 32.1579      a->addTo( exportMenu );
 32.1580  
 32.1581 -	a = new QAction( tr( "Export XML" ), QPixmap(), tr( "Export XML" ),  0, this, "exportXML" );
 32.1582 +    a = new QAction( "Text (ASCII)...", this);
 32.1583 +	a->setStatusTip ( tr( "Export as")+" ASCII"+" "+tr("(still experimental)" ));
 32.1584 +    connect( a, SIGNAL( activated() ), this, SLOT( fileExportASCII() ) );
 32.1585 +	a->addTo( exportMenu );
 32.1586 +
 32.1587 +	a = new QAction( tr("KDE Bookmarks"), this);
 32.1588 +	a->setStatusTip( tr( "Export as")+" "+tr("KDE Bookmarks" ));
 32.1589 +	connect( a, SIGNAL( activated() ), this, SLOT( fileExportKDEBookmarks() ) );
 32.1590 +	a->addTo (exportMenu);
 32.1591 +
 32.1592 +    a = new QAction( "Taskjuggler...", this );
 32.1593 +    a->setStatusTip( tr( "Export as")+" Taskjuggler"+" "+tr("(still experimental)" ));
 32.1594 +    connect( a, SIGNAL( activated() ), this, SLOT( fileExportTaskjuggler() ) );
 32.1595 +	a->addTo( exportMenu );
 32.1596 +
 32.1597 +    a = new QAction( "LaTeX...", this);
 32.1598 +    a->setStatusTip( tr( "Export as")+" LaTeX"+" "+tr("(still experimental)" ));
 32.1599 +    connect( a, SIGNAL( activated() ), this, SLOT( fileExportLaTeX() ) );
 32.1600 +	a->addTo( exportMenu );
 32.1601 +
 32.1602 +	a = new QAction( "XML..." , this );
 32.1603 +	a->setStatusTip (tr( "Export as")+" XML");
 32.1604      connect( a, SIGNAL( activated() ), this, SLOT( fileExportXML() ) );
 32.1605      a->addTo( exportMenu );
 32.1606  	
 32.1607 -    if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) 
 32.1608 -	{
 32.1609 -		a = new QAction( tr( "Export HTML" ), QPixmap(), tr( "Export HTML" ), 0, this, "exportHTML" );
 32.1610 -		connect( a, SIGNAL( activated() ), this, SLOT( fileExportHTML() ) );
 32.1611 -		a->addTo( exportMenu );
 32.1612 -	}
 32.1613 -
 32.1614 -	a = new QAction( tr( "Export XHTML" ), QPixmap(), tr( "Export XHTML" ), ALT + Key_X, this, "exportXHTML" );
 32.1615 -    connect( a, SIGNAL( activated() ), this, SLOT( fileExportXHTML() ) );
 32.1616 -    a->addTo( exportMenu );
 32.1617 -
 32.1618 -	
 32.1619  	// Context menu for canvas
 32.1620 -	canvasContextMenu =new QPopupMenu (this);
 32.1621 +	canvasContextMenu =new Q3PopupMenu (this);
 32.1622  	actionEditMapInfo->addTo( canvasContextMenu );
 32.1623  	canvasContextMenu->insertSeparator();	
 32.1624  	actionGroupFormatLinkStyles->addTo( canvasContextMenu );
 32.1625 @@ -910,7 +1486,7 @@
 32.1626  
 32.1627  void Main::showEvent (QShowEvent * )
 32.1628  {
 32.1629 -	if (textEditor->showWithMain()) textEditor->show();
 32.1630 +	if (textEditor->showWithMain()) textEditor->showNormal();
 32.1631  }
 32.1632  
 32.1633  bool Main::reallyWriteDirectory(const QString &dir)
 32.1634 @@ -920,9 +1496,8 @@
 32.1635  	if (eList.first() =="..") eList.pop_front();	// remove "."
 32.1636  	if (!eList.isEmpty())
 32.1637  	{
 32.1638 -		QMessageBox mb( "VYM",
 32.1639 -			tr("The directory ") + dir + 
 32.1640 -			tr(" is not empty. Do you risk to overwrite its contents?"),
 32.1641 +		QMessageBox mb( __VYM,
 32.1642 +			tr("The directory %1 is not empty.\nDo you risk to overwrite its contents?").arg(dir),
 32.1643  		QMessageBox::Warning,
 32.1644  		QMessageBox::Yes ,
 32.1645  		QMessageBox::Cancel | QMessageBox::Default,
 32.1646 @@ -945,9 +1520,9 @@
 32.1647  
 32.1648  QString Main::browseDirectory (const QString &caption)
 32.1649  {
 32.1650 -	QFileDialog fd(this,caption);
 32.1651 -	fd.setMode (QFileDialog::DirectoryOnly);
 32.1652 -	fd.setCaption("VYM - "+caption);
 32.1653 +	Q3FileDialog fd(this,caption);
 32.1654 +	fd.setMode (Q3FileDialog::DirectoryOnly);
 32.1655 +	fd.setCaption(__VYM " - "+caption);
 32.1656  	fd.show();
 32.1657  	
 32.1658  	if ( fd.exec() == QDialog::Accepted )
 32.1659 @@ -968,7 +1543,7 @@
 32.1660  void Main::newView() 
 32.1661  {
 32.1662      // Open a new view... have it delete when closed.
 32.1663 -    Main *m = new Main(0, 0, WDestructiveClose);
 32.1664 +    Main *m = new Main(0, 0, Qt::WDestructiveClose);
 32.1665      qApp->setMainWidget(m);
 32.1666      m->show();
 32.1667      qApp->setMainWidget(0);
 32.1668 @@ -995,18 +1570,17 @@
 32.1669  void Main::fileNew()
 32.1670  {
 32.1671  	QString fn="unnamed";
 32.1672 -	MapEditor* medit = new MapEditor (tabWidget, true);
 32.1673 +	MapEditor* medit = new MapEditor ( NULL,true);
 32.1674  	tabWidget->addTab (medit,fn);
 32.1675  	tabWidget->showPage(medit);
 32.1676  	medit->viewport()->setFocus();
 32.1677 +	// For the very first map we do not have flagrows yet...
 32.1678  	medit->select("mc:");
 32.1679  }
 32.1680  
 32.1681 -void Main::fileLoad(QString fn, const LoadMode &lmode)
 32.1682 +ErrorCode Main::fileLoad(QString fn, const LoadMode &lmode)
 32.1683  {
 32.1684 -	// Error codes
 32.1685 -	enum errorCode {success,aborted};
 32.1686 -	errorCode err=success;
 32.1687 +	ErrorCode err=success;
 32.1688  	
 32.1689  	// fn is usually the archive, mapfile the file after uncompressing
 32.1690  	QString mapfile;
 32.1691 @@ -1026,15 +1600,15 @@
 32.1692  			if (me->getFilePath() == fn)
 32.1693  			{
 32.1694  				// Already there, ask for confirmation
 32.1695 -				QMessageBox mb( "VYM",
 32.1696 -					tr("The map ") + fn + tr ("\n is already opened."
 32.1697 +				QMessageBox mb( __VYM,
 32.1698 +					tr("The map %1\nis already opened."
 32.1699  					"Opening the same map in multiple editors may lead \n"
 32.1700  					"to confusion when finishing working with vym."
 32.1701 -					"Do you want to"),
 32.1702 +					"Do you want to").arg(fn),
 32.1703  					QMessageBox::Warning,
 32.1704  					QMessageBox::Yes | QMessageBox::Default,
 32.1705  					QMessageBox::Cancel | QMessageBox::Escape,
 32.1706 -					QMessageBox::QMessageBox::NoButton);
 32.1707 +					QMessageBox::NoButton);
 32.1708  				mb.setButtonText( QMessageBox::Yes, tr("Open anyway") );
 32.1709  				mb.setButtonText( QMessageBox::Cancel, tr("Cancel"));
 32.1710  				switch( mb.exec() ) 
 32.1711 @@ -1045,7 +1619,7 @@
 32.1712  						break;
 32.1713  					case QMessageBox::Cancel:
 32.1714  						// do nothing
 32.1715 -						return;
 32.1716 +						return aborted;
 32.1717  						break;
 32.1718  				}
 32.1719  			}
 32.1720 @@ -1074,13 +1648,12 @@
 32.1721  		// from command line
 32.1722  		if (!QFile(fn).exists() )
 32.1723  		{
 32.1724 -			QMessageBox mb( "VYM",
 32.1725 -				tr("The map") + fn + 
 32.1726 -				tr(" does not exist.\n Do you want to create a new one?"),
 32.1727 +			QMessageBox mb( __VYM,
 32.1728 +				tr("This map does not exist:\n  %1\nDo you want to create a new one?").arg(fn),
 32.1729  				QMessageBox::Question,
 32.1730  				QMessageBox::Yes ,
 32.1731  				QMessageBox::Cancel | QMessageBox::Default,
 32.1732 -				QMessageBox::QMessageBox::NoButton );
 32.1733 +				QMessageBox::NoButton );
 32.1734  
 32.1735  			mb.setButtonText( QMessageBox::Yes, tr("Create"));
 32.1736  			mb.setButtonText( QMessageBox::No, tr("Cancel"));
 32.1737 @@ -1092,13 +1665,13 @@
 32.1738  					tabWidget->setTabLabel (currentMapEditor(),
 32.1739  						currentMapEditor()->getFileName() );
 32.1740  					statusBar()->message( "Created " + fn , statusbarTime );
 32.1741 -					return;
 32.1742 +					return success;
 32.1743  						
 32.1744  				case QMessageBox::Cancel:
 32.1745  					// don't create new map
 32.1746  					statusBar()->message( "Loading " + fn + " failed!", statusbarTime );
 32.1747  					fileCloseMap();
 32.1748 -					return;
 32.1749 +					return aborted;
 32.1750  			}
 32.1751  		}	
 32.1752  
 32.1753 @@ -1112,130 +1685,101 @@
 32.1754  		QString tmpMapDir=mkdtemp(tmpdir1);
 32.1755  
 32.1756  		// Try to unzip file
 32.1757 -		Process *zipProc=new Process ();
 32.1758 -		zipProc->clearArguments();
 32.1759 -		zipProc->setWorkingDirectory (QDir(tmpMapDir));
 32.1760 -		zipProc->addArgument ("unzip");
 32.1761 -		zipProc->addArgument (fn );
 32.1762 -		zipProc->addArgument ("-d");
 32.1763 -		zipProc->addArgument (tmpMapDir);
 32.1764 -
 32.1765 -		if (!zipProc->start() )
 32.1766 +		err=unzipDir (tmpMapDir,fn);
 32.1767 +		if (err==nozip)
 32.1768  		{
 32.1769 -			QMessageBox::critical( 0, tr( "Critical Load Error" ),
 32.1770 -						   tr("Couldn't start unzip to decompress data."));
 32.1771 -			err=aborted;
 32.1772 -			
 32.1773 +			mapfile=fn;
 32.1774 +			me->setZipped(false);
 32.1775  		} else
 32.1776  		{
 32.1777 -			zipProc->waitFinished();
 32.1778 -			if (!zipProc->normalExit() )
 32.1779 +			me->setZipped(true);
 32.1780 +			
 32.1781 +			// Look for mapname.xml
 32.1782 +			mapfile= fn.left(fn.findRev(".",-1,true));
 32.1783 +			mapfile=mapfile.section( '/', -1 );
 32.1784 +			QFile file( tmpMapDir + "/" + mapfile + ".xml");
 32.1785 +			if (!file.exists() )
 32.1786  			{
 32.1787 -				QMessageBox::critical( 0, tr( "Critical Load Error" ),
 32.1788 -							   tr("unzip didn't exit normally") +
 32.1789 -							   zipProc->getErrout() );
 32.1790 -				err=aborted;
 32.1791 -			} else
 32.1792 -			{
 32.1793 -				if (zipProc->exitStatus()>0)
 32.1794 +				// mapname.xml does not exist, well, 
 32.1795 +				// maybe some renamed the mapname.vym file...
 32.1796 +				// Try to find any .xml in the toplevel 
 32.1797 +				// directory of the .vym file
 32.1798 +				QStringList flist=QDir (tmpMapDir).entryList("*.xml");
 32.1799 +				if (flist.count()==1) 
 32.1800  				{
 32.1801 -					if (zipProc->exitStatus()==9)
 32.1802 -					{
 32.1803 -						// no zipped file, but maybe .xml or old version? Try again.
 32.1804 -						mapfile=fn;
 32.1805 -						me->setZipped(false);
 32.1806 -					}	
 32.1807 -					else	
 32.1808 -					{
 32.1809 -						QMessageBox::critical( 0, tr( "Critical Load Error" ),
 32.1810 -									   QString("unzip exit code:  %1").arg(zipProc->exitStatus() ) +
 32.1811 -									   zipProc->getErrout() );
 32.1812 -						err=aborted;
 32.1813 -					}
 32.1814 +					// Only one entry, take this one
 32.1815 +					mapfile=tmpMapDir + "/"+flist.first();
 32.1816  				} else
 32.1817 -				{	// Uncompressing was successfull,
 32.1818 -					// load from uncompressed temporary directory
 32.1819 -
 32.1820 -					me->setZipped(true);
 32.1821 -
 32.1822 +				{
 32.1823 +					for ( QStringList::Iterator it = flist.begin(); it != flist.end(); ++it ) 
 32.1824 +						*it=tmpMapDir + "/" + *it;
 32.1825 +					// TODO Multiple entries, load all (but only the first one into this ME)
 32.1826 +					//mainWindow->fileLoadFromTmp (flist);
 32.1827 +					//returnCode=1;	// Silently forget this attempt to load
 32.1828 +					qWarning ("MainWindow::load (fn)  multimap found...");
 32.1829 +				}	
 32.1830  					
 32.1831 -					// Look for mapname.xml
 32.1832 -					mapfile= fn.left(fn.findRev(".",-1,true));
 32.1833 -					mapfile=mapfile.section( '/', -1 );
 32.1834 -					QFile file( tmpMapDir + "/" + mapfile + ".xml");
 32.1835 -					if (!file.exists() )
 32.1836 -					{
 32.1837 -						// mapname.xml does not exist, well, 
 32.1838 -						// maybe some renamed the mapname.vym file...
 32.1839 -						// Try to find any .xml in the toplevel 
 32.1840 -						// directory of the .vym file
 32.1841 -						QStringList flist=QDir (tmpMapDir).entryList("*.xml");
 32.1842 -						if (flist.count()==1) 
 32.1843 -						{
 32.1844 -							// Only one entry, take this one
 32.1845 -							mapfile=tmpMapDir + "/"+flist.first();
 32.1846 -						} else
 32.1847 -						{
 32.1848 -							for ( QStringList::Iterator it = flist.begin(); it != flist.end(); ++it ) 
 32.1849 -								*it=tmpMapDir + "/" + *it;
 32.1850 -							// FIXME	
 32.1851 -							// Multiple entries, load all (but only the first one into this ME)
 32.1852 -							//mainWindow->fileLoadFromTmp (flist);
 32.1853 -							//returnCode=1;	// Silently forget this attempt to load
 32.1854 -							qWarning ("MainWindow::load (fn)  multimap found...");
 32.1855 -						}	
 32.1856 -							
 32.1857 -						if (flist.isEmpty() )
 32.1858 -						{
 32.1859 -							QMessageBox::critical( 0, tr( "Critical Load Error" ),
 32.1860 -									   tr("Couldn't find a map (*.xml) in .vym archive.\n"));
 32.1861 -							err=aborted;				   
 32.1862 -						}	
 32.1863 -					} //file doesn't exist	
 32.1864 -					else
 32.1865 -						mapfile=file.name();
 32.1866 -				} // Uncompressing successfull
 32.1867 -			}
 32.1868 +				if (flist.isEmpty() )
 32.1869 +				{
 32.1870 +					QMessageBox::critical( 0, tr( "Critical Load Error" ),
 32.1871 +							   tr("Couldn't find a map (*.xml) in .vym archive.\n"));
 32.1872 +					err=aborted;				   
 32.1873 +				}	
 32.1874 +			} //file doesn't exist	
 32.1875 +			else
 32.1876 +				mapfile=file.name();
 32.1877  		}
 32.1878  
 32.1879 -		// Finally load map into mapEditor
 32.1880 -		me->setFilePath (mapfile,fn);
 32.1881 -		if (me->load(mapfile,lmode))
 32.1882 -			err=aborted;
 32.1883 +		if (err!=aborted)
 32.1884 +		{
 32.1885 +			// Save existing filename in case  we import
 32.1886 +			QString fn_org=me->getFilePath();
 32.1887  
 32.1888 -		// Delete tmpDir
 32.1889 -		system ( "rm -rf "+tmpMapDir);
 32.1890 +			// Finally load map into mapEditor
 32.1891 +			me->setFilePath (mapfile,fn);
 32.1892 +			err=me->load(mapfile,lmode);
 32.1893  
 32.1894 -		// Check for errors
 32.1895 -		if (err==success) 
 32.1896 +			// Restore old (maybe empty) filepath, if this is an import
 32.1897 +			if (lmode!=NewMap)
 32.1898 +				me->setFilePath (fn_org);
 32.1899 +		}	
 32.1900 +
 32.1901 +		// Finally check for errors and go home
 32.1902 +		if (err==aborted) 
 32.1903 +		{
 32.1904 +			if (lmode==NewMap) fileCloseMap();
 32.1905 +			statusBar()->message( "Could not load " + fn, statusbarTime );
 32.1906 +		} else 
 32.1907  		{
 32.1908  			if (lmode==NewMap)
 32.1909  			{
 32.1910  				me->setFilePath (fn);
 32.1911  				tabWidget->changeTab(tabWidget->page(tabIndex), me->getFileName());
 32.1912 -				lastMaps.prepend(me->getFilePath() );
 32.1913 -				setupLastMapsMenu();
 32.1914 +				if (fn.left(9)!="/tmp/vym-")
 32.1915 +				{
 32.1916 +					// Only append to lastMaps if not loaded from a tmpDir
 32.1917 +					// e.g. imported bookmarks are in a tmpDir
 32.1918 +					lastMaps.prepend(me->getFilePath() );
 32.1919 +					setupLastMapsMenu();
 32.1920 +				}
 32.1921  				actionFilePrint->setEnabled (true);
 32.1922  			}	
 32.1923  			statusBar()->message( "Loaded " + fn, statusbarTime );
 32.1924 -			return;
 32.1925 -		} else 
 32.1926 -		{
 32.1927 -			if (lmode==NewMap)
 32.1928 -				fileCloseMap();
 32.1929  		}	
 32.1930  
 32.1931 -
 32.1932 +		// Delete tmpDir
 32.1933 +		removeDir (QDir(tmpMapDir));
 32.1934  	}
 32.1935 -	statusBar()->message( "Could not load " + fn, statusbarTime );
 32.1936 +	return err;
 32.1937  }
 32.1938  
 32.1939  
 32.1940  void Main::fileLoad(const LoadMode &lmode)
 32.1941  {
 32.1942 -	QFileDialog *fd=new QFileDialog( this);
 32.1943 +	Q3FileDialog *fd=new Q3FileDialog( this);
 32.1944  	if (!lastFileDir.isEmpty()) 
 32.1945  		fd->setDir (lastFileDir);
 32.1946 +	fd->setMode (Q3FileDialog::ExistingFiles);
 32.1947  	fd->addFilter ("XML (*.xml)");
 32.1948  	fd->addFilter ("VYM map (*.vym *.vyp)");
 32.1949  	switch (lmode)
 32.1950 @@ -1256,9 +1800,16 @@
 32.1951  	if ( fd->exec() == QDialog::Accepted )
 32.1952  	{
 32.1953  		lastFileDir=fd->dirPath();
 32.1954 -        fn = fd->selectedFile();
 32.1955 -		fileLoad(fn, lmode);				   
 32.1956 +	    QStringList flist = fd->selectedFiles();
 32.1957 +		QStringList::Iterator it = flist.begin();
 32.1958 +		while( it != flist.end() ) 
 32.1959 +		{
 32.1960 +			fn = *it;
 32.1961 +			fileLoad(*it, lmode);				   
 32.1962 +			++it;
 32.1963 +		}
 32.1964  	}
 32.1965 +	delete (fd);
 32.1966  }
 32.1967  
 32.1968  void Main::fileLoad()
 32.1969 @@ -1268,7 +1819,7 @@
 32.1970  
 32.1971  void Main::fileLoadLast(int i)
 32.1972  {
 32.1973 -	fileLoad(*lastMaps.at(lastMapsMenu->indexOf (i) ),NewMap);			   
 32.1974 +	fileLoad(QString(*lastMaps.at(lastMapsMenu->indexOf (i)) ),NewMap);			   
 32.1975  }
 32.1976  
 32.1977  void Main::fileSave(const SaveMode &savemode)
 32.1978 @@ -1277,16 +1828,16 @@
 32.1979  	QString tmpMapDir;
 32.1980  	
 32.1981  	// Error codes
 32.1982 -	enum errorCode {success,aborted};
 32.1983 -	errorCode err=success;
 32.1984 +	ErrorCode err=success;
 32.1985  	
 32.1986  	QString safeFilePath;
 32.1987  
 32.1988  	bool saveZipped=currentMapEditor()->saveZipped();
 32.1989  
 32.1990 -	if (currentMapEditor())
 32.1991 +	MapEditor *	me=currentMapEditor();
 32.1992 +	if (me)
 32.1993  	{
 32.1994 -		QString fn=currentMapEditor()->getFilePath();
 32.1995 +		QString fn=me->getFilePath();
 32.1996  		// filename=unnamed, filepath="" in constructor...
 32.1997  		if ( !fn.isEmpty() ) 
 32.1998  		{	
 32.1999 @@ -1302,12 +1853,11 @@
 32.2000  			// Look, if we should zip the data:
 32.2001  			if (!saveZipped)
 32.2002  			{
 32.2003 -				QMessageBox mb( "VYM",
 32.2004 -					tr("The map ") + fn + 
 32.2005 -					tr ("\ndid not use the compressed "
 32.2006 +				QMessageBox mb( __VYM,
 32.2007 +					tr("The map %1\ndid not use the compressed "
 32.2008  					"vym file format.\nWriting it uncompressed will also write images \n"
 32.2009  					"and flags and thus may overwrite files in the "
 32.2010 -					"given directory\n\nDo you want to write the map"),
 32.2011 +					"given directory\n\nDo you want to write the map").arg(fn),
 32.2012  					QMessageBox::Warning,
 32.2013  					QMessageBox::Yes | QMessageBox::Default,
 32.2014  					QMessageBox::No ,
 32.2015 @@ -1337,57 +1887,22 @@
 32.2016  				char tmpdir1[]="/tmp/vym-XXXXXX";	
 32.2017  				tmpMapDir=mkdtemp(tmpdir1);
 32.2018  			
 32.2019 -				safeFilePath=currentMapEditor()->getFilePath();
 32.2020 -				currentMapEditor()->setFilePath (tmpMapDir+"/"+
 32.2021 -					currentMapEditor()->getMapName()+ ".xml",
 32.2022 +				safeFilePath=me->getFilePath();
 32.2023 +				me->setFilePath (tmpMapDir+"/"+
 32.2024 +					me->getMapName()+ ".xml",
 32.2025  					safeFilePath);
 32.2026 -				currentMapEditor()->save (savemode);
 32.2027 -				currentMapEditor()->setFilePath (safeFilePath);
 32.2028 +				me->save (savemode);
 32.2029 +				me->setFilePath (safeFilePath);
 32.2030  				
 32.2031 -				// zip the temporary directory
 32.2032 -				Process *zipProc=new Process ();
 32.2033 -				zipProc->clearArguments();
 32.2034 -				zipProc->setWorkingDirectory (QDir(tmpMapDir));
 32.2035 -				zipProc->addArgument ("zip");
 32.2036 -				zipProc->addArgument ("-r");
 32.2037 -				zipProc->addArgument (fn);
 32.2038 -				zipProc->addArgument (".");
 32.2039 -
 32.2040 -				if (!zipProc->start() )
 32.2041 -				{	
 32.2042 -					// zip could not be started
 32.2043 -					QMessageBox::critical( 0, tr( "Critical Save Error" ),
 32.2044 -								   tr("Couldn't start zip to compress data."));
 32.2045 -					err=aborted;
 32.2046 -				} else
 32.2047 -				{
 32.2048 -					// zip could be started
 32.2049 -					zipProc->waitFinished();
 32.2050 -					if (!zipProc->normalExit() )
 32.2051 -					{
 32.2052 -						QMessageBox::critical( 0, tr( "Critical Save Error" ),
 32.2053 -									   tr("zip didn't exit normally")+
 32.2054 -									   "\n" + zipProc->getErrout());
 32.2055 -						err=aborted;
 32.2056 -					} else
 32.2057 -					{
 32.2058 -						if (zipProc->exitStatus()>0)
 32.2059 -						{
 32.2060 -							QMessageBox::critical( 0, tr( "Critical Save Error" ),
 32.2061 -									   QString("zip exit code:  %1").arg(zipProc->exitStatus() )+
 32.2062 -									   "\n" + zipProc->getErrout() );
 32.2063 -							err=aborted;
 32.2064 -						}
 32.2065 -					}
 32.2066 -				}	// zip could be started
 32.2067 +				zipDir (tmpMapDir,fn);
 32.2068  			} // save zipped
 32.2069  			else
 32.2070  			{
 32.2071  				// Save unzipped. 
 32.2072 -				safeFilePath=currentMapEditor()->getFilePath();
 32.2073 -				currentMapEditor()->setFilePath (fn, safeFilePath);
 32.2074 -				currentMapEditor()->save (savemode);
 32.2075 -				currentMapEditor()->setFilePath (safeFilePath);
 32.2076 +				safeFilePath=me->getFilePath();
 32.2077 +				me->setFilePath (fn, safeFilePath);
 32.2078 +				me->save (savemode);
 32.2079 +				me->setFilePath (safeFilePath);
 32.2080  			} // save zipped 	
 32.2081  		} // filepath available
 32.2082  		else
 32.2083 @@ -1399,19 +1914,20 @@
 32.2084  		}
 32.2085      }
 32.2086  
 32.2087 -	if (currentMapEditor()->saveZipped())
 32.2088 -	{
 32.2089 +	if (saveZipped && !tmpMapDir.isEmpty())
 32.2090  		// Delete tmpDir
 32.2091 -		system ( "rm -rf "+ tmpMapDir );
 32.2092 -	} 
 32.2093 +		removeDir (QDir(tmpMapDir));
 32.2094  
 32.2095  	if (err==success)
 32.2096 +	{
 32.2097  		statusBar()->message( 
 32.2098 -			tr("Saved")+" " + currentMapEditor()->getFilePath(), 
 32.2099 +			tr("Saved  %1").arg(me->getFilePath()), 
 32.2100  			statusbarTime );
 32.2101 -	else		
 32.2102 +		lastMaps.prepend(me->getFilePath() );
 32.2103 +		setupLastMapsMenu();
 32.2104 +	} else		
 32.2105  		statusBar()->message( 
 32.2106 -			tr("Couldn't save")+" " + currentMapEditor()->getFilePath(), 
 32.2107 +			tr("Couldn't save ").arg(me->getFilePath()), 
 32.2108  			statusbarTime );
 32.2109  }
 32.2110  
 32.2111 @@ -1422,26 +1938,25 @@
 32.2112  
 32.2113  void Main::fileSaveAs(const SaveMode& savemode)
 32.2114  {
 32.2115 -	QString tmpMapDir;
 32.2116  	QString fn;
 32.2117  
 32.2118  	if (currentMapEditor())
 32.2119  	{
 32.2120  		if (savemode==CompleteMap)
 32.2121 -			fn = QFileDialog::getSaveFileName( QString::null, "VYM map (*.vym)", this );
 32.2122 +			fn = Q3FileDialog::getSaveFileName( QString::null, "VYM map (*.vym)", this );
 32.2123  		else		
 32.2124 -			fn = QFileDialog::getSaveFileName( QString::null, "VYM part of map (*.vyp)", this );
 32.2125 +			fn = Q3FileDialog::getSaveFileName( QString::null, "VYM part of map (*.vyp)", this );
 32.2126  		if ( !fn.isEmpty() ) 
 32.2127  		{
 32.2128  			// Check for existing file
 32.2129  			if (QFile (fn).exists())
 32.2130  			{
 32.2131 -				QMessageBox mb( "VYM",
 32.2132 -					tr("The file ") + fn + tr ("\nexists already. Do you want to"),
 32.2133 +				QMessageBox mb( __VYM,
 32.2134 +					tr("The file %1\nexists already. Do you want to").arg(fn),
 32.2135  					QMessageBox::Warning,
 32.2136  					QMessageBox::Yes | QMessageBox::Default,
 32.2137  					QMessageBox::Cancel | QMessageBox::Escape,
 32.2138 -					QMessageBox::QMessageBox::NoButton);
 32.2139 +					QMessageBox::NoButton);
 32.2140  				mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
 32.2141  				mb.setButtonText( QMessageBox::Cancel, tr("Cancel"));
 32.2142  				switch( mb.exec() ) 
 32.2143 @@ -1477,8 +1992,9 @@
 32.2144  			fileSave(savemode);
 32.2145  
 32.2146  			// Set name of tab
 32.2147 -			tabWidget->setTabLabel (currentMapEditor(),
 32.2148 -				currentMapEditor()->getFileName() );
 32.2149 +			if (savemode==CompleteMap)
 32.2150 +				tabWidget->setTabLabel (currentMapEditor(),
 32.2151 +					currentMapEditor()->getFileName() );
 32.2152  			return;
 32.2153  		} 
 32.2154  	}
 32.2155 @@ -1489,6 +2005,73 @@
 32.2156  	fileSaveAs (CompleteMap);
 32.2157  }
 32.2158  
 32.2159 +void Main::fileImportKDEBookmarks()
 32.2160 +{
 32.2161 +	ImportKDEBookmarks im;
 32.2162 +	im.transform();
 32.2163 +	if (success==fileLoad (im.getTransformedFile(),NewMap) && currentMapEditor() )
 32.2164 +		currentMapEditor()->setFilePath ("");
 32.2165 +}
 32.2166 +
 32.2167 +void Main::fileImportFirefoxBookmarks()
 32.2168 +{
 32.2169 +	Q3FileDialog *fd=new Q3FileDialog( this);
 32.2170 +	fd->setDir (vymBaseDir.homeDirPath()+"/.mozilla/firefox");
 32.2171 +	fd->setMode (Q3FileDialog::ExistingFiles);
 32.2172 +	fd->addFilter ("Firefox "+tr("Bookmarks")+" (*.html)");
 32.2173 +	fd->setCaption(tr("Import")+" "+"Firefox "+tr("Bookmarks"));
 32.2174 +	fd->show();
 32.2175 +
 32.2176 +	if ( fd->exec() == QDialog::Accepted )
 32.2177 +	{
 32.2178 +		ImportFirefoxBookmarks im;
 32.2179 +	    QStringList flist = fd->selectedFiles();
 32.2180 +		QStringList::Iterator it = flist.begin();
 32.2181 +		while( it != flist.end() ) 
 32.2182 +		{
 32.2183 +			im.setFile (*it);
 32.2184 +			if (im.transform() && 
 32.2185 +				success==fileLoad (im.getTransformedFile(),NewMap) && 
 32.2186 +				currentMapEditor() )
 32.2187 +				currentMapEditor()->setFilePath ("");
 32.2188 +			++it;
 32.2189 +		}
 32.2190 +	}
 32.2191 +	delete (fd);
 32.2192 +}
 32.2193 +
 32.2194 +void Main::fileImportMM()
 32.2195 +{
 32.2196 +	ImportMM im;
 32.2197 +
 32.2198 +	Q3FileDialog *fd=new Q3FileDialog( this);
 32.2199 +	if (!lastFileDir.isEmpty()) 
 32.2200 +		fd->setDir (lastFileDir);
 32.2201 +	fd->setMode (Q3FileDialog::ExistingFiles);
 32.2202 +	fd->addFilter ("Mind Manager (*.mmap)");
 32.2203 +	fd->setCaption(tr("Import")+" "+"Mind Manager");
 32.2204 +	fd->show();
 32.2205 +
 32.2206 +	if ( fd->exec() == QDialog::Accepted )
 32.2207 +	{
 32.2208 +		lastFileDir=fd->dirPath();
 32.2209 +	    QStringList flist = fd->selectedFiles();
 32.2210 +		QStringList::Iterator it = flist.begin();
 32.2211 +		while( it != flist.end() ) 
 32.2212 +		{
 32.2213 +			im.setFile (*it);
 32.2214 +			if (im.transform() && 
 32.2215 +				success==fileLoad (im.getTransformedFile(),NewMap) && 
 32.2216 +				currentMapEditor() )
 32.2217 +				currentMapEditor()->setFilePath ("");
 32.2218 +
 32.2219 +			++it;
 32.2220 +		}
 32.2221 +	}
 32.2222 +	delete (fd);
 32.2223 +
 32.2224 +}
 32.2225 +
 32.2226  void Main::fileImportDir()
 32.2227  {
 32.2228  	if (currentMapEditor())
 32.2229 @@ -1505,32 +2088,16 @@
 32.2230  	}	
 32.2231  }
 32.2232  
 32.2233 -void Main::fileExportHTML()
 32.2234 -{
 32.2235 -	if (currentMapEditor())
 32.2236 -	{
 32.2237 -		ExportHTMLDialog dia(this);
 32.2238 -		
 32.2239 -		if (dia.exec()==QDialog::Accepted)
 32.2240 -		{
 32.2241 -			QString dir=dia.getDir();
 32.2242 -			if (reallyWriteDirectory(dir) )
 32.2243 -			{
 32.2244 -				currentMapEditor()->exportXML (dia.getDir() );
 32.2245 -				dia.doExport(currentMapEditor()->getMapName() );
 32.2246 -			}	
 32.2247 -		}
 32.2248 -	}	
 32.2249 -}
 32.2250  
 32.2251  void Main::fileExportXHTML()
 32.2252  {
 32.2253 +	MapEditor *me=currentMapEditor();
 32.2254  	QString dir;
 32.2255 -	if (currentMapEditor())
 32.2256 +	if (me)
 32.2257  	{
 32.2258  		ExportXHTMLDialog dia(this);
 32.2259 -		dia.setFilePath (currentMapEditor()->getFilePath() );
 32.2260 -		dia.setMapName (currentMapEditor()->getMapName() );
 32.2261 +		dia.setFilePath (me->getFilePath() );
 32.2262 +		dia.setMapName (me->getMapName() );
 32.2263  		dia.readSettings();
 32.2264  		
 32.2265  		if (dia.exec()==QDialog::Accepted)
 32.2266 @@ -1546,10 +2113,10 @@
 32.2267  
 32.2268  			if (ok)
 32.2269  			{
 32.2270 -				currentMapEditor()->exportXML (dia.getDir() );
 32.2271 -				dia.doExport(currentMapEditor()->getMapName() );
 32.2272 +				me->exportXML (dia.getDir() );
 32.2273 +				dia.doExport(me->getMapName() );
 32.2274  				if (dia.hasChanged())
 32.2275 -					currentMapEditor()->setChanged();
 32.2276 +					me->setChanged();
 32.2277  			}	
 32.2278  		}
 32.2279  	}	
 32.2280 @@ -1557,23 +2124,103 @@
 32.2281  
 32.2282  void Main::fileExportImage(int item)
 32.2283  {
 32.2284 -	if (currentMapEditor())
 32.2285 +	MapEditor *me=currentMapEditor();
 32.2286 +	if (me)
 32.2287  	{
 32.2288 -		QString fn = QFileDialog::getSaveFileName( QString::null, "Image  (*.bmp *.jpg *.pbm *.pgm *.png *.ppm *xbm *.xpm)",
 32.2289 +		QString fn = Q3FileDialog::getSaveFileName( QString::null, "Image  (*.bmp *.jpg *.pbm *.pgm *.png *.ppm *xbm *.xpm)",
 32.2290  							   this );
 32.2291  		if ( !fn.isEmpty() ) 
 32.2292 -		{
 32.2293 -			currentMapEditor()->exportImage(fn,item);
 32.2294 -		} else {
 32.2295 -			statusBar()->message( tr("Couldn't save") + fn, statusbarTime );
 32.2296 -		}
 32.2297 +			me->exportImage(fn,item);
 32.2298 +		else 
 32.2299 +			statusBar()->message( tr("Couldn't save %1").arg(fn), statusbarTime );
 32.2300 +		
 32.2301  	}
 32.2302  }
 32.2303  
 32.2304  void Main::fileExportASCII()
 32.2305  {
 32.2306 -	if (currentMapEditor())
 32.2307 -		currentMapEditor()->exportASCII();	
 32.2308 +	MapEditor *me=currentMapEditor();
 32.2309 +	if (me)
 32.2310 +	{
 32.2311 +		ExportASCII ex;
 32.2312 +		ex.setMapCenter(me->getMapCenter());
 32.2313 +		ex.addFilter ("TXT (*.txt)");
 32.2314 +		ex.setCaption(__VYM " -" +tr("Export as ASCII")+" "+tr("(still experimental)"));
 32.2315 +		if (ex.execDialog() ) 
 32.2316 +		{
 32.2317 +			me->setExportMode(true);
 32.2318 +			ex.doExport();
 32.2319 +			me->setExportMode(false);
 32.2320 +		}
 32.2321 +	}
 32.2322 +}
 32.2323 +
 32.2324 +void Main::fileExportLaTeX()
 32.2325 +{
 32.2326 +	MapEditor *me=currentMapEditor();
 32.2327 +	if (me)
 32.2328 +	{
 32.2329 +		ExportLaTeX ex;
 32.2330 +		ex.setMapCenter(me->getMapCenter());
 32.2331 +		ex.addFilter ("Tex (*.tex)");
 32.2332 +		ex.setCaption(__VYM " -" +tr("Export as LaTeX")+" "+tr("(still experimental)"));
 32.2333 +		if (ex.execDialog() ) 
 32.2334 +		{
 32.2335 +			me->setExportMode(true);
 32.2336 +			ex.doExport();
 32.2337 +			me->setExportMode(false);
 32.2338 +		}
 32.2339 +	}
 32.2340 +}
 32.2341 +
 32.2342 +void Main::fileExportKDEBookmarks()
 32.2343 +{
 32.2344 +	ExportKDEBookmarks ex;
 32.2345 +	MapEditor *me=currentMapEditor();
 32.2346 +	if (me)
 32.2347 +	{
 32.2348 +		ex.setMapCenter (me->getMapCenter() );
 32.2349 +		ex.doExport();
 32.2350 +	}	
 32.2351 +}
 32.2352 +
 32.2353 +void Main::fileExportTaskjuggler()
 32.2354 +{
 32.2355 +	ExportTaskjuggler ex;
 32.2356 +	MapEditor *me=currentMapEditor();
 32.2357 +	if (me)
 32.2358 +	{
 32.2359 +		ex.setMapCenter (me->getMapCenter() );
 32.2360 +		ex.setCaption ( __VYM " - "+tr("Export to")+" Taskjuggler"+tr("(still experimental)"));
 32.2361 +		ex.addFilter ("Taskjuggler (*.tjp)");
 32.2362 +		if (ex.execDialog() ) 
 32.2363 +		{
 32.2364 +			me->setExportMode(true);
 32.2365 +			ex.doExport();
 32.2366 +			me->setExportMode(false);
 32.2367 +		}
 32.2368 +	}	
 32.2369 +}
 32.2370 +
 32.2371 +void Main::fileExportOOPresentation()
 32.2372 +{
 32.2373 +	ExportOOFileDialog *fd=new ExportOOFileDialog( this,__VYM " - "+tr("Export to")+" Open Office");
 32.2374 +	// FIXME add extra info in dialog
 32.2375 +	//ImagePreview *p =new ImagePreview (fd);
 32.2376 +	//fd->setContentsPreviewEnabled( TRUE );
 32.2377 +	//fd->setContentsPreview( p, p );
 32.2378 +	//fd->setPreviewMode( QFileDialog::Contents );
 32.2379 +	fd->setCaption(__VYM " - " +tr("Export to")+" Open Office");
 32.2380 +	//fd->setDir (lastImageDir);
 32.2381 +	fd->show();
 32.2382 +
 32.2383 +	if ( fd->exec() == QDialog::Accepted )
 32.2384 +	{
 32.2385 +		QString fn=fd->selectedFile();
 32.2386 +		//lastImageDir=fn.left(fn.findRev ("/"));
 32.2387 +		if (currentMapEditor())
 32.2388 +			currentMapEditor()->exportOOPresentation(fn,fd->selectedConfig());	
 32.2389 +	}
 32.2390  }
 32.2391  
 32.2392  void Main::fileCloseMap()
 32.2393 @@ -1582,9 +2229,8 @@
 32.2394  	{
 32.2395  		if (currentMapEditor()->hasChanged())
 32.2396  		{
 32.2397 -			QMessageBox mb( "VYM",
 32.2398 -				tr("The map ") + currentMapEditor()->getFileName() +
 32.2399 -				tr(" has been modified but not saved yet. Do you want to"),
 32.2400 +			QMessageBox mb( __VYM,
 32.2401 +				tr("The map %1 has been modified but not saved yet. Do you want to").arg(currentMapEditor()->getFileName()),
 32.2402  				QMessageBox::Warning,
 32.2403  				QMessageBox::Yes | QMessageBox::Default,
 32.2404  				QMessageBox::No,
 32.2405 @@ -1632,7 +2278,7 @@
 32.2406  		if (me->isUnsaved())
 32.2407  		{
 32.2408  			tabWidget->setCurrentPage(i);
 32.2409 -			QMessageBox mb( "VYM",
 32.2410 +			QMessageBox mb( __VYM,
 32.2411  				tr("This map is not saved yet. Do you want to"),
 32.2412  				QMessageBox::Warning,
 32.2413  				QMessageBox::Yes | QMessageBox::Default,
 32.2414 @@ -1641,12 +2287,6 @@
 32.2415  			mb.setButtonText( QMessageBox::Yes, tr("Save map") );
 32.2416  			mb.setButtonText( QMessageBox::No, tr("Discard changes") );
 32.2417  			mb.show();
 32.2418 -			// Call undocumented function: setActiveWindow is only
 32.2419 -			// possible, if widget is visible. This depends on
 32.2420 -			// windowmanager...
 32.2421 -#if defined(Q_OS_LINUX)
 32.2422 -			qt_wait_for_window_manager( this);
 32.2423 -#endif			
 32.2424  			mb.setActiveWindow();
 32.2425  			switch( mb.exec() ) {
 32.2426  				case QMessageBox::Yes:
 32.2427 @@ -1671,8 +2311,10 @@
 32.2428  		currentMapEditor()->undo();
 32.2429  }
 32.2430  
 32.2431 -void Main::editRedo()	    // TODO
 32.2432 +void Main::editRedo()	   
 32.2433  {
 32.2434 +	if (currentMapEditor())
 32.2435 +		currentMapEditor()->redo();
 32.2436  }
 32.2437  
 32.2438  void Main::editCopy()
 32.2439 @@ -1697,13 +2339,6 @@
 32.2440  {
 32.2441  	findWindow->popup();
 32.2442  	findWindow->raise();
 32.2443 -
 32.2444 -	// Call undocumented function: setActiveWindow is only
 32.2445 -	// possible, if widget is visible. This depends on
 32.2446 -	// windowmanager...
 32.2447 -#if defined(Q_OS_LINUX)
 32.2448 -	qt_wait_for_window_manager( this);
 32.2449 -#endif	
 32.2450  	findWindow->setActiveWindow();
 32.2451  }
 32.2452  
 32.2453 @@ -1717,8 +2352,7 @@
 32.2454  	} else
 32.2455  	{
 32.2456  		QMessageBox::information( findWindow, tr( "VYM -Information:" ),
 32.2457 -							   tr("No matches found for ")+
 32.2458 -							   "'<b>"+s+"</b>'");
 32.2459 +							   tr("No matches found for \"%1\"").arg(s));
 32.2460  	}	
 32.2461  }
 32.2462  
 32.2463 @@ -1729,8 +2363,70 @@
 32.2464  
 32.2465  void Main::editOpenURL()
 32.2466  {
 32.2467 +	// Open new browser
 32.2468  	if (currentMapEditor())
 32.2469 -	    currentMapEditor()->openURL();
 32.2470 +	{	
 32.2471 +	    QString url=currentMapEditor()->getURL();
 32.2472 +		if (url=="") return;
 32.2473 +		QString browser=settings.readEntry("/vym/mainwindow/readerURL" );
 32.2474 +		procBrowser = new Q3Process( this );
 32.2475 +
 32.2476 +		procBrowser->addArgument( browser);
 32.2477 +		procBrowser->addArgument( url);
 32.2478 +
 32.2479 +		if ( !procBrowser->start() ) 
 32.2480 +		{
 32.2481 +			// try to set path to browser
 32.2482 +			QMessageBox::warning(0, 
 32.2483 +				tr("Warning"),
 32.2484 +				tr("Couldn't find a viewer to open %1.\n").arg(url)+
 32.2485 +				tr("Please use Settings->")+tr("Set application to open an URL"));
 32.2486 +			settingsURL() ; 
 32.2487 +		}	
 32.2488 +	}	
 32.2489 +}
 32.2490 +void Main::editOpenURLTab()
 32.2491 +{
 32.2492 +	if (currentMapEditor())
 32.2493 +	{	
 32.2494 +	    QString url=currentMapEditor()->getURL();
 32.2495 +		if (url=="") return;
 32.2496 +		QString browser=settings.readEntry("/vym/mainwindow/readerURL" );
 32.2497 +		if (procBrowser && procBrowser->isRunning())
 32.2498 +		{
 32.2499 +			if (browser.contains("konqueror"))
 32.2500 +			{
 32.2501 +				// Try to open new tab in existing konqueror started previously by vym
 32.2502 +				Q3Process *p=new Q3Process (this);
 32.2503 +				p->addArgument ("dcop");
 32.2504 +				p->addArgument (QString("konqueror-%1").arg(procBrowser->processIdentifier()));
 32.2505 +				p->addArgument ("konqueror-mainwindow#1");
 32.2506 +				p->addArgument ("newTab");
 32.2507 +				p->addArgument (url);
 32.2508 +				if ( !p->start() ) 
 32.2509 +					// try to set browser
 32.2510 +					QMessageBox::warning(0, 
 32.2511 +						tr("Warning"),
 32.2512 +						tr("Couldn't start %1 to open a new tab in %2.").arg("dcop").arg("konqueror"));
 32.2513 +				return;		
 32.2514 +			} else if (browser.contains ("firefox") || browser.contains ("mozilla") )
 32.2515 +			{
 32.2516 +				// Try to open new tab in firefox
 32.2517 +				Q3Process *p=new Q3Process (this);
 32.2518 +				p->addArgument (browser);
 32.2519 +				p->addArgument ("-remote");
 32.2520 +				p->addArgument (QString("openurl(%1,new-tab)").arg(url));
 32.2521 +				if ( !p->start() ) 
 32.2522 +					// try to set browser
 32.2523 +					QMessageBox::warning(0, 
 32.2524 +						tr("Warning"),
 32.2525 +						tr("Couldn't start %1 to open a new tab").arg(browser));
 32.2526 +				return;		
 32.2527 +			}
 32.2528 +		}
 32.2529 +		// Open new browser
 32.2530 +		editOpenURL();
 32.2531 +	}	
 32.2532  }
 32.2533  
 32.2534  void Main::editURL()
 32.2535 @@ -1751,6 +2447,12 @@
 32.2536  	    currentMapEditor()->editBugzilla2URL();
 32.2537  }
 32.2538  
 32.2539 +void Main::editFATE2URL()
 32.2540 +{
 32.2541 +	if (currentMapEditor())
 32.2542 +	    currentMapEditor()->editFATE2URL();
 32.2543 +}
 32.2544 +
 32.2545  void Main::editOpenVymLink()
 32.2546  {
 32.2547  	// Get current path to map
 32.2548 @@ -1776,7 +2478,7 @@
 32.2549  		{
 32.2550  			if (!QFile(currentVymLink).exists() )
 32.2551  				QMessageBox::critical( 0, tr( "Critical Error" ),
 32.2552 -				   tr("Couldn't open map " +currentVymLink)+".");
 32.2553 +				   tr("Couldn't open map %1").arg(currentVymLink));
 32.2554  			else
 32.2555  			{
 32.2556  				fileLoad (currentVymLink, NewMap);
 32.2557 @@ -1800,6 +2502,12 @@
 32.2558  		currentMapEditor()->deleteVymLink();	
 32.2559  }
 32.2560  
 32.2561 +void Main::editToggleHideExport()
 32.2562 +{
 32.2563 +	if (currentMapEditor())
 32.2564 +		currentMapEditor()->toggleHideExport();	
 32.2565 +}
 32.2566 +
 32.2567  void Main::editMapInfo()
 32.2568  {
 32.2569  	if (currentMapEditor())
 32.2570 @@ -1846,6 +2554,12 @@
 32.2571  		currentMapEditor()->addNewBranch(0);
 32.2572  }
 32.2573  
 32.2574 +void Main::editNewBranchHere()
 32.2575 +{
 32.2576 +	if (currentMapEditor())
 32.2577 +		currentMapEditor()->addNewBranchHere();
 32.2578 +}
 32.2579 +
 32.2580  void Main::editNewBranchAbove()
 32.2581  {
 32.2582  	if (currentMapEditor())
 32.2583 @@ -1873,9 +2587,21 @@
 32.2584  	fileSaveAs (PartOfMap);
 32.2585  }
 32.2586  
 32.2587 +void Main::editRemoveBranchKeepChilds()
 32.2588 +{
 32.2589 +	if (currentMapEditor())
 32.2590 +		currentMapEditor()->removeBranchKeepChilds();
 32.2591 +}
 32.2592 +
 32.2593 +void Main::editRemoveChilds()
 32.2594 +{
 32.2595 +	if (currentMapEditor())
 32.2596 +		currentMapEditor()->removeChilds();
 32.2597 +}
 32.2598 +
 32.2599  void Main::editDeleteSelection()
 32.2600  {
 32.2601 -	if (currentMapEditor())
 32.2602 +	if (currentMapEditor() && actionSettingsUseDelKey->isOn())
 32.2603  		currentMapEditor()->deleteSelection();
 32.2604  }
 32.2605  
 32.2606 @@ -1927,10 +2653,16 @@
 32.2607  		currentMapEditor()->saveFloatImage(item);
 32.2608  }
 32.2609  
 32.2610 -void Main::editToggleFloatExport()
 32.2611 +void Main::editFollowXLink(int item)
 32.2612  {
 32.2613  	if (currentMapEditor())
 32.2614 -		currentMapEditor()->toggleFloatExport();
 32.2615 +		currentMapEditor()->followXLink(branchLinksContextMenu->indexOf(item));
 32.2616 +}
 32.2617 +
 32.2618 +void Main::editEditXLink(int item)
 32.2619 +{
 32.2620 +	if (currentMapEditor())
 32.2621 +		currentMapEditor()->editXLink(branchLinksContextMenuDup->indexOf(item));
 32.2622  }
 32.2623  
 32.2624  void Main::formatSelectColor()
 32.2625 @@ -2022,11 +2754,29 @@
 32.2626  		currentMapEditor()->setFrame(Rectangle);
 32.2627  }
 32.2628  
 32.2629 +void Main::formatIncludeImagesVer()
 32.2630 +{
 32.2631 +	if (currentMapEditor())
 32.2632 +		currentMapEditor()->setIncludeImagesVer(actionFormatIncludeImagesVer->isOn());
 32.2633 +}
 32.2634 +
 32.2635 +void Main::formatIncludeImagesHor()
 32.2636 +{
 32.2637 +	if (currentMapEditor())
 32.2638 +		currentMapEditor()->setIncludeImagesHor(actionFormatIncludeImagesHor->isOn());
 32.2639 +}
 32.2640 +
 32.2641 +void Main::formatHideLinkUnselected()
 32.2642 +{
 32.2643 +	if (currentMapEditor())
 32.2644 +		currentMapEditor()->setHideLinkUnselected(actionFormatHideLinkUnselected->isOn());
 32.2645 +}
 32.2646 +
 32.2647  void Main::viewZoomReset()
 32.2648  {
 32.2649  	if (currentMapEditor())
 32.2650  	{
 32.2651 -		QWMatrix m;
 32.2652 +		QMatrix m;
 32.2653  		m.reset();
 32.2654  		currentMapEditor()->setWorldMatrix( m );
 32.2655  		currentMapEditor()->setViewCenter();
 32.2656 @@ -2038,7 +2788,7 @@
 32.2657  {
 32.2658  	if (currentMapEditor())
 32.2659  	{
 32.2660 -		QWMatrix m = currentMapEditor()->worldMatrix();
 32.2661 +		QMatrix m = currentMapEditor()->worldMatrix();
 32.2662  		m.scale( 1.25, 1.25 );
 32.2663  		currentMapEditor()->setWorldMatrix( m );
 32.2664  		currentMapEditor()->setViewCenter();
 32.2665 @@ -2050,19 +2800,28 @@
 32.2666  {
 32.2667  	if (currentMapEditor())
 32.2668  	{
 32.2669 -		QWMatrix m = currentMapEditor()->worldMatrix();
 32.2670 +		QMatrix m = currentMapEditor()->worldMatrix();
 32.2671  		m.scale( 0.8, 0.8 );
 32.2672  		currentMapEditor()->setWorldMatrix( m );
 32.2673  		currentMapEditor()->setViewCenter();
 32.2674  		currentMapEditor()->adjustCanvasSize();
 32.2675  	}	
 32.2676  }
 32.2677 +
 32.2678 +void Main::modModeColor()
 32.2679 +{
 32.2680 +}
 32.2681 +
 32.2682 +void Main::modModeLink()
 32.2683 +{
 32.2684 +}
 32.2685 +
 32.2686  bool Main::settingsPDF()
 32.2687  {
 32.2688  	// Default browser is set in constructor
 32.2689  	bool ok;
 32.2690  	QString text = QInputDialog::getText(
 32.2691 -		"VYM", tr("Enter path for pdf reader:"), QLineEdit::Normal,
 32.2692 +		"VYM", tr("Set application to open PDF files")+":", QLineEdit::Normal,
 32.2693  		settings.readEntry("/vym/mainwindow/readerPDF"), &ok, this );
 32.2694  	if (ok)
 32.2695  		settings.writeEntry ("/vym/mainwindow/readerPDF",text);
 32.2696 @@ -2075,7 +2834,7 @@
 32.2697  	// Default browser is set in constructor
 32.2698  	bool ok;
 32.2699  	QString text = QInputDialog::getText(
 32.2700 -		"VYM", tr("Enter path for application to open an URL:"), QLineEdit::Normal,
 32.2701 +		"VYM", tr("Set application to open an URL")+":", QLineEdit::Normal,
 32.2702  		settings.readEntry("/vym/mainwindow/readerURL")
 32.2703  		, &ok, this );
 32.2704  	if (ok)
 32.2705 @@ -2083,6 +2842,17 @@
 32.2706  	return ok;
 32.2707  }
 32.2708  
 32.2709 +void Main::settingsToggleDelKey()
 32.2710 +{
 32.2711 +	if (actionSettingsUseDelKey->isOn())
 32.2712 +	{
 32.2713 +		actionEditDelete->setAccel (QKeySequence (Qt::Key_Delete));
 32.2714 +	} else
 32.2715 +	{
 32.2716 +		actionEditDelete->setAccel (QKeySequence (""));
 32.2717 +	}
 32.2718 +}
 32.2719 +
 32.2720  void Main::windowToggleNoteEditor()
 32.2721  {
 32.2722  	if (textEditor->showWithMain() )
 32.2723 @@ -2091,6 +2861,18 @@
 32.2724  		windowShowNoteEditor();
 32.2725  }
 32.2726  
 32.2727 +void Main::windowToggleHistory()
 32.2728 +{
 32.2729 +	if (currentMapEditor())
 32.2730 +		currentMapEditor()->toggleHistoryWindow();
 32.2731 +}
 32.2732 +
 32.2733 +void Main::updateNoteFlag()
 32.2734 +{
 32.2735 +	if (currentMapEditor())
 32.2736 +		currentMapEditor()->updateNoteFlag();
 32.2737 +}
 32.2738 +
 32.2739  void Main::windowShowNoteEditor()
 32.2740  {
 32.2741  	textEditor->setShowWithMain(true);
 32.2742 @@ -2124,20 +2906,18 @@
 32.2743  
 32.2744  void Main::testFunction()
 32.2745  {
 32.2746 -	//textEditor->stackUnder(this);
 32.2747  	currentMapEditor()->testFunction();
 32.2748  }
 32.2749  
 32.2750 -void Main::testShowClipboard()
 32.2751 -{
 32.2752 -	clipboardME->show();
 32.2753 -}
 32.2754 -
 32.2755  void Main::helpDoc()
 32.2756  {
 32.2757  	QString docpath;
 32.2758 -	// default path in SUSE LINUX
 32.2759 -	docpath="/usr/share/doc/packages/vym/doc/vym.pdf";
 32.2760 +	#if defined(Q_OS_MACX)
 32.2761 +		docpath="./vym.app/Contents/vym.pdf";
 32.2762 +	#else
 32.2763 +		// default path in SUSE LINUX
 32.2764 +		docpath="/usr/share/doc/packages/vym/doc/vym.pdf";
 32.2765 +	#endif
 32.2766  
 32.2767  	if (!QFile (docpath).exists() )
 32.2768  	{
 32.2769 @@ -2149,11 +2929,16 @@
 32.2770  			docpath="doc/tex/vym.pdf";
 32.2771  			if (!QFile (docpath).exists() )
 32.2772  			{
 32.2773 -				QMessageBox::critical(0, 
 32.2774 -				tr("Critcal error"),
 32.2775 -				tr("Couldn't find the documentation\n"
 32.2776 -				"vym.pdf in various places."));
 32.2777 -				return;
 32.2778 +				// Try yet another one for Knoppix
 32.2779 +				docpath="/usr/share/doc/packages/vym/vym.pdf";
 32.2780 +				if (!QFile (docpath).exists() )
 32.2781 +				{
 32.2782 +					QMessageBox::critical(0, 
 32.2783 +					tr("Critcal error"),
 32.2784 +					tr("Couldn't find the documentation\n"
 32.2785 +					"vym.pdf in various places."));
 32.2786 +					return;
 32.2787 +				}	
 32.2788  			}	
 32.2789  		}
 32.2790  	}
 32.2791 @@ -2166,10 +2951,11 @@
 32.2792  	if ( !pdfProc->start() ) 
 32.2793  	{
 32.2794  		// error handling
 32.2795 -		QMessageBox::critical(0, 
 32.2796 -		tr("Critcal error"),
 32.2797 -		tr("Couldn't find a viewer to read vym.pdf.\n"
 32.2798 -		"Please use Settings->")+tr("Set application to open pdf files"));
 32.2799 +		QMessageBox::warning(0, 
 32.2800 +			tr("Warning"),
 32.2801 +			tr("Couldn't find a viewer to open %1.\n").arg("vym.pdf")+
 32.2802 +			tr("Please use Settings->")+tr("Set application to open PDF files"));
 32.2803 +		settingsPDF();	
 32.2804  		return;
 32.2805  	}
 32.2806  }
 32.2807 @@ -2177,33 +2963,11 @@
 32.2808  
 32.2809  void Main::helpAbout()
 32.2810  {
 32.2811 -    static QMessageBox* about = new QMessageBox( "VYM",
 32.2812 -			"<h3>VYM - View Your Mind </h3>"
 32.2813 -			"<p> A tool to put the things you have got in your mind into a map.</p>"
 32.2814 -			"<ul>"
 32.2815 -				"<li> (c) by Uwe Drechsel (vym@InSilmaril.de)</li>"
 32.2816 -				"<li> vym is released under the GPL (Gnu General Public License)"
 32.2817 -				", with one exception (see the file \"LICENSE\"which "
 32.2818 -				"comes with vym). This exception is needed to build vym with QT libraries for proprietary operating systems.</li>"
 32.2819 -				"<li> Project homepage <a href=\"http:/www.InSilmaril.de/vym\">"
 32.2820 -    					"http:/www.InSilmaril.de/vym</a></li>"
 32.2821 -			"<li> Credits " 
 32.2822 -				"<ul>"
 32.2823 -					"<li>Thomas Schraitle for the stylesheet  used for XHTML-export </li>"
 32.2824 -					"<li>Clemens Kraus for stylesheets and script used for HTML-export "
 32.2825 -					"<a href=\"http://www.clemens-kraus.de\">(www.clemens-kraus.de)</a></li>"
 32.2826 -					"<li>Alexander Johannesen for providing stylesheets from his xsiteable project " 
 32.2827 -					"<a href=\"http://www.shelter.nu/xsiteable/xsiteable.html\">(www.shelter.nu/xsiteable/xsiteable.html)</a>. </li>"
 32.2828 -					"<li>Ken Wimer and Olaf Hering for Mac support</li>"
 32.2829 -				"</ul>"
 32.2830 -			"</li>"
 32.2831 -			"<li> Version "  __VYM_VERSION__  "</li>"
 32.2832 -				"<li> Build date "  __BUILD_DATE__"</li>"
 32.2833 -			"</ul>", QMessageBox::Information, 1, 0, 0, this, 0, FALSE );
 32.2834 -    about->setButtonText( 1, "Dismiss" );
 32.2835 -    about->setMinimumSize(QSize(300,300));
 32.2836 -	about->setIconPixmap (QPixmap(vym_logo_xpm));
 32.2837 -    about->show();
 32.2838 +	AboutDialog ad;
 32.2839 +	ad.setName ("aboutwindow");
 32.2840 +	ad.setMinimumSize(500,500);
 32.2841 +	ad.resize (QSize (500,500));
 32.2842 +	ad.exec();
 32.2843  }
 32.2844  
 32.2845  void Main::helpAboutQT()
    33.1 --- a/mainwindow.h	Sun Jan 30 12:58:47 2005 +0000
    33.2 +++ b/mainwindow.h	Tue Jun 06 14:58:11 2006 +0000
    33.3 @@ -1,28 +1,33 @@
    33.4  #ifndef MAINWINDOW_H 
    33.5  #define MAINWINDOW_H
    33.6  
    33.7 -#include <qpopupmenu.h>
    33.8 -#include <qmainwindow.h>
    33.9 -#include <qtextedit.h>
   33.10 -#include <qintdict.h>
   33.11 -#include <qcanvas.h>
   33.12 +#include <q3popupmenu.h>
   33.13 +#include <q3mainwindow.h>
   33.14 +#include <q3textedit.h>
   33.15 +#include <q3intdict.h>
   33.16 +#include <q3canvas.h>
   33.17  #include <qlineedit.h>
   33.18  #include <qaction.h>
   33.19  #include <qcursor.h>
   33.20  #include <qtabwidget.h>
   33.21  #include <qmap.h>
   33.22 +//Added by qt3to4:
   33.23 +#include <QCloseEvent>
   33.24 +#include <QShowEvent>
   33.25 +#include <QHideEvent>
   33.26  
   33.27 +#include "file.h"
   33.28 +#include "findwindow.h"
   33.29 +#include "mapeditor.h"
   33.30 +#include "texteditor.h"
   33.31  #include "xml.h"
   33.32 -#include "texteditor.h"
   33.33 -#include "mapeditor.h"
   33.34 -#include "findwindow.h"
   33.35  
   33.36 -class Main : public QMainWindow 
   33.37 +class Main : public Q3MainWindow 
   33.38  {
   33.39      Q_OBJECT
   33.40  
   33.41  public:
   33.42 -    Main(QWidget* parent=0, const char* name=0, WFlags f=0);
   33.43 +    Main(QWidget* parent=0, const char* name=0, Qt::WFlags f=0);
   33.44      ~Main();
   33.45  	void loadCmdLine();
   33.46  	void statusMessage (const QString &);
   33.47 @@ -38,6 +43,7 @@
   33.48      void setupEditActions();
   33.49      void setupFormatActions();
   33.50      void setupViewActions();
   33.51 +    void setupModeActions();
   33.52      void setupWindowActions();
   33.53      void setupFlagActions();
   33.54      void setupSettingsActions();
   33.55 @@ -55,7 +61,7 @@
   33.56      void newView();
   33.57  	void editorChanged(QWidget*);
   33.58  
   33.59 -    void fileLoad(QString ,const LoadMode &);
   33.60 +    ErrorCode fileLoad(QString ,const LoadMode &);
   33.61      void fileLoad(const LoadMode &);
   33.62      void fileLoad();
   33.63  	void fileLoadLast(int);
   33.64 @@ -63,12 +69,18 @@
   33.65      void fileSave();
   33.66      void fileSaveAs(const SaveMode &);
   33.67      void fileSaveAs();
   33.68 +    void fileImportKDEBookmarks();
   33.69 +    void fileImportFirefoxBookmarks();
   33.70 +    void fileImportMM();
   33.71      void fileImportDir();
   33.72      void fileExportXML();
   33.73 -    void fileExportHTML();
   33.74      void fileExportXHTML();
   33.75      void fileExportImage(int);
   33.76      void fileExportASCII();
   33.77 +    void fileExportLaTeX();
   33.78 +    void fileExportKDEBookmarks();
   33.79 +    void fileExportTaskjuggler();
   33.80 +    void fileExportOOPresentation();
   33.81      void fileCloseMap();
   33.82      void filePrint();
   33.83      void fileExitVYM();
   33.84 @@ -83,15 +95,18 @@
   33.85  	void editFindChanged();
   33.86  public slots:
   33.87  	void editOpenURL();
   33.88 +	void editOpenURLTab();
   33.89  private slots:
   33.90  	void editURL();
   33.91  	void editHeading2URL();
   33.92  	void editBugzilla2URL();
   33.93 +	void editFATE2URL();
   33.94  	void editVymLink();
   33.95  public slots:
   33.96  	void editOpenVymLink();
   33.97  private slots:
   33.98  	void editDeleteVymLink();
   33.99 +	void editToggleHideExport();
  33.100  	void editMapInfo();
  33.101      void editMoveUp();	
  33.102      void editMoveDown();	
  33.103 @@ -99,11 +114,14 @@
  33.104      void editUnScrollAll();
  33.105      void editHeading();
  33.106      void editNewBranch();
  33.107 +    void editNewBranchHere();
  33.108      void editNewBranchAbove();
  33.109      void editNewBranchBelow();
  33.110      void editImportAdd();
  33.111      void editImportReplace();
  33.112      void editSaveBranch();
  33.113 +    void editRemoveBranchKeepChilds();
  33.114 +    void editRemoveChilds();
  33.115      void editDeleteSelection();
  33.116      void editUpperBranch();
  33.117      void editLowerBranch();
  33.118 @@ -113,7 +131,8 @@
  33.119      void editLastBranch();
  33.120      void editLoadImage();
  33.121      void editSaveImage(int);
  33.122 -    void editToggleFloatExport();
  33.123 +    void editFollowXLink (int);
  33.124 +    void editEditXLink (int);
  33.125  
  33.126      void formatSelectColor();
  33.127      void formatPickColor();
  33.128 @@ -129,16 +148,26 @@
  33.129      void formatToggleLinkColorHint();
  33.130  	void formatFrameNone();
  33.131  	void formatFrameRectangle();
  33.132 +	void formatIncludeImagesVer();
  33.133 +	void formatIncludeImagesHor();
  33.134 +	void formatHideLinkUnselected();
  33.135  
  33.136      void viewZoomReset();
  33.137      void viewZoomIn();
  33.138      void viewZoomOut();
  33.139  
  33.140 +	void modModeColor();
  33.141 +	void modModeLink();
  33.142 +
  33.143  public slots:
  33.144  	bool settingsPDF();
  33.145  	bool settingsURL();
  33.146 +	void settingsToggleDelKey();
  33.147  
  33.148  	void windowToggleNoteEditor();
  33.149 +	void windowToggleHistory();
  33.150 +	void updateNoteFlag();
  33.151 +
  33.152  private slots:
  33.153  	void windowNextEditor();
  33.154  	void windowPreviousEditor();
  33.155 @@ -148,19 +177,19 @@
  33.156  	void standardFlagChanged();
  33.157  
  33.158      void testFunction();
  33.159 -    void testShowClipboard();
  33.160  
  33.161      void helpDoc();
  33.162      void helpAbout();
  33.163      void helpAboutQT();
  33.164  
  33.165  private:
  33.166 -    QCanvas* canvas;
  33.167 +// not needed?    QCanvas* canvas;
  33.168  	QTabWidget *tabWidget;
  33.169  	FindWindow *findWindow;
  33.170  	QStringList lastMaps;
  33.171  	int maxLastMaps;
  33.172  	QString lastFileDir;
  33.173 +	Q3Process *procBrowser;
  33.174  };
  33.175  
  33.176  
    34.1 --- a/mapcenterobj.cpp	Sun Jan 30 12:58:47 2005 +0000
    34.2 +++ b/mapcenterobj.cpp	Tue Jun 06 14:58:11 2006 +0000
    34.3 @@ -13,7 +13,7 @@
    34.4      init();
    34.5  }
    34.6  
    34.7 -MapCenterObj::MapCenterObj(QCanvas* c) : BranchObj (c)
    34.8 +MapCenterObj::MapCenterObj(Q3Canvas* c) : BranchObj (c)
    34.9  {
   34.10  //    cout << "Const MapCenterObj   canvas="<<c<<"\n";
   34.11      init();
   34.12 @@ -27,26 +27,18 @@
   34.13  void MapCenterObj::clear() 
   34.14  {
   34.15  	BranchObj::clear();
   34.16 -    init();
   34.17  }
   34.18  
   34.19  void MapCenterObj::init () 
   34.20  {
   34.21 +	BranchObj::init();
   34.22      orientation=OrientUndef;
   34.23 -    absPos=QPoint (canvas->width()/2, canvas->height()/2);
   34.24  
   34.25  	// FIXME this should be done in TextObj later...
   34.26 -	QFont font ("Sans Serif,16,-1,5,50,0,0,0,0,0");		
   34.27 -	heading->setFont(font);
   34.28 -
   34.29 -	branch.setAutoDelete (TRUE);
   34.30 -	floatimage.setAutoDelete (TRUE);
   34.31 -
   34.32 -	move (absPos.x(), absPos.y() );
   34.33 +	//QFont font ("Sans Serif,16,-1,5,50,0,0,0,0,0");		
   34.34 +	//heading->setFont(font);
   34.35  	depth=0;
   34.36 -
   34.37 -	scrolled=false;
   34.38 -	tmpUnscrolled=false;
   34.39 +	setDefAttr(MovedBranch);
   34.40  
   34.41  	frame->setFrameType (Rectangle);
   34.42  }
   34.43 @@ -54,13 +46,11 @@
   34.44  void MapCenterObj::move (double x, double y)
   34.45  {
   34.46  	BranchObj::move(x,y);
   34.47 -	positionBBox();
   34.48  }
   34.49  
   34.50  void MapCenterObj::moveBy (double x, double y)
   34.51  {
   34.52  	BranchObj::moveBy(x,y);
   34.53 -	positionBBox();
   34.54  }
   34.55  
   34.56  void MapCenterObj::moveAll (double x, double y)
   34.57 @@ -77,16 +67,13 @@
   34.58  {
   34.59  	// Move myself
   34.60  	moveBy(dx,dy);
   34.61 -
   34.62 -	positionBBox();
   34.63  }
   34.64  
   34.65  void MapCenterObj::updateLink()
   34.66  {
   34.67  	// set childPos to middle of MapCenterObj
   34.68 -	childPos=QPoint(
   34.69 -		absPos.x() + QSize(getSize() ).width()/2, 
   34.70 -		absPos.y() + QSize(getSize() ).height()/2);
   34.71 +	childPos.setX( clickBox.topLeft().x() + (int)(clickBox.width())/2 );
   34.72 +	childPos.setY( clickBox.topLeft().y() + (int)(clickBox.height())/2 );
   34.73  	parPos=childPos;		
   34.74  	BranchObj *b;
   34.75  	for (b=branch.first(); b; b=branch.next() )
   34.76 @@ -102,19 +89,15 @@
   34.77  	for (bo=branch.first(); bo; bo=branch.next() )
   34.78  	{	
   34.79  		lmo = bo->findMapObj(p, excludeLMO);
   34.80 -		
   34.81 -		if (lmo!= NULL) 
   34.82 -		{
   34.83 -			return lmo;
   34.84 -		}	
   34.85 +		if (lmo!= NULL) return lmo;
   34.86  	}
   34.87  	// is p in MapCenter?
   34.88 -	if (inBBox (p) && (this != excludeLMO) ) return this;
   34.89 +	if (inBox (p) && (this != excludeLMO) ) return this;
   34.90  
   34.91  	// Search float images
   34.92  	FloatImageObj *foi;
   34.93  	for (foi=floatimage.first(); foi; foi=floatimage.next() )
   34.94 -		if (foi->inBBox(p) && (foi != excludeLMO) && foi->getParObj()!= excludeLMO) return foi;
   34.95 +		if (foi->inBox(p) && (foi != excludeLMO) && foi->getParObj()!= excludeLMO) return foi;
   34.96  
   34.97  	// nothing found
   34.98  	return NULL;
   34.99 @@ -131,13 +114,21 @@
  34.100  		attribut("x2",QString().setNum(absPos.x()+width()-offset.x(),10)) +
  34.101  		attribut("y2",QString().setNum(absPos.y()+height()-offset.y(),10));
  34.102  	
  34.103 +	// Providing an ID for a branch makes export to XHTML easier
  34.104 +	QString idAttr;
  34.105 +	if (countXLinks()>0)
  34.106 +		idAttr=attribut ("id",getSelectString());
  34.107 +	else
  34.108 +		idAttr="";
  34.109 +
  34.110 +	QString linkAttr=getLinkAttr();
  34.111 +
  34.112      s=beginElement ("mapcenter" 
  34.113 -		+attribut("absPosX",QString().setNum(absPos.x(),10))
  34.114 -		+attribut("absPosY",QString().setNum(absPos.y(),10))
  34.115 +		+getOrnAttr() 
  34.116  		+attribut("frameType",frame->getFrameTypeName()) 
  34.117  		+areaAttr 
  34.118 -		);
  34.119 -		
  34.120 +		+idAttr 
  34.121 +		+getIncludeImageAttr() );
  34.122      incIndent();
  34.123      if (heading->getColor()!=QColor("black"))
  34.124  		a=attribut ("textColor",QColor(heading->getColor()).name() );
  34.125 @@ -149,23 +140,25 @@
  34.126  	s+=standardFlags->saveToDir(tmpdir+"/flags", "/standardFlag-", verbose);
  34.127      s=s+valueElement("heading", getHeading(),a);
  34.128  
  34.129 -	// Reset the counters before saving
  34.130 -	FloatImageObj (canvas).resetSaveCounter();
  34.131 -
  34.132  	// add link to file in s
  34.133  	if (!note.isEmpty() )
  34.134  		s+=note.saveToDir();
  34.135  	
  34.136 -	// Save FloatImages
  34.137 -	FloatImageObj *fio;
  34.138 -	for (fio=floatimage.first(); fio; fio=floatimage.next() )
  34.139 -		s+=fio->saveToDir (tmpdir,prefix);
  34.140 -
  34.141  	// Save branches
  34.142      BranchObj *bo;
  34.143      for (bo=branch.first(); bo; bo=branch.next() )
  34.144  		s+=bo->saveToDir(tmpdir,prefix, offset);
  34.145  
  34.146 +	// Save FloatImages
  34.147 +	FloatImageObj *fio;
  34.148 +	for (fio=floatimage.first(); fio; fio=floatimage.next() )
  34.149 +		s+=fio->saveToDir (tmpdir,prefix,offset);
  34.150 +
  34.151 +	// Save XLinks
  34.152 +	XLinkObj *xlo;
  34.153 +    for (xlo=xlink.first(); xlo; xlo=xlink.next() )
  34.154 +		s+=xlo->saveToDir();
  34.155 +
  34.156      decIndent();
  34.157      s+=endElement   ("mapcenter");
  34.158      return s;
  34.159 @@ -184,9 +177,9 @@
  34.160  	QString s2=version.section (".",1,1);
  34.161  	QString s3=version.section (".",2,2);
  34.162  	bool ok;
  34.163 -	int vv1 =QString(__VYM_VERSION__).section (".",0,0).toInt(&ok,10);
  34.164 -	int vv2 =QString(__VYM_VERSION__).section (".",1,1).toInt(&ok,10);
  34.165 -	int vv3 =QString(__VYM_VERSION__).section (".",2,2).toInt(&ok,10);
  34.166 +	int vv1 =QString(__VYM_VERSION).section (".",0,0).toInt(&ok,10);
  34.167 +	int vv2 =QString(__VYM_VERSION).section (".",1,1).toInt(&ok,10);
  34.168 +	int vv3 =QString(__VYM_VERSION).section (".",2,2).toInt(&ok,10);
  34.169  	int mv1=0;
  34.170  	int mv2=0;
  34.171  	int mv3=0;
  34.172 @@ -233,3 +226,4 @@
  34.173  {
  34.174  	return QDate::currentDate().toString ("yyyy-MM-dd");
  34.175  }
  34.176 +
    35.1 --- a/mapcenterobj.h	Sun Jan 30 12:58:47 2005 +0000
    35.2 +++ b/mapcenterobj.h	Tue Jun 06 14:58:11 2006 +0000
    35.3 @@ -1,14 +1,18 @@
    35.4  #ifndef MAPCENTEROBJ_H
    35.5  #define MAPCENTEROBJ_H
    35.6  
    35.7 +
    35.8 +#include <QDate>
    35.9 +
   35.10  #include "branchobj.h"
   35.11 +#include "xlinkobj.h"
   35.12  #include "version.h"
   35.13  
   35.14  /////////////////////////////////////////////////////////////////////////////
   35.15  class MapCenterObj:public BranchObj {
   35.16  public:
   35.17      MapCenterObj ();
   35.18 -    MapCenterObj (QCanvas*);
   35.19 +    MapCenterObj (Q3Canvas*);
   35.20      ~MapCenterObj ();
   35.21      void clear();
   35.22      void init();
    36.1 --- a/mapeditor.cpp	Sun Jan 30 12:58:47 2005 +0000
    36.2 +++ b/mapeditor.cpp	Tue Jun 06 14:58:11 2006 +0000
    36.3 @@ -4,61 +4,63 @@
    36.4  #include <qmessagebox.h>
    36.5  #include <qapplication.h>
    36.6  #include <qpainter.h>
    36.7 -#include <qpopupmenu.h>
    36.8 +#include <q3popupmenu.h>
    36.9  #include <qprinter.h>
   36.10 -#include <qpaintdevicemetrics.h>
   36.11 +#include <q3paintdevicemetrics.h>
   36.12  #include <qfile.h>
   36.13 -#include <qfiledialog.h>
   36.14 +#include <q3filedialog.h>
   36.15  #include <qdir.h>
   36.16  #include <qcolor.h>
   36.17  #include <qcolordialog.h>
   36.18  #include <qbitmap.h>
   36.19 -#include <qprocess.h>
   36.20 +#include <q3process.h>
   36.21  #include <qinputdialog.h>
   36.22 +#include <q3dragobject.h>
   36.23 +#include <q3urloperator.h>
   36.24 +#include <q3networkprotocol.h>
   36.25 +#include <qregexp.h>
   36.26 +//Added by qt3to4:
   36.27 +#include <QResizeEvent>
   36.28 +#include <QContextMenuEvent>
   36.29 +#include <Q3StrList>
   36.30 +#include <QPixmap>
   36.31 +#include <QMouseEvent>
   36.32 +#include <QDragEnterEvent>
   36.33 +#include <QTextStream>
   36.34 +#include <QDropEvent>
   36.35 +#include <Q3ActionGroup>
   36.36 +#include <Q3PtrList>
   36.37  
   36.38  #include <iostream>
   36.39 -#include <stdlib.h>
   36.40 +#include <cstdlib>
   36.41  #include <typeinfo>
   36.42  
   36.43  #include "version.h"
   36.44  
   36.45 +#include "api.h"
   36.46 +#include "editxlinkdialog.h"
   36.47 +#include "exports.h"
   36.48 +#include "extrainfodialog.h"
   36.49 +#include "file.h"
   36.50 +#include "linkablemapobj.h"
   36.51 +#include "mainwindow.h"
   36.52 +#include "misc.h"
   36.53 +#include "settings.h"
   36.54 +#include "texteditor.h"
   36.55 +#include "warningdialog.h"
   36.56  #include "xml.h"
   36.57 -#include "texteditor.h"
   36.58 -#include "linkablemapobj.h"
   36.59 -#include "exports.h"
   36.60 -#include "misc.h"
   36.61 -#include "mainwindow.h"
   36.62 -#include "extrainfodialog.h"
   36.63 -#include "settings.h"
   36.64 -
   36.65 -#include "icons/flag-note.xpm"
   36.66 -#include "icons/flag-url.xpm"
   36.67 -#include "icons/flag-vymlink.xpm"	
   36.68 -#include "icons/flag-scrolled-right.xpm"
   36.69 -#include "icons/flag-tmpUnscrolled-right.xpm"
   36.70 -#include "icons/flag-questionmark.xpm"
   36.71 -#include "icons/flag-exclamationmark.xpm"
   36.72 -#include "icons/flag-hook-green.xpm"
   36.73 -#include "icons/flag-cross-red.xpm"
   36.74 -#include "icons/flag-stopsign.xpm"
   36.75 -#include "icons/flag-smiley-good.xpm"
   36.76 -#include "icons/flag-smiley-sad.xpm"
   36.77 -#include "icons/flag-clock.xpm"
   36.78 -#include "icons/flag-lamp.xpm"
   36.79 -#include "icons/flag-arrow-up.xpm"
   36.80 -#include "icons/flag-arrow-down.xpm"
   36.81 -#include "icons/flag-thumb-up.xpm"
   36.82 -#include "icons/flag-thumb-down.xpm"
   36.83 -#include "icons/flag-heart.xpm"
   36.84 -#include "icons/flag-flash.xpm"
   36.85 -#include "icons/flag-lifebelt.xpm"
   36.86 +
   36.87  
   36.88  extern TextEditor *textEditor;
   36.89  extern int statusbarTime;
   36.90  extern Main *mainWindow;
   36.91 +extern QString tmpVymDir;
   36.92 +extern QString clipboardDir;
   36.93 +extern bool clipboardEmpty;
   36.94  extern FlagRowObj *systemFlagsDefault;
   36.95  extern FlagRowObj *standardFlagsDefault;
   36.96 -extern MapEditor *clipboardME;
   36.97 +
   36.98 +extern Q3PtrList <QAction> actionListBranches;
   36.99  
  36.100  extern QAction *actionFileSave;
  36.101  extern QAction *actionEditUndo;
  36.102 @@ -69,24 +71,28 @@
  36.103  extern QAction *actionEditMoveDown;
  36.104  extern QAction *actionEditToggleScroll;
  36.105  extern QAction *actionEditOpenURL;
  36.106 +extern QAction *actionEditOpenURLTab;
  36.107  extern QAction *actionEditURL;
  36.108  extern QAction *actionEditHeading2URL;
  36.109  extern QAction *actionEditBugzilla2URL;
  36.110 +extern QAction *actionEditFATE2URL;
  36.111  extern QAction *actionEditOpenVymLink;
  36.112  extern QAction *actionEditVymLink;
  36.113  extern QAction *actionEditDeleteVymLink;
  36.114 +extern QAction *actionEditToggleHideExport;
  36.115  extern QAction *actionEditHeading;
  36.116  extern QAction *actionEditDelete;
  36.117  extern QAction *actionEditAddBranch;
  36.118  extern QAction *actionEditAddBranchAbove;
  36.119  extern QAction *actionEditAddBranchBelow;
  36.120 +extern QAction *actionEditRemoveBranchHere;
  36.121 +extern QAction *actionEditRemoveChilds;
  36.122  extern QAction *actionEditImportAdd;
  36.123  extern QAction *actionEditImportReplace;
  36.124  extern QAction *actionEditSaveBranch;
  36.125  extern QAction *actionEditSelectFirst;
  36.126  extern QAction *actionEditSelectLast;
  36.127  extern QAction *actionEditLoadImage;
  36.128 -extern QAction *actionEditToggleFloatExport;
  36.129  
  36.130  extern QAction* actionFormatPickColor;
  36.131  extern QAction* actionFormatColorBranch;
  36.132 @@ -95,11 +101,19 @@
  36.133  extern QAction *actionFormatBackColor;
  36.134  extern QAction *actionFormatLinkColor;
  36.135  
  36.136 -extern QActionGroup *actionGroupFormatFrameTypes;
  36.137 +extern Q3ActionGroup* actionGroupModModes;
  36.138 +extern QAction* actionModModeColor;
  36.139 +extern QAction* actionModModeLink;
  36.140 +extern QAction* actionModModeCopy;
  36.141 +
  36.142 +extern Q3ActionGroup *actionGroupFormatFrameTypes;
  36.143  extern QAction *actionFormatFrameNone;
  36.144  extern QAction *actionFormatFrameRectangle;
  36.145  
  36.146 -extern QActionGroup *actionGroupFormatLinkStyles;
  36.147 +extern Q3ActionGroup *actionGroupFormatLinkStyles;
  36.148 +extern QAction *actionFormatIncludeImagesVer;
  36.149 +extern QAction *actionFormatIncludeImagesHor;
  36.150 +extern QAction *actionFormatHideLinkUnselected;
  36.151  extern QAction *actionFormatLinkStyleLine;
  36.152  extern QAction *actionFormatLinkStyleParabel;
  36.153  extern QAction *actionFormatLinkStylePolyLine;
  36.154 @@ -111,213 +125,98 @@
  36.155  extern QAction *actionSettingsAutoselectHeading;
  36.156  extern QAction *actionSettingsAutoselectText;
  36.157  extern QAction *actionSettingsPasteNewHeading;
  36.158 -
  36.159 -extern QPopupMenu *branchContextMenu;
  36.160 -extern QPopupMenu *floatimageContextMenu;
  36.161 -extern QPopupMenu *saveImageFormatMenu;
  36.162 -extern QPopupMenu *exportImageFormatMenu;
  36.163 -extern QPopupMenu *canvasContextMenu;
  36.164 +extern QAction *actionSettingsUseFlagGroups;
  36.165 +
  36.166 +extern Q3PopupMenu *branchContextMenu;
  36.167 +extern Q3PopupMenu *branchLinksContextMenu;
  36.168 +extern Q3PopupMenu *branchLinksContextMenuDup;
  36.169 +extern Q3PopupMenu *floatimageContextMenu;
  36.170 +extern Q3PopupMenu *saveImageFormatMenu;
  36.171 +extern Q3PopupMenu *exportImageFormatMenu;
  36.172 +extern Q3PopupMenu *canvasContextMenu;
  36.173  
  36.174  extern Settings settings;
  36.175  
  36.176 +extern QString iconPath;
  36.177 +extern QDir vymBaseDir;
  36.178 +
  36.179 +int MapEditor::mapNum=0;	// make instance
  36.180  
  36.181  ///////////////////////////////////////////////////////////////////////
  36.182  ///////////////////////////////////////////////////////////////////////
  36.183  MapEditor::MapEditor(
  36.184 -	QWidget* parent, bool interactive, const char* name, WFlags f) :
  36.185 -    QCanvasView(parent,name,f)
  36.186 +	QWidget* parent, bool interactive, const char* name, Qt::WFlags f) :
  36.187 +  Q3CanvasView(parent,name,f), urlOperator(0), imageBuffer(0)
  36.188  {
  36.189  	//cout << "Constructor ME "<<this<<endl;
  36.190 -
  36.191 -    mapCanvas = new QCanvas(1000,800);
  36.192 +	mapNum++;
  36.193 +
  36.194 +    viewport()->setAcceptDrops(true);
  36.195 +
  36.196 +    mapCanvas = new Q3Canvas(1000,800);
  36.197  	mapCanvas->setAdvancePeriod(30);
  36.198 +	mapCanvas->setBackgroundColor (Qt::white);
  36.199  
  36.200      setCanvas (mapCanvas);
  36.201  	
  36.202 -	setVScrollBarMode ( QScrollView::AlwaysOn );
  36.203 -	setHScrollBarMode ( QScrollView::AlwaysOn );
  36.204 -
  36.205 -	// Now create the _global_ system flags _once_:
  36.206 -	// (Later all OrnamentedObj copy from this 
  36.207 -	// and set their own canvas)
  36.208 -	if (!systemFlagsDefault)
  36.209 -	{
  36.210 -		systemFlagsDefault = new FlagRowObj (mapCanvas);
  36.211 -		systemFlagsDefault->setVisibility (false);
  36.212 -		systemFlagsDefault->setName ("systemFlagsDef");
  36.213 -
  36.214 -		FlagObj *fo = new FlagObj (mapCanvas);
  36.215 -		fo->load(QPixmap(flag_note_xpm));
  36.216 -		fo->setName("note");
  36.217 -		fo->setToolTip(tr("Note"));
  36.218 -		systemFlagsDefault->addFlag (fo);	// makes deep copy
  36.219 -
  36.220 -		fo->load(QPixmap(flag_url_xpm));
  36.221 -		fo->setName("url");
  36.222 -		fo->setToolTip(tr("WWW Document (external)"));
  36.223 -		systemFlagsDefault->addFlag (fo);
  36.224 -		
  36.225 -		fo->load(QPixmap(flag_vymlink_xpm));
  36.226 -		fo->setName("vymLink");
  36.227 -		fo->setToolTip(tr("Link to another vym map"));
  36.228 -		systemFlagsDefault->addFlag (fo);	
  36.229 -
  36.230 -		fo->load(QPixmap(flag_scrolled_right_xpm));
  36.231 -		fo->setName("scrolledright");
  36.232 -		fo->setToolTip(tr("subtree is scrolled"));
  36.233 -		systemFlagsDefault->addFlag (fo);
  36.234 -		
  36.235 -		fo->load(QPixmap(flag_tmpUnscrolled_right_xpm));
  36.236 -		fo->setName("tmpUnscrolledright");
  36.237 -		fo->setToolTip(tr("subtree is temporary scrolled"));
  36.238 -		systemFlagsDefault->addFlag (fo);
  36.239 -		delete (fo);
  36.240 -	}
  36.241 -	if (!standardFlagsDefault)
  36.242 -	{
  36.243 -		standardFlagsDefault = new FlagRowObj (mapCanvas);
  36.244 -		standardFlagsDefault->setVisibility (false);
  36.245 -		standardFlagsDefault->setName ("standardFlagsDef");
  36.246 -
  36.247 -		FlagObj *fo = new FlagObj (mapCanvas);
  36.248 -		fo->load(QPixmap(flag_exclamationmark_xpm));
  36.249 -		fo->setName("exclamationmark");
  36.250 -		fo->setToolTip(tr("Take care!"));
  36.251 -		standardFlagsDefault->addFlag (fo);	// makes deep copy
  36.252 -		
  36.253 -		fo->load(QPixmap(flag_questionmark_xpm));
  36.254 -		fo->setName("questionmark");
  36.255 -		fo->setToolTip(tr("Really?"));
  36.256 -		standardFlagsDefault->addFlag (fo);	
  36.257 -
  36.258 -		fo->load(QPixmap(flag_hook_green_xpm));
  36.259 -		fo->setName("hook-green");
  36.260 -		fo->setToolTip(tr("ok!"));
  36.261 -		standardFlagsDefault->addFlag (fo);	
  36.262 -
  36.263 -		fo->load(QPixmap(flag_cross_red_xpm));
  36.264 -		fo->setName("cross-red");
  36.265 -		fo->setToolTip(tr("Not ok!"));
  36.266 -		standardFlagsDefault->addFlag (fo);	
  36.267 -
  36.268 -		fo->load(QPixmap(flag_stopsign_xpm));
  36.269 -		fo->setName("stopsign");
  36.270 -		fo->setToolTip(tr("This won't work!"));
  36.271 -		standardFlagsDefault->addFlag (fo);	
  36.272 -
  36.273 -		fo->load(QPixmap(flag_smiley_good_xpm));
  36.274 -		fo->setName("smiley-good");
  36.275 -		fo->setToolTip(tr("Good"));
  36.276 -		standardFlagsDefault->addFlag (fo);	
  36.277 -
  36.278 -		fo->load(QPixmap(flag_smiley_sad_xpm));
  36.279 -		fo->setName("smiley-sad");
  36.280 -		fo->setToolTip(tr("Bad"));
  36.281 -		standardFlagsDefault->addFlag (fo);	
  36.282 -
  36.283 -		fo->load(QPixmap(flag_clock_xpm));
  36.284 -		fo->setName("clock");
  36.285 -		fo->setToolTip(tr("Time critical"));
  36.286 -		standardFlagsDefault->addFlag (fo);	
  36.287 -
  36.288 -		fo->load(QPixmap(flag_lamp_xpm));
  36.289 -		fo->setName("lamp");
  36.290 -		fo->setToolTip(tr("Idea!"));
  36.291 -		standardFlagsDefault->addFlag (fo);	
  36.292 -
  36.293 -		fo->load(QPixmap(flag_arrow_up_xpm));
  36.294 -		fo->setName("arrow-up");
  36.295 -		fo->setToolTip(tr("Important"));
  36.296 -		standardFlagsDefault->addFlag (fo);	
  36.297 -
  36.298 -		fo->load(QPixmap(flag_arrow_down_xpm));
  36.299 -		fo->setName("arrow-down");
  36.300 -		fo->setToolTip(tr("Unimportant"));
  36.301 -		standardFlagsDefault->addFlag (fo);	
  36.302 -
  36.303 -		fo->load(QPixmap(flag_thumb_up_xpm));
  36.304 -		fo->setName("thumb-up");
  36.305 -		fo->setToolTip(tr("I like this"));
  36.306 -		standardFlagsDefault->addFlag (fo);	
  36.307 -
  36.308 -		fo->load(QPixmap(flag_thumb_down_xpm));
  36.309 -		fo->setName("thumb-down");
  36.310 -		fo->setToolTip(tr("I do not like this"));
  36.311 -		standardFlagsDefault->addFlag (fo);	
  36.312 -		
  36.313 -		fo->load(QPixmap(flag_heart_xpm));
  36.314 -		fo->setName("heart");
  36.315 -		fo->setToolTip(tr("I just love... "));
  36.316 -		standardFlagsDefault->addFlag (fo);	
  36.317 -
  36.318 -		fo->load(QPixmap(flag_flash_xpm));
  36.319 -		fo->setName("flash");
  36.320 -		fo->setToolTip(tr("Dangerous"));
  36.321 -		standardFlagsDefault->addFlag (fo);	
  36.322 -		
  36.323 -		fo->load(QPixmap(flag_lifebelt_xpm));
  36.324 -		fo->setName("lifebelt");
  36.325 -		fo->setToolTip(tr("This will help"));
  36.326 -		standardFlagsDefault->addFlag (fo);	
  36.327 -		delete (fo);
  36.328 -
  36.329 -	}
  36.330 -	
  36.331 +	// Always show scroll bars (automatic would flicker sometimes)
  36.332 +	setVScrollBarMode ( Q3ScrollView::AlwaysOn );
  36.333 +	setHScrollBarMode ( Q3ScrollView::AlwaysOn );
  36.334 +
  36.335      mapCenter = new MapCenterObj(mapCanvas);
  36.336      mapCenter->setVisibility (true);
  36.337  	mapCenter->setMapEditor (this);
  36.338 -	mapCenter->setHeading (tr("New Map"));
  36.339 +	mapCenter->setHeading (tr("New Map","Heading of mapcenter in new map"));
  36.340 +	mapCenter->move(mapCanvas->width()/2-mapCenter->width()/2,mapCanvas->height()/2-mapCenter->height()/2);
  36.341  
  36.342      printer=NULL;
  36.343  
  36.344      lineedit = new QLineEdit(this, "lineedit"  );
  36.345 -    connect( lineedit, SIGNAL( returnPressed() ), SLOT( finishedLineEditNoSave() ) );
  36.346 +    connect( lineedit, SIGNAL( returnPressed() ), SLOT( finishedLineEdit() ) );
  36.347      lineedit->hide();
  36.348  
  36.349 -    actColor=black; setColor (actColor);
  36.350 -	deflinkcolor=QColor (0,0,255);
  36.351 +    actColor=Qt::black; setColor (actColor);
  36.352 +	defLinkColor=QColor (0,0,255);
  36.353 +	defXLinkColor=QColor (180,180,180);
  36.354  	linkcolorhint=DefaultColor;
  36.355  	linkstyle=StylePolyParabel;
  36.356 -	mapCanvas->setBackgroundColor (white);
  36.357  
  36.358  	// Create bitmap cursors, patform dependant
  36.359  	#if defined(Q_OS_MACX)
  36.360 -		#include "icons/cursorhandopen16.xpm"
  36.361 -		#include "icons/cursorcolorpicker16.xpm"
  36.362 -		QBitmap cb( 16, 16, chandopen, TRUE );
  36.363 -		QBitmap cm( 16, 16, chandopenmask, TRUE );
  36.364 -		handOpenCursor=QCursor ( cb, cm );		
  36.365 +		handOpenCursor=QCursor ( QPixmap(iconPath+"cursorhandopen16.png") );		
  36.366  		// set hot spot to tip of picker			
  36.367 -		pickColorCursor=QCursor ( cursorcolorpicker_xpm, 1,15 ); 
  36.368 +		pickColorCursor=QCursor ( QPixmap (iconPath+"cursorcolorpicker16.png"), 1,15 ); 
  36.369  	#else
  36.370 -		#include "icons/cursorhandopen.xpm"
  36.371 -		#include "icons/cursorcolorpicker.xpm"
  36.372 -
  36.373 -		QBitmap cb( 32, 32, chandopen, TRUE );
  36.374 -		QBitmap cm( 32, 32, chandopenmask, TRUE );
  36.375 -		handOpenCursor=QCursor ( cb, cm );		
  36.376 +		handOpenCursor=QCursor (QPixmap(iconPath+"cursorhandopen16.png"));		
  36.377  		// set hot spot to tip of picker			
  36.378 -		pickColorCursor=QCursor ( cursorcolorpicker_xpm, 5,27 ); 
  36.379 +		pickColorCursor=QCursor ( QPixmap(iconPath+"cursorcolorpicker.png"), 5,27 ); 
  36.380  	#endif
  36.381  
  36.382 -
  36.383  	pickingColor=false;
  36.384 +	drawingLink=false;
  36.385 +	copyingObj=false;
  36.386  
  36.387      editingBO=NULL;
  36.388      selection=NULL;
  36.389      selectionLast=NULL;
  36.390      movingObj=NULL;
  36.391  
  36.392 +	defXLinkWidth=1;
  36.393 +	defXLinkColor=QColor (230,230,230);
  36.394 +
  36.395      mapChanged=false;
  36.396  	mapDefault=true;
  36.397  	mapUnsaved=false;
  36.398 -	undoSelection=NULL;
  36.399  	
  36.400  	zipped=true;
  36.401  	filePath="";
  36.402 -	fileName="unnamed";
  36.403 +	fileName=tr("unnamed");
  36.404  	mapName="";
  36.405  
  36.406 +	undosTotal=settings.readNumEntry("/vym/mapeditor/undoLevels",50);
  36.407 +	undosAvail=0;	
  36.408 +	undoNum=0;
  36.409 +	
  36.410  	// Initialize find routine
  36.411  	itFind=NULL;				
  36.412  	EOFind=false;
  36.413 @@ -325,7 +224,11 @@
  36.414  	printFrame=true;
  36.415  	printFooter=true;
  36.416  
  36.417 -	blockreposition=false;
  36.418 +	blockReposition=false;
  36.419 +	blockSaveState=false;
  36.420 +
  36.421 +	hidemode=HideNone;
  36.422 +
  36.423  	isInteractive=interactive;
  36.424  	if (isInteractive)
  36.425  		// Create temporary files
  36.426 @@ -334,13 +237,22 @@
  36.427  	// Initially set movingCentre
  36.428  	updateViewCenter();
  36.429  
  36.430 +	// For testing purposes create history window
  36.431 +	historyWindow = new ShowTextDialog (this);
  36.432 +	historyWindow->setCaption (fileName);
  36.433 +
  36.434  	mapCenter->reposition();	//	for positioning heading
  36.435  }
  36.436  
  36.437  MapEditor::~MapEditor()
  36.438  {
  36.439 +  if (imageBuffer) delete imageBuffer;
  36.440 +  if (urlOperator) {
  36.441 +    urlOperator->stop();
  36.442 +    delete urlOperator;
  36.443 +  }
  36.444 +
  36.445  	//cout <<"Destructor MapEditor\n";
  36.446 -	if (isInteractive) delTmpDirs();
  36.447  
  36.448  	// Save Settings
  36.449  	//settings.writeEntry( "/vym/mapeditor/editmode/autoselect",  );
  36.450 @@ -362,7 +274,7 @@
  36.451      return mapCenter;
  36.452  }
  36.453  
  36.454 -QCanvas* MapEditor::getCanvas()
  36.455 +Q3Canvas* MapEditor::getCanvas()
  36.456  {
  36.457      return mapCanvas;
  36.458  }
  36.459 @@ -420,6 +332,7 @@
  36.460  		{
  36.461  			mapCenter->moveAllBy(dx,dy);
  36.462  			mapCenter->reposition();
  36.463 +//			mapCenter->positionBBox();	// To move float
  36.464  
  36.465  			// scroll the view (in order to not move map on screen)
  36.466  			scrollBy (dx,dy);
  36.467 @@ -427,45 +340,44 @@
  36.468  	}
  36.469  }
  36.470  
  36.471 -bool MapEditor::blockReposition()
  36.472 +bool MapEditor::isRepositionBlocked()
  36.473  {
  36.474 -	return blockreposition;
  36.475 +	return blockReposition;
  36.476 +}
  36.477 +
  36.478 +QString MapEditor::getName (LinkableMapObj *lmo)
  36.479 +{
  36.480 +	QString s;
  36.481 +	if (!lmo) return QString("Error: NULL has no name!");
  36.482 +
  36.483 +	if ((typeid(*lmo) == typeid(BranchObj) ||
  36.484 +				      typeid(*lmo) == typeid(MapCenterObj))) 
  36.485 +	{
  36.486 +		
  36.487 +		s=(((BranchObj*)lmo)->getHeading());
  36.488 +		if (s=="") s="unnamed";
  36.489 +		return QString("branch (<font color=\"#0000ff\">%1</font>)").arg(s);
  36.490 +	}	
  36.491 +	if ((typeid(*lmo) == typeid(FloatImageObj) ))
  36.492 +		return QString ("floatimage [<font color=\"#0000ff\">%1</font>]").arg(((FloatImageObj*)lmo)->getOriginalFilename());
  36.493 +	return QString("Unknown type has no name!");
  36.494  }
  36.495  
  36.496  void MapEditor::makeTmpDirs()
  36.497  {
  36.498  	// Create unique temporary directories
  36.499 -	char tmpdir[]="/tmp/vym-XXXXXX";	
  36.500 -	bakMapDir=mkdtemp(tmpdir);
  36.501 -	makeSubDirs(bakMapDir);
  36.502 -	// FIXME set permissions
  36.503 -	// and maybe use QT method for portability
  36.504 +	tmpMapDir=tmpVymDir+QString("/mapeditor-%1").arg(mapNum);
  36.505 +	QDir d;
  36.506 +	d.mkdir (tmpMapDir,true);
  36.507  }
  36.508  
  36.509 -void MapEditor::delTmpDirs()
  36.510 +QString MapEditor::saveToDir(const QString &tmpdir, const QString &prefix, bool writeflags, const QPoint &offset, LinkableMapObj *saveSelection)
  36.511  {
  36.512 -	//FIXME delete tmp directory, better use QT methods here:
  36.513 -	system ( "rm -rf "+ bakMapDir );
  36.514 -}
  36.515 -
  36.516 -
  36.517 -void MapEditor::makeSubDirs(const QString &s)
  36.518 -{
  36.519 -	QDir d(s);
  36.520 -	d.mkdir ("images");	
  36.521 -	d.mkdir ("flags");	
  36.522 -}
  36.523 -
  36.524 -
  36.525 -QString MapEditor::saveToDir(const QString &tmpdir, const QString &prefix, bool writeflags, const QPoint &offset, SaveMode savemode)
  36.526 -{
  36.527 -	// tmpdir		temporary directory to which data will be writte
  36.528 +	// tmpdir		temporary directory to which data will be written
  36.529  	// prefix		mapname, which will be appended to images etc.
  36.530  	// writeflags	Only write flags for "real" save of map, not undo
  36.531  	// offset		offset of bbox of whole map in canvas. 
  36.532  	//				Needed for XML export
  36.533 -	// completeMap	if false, only vympart will be written, without
  36.534 -	//				mapcenter
  36.535  	
  36.536  	// Save Header
  36.537  	QString ls;
  36.538 @@ -490,14 +402,16 @@
  36.539  	if (linkcolorhint==HeadingColor) 
  36.540  		colhint=attribut("linkColorHint","HeadingColor");
  36.541  
  36.542 -	QString mapAttr=attribut("version",__VYM_VERSION__);
  36.543 -	if (savemode==CompleteMap)
  36.544 +	QString mapAttr=attribut("version",__VYM_VERSION);
  36.545 +	if (!saveSelection)
  36.546  		mapAttr+= attribut("author",mapCenter->getAuthor()) +
  36.547  				  attribut("comment",mapCenter->getComment()) +
  36.548  			      attribut("date",mapCenter->getDate()) +
  36.549  		          attribut("backgroundColor", mapCanvas->backgroundColor().name() ) +
  36.550  		          attribut("linkStyle", ls ) +
  36.551 -		          attribut("linkColor", deflinkcolor.name() ) +
  36.552 +		          attribut("linkColor", defLinkColor.name() ) +
  36.553 +		          attribut("defXLinkColor", defXLinkColor.name() ) +
  36.554 +		          attribut("defXLinkWidth", QString().setNum(defXLinkWidth,10) ) +
  36.555  		          colhint; 
  36.556  	s+=beginElement("vymmap",mapAttr);
  36.557  	incIndent();
  36.558 @@ -505,21 +419,29 @@
  36.559  	// Find the used flags while traversing the tree
  36.560  	standardFlagsDefault->resetUsedCounter();
  36.561  	
  36.562 +	// Reset the counters before saving
  36.563 +	FloatImageObj (mapCanvas).resetSaveCounter();
  36.564 +
  36.565  	// Build xml recursivly
  36.566 -	if (savemode==CompleteMap)
  36.567 +	if (!saveSelection)
  36.568  		s+=mapCenter->saveToDir(tmpdir,prefix,writeflags,offset);
  36.569  	else
  36.570  	{
  36.571 -		if ( undoSelection &&
  36.572 -			typeid(*undoSelection) == typeid(BranchObj) )
  36.573 -			s+=((BranchObj*)(undoSelection))->saveToDir(tmpdir,prefix,offset);
  36.574 +		if ( typeid(*saveSelection) == typeid(BranchObj) )
  36.575 +			s+=((BranchObj*)(saveSelection))->saveToDir(tmpdir,prefix,offset);
  36.576 +		else if ( typeid(*saveSelection) == typeid(FloatImageObj) )
  36.577 +			s+=((FloatImageObj*)(saveSelection))->saveToDir(tmpdir,prefix,offset);
  36.578 +			
  36.579 +		else if (selection && typeid(*selection)==typeid(BranchObj))
  36.580 +				// This is used if selected branch is saved from mainwindow
  36.581 +				s+=((BranchObj*)selection)->saveToDir(tmpdir,prefix,offset);
  36.582  	}
  36.583  
  36.584  	// Save local settings
  36.585  	s+=settings.getXMLData (destPath);
  36.586  
  36.587  	// Save selection
  36.588 -	if (selection) 
  36.589 +	if (selection && !saveSelection ) 
  36.590  		s+=valueElement("select",selection->getSelectString());
  36.591  
  36.592  	decIndent();
  36.593 @@ -527,37 +449,240 @@
  36.594  
  36.595  	if (writeflags)
  36.596  		standardFlagsDefault->saveToDir (tmpdir+"/flags/","",writeflags);
  36.597 -	
  36.598  	return s;
  36.599  }
  36.600  
  36.601 -void MapEditor::saveState()
  36.602 +void MapEditor::saveState(const QString &comment)
  36.603  {
  36.604 -	saveState (CompleteMap,NULL);
  36.605 +	// Save complete map
  36.606 +	saveState (CompleteMap,"",NULL,"",NULL, comment);
  36.607  }
  36.608  
  36.609 -void MapEditor::saveState(const SaveMode &mode, LinkableMapObj *part)
  36.610 +void MapEditor::saveState(LinkableMapObj *undoSel, const QString &comment)
  36.611  {
  36.612 -	// all binary data is saved in bakMapDir (created in Constructor)
  36.613 -	// the xml data itself is kept in memory in backupXML
  36.614 -	// 
  36.615 -	// For faster write/read of data, a part of the map can be
  36.616 -	// written. Then the undoSelection will mark, which part of the
  36.617 -	// map should be replaced if an undo is wanted later.
  36.618 -
  36.619 -	if (mode==PartOfMap && part && (typeid(*part) == typeid (BranchObj) ) ) 
  36.620 +	// save the given part of the map 
  36.621 +	saveState (PartOfMap,"",undoSel,"",NULL, comment);
  36.622 +}
  36.623 +
  36.624 +void MapEditor::saveState(const QString &uc, const QString &rc, const QString &comment)
  36.625 +{
  36.626 +	// selection does not change during action,
  36.627 +	// so just save commands for undo and redo
  36.628 +	LinkableMapObj *unsel;
  36.629 +	if (selection)
  36.630 +		unsel=selection;
  36.631 +	else
  36.632 +		unsel=NULL;
  36.633 +	saveState (UndoCommand,uc,unsel,rc,unsel, comment);
  36.634 +}
  36.635 +
  36.636 +void MapEditor::saveState(const QString & uncom, LinkableMapObj *unsel, const QString &comment) 
  36.637 +{
  36.638 +	saveState (UndoCommand,uncom,unsel,"FIXME-redoCom",NULL, comment);
  36.639 +}
  36.640 +
  36.641 +void MapEditor::saveState(const SaveMode &savemode, const QString &undoCom, LinkableMapObj *undoSel, const QString &redoCom, LinkableMapObj *redoSel, const QString &comment)
  36.642 +{
  36.643 +	// Main saveState
  36.644 +
  36.645 +	if (blockSaveState) return;
  36.646 +
  36.647 +	/* TODO remove after testing
  36.648 +	cout << "ME::saveState()  begin\n"<<endl;
  36.649 +	cout << "    undosTotal="<<undosTotal<<endl;
  36.650 +	cout << "    undosAvail="<<undosAvail<<endl;
  36.651 +	cout << "       undoNum="<<undoNum<<endl;
  36.652 +	cout << "    ---------------------------"<<endl;
  36.653 +	*/
  36.654 +
  36.655 +	historyWindow->append (comment);
  36.656 +	
  36.657 +	setChanged();
  36.658 +
  36.659 +	// Find out current undo directory
  36.660 +	if (undosAvail<undosTotal) undosAvail++;
  36.661 +	undoNum++;
  36.662 +	if (undoNum>undosTotal) undoNum=1;
  36.663 +	
  36.664 +	QString backupXML;
  36.665 +	QString bakMapDir=QDir::convertSeparators (QString(tmpMapDir+"/undo-%1").arg(undoNum));
  36.666 +	QString bakMapPath=QDir::convertSeparators(bakMapDir+"/map.xml");
  36.667 +
  36.668 +	// Create bakMapDir if not available
  36.669 +	QDir d(bakMapDir);
  36.670 +	if (!d.exists()) 
  36.671 +		makeSubDirs (bakMapDir);
  36.672 +
  36.673 +	// Save current selection 
  36.674 +	QString redoSelection="";
  36.675 +	if (redoSel)
  36.676 +		redoSelection=redoSel->getSelectString();
  36.677 +
  36.678 +	// Save the object, which should be undone
  36.679 +	QString undoSelection="";
  36.680 +	if (undoSel)
  36.681 +		undoSelection=undoSel->getSelectString();
  36.682 +		
  36.683 +	// Save depending on how much needs to be saved	
  36.684 +	QString undoCommand="";
  36.685 +	if (savemode==UndoCommand)
  36.686  	{
  36.687 -		// Writing a vympart only is useful for BranchObj
  36.688 -		undoSelection=part;
  36.689 -		backupXML=saveToDir (bakMapDir,mapName+"-",false, QPoint (),PartOfMap);
  36.690 -	} else	
  36.691 +		undoCommand=undoCom;
  36.692 +		backupXML="";
  36.693 +	}	
  36.694 +	else if (savemode==PartOfMap && undoSel)
  36.695  	{
  36.696 -		undoSelection=NULL;
  36.697 -		backupXML=saveToDir (bakMapDir,mapName+"-",false, QPoint (),CompleteMap);
  36.698 +		undoCommand="undoPart (\""+ undoSelection+"\",\""+bakMapPath+"\")";
  36.699 +		backupXML=saveToDir (bakMapDir,mapName+"-",false, QPoint (),undoSel);
  36.700 +	} else
  36.701 +	{
  36.702 +		undoCommand="undoMap (\""+bakMapPath+"\")";
  36.703 +		backupXML=saveToDir (bakMapDir,mapName+"-",false, QPoint (),NULL);
  36.704 +		undoSelection="";
  36.705 +	}
  36.706 +	if (!backupXML.isEmpty())
  36.707 +		// Write XML Data to disk
  36.708 +		saveStringToDisk (QString(bakMapPath),backupXML);
  36.709 +
  36.710 +	SimpleSettings set;
  36.711 +	set.setEntry (QString("undoCommand"),undoCommand);
  36.712 +	set.setEntry (QString("undoSelection"),undoSelection);
  36.713 +	set.setEntry (QString("redoCommand"),redoCom);
  36.714 +	set.setEntry (QString("redoSelection"),redoSelection);
  36.715 +	set.setEntry (QString("comment"),comment);
  36.716 +	set.writeSettings(QString(bakMapDir+"/commands"));
  36.717 +
  36.718 +	/* TODO remove after testing
  36.719 +	cout << "          into="<< bakMapDir<<endl;
  36.720 +	cout << "    undosAvail="<<undosAvail<<endl;
  36.721 +	cout << "       undoNum="<<undoNum<<endl;
  36.722 +	cout << "    ---------------------------"<<endl;
  36.723 +	cout << "    comment="<<comment<<endl;
  36.724 +	cout << "    ---------------------------"<<endl;
  36.725 +	cout << "    undoCom="<<undoCommand<<endl;
  36.726 +	cout << "    undoSel="<<undoSelection<<endl;
  36.727 +	cout << "    ---------------------------"<<endl;
  36.728 +	cout << "    redoCom="<<redoCom<<endl;
  36.729 +	cout << "    redoSel="<<redoSelection<<endl;
  36.730 +	cout << "    ---------------------------"<<endl<<endl;
  36.731 +	*/
  36.732 +}
  36.733 +
  36.734 +void MapEditor::parseAtom(const QString &atom)
  36.735 +{
  36.736 +	API api;
  36.737 +	QString s,t;
  36.738 +	int x,y;
  36.739 +	bool ok;
  36.740 +
  36.741 +	// Split string s into command and parameters
  36.742 +	api.parseCommand (atom);
  36.743 +	QString com=api.command();
  36.744 +	
  36.745 +	// External commands
  36.746 +	if (com=="moveBranchUp")
  36.747 +		moveBranchUp();
  36.748 +	else if (com=="moveBranchDown")
  36.749 +		moveBranchDown();
  36.750 +	else if (com=="move")
  36.751 +	{
  36.752 +		if (api.checkParamCount(2) && selection )
  36.753 +		{	
  36.754 +			x=api.parInt (ok,0);
  36.755 +			if (ok)
  36.756 +			{
  36.757 +				y=api.parInt (ok,1);
  36.758 +				if (ok) move (x,y);
  36.759 +			}
  36.760 +		}	
  36.761 +	}
  36.762 +	else if (com=="linkBranchToPos")
  36.763 +	{
  36.764 +		if (selection && typeid(*selection) == typeid(BranchObj) ) 
  36.765 +		{
  36.766 +			if (api.checkParamCount(4))
  36.767 +			{
  36.768 +				s=api.parString(ok,0);
  36.769 +				LinkableMapObj *dst=mapCenter->findObjBySelect (s);
  36.770 +				if (dst)
  36.771 +				{	
  36.772 +					if (typeid(*dst) == typeid(BranchObj) ) 
  36.773 +					{
  36.774 +						// Get number in parent
  36.775 +						x=api.parInt (ok,1);
  36.776 +						if (ok)
  36.777 +							((BranchObj*)selection)->moveBranchTo ((BranchObj*)(dst),x);
  36.778 +					} else if (typeid(*dst) == typeid(MapCenterObj) ) 
  36.779 +					{
  36.780 +						((BranchObj*)selection)->moveBranchTo ((BranchObj*)(dst),-1);
  36.781 +						// Get coordinates of mainbranch
  36.782 +						x=api.parInt (ok,2);
  36.783 +						if (ok)
  36.784 +						{
  36.785 +							y=api.parInt (ok,3);
  36.786 +							if (ok) ((BranchObj*)selection)->move (x,y);
  36.787 +						}
  36.788 +					}	
  36.789 +				}	
  36.790 +			}
  36.791 +		}
  36.792 +	} else if (com=="setHeading")
  36.793 +	{
  36.794 +		if (api.checkParamCount(1))
  36.795 +		{
  36.796 +			s=api.parString (ok,0);
  36.797 +			if (ok) setHeading (s);
  36.798 +		}	
  36.799 +	} else if (com=="setURL")
  36.800 +	{
  36.801 +		if (api.checkParamCount(1))
  36.802 +		{
  36.803 +			s=api.parString (ok,0);
  36.804 +			if (ok) setURL(s);
  36.805 +		}	
  36.806 +	} else if (com=="setVymLink")
  36.807 +	{
  36.808 +		if (api.checkParamCount(1))
  36.809 +		{
  36.810 +			s=api.parString (ok,0);
  36.811 +			if (ok) setVymLink(s);
  36.812 +		}	
  36.813 +	}
  36.814 +	// Internal commands, used for undo etc.	
  36.815 +	else if (com==QString("undoMap"))
  36.816 +	{
  36.817 +		if (api.checkParamCount(1))
  36.818 +			undoXML("",api.parString (ok,0));
  36.819 +	} else if (com==QString("undoPart"))
  36.820 +	{
  36.821 +		if (api.checkParamCount(2))
  36.822 +		{
  36.823 +			s=api.parString (ok,0);
  36.824 +			t=api.parString (ok,1);
  36.825 +			undoXML(s,t);	
  36.826 +		}
  36.827 +	} else if (com=="select")
  36.828 +		if (api.checkParamCount(1))
  36.829 +		{
  36.830 +			s=api.parString(ok,0);
  36.831 +			if (ok) select (s);
  36.832 +		}	
  36.833 +	else
  36.834 +	{
  36.835 +		api.setError ("Unknown command in: "+atom);
  36.836 +		cout << "ME::parse   api should have error now...\n";
  36.837 +	}
  36.838 +
  36.839 +	// Any errors?
  36.840 +	if (api.error())
  36.841 +	{
  36.842 +		qWarning("MapEditor::parseAtom: Error!");
  36.843 +		qWarning(api.errorDesc());
  36.844  	}	
  36.845  }
  36.846  
  36.847 -void MapEditor::finishedLineEditNoSave()
  36.848 +
  36.849 +void MapEditor::finishedLineEdit()
  36.850  {
  36.851  	// This is called by finishedLineEdit or any MapEditor method,
  36.852  	// which wants to assure, that lineedits finish, before e.g. a branch is 
  36.853 @@ -569,6 +694,7 @@
  36.854  
  36.855      if (editingBO!=NULL) 
  36.856  	{
  36.857 +		saveState("setHeading (\""+editingBO->getHeading()+"\")",editingBO, QString("Set heading of %1 to \"%2\"").arg(getName(editingBO)).arg(lineedit->text()) );
  36.858  		editingBO->setHeading(lineedit->text() );
  36.859  		editingBO=NULL;
  36.860  		lineedit->releaseKeyboard();
  36.861 @@ -580,6 +706,14 @@
  36.862      }		
  36.863  }
  36.864  
  36.865 +void MapEditor::toggleHistoryWindow()
  36.866 +{
  36.867 +	if (historyWindow->isVisible())
  36.868 +		historyWindow->hide();
  36.869 +	else	
  36.870 +		historyWindow->show();
  36.871 +}
  36.872 +
  36.873  
  36.874  bool MapEditor::isDefault()
  36.875  {
  36.876 @@ -609,7 +743,7 @@
  36.877  void MapEditor::closeMap()
  36.878  {
  36.879  	// Finish open lineEdits
  36.880 -	if (lineedit) finishedLineEditNoSave();
  36.881 +	if (lineedit) finishedLineEdit();
  36.882  
  36.883  	// Unselect before disabling the toolbar actions
  36.884  	if (selection) selection->unselect();
  36.885 @@ -627,20 +761,31 @@
  36.886  
  36.887  void MapEditor::setFilePath(QString fname, QString destname)
  36.888  {
  36.889 -	filePath=fname;
  36.890 -	fileName=fname;
  36.891 -	destPath=destname;
  36.892 -
  36.893 -	// If fname is not an absolute path, complete it
  36.894 -	filePath=QDir(fname).absPath();
  36.895 -	fileDir=filePath.left (1+filePath.findRev ("/"));
  36.896 -
  36.897 -	// Set short name, too. Search from behind:
  36.898 -	int i=fileName.findRev("/");
  36.899 -	if (i>=0) fileName=fileName.remove (0,i+1);
  36.900 -
  36.901 -	// Forget the .vym (or .xml) for name of map
  36.902 -	mapName=fileName.left(fileName.findRev(".",-1,true) );
  36.903 +	if (fname.isEmpty() || fname=="")
  36.904 +	{
  36.905 +		filePath="";
  36.906 +		fileName="";
  36.907 +		destPath="";
  36.908 +	} else
  36.909 +	{
  36.910 +		filePath=fname;		// becomes absolute path
  36.911 +		fileName=fname;		// gets stripped of path
  36.912 +		destPath=destname;	// needed for vymlinks
  36.913 +
  36.914 +		// If fname is not an absolute path, complete it
  36.915 +		filePath=QDir(fname).absPath();
  36.916 +		fileDir=filePath.left (1+filePath.findRev ("/"));
  36.917 +
  36.918 +		// Set short name, too. Search from behind:
  36.919 +		int i=fileName.findRev("/");
  36.920 +		if (i>=0) fileName=fileName.remove (0,i+1);
  36.921 +
  36.922 +		// Forget the .vym (or .xml) for name of map
  36.923 +		mapName=fileName.left(fileName.findRev(".",-1,true) );
  36.924 +
  36.925 +		// Adjust history window
  36.926 +		historyWindow->setCaption (fileName);
  36.927 +	}
  36.928  }
  36.929  
  36.930  QString MapEditor::getFilePath()
  36.931 @@ -663,12 +808,12 @@
  36.932  	return destPath;
  36.933  }
  36.934  
  36.935 -int MapEditor::load (QString &fname, const LoadMode &lmode)
  36.936 +ErrorCode MapEditor::load (QString fname, LoadMode lmode)
  36.937  {
  36.938  	// Finish open lineEdits
  36.939 -	if (lineedit) finishedLineEditNoSave();
  36.940 -
  36.941 -	int returnCode=0;
  36.942 +	if (lineedit) finishedLineEdit();
  36.943 +
  36.944 +	ErrorCode err=success;
  36.945  
  36.946  	if (lmode==NewMap)
  36.947  	{
  36.948 @@ -679,8 +824,7 @@
  36.949  		// (map state is set later at end of load...)
  36.950  	} else
  36.951  	{
  36.952 -		setChanged();
  36.953 -		saveState(PartOfMap,selection);
  36.954 +		saveState(selection,"Load map");
  36.955  	}	
  36.956  	
  36.957      
  36.958 @@ -693,19 +837,22 @@
  36.959  	{
  36.960  		QMessageBox::critical( 0, tr( "Critical Parse Error" ),
  36.961  				   tr("Couldn't open map " +fname)+".");
  36.962 -		returnCode=1;	
  36.963 +		err=aborted;	
  36.964  	} else
  36.965  	{
  36.966 -		blockreposition=true;
  36.967 +		blockReposition=true;
  36.968  		QXmlInputSource source( file);
  36.969  		QXmlSimpleReader reader;
  36.970  		reader.setContentHandler( &handler );
  36.971  		reader.setErrorHandler( &handler );
  36.972  		handler.setMapEditor( this );
  36.973  		handler.setTmpDir (filePath.left(filePath.findRev("/",-1)));	// needed to load files with rel. path
  36.974 +		handler.setInputFile (file.name());
  36.975  		handler.setLoadMode (lmode);
  36.976 +		blockSaveState=true;
  36.977  		bool ok = reader.parse( source );
  36.978 -		blockreposition=false;
  36.979 +		blockReposition=false;
  36.980 +		blockSaveState=false;
  36.981  		file.close();
  36.982  		if ( ok ) 
  36.983  		{
  36.984 @@ -727,16 +874,19 @@
  36.985  		}	
  36.986  	}	
  36.987  	updateActions();
  36.988 -	return returnCode;
  36.989 +	return err;
  36.990  }
  36.991  
  36.992  int MapEditor::save (const SaveMode &savemode)
  36.993  {
  36.994  	// Finish open lineEdits
  36.995 -	if (lineedit) finishedLineEditNoSave();
  36.996 +	if (lineedit) finishedLineEdit();
  36.997  
  36.998  	int returnCode=0;
  36.999  
 36.1000 +	// The SaveMode UndoCommand is not supported here
 36.1001 +	if (savemode==UndoCommand) return 1;
 36.1002 +
 36.1003  	// Create mapName and fileDir
 36.1004  	makeSubDirs (fileDir);
 36.1005  	QString fname;
 36.1006 @@ -748,32 +898,14 @@
 36.1007  		fname=fileName;
 36.1008  
 36.1009  
 36.1010 -	// Check if fname is writeable
 36.1011 -	QFile file( fileDir+fname);
 36.1012 -	if (!file.open( IO_WriteOnly ) ) 
 36.1013 -	{
 36.1014 -		QMessageBox::critical( 0, tr( "Critical Save Error" ),
 36.1015 -					   tr("Couldn't write to ") +fileDir+fname);
 36.1016 +	QString saveFile;
 36.1017 +	if (savemode==CompleteMap || selection==NULL)
 36.1018 +		saveFile=saveToDir (fileDir,mapName+"-",true,QPoint(),NULL);
 36.1019 +	else	
 36.1020 +		saveFile=saveToDir (fileDir,mapName+"-",true,QPoint(),selection);
 36.1021 +
 36.1022 +	if (!saveStringToDisk(fileDir+fname,saveFile))
 36.1023  		return 1;
 36.1024 -	}	
 36.1025 -	file.close();
 36.1026 -
 36.1027 -	QString saveFile;
 36.1028 -	saveFile=saveToDir (fileDir,mapName+"-",true,QPoint(),savemode);
 36.1029 -
 36.1030 -	file.setName ( fileDir  + fname);
 36.1031 -	if ( !file.open( IO_WriteOnly ) )
 36.1032 -	{
 36.1033 -		// This should neverever happen
 36.1034 -		QMessageBox::critical(0, tr("Critcal save error"),"MapEditor::save() Couldn't open "+file.name());
 36.1035 -		return 1;
 36.1036 -	}	
 36.1037 -
 36.1038 -	// Write it finally, and write in UTF8, no matter what 
 36.1039 -	QTextStream ts( &file );
 36.1040 -	ts.setEncoding (QTextStream::UnicodeUTF8);
 36.1041 -	ts << saveFile;
 36.1042 -	file.close();
 36.1043  
 36.1044  	if (returnCode==0)
 36.1045  	{
 36.1046 @@ -798,12 +930,13 @@
 36.1047  void MapEditor::print()
 36.1048  {
 36.1049  	// Finish open lineEdits
 36.1050 -	if (lineedit) finishedLineEditNoSave();
 36.1051 +	if (lineedit) finishedLineEdit();
 36.1052  
 36.1053  	if ( !printer ) 
 36.1054  	{
 36.1055  		printer = new QPrinter;
 36.1056  		printer->setColorMode (QPrinter::Color);
 36.1057 +		printer->setPrinterName (settings.readEntry("/vym/mainwindow/printerName",printer->printerName()));
 36.1058  	}
 36.1059  
 36.1060  	QRect totalBBox=mapCenter->getTotalBBox();
 36.1061 @@ -840,50 +973,56 @@
 36.1062  		// e.g. (0,50,700,700) is upper part on A4
 36.1063  		// see also /usr/lib/qt3/doc/html/coordsys.html
 36.1064  
 36.1065 -		QPaintDeviceMetrics metrics (printer);
 36.1066 +		Q3PaintDeviceMetrics metrics (printer);
 36.1067  
 36.1068  		double paperAspect = (double)metrics.width()   / (double)metrics.height();
 36.1069  		double   mapAspect = (double)totalBBox.width() / (double)totalBBox.height();
 36.1070  
 36.1071 -		QRect mapRect=mapCenter->getTotalBBox();
 36.1072 -		QCanvasRectangle *frame=NULL;
 36.1073 -		QCanvasText *footerFN=NULL;
 36.1074 -		QCanvasText *footerDate=NULL;
 36.1075 +		QRect mapRect=totalBBox;
 36.1076 +		Q3CanvasRectangle *frame=NULL;
 36.1077 +		Q3CanvasText *footerFN=NULL;
 36.1078 +		Q3CanvasText *footerDate=NULL;
 36.1079  		if (printFrame || printFooter)
 36.1080  		{
 36.1081  			
 36.1082  			if (printFrame) 
 36.1083  			{
 36.1084  				// Print frame around map
 36.1085 -				mapRect.setRect (mapRect.x()-10, mapRect.y()-10, 
 36.1086 -					mapRect.width()+20, mapRect.height()+20);
 36.1087 -				frame=new QCanvasRectangle (mapRect,mapCanvas);
 36.1088 -				frame->setBrush (QColor(white));
 36.1089 -				frame->setPen (QColor(black));
 36.1090 +				mapRect.setRect (totalBBox.x()-10, totalBBox.y()-10, 
 36.1091 +					totalBBox.width()+20, totalBBox.height()+20);
 36.1092 +				frame=new Q3CanvasRectangle (mapRect,mapCanvas);
 36.1093 +				frame->setBrush (QColor(Qt::white));
 36.1094 +				frame->setPen (QColor(Qt::black));
 36.1095  				frame->setZ(0);
 36.1096  				frame->show();    
 36.1097  			}		
 36.1098 +			/* TODO remove after testing 
 36.1099 +			QCanvasLine *l=new QCanvasLine (mapCanvas);
 36.1100 +			l->setPoints (0,0,mapRect.width(),mapRect.height());
 36.1101 +			l->setPen (QPen(QColor(black), 1));
 36.1102 +			l->setZ (200);
 36.1103 +			l->show();
 36.1104 +			*/
 36.1105 +
 36.1106  			if (printFooter) 
 36.1107  			{
 36.1108  				// Print footer below map
 36.1109  				QFont font;		
 36.1110  				font.setPointSize(10);
 36.1111 -				footerFN=new QCanvasText (mapCanvas);
 36.1112 +				footerFN=new Q3CanvasText (mapCanvas);
 36.1113  				footerFN->setText ("VYM - " + fileName);
 36.1114  				footerFN->setFont(font);
 36.1115  				footerFN->move (mapRect.x(), mapRect.y() + mapRect.height() );
 36.1116  				footerFN->setZ(Z_TEXT);
 36.1117  				footerFN->show();    
 36.1118 -				footerDate=new QCanvasText (mapCanvas);
 36.1119 +				footerDate=new Q3CanvasText (mapCanvas);
 36.1120  				footerDate->setText (QDate::currentDate().toString(Qt::TextDate));
 36.1121  				footerDate->setFont(font);
 36.1122  				footerDate->move (mapRect.x()+mapRect.width()-footerDate->boundingRect().width(), mapRect.y() + mapRect.height() );
 36.1123  				footerDate->setZ(Z_TEXT);
 36.1124  				footerDate->show();    
 36.1125 -				mapRect.setRect (mapRect.x(), mapRect.y(), 
 36.1126 -					mapRect.width(), mapRect.height()+20);
 36.1127  			}
 36.1128 -			pp.setWindow (mapRect.x(), mapRect.y(), mapRect.width(), mapRect.height());
 36.1129 +			pp.setWindow (mapRect.x(), mapRect.y(), mapRect.width(), mapRect.height()+20);
 36.1130  		}	else	
 36.1131  		{
 36.1132  			pp.setWindow (mapRect);
 36.1133 @@ -915,6 +1054,9 @@
 36.1134  			selection=oldselection;
 36.1135  			selection->select();
 36.1136  		}	
 36.1137 +
 36.1138 +		// Save settings in vymrc
 36.1139 +		settings.writeEntry("/vym/mainwindow/printerName",printer->printerName());
 36.1140  	}
 36.1141  }
 36.1142  
 36.1143 @@ -947,86 +1089,84 @@
 36.1144  	return pix;
 36.1145  }
 36.1146  
 36.1147 +void MapEditor::setHideTmpMode (HideTmpMode mode)
 36.1148 +{
 36.1149 +	hidemode=mode;
 36.1150 +	mapCenter->setHideTmp (hidemode);
 36.1151 +	mapCenter->reposition();
 36.1152 +	adjustCanvasSize();
 36.1153 +	canvas()->update();
 36.1154 +}
 36.1155 +
 36.1156 +HideTmpMode MapEditor::getHideTmpMode()
 36.1157 +{
 36.1158 +	return hidemode;
 36.1159 +}
 36.1160 +
 36.1161  void MapEditor::exportImage(QString fn)
 36.1162  {
 36.1163  	// Finish open lineEdits
 36.1164 -	if (lineedit) finishedLineEditNoSave();
 36.1165 -
 36.1166 +	if (lineedit) finishedLineEdit();
 36.1167 +
 36.1168 +	setExportMode (true);
 36.1169  	QPixmap pix (getPixmap());
 36.1170  	pix.save(fn, "PNG");
 36.1171 +	setExportMode (false);
 36.1172 +}
 36.1173 +
 36.1174 +void MapEditor::setExportMode (bool b)
 36.1175 +{
 36.1176 +	// should be called before and after exports
 36.1177 +	// depending on the settings
 36.1178 +	if (b && settings.value("/vym/export/useHideExport","yes")=="yes")
 36.1179 +		setHideTmpMode (HideExport);
 36.1180 +	else	
 36.1181 +		setHideTmpMode (HideNone);
 36.1182  }
 36.1183  
 36.1184  void MapEditor::exportImage(QString fn, int item)
 36.1185  {
 36.1186  	// Finish open lineEdits
 36.1187 -	if (lineedit) finishedLineEditNoSave();
 36.1188 -
 36.1189 +	if (lineedit) finishedLineEdit();
 36.1190 +
 36.1191 +	setExportMode (true);
 36.1192  	QPixmap pix (getPixmap());
 36.1193  	pix.save(fn, exportImageFormatMenu->text(item) );
 36.1194 +	setExportMode (false);
 36.1195  }
 36.1196  
 36.1197 -void MapEditor::exportASCII()
 36.1198 +void MapEditor::exportOOPresentation(const QString &fn, const QString &cf)
 36.1199  {
 36.1200 -	// FIXME still experimental
 36.1201 -	QFileDialog *fd=new QFileDialog( this, tr("VYM - Export (ASCII)"));
 36.1202 -	fd->addFilter ("TXT (*.txt)");
 36.1203 -	fd->setCaption("VYM - Export (ASCII) (still experimental)");
 36.1204 -	fd->setMode( QFileDialog::AnyFile );
 36.1205 -	fd->show();
 36.1206 -
 36.1207 -	if ( fd->exec() == QDialog::Accepted )
 36.1208 +	ExportOO ex;
 36.1209 +	ex.setFile (fn);
 36.1210 +	ex.setMapCenter(mapCenter);
 36.1211 +	if (ex.setConfigFile(cf)) 
 36.1212  	{
 36.1213 -		if (QFile (fd->selectedFile()).exists() )
 36.1214 -		{
 36.1215 -			QMessageBox mb( "VYM",
 36.1216 -				tr("The file ") + fd->selectedFile() + 
 36.1217 -				tr(" exists already. Do you want to overwrite it?"),
 36.1218 -			QMessageBox::Warning,
 36.1219 -			QMessageBox::Yes | QMessageBox::Default,
 36.1220 -			QMessageBox::Cancel | QMessageBox::Escape,
 36.1221 -			QMessageBox::NoButton );
 36.1222 -
 36.1223 -			mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
 36.1224 -			mb.setButtonText( QMessageBox::No, tr("Cancel"));
 36.1225 -			Export ex;
 36.1226 -			switch( mb.exec() ) 
 36.1227 -			{
 36.1228 -				case QMessageBox::Yes:
 36.1229 -					// save 
 36.1230 -					if (!ex.setOutputDir ("out"))
 36.1231 -					{
 36.1232 -						QMessageBox::critical (0,tr("Critical Export Error "),tr("Couldn't create directory ") + "out");
 36.1233 -						return;
 36.1234 -					}
 36.1235 -					break;;
 36.1236 -				case QMessageBox::Cancel:
 36.1237 -					// do nothing
 36.1238 -					return;
 36.1239 -					break;
 36.1240 -			}
 36.1241 -		}
 36.1242 -		Export ex;
 36.1243 -		ex.setPath (fd->selectedFile() );
 36.1244 -		ex.setMapCenter(mapCenter);
 36.1245 -		ex.exportMap();
 36.1246 +		setExportMode (true);
 36.1247 +		ex.exportPresentation();
 36.1248 +		setExportMode (false);
 36.1249  	}
 36.1250  }
 36.1251  
 36.1252  
 36.1253 +
 36.1254  void MapEditor::exportXML(const QString &dir)
 36.1255  {
 36.1256 +	// Hide stuff during export, if settings want this
 36.1257 +	setExportMode (true);
 36.1258 +
 36.1259  	// Create subdirectories
 36.1260  	makeSubDirs (dir);
 36.1261  
 36.1262  	// write to directory
 36.1263 -	QString saveFile=saveToDir (dir,mapName+"-",true,mapCenter->getTotalBBox().topLeft() ,CompleteMap);
 36.1264 +	QString saveFile=saveToDir (dir,mapName+"-",true,mapCenter->getTotalBBox().topLeft() ,NULL);
 36.1265  	QFile file;
 36.1266  
 36.1267  	file.setName ( dir + "/"+mapName+".xml");
 36.1268 -	if ( !file.open( IO_WriteOnly ) )
 36.1269 +	if ( !file.open( QIODevice::WriteOnly ) )
 36.1270  	{
 36.1271  		// This should neverever happen
 36.1272 -		QMessageBox::critical (0,tr("Critical Export Error"),tr("MapEditor::exportXML couldn't open ")+file.name());
 36.1273 +		QMessageBox::critical (0,tr("Critical Export Error"),tr("MapEditor::exportXML couldn't open %1").arg(file.name()));
 36.1274  		return;
 36.1275  	}	
 36.1276  
 36.1277 @@ -1038,6 +1178,8 @@
 36.1278  
 36.1279  	// Now write image, too
 36.1280  	exportImage (dir+"/images/"+mapName+".png");
 36.1281 +
 36.1282 +	setExportMode (false);
 36.1283  }
 36.1284  
 36.1285  void MapEditor::clear()
 36.1286 @@ -1051,240 +1193,264 @@
 36.1287  	mapCenter->clear();
 36.1288  }
 36.1289  
 36.1290 +void MapEditor::copy()
 36.1291 +{
 36.1292 +	// Finish open lineEdits
 36.1293 +	if (lineedit) finishedLineEdit();
 36.1294 +
 36.1295 +	if (selection) 
 36.1296 +	{
 36.1297 +		// write to directory
 36.1298 +		QString clipfile="part";
 36.1299 +		QString saveFile=saveToDir (fileDir,clipfile+"-",true,QPoint(),selection);
 36.1300 +		QFile file;
 36.1301 +
 36.1302 +		file.setName ( clipboardDir + "/"+clipfile+".xml");
 36.1303 +		if ( !file.open( QIODevice::WriteOnly ) )
 36.1304 +		{
 36.1305 +			// This should neverever happen
 36.1306 +			QMessageBox::critical (0,tr("Critical Export Error"),tr("MapEditor::exportXML couldn't open %1").arg(file.name()));
 36.1307 +			return;
 36.1308 +		}	
 36.1309 +
 36.1310 +		// Write it finally, and write in UTF8, no matter what 
 36.1311 +		QTextStream ts( &file );
 36.1312 +		ts.setEncoding (QTextStream::UnicodeUTF8);
 36.1313 +		ts << saveFile;
 36.1314 +		file.close();
 36.1315 +
 36.1316 +		clipboardEmpty=false;
 36.1317 +		updateActions();
 36.1318 +	}	    
 36.1319 +}
 36.1320 +
 36.1321 +void MapEditor::redo()
 36.1322 +{
 36.1323 +	// Finish open lineEdits
 36.1324 +	if (lineedit) finishedLineEdit();
 36.1325 +
 36.1326 +	blockSaveState=true;
 36.1327 +	
 36.1328 +	// Find out current undo directory
 36.1329 +	QString bakMapDir=QDir::convertSeparators (QString(tmpMapDir+"/undo-%1").arg(undoNum));
 36.1330 +
 36.1331 +	// Restore variables
 36.1332 +	QString undoCommand;
 36.1333 +	QString undoSelection;
 36.1334 +	QString redoCommand;
 36.1335 +	QString redoSelection;
 36.1336 +	SimpleSettings set;
 36.1337 +	set.readSettings(QString(bakMapDir+"/commands"));
 36.1338 +	undoCommand=set.readEntry ("undoCommand");
 36.1339 +	undoSelection=set.readEntry ("undoSelection");
 36.1340 +	redoCommand=set.readEntry ("redoCommand");
 36.1341 +	redoSelection=set.readEntry ("redoSelection");
 36.1342 +
 36.1343 +	// select  object before redo
 36.1344 +	if (!redoSelection.isEmpty())
 36.1345 +		select (redoSelection);
 36.1346 +
 36.1347 +/* TODO remove testing
 36.1348 +	cout << "ME::redo() begin\n";
 36.1349 +	cout << "    undosTotal="<<undosTotal<<endl;
 36.1350 +	cout << "    undosAvail="<<undosAvail<<endl;
 36.1351 +	cout << "       undoNum="<<undoNum<<endl;
 36.1352 +	cout << "    ---------------------------"<<endl;
 36.1353 +	cout << "    undoCom="<<undoCommand<<endl;
 36.1354 +	cout << "    undoSel="<<undoSelection<<endl;
 36.1355 +	cout << "    ---------------------------"<<endl;
 36.1356 +	cout << "    redoCom="<<redoCommand<<endl;
 36.1357 +	cout << "    redoSel="<<redoSelection<<endl;
 36.1358 +	cout << "    ---------------------------"<<endl;
 36.1359 +*/
 36.1360 +	parseAtom (undoCommand);
 36.1361 +	mapCenter->reposition();
 36.1362 +
 36.1363 +	//if (!redoSelection.isEmpty())
 36.1364 +	//	select (redoSelection);
 36.1365 +
 36.1366 +	undosAvail--;
 36.1367 +	if (undosAvail<1)
 36.1368 +		// Undo not longer available now
 36.1369 +		actionEditUndo->setEnabled (false);
 36.1370 +	else	
 36.1371 +		undoNum--; if (undoNum<1) undoNum=undosTotal;
 36.1372 +
 36.1373 +	blockSaveState=false;
 36.1374 +/* TODO remove testing
 36.1375 +	cout << "ME::redo() end\n";
 36.1376 +	cout << "    undosAvail="<<undosAvail<<endl;
 36.1377 +	cout << "       undoNum="<<undoNum<<endl;
 36.1378 +	cout << "    ---------------------------"<<endl<<endl;
 36.1379 +*/	
 36.1380 +}
 36.1381 +
 36.1382  void MapEditor::undo()
 36.1383  {
 36.1384 -	QDir d;
 36.1385 -	d.setPath(bakMapDir);
 36.1386 +	// Finish open lineEdits
 36.1387 +	if (lineedit) finishedLineEdit();
 36.1388 +
 36.1389 +	blockSaveState=true;
 36.1390 +	
 36.1391 +	// Find out current undo directory
 36.1392 +	QString bakMapDir=QDir::convertSeparators (QString(tmpMapDir+"/undo-%1").arg(undoNum));
 36.1393 +
 36.1394 +	// Restore variables
 36.1395 +	QString undoCommand;
 36.1396 +	QString undoSelection;
 36.1397 +	QString redoCommand;
 36.1398 +	QString redoSelection;
 36.1399 +	SimpleSettings set;
 36.1400 +	set.readSettings(QString(bakMapDir+"/commands"));
 36.1401 +	undoCommand=  set.readEntry ("undoCommand");
 36.1402 +	undoSelection=set.readEntry ("undoSelection");
 36.1403 +	redoCommand=  set.readEntry ("redoCommand");
 36.1404 +	redoSelection=set.readEntry ("redoSelection");
 36.1405 +
 36.1406 +	// select  object before undo
 36.1407 +	if (!undoSelection.isEmpty())
 36.1408 +		select (undoSelection);
 36.1409 +
 36.1410 +/* TODO testing
 36.1411 +	cout << "ME::undo() begin\n";
 36.1412 +	cout << "    undosTotal="<<undosTotal<<endl;
 36.1413 +	cout << "    undosAvail="<<undosAvail<<endl;
 36.1414 +	cout << "       undoNum="<<undoNum<<endl;
 36.1415 +	cout << "    ---------------------------"<<endl;
 36.1416 +	cout << "    undoCom="<<undoCommand<<endl;
 36.1417 +	cout << "    undoSel="<<undoSelection<<endl;
 36.1418 +	cout << "    ---------------------------"<<endl;
 36.1419 +	cout << "    redoCom="<<redoCommand<<endl;
 36.1420 +	cout << "    redoSel="<<redoSelection<<endl;
 36.1421 +	cout << "    ---------------------------"<<endl;
 36.1422 +*/	
 36.1423 +	parseAtom (undoCommand);
 36.1424 +	mapCenter->reposition();
 36.1425 +
 36.1426 +	//if (!redoSelection.isEmpty())
 36.1427 +	//	select (redoSelection);
 36.1428 +
 36.1429 +	undosAvail--;
 36.1430 +	if (undosAvail<1)
 36.1431 +		// Undo not longer available now
 36.1432 +		actionEditUndo->setEnabled (false);
 36.1433 +	else	
 36.1434 +		undoNum--; if (undoNum<1) undoNum=undosTotal;
 36.1435 +
 36.1436 +	blockSaveState=false;
 36.1437 +/* TODO remove testing
 36.1438 +	cout << "ME::undo() end\n";
 36.1439 +	cout << "    undosAvail="<<undosAvail<<endl;
 36.1440 +	cout << "       undoNum="<<undoNum<<endl;
 36.1441 +	cout << "    ---------------------------"<<endl<<endl;
 36.1442 +*/
 36.1443 +}
 36.1444 +
 36.1445 +void MapEditor::undoXML(const QString &undoSel, const QString &bakMapPath)
 36.1446 +{
 36.1447 +	QString bakMapDir=bakMapPath.left(bakMapPath.findRev("/"));
 36.1448 +	QDir d(bakMapDir);
 36.1449 +	QFile file (bakMapPath);
 36.1450 +
 36.1451  	if (d.exists() )
 36.1452  	{
 36.1453 -		// Finish open lineEdits
 36.1454 -		if (lineedit) finishedLineEditNoSave();
 36.1455 -
 36.1456 -		if (selection) 
 36.1457 -		{
 36.1458 -			selection->unselect();
 36.1459 -			selection=NULL;
 36.1460 -		}	
 36.1461 -		
 36.1462 +		// We need to parse saved XML data
 36.1463  		mapBuilderHandler handler;
 36.1464 -		QXmlInputSource source;
 36.1465 -		source.setData(backupXML);
 36.1466 +		QXmlInputSource source( file);
 36.1467  		QXmlSimpleReader reader;
 36.1468  		reader.setContentHandler( &handler );
 36.1469  		reader.setErrorHandler( &handler );
 36.1470  		handler.setMapEditor( this );
 36.1471  		handler.setTmpDir ( bakMapDir );	// needed to load files with rel. path
 36.1472 -		if (undoSelection)
 36.1473 +		if (undoSel.isEmpty())
 36.1474  		{
 36.1475 -			selection=undoSelection;
 36.1476 -			selection->select();
 36.1477 -			handler.setLoadMode (ImportReplace);
 36.1478 -
 36.1479 +			unselect();
 36.1480 +			mapCenter->clear();
 36.1481 +			handler.setLoadMode (NewMap);
 36.1482  		} else	
 36.1483  		{
 36.1484 -			mapCenter->clear();
 36.1485 -			handler.setLoadMode (NewMap);
 36.1486 +			select (undoSel);
 36.1487 +			handler.setLoadMode (ImportReplace);
 36.1488  		}	
 36.1489 -		blockreposition=true;
 36.1490 +		blockReposition=true;
 36.1491  		bool ok = reader.parse( source );
 36.1492 -		blockreposition=false;
 36.1493 -		if ( ok ) 
 36.1494 -			mapCenter->reposition();
 36.1495 -			
 36.1496 -		else 
 36.1497 +		blockReposition=false;
 36.1498 +		if (! ok ) 
 36.1499  		{	
 36.1500  			// This should never ever happen
 36.1501  			QMessageBox::critical( 0, tr( "Critical Parse Error by reading backupFile" ),
 36.1502 -								   tr( handler.errorProtocol() )+" in "+backupXML );
 36.1503 +								   tr( handler.errorProtocol() )+" in "+bakMapDir );
 36.1504  		}
 36.1505 -		// Undo not longer available now
 36.1506 -		actionEditUndo->setEnabled (false);
 36.1507 -		undoSelection=false;
 36.1508 -		mapChanged=false;
 36.1509 -		return;
 36.1510  	} else	
 36.1511  	{
 36.1512  		QMessageBox::critical( 0, tr( "Critical Error" ),
 36.1513 -			"Temporary directory " +bakMapDir + 
 36.1514 -			tr (" used for undo is gone. \n"
 36.1515 +			tr("Temporary directory %1 used for undo is gone. \n"
 36.1516  			"I will create a new one, but at the moment no undo is available.\n"
 36.1517  			"Maybe you want to reload your original data.\n\n"
 36.1518 -			"Sorry for any inconveniences.") );
 36.1519 +			"Sorry for any inconveniences.").arg(bakMapDir) );
 36.1520  		makeTmpDirs();	
 36.1521  	}							
 36.1522  }
 36.1523  
 36.1524 -void MapEditor::copy()
 36.1525 +void MapEditor::pasteNoSave()
 36.1526  {
 36.1527  	// Finish open lineEdits
 36.1528 -	if (lineedit) finishedLineEditNoSave();
 36.1529 -
 36.1530 -	if (selection) 
 36.1531 -	{
 36.1532 -		if (typeid(*selection) == typeid(BranchObj) ) 
 36.1533 -		{
 36.1534 -			BranchObj* to;
 36.1535 -			BranchObj* from;
 36.1536 -			clipboardME->clear();
 36.1537 -			clipboardME->getMapCenter()->addBranch();
 36.1538 -			to=clipboardME->getMapCenter()->getLastBranch();
 36.1539 -			if (to) 
 36.1540 -			{
 36.1541 -				from=(BranchObj*)(selection);
 36.1542 -				to->copy(from);
 36.1543 -
 36.1544 -				// keep position relative to parent
 36.1545 -				to->move2RelPos ( from->getRelPos());
 36.1546 -
 36.1547 -				// select data in clipboard
 36.1548 -				clipboardME->select ("bo:0");
 36.1549 -
 36.1550 -				// repositioning makes testing nicer,
 36.1551 -				// but is not needed usually:
 36.1552 -				if (clipboardME->isVisible())
 36.1553 -				{
 36.1554 -					clipboardME->getMapCenter()->reposition();  
 36.1555 -				}	
 36.1556 -				else
 36.1557 -					clipboardME->hide();
 36.1558 -			}
 36.1559 -		}    
 36.1560 -		if (typeid(*selection) == typeid(FloatImageObj) ) 
 36.1561 -		{
 36.1562 -			FloatImageObj* to;
 36.1563 -			FloatImageObj* from;
 36.1564 -			clipboardME->clear();
 36.1565 -			clipboardME->getMapCenter()->addFloatImage();
 36.1566 -			to=clipboardME->getMapCenter()->getLastFloatImage();
 36.1567 -			if (to) 
 36.1568 -			{
 36.1569 -				from=(FloatImageObj*)(selection);
 36.1570 -				to->copy(from);
 36.1571 -
 36.1572 -				// select data in clipboard
 36.1573 -				clipboardME->select ("fi:0");
 36.1574 -
 36.1575 -				// repositioning makes testing nicer,
 36.1576 -				// but is not needed usually:
 36.1577 -				if (clipboardME->isVisible())
 36.1578 -				{
 36.1579 -					clipboardME->getMapCenter()->reposition();  
 36.1580 -				}	
 36.1581 -				else
 36.1582 -					clipboardME->hide();
 36.1583 -			}
 36.1584 -		}    
 36.1585 -	}	    
 36.1586 -}
 36.1587 -
 36.1588 -LinkableMapObj* MapEditor::pasteNoSave()
 36.1589 -{
 36.1590 -	return pasteAtNoSave (-1);
 36.1591 -}
 36.1592 -
 36.1593 -LinkableMapObj* MapEditor::pasteAtNoSave(int pos)
 36.1594 -{
 36.1595 -	// Finish open lineEdits
 36.1596 -	if (lineedit) finishedLineEditNoSave();
 36.1597 -
 36.1598 -	LinkableMapObj *fromLMO=clipboardME->getSelection();
 36.1599 -	LinkableMapObj *returnLMO=NULL;
 36.1600 -
 36.1601 -	if (selection && fromLMO) 
 36.1602 -	{
 36.1603 -
 36.1604 -		if (typeid(*fromLMO) == typeid(BranchObj) ) 
 36.1605 -		{
 36.1606 -			if (typeid(*selection) == typeid(MapCenterObj)) 
 36.1607 -			{
 36.1608 -				returnLMO=mapCenter->addBranch( (BranchObj*)(fromLMO) );
 36.1609 -				((BranchObj*)(returnLMO))->move2RelPos(normalise(fromLMO->getRelPos() ) );
 36.1610 -			}     
 36.1611 -			if (typeid(*selection) == typeid(BranchObj)) 
 36.1612 -				if (pos<0)
 36.1613 -					returnLMO=((BranchObj*)(selection))->addBranch((BranchObj*)(fromLMO) );
 36.1614 -				else
 36.1615 -				{
 36.1616 -					BranchObj *par=(BranchObj*)(selection->getParObj());
 36.1617 -					if (par) returnLMO=par->insertBranch((BranchObj*)(fromLMO),pos );
 36.1618 -				}	
 36.1619 -		}
 36.1620 -		
 36.1621 -		if (typeid(*fromLMO) == typeid(FloatImageObj) &&
 36.1622 -			(typeid(*selection) == typeid (BranchObj) || 
 36.1623 -			 typeid(*selection)==typeid(MapCenterObj)) )
 36.1624 -			returnLMO=((BranchObj*) (selection))->addFloatImage ((FloatImageObj*)(fromLMO));
 36.1625 -		
 36.1626 -	}	    
 36.1627 -	return returnLMO;
 36.1628 +	if (lineedit) finishedLineEdit();
 36.1629 +
 36.1630 +	load (clipboardDir+"/part.xml",ImportAdd);
 36.1631  }
 36.1632  
 36.1633  void MapEditor::cutNoSave()
 36.1634  {
 36.1635 -	// Finish open lineEdits
 36.1636 -	if (lineedit) finishedLineEditNoSave();
 36.1637 -
 36.1638 -	BranchObj* bo;
 36.1639 -	BranchObj* par; 
 36.1640 -	if (selection != NULL) {
 36.1641 -		if (typeid(*selection) == typeid(BranchObj) ) 
 36.1642 -		{
 36.1643 -			bo=(BranchObj*)(selection);
 36.1644 -			par=(BranchObj*)(bo->getParObj());
 36.1645 -			bo->unselect();
 36.1646 -			selection=NULL;
 36.1647 -			par->removeBranch(bo);
 36.1648 -			selection=par;
 36.1649 -			selection->select();
 36.1650 -		}
 36.1651 -		if (typeid(*selection) == typeid(FloatImageObj) ) 
 36.1652 -		{
 36.1653 -			FloatImageObj* fio=(FloatImageObj*)(selection);
 36.1654 -			par=(BranchObj*)(fio->getParObj());
 36.1655 -			fio->unselect();
 36.1656 -			selection=NULL;
 36.1657 -			par->removeFloatImage(fio);
 36.1658 -			selection=par;
 36.1659 -			selection->select();
 36.1660 -		}
 36.1661 -	}	    
 36.1662 +	copy();
 36.1663 +	deleteSelection();
 36.1664  }
 36.1665  
 36.1666  void MapEditor::paste()
 36.1667  {   
 36.1668 -	setChanged();
 36.1669 -	saveState(PartOfMap,selection);
 36.1670 -	pasteNoSave();
 36.1671 -	mapCenter->reposition();
 36.1672 -	adjustCanvasSize();
 36.1673 +	if (selection && (typeid(*selection) == typeid(BranchObj) ||
 36.1674 +				      typeid(*selection) == typeid(MapCenterObj))) 
 36.1675 +	{
 36.1676 +		saveState(selection,QString("Paste to %1").arg( getName(selection)));
 36.1677 +		pasteNoSave();
 36.1678 +		mapCenter->reposition();
 36.1679 +		adjustCanvasSize();
 36.1680 +	}
 36.1681  }
 36.1682  
 36.1683  void MapEditor::cut()
 36.1684  {
 36.1685 -	setChanged();
 36.1686 -	saveState(PartOfMap,selection->getParObj());
 36.1687 +	saveState(selection->getParObj(),QString("Cut %1").arg(getName(selection)));
 36.1688  	copy();
 36.1689  	cutNoSave();
 36.1690  	mapCenter->reposition();
 36.1691  	adjustCanvasSize();
 36.1692  }
 36.1693  
 36.1694 +void MapEditor::move(const int &x, const int &y)
 36.1695 +{
 36.1696 +	// TODO no saveState, because this is only internal at undo so far
 36.1697 +	if (selection) selection->move(x,y);
 36.1698 +	if (typeid(*selection) == typeid(FloatImageObj))
 36.1699 +		((FloatImageObj*)selection)->setRelPos();
 36.1700 +}
 36.1701 +
 36.1702  void MapEditor::moveBranchUp()
 36.1703  {
 36.1704  	// Finish open lineEdits
 36.1705 -	if (lineedit) finishedLineEditNoSave();
 36.1706 +	if (lineedit) finishedLineEdit();
 36.1707  
 36.1708  	BranchObj* bo;
 36.1709  	BranchObj* par;
 36.1710  	if (typeid(*selection) == typeid(BranchObj)  ) 
 36.1711  	{
 36.1712 -		setChanged();
 36.1713 -		saveState(PartOfMap,selection->getParObj());
 36.1714 -		bo=(BranchObj*)(selection);
 36.1715 +		bo=(BranchObj*)selection;
 36.1716 +		if (!bo->canMoveBranchUp()) return;
 36.1717  		par=(BranchObj*)(bo->getParObj());
 36.1718  		selection->unselect();
 36.1719  		selection=par->moveBranchUp (bo);
 36.1720  		selection->select();
 36.1721 +		saveState("moveBranchDown ()",bo,QString("Move up %1").arg(getName(bo)));
 36.1722  		mapCenter->reposition();
 36.1723  		ensureSelectionVisible();
 36.1724  	}
 36.1725 @@ -1293,19 +1459,19 @@
 36.1726  void MapEditor::moveBranchDown()
 36.1727  {
 36.1728  	// Finish open lineEdits
 36.1729 -	if (lineedit) finishedLineEditNoSave();
 36.1730 +	if (lineedit) finishedLineEdit();
 36.1731  
 36.1732  	BranchObj* bo;
 36.1733  	BranchObj* par;
 36.1734  	if (typeid(*selection) == typeid(BranchObj)  ) 
 36.1735  	{
 36.1736 -		setChanged();
 36.1737 -		saveState(PartOfMap,selection->getParObj());
 36.1738 -		bo=(BranchObj*)(selection);
 36.1739 +		bo=(BranchObj*)selection;
 36.1740 +		if (!bo->canMoveBranchDown()) return;
 36.1741  		par=(BranchObj*)(bo->getParObj());
 36.1742  		selection->unselect(); 
 36.1743  		selection=par->moveBranchDown(bo);
 36.1744  		selection->select();
 36.1745 +		saveState("moveBranchUp ()",bo,QString("Move down %1").arg(getName(bo)));
 36.1746  		mapCenter->reposition();
 36.1747  		ensureSelectionVisible();
 36.1748  	}	
 36.1749 @@ -1314,46 +1480,82 @@
 36.1750  void MapEditor::editHeading()
 36.1751  {
 36.1752  	// Finish open lineEdits
 36.1753 -	if (lineedit) finishedLineEditNoSave();
 36.1754 +	if (lineedit) finishedLineEdit();
 36.1755  
 36.1756  	if (selection  &&  
 36.1757  		 (typeid(*selection) == typeid(BranchObj) || 
 36.1758  		  typeid(*selection) == typeid(MapCenterObj) ) ) 
 36.1759  	{
 36.1760 -		setChanged();
 36.1761 -		saveState(PartOfMap,selection);
 36.1762 +		editingBO=(BranchObj*)selection;
 36.1763  
 36.1764  		ensureSelectionVisible();
 36.1765 -		BranchObj *bo=(BranchObj*)(selection);
 36.1766 -		editingBO=(BranchObj*)(selection);
 36.1767 -		QPoint p = worldMatrix().map(QPoint (bo->x(),bo->y()));
 36.1768 +		QPoint p = worldMatrix().map(QPoint (editingBO->x(),editingBO->y()));
 36.1769  		lineedit->setGeometry(p.x()-contentsX(),p.y()-contentsY(),200,25);
 36.1770 -		QString s=bo->getHeading();
 36.1771 +		QString s=editingBO->getHeading();
 36.1772  		lineedit->setText(s);
 36.1773  		lineedit->setCursorPosition(1);
 36.1774  		if (actionSettingsAutoselectText->isOn() && !s.isEmpty() && actionSettingsPasteNewHeading->isOn() )
 36.1775  			lineedit->selectAll();
 36.1776  		lineedit->show();
 36.1777 -
 36.1778  		lineedit->grabKeyboard();
 36.1779  		lineedit->setFocus();
 36.1780  	}				
 36.1781  }
 36.1782  
 36.1783 -
 36.1784 -void MapEditor::addNewBranch(int pos)
 36.1785 +void MapEditor::setHeading(const QString &s)
 36.1786  {
 36.1787 -	// Finish open lineEdits
 36.1788 -	if (lineedit) finishedLineEditNoSave();
 36.1789 -
 36.1790 +	// Internal function, no saveState needed
 36.1791  	if (selection  &&  
 36.1792  		 (typeid(*selection) == typeid(BranchObj) || 
 36.1793  		  typeid(*selection) == typeid(MapCenterObj) ) ) 
 36.1794  	{
 36.1795 -		setChanged();
 36.1796 -		saveState(PartOfMap,selection);
 36.1797 -
 36.1798 -		BranchObj* bo1 = (BranchObj*) (selection);
 36.1799 +		((BranchObj*)selection)->setHeading(s);
 36.1800 +		mapCenter->reposition();
 36.1801 +		adjustCanvasSize();
 36.1802 +		ensureSelectionVisible();
 36.1803 +	}
 36.1804 +}
 36.1805 +
 36.1806 +void MapEditor::setURL (const QString &s)
 36.1807 +{
 36.1808 +	// Internal function, no saveState needed
 36.1809 +	if (selection  &&  
 36.1810 +		 (typeid(*selection) == typeid(BranchObj) || 
 36.1811 +		  typeid(*selection) == typeid(MapCenterObj) ) ) 
 36.1812 +	{
 36.1813 +		((BranchObj*)selection)->setURL(s);
 36.1814 +		mapCenter->reposition();
 36.1815 +		adjustCanvasSize();
 36.1816 +		ensureSelectionVisible();
 36.1817 +	}
 36.1818 +}
 36.1819 +
 36.1820 +void MapEditor::setVymLink (const QString &s)
 36.1821 +{
 36.1822 +	// Internal function, no saveState needed
 36.1823 +	if (selection  &&  
 36.1824 +		 (typeid(*selection) == typeid(BranchObj) || 
 36.1825 +		  typeid(*selection) == typeid(MapCenterObj) ) ) 
 36.1826 +	{
 36.1827 +		((BranchObj*)selection)->setVymLink(s);
 36.1828 +		mapCenter->reposition();
 36.1829 +		adjustCanvasSize();
 36.1830 +		ensureSelectionVisible();
 36.1831 +	}
 36.1832 +}
 36.1833 +
 36.1834 +void MapEditor::addNewBranch(int pos)
 36.1835 +{
 36.1836 +	// Finish open lineEdits
 36.1837 +	if (lineedit) finishedLineEdit();
 36.1838 +
 36.1839 +	if (selection  &&  
 36.1840 +		 (typeid(*selection) == typeid(BranchObj) || 
 36.1841 +		  typeid(*selection) == typeid(MapCenterObj) ) ) 
 36.1842 +	{
 36.1843 +		BranchObj* bo1 = (BranchObj*) selection;
 36.1844 +		saveState(selection, QString("Add new branch to %1").arg(getName(bo1)));	//TODO undoCommand
 36.1845 +
 36.1846  		bool wasScrolled=false;
 36.1847  		BranchObj *newbo=NULL;
 36.1848  		if (pos==0)
 36.1849 @@ -1391,7 +1593,7 @@
 36.1850  			selection->select();
 36.1851  			if (actionSettingsPasteNewHeading->isOn() )
 36.1852  			{
 36.1853 -				BranchObj *bo2= (BranchObj*)(selection);
 36.1854 +				BranchObj *bo2= (BranchObj*)selection;
 36.1855  				bo2->setHeading("");
 36.1856  			}	
 36.1857  			if (actionSettingsAutoedit->isOn() )
 36.1858 @@ -1407,18 +1609,74 @@
 36.1859  	}	
 36.1860  }
 36.1861  
 36.1862 +
 36.1863 +void MapEditor::addNewBranchHere()
 36.1864 +{
 36.1865 +	// Finish open lineEdits
 36.1866 +	if (lineedit) finishedLineEdit();
 36.1867 +
 36.1868 +	if (selection  &&  
 36.1869 +		 (typeid(*selection) == typeid(BranchObj) ) )
 36.1870 +	{
 36.1871 +		BranchObj* bo1 = (BranchObj*) selection;
 36.1872 +		saveState(selection, QString("Add new branch here").arg(getName(bo1)));
 36.1873 +
 36.1874 +		bool wasScrolled=false;
 36.1875 +		BranchObj *newbo=NULL;
 36.1876 +		BranchObj *parbo=(BranchObj*)(selection->getParObj());
 36.1877 +		if (parbo)
 36.1878 +		{
 36.1879 +			// add below selection
 36.1880 +			newbo=parbo->insertBranch(bo1->getNum()+1);
 36.1881 +		} 
 36.1882 +
 36.1883 +		LinkableMapObj *oldselection=selection;
 36.1884 +		((BranchObj*)selection)->moveBranchTo (newbo,-1);
 36.1885 +
 36.1886 +		mapCenter->reposition();
 36.1887 +		adjustCanvasSize();
 36.1888 +		if (actionSettingsAutoedit->isOn() ||
 36.1889 +			actionSettingsAutoselectHeading->isOn() )
 36.1890 +		{
 36.1891 +			selection->unselect();
 36.1892 +			selection=newbo;
 36.1893 +			selection->select();
 36.1894 +			if (actionSettingsPasteNewHeading->isOn() )
 36.1895 +			{
 36.1896 +				BranchObj *bo2= (BranchObj*)selection;
 36.1897 +				bo2->setHeading("");
 36.1898 +			}	
 36.1899 +			if (actionSettingsAutoedit->isOn() )
 36.1900 +				editHeading();
 36.1901 +			if (!actionSettingsAutoselectHeading->isOn()
 36.1902 +				&& !wasScrolled)
 36.1903 +			{
 36.1904 +				selection->unselect();
 36.1905 +				selection=oldselection;
 36.1906 +				selection->select();
 36.1907 +			}
 36.1908 +		}	
 36.1909 +	}	
 36.1910 +}
 36.1911 +
 36.1912  void MapEditor::deleteSelection()
 36.1913  {
 36.1914  	// Finish open lineEdits
 36.1915 -	if (lineedit) finishedLineEditNoSave();
 36.1916 +	if (lineedit) finishedLineEdit();
 36.1917  
 36.1918  	if (selection  && typeid(*selection) ==typeid(BranchObj) ) 
 36.1919  	{
 36.1920 -		setChanged();
 36.1921 -		saveState(PartOfMap,selection->getParObj());
 36.1922  		BranchObj* bo=dynamic_cast <BranchObj*> (selection);
 36.1923  		BranchObj* par=(BranchObj*)(bo->getParObj());
 36.1924  		bo->unselect();
 36.1925 +		if (selection->getDepth()>1)
 36.1926 +			// Normal branch, save parent with childs
 36.1927 +			saveState(par,QString("Delete %1").arg(getName(bo)));
 36.1928 +		else
 36.1929 +			// Mainbranch, save whole map
 36.1930 +			// TODO Better would be to insert mainbranch again at pos
 36.1931 +			// But undoCommand is missing right now
 36.1932 +			saveState(QString("Delete %1").arg(getName(bo)));
 36.1933  		selection=NULL;
 36.1934  		par->removeBranch(bo);
 36.1935  		selection=par;
 36.1936 @@ -1429,10 +1687,9 @@
 36.1937  	}
 36.1938  	if (selection  && typeid(*selection) ==typeid(FloatImageObj) ) 
 36.1939  	{
 36.1940 -		setChanged();
 36.1941 -		saveState(PartOfMap,selection->getParObj());
 36.1942  		FloatImageObj* fio=dynamic_cast <FloatImageObj*> (selection);
 36.1943  		BranchObj* par=(BranchObj*)(fio->getParObj());
 36.1944 +		saveState(par, QString("Delete %1").arg(getName(fio)));
 36.1945  		fio->unselect();
 36.1946  		selection=NULL;
 36.1947  		par->removeFloatImage(fio);
 36.1948 @@ -1449,56 +1706,6 @@
 36.1949  	return selection;
 36.1950  }
 36.1951  
 36.1952 -bool MapEditor::select (QString s)
 36.1953 -{
 36.1954 -	LinkableMapObj *lmo=mapCenter;
 36.1955 -	QString part;
 36.1956 -	QString typ;
 36.1957 -	QString num;
 36.1958 -	while (!s.isEmpty() )
 36.1959 -	{
 36.1960 -		part=s.section(",",0,0);
 36.1961 -		typ=part.left (3);
 36.1962 -		num=part.right(part.length() - 3);
 36.1963 -		
 36.1964 -		if (typ=="mc:")
 36.1965 -		{
 36.1966 -			if (num=="")
 36.1967 -				break;
 36.1968 -			else
 36.1969 -				lmo=mapCenter->getBranchNum (num.toUInt());
 36.1970 -		} else
 36.1971 -			if (typ=="bo:")
 36.1972 -				lmo=((BranchObj*)(lmo))->getBranchNum (num.toUInt());
 36.1973 -			else
 36.1974 -				if (typ=="fi:")
 36.1975 -					lmo=((BranchObj*)(lmo))->getFloatImageNum (num.toUInt());
 36.1976 -				
 36.1977 -		
 36.1978 -		
 36.1979 -		if (!lmo) break;
 36.1980 -		
 36.1981 -		if (s.contains(","))
 36.1982 -			s=s.right(s.length() - part.length() -1 );
 36.1983 -		else	
 36.1984 -			break;
 36.1985 -	}
 36.1986 -
 36.1987 -	// Finally select the found object
 36.1988 -	if (lmo)
 36.1989 -	{
 36.1990 -		if (selection) selection->unselect();
 36.1991 -		selection=lmo;
 36.1992 -		selection->select();
 36.1993 -		adjustCanvasSize();
 36.1994 -		ensureSelectionVisible();
 36.1995 -		return true;
 36.1996 -	} else
 36.1997 -		return false;
 36.1998 -	
 36.1999 -	
 36.2000 -}
 36.2001 -
 36.2002  void MapEditor::unselect()
 36.2003  {
 36.2004  	if (selection) 
 36.2005 @@ -1519,6 +1726,37 @@
 36.2006  	}
 36.2007  }	
 36.2008  
 36.2009 +bool MapEditor::select (const QString &s)
 36.2010 +{
 36.2011 +	LinkableMapObj *lmo=mapCenter->findObjBySelect(s);
 36.2012 +
 36.2013 +	// Finally select the found object
 36.2014 +	if (lmo)
 36.2015 +	{
 36.2016 +		if (selection) unselect();
 36.2017 +		selection=lmo;
 36.2018 +		selection->select();
 36.2019 +		adjustCanvasSize();
 36.2020 +		ensureSelectionVisible();
 36.2021 +		return true;
 36.2022 +	} 
 36.2023 +	return false;
 36.2024 +}
 36.2025 +
 36.2026 +void MapEditor::select (LinkableMapObj *lmo)
 36.2027 +{
 36.2028 +	if (lmo && selection != lmo)
 36.2029 +	{
 36.2030 +		// select the MapObj
 36.2031 +		if (selection) selection->unselect();
 36.2032 +		selection=lmo;
 36.2033 +		selection->select();
 36.2034 +			
 36.2035 +		adjustCanvasSize();
 36.2036 +	}
 36.2037 +
 36.2038 +}
 36.2039 +
 36.2040  void MapEditor::selectNextBranch()
 36.2041  {
 36.2042  	// Increase number of branch
 36.2043 @@ -1583,7 +1821,7 @@
 36.2044  					b=select (s);
 36.2045  					if (b)
 36.2046  					{	
 36.2047 -						if ( ((BranchObj*)(selection))->countBranches()>0)
 36.2048 +						if ( ((BranchObj*)selection)->countBranches()>0)
 36.2049  							s+=",bo:0";
 36.2050  						else	
 36.2051  							break;
 36.2052 @@ -1662,8 +1900,8 @@
 36.2053  				{
 36.2054  					b=select (s);
 36.2055  					if (b)
 36.2056 -						if ( ((BranchObj*)(selection))->countBranches()>0)
 36.2057 -							s+=",bo:"+ QString ("%1").arg( ((BranchObj*)(selection))->countBranches()-1 );
 36.2058 +						if ( ((BranchObj*)selection)->countBranches()>0)
 36.2059 +							s+=",bo:"+ QString ("%1").arg( ((BranchObj*)selection)->countBranches()-1 );
 36.2060  						else	
 36.2061  							break;
 36.2062  					else
 36.2063 @@ -1681,7 +1919,7 @@
 36.2064  void MapEditor::selectUpperBranch()
 36.2065  {
 36.2066  	// Finish open lineEdits
 36.2067 -	if (lineedit) finishedLineEditNoSave();
 36.2068 +	if (lineedit) finishedLineEdit();
 36.2069  
 36.2070  	if (selection) 
 36.2071  	{
 36.2072 @@ -1701,7 +1939,7 @@
 36.2073  void MapEditor::selectLowerBranch()
 36.2074  {
 36.2075  	// Finish open lineEdits
 36.2076 -	if (lineedit) finishedLineEditNoSave();
 36.2077 +	if (lineedit) finishedLineEdit();
 36.2078  
 36.2079  	if (selection) 
 36.2080  	{
 36.2081 @@ -1722,7 +1960,7 @@
 36.2082  void MapEditor::selectLeftBranch()
 36.2083  {
 36.2084  	// Finish open lineEdits
 36.2085 -	if (lineedit) finishedLineEditNoSave();
 36.2086 +	if (lineedit) finishedLineEdit();
 36.2087  
 36.2088  	BranchObj* bo;
 36.2089  	BranchObj* par;
 36.2090 @@ -1730,7 +1968,7 @@
 36.2091  	{
 36.2092  		if (typeid(*selection) == typeid(MapCenterObj))
 36.2093  		{
 36.2094 -			par=  (BranchObj*) (selection);
 36.2095 +			par=  (BranchObj*) selection;
 36.2096  			bo=par->getLastSelectedBranch();
 36.2097  			if (bo)
 36.2098  			{
 36.2099 @@ -1766,7 +2004,7 @@
 36.2100  			{
 36.2101  				if (typeid(*selection) == typeid(BranchObj) )
 36.2102  				{
 36.2103 -					bo=((BranchObj*)(selection))->getLastSelectedBranch();
 36.2104 +					bo=((BranchObj*)selection)->getLastSelectedBranch();
 36.2105  					if (bo) 
 36.2106  					{
 36.2107  						selection->unselect();
 36.2108 @@ -1784,7 +2022,7 @@
 36.2109  void MapEditor::selectRightBranch()
 36.2110  {
 36.2111  	// Finish open lineEdits
 36.2112 -	if (lineedit) finishedLineEditNoSave();
 36.2113 +	if (lineedit) finishedLineEdit();
 36.2114  
 36.2115  	BranchObj* bo;
 36.2116  	BranchObj* par;
 36.2117 @@ -1793,7 +2031,7 @@
 36.2118  	{
 36.2119  		if (typeid(*selection) == typeid(MapCenterObj))
 36.2120  		{
 36.2121 -			par=  (BranchObj*) (selection);
 36.2122 +			par=  (BranchObj*) selection;
 36.2123  			bo=par->getLastSelectedBranch();
 36.2124  			if (bo)
 36.2125  			{
 36.2126 @@ -1826,7 +2064,7 @@
 36.2127  			{
 36.2128  				if (typeid(*selection) == typeid(BranchObj) )
 36.2129  				{
 36.2130 -					bo=((BranchObj*)(selection))->getLastSelectedBranch();
 36.2131 +					bo=((BranchObj*)selection)->getLastSelectedBranch();
 36.2132  					if (bo) 
 36.2133  					{
 36.2134  						selection->unselect();
 36.2135 @@ -1844,7 +2082,7 @@
 36.2136  void MapEditor::selectFirstBranch()
 36.2137  {
 36.2138  	// Finish open lineEdits
 36.2139 -	if (lineedit) finishedLineEditNoSave();
 36.2140 +	if (lineedit) finishedLineEdit();
 36.2141  
 36.2142  	BranchObj *bo1;
 36.2143  	BranchObj *bo2;
 36.2144 @@ -1852,7 +2090,7 @@
 36.2145  	if (selection) {
 36.2146  		if (typeid(*selection) == typeid(BranchObj))
 36.2147  		{
 36.2148 -			bo1=  (BranchObj*) (selection);
 36.2149 +			bo1=  (BranchObj*) selection;
 36.2150  			par=(BranchObj*)(bo1->getParObj());
 36.2151  			bo2=par->getFirstBranch();
 36.2152  			if (bo2) {
 36.2153 @@ -1869,7 +2107,7 @@
 36.2154  void MapEditor::selectLastBranch()
 36.2155  {
 36.2156  	// Finish open lineEdits
 36.2157 -	if (lineedit) finishedLineEditNoSave();
 36.2158 +	if (lineedit) finishedLineEdit();
 36.2159  
 36.2160  	BranchObj *bo1;
 36.2161  	BranchObj *bo2;
 36.2162 @@ -1877,7 +2115,7 @@
 36.2163  	if (selection) {
 36.2164  		if (typeid(*selection) == typeid(BranchObj))
 36.2165  		{
 36.2166 -			bo1=  (BranchObj*) (selection);
 36.2167 +			bo1=  (BranchObj*) selection;
 36.2168  			par=(BranchObj*)(bo1->getParObj());
 36.2169  			bo2=par->getLastBranch();
 36.2170  			if (bo2) {
 36.2171 @@ -1899,12 +2137,12 @@
 36.2172  void MapEditor::selectBackgroundColor()
 36.2173  {
 36.2174  	// Finish open lineEdits
 36.2175 -	if (lineedit) finishedLineEditNoSave();
 36.2176 +	if (lineedit) finishedLineEdit();
 36.2177  
 36.2178  	QColor col = QColorDialog::getColor( mapCanvas->backgroundColor(), this );
 36.2179  	if ( !col.isValid() ) return;
 36.2180  	setBackgroundColor( col );
 36.2181 -	setChanged();
 36.2182 +	saveState(QString("Set background color of map to %1").arg(col.name()));
 36.2183  }
 36.2184  
 36.2185  void MapEditor::setBackgroundColor(QColor c)
 36.2186 @@ -1919,7 +2157,7 @@
 36.2187  		if (typeid(*selection) == typeid(BranchObj) ||
 36.2188  			typeid(*selection) == typeid(MapCenterObj))
 36.2189  		{
 36.2190 -			BranchObj *bo=(BranchObj*)(selection);
 36.2191 +			BranchObj *bo=(BranchObj*)selection;
 36.2192  			actColor=bo->getColor(); 
 36.2193  		}    
 36.2194  	}
 36.2195 @@ -1933,10 +2171,9 @@
 36.2196  		if (typeid(*selection) == typeid(BranchObj) ||
 36.2197  			typeid(*selection) == typeid(MapCenterObj))
 36.2198  		{
 36.2199 -			setChanged();
 36.2200 -			saveState(PartOfMap,selection);
 36.2201 -			BranchObj *bo=(BranchObj*)(selection);
 36.2202 -			bo->setColor(actColor, false); // color links, color childs
 36.2203 +			BranchObj *bo=(BranchObj*)selection;
 36.2204 +			saveState(selection, QString("Set color of %1 to %2").arg(getName(bo)).arg(actColor.name()));	//TODO undoCommand
 36.2205 +			bo->setColor(actColor); // color branch
 36.2206  		}    
 36.2207  	}
 36.2208  }
 36.2209 @@ -1948,10 +2185,9 @@
 36.2210  		if (typeid(*selection) == typeid(BranchObj) ||
 36.2211  			typeid(*selection) == typeid(MapCenterObj))
 36.2212  		{
 36.2213 -			setChanged();
 36.2214 -			saveState(PartOfMap,selection);
 36.2215 -			BranchObj *bo=(BranchObj*)(selection);
 36.2216 -			bo->setColor(actColor, true); // color links, color childs
 36.2217 +			BranchObj *bo=(BranchObj*)selection;
 36.2218 +			saveState(selection, QString ("Set color of %1 and childs to %2").arg(getName(bo)).arg(actColor.name()));	//TODO undoCommand
 36.2219 +			bo->setColorChilds(actColor); // color links, color childs
 36.2220  		}    
 36.2221  	}
 36.2222  }
 36.2223 @@ -1961,9 +2197,15 @@
 36.2224  {
 36.2225  	if (selection)
 36.2226  	{
 36.2227 -		setChanged();
 36.2228 -		saveState(PartOfMap,selection);	
 36.2229 -		((BranchObj*)(selection))->toggleStandardFlag (f);
 36.2230 +		BranchObj *bo=(BranchObj*)selection;
 36.2231 +		QString s;
 36.2232 +		if (bo->isSetStandardFlag(f))
 36.2233 +			s="Unset";
 36.2234 +		else
 36.2235 +			s="Set";
 36.2236 +		saveState(selection, QString("%1 standard flag \"%2\" of %3").arg(s).arg(f).arg(getName(bo)));// TODO undoCommand	
 36.2237 +		bo->toggleStandardFlag (f,actionSettingsUseFlagGroups->isOn());
 36.2238 +		adjustCanvasSize();
 36.2239  	}	
 36.2240  }
 36.2241  
 36.2242 @@ -1995,7 +2237,7 @@
 36.2243  			{
 36.2244  				if (selection!=itFind) 
 36.2245  				{
 36.2246 -					if (selection) ((BranchObj*)(selection))->unselect();
 36.2247 +					if (selection) ((BranchObj*)selection)->unselect();
 36.2248  					selection=itFind;
 36.2249  					selection->select();
 36.2250  					adjustCanvasSize();
 36.2251 @@ -2010,7 +2252,7 @@
 36.2252  			// Searching in Heading
 36.2253  			if (searching && itFind->getHeading().contains (s,cs) ) 
 36.2254  			{
 36.2255 -				if (selection) ((BranchObj*)(selection))->unselect();
 36.2256 +				if (selection) ((BranchObj*)selection)->unselect();
 36.2257  				selection=itFind;
 36.2258  				selection->select();
 36.2259  				adjustCanvasSize();
 36.2260 @@ -2027,7 +2269,7 @@
 36.2261  	if (!searching)
 36.2262  	{
 36.2263  		adjustCanvasSize();
 36.2264 -		return (BranchObj*)(selection);
 36.2265 +		return (BranchObj*)selection;
 36.2266  	}	else
 36.2267  		return NULL;
 36.2268  }
 36.2269 @@ -2038,62 +2280,44 @@
 36.2270  	EOFind=false;
 36.2271  }
 36.2272  
 36.2273 -void MapEditor::openURL()
 36.2274 -{
 36.2275 -	if (selection )
 36.2276 -	{
 36.2277 -		if (typeid(*selection) == typeid(BranchObj) ||
 36.2278 -			typeid(*selection) == typeid(MapCenterObj))
 36.2279 -		{
 36.2280 -			QString url=((BranchObj*)(selection))->getURL();
 36.2281 -
 36.2282 -			QProcess *proc = new QProcess( this );
 36.2283 -
 36.2284 -#if !defined(Q_OS_MACX)
 36.2285 -			proc->addArgument( settings.readEntry("/vym/mainwindow/readerURL","konqueror" ));
 36.2286 -#else			
 36.2287 -			proc->addArgument( settings.readEntry("/vym/mainwindow/readerURL",
 36.2288 -				"/Applications/Safari.app/Contents/MacOS/Safari" ));
 36.2289 -#endif			
 36.2290 -
 36.2291 -			proc->addArgument( url);
 36.2292 -
 36.2293 -			if ( !proc->start() ) 
 36.2294 -				// error handling
 36.2295 -				if (mainWindow->settingsURL() ) 
 36.2296 -					openURL();
 36.2297 -		}	
 36.2298 -	}	
 36.2299 -}
 36.2300 -
 36.2301  void MapEditor::editURL()
 36.2302  {
 36.2303  	if (selection && (typeid(*selection) == typeid(BranchObj) ||
 36.2304  			typeid(*selection) == typeid(MapCenterObj)) )
 36.2305  	{		
 36.2306  		bool ok;
 36.2307 +		BranchObj *bo=(BranchObj*)selection;
 36.2308  		QString text = QInputDialog::getText(
 36.2309  				"VYM", tr("Enter URL:"), QLineEdit::Normal,
 36.2310 -				((BranchObj*)(selection))->getURL(), &ok, this );
 36.2311 +				bo->getURL(), &ok, this );
 36.2312  		if ( ok) 
 36.2313  		{
 36.2314  			// user entered something and pressed OK
 36.2315 -			((BranchObj*)(selection))->setURL (text);
 36.2316 +			saveState("setURL (\""+bo->getURL()+"\")","setURL (\""+text+"\")", QString("Set URL of %1 to %21").arg(getName(bo)).arg(text));	
 36.2317 +			bo->setURL (text);
 36.2318  			updateActions();
 36.2319 -			setChanged();
 36.2320  		}	
 36.2321  	}
 36.2322  }
 36.2323  
 36.2324 +QString MapEditor::getURL()
 36.2325 +{
 36.2326 +	if (selection && (typeid(*selection) == typeid(BranchObj) ||
 36.2327 +			typeid(*selection) == typeid(MapCenterObj)) )
 36.2328 +		return ((BranchObj*)selection)->getURL();
 36.2329 +	else
 36.2330 +		return "";
 36.2331 +}
 36.2332 +
 36.2333  void MapEditor::editHeading2URL()
 36.2334  {
 36.2335  	if (selection && (typeid(*selection) == typeid(BranchObj) ||
 36.2336  			typeid(*selection) == typeid(MapCenterObj)) )
 36.2337  	{		
 36.2338 -		BranchObj *b=(BranchObj*)(selection);
 36.2339 -		b->setURL (b->getHeading());
 36.2340 +		BranchObj *bo=(BranchObj*)selection;
 36.2341 +		saveState("setURL (\""+bo->getURL()+"\")","setURL (\""+bo->getHeading()+"\")",QString("Copy heading of %1 to URL").arg(getName(bo)));	
 36.2342 +		bo->setURL (bo->getHeading());
 36.2343  		updateActions();
 36.2344 -		setChanged();
 36.2345  	}
 36.2346  }	
 36.2347  
 36.2348 @@ -2102,10 +2326,24 @@
 36.2349  	if (selection && (typeid(*selection) == typeid(BranchObj) ||
 36.2350  			typeid(*selection) == typeid(MapCenterObj)) )
 36.2351  	{		
 36.2352 -		BranchObj *b=(BranchObj*)(selection);
 36.2353 -		b->setURL ("http://bugzilla.suse.de/show_bug.cgi?id="+b->getHeading());
 36.2354 +		BranchObj *bo=(BranchObj*)selection;
 36.2355 +		QString url= "https://bugzilla.novell.com/show_bug.cgi?id="+bo->getHeading();
 36.2356 +		saveState("setURL (\""+bo->getURL()+"\")","setURL (\""+url+"\")",QString("Use heading of %1 as link to Novell Bugzilla").arg(getName(bo)));	
 36.2357 +		bo->setURL (url);
 36.2358  		updateActions();
 36.2359 -		setChanged();
 36.2360 +	}
 36.2361 +}	
 36.2362 +
 36.2363 +void MapEditor::editFATE2URL()
 36.2364 +{
 36.2365 +	if (selection && (typeid(*selection) == typeid(BranchObj) ||
 36.2366 +			typeid(*selection) == typeid(MapCenterObj)) )
 36.2367 +	{		
 36.2368 +		BranchObj *bo=(BranchObj*)selection;
 36.2369 +		QString url= "http://keeper.suse.de:8080/webfate/match/id?value=ID"+bo->getHeading();
 36.2370 +		saveState("setURL (\""+bo->getURL()+"\")","setURL (\""+url+"\")",QString("Use heading of %1 as link to FATE").arg(getName(bo)));	
 36.2371 +		bo->setURL (url);
 36.2372 +		updateActions();
 36.2373  	}
 36.2374  }	
 36.2375  
 36.2376 @@ -2114,21 +2352,24 @@
 36.2377  	if (selection && (typeid(*selection) == typeid(BranchObj) ||
 36.2378  			typeid(*selection) == typeid(MapCenterObj)) )
 36.2379  	{		
 36.2380 -		QFileDialog *fd=new QFileDialog( this,tr("VYM - Link to another map"));
 36.2381 +		BranchObj *bo=(BranchObj*)selection;
 36.2382 +		Q3FileDialog *fd=new Q3FileDialog( this,__VYM " - " +tr("Link to another map"));
 36.2383  		fd->addFilter (QString (tr("vym map") + " (*.vym)"));
 36.2384 -		fd->setCaption(tr("VYM - Link to another map"));
 36.2385 -		if (! ((BranchObj*)(selection))->getVymLink().isEmpty() )
 36.2386 -			fd->setSelection( ((BranchObj*)(selection))->getVymLink() );
 36.2387 +		fd->setCaption(__VYM " - " +tr("Link to another map"));
 36.2388 +		if (! bo->getVymLink().isEmpty() )
 36.2389 +			fd->setSelection( bo->getVymLink() );
 36.2390  		fd->show();
 36.2391  
 36.2392  		QString fn;
 36.2393  		if ( fd->exec() == QDialog::Accepted )
 36.2394 -			((BranchObj*)(selection))->setVymLink (fd->selectedFile() );
 36.2395 -		updateActions();
 36.2396 -		mapCenter->reposition();
 36.2397 -		adjustCanvasSize();
 36.2398 -		canvas()->update();
 36.2399 -		setChanged();
 36.2400 +		{
 36.2401 +			saveState("setVymLink (\""+bo->getVymLink()+"\")","setVymLink (\""+fd->selectedFile()+"\")",QString("Set vymlink of %1 to %2").arg(getName(bo)).arg(fd->selectedFile()));	
 36.2402 +			bo->setVymLink (fd->selectedFile() );
 36.2403 +			updateActions();
 36.2404 +			mapCenter->reposition();
 36.2405 +			adjustCanvasSize();
 36.2406 +			canvas()->update();
 36.2407 +		}
 36.2408  	}
 36.2409  }
 36.2410  
 36.2411 @@ -2137,12 +2378,41 @@
 36.2412  	if (selection && (typeid(*selection) == typeid(BranchObj) ||
 36.2413  			typeid(*selection) == typeid(MapCenterObj)) )
 36.2414  	{		
 36.2415 -		((BranchObj*)(selection))->setVymLink ("" );
 36.2416 +		BranchObj *bo=(BranchObj*)selection;
 36.2417 +		saveState("setVymLink (\""+bo->getVymLink()+"\")","setVymLink (\"\")",QString("Unset vymlink of %1").arg(getName(bo)));	
 36.2418 +		bo->setVymLink ("" );
 36.2419  		updateActions();
 36.2420  		mapCenter->reposition();
 36.2421  		adjustCanvasSize();
 36.2422  		canvas()->update();
 36.2423 -		setChanged();
 36.2424 +	}
 36.2425 +}
 36.2426 +
 36.2427 +void MapEditor::toggleHideExport()
 36.2428 +{
 36.2429 +	if (selection && (typeid(*selection) == typeid(BranchObj) ||
 36.2430 +			typeid(*selection) == typeid(MapCenterObj)) ||
 36.2431 +			(typeid(*selection)==typeid(FloatImageObj))
 36.2432 +			)
 36.2433 +	{		
 36.2434 +		OrnamentedObj *oo=(OrnamentedObj*)selection;
 36.2435 +		QString s;
 36.2436 +		if (oo->hideInExport())
 36.2437 +		{
 36.2438 +			oo->setHideInExport(false);
 36.2439 +			s="Unset";
 36.2440 +		}	
 36.2441 +		else	
 36.2442 +		{
 36.2443 +			oo->setHideInExport(true);
 36.2444 +			s="Set";
 36.2445 +		}	
 36.2446 +		saveState(QString ("%1 hide export flag of %2").arg(s).arg(getName(selection)));	//TODO undoCommand
 36.2447 +		actionEditToggleHideExport->setOn (oo->hideInExport());	
 36.2448 +		updateActions();
 36.2449 +		mapCenter->reposition();
 36.2450 +		adjustCanvasSize();
 36.2451 +		canvas()->update();
 36.2452  	}
 36.2453  }
 36.2454  
 36.2455 @@ -2151,12 +2421,41 @@
 36.2456  	if (selection && (typeid(*selection) == typeid(BranchObj) ||
 36.2457  			typeid(*selection) == typeid(MapCenterObj)) )
 36.2458  	{		
 36.2459 -		return ((BranchObj*)(selection))->getVymLink();
 36.2460 +		return ((BranchObj*)selection)->getVymLink();
 36.2461  	}
 36.2462  	return "";
 36.2463  	
 36.2464  }
 36.2465  
 36.2466 +void MapEditor::removeBranchKeepChilds()
 36.2467 +{
 36.2468 +	if (selection && (typeid(*selection) == typeid(BranchObj) ))
 36.2469 +	{		
 36.2470 +		BranchObj* bo=(BranchObj*)selection;
 36.2471 +		BranchObj* par=(BranchObj*)(bo->getParObj());
 36.2472 +		QString s=QString("Remove %1 and keep its childs").arg(getName(bo));
 36.2473 +		if (bo->getDepth()==1)
 36.2474 +			saveState(s);
 36.2475 +		else	
 36.2476 +			saveState(selection->getParObj(),s);	// TODO undoCommand
 36.2477 +		QString sel=selection->getSelectString();
 36.2478 +		unselect();
 36.2479 +		par->removeBranchHere(bo);
 36.2480 +		mapCenter->reposition();
 36.2481 +		select (sel);
 36.2482 +	}	
 36.2483 +}
 36.2484 +
 36.2485 +void MapEditor::removeChilds()
 36.2486 +{
 36.2487 +	if (selection && (typeid(*selection) == typeid(BranchObj) ))
 36.2488 +	{		
 36.2489 +		saveState(selection->getParObj(), QString("Remove childs of branch %1").arg(getName(selection)));
 36.2490 +		((BranchObj*)selection)->removeChilds();
 36.2491 +		mapCenter->reposition();
 36.2492 +	}	
 36.2493 +}
 36.2494 +
 36.2495  void MapEditor::editMapInfo()
 36.2496  {
 36.2497  	ExtraInfoDialog dia;
 36.2498 @@ -2167,14 +2466,15 @@
 36.2499  	// Calc some stats
 36.2500  	QString stats;
 36.2501      int i=0;
 36.2502 -    QCanvasItemList l=canvas()->allItems();
 36.2503 -    for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) 
 36.2504 +    Q3CanvasItemList l=canvas()->allItems();
 36.2505 +    for (Q3CanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) 
 36.2506          i++;
 36.2507      stats+=QString ("%1 items on canvas\n").arg (i,6);
 36.2508  
 36.2509  	uint b=0;
 36.2510  	uint f=0;
 36.2511  	uint n=0;
 36.2512 +	uint xl=0;
 36.2513  	BranchObj *bo;
 36.2514  	bo=mapCenter->first();
 36.2515  	while (bo) 
 36.2516 @@ -2182,9 +2482,11 @@
 36.2517  		if (!bo->getNote().isEmpty() ) n++;
 36.2518  		f+= bo->countFloatImages();
 36.2519  		b++;
 36.2520 +		xl+=bo->countXLinks();
 36.2521  		bo=bo->next();
 36.2522  	}
 36.2523      stats+=QString ("%1 branches\n").arg (b-1,6);
 36.2524 +    stats+=QString ("%1 xLinks \n").arg (xl,6);
 36.2525      stats+=QString ("%1 notes\n").arg (n,6);
 36.2526      stats+=QString ("%1 images\n").arg (f,6);
 36.2527  	dia.setStats (stats);
 36.2528 @@ -2192,14 +2494,15 @@
 36.2529  	// Finally show dialog
 36.2530  	if (dia.exec() == QDialog::Accepted)
 36.2531  	{
 36.2532 +		saveState("Edit info about map");	//TODO undoCommand
 36.2533  		mapCenter->setAuthor (dia.getAuthor() );
 36.2534  		mapCenter->setComment (dia.getComment() );
 36.2535 -		setChanged();
 36.2536  	}
 36.2537  }
 36.2538  
 36.2539  void MapEditor::updateActions()
 36.2540  {
 36.2541 +	QAction *a;
 36.2542  	if (getLinkColorHint()==HeadingColor) 
 36.2543  		actionFormatLinkColorHint->setOn(true);
 36.2544  	else	
 36.2545 @@ -2226,7 +2529,7 @@
 36.2546  	QPixmap pix( 16, 16 );
 36.2547      pix.fill( mapCanvas->backgroundColor() );
 36.2548      actionFormatBackColor->setIconSet( pix );
 36.2549 -    pix.fill( deflinkcolor );
 36.2550 +    pix.fill( defLinkColor );
 36.2551      actionFormatLinkColor->setIconSet( pix );
 36.2552  
 36.2553  	actionEditUndo->setEnabled( mapChanged );
 36.2554 @@ -2237,17 +2540,54 @@
 36.2555  		if ( (typeid(*selection) == typeid(BranchObj)) || 
 36.2556  			(typeid(*selection) == typeid(MapCenterObj))  )
 36.2557  		{
 36.2558 +			BranchObj *bo=(BranchObj*)selection;
 36.2559 +			// Take care of links
 36.2560 +			if (bo->countXLinks()==0)
 36.2561 +			{
 36.2562 +				branchLinksContextMenu->clear();
 36.2563 +				branchLinksContextMenu->insertItem ("No xLink available");
 36.2564 +				branchLinksContextMenuDup->clear();
 36.2565 +				branchLinksContextMenuDup->insertItem ("No xLink available");
 36.2566 +				
 36.2567 +			} else
 36.2568 +			{
 36.2569 +				BranchObj *bot;
 36.2570 +				QString s;
 36.2571 +				branchLinksContextMenu->clear();
 36.2572 +				branchLinksContextMenuDup->clear();
 36.2573 +				for (int i=0; i<=bo->countXLinks();i++)
 36.2574 +				{
 36.2575 +					bot=bo->XLinkTargetAt(i);
 36.2576 +					if (bot)
 36.2577 +					{
 36.2578 +						s=bot->getHeading();
 36.2579 +						if (s.length()>25)
 36.2580 +							s=s.left(25)+"...";
 36.2581 +						branchLinksContextMenu->insertItem (s);
 36.2582 +						branchLinksContextMenuDup->insertItem (s);
 36.2583 +					}	
 36.2584 +				}
 36.2585 +			}
 36.2586 +
 36.2587  			standardFlagsDefault->setEnabled (true);
 36.2588  
 36.2589 -			if ( ((BranchObj*)(selection))->getURL().isEmpty() )
 36.2590 +			actionEditToggleScroll->setEnabled (true);
 36.2591 +			if ( bo->isScrolled() )
 36.2592 +				actionEditToggleScroll->setOn(true);
 36.2593 +			else	
 36.2594 +				actionEditToggleScroll->setOn(false);
 36.2595 +
 36.2596 +			if ( bo->getURL().isEmpty() )
 36.2597 +			{
 36.2598  				actionEditOpenURL->setEnabled (false);
 36.2599 +				actionEditOpenURLTab->setEnabled (false);
 36.2600 +			}	
 36.2601  			else	
 36.2602 +			{
 36.2603  				actionEditOpenURL->setEnabled (true);
 36.2604 -			actionEditURL->setEnabled (true);	
 36.2605 -			actionEditHeading2URL->setEnabled (true);	
 36.2606 -			actionEditBugzilla2URL->setEnabled (true);	
 36.2607 -
 36.2608 -			if ( ((BranchObj*)(selection))->getVymLink().isEmpty() )
 36.2609 +				actionEditOpenURLTab->setEnabled (true);
 36.2610 +			}
 36.2611 +			if ( bo->getVymLink().isEmpty() )
 36.2612  			{
 36.2613  				actionEditOpenVymLink->setEnabled (false);
 36.2614  				actionEditDeleteVymLink->setEnabled (false);
 36.2615 @@ -2256,28 +2596,29 @@
 36.2616  				actionEditOpenVymLink->setEnabled (true);
 36.2617  				actionEditDeleteVymLink->setEnabled (true);
 36.2618  			}	
 36.2619 -			actionEditVymLink->setEnabled (true);	
 36.2620 +
 36.2621 +			if (bo->canMoveBranchUp()) 
 36.2622 +				actionEditMoveUp->setEnabled (true);
 36.2623 +			else	
 36.2624 +				actionEditMoveUp->setEnabled (false);
 36.2625 +			if (bo->canMoveBranchDown()) 
 36.2626 +				actionEditMoveDown->setEnabled (true);
 36.2627 +			else	
 36.2628 +				actionEditMoveDown->setEnabled (false);
 36.2629 +
 36.2630 +
 36.2631 +			actionEditToggleHideExport->setEnabled (true);	
 36.2632 +			actionEditToggleHideExport->setOn (bo->hideInExport() );	
 36.2633  
 36.2634  			actionEditCopy->setEnabled (true);	
 36.2635  			actionEditCut->setEnabled (true);	
 36.2636 -			actionEditPaste->setEnabled (true);	
 36.2637 -			actionEditMoveUp->setEnabled (true);	
 36.2638 -			actionEditMoveDown->setEnabled (true);	
 36.2639 -			actionEditToggleScroll->setEnabled (true);	
 36.2640 -			actionEditHeading->setEnabled (true);
 36.2641 +			if (!clipboardEmpty)
 36.2642 +				actionEditPaste->setEnabled (true);	
 36.2643 +			else	
 36.2644 +				actionEditPaste->setEnabled (false);	
 36.2645 +			for (a=actionListBranches.first();a;a=actionListBranches.next())
 36.2646 +				a->setEnabled(true);
 36.2647  			actionEditDelete->setEnabled (true);
 36.2648 -			actionEditAddBranch->setEnabled (true);
 36.2649 -			actionEditAddBranchAbove->setEnabled (true);
 36.2650 -			actionEditAddBranchBelow->setEnabled (true);
 36.2651 -			actionEditImportAdd->setEnabled (true);
 36.2652 -			actionEditImportReplace->setEnabled (true);
 36.2653 -			actionEditSaveBranch->setEnabled (true);
 36.2654 -			actionEditSelectFirst->setEnabled (true);
 36.2655 -			actionEditSelectLast->setEnabled (true);
 36.2656 -			actionEditToggleFloatExport->setEnabled (false);
 36.2657 -			actionFormatPickColor->setEnabled (true);
 36.2658 -			actionFormatColorBranch->setEnabled (true);
 36.2659 -			actionFormatColorSubtree->setEnabled (true);
 36.2660  			switch (selection->getFrameType())
 36.2661  			{
 36.2662  				case NoFrame: 
 36.2663 @@ -2289,40 +2630,35 @@
 36.2664  				default:
 36.2665  					break;
 36.2666  			}	
 36.2667 +			actionFormatIncludeImagesVer->setOn
 36.2668 +				( ((BranchObj*)selection)->getIncludeImagesVer());
 36.2669 +			actionFormatIncludeImagesHor->setOn
 36.2670 +				( ((BranchObj*)selection)->getIncludeImagesHor());
 36.2671 +			actionFormatHideLinkUnselected->setOn
 36.2672 +				(selection->getHideLinkUnselected());
 36.2673  		}
 36.2674  		if ( (typeid(*selection) == typeid(FloatImageObj)) )
 36.2675  		{
 36.2676 +			FloatObj *fo=(FloatImageObj*)selection;
 36.2677  			standardFlagsDefault->setEnabled (false);
 36.2678  
 36.2679  			actionEditOpenURL->setEnabled (false);
 36.2680 -			actionEditURL->setEnabled (false);	
 36.2681 -			actionEditHeading2URL->setEnabled (false);	
 36.2682 -			actionEditBugzilla2URL->setEnabled (false);	
 36.2683  			actionEditOpenVymLink->setEnabled (false);
 36.2684 -			actionEditVymLink->setEnabled (false);	
 36.2685  			actionEditDeleteVymLink->setEnabled (false);	
 36.2686 +			actionEditToggleHideExport->setEnabled (true);	
 36.2687 +			actionEditToggleHideExport->setOn (fo->hideInExport() );	
 36.2688 +
 36.2689  
 36.2690  			actionEditCopy->setEnabled (true);
 36.2691  			actionEditCut->setEnabled (true);	
 36.2692 -			actionEditPaste->setEnabled (false);	//FIXME
 36.2693 -			actionEditMoveUp->setEnabled (false);	
 36.2694 -			actionEditMoveDown->setEnabled (false);	
 36.2695 -			actionEditToggleScroll->setEnabled (false);	
 36.2696 -			actionEditHeading->setEnabled (false);
 36.2697 +			actionEditPaste->setEnabled (false);
 36.2698 +			for (a=actionListBranches.first();a;a=actionListBranches.next())
 36.2699 +				a->setEnabled(false);
 36.2700  			actionEditDelete->setEnabled (true);
 36.2701 -			actionEditAddBranch->setEnabled (false);
 36.2702 -			actionEditAddBranchAbove->setEnabled (false);
 36.2703 -			actionEditAddBranchBelow->setEnabled (false);
 36.2704 -			actionEditImportAdd->setEnabled (false);
 36.2705 -			actionEditSaveBranch->setEnabled (false);
 36.2706 -			actionEditImportReplace->setEnabled (false);
 36.2707 -			actionEditSelectFirst->setEnabled (false);
 36.2708 -			actionEditSelectLast->setEnabled (false);
 36.2709 -			actionEditToggleFloatExport->setOn
 36.2710 -				( ((FloatImageObj*)(selection))->getFloatExport() );
 36.2711 -			actionFormatPickColor->setEnabled (false);
 36.2712 -			actionFormatColorBranch->setEnabled (false);
 36.2713 -			actionFormatColorSubtree->setEnabled (false);
 36.2714 +			actionFormatHideLinkUnselected->setOn
 36.2715 +				( selection->getHideLinkUnselected());
 36.2716 +			actionEditMoveUp->setEnabled (false);
 36.2717 +			actionEditMoveDown->setEnabled (false);
 36.2718  		}
 36.2719  
 36.2720  	} else
 36.2721 @@ -2332,36 +2668,34 @@
 36.2722  		actionEditCopy->setEnabled (false);	
 36.2723  		actionEditCut->setEnabled (false);	
 36.2724  		actionEditPaste->setEnabled (false);	
 36.2725 -		actionEditMoveUp->setEnabled (false);	
 36.2726 -		actionEditMoveDown->setEnabled (false);	
 36.2727 -		actionEditToggleScroll->setEnabled (false);	
 36.2728 +		for (a=actionListBranches.first();a;a=actionListBranches.next())
 36.2729 +			a->setEnabled(false);
 36.2730 +
 36.2731 +		actionEditToggleScroll->setEnabled (false);
 36.2732  		actionEditOpenURL->setEnabled (false);
 36.2733 -		actionEditURL->setEnabled (false);	
 36.2734  		actionEditOpenVymLink->setEnabled (false);
 36.2735 -		actionEditVymLink->setEnabled (false);	
 36.2736  		actionEditDeleteVymLink->setEnabled (false);	
 36.2737  		actionEditHeading2URL->setEnabled (false);	
 36.2738 -		actionEditBugzilla2URL->setEnabled (false);	
 36.2739 -		actionEditHeading->setEnabled (false);
 36.2740  		actionEditDelete->setEnabled (false);
 36.2741 -		actionEditAddBranch->setEnabled (false);
 36.2742 -		actionEditAddBranchAbove->setEnabled (false);
 36.2743 -		actionEditAddBranchBelow->setEnabled (false);
 36.2744 -		actionEditSaveBranch->setEnabled (false);
 36.2745 -		actionEditImportReplace->setEnabled (false);
 36.2746 -		actionEditSelectFirst->setEnabled (false);
 36.2747 -		actionEditSelectLast->setEnabled (false);
 36.2748 -		actionEditToggleFloatExport->setEnabled (false);
 36.2749 -		actionFormatPickColor->setEnabled (false);
 36.2750 -		actionFormatColorBranch->setEnabled (false);
 36.2751 -		actionFormatColorSubtree->setEnabled (false);
 36.2752 +		actionEditMoveUp->setEnabled (false);
 36.2753 +		actionEditMoveDown->setEnabled (false);
 36.2754 +		actionEditToggleHideExport->setEnabled (false);	
 36.2755  	}	
 36.2756  }
 36.2757  
 36.2758 +void MapEditor::updateNoteFlag()
 36.2759 +{
 36.2760 +	if (selection)
 36.2761 +		if ( (typeid(*selection) == typeid(BranchObj)) || 
 36.2762 +			(typeid(*selection) == typeid(MapCenterObj))  )
 36.2763 +			((BranchObj*)selection)->updateNoteFlag();
 36.2764 +}
 36.2765 +
 36.2766  void MapEditor::setLinkStyle (LinkStyle ls)
 36.2767  {
 36.2768  	linkstyle=ls;
 36.2769  
 36.2770 +	saveState("Set link style");	// TODO undoCommand
 36.2771  	BranchObj *bo;
 36.2772  	bo=mapCenter->first();
 36.2773  	bo=bo->next();
 36.2774 @@ -2370,8 +2704,7 @@
 36.2775  		bo->setLinkStyle(bo->getDefLinkStyle());
 36.2776  		bo=bo->next();
 36.2777  	}
 36.2778 -	//setChanged();
 36.2779 -	//saveState();
 36.2780 +	mapCenter->reposition();
 36.2781  }
 36.2782  
 36.2783  LinkStyle MapEditor::getLinkStyle ()
 36.2784 @@ -2381,7 +2714,7 @@
 36.2785  
 36.2786  void MapEditor::setLinkColor(QColor c)
 36.2787  {
 36.2788 -	deflinkcolor=c;
 36.2789 +	defLinkColor=c;
 36.2790  	updateActions();
 36.2791  }
 36.2792  
 36.2793 @@ -2425,29 +2758,54 @@
 36.2794  
 36.2795  QColor MapEditor::getDefLinkColor()
 36.2796  {
 36.2797 -	return deflinkcolor;
 36.2798 +	return defLinkColor;
 36.2799 +}
 36.2800 +
 36.2801 +void MapEditor::setDefXLinkColor(QColor col)
 36.2802 +{
 36.2803 +	defXLinkColor=col;
 36.2804 +}
 36.2805 +
 36.2806 +QColor MapEditor::getDefXLinkColor()
 36.2807 +{
 36.2808 +	return defXLinkColor;
 36.2809 +}
 36.2810 +
 36.2811 +void MapEditor::setDefXLinkWidth (int w)
 36.2812 +{
 36.2813 +	defXLinkWidth=w;
 36.2814 +}
 36.2815 +
 36.2816 +int MapEditor::getDefXLinkWidth()
 36.2817 +{
 36.2818 +	return defXLinkWidth;
 36.2819  }
 36.2820  
 36.2821  void MapEditor::selectLinkColor()
 36.2822  {
 36.2823  	// Finish open lineEdits
 36.2824 -	if (lineedit) finishedLineEditNoSave();
 36.2825 -
 36.2826 -	QColor col = QColorDialog::getColor( deflinkcolor, this );
 36.2827 +	if (lineedit) finishedLineEdit();
 36.2828 +
 36.2829 +	QColor col = QColorDialog::getColor( defLinkColor, this );
 36.2830  	if ( !col.isValid() ) return;
 36.2831  	setLinkColor( col );
 36.2832 -	setChanged();
 36.2833 +	saveState(QString("Set link color to %1").arg(col.name()));	//TODO undoCommand
 36.2834 +
 36.2835  }
 36.2836  
 36.2837  void MapEditor::toggleScroll()
 36.2838  {
 36.2839  	if (selection && (typeid(*selection) == typeid(BranchObj)) )
 36.2840  	{
 36.2841 -		BranchObj *bo=((BranchObj*)(selection));
 36.2842 +		BranchObj *bo=((BranchObj*)selection);
 36.2843  		if (bo->countBranches()==0) return;
 36.2844  		if (bo->getDepth()==0) return;
 36.2845 -		setChanged();
 36.2846 -		saveState(PartOfMap,selection);
 36.2847 +		QString s;
 36.2848 +		if (bo->isScrolled())
 36.2849 +			s="Unscroll";
 36.2850 +		else	
 36.2851 +			s="Scroll";
 36.2852 +		saveState(selection, QString ("%1 %2").arg(s).arg(getName(bo)));
 36.2853  		bo->toggleScroll();
 36.2854  		adjustCanvasSize();
 36.2855  		canvas()->update();
 36.2856 @@ -2471,33 +2829,42 @@
 36.2857  		(typeid(*selection) == typeid(BranchObj)) || 
 36.2858  		(typeid(*selection) == typeid(MapCenterObj))  )
 36.2859  	{
 36.2860 -		BranchObj *bo=((BranchObj*)(selection));
 36.2861 -
 36.2862 -		QFileDialog *fd=new QFileDialog( this,tr("vym - load image"));
 36.2863 +		BranchObj *bo=((BranchObj*)selection);
 36.2864 +
 36.2865 +		Q3FileDialog *fd=new Q3FileDialog( this);
 36.2866 +		fd->setMode (Q3FileDialog::ExistingFiles);
 36.2867  		fd->addFilter (QString (tr("Images") + " (*.png *.bmp *.xbm *.jpg *.png *.xpm *.gif *.pnm)"));
 36.2868  		ImagePreview *p =new ImagePreview (fd);
 36.2869  		fd->setContentsPreviewEnabled( TRUE );
 36.2870  		fd->setContentsPreview( p, p );
 36.2871 -		fd->setPreviewMode( QFileDialog::Contents );
 36.2872 -		fd->setCaption(tr("vym - Load image"));
 36.2873 +		fd->setPreviewMode( Q3FileDialog::Contents );
 36.2874 +		fd->setCaption(__VYM " - " +tr("Load image"));
 36.2875  		fd->setDir (lastImageDir);
 36.2876  		fd->show();
 36.2877  
 36.2878  		QString fn;
 36.2879  		if ( fd->exec() == QDialog::Accepted )
 36.2880  		{
 36.2881 -			setChanged();
 36.2882 -			saveState(PartOfMap,selection);
 36.2883 -			QString fn=fd->selectedFile();
 36.2884 +			saveState(selection, QString("Add floatimage to %1").arg(getName(selection)));
 36.2885  			lastImageDir=fn.left(fn.findRev ("/"));
 36.2886 -			bo->addFloatImage();
 36.2887 -			// FIXME check if load was successful
 36.2888 -			bo->getLastFloatImage()->load(fn);
 36.2889 -			bo->getLastFloatImage()->setOriginalFilename(fn);
 36.2890 +			QStringList flist = fd->selectedFiles();
 36.2891 +			QStringList::Iterator it = flist.begin();
 36.2892 +			while( it != flist.end() ) 
 36.2893 +			{
 36.2894 +				fn = *it;
 36.2895 +				bo->addFloatImage();
 36.2896 +				// TODO check if load was successful
 36.2897 +				bo->getLastFloatImage()->load(*it);
 36.2898 +				bo->getLastFloatImage()->setOriginalFilename(fn);
 36.2899 +				++it;
 36.2900 +			}
 36.2901 +
 36.2902  			mapCenter->reposition();
 36.2903  			adjustCanvasSize();
 36.2904  			canvas()->update();
 36.2905  		}
 36.2906 +		delete (p);
 36.2907 +		delete (fd);
 36.2908  	}
 36.2909  }
 36.2910  
 36.2911 @@ -2506,10 +2873,10 @@
 36.2912  	if (selection && 
 36.2913  		(typeid(*selection) == typeid(FloatImageObj)) )
 36.2914  	{
 36.2915 -		FloatImageObj *fio=((FloatImageObj*)(selection));
 36.2916 +		FloatImageObj *fio=((FloatImageObj*)selection);
 36.2917  		const char* fmt = saveImageFormatMenu->text(item);
 36.2918  
 36.2919 -		QFileDialog *fd=new QFileDialog( this, tr("vym - save image as") + fmt);
 36.2920 +		Q3FileDialog *fd=new Q3FileDialog( this, tr("vym - save image as") + fmt);
 36.2921  		fd->addFilter ("PNG (*.png)");
 36.2922  		fd->addFilter ("BMP (*.bmp)");
 36.2923  		fd->addFilter ("XBM (*.xbm)");
 36.2924 @@ -2518,8 +2885,8 @@
 36.2925  		fd->addFilter ("GIF (*.gif)");
 36.2926  		fd->addFilter ("PNM (*.pnm)");
 36.2927  		fd->addFilter (QString (tr("Images") + " (*.png *.bmp *.xbm *.jpg *.png *.xpm *.gif *.pnm)"));
 36.2928 -		fd->setCaption(tr("vym - Save image as ") + fmt);
 36.2929 -		fd->setMode( QFileDialog::AnyFile );
 36.2930 +		fd->setCaption(__VYM " - " +tr("Save image as %1").arg(fmt));
 36.2931 +		fd->setMode( Q3FileDialog::AnyFile );
 36.2932  		fd->setSelection (fio->getOriginalFilename());
 36.2933  		fd->show();
 36.2934  
 36.2935 @@ -2528,10 +2895,9 @@
 36.2936  		{
 36.2937  			if (QFile (fd->selectedFile()).exists() )
 36.2938  			{
 36.2939 -				QMessageBox mb( "VYM",
 36.2940 -					tr("The file ") + fd->selectedFile() + 
 36.2941 -					tr(" exists already. "
 36.2942 -					"Do you want to overwrite it?"),
 36.2943 +				QMessageBox mb( __VYM,
 36.2944 +					tr("The file %1 exists already.\n"
 36.2945 +					"Do you want to overwrite it?").arg(fd->selectedFile()),
 36.2946  				QMessageBox::Warning,
 36.2947  				QMessageBox::Yes | QMessageBox::Default,
 36.2948  				QMessageBox::Cancel | QMessageBox::Escape,
 36.2949 @@ -2555,17 +2921,6 @@
 36.2950  	}
 36.2951  }
 36.2952  
 36.2953 -void MapEditor::toggleFloatExport()
 36.2954 -{
 36.2955 -	if (selection && 
 36.2956 -		(typeid(*selection) == typeid(FloatImageObj))|| 
 36.2957 -		(typeid(*selection) == typeid(FloatObj)) )
 36.2958 -	{
 36.2959 -		FloatImageObj *fio=((FloatImageObj*)(selection));
 36.2960 -		fio->setFloatExport (actionEditToggleFloatExport->isOn() );
 36.2961 -	}
 36.2962 -}
 36.2963 -
 36.2964  void MapEditor::setFrame(const FrameType &t)
 36.2965  {
 36.2966  	if (selection && 
 36.2967 @@ -2578,6 +2933,33 @@
 36.2968  	}
 36.2969  }
 36.2970  
 36.2971 +void MapEditor::setIncludeImagesVer(bool b)
 36.2972 +{
 36.2973 +	if (selection && 
 36.2974 +		(typeid(*selection) == typeid(BranchObj)) || 
 36.2975 +		(typeid(*selection) == typeid(MapCenterObj))  )
 36.2976 +		((BranchObj*)selection)->setIncludeImagesVer(b);
 36.2977 +		mapCenter->reposition();
 36.2978 +}
 36.2979 +
 36.2980 +void MapEditor::setIncludeImagesHor(bool b)
 36.2981 +{
 36.2982 +	if (selection && 
 36.2983 +		(typeid(*selection) == typeid(BranchObj)) || 
 36.2984 +		(typeid(*selection) == typeid(MapCenterObj))  )
 36.2985 +		((BranchObj*)selection)->setIncludeImagesHor(b);
 36.2986 +		mapCenter->reposition();
 36.2987 +}
 36.2988 +
 36.2989 +void MapEditor::setHideLinkUnselected (bool b)
 36.2990 +{
 36.2991 +	if (selection && 
 36.2992 +		(typeid(*selection) == typeid(BranchObj)) || 
 36.2993 +		(typeid(*selection) == typeid(MapCenterObj))  ||
 36.2994 +		(typeid(*selection) == typeid(FloatImageObj)) )
 36.2995 +		selection->setHideLinkUnselected(b);
 36.2996 +}
 36.2997 +
 36.2998  void MapEditor::importDir(BranchObj *dst, QDir d)
 36.2999  {
 36.3000  	if (selection && 
 36.3001 @@ -2588,41 +2970,42 @@
 36.3002  		
 36.3003  		// Traverse directories
 36.3004  		d.setFilter( QDir::Dirs| QDir::Hidden | QDir::NoSymLinks );
 36.3005 -		const QFileInfoList *dirlist = d.entryInfoList();
 36.3006 -		QFileInfoListIterator itdir( *dirlist );
 36.3007 -		QFileInfo *fi;
 36.3008 -
 36.3009 -		while ( (fi = itdir.current()) != 0 ) 
 36.3010 +		QFileInfoList list = d.entryInfoList();
 36.3011 +		QFileInfo fi;
 36.3012 +
 36.3013 +		for (int i = 0; i < list.size(); ++i) 
 36.3014  		{
 36.3015 -			if (fi->fileName() != "." && fi->fileName() != ".." )
 36.3016 +			fi=list.at(i);
 36.3017 +			if (fi.fileName() != "." && fi.fileName() != ".." )
 36.3018  			{
 36.3019  				dst->addBranch();
 36.3020  				bo=dst->getLastBranch();
 36.3021 -				bo->setHeading (fi->fileName() );
 36.3022 -				bo->setColor (QColor("blue"),false);
 36.3023 +				bo->setHeading (fi.fileName() );
 36.3024 +				bo->setColor (QColor("blue"));
 36.3025  				bo->toggleScroll();
 36.3026 -				if ( !d.cd(fi->fileName()) ) 
 36.3027 -					QMessageBox::critical (0,tr("Critical Import Error"),tr("Cannot find the directory"));
 36.3028 +				if ( !d.cd(fi.fileName()) ) 
 36.3029 +					QMessageBox::critical (0,tr("Critical Import Error"),tr("Cannot find the directory %1").arg(fi.fileName()));
 36.3030  				else 
 36.3031  				{
 36.3032 +					// Recursively add subdirs
 36.3033  					importDir (bo,d);
 36.3034  					d.cdUp();
 36.3035  				}
 36.3036  			}	
 36.3037 -			++itdir;
 36.3038  		}		
 36.3039  		// Traverse files
 36.3040  		d.setFilter( QDir::Files| QDir::Hidden | QDir::NoSymLinks );
 36.3041 -		const QFileInfoList *filelist = d.entryInfoList();
 36.3042 -		QFileInfoListIterator itfile( *filelist );
 36.3043 -
 36.3044 -		while ( (fi = itfile.current()) != 0 ) 
 36.3045 +		list = d.entryInfoList();
 36.3046 +
 36.3047 +		for (int i = 0; i < list.size(); ++i) 
 36.3048  		{
 36.3049 +			fi=list.at(i);
 36.3050  			dst->addBranch();
 36.3051  			bo=dst->getLastBranch();
 36.3052 -			bo->setHeading (fi->fileName() );
 36.3053 -			bo->setColor (QColor("black"),false);
 36.3054 -			++itfile;
 36.3055 +			bo->setHeading (fi.fileName() );
 36.3056 +			bo->setColor (QColor("black"));
 36.3057 +			if (fi.fileName().right(4) == ".vym" )
 36.3058 +				bo->setVymLink (fi.filePath());
 36.3059  		}	
 36.3060  	}		
 36.3061  }
 36.3062 @@ -2633,16 +3016,16 @@
 36.3063  		(typeid(*selection) == typeid(BranchObj)) || 
 36.3064  		(typeid(*selection) == typeid(MapCenterObj))  )
 36.3065  	{
 36.3066 -		QFileDialog *fd=new QFileDialog( this,tr("VYM - Choose directory structur to import"));
 36.3067 -		fd->setMode (QFileDialog::DirectoryOnly);
 36.3068 +		Q3FileDialog *fd=new Q3FileDialog( this,__VYM " - " +tr("Choose directory structure to import"));
 36.3069 +		fd->setMode (Q3FileDialog::DirectoryOnly);
 36.3070  		fd->addFilter (QString (tr("vym map") + " (*.vym)"));
 36.3071 -		fd->setCaption(tr("VYM - Choose directory structur to import"));
 36.3072 +		fd->setCaption(__VYM " - " +tr("Choose directory structure to import"));
 36.3073  		fd->show();
 36.3074  
 36.3075  		QString fn;
 36.3076  		if ( fd->exec() == QDialog::Accepted )
 36.3077  		{
 36.3078 -			BranchObj *bo=((BranchObj*)(selection));
 36.3079 +			BranchObj *bo=((BranchObj*)selection);
 36.3080  			importDir (bo,QDir(fd->selectedFile()) );
 36.3081  			mapCenter->reposition();
 36.3082  			adjustCanvasSize();
 36.3083 @@ -2651,20 +3034,119 @@
 36.3084  	}	
 36.3085  }
 36.3086  
 36.3087 +void MapEditor::followXLink(int i)
 36.3088 +{
 36.3089 +	if (selection && 
 36.3090 +		(typeid(*selection) == typeid(BranchObj)) || 
 36.3091 +		(typeid(*selection) == typeid(MapCenterObj))  )
 36.3092 +	{
 36.3093 +		BranchObj *bo=((BranchObj*)selection)->XLinkTargetAt(i);
 36.3094 +		if (bo) 
 36.3095 +		{
 36.3096 +			selection->unselect();
 36.3097 +			selection=bo;
 36.3098 +			selection->select();
 36.3099 +			ensureSelectionVisible();
 36.3100 +		}
 36.3101 +	}
 36.3102 +}
 36.3103 +
 36.3104 +void MapEditor::editXLink(int i)
 36.3105 +{
 36.3106 +	if (selection && 
 36.3107 +		(typeid(*selection) == typeid(BranchObj)) || 
 36.3108 +		(typeid(*selection) == typeid(MapCenterObj))  )
 36.3109 +	{
 36.3110 +		XLinkObj *xlo=((BranchObj*)selection)->XLinkAt(i);
 36.3111 +		if (xlo) 
 36.3112 +		{
 36.3113 +			EditXLinkDialog dia;
 36.3114 +			dia.setXLink (xlo);
 36.3115 +			dia.setSelection(selection);
 36.3116 +			if (dia.exec() == QDialog::Accepted)
 36.3117 +			{
 36.3118 +				if (dia.useSettingsGlobal() )
 36.3119 +				{
 36.3120 +					setDefXLinkColor (xlo->getColor() );
 36.3121 +					setDefXLinkWidth (xlo->getWidth() );
 36.3122 +				}
 36.3123 +				if (dia.deleteXLink())
 36.3124 +					((BranchObj*)selection)->deleteXLinkAt(i);
 36.3125 +				saveState("Edit xLink");	//TODO undoCommand
 36.3126 +			}
 36.3127 +		}	
 36.3128 +	}
 36.3129 +}
 36.3130 +
 36.3131  void MapEditor::testFunction()
 36.3132  {
 36.3133  	cout << "MapEditor::testFunction() called\n";
 36.3134 +
 36.3135 +	mapCenter->positionBBox();
 36.3136 +	return;
 36.3137 +
 36.3138 +	WarningDialog dia;
 36.3139 +	dia.setCancelButton (true);
 36.3140 +	dia.setText("This is a longer \nWarning");
 36.3141 +	dia.setCaption("Warning: Flux problem");
 36.3142 +	dia.setShowAgainName("/vym/warnings/mapeditor");
 36.3143 +	if (dia.exec()==QDialog::Accepted)
 36.3144 +		cout << "accepted!\n";
 36.3145 +	else	
 36.3146 +		cout << "canceled!\n";
 36.3147 +	return;
 36.3148 +
 36.3149 +	QString ub=vymBaseDir.path()+"/scripts/update-bookmarks";
 36.3150 +	Q3Process *proc = new Q3Process( this );
 36.3151 +	proc->addArgument(ub);
 36.3152 +
 36.3153 +	if ( !proc->start() ) 
 36.3154 +	{
 36.3155 +		QMessageBox::warning(0, 
 36.3156 +			tr("Warning"),
 36.3157 +			tr("Couldn't find script %1\nto notifiy Browsers of changed bookmarks.").arg(ub));
 36.3158 +	}	
 36.3159 +
 36.3160 +	
 36.3161 +/*
 36.3162 +	if (hidemode==HideNone)
 36.3163 +	{
 36.3164 +		setHideTmpMode (HideExport);
 36.3165 +		mapCenter->calcBBoxSizeWithChilds();
 36.3166 +		QRect totalBBox=mapCenter->getTotalBBox();
 36.3167 +		QRect mapRect=totalBBox;
 36.3168 +		QCanvasRectangle *frame=NULL;
 36.3169 +
 36.3170 +		cout << "  map has =("<<totalBBox.x()<<","<<totalBBox.y()<<","<<totalBBox.width()<<","<<totalBBox.height()<<")\n";
 36.3171 +	
 36.3172 +		mapRect.setRect (totalBBox.x(), totalBBox.y(), 
 36.3173 +			totalBBox.width(), totalBBox.height());
 36.3174 +		frame=new QCanvasRectangle (mapRect,mapCanvas);
 36.3175 +		frame->setBrush (QColor(white));
 36.3176 +		frame->setPen (QColor(black));
 36.3177 +		frame->setZ(0);
 36.3178 +		frame->show();    
 36.3179 +	}	
 36.3180 +	else	
 36.3181 +	{
 36.3182 +		setHideTmpMode (HideNone);
 36.3183 +	}	
 36.3184 +	cout <<"  hidemode="<<hidemode<<endl;
 36.3185 +	*/
 36.3186  }
 36.3187  
 36.3188  void MapEditor::ensureSelectionVisible()
 36.3189  {
 36.3190 -	LinkableMapObj* lmo= dynamic_cast <LinkableMapObj*> (selection);
 36.3191 -	QPoint p;
 36.3192 -	if (selection->getOrientation() == OrientLeftOfCenter)
 36.3193 -		p= worldMatrix().map(QPoint (lmo->x(),lmo->y()));
 36.3194 -	else	
 36.3195 -		p= worldMatrix().map(QPoint (lmo->x()+lmo->width(),lmo->y()+lmo->height()));
 36.3196 -	ensureVisible (p.x(), p.y() );
 36.3197 +	if (selection)
 36.3198 +	{
 36.3199 +		LinkableMapObj* lmo= dynamic_cast <LinkableMapObj*> (selection);
 36.3200 +		QPoint p;
 36.3201 +		if (selection->getOrientation() == OrientLeftOfCenter)
 36.3202 +			p= worldMatrix().map(QPoint (lmo->x(),lmo->y()));
 36.3203 +		else	
 36.3204 +			p= worldMatrix().map(QPoint (lmo->x()+lmo->width(),lmo->y()+lmo->height()));
 36.3205 +		ensureVisible (p.x(), p.y() );
 36.3206 +	}
 36.3207  
 36.3208  }
 36.3209  
 36.3210 @@ -2719,78 +3201,129 @@
 36.3211  		updateActions();
 36.3212  		canvasContextMenu->popup(e->globalPos() );
 36.3213      } 
 36.3214 +	e->accept();
 36.3215  }
 36.3216  
 36.3217  void MapEditor::contentsMousePressEvent(QMouseEvent* e)
 36.3218  {
 36.3219 +	// Ignore right clicks, these will go to context menus
 36.3220 +	if (e->button() == Qt::RightButton )
 36.3221 +	{
 36.3222 +		e->ignore();
 36.3223 +		return;
 36.3224 +	}
 36.3225 +
 36.3226  	// Finish open lineEdits
 36.3227 -	if (lineedit) finishedLineEditNoSave();
 36.3228 +	if (lineedit) finishedLineEdit();
 36.3229  	
 36.3230      QPoint p = inverseWorldMatrix().map(e->pos());
 36.3231      LinkableMapObj* lmo=mapCenter->findMapObj(p, NULL);
 36.3232  	
 36.3233 -	// Special case: CTRL is pressed, don't select anything
 36.3234 -	if (e->state() & QMouseEvent::ControlButton)
 36.3235 +	e->accept();
 36.3236 +
 36.3237 +	//Take care of clickdesystem flags _or_ modifier modes
 36.3238 +	//
 36.3239 +	if (lmo && (typeid(*lmo)==typeid(BranchObj) ||
 36.3240 +		typeid(*lmo)==typeid(MapCenterObj) ))
 36.3241  	{
 36.3242 -		pickingColor=true;
 36.3243 -		setCursor (pickColorCursor);
 36.3244 -		return;
 36.3245 +		QString foname=((BranchObj*)lmo)->getSystemFlagName(p);
 36.3246 +		if (!foname.isEmpty())
 36.3247 +		{
 36.3248 +			// systemFlag clicked
 36.3249 +			select (lmo);
 36.3250 +			if (foname=="url") 
 36.3251 +			{
 36.3252 +				if (e->state() & Qt::ControlModifier)
 36.3253 +					mainWindow->editOpenURLTab();
 36.3254 +				else	
 36.3255 +					mainWindow->editOpenURL();
 36.3256 +			}	
 36.3257 +			else if (foname=="vymLink")
 36.3258 +			{
 36.3259 +				mainWindow->editOpenVymLink();
 36.3260 +				// tabWidget may change, better return now
 36.3261 +				// before segfaulting...
 36.3262 +			} else if (foname=="note")
 36.3263 +				mainWindow->windowToggleNoteEditor();
 36.3264 +			else if (foname=="hideInExport")		
 36.3265 +				toggleHideExport();
 36.3266 +			return;	
 36.3267 +		} 
 36.3268 +	} 
 36.3269 +	// No system flag clicked, take care of modmodes
 36.3270 +
 36.3271 +	// Special case: CTRL is pressed
 36.3272 +	if (e->state() & Qt::ControlModifier)
 36.3273 +	{
 36.3274 +		if (actionModModeColor->isOn())
 36.3275 +		{
 36.3276 +				pickingColor=true;
 36.3277 +				setCursor (pickColorCursor);
 36.3278 +				return;
 36.3279 +		} 
 36.3280 +		if (actionModModeLink->isOn())
 36.3281 +		{	
 36.3282 +			BranchObj *bo_begin=NULL;
 36.3283 +			if (lmo)
 36.3284 +				bo_begin=(BranchObj*)(lmo);
 36.3285 +			else	
 36.3286 +				if (selection && 
 36.3287 +					((typeid(*selection) == typeid(BranchObj)) || 
 36.3288 +					(typeid(*selection) == typeid(MapCenterObj)))  )
 36.3289 +				bo_begin=(BranchObj*)selection;
 36.3290 +			if (bo_begin)	
 36.3291 +			{
 36.3292 +				drawingLink=true;
 36.3293 +				linkingObj_src=bo_begin;
 36.3294 +				tmpXLink=new XLinkObj (mapCanvas);
 36.3295 +				tmpXLink->setBegin (bo_begin);
 36.3296 +				tmpXLink->setEnd   (p);
 36.3297 +				tmpXLink->setColor(defXLinkColor);
 36.3298 +				tmpXLink->setWidth(defXLinkWidth);
 36.3299 +				tmpXLink->updateXLink();
 36.3300 +				tmpXLink->setVisibility (true);
 36.3301 +				return;
 36.3302 +			} 
 36.3303 +		}
 36.3304  	}
 36.3305 -
 36.3306      if (lmo) 
 36.3307 -	{	// MapObj was found
 36.3308 -		if (selection != lmo)
 36.3309 +	{	
 36.3310 +		select (lmo);
 36.3311 +		// Left Button	    Move Branches
 36.3312 +		if (e->button() == Qt::LeftButton )
 36.3313  		{
 36.3314 -			// select the MapObj
 36.3315 -			if (selection) selection->unselect();
 36.3316 -			selection=lmo;
 36.3317 -			selection->select();
 36.3318 -				
 36.3319 -			adjustCanvasSize();
 36.3320 -		}
 36.3321 -
 36.3322 -		// Check, if systemFlag clicked
 36.3323 -		if (typeid(*selection)==typeid(BranchObj) ||
 36.3324 -			typeid(*selection)==typeid(MapCenterObj) )
 36.3325 -		{
 36.3326 -			QString foname=((BranchObj*)(selection))->getSystemFlagName(p);
 36.3327 -			if (!foname.isEmpty())
 36.3328 -			{
 36.3329 -				// Do not move, if systemFlag clicked
 36.3330 -				if (foname=="url") 
 36.3331 -					openURL();
 36.3332 -				else
 36.3333 -					if (foname=="vymLink")
 36.3334 -					{
 36.3335 -						mainWindow->editOpenVymLink();
 36.3336 -						// tabWidget may change, better return now
 36.3337 -						// before segfaulting...
 36.3338 -						return;
 36.3339 -					} else
 36.3340 -						if (foname=="note")
 36.3341 -							mainWindow->windowToggleNoteEditor();
 36.3342 -			}			
 36.3343 -		}	
 36.3344 -			
 36.3345 -		// Left Button	    Move Branches
 36.3346 -		if (e->button() == QMouseEvent::LeftButton )
 36.3347 -		{
 36.3348 -			movingObj=selection;	
 36.3349  			movingObj_start.setX( p.x() - selection->x() );	
 36.3350  			movingObj_start.setY( p.y() - selection->y() );	
 36.3351 +			movingObj_orgPos.setX (lmo->x() );
 36.3352 +			movingObj_orgPos.setY (lmo->y() );
 36.3353 +
 36.3354 +			// If modMode==copy, then we want to "move" the _new_ object around
 36.3355 +			// then we need the offset from p to the _old_ selection, because of tmp
 36.3356 +			if (actionModModeCopy->isOn() &&
 36.3357 +				e->state() & Qt::ControlModifier)
 36.3358 +			{
 36.3359 +				if (typeid(*selection)==typeid(BranchObj) )
 36.3360 +				{
 36.3361 +					copyingObj=true;
 36.3362 +					mapCenter->addBranch ((BranchObj*)selection);
 36.3363 +					unselect();
 36.3364 +					selection=mapCenter->getLastBranch();
 36.3365 +					selection->select();
 36.3366 +					mapCenter->reposition();
 36.3367 +				}
 36.3368 +			}	
 36.3369 +			movingObj=selection;	
 36.3370  		} else
 36.3371  			// Middle Button    Toggle Scroll
 36.3372  			// (On Mac OS X this won't work, but we still have 
 36.3373  			// a button in the toolbar)
 36.3374 -			if (e->button() == QMouseEvent::MidButton )
 36.3375 -			{
 36.3376 +			if (e->button() == Qt::MidButton )
 36.3377  				toggleScroll();
 36.3378 -			} 
 36.3379  		updateActions();
 36.3380  	} else 
 36.3381  	{ // No MapObj found, we are on the Canvas itself
 36.3382  		// Left Button	    move Pos of CanvasView
 36.3383 -		if (e->button() == QMouseEvent::LeftButton )
 36.3384 +		if (e->button() == Qt::LeftButton )
 36.3385  		{
 36.3386  			movingObj=NULL;	// move Content not Obj
 36.3387  			movingObj_start=e->globalPos();
 36.3388 @@ -2803,14 +3336,19 @@
 36.3389  
 36.3390  void MapEditor::contentsMouseMoveEvent(QMouseEvent* e)
 36.3391  {
 36.3392 +	QPoint p = inverseWorldMatrix().map(e->pos());
 36.3393 +
 36.3394      // Move the selected MapObj
 36.3395      if ( selection && movingObj) 
 36.3396      {	
 36.3397 -		QPoint p = inverseWorldMatrix().map(e->pos());
 36.3398 +		// To avoid jumping of the CanvasView, only 
 36.3399 +		// ensureSelectionVisible, if not tmp linked
 36.3400 +		if (!selection->hasParObjTmp())
 36.3401 +			ensureSelectionVisible ();
 36.3402  		
 36.3403 -		// Now move the selection, but add relative position (movingObj_start) 
 36.3404 -		// where selection 
 36.3405 -		// was chosen with mousepointer. (This avoids flickering resp. jumping 
 36.3406 +		// Now move the selection, but add relative position 
 36.3407 +		// (movingObj_start) where selection was chosen with 
 36.3408 +		// mousepointer. (This avoids flickering resp. jumping 
 36.3409  		// of selection back to absPos)
 36.3410  		
 36.3411  		LinkableMapObj *lmosel;
 36.3412 @@ -2822,21 +3360,17 @@
 36.3413  
 36.3414  		if (typeid(*selection) == typeid(FloatImageObj))
 36.3415  		{
 36.3416 -			setChanged();
 36.3417 -			saveState();
 36.3418 -			FloatObj *fo=(FloatObj*)(selection);
 36.3419 -			if (fo->getLinkStyle()==StyleUndef) 
 36.3420 -			{
 36.3421 -				fo->setLinkStyle(fo->getDefLinkStyle());
 36.3422 -				fo->setLinkColor(fo->getParObj()->getLinkColor());
 36.3423 -			}	
 36.3424 +			FloatObj *fo=(FloatObj*)selection;
 36.3425 +			saveState(
 36.3426 +				"move "+qpointToString(movingObj_orgPos),fo->getSelectString() ,
 36.3427 +				QString("Move %1").arg(getName(selection)));
 36.3428  			fo->move   (p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );		
 36.3429  			fo->setRelPos();
 36.3430  			fo->reposition();
 36.3431  
 36.3432  			// Relink float to new mapcenter or branch, if shift is pressed	
 36.3433  			// Only relink, if selection really has a new parent
 36.3434 -			if ( (e->state() & QMouseEvent::ShiftButton) && lmo &&
 36.3435 +			if ( (e->state() & Qt::ShiftModifier) && lmo &&
 36.3436  				( (typeid(*lmo)==typeid(BranchObj)) ||
 36.3437  				  (typeid(*lmo)==typeid(MapCenterObj)) ) &&
 36.3438  				( lmo != fo->getParObj())  
 36.3439 @@ -2844,6 +3378,7 @@
 36.3440  			{
 36.3441  				if (typeid(*fo) == typeid(FloatImageObj)) 
 36.3442  				{
 36.3443 +					saveState(QString("Relink %1 to %2").arg(getName(fo)).arg(getName(lmo) ) );
 36.3444  					FloatImageObj *fio=(FloatImageObj*)(fo);
 36.3445  					((BranchObj*)(lmo))->addFloatImage (fio);
 36.3446  					fio->unselect();
 36.3447 @@ -2854,18 +3389,13 @@
 36.3448  					selection=(LinkableMapObj*)(fio);
 36.3449  					selection->select();
 36.3450  					movingObj=(MapObj*)(fio);
 36.3451 -					// setLinkStyle calls updateLink, only set it once
 36.3452 -					if (fio->getLinkStyle()!=fio->getDefLinkStyle() ) 
 36.3453 -						fio->setLinkStyle (fio->getDefLinkStyle());
 36.3454 -
 36.3455  				}	
 36.3456 -				// TODO if (typeid(*selection) == typeid(FloatTextObj))
 36.3457  			}
 36.3458  		} else	// selection != a FloatObj
 36.3459  		{
 36.3460  			if (lmosel->getDepth()==0)
 36.3461  			{
 36.3462 -				if (e->state() == (LeftButton | !ShiftButton)) 
 36.3463 +				if (e->state() == Qt::LeftButton && e->modifiers()==Qt::ShiftModifier) 
 36.3464  					// If mapCenter is moved, move all the rest by default, too.
 36.3465  					mapCenter->moveAll(p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );		
 36.3466  				else	
 36.3467 @@ -2875,8 +3405,6 @@
 36.3468  				if (lmosel->getDepth()==1)
 36.3469  				{
 36.3470  					// depth==1, mainbranch
 36.3471 -					setChanged();
 36.3472 -					saveState(PartOfMap,lmosel);
 36.3473  					lmosel->move(p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );		
 36.3474  				} else
 36.3475  				{
 36.3476 @@ -2884,36 +3412,31 @@
 36.3477  					if (lmosel->getOrientation() == OrientLeftOfCenter)
 36.3478  						// Add width of bbox here, otherwise alignRelTo will cause jumping around
 36.3479  						lmosel->move(p.x() -movingObj_start.x()+lmosel->getBBox().width(), 
 36.3480 -							p.y()-movingObj_start.y() );		
 36.3481 +							p.y()-movingObj_start.y() +lmosel->getTopPad() );		
 36.3482  					else	
 36.3483 -						lmosel->move(p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );
 36.3484 +						lmosel->move(p.x() -movingObj_start.x(), p.y()-movingObj_start.y() -lmosel->getTopPad());
 36.3485  				} 
 36.3486  				// reposition subbranch
 36.3487  				lmosel->reposition();	
 36.3488 -				ensureSelectionVisible();
 36.3489 +				//ensureSelectionVisible();
 36.3490  
 36.3491  				if (lmo && (lmo!=selection) &&  
 36.3492  					(typeid(*lmo) == typeid(BranchObj) ||
 36.3493  					(typeid(*lmo) == typeid(MapCenterObj) )
 36.3494  					) )
 36.3495  				{
 36.3496 -					if (e->state() & QMouseEvent::ControlButton)
 36.3497 +					if (e->state() & Qt::ControlModifier)
 36.3498  					{
 36.3499  						// Special case: CTRL to link below lmo
 36.3500  						lmosel->setParObjTmp (lmo,p,+1);
 36.3501  					}
 36.3502 -					else if (e->state() & QMouseEvent::ShiftButton)
 36.3503 +					else if (e->state() & Qt::ShiftModifier)
 36.3504  						lmosel->setParObjTmp (lmo,p,-1);
 36.3505  					else
 36.3506  						lmosel->setParObjTmp (lmo,p,0);
 36.3507  				} else	
 36.3508  				{
 36.3509 -					if (lmo &&(lmo==selection))   
 36.3510 -						// Could link to myself (happens sometimes...)
 36.3511 -						lmosel->unsetParObjTmp();
 36.3512 -					if (!lmo)  
 36.3513 -						// no Obj under selection, go back to original Parent
 36.3514 -						lmosel->unsetParObjTmp();
 36.3515 +					lmosel->unsetParObjTmp();
 36.3516  				}		
 36.3517  			} // depth>0
 36.3518  
 36.3519 @@ -2923,8 +3446,15 @@
 36.3520  		return;
 36.3521  	} // selection && moving_obj
 36.3522  		
 36.3523 +	// Draw a link from one branch to another
 36.3524 +	if (drawingLink)
 36.3525 +	{
 36.3526 +		 tmpXLink->setEnd (p);
 36.3527 +		 tmpXLink->updateXLink();
 36.3528 +	}	 
 36.3529 +	
 36.3530      // Move CanvasView 
 36.3531 -    if (!movingObj && !pickingColor) 
 36.3532 +    if (!movingObj && !pickingColor &&!drawingLink) 
 36.3533  	{
 36.3534  		QPoint p=e->globalPos();
 36.3535  		movingVec.setX(-p.x() + movingObj_start.x() );
 36.3536 @@ -2944,37 +3474,62 @@
 36.3537  	if (pickingColor)
 36.3538  	{
 36.3539  		pickingColor=false;
 36.3540 -		setCursor (ArrowCursor);
 36.3541 +		setCursor (Qt::ArrowCursor);
 36.3542  		// Check if we are over another branch
 36.3543  		dst=mapCenter->findMapObj(inverseWorldMatrix().map(e->pos() ), NULL);
 36.3544  		if (dst && selection) 
 36.3545  		{	
 36.3546 -			if (e->state() & QMouseEvent::ShiftButton)
 36.3547 +			if (e->state() & Qt::ShiftModifier)
 36.3548  			{
 36.3549 -				((BranchObj*)(selection))->setColor (((BranchObj*)(dst))->getColor(),false);
 36.3550 -				((BranchObj*)(selection))->setLinkColor ();
 36.3551 +				((BranchObj*)selection)->setColor (((BranchObj*)(dst))->getColor());
 36.3552 +				((BranchObj*)selection)->setLinkColor ();
 36.3553  			}	
 36.3554  			else	
 36.3555  			{
 36.3556 -				((BranchObj*)(selection))->setColor (((BranchObj*)(dst))->getColor(),true);
 36.3557 -				((BranchObj*)(selection))->setLinkColor ();
 36.3558 +				((BranchObj*)selection)->setColorChilds (((BranchObj*)(dst))->getColor());
 36.3559 +				((BranchObj*)selection)->setLinkColor ();
 36.3560  			}	
 36.3561  		} 
 36.3562  		return;
 36.3563  	}
 36.3564 +
 36.3565 +	// Have we been drawing a link?
 36.3566 +	if (drawingLink)
 36.3567 +	{
 36.3568 +		drawingLink=false;
 36.3569 +		// Check if we are over another branch
 36.3570 +		dst=mapCenter->findMapObj(inverseWorldMatrix().map(e->pos() ), NULL);
 36.3571 +		if (dst && selection) 
 36.3572 +		{	
 36.3573 +			tmpXLink->setEnd ( ((BranchObj*)(dst)) );
 36.3574 +			tmpXLink->updateXLink();
 36.3575 +			tmpXLink->activate();
 36.3576 +			saveState(QString("Activate xLink from %1 to %2").arg(getName(tmpXLink->getBegin())).arg(getName(tmpXLink->getEnd())) );	//TODO undoCommand
 36.3577 +		} else
 36.3578 +		{
 36.3579 +			delete(tmpXLink);
 36.3580 +			tmpXLink=NULL;
 36.3581 +		}
 36.3582 +		return;
 36.3583 +	}
 36.3584 +	
 36.3585      // Have we been moving something?
 36.3586      if ( selection && movingObj ) 
 36.3587      {	
 36.3588 +		// Moved FloatObj? Maybe we need to reposition
 36.3589 +		if(typeid(*selection)==typeid (FloatImageObj))
 36.3590 +		{
 36.3591 +			selection->getParObj()->requestReposition();
 36.3592 +			mapCenter->reposition();
 36.3593 +		}	
 36.3594 +
 36.3595  		// Check if we are over another branch, but ignore 
 36.3596  		// any found LMOs, which are FloatObjs
 36.3597  		dst=mapCenter->findMapObj(inverseWorldMatrix().map(e->pos() ), 
 36.3598 -			((LinkableMapObj*)(selection)) );
 36.3599 -
 36.3600 -		if (dst &&
 36.3601 -		(typeid(*dst)!=typeid(BranchObj)&&typeid(*dst)!=typeid(MapCenterObj))) 
 36.3602 -		{
 36.3603 +			((LinkableMapObj*)selection) );
 36.3604 +
 36.3605 +		if (dst && (typeid(*dst)!=typeid(BranchObj) && typeid(*dst)!=typeid(MapCenterObj))) 
 36.3606  			dst=NULL;
 36.3607 -		}	
 36.3608  		
 36.3609  		// Now check, if we have been moving a branch 
 36.3610  		if (typeid(*selection) == typeid(BranchObj)  )
 36.3611 @@ -2983,40 +3538,43 @@
 36.3612  			QPoint savePos=QPoint (selection->x(),selection->y() );
 36.3613  
 36.3614  			// Reset the temporary drawn link to the original one
 36.3615 -			((LinkableMapObj*)(selection))->unsetParObjTmp();
 36.3616 -
 36.3617 +			((LinkableMapObj*)selection)->unsetParObjTmp();
 36.3618 +
 36.3619 +
 36.3620 +			copyingObj=false;	
 36.3621  			if (dst ) 
 36.3622 -			{   
 36.3623 -				setChanged();
 36.3624 -				saveState();
 36.3625 +			{
 36.3626 +				BranchObj* bs=((BranchObj*)selection);
 36.3627 +				QString undoCom="linkBranchToPos (\""+ 
 36.3628 +					(bs->getParObj())->getSelectString()+
 36.3629 +					"\","+
 36.3630 +					QString("%1").arg(bs->getNum())+
 36.3631 +					","+
 36.3632 +					QString ("%1,%2").arg(movingObj_orgPos.x()).arg(movingObj_orgPos.y())+
 36.3633 +					")";
 36.3634  				// TODO we also could check, if dest and src are on same branch,
 36.3635  				// then it would be sufficient to saveState of this branch
 36.3636  
 36.3637 -				// FIXME better introduce BO::move  to speed up and keep IDs
 36.3638 -				copy();			// copy selection to clipboard
 36.3639 -				cutNoSave();	// remove selection here
 36.3640 -
 36.3641 -				selection->unselect();	
 36.3642 -				selection=dst;
 36.3643  				// Modifiers allow to insert above/below dst
 36.3644 -				if (e->state() & QMouseEvent::ShiftButton)
 36.3645 +				if (e->state() & Qt::ShiftModifier)
 36.3646  				{
 36.3647 -					selection=pasteAtNoSave (((BranchObj*)(dst))->getNum());
 36.3648 -					if (selection) selection->select();
 36.3649 -				}	
 36.3650 -				else if (e->state() & QMouseEvent::ControlButton)
 36.3651 +					bs->moveBranchTo ( (BranchObj*)(dst->getParObj()), ((BranchObj*)(dst))->getNum());
 36.3652 +				} else 
 36.3653 +				if (e->state() & Qt::ControlModifier)
 36.3654 +			{
 36.3655 +					bs->moveBranchTo ( (BranchObj*)(dst->getParObj()), ((BranchObj*)(dst))->getNum()+1);
 36.3656 +				} else	
 36.3657  				{
 36.3658 -					selection=pasteAtNoSave (((BranchObj*)(dst))->getNum()+1);
 36.3659 -					if (selection) selection->select();
 36.3660 -				}	
 36.3661 -				else	
 36.3662 -				{
 36.3663 -					selection=pasteNoSave();
 36.3664 -					selection->select();
 36.3665 +					bs->moveBranchTo ((BranchObj*)(dst),-1);
 36.3666  					if (dst->getDepth()==0) 
 36.3667 -						((BranchObj*)(selection))->move (savePos);
 36.3668 -				}	
 36.3669 -			} 
 36.3670 +						bs->move (savePos);
 36.3671 +				} 
 36.3672 +				saveState (undoCom,bs->getSelectString(),QString("Relink %1 to %2").arg(getName(bs)).arg(getName(dst)) );
 36.3673 +			} else
 36.3674 +				if (selection->getDepth()==1)
 36.3675 +					// If we have moved mainbranch only save endposition
 36.3676 +					saveState("move "+qpointToString(movingObj_orgPos), selection->getSelectString(), QString("Move %1 to %2").arg(getName(selection)).arg(qpointToString(movingObj_orgPos)));
 36.3677 +			
 36.3678  			// Draw the original link, before selection was moved around
 36.3679  			mapCenter->reposition();
 36.3680  		}
 36.3681 @@ -3025,17 +3583,17 @@
 36.3682  		canvas()->update();
 36.3683  		movingObj=NULL;		
 36.3684  	} else 
 36.3685 -	{	// maybe we moved View: set old cursor
 36.3686 -		setCursor (ArrowCursor);
 36.3687 -    }
 36.3688 +		// maybe we moved View: set old cursor
 36.3689 +		setCursor (Qt::ArrowCursor);
 36.3690 +    
 36.3691  }
 36.3692  
 36.3693  void MapEditor::contentsMouseDoubleClickEvent(QMouseEvent* e)
 36.3694  {
 36.3695  	// Finish open lineEdits
 36.3696 -	if (lineedit) finishedLineEditNoSave();
 36.3697 +	if (lineedit) finishedLineEdit();
 36.3698  	
 36.3699 -	if (e->button() == QMouseEvent::LeftButton )
 36.3700 +	if (e->button() == Qt::LeftButton )
 36.3701  	{
 36.3702  		QPoint p = inverseWorldMatrix().map(e->pos());
 36.3703  		LinkableMapObj *lmo=mapCenter->findMapObj(p, NULL);
 36.3704 @@ -3044,8 +3602,6 @@
 36.3705  			if (selection) selection->unselect();
 36.3706  			selection=lmo;
 36.3707  			selection->select();
 36.3708 -			setChanged();
 36.3709 -			saveState(PartOfMap,selection);
 36.3710  			editHeading();
 36.3711  		}
 36.3712  	}
 36.3713 @@ -3053,10 +3609,239 @@
 36.3714  
 36.3715  void MapEditor::resizeEvent (QResizeEvent* e)
 36.3716  {
 36.3717 -	QCanvasView::resizeEvent( e );
 36.3718 -	
 36.3719 -	QString s="";
 36.3720 -	if (!fileName.isEmpty()) s=fileName;
 36.3721 +	Q3CanvasView::resizeEvent( e );
 36.3722  	adjustCanvasSize();
 36.3723  }
 36.3724  
 36.3725 +void MapEditor::contentsDragEnterEvent(QDragEnterEvent *event) 
 36.3726 +{
 36.3727 +
 36.3728 +//  for (unsigned int i=0;event->format(i);i++) // Debug mime type
 36.3729 +//    cerr << event->format(i) << endl;
 36.3730 +
 36.3731 +  if (selection && 
 36.3732 +      (typeid(*selection) == typeid(BranchObj)) || 
 36.3733 +      (typeid(*selection) == typeid(MapCenterObj))) {
 36.3734 +    
 36.3735 +    // If QImageDrag can decode mime type 
 36.3736 +    if (Q3ImageDrag::canDecode(event)) {
 36.3737 +      event->accept();
 36.3738 +      return;
 36.3739 +    }
 36.3740 +    
 36.3741 +    // If image are dragged from firefox 
 36.3742 +    if (event->provides("application/x-moz-file-promise-url") && 
 36.3743 +	event->provides("application/x-moz-nativeimage")) {
 36.3744 +      event->accept(true);
 36.3745 +      return;
 36.3746 +    }
 36.3747 +
 36.3748 +    // If QUriDrag can decode mime type 
 36.3749 +    if (Q3UriDrag::canDecode(event)) {
 36.3750 +      event->accept();
 36.3751 +      return;
 36.3752 +    }
 36.3753 +    
 36.3754 +	// If Uri are dragged from firefox 
 36.3755 +    if (event->provides("_NETSCAPE_URL")){
 36.3756 +      event->accept();
 36.3757 +      return;
 36.3758 +    }
 36.3759 +
 36.3760 +    // If QTextDrag can decode mime type
 36.3761 +    if (Q3TextDrag::canDecode(event)) {
 36.3762 +      event->accept();
 36.3763 +      return;
 36.3764 +    }
 36.3765 +
 36.3766 +  }
 36.3767 +  event->ignore();
 36.3768 +}
 36.3769 +
 36.3770 +bool isUnicode16(const QByteArray &d) 
 36.3771 +{
 36.3772 +  // TODO: make more precise check for unicode 16.
 36.3773 +  // Guess unicode16 if any of second bytes are zero
 36.3774 +  unsigned int length = max(0,d.size()-2)/2;
 36.3775 +  for (unsigned int i = 0; i<length ; i++)
 36.3776 +    if (d.at(i*2+1)==0) return true;
 36.3777 +  return false;
 36.3778 +}
 36.3779 +      
 36.3780 +void MapEditor::contentsDropEvent(QDropEvent *event) 
 36.3781 +{
 36.3782 +	if (selection && 
 36.3783 +      (typeid(*selection) == typeid(BranchObj)) || 
 36.3784 +      (typeid(*selection) == typeid(MapCenterObj))) 
 36.3785 +	{
 36.3786 +		bool update=false;
 36.3787 +		Q3StrList uris;
 36.3788 +		QString heading;
 36.3789 +		if (event->provides("image/png")) 
 36.3790 +		{
 36.3791 +			QPixmap pix;
 36.3792 +			if (Q3ImageDrag::decode(event, pix)) 
 36.3793 +			{
 36.3794 +				addFloatImage(pix);
 36.3795 +				event->accept();
 36.3796 +				update=true;
 36.3797 +			} else
 36.3798 +				event->ignore();
 36.3799 +
 36.3800 +		} else if (event->provides("application/x-moz-file-promise-url") && 
 36.3801 +			 event->provides("application/x-moz-nativeimage")) 
 36.3802 +		{
 36.3803 +			// Contains url to the img src in unicode16
 36.3804 +			QByteArray d = event->encodedData("application/x-moz-file-promise-url");
 36.3805 +			QString url = QString((const QChar*)d.data(),d.size()/2);
 36.3806 +			fetchImage(url);
 36.3807 +			event->accept();
 36.3808 +			update=true;
 36.3809 +		} else if (event->provides ("text/uri-list"))
 36.3810 +		{	// Uris provided e.g. by konqueror
 36.3811 +			Q3UriDrag::decode (event,uris);
 36.3812 +		} else if (event->provides ("_NETSCAPE_URL"))
 36.3813 +		{	// Uris provided by Mozilla
 36.3814 +		  QStringList l = QStringList::split("\n", event->encodedData("_NETSCAPE_URL"));
 36.3815 +		  uris.append(l[0]);
 36.3816 +		  heading = l[1];
 36.3817 +		} else if (event->provides("text/html")) {
 36.3818 +
 36.3819 +		  // Handels text mime types
 36.3820 +		  // Look like firefox allways handle text as unicode16 (2 bytes per char.)
 36.3821 +		  QByteArray d = event->encodedData("text/html");
 36.3822 +		  QString text;
 36.3823 +		  if (isUnicode16(d)) 
 36.3824 +		    text = QString((const QChar*)d.data(),d.size()/2);
 36.3825 +		  else 
 36.3826 +		    text = QString(d);
 36.3827 +
 36.3828 +		  textEditor->setText(text);
 36.3829 +
 36.3830 +		  event->accept();
 36.3831 +		  update=true;
 36.3832 +		} else if (event->provides("text/plain")) {
 36.3833 +		  QByteArray d = event->encodedData("text/plain");
 36.3834 +		  QString text;
 36.3835 +		  if (isUnicode16(d))
 36.3836 +		    text = QString((const QChar*)d.data(),d.size()/2);
 36.3837 +		  else 
 36.3838 +		    text = QString(d);
 36.3839 +
 36.3840 +		  textEditor->setText(text);
 36.3841 +		  
 36.3842 +		  event->accept();
 36.3843 +		  update= true;
 36.3844 +		}
 36.3845 +
 36.3846 +		if (uris.count()>0)
 36.3847 +		{
 36.3848 +			QStringList files;
 36.3849 +			QStringList urls;
 36.3850 +			QString s;
 36.3851 +			BranchObj *bo;
 36.3852 +			for (const char* u=uris.first(); u; u=uris.next())
 36.3853 +			{
 36.3854 +				bo=((BranchObj*)selection)->addBranch();
 36.3855 +				if (bo)
 36.3856 +				{
 36.3857 +					s=Q3UriDrag::uriToLocalFile(u);
 36.3858 +					if (!s.isEmpty()) 
 36.3859 +					{
 36.3860 +                       QString file = QDir::convertSeparators(s);
 36.3861 +                       heading = QFileInfo(file).baseName();
 36.3862 +                       files.append(file);
 36.3863 +                       if (file.endsWith(".vym", false))
 36.3864 +                           bo->setVymLink(file);
 36.3865 +                       else
 36.3866 +                           bo->setURL(u);
 36.3867 +                   } else 
 36.3868 +				   {
 36.3869 +                       urls.append (u);
 36.3870 +                       bo->setURL(u);
 36.3871 +                   }
 36.3872 +
 36.3873 +                   if (!heading.isEmpty())
 36.3874 +                       bo->setHeading(heading);
 36.3875 +                   else
 36.3876 +                       bo->setHeading(u);
 36.3877 +				}
 36.3878 +			}
 36.3879 +			update=true;
 36.3880 +		}
 36.3881 +
 36.3882 +		if (update) 
 36.3883 +		{
 36.3884 +			//FIXME saveState has to be called earlier for each of the drops...
 36.3885 +			saveState("Drop Event");	//TODO undo Command
 36.3886 +			mapCenter->reposition();
 36.3887 +			adjustCanvasSize();
 36.3888 +			canvas()->update();
 36.3889 +		}	
 36.3890 +	}	
 36.3891 +}
 36.3892 +
 36.3893 +void MapEditor::addFloatImage(const QPixmap &img) 
 36.3894 +{
 36.3895 +  if (selection && 
 36.3896 +      (typeid(*selection) == typeid(BranchObj)) || 
 36.3897 +      (typeid(*selection) == typeid(MapCenterObj))  )
 36.3898 +  {
 36.3899 +    BranchObj *bo=((BranchObj*)selection);
 36.3900 +    saveState(selection,QString("Add floatimage to %1").arg(getName(bo)));
 36.3901 +    //QString fn=fd->selectedFile();
 36.3902 +    //lastImageDir=fn.left(fn.findRev ("/"));
 36.3903 +    bo->addFloatImage();
 36.3904 +    // FIXME check if load was successful
 36.3905 +    bo->getLastFloatImage()->load(img);
 36.3906 +    //bo->getLastFloatImage()->setOriginalFilename(fn);
 36.3907 +    mapCenter->reposition();
 36.3908 +    adjustCanvasSize();
 36.3909 +    canvas()->update();
 36.3910 +  }
 36.3911 +}
 36.3912 +
 36.3913 +
 36.3914 +void MapEditor::imageDataFetched(const QByteArray &a, Q3NetworkOperation */*nop*/) 
 36.3915 +{
 36.3916 +  if (!imageBuffer) imageBuffer = new QBuffer();
 36.3917 +  if (!imageBuffer->isOpen()) {
 36.3918 +    imageBuffer->open(QIODevice::WriteOnly | QIODevice::Append);
 36.3919 +  }
 36.3920 +  imageBuffer->at(imageBuffer->at()+imageBuffer->writeBlock(a));
 36.3921 +}
 36.3922 +
 36.3923 +
 36.3924 +void MapEditor::imageDataFinished(Q3NetworkOperation *nop) 
 36.3925 +{
 36.3926 +	if (nop->state()==Q3NetworkProtocol::StDone) {
 36.3927 +		QPixmap img(imageBuffer->buffer());
 36.3928 +		addFloatImage(img);
 36.3929 +	}
 36.3930 +
 36.3931 +	if (imageBuffer) {
 36.3932 +		imageBuffer->close();
 36.3933 +		if (imageBuffer) {
 36.3934 +			imageBuffer->close();
 36.3935 +			delete imageBuffer;
 36.3936 +			imageBuffer = 0;
 36.3937 +		}
 36.3938 +	}
 36.3939 +}
 36.3940 +
 36.3941 +void MapEditor::fetchImage(const QString &url) 
 36.3942 +{
 36.3943 +  if (urlOperator) {
 36.3944 +    urlOperator->stop();
 36.3945 +    disconnect(urlOperator);
 36.3946 +    delete urlOperator;
 36.3947 +  }
 36.3948 +  
 36.3949 +  urlOperator = new Q3UrlOperator(url);
 36.3950 +  connect(urlOperator, SIGNAL(finished(Q3NetworkOperation *)), 
 36.3951 +	  this, SLOT(imageDataFinished(Q3NetworkOperation*)));
 36.3952 +
 36.3953 +  connect(urlOperator, SIGNAL(data(const QByteArray &, Q3NetworkOperation *)),
 36.3954 +	  this, SLOT(imageDataFetched(const QByteArray &, Q3NetworkOperation *)));
 36.3955 +  urlOperator->get();
 36.3956 +}
    37.1 --- a/mapeditor.h	Sun Jan 30 12:58:47 2005 +0000
    37.2 +++ b/mapeditor.h	Tue Jun 06 14:58:11 2006 +0000
    37.3 @@ -1,43 +1,63 @@
    37.4  #ifndef MAPEDITOR_H
    37.5  #define MAPEDITOR_H
    37.6  
    37.7 -#include <qcanvas.h>
    37.8 +#include <q3canvas.h>
    37.9  #include <qlineedit.h>
   37.10  #include <qcursor.h>
   37.11 -#include <qfiledialog.h>
   37.12 +#include <q3filedialog.h>
   37.13  #include <qevent.h>
   37.14 -#include <qprocess.h>
   37.15 +#include <q3process.h>
   37.16 +#include <qbuffer.h>
   37.17 +//Added by qt3to4:
   37.18 +#include <QContextMenuEvent>
   37.19 +#include <QDropEvent>
   37.20 +#include <QResizeEvent>
   37.21 +#include <QPixmap>
   37.22 +#include <QMouseEvent>
   37.23 +#include <QDragEnterEvent>
   37.24  
   37.25  #include "mapcenterobj.h"
   37.26 +#include "file.h"
   37.27  #include "misc.h"
   37.28 +#include "showtextdialog.h"
   37.29  
   37.30 -class MapEditor : public QCanvasView , public xmlObj {
   37.31 +class Q3NetworkOperation;
   37.32 +class Q3UrlOperator;
   37.33 +
   37.34 +class MapEditor : public Q3CanvasView , public xmlObj {
   37.35      Q_OBJECT
   37.36  
   37.37  public:
   37.38 -    MapEditor(QWidget* parent=0, bool interactive=false, const char* name=0, WFlags f=0);
   37.39 +    MapEditor(QWidget* parent=0, bool interactive=false, const char* name=0, Qt::WFlags f=0);
   37.40  	~MapEditor();
   37.41      QColor color();
   37.42      QColor backgroundColor();
   37.43      MapCenterObj* getMapCenter();
   37.44 -	QCanvas* getCanvas();
   37.45 +	Q3Canvas* getCanvas();
   37.46  	void adjustCanvasSize();// adjust canvas size to map and scrollview
   37.47 -	bool blockReposition(); // block while load or undo
   37.48 +	bool isRepositionBlocked(); // block while load or undo
   37.49  	
   37.50  private:
   37.51 +	QString getName(LinkableMapObj*);	// Get e.g. heading or filename
   37.52  	void makeTmpDirs();		// create temporary directories
   37.53 -	void delTmpDirs();		// delete temporary directories
   37.54 -	void makeSubDirs(const QString&);		
   37.55 -							// create subdirs in dir
   37.56 -    QString saveToDir(const QString&,const QString &,bool, const QPoint
   37.57 -	&,SaveMode);
   37.58 -    void saveState();		// save actual state to backup
   37.59 -    void saveState(const SaveMode&, LinkableMapObj *);
   37.60 +    QString saveToDir(const QString&,const QString &,bool, const QPoint &,LinkableMapObj*);
   37.61 +    void saveState(const QString &);	// save actual state to backup
   37.62 +    void saveState(LinkableMapObj *, const QString &);
   37.63 +    void saveState(const QString &, const QString &, const QString &);
   37.64 +    void saveState(const QString &, LinkableMapObj *, const QString &);
   37.65 +    void saveState(const SaveMode&, const QString &, LinkableMapObj *, const QString &, LinkableMapObj *, const QString &);
   37.66 +    void parseAtom(const QString &);	
   37.67  
   37.68 -private slots:
   37.69 -    void finishedLineEditNoSave();
   37.70 +    void addFloatImage(const QPixmap &img);
   37.71 +
   37.72 +  private slots:
   37.73 +    void finishedLineEdit();
   37.74 +    void fetchImage(const QString &img);
   37.75 +    void imageDataFetched(const QByteArray &, Q3NetworkOperation *);
   37.76 +    void imageDataFinished(Q3NetworkOperation *);
   37.77  
   37.78  public:
   37.79 +	void toggleHistoryWindow();
   37.80  	bool isDefault();		// false, if map was changed once
   37.81      bool isUnsaved();		// save necessary
   37.82      bool hasChanged();		// undo possible
   37.83 @@ -49,38 +69,51 @@
   37.84  	QString getFileName ();	// e.g. "map.xml"
   37.85  	QString getMapName ();	// e.g. "map"
   37.86  	QString getDestPath (); // e.g. "/home/tux/map.vym"
   37.87 -    int load (QString&, const LoadMode &);	// newmap, import/replace selection
   37.88 +    ErrorCode load (QString, LoadMode );	// newmap, import/replace selection
   37.89 +public:
   37.90      int save(const SaveMode &);	// Save map 
   37.91  	void setZipped(bool);		// save map zipped
   37.92  	bool saveZipped();			// 1 if file will be saved zipped
   37.93      void print();				// print canvas
   37.94  private:
   37.95      QPixmap getPixmap();
   37.96 +	void setHideTmpMode (HideTmpMode);	// temporary hide stuff
   37.97 +	HideTmpMode getHideTmpMode();		// temporary hide stuff
   37.98  public:
   37.99 +	void setExportMode (bool);			// temporary hide stuff during export
  37.100      void exportImage (QString fn);		// export as PNG	
  37.101      void exportImage (QString fn, int);	// export in given format
  37.102 -    void exportASCII();
  37.103 +    void exportOOPresentation(const QString &,const QString &);
  37.104      void exportXML(const QString&);		// export to directory
  37.105      void clear();		// clear map
  37.106 +    void copy();		// copy branch to clipboard
  37.107 +    void redo();		// redo last action
  37.108      void undo();		// undo last action
  37.109 -    void copy();		// copy branch to clipboard
  37.110  private:	
  37.111 -    LinkableMapObj* pasteNoSave();		// paste clipboard to branch
  37.112 -    LinkableMapObj* pasteAtNoSave(int);	// paste clipboard to branch at position i
  37.113 +    void undoXML(const QString &, const QString &);
  37.114 +    void pasteNoSave();		// paste clipboard to branch
  37.115      void cutNoSave();	// cut to clipboard
  37.116  public:	
  37.117      void paste();		// paste clipboard to branch and backup
  37.118      void cut();			// cut to clipboard and backup
  37.119 +    void move(const int &,const int&);
  37.120      void moveBranchUp();
  37.121      void moveBranchDown();
  37.122 -    void editHeading();
  37.123 +    void editHeading();					// Start editing heading 
  37.124 +private:
  37.125 +	void setHeading(const QString &);	// Just set the heading for selection
  37.126 +	void setURL(const QString &);		// Just set the URL for selection
  37.127 +	void setVymLink(const QString &);	// Set vymLink for selection
  37.128 +public:	
  37.129      void addNewBranch(int);			// pos allows to add above/below selection
  37.130 +    void addNewBranchHere();		// insert and make selection its
  37.131      void deleteSelection();
  37.132  	LinkableMapObj* getSelection();	// returns selection
  37.133 -	bool select(QString );			// Select 
  37.134  	void unselect();				// before changing current noteedit
  37.135  	void reselect();				// after  changing current noteedit
  37.136 +	bool select(const QString &);	// Select 
  37.137  private:	
  37.138 +	void select(LinkableMapObj*);	
  37.139  	void selectNextBranch();		// Increment number of branch
  37.140  	void selectPrevBranch();		// Decrement number of branch
  37.141  public:	
  37.142 @@ -100,15 +133,20 @@
  37.143  	virtual void setViewCenter();			// needed for zooming
  37.144      BranchObj* findText(QString,bool);		// Find object
  37.145      void findReset();						// Reset Find 
  37.146 -	void openURL();							// open URL in external browser
  37.147  	void editURL();							// edit the URL
  37.148 +	QString getURL();						// returns URL of selection or ""
  37.149  	void editHeading2URL();					// copy heading to URL
  37.150  	void editBugzilla2URL();				// create URL to Bugzilla
  37.151 +	void editFATE2URL();					// create URL to FATE
  37.152  	void editVymLink();						// edit link to another map
  37.153  	void deleteVymLink();					// delete link to another map
  37.154  	QString getVymLink();					// return path to map
  37.155 +	void toggleHideExport();				// toggle the export flag
  37.156 +	void removeBranchKeepChilds();			// remove but keep childs
  37.157 +	void removeChilds();					// remove childs
  37.158  	void editMapInfo();						// dialog to enter author, ...
  37.159  	void updateActions();					// update e.g. format buttons
  37.160 +	void updateNoteFlag();					// when TextEditor changes
  37.161  	void setLinkStyle (LinkStyle);			// Set style of link
  37.162  	LinkStyle getLinkStyle ();				// requested in LMO
  37.163  	void setLinkColor(QColor);				// default color of links
  37.164 @@ -116,18 +154,27 @@
  37.165  	void setLinkColorHint(LinkColorHint);	// color of links
  37.166  	LinkColorHint getLinkColorHint();
  37.167  	QColor getDefLinkColor();
  37.168 +	void setDefXLinkColor(QColor);
  37.169 +	QColor getDefXLinkColor();
  37.170 +	void setDefXLinkWidth (int);
  37.171 +	int getDefXLinkWidth();
  37.172  	void toggleLinkColorHint();				// after changing linkStyles
  37.173      void selectLinkColor();
  37.174      void toggleScroll();
  37.175      void unScrollAll();
  37.176  	void loadFloatImage ();
  37.177  	void saveFloatImage (int);
  37.178 -	void toggleFloatExport();
  37.179  	void setFrame(const FrameType &);
  37.180 +	void setIncludeImagesVer(bool);
  37.181 +	void setIncludeImagesHor(bool);
  37.182 +	void setHideLinkUnselected (bool);
  37.183 +	bool getHideLinkUnselected ();
  37.184  private:	
  37.185      void importDir(BranchObj *,QDir);
  37.186  public:	
  37.187      void importDir();
  37.188 +	void followXLink (int);
  37.189 +	void editXLink (int);
  37.190      void testFunction();				// FIXME just testing
  37.191  
  37.192  protected:
  37.193 @@ -139,8 +186,10 @@
  37.194      virtual void contentsMouseDoubleClickEvent(QMouseEvent*);
  37.195      virtual void contentsMouseMoveEvent(QMouseEvent*);
  37.196  
  37.197 +    virtual void contentsDragEnterEvent(QDragEnterEvent *event);
  37.198 +    virtual void contentsDropEvent(QDropEvent *event);
  37.199  private:
  37.200 -    QCanvas* mapCanvas;
  37.201 +    Q3Canvas* mapCanvas;
  37.202      MapCenterObj* mapCenter;
  37.203  
  37.204  	bool adjustCanvasRequested;	// collect requests until end of user event
  37.205 @@ -148,17 +197,24 @@
  37.206      QLineEdit* lineedit;
  37.207  
  37.208      QColor actColor;			// actual color
  37.209 -	QColor deflinkcolor;		// default color for links
  37.210 +	QColor defLinkColor;		// default color for links
  37.211 +	QColor defXLinkColor;		// default color for xlinks
  37.212 +	int defXLinkWidth;			// default width for xlinks
  37.213  	LinkColorHint linkcolorhint;// use heading color or own color
  37.214  	LinkStyle linkstyle;		// default style for links
  37.215  
  37.216      QCursor handOpenCursor;		// cursor while moving canvas view
  37.217  	QCursor pickColorCursor;	// cursor while picking color 
  37.218 -	bool pickingColor;			// true while picking Color CTRL-LeftButton
  37.219 +	bool pickingColor;
  37.220 +	bool drawingLink;			// true while creating a link
  37.221 +	bool copyingObj;			// true while creating a link
  37.222 +	XLinkObj* tmpXLink;
  37.223  	
  37.224      LinkableMapObj* selection;		// select a LinkableMapObj
  37.225      LinkableMapObj* selectionLast;	// last selection 
  37.226      MapObj* movingObj;				// moving a MapObj
  37.227 +	MapObj* linkingObj_src;			// part of a link
  37.228 +    QPoint movingObj_orgPos;		// org. pos of mouse before move
  37.229      QPoint movingObj_start;			// rel. pos of mouse to absPos 
  37.230      QPoint movingCont_start;		// inital pos of moving Content or
  37.231      QPoint movingVec;				// how far has Content moved
  37.232 @@ -168,14 +224,12 @@
  37.233      bool mapDefault;				// Flag if map is untouched
  37.234      bool mapChanged;				// Flag if undo is possible
  37.235  	bool mapUnsaved;				// Flag if map should be saved
  37.236 -    QString backupXML;				// backup (XML) for undo
  37.237 -	LinkableMapObj* undoSelection;	// replace this LMO with vympart from backup
  37.238 -									// if != NULL
  37.239  
  37.240  	bool printFrame;			// Print frame around map
  37.241  	bool printFooter;			// Print footer below map
  37.242  
  37.243  	bool zipped;				// should map be zipped
  37.244 +static	int mapNum;				// unique number for Editor
  37.245  	QString fileName;			// short name of file (for tab)
  37.246  	QString filePath;			// path to file which will be saved
  37.247  	QString fileDir;			// dir where file is saved
  37.248 @@ -184,14 +238,27 @@
  37.249  	QString lastImageDir;		// save dir for adding images
  37.250  
  37.251  	bool isInteractive;			// non interactive don't need tmpdirs
  37.252 -	QString bakMapDir;			// tmp directory with data for undo
  37.253 -	bool blockreposition;		// block while load or undo
  37.254 +	QString tmpMapDir;			// tmp directory with data for undo/redo
  37.255 +	int undosTotal;				// total number of undos 
  37.256 +	int undoNum;				// current number of bakMapDir to be used 
  37.257 +	int undosAvail;				// how many actions can currently be undone
  37.258 +	bool blockReposition;		// block while load or undo
  37.259 +	bool blockSaveState;		// block while load or undo
  37.260  
  37.261  	BranchObj* itFind;			// next object in find process
  37.262  	bool EOFind;				// true, if search failed
  37.263  
  37.264  	QPoint exportOffset;		// set before export, used in save
  37.265 +	HideTmpMode hidemode;			// true while exporting to hide some stuff
  37.266 +	
  37.267      void resizeEvent( QResizeEvent * );
  37.268 +
  37.269 +  Q3UrlOperator *urlOperator;
  37.270 +  QDataStream *imageData;
  37.271 +  QBuffer *imageBuffer;
  37.272 +
  37.273 +	ShowTextDialog *historyWindow;
  37.274 +
  37.275  };
  37.276  #endif
  37.277  
    38.1 --- a/mapobj.cpp	Sun Jan 30 12:58:47 2005 +0000
    38.2 +++ b/mapobj.cpp	Tue Jun 06 14:58:11 2006 +0000
    38.3 @@ -1,17 +1,17 @@
    38.4  #include "mapobj.h"
    38.5 +#include "misc.h"
    38.6  
    38.7  /////////////////////////////////////////////////////////////////
    38.8  // MapObj
    38.9  /////////////////////////////////////////////////////////////////
   38.10  MapObj::MapObj ()
   38.11  {
   38.12 -	// TODO not used any longer...
   38.13 -	cout << "Const MapObj (): Please set canvas somehow!!!\n";
   38.14 -    // canvas=actMapEditor->getCanvas();
   38.15 +	//qWarning ( "Const MapObj (): Please set canvas somehow!!!");
   38.16 +	canvas=NULL;
   38.17      init ();
   38.18  }
   38.19  
   38.20 -MapObj::MapObj (QCanvas* c)
   38.21 +MapObj::MapObj (Q3Canvas* c)
   38.22  {
   38.23  //  cout << "Const MapObj\n";
   38.24      canvas=c;
   38.25 @@ -45,7 +45,7 @@
   38.26  	bbox.setSize (QSize(other->bbox.width(), other->bbox.height() ) );
   38.27  }
   38.28  
   38.29 -QCanvas* MapObj::getCanvas()
   38.30 +Q3Canvas* MapObj::getCanvas()
   38.31  {
   38.32  	return canvas;
   38.33  }
   38.34 @@ -70,6 +70,16 @@
   38.35      return bbox.height();
   38.36  }
   38.37  
   38.38 +QPoint MapObj::getAbsPos() 
   38.39 +{
   38.40 +    return absPos;
   38.41 +}
   38.42 +
   38.43 +QString MapObj::getPos()
   38.44 +{
   38.45 +	return qpointToString(absPos);
   38.46 +}
   38.47 +
   38.48  void MapObj::move (double x, double y) 
   38.49  {
   38.50      int xi=static_cast <int> (x);
   38.51 @@ -77,18 +87,23 @@
   38.52      absPos.setX( xi);
   38.53      absPos.setY( yi);
   38.54      bbox.moveTopLeft(QPoint(xi,yi));
   38.55 +    clickBox.moveTopLeft(QPoint(xi,yi));
   38.56  }
   38.57  
   38.58  void MapObj::moveBy (double x, double y) 
   38.59  {
   38.60 -    move (x+absPos.x(),y+absPos.y() );
   38.61 +	int ix=(int)x;
   38.62 +	int iy=(int)y;
   38.63 +    MapObj::move (x+absPos.x(),y+absPos.y() );
   38.64 +	bbox.moveBy (ix,iy);
   38.65 +	clickBox.moveBy (ix,iy);
   38.66  }
   38.67  
   38.68 -bool MapObj::inBBox(QPoint p)
   38.69 +bool MapObj::inBox(const QPoint &p)
   38.70  {
   38.71 -    if (p.x() >= bbox.left() && p.x() <= bbox.right()  
   38.72 -	&& p.y() <= bbox.bottom() && p.y() >= bbox.top() )
   38.73 -	return true;
   38.74 +    if (p.x() >= clickBox.left() && p.x() <= clickBox.right()  
   38.75 +	&& p.y() <= clickBox.bottom() && p.y() >= clickBox.top() )
   38.76 +		return true;
   38.77      return false;	
   38.78  }
   38.79  
   38.80 @@ -98,7 +113,9 @@
   38.81  }
   38.82  
   38.83  QRect MapObj::addBBox(QRect r1, QRect r2)
   38.84 -{
   38.85 +{	
   38.86 +	// Find smallest QRect containing given rectangles
   38.87 +
   38.88  	QRect n;
   38.89  	// Set left border
   38.90  	if (r1.left() <= r2.left() )
   38.91 @@ -141,3 +158,4 @@
   38.92  {
   38.93      visible=v;
   38.94  }
   38.95 +
    39.1 --- a/mapobj.h	Sun Jan 30 12:58:47 2005 +0000
    39.2 +++ b/mapobj.h	Tue Jun 06 14:58:11 2006 +0000
    39.3 @@ -1,46 +1,51 @@
    39.4  #ifndef MAPOBJ_H
    39.5  #define MAPOBJ_H
    39.6  
    39.7 -#include <qcanvas.h>
    39.8 +#include <q3canvas.h>
    39.9  #include <iostream>
   39.10  
   39.11  #include "misc.h"
   39.12  
   39.13  using namespace std;
   39.14  
   39.15 -#define Z_BBOX     0
   39.16 -#define Z_LINK    20
   39.17 -#define Z_FRAME   50
   39.18 -#define Z_SELBOX  60
   39.19 -#define Z_ICON    80
   39.20 -#define Z_TEXT   100
   39.21 +#define Z_BBOX      0
   39.22 +#define Z_XLINK    10
   39.23 +#define Z_LINK     20
   39.24 +#define Z_FRAME    50
   39.25 +#define Z_SELBOX   60
   39.26 +#define Z_FLOATIMG 65
   39.27 +#define Z_ICON     80
   39.28 +#define Z_TEXT    100
   39.29  
   39.30  class MapObj:public xmlObj {
   39.31  public:
   39.32      MapObj ();
   39.33 -    MapObj (QCanvas*);
   39.34 +    MapObj (Q3Canvas*);
   39.35      MapObj (MapObj*);
   39.36      virtual ~MapObj ();
   39.37      virtual void init ();
   39.38      virtual void copy (MapObj*);
   39.39 -	virtual QCanvas* getCanvas();
   39.40 +	virtual Q3Canvas* getCanvas();
   39.41      virtual int x();
   39.42      virtual int y();
   39.43  	virtual int width();
   39.44  	virtual int height();
   39.45 +	virtual QPoint getAbsPos();
   39.46 +	virtual QString getPos();					// Return position as string (x,y)
   39.47      virtual void move (double x,double y);      // move to absolute Position
   39.48      virtual void moveBy (double x,double y);    // move to relative Position
   39.49 -    virtual bool inBBox(QPoint);				// Check if Point is in bbox
   39.50 +    virtual bool inBox(const QPoint&);			// Check if Point is within clickbox
   39.51      virtual QRect getBBox();					// returns bounding box
   39.52      virtual QRect addBBox(QRect,QRect);			// returns bbox which includes both boxes
   39.53      virtual QSize getSize();					// returns size of bounding box
   39.54      virtual bool isVisibleObj();
   39.55      virtual void setVisibility(bool);
   39.56 -protected:  
   39.57 -    QCanvas* canvas;
   39.58 -    QRect bbox;									// bounding box of MO itself
   39.59      virtual void positionBBox()=0;       
   39.60  	virtual void calcBBoxSize()=0;
   39.61 +protected:  
   39.62 +    Q3Canvas* canvas;
   39.63 +    QRect bbox;									// bounding box of MO itself
   39.64 +	QRect clickBox;								// area where mouseclicks are found
   39.65      QPoint absPos;							    // Position on canvas
   39.66      bool visible;
   39.67  };
    40.1 --- a/misc.cpp	Sun Jan 30 12:58:47 2005 +0000
    40.2 +++ b/misc.cpp	Tue Jun 06 14:58:11 2006 +0000
    40.3 @@ -1,14 +1,20 @@
    40.4 +#include <math.h>
    40.5 +
    40.6  #include <qregexp.h>
    40.7  #include <qpoint.h>
    40.8 -
    40.9 -#include <math.h>
   40.10 +#include <stdlib.h>
   40.11  
   40.12  #include "misc.h"
   40.13  
   40.14 +QString qpointToString (const QPoint &p)
   40.15 +{
   40.16 +	return "(" + QString("%1").arg(p.x()) +","+ QString ("%1").arg (p.y()) +")";
   40.17 +}
   40.18  
   40.19  ostream &operator<< (ostream &stream, QPoint const &p)
   40.20  { 
   40.21 -    return (stream << "(" << p.x() << "," << p.y() << ")");
   40.22 +	stream << "("<<p.x()<<","<<p.y()<<")";
   40.23 +	return stream;
   40.24  }
   40.25  
   40.26  float getAngle(const QPoint &p)
   40.27 @@ -65,49 +71,6 @@
   40.28  	return QPoint ((int) (x),(int) (y));
   40.29  }
   40.30  
   40.31 -QString maskPath(QString p)
   40.32 -{
   40.33 -	// Change " " to "\ " to enable blanks in filenames
   40.34 -	p=p.replace(QChar('&'),"\\&");
   40.35 -	return p.replace(QChar(' '),"\\ ");
   40.36 -}
   40.37 -
   40.38 -QString convertToRel (const QString &src, const QString &dst)
   40.39 -{
   40.40 -	QString s=src;
   40.41 -	QString d=dst;
   40.42 -	int i;
   40.43 -	// Find relative path from src to dst
   40.44 -
   40.45 -	// Remove the first "/"
   40.46 -	if (s.section ("/",0,0).isEmpty()) 
   40.47 -	{
   40.48 -		s=s.right (s.length()-1);
   40.49 -		d=d.right (d.length()-1);
   40.50 -	}
   40.51 -	
   40.52 -	// remove identical left parts
   40.53 -	while (s.section("/",0,0) == d.section("/",0,0) ) 
   40.54 -	{
   40.55 -		i=s.find ("/");
   40.56 -		s=s.right (s.length()-i-1);
   40.57 -		d=d.right (d.length()-i-1);
   40.58 -	}
   40.59 -
   40.60 -	int srcsep=s.contains("/");
   40.61 -	int dstsep=d.contains("/");
   40.62 -	if (srcsep >=  dstsep )
   40.63 -	{
   40.64 -		// find path to go up first and then back to dst
   40.65 -		i=1;
   40.66 -		while (i<=srcsep) 
   40.67 -		{
   40.68 -			d="../"+d;
   40.69 -			i++;
   40.70 -		}	
   40.71 -	}
   40.72 -	return d;
   40.73 -}
   40.74  
   40.75  // returns masked "<" ">" "&"
   40.76  QString quotemeta(const QString &s)
   40.77 @@ -203,36 +166,3 @@
   40.78      return s;
   40.79  }	
   40.80  
   40.81 -
   40.82 -
   40.83 -ImagePreview::ImagePreview (QWidget *parent=0): QLabel (parent)
   40.84 -{
   40.85 -}
   40.86 -
   40.87 -void ImagePreview::previewUrl( const QUrl &u )
   40.88 -{
   40.89 -    QString path = u.path();
   40.90 -    QPixmap pix( path );
   40.91 -    if ( pix.isNull() )
   40.92 -        setText( QObject::tr("This is not an image.") );
   40.93 -    else
   40.94 -	{
   40.95 -		float max_w=300;
   40.96 -		float max_h=300;
   40.97 -		float r;
   40.98 -		if (pix.width()>max_w)
   40.99 -		{
  40.100 -			r=max_w / pix.width();
  40.101 -			pix.resize(lrint(pix.width()*r), lrint(pix.height()*r));
  40.102 -			// TODO not a resize, but a shrink/enlarge is needed here...
  40.103 -		}
  40.104 -		if (pix.height()>max_h)
  40.105 -		{
  40.106 -			r=max_h / pix.height();
  40.107 -			pix.resize(lrint(pix.width()*r), lrint(pix.height()*r));
  40.108 -			// TODO not a resize, but a shrink/enlarge is needed here...
  40.109 -		}
  40.110 -        setPixmap( pix );
  40.111 -	}	
  40.112 -}
  40.113 -
    41.1 --- a/options.cpp	Sun Jan 30 12:58:47 2005 +0000
    41.2 +++ b/options.cpp	Tue Jun 06 14:58:11 2006 +0000
    41.3 @@ -86,7 +86,7 @@
    41.4  			}
    41.5  			if (isFile)
    41.6  			{
    41.7 -				cout << "Error: Unknown argument "<<*itarg<<endl;
    41.8 +				qWarning("Error: Unknown argument ");
    41.9  				return 1;
   41.10  			}
   41.11  		} else
    42.1 --- a/options.h	Sun Jan 30 12:58:47 2005 +0000
    42.2 +++ b/options.h	Tue Jun 06 14:58:11 2006 +0000
    42.3 @@ -3,6 +3,8 @@
    42.4  
    42.5  #include <qstring.h>
    42.6  #include <qstringlist.h>
    42.7 +//Added by qt3to4:
    42.8 +#include <Q3ValueList>
    42.9  
   42.10  enum OptionType  {SwitchOption,StringOption};
   42.11  
   42.12 @@ -30,7 +32,7 @@
   42.13  
   42.14  
   42.15  
   42.16 -typedef QValueList <Option> OptionList;
   42.17 +typedef Q3ValueList <Option> OptionList;
   42.18  
   42.19  class Options
   42.20  {
    43.1 --- a/ornamentedobj.cpp	Sun Jan 30 12:58:47 2005 +0000
    43.2 +++ b/ornamentedobj.cpp	Tue Jun 06 14:58:11 2006 +0000
    43.3 @@ -18,7 +18,7 @@
    43.4      init ();
    43.5  }
    43.6  
    43.7 -OrnamentedObj::OrnamentedObj(QCanvas* c) :LinkableMapObj(c)
    43.8 +OrnamentedObj::OrnamentedObj(Q3Canvas* c) :LinkableMapObj(c)
    43.9  {
   43.10  //    cout << "Const OrnamentedObj\n";
   43.11      init ();
   43.12 @@ -54,20 +54,29 @@
   43.13  	standardFlags->clone(standardFlagsDefault);
   43.14  	standardFlags->setName ("standardFlags");
   43.15  
   43.16 +	hideExport=false;
   43.17 +	hidden=false;
   43.18  
   43.19 -
   43.20 +	url="";
   43.21 +	vymLink="";
   43.22 +	
   43.23  }
   43.24  
   43.25  void OrnamentedObj::copy (OrnamentedObj* other)
   43.26  {
   43.27      LinkableMapObj::copy(other);
   43.28  	heading->copy(other->heading);
   43.29 -    setColor   (other->heading->getColor(),false);	
   43.30 +    setColor   (other->heading->getColor());	
   43.31  
   43.32  	note.copy (other->note);
   43.33  	systemFlags->copy (other->systemFlags);
   43.34  	standardFlags->copy (other->standardFlags);
   43.35  
   43.36 +	ornamentsBBox=other->ornamentsBBox;
   43.37 +
   43.38 +	hideExport=other->hideExport;
   43.39 +	url=other->url;
   43.40 +	vymLink=other->vymLink;
   43.41  }
   43.42  
   43.43  QString OrnamentedObj::getHeading()
   43.44 @@ -83,27 +92,45 @@
   43.45  		LinkableMapObj::setLinkColor (mapEditor->getDefLinkColor());
   43.46  }
   43.47  
   43.48 +void OrnamentedObj::setColor (QColor col)
   43.49 +{
   43.50 +    heading->setColor(col);
   43.51 +	setLinkColor();
   43.52 +}
   43.53 +
   43.54  QColor OrnamentedObj::getColor ()
   43.55  {
   43.56      return heading->getColor();
   43.57  }
   43.58  
   43.59  
   43.60 +void OrnamentedObj::positionContents()
   43.61 +{
   43.62 +	double d=frame->getBorder()/2;
   43.63 +	double x=absPos.x();
   43.64 +	double y=absPos.y();
   43.65 +
   43.66 +	double ox,oy;	// Offset due to padding
   43.67 +
   43.68 +	ox=leftPad + d;
   43.69 +	oy=topPad + d;
   43.70 +	
   43.71 +	systemFlags-> move (ox +x , oy + y );
   43.72 +
   43.73 +	// vertical align heading to bottom
   43.74 +    heading->move (ox + x + systemFlags->getBBox().width(),
   43.75 +				   oy + y + ornamentsBBox.height() - heading->getHeight() 
   43.76 +					);
   43.77 +	standardFlags->move (ox +x + heading->getWidth() + systemFlags->getBBox().width() , oy + y );
   43.78 +
   43.79 +	ornamentsBBox.moveTopLeft ( QPoint ((int)(ox+x),(int)(oy+y)));
   43.80 +	clickBox.moveTopLeft (QPoint ((int)(ox + x), (int)(oy + y)));
   43.81 +}
   43.82 +
   43.83  void OrnamentedObj::move (double x, double y)
   43.84  {
   43.85  	MapObj::move (x,y);
   43.86 -	double dx=frame->getBorder()/2;  // care for border around object
   43.87 -	double dy=frame->getBorder()/2;
   43.88 -	systemFlags-> move (x + dx, y + dy);
   43.89 -
   43.90 -	// vertical align heading to bottom
   43.91 -	int h=max (systemFlags->getBBox().height(), standardFlags->getBBox().height());
   43.92 -	h=max (h,heading->getHeight());
   43.93 -    heading->move (x + dx + systemFlags->getBBox().width(),
   43.94 -					y + dy  + h - heading->getHeight() 
   43.95 -					);
   43.96 -	standardFlags->move (x + heading->getWidth() + systemFlags->getBBox().width(), y + dy );				
   43.97 -
   43.98 +	positionContents();
   43.99  	updateLink();
  43.100  	requestReposition();
  43.101  }
  43.102 @@ -138,8 +165,7 @@
  43.103  
  43.104  void OrnamentedObj::move2RelPos(QPoint p)
  43.105  {
  43.106 -	if (!parObj) return;
  43.107 -	move (parObj->getChildPos().x() + p.x(), parObj->getChildPos().y() + p.y() );
  43.108 +	move2RelPos (p.x(),p.y());
  43.109  }
  43.110  
  43.111  void OrnamentedObj::setNote(QString s)
  43.112 @@ -174,9 +200,72 @@
  43.113      return note.getNote();
  43.114  }
  43.115  
  43.116 -void OrnamentedObj::toggleStandardFlag(QString f)
  43.117 +QString OrnamentedObj::getNoteASCII()
  43.118  {
  43.119 -	standardFlags->toggle(f);
  43.120 +    return note.getNoteASCII();
  43.121 +}
  43.122 +
  43.123 +QString OrnamentedObj::getNoteOpenDoc()
  43.124 +{
  43.125 +    return note.getNoteOpenDoc();
  43.126 +}
  43.127 +
  43.128 +void OrnamentedObj::setURL(QString s)
  43.129 +{
  43.130 +	url=s;
  43.131 +	if (!url.isEmpty())
  43.132 +		systemFlags->activate("url");
  43.133 +	else	
  43.134 +		systemFlags->deactivate("url");
  43.135 +	calcBBoxSize();			// recalculate bbox
  43.136 +    positionBBox();			// rearrange contents
  43.137 +	forceReposition();
  43.138 +}
  43.139 +
  43.140 +QString OrnamentedObj::getURL()
  43.141 +{
  43.142 +	return url;
  43.143 +}
  43.144 +
  43.145 +void OrnamentedObj::setVymLink(QString s)
  43.146 +{
  43.147 +	if (!s.isEmpty())
  43.148 +	{
  43.149 +		// We need the relative (from loading) 
  43.150 +		// or absolute path (from User event)
  43.151 +		// and build the absolute path.
  43.152 +		// Note: If we have relative, use path of
  43.153 +		// current map to build absolute path
  43.154 +		QDir d(s);
  43.155 +		if (!d.path().startsWith ("/"))
  43.156 +		{
  43.157 +			QString p=mapEditor->getDestPath();
  43.158 +			int i=p.findRev("/",-1);
  43.159 +			d.setPath(p.left(i)+"/"+s);
  43.160 +			d.convertToAbs();
  43.161 +		}
  43.162 +		vymLink=d.path();
  43.163 +		systemFlags->activate("vymLink");
  43.164 +	}	
  43.165 +	else	
  43.166 +	{
  43.167 +		systemFlags->deactivate("vymLink");
  43.168 +		vymLink="";
  43.169 +	}	
  43.170 +	calcBBoxSize();			// recalculate bbox
  43.171 +    positionBBox();			// rearrange contents
  43.172 +	forceReposition();
  43.173 +}
  43.174 +
  43.175 +QString OrnamentedObj::getVymLink()
  43.176 +{
  43.177 +	return vymLink;
  43.178 +}
  43.179 +
  43.180 +
  43.181 +void OrnamentedObj::toggleStandardFlag(QString f, bool exclusive)
  43.182 +{
  43.183 +	standardFlags->toggle(f,exclusive);
  43.184  	calcBBoxSize();
  43.185  	positionBBox();
  43.186  	move (absPos.x(), absPos.y() );
  43.187 @@ -192,20 +281,93 @@
  43.188  	forceReposition();
  43.189  }
  43.190  
  43.191 +bool OrnamentedObj::isSetStandardFlag (QString f)
  43.192 +{
  43.193 +	return standardFlags->isActive(f);
  43.194 +}
  43.195 +
  43.196  QString OrnamentedObj::getSystemFlagName(const QPoint &p)
  43.197  {
  43.198  	return systemFlags->getFlagName(p);	
  43.199  }
  43.200  
  43.201 +bool OrnamentedObj::isActiveFlag (const QString & fname)
  43.202 +{
  43.203 +	if (standardFlags->isActive (fname) ) return true;
  43.204 +	return false;
  43.205 +}
  43.206 +
  43.207  void OrnamentedObj::updateNoteFlag()
  43.208  {
  43.209 -	// text in NoteEditor has changed, notify MapEditor 
  43.210 -	mapEditor->setChanged();
  43.211 +	if (selected) 
  43.212 +	{
  43.213 +		// text in NoteEditor has changed, notify MapEditor 
  43.214 +		mapEditor->setChanged();
  43.215  
  43.216 -	// save text
  43.217 -	setNote( textEditor->getText() );
  43.218 +		// save text
  43.219 +		setNote( textEditor->getText() );
  43.220  	
  43.221 -	// save font   
  43.222 -	note.setFontHint (textEditor->getFontHint() );
  43.223 +		// save font   
  43.224 +		note.setFontHint (textEditor->getFontHint() );
  43.225 +	}	
  43.226  }
  43.227  
  43.228 +void OrnamentedObj::setHideInExport(bool b)
  43.229 +{
  43.230 +	if (parObj)
  43.231 +	{
  43.232 +		// Don't allow to MapCenter to be hidden
  43.233 +		hideExport=b;
  43.234 +		if (b)
  43.235 +			systemFlags->activate("hideInExport");
  43.236 +		else	
  43.237 +			systemFlags->deactivate("hideInExport");
  43.238 +		calcBBoxSize();
  43.239 +		positionBBox();
  43.240 +		requestReposition();	
  43.241 +	}
  43.242 +}	
  43.243 +
  43.244 +bool OrnamentedObj::hideInExport()
  43.245 +{
  43.246 +	return hideExport;
  43.247 +}	
  43.248 +
  43.249 +bool OrnamentedObj::isHidden()
  43.250 +{
  43.251 +	return hidden;
  43.252 +}	
  43.253 +
  43.254 +QString OrnamentedObj::getOrnAttr()
  43.255 +{
  43.256 +	QString posAttr;
  43.257 +
  43.258 +	if (useRelPos)
  43.259 +		posAttr=attribut("relPosX",QString().setNum(relPos.x(),10)) +
  43.260 +                attribut("relPosY",QString().setNum(relPos.y(),10)); 
  43.261 +	else
  43.262 +	{
  43.263 +		if (depth==0 || depth==1) posAttr=
  43.264 +			attribut("absPosX",QString().setNum(absPos.x(),10)) +
  43.265 +			attribut("absPosY",QString().setNum(absPos.y(),10)); 
  43.266 +		else
  43.267 +			posAttr="";
  43.268 +	}	
  43.269 +
  43.270 +	QString urlAttr;
  43.271 +	if (!url.isEmpty())
  43.272 +		urlAttr=attribut ("url",url);
  43.273 +
  43.274 +	QString vymLinkAttr;
  43.275 +	if (!vymLink.isEmpty())
  43.276 +		vymLinkAttr=attribut ("vymLink",convertToRel(mapEditor->getDestPath(),vymLink) );
  43.277 +
  43.278 +	QString hideExpAttr;
  43.279 +	if (hideExport)
  43.280 +		hideExpAttr= attribut("hideInExport","true");
  43.281 +	else	
  43.282 +		hideExpAttr="";
  43.283 +
  43.284 +	return posAttr +urlAttr +vymLinkAttr +getLinkAttr() +hideExpAttr;
  43.285 +}
  43.286 +
    44.1 --- a/ornamentedobj.h	Sun Jan 30 12:58:47 2005 +0000
    44.2 +++ b/ornamentedobj.h	Tue Jun 06 14:58:11 2006 +0000
    44.3 @@ -4,23 +4,19 @@
    44.4  #include "linkablemapobj.h"
    44.5  
    44.6  class OrnamentedObj:public LinkableMapObj {
    44.7 -	Q_OBJECT
    44.8  public:	
    44.9      OrnamentedObj ();
   44.10 -    OrnamentedObj (QCanvas*);
   44.11 +    OrnamentedObj (Q3Canvas*);
   44.12      OrnamentedObj (OrnamentedObj*);
   44.13      ~OrnamentedObj ();
   44.14      virtual void init ();
   44.15      virtual void copy (OrnamentedObj*);
   44.16  
   44.17 -    virtual void setHeading (QString s)=0;  // set the heading, pure virtual 
   44.18 -											// to take care of fontsize
   44.19      virtual QString getHeading();			// returns the heading	
   44.20  	virtual void setLinkColor();			// sets color according to colorhint, overloaded
   44.21 -    virtual void setVisibility(bool,int)=0;	// set visibility
   44.22 -    virtual void setVisibility(bool)=0;	    // set vis. for w
   44.23 -	virtual void setColor(QColor,bool)=0;		// set the color of text and link
   44.24 +	virtual void setColor(QColor);			// set the color of text and link
   44.25  	QColor getColor ();						// get color of heading
   44.26 +    virtual void positionContents();
   44.27      virtual void move   (double,double);
   44.28      virtual void move   (QPoint);
   44.29      virtual void moveBy (double,double);
   44.30 @@ -29,19 +25,35 @@
   44.31      virtual void move2RelPos (double,double);
   44.32      virtual void setNote(QString);			// set note
   44.33      virtual void setNote(NoteObj);			// set note
   44.34 -    virtual QString getNote();				// returns note	
   44.35 -	virtual void toggleStandardFlag(QString);
   44.36 +    virtual QString getNote();				// returns note	(HTML)
   44.37 +    virtual QString getNoteASCII();			// returns note	(ASCII)
   44.38 +    virtual QString getNoteOpenDoc();		// returns note	(OpenDoc)
   44.39 +    virtual void setURL (QString);
   44.40 +    virtual QString getURL ();
   44.41 +    virtual void setVymLink (QString);
   44.42 +    virtual QString getVymLink ();
   44.43 +
   44.44 +	virtual void toggleStandardFlag(QString, bool);
   44.45  	virtual void activateStandardFlag(QString);
   44.46 +	virtual bool isSetStandardFlag(QString);
   44.47  	virtual QString getSystemFlagName (const QPoint &p);
   44.48 -
   44.49 -public slots:
   44.50 -	void updateNoteFlag();
   44.51 +	virtual bool isActiveFlag(const QString&);	// check if flag is set
   44.52 +	virtual void updateNoteFlag();
   44.53 +	virtual void setHideInExport(bool);		// set export of object (and childs)
   44.54 +	virtual bool hideInExport();
   44.55 +	virtual bool isHidden ();
   44.56 +	virtual QString getOrnAttr();			// get attributes for saveToDir
   44.57  
   44.58  protected:
   44.59      HeadingObj *heading;			// Heading
   44.60  	NoteObj note;					// Notes
   44.61  	FlagRowObj *systemFlags;		// System Flags
   44.62  	FlagRowObj *standardFlags;		// Standard Flags
   44.63 +	QRect ornamentsBBox;			// bbox of flags and heading
   44.64 +	QString url;					// url to external doc
   44.65 +	QString vymLink;				// path to another map
   44.66 +	bool hideExport;				// hide in exports if set
   44.67 +	bool hidden;					// true if temporary hidden
   44.68  };
   44.69  
   44.70  #endif
    45.1 --- a/process.h	Sun Jan 30 12:58:47 2005 +0000
    45.2 +++ b/process.h	Tue Jun 06 14:58:11 2006 +0000
    45.3 @@ -1,13 +1,13 @@
    45.4  #ifndef PROCESS_H
    45.5  #define PROCESS_H
    45.6  
    45.7 -#include <qprocess.h>
    45.8 +#include <q3process.h>
    45.9  #include <qstring.h>
   45.10  
   45.11  
   45.12  using namespace std;
   45.13  
   45.14 -class Process:public QProcess
   45.15 +class Process:public Q3Process
   45.16  {
   45.17  	Q_OBJECT
   45.18  public:
    46.1 --- a/selection.h	Sun Jan 30 12:58:47 2005 +0000
    46.2 +++ b/selection.h	Tue Jun 06 14:58:11 2006 +0000
    46.3 @@ -2,7 +2,7 @@
    46.4  #define SELECTIONOBJ_H
    46.5  
    46.6  #include "linkablemapobj.h"
    46.7 -#include <qptrlist.h>
    46.8 +#include <q3ptrlist.h>
    46.9  
   46.10  class Selection 
   46.11  {
   46.12 @@ -20,7 +20,7 @@
   46.13  	uint count();
   46.14  
   46.15  private:
   46.16 -	QPtrList <LinkableMapObj> selectList;
   46.17 +	Q3PtrList <LinkableMapObj> selectList;
   46.18  };
   46.19  #endif
   46.20  
    47.1 --- a/texteditor.cpp	Sun Jan 30 12:58:47 2005 +0000
    47.2 +++ b/texteditor.cpp	Tue Jun 06 14:58:11 2006 +0000
    47.3 @@ -1,6 +1,6 @@
    47.4  #include "texteditor.h"
    47.5  
    47.6 -#include <qcanvas.h>
    47.7 +#include <q3canvas.h>
    47.8  #include <qstatusbar.h>
    47.9  #include <qmessagebox.h>
   47.10  #include <qaction.h>
   47.11 @@ -8,68 +8,65 @@
   47.12  #include <qpainter.h>
   47.13  #include <qprinter.h>
   47.14  #include <qfile.h>
   47.15 -#include <qfiledialog.h>
   47.16 -#include <qtoolbar.h>
   47.17 -#include <qpopupmenu.h>
   47.18 +#include <q3filedialog.h>
   47.19 +#include <q3toolbar.h>
   47.20 +#include <q3popupmenu.h>
   47.21  #include <qmenubar.h>
   47.22 -#include <qtextedit.h>
   47.23 -#include <qaccel.h>
   47.24 +#include <q3textedit.h>
   47.25 +#include <q3accel.h>
   47.26  #include <qtextstream.h>
   47.27 -#include <qpaintdevicemetrics.h>
   47.28 +#include <q3paintdevicemetrics.h>
   47.29  #include <qsettings.h>
   47.30  #include <qfontdialog.h>
   47.31  #include <qmessagebox.h>
   47.32  #include <qcolordialog.h>
   47.33  #include <qregexp.h>
   47.34  #include <qlineedit.h>
   47.35 -#include <qsimplerichtext.h>
   47.36 +#include <q3simplerichtext.h>
   47.37 +//Added by qt3to4:
   47.38 +#include <Q3ValueList>
   47.39 +#include <QPixmap>
   47.40 +#include <Q3ActionGroup>
   47.41 +#include <QCloseEvent>
   47.42  
   47.43  #include <iostream>
   47.44 -#include <stdlib.h>
   47.45 +#include <cstdlib>
   47.46  #include <typeinfo>
   47.47  
   47.48 -#include "icons/fileopen.xpm"
   47.49 -#include "icons/filesave.xpm"
   47.50 -#include "icons/fileprint.xpm"
   47.51 -#include "icons/editundo.xpm"	
   47.52 -#include "icons/editredo.xpm"	
   47.53 -#include "icons/editcopy.xpm"
   47.54 -#include "icons/editcut.xpm"
   47.55 -#include "icons/editpaste.xpm"
   47.56 -#include "icons/edittrash.xpm"
   47.57 -#include "icons/formatfixedfont.xpm"
   47.58 -#include "icons/formattextbold.xpm"
   47.59 -#include "icons/formattextitalic.xpm"
   47.60 -#include "icons/formattextunder.xpm"
   47.61 -#include "icons/formattextleft.xpm"
   47.62 -#include "icons/formattextcenter.xpm"
   47.63 -#include "icons/formattextright.xpm"
   47.64 -#include "icons/formattextjustify.xpm"
   47.65 +#include "noteobj.h"
   47.66 +#include "version.h"
   47.67  
   47.68 -extern QCanvas* actCanvas;
   47.69 +extern Q3Canvas* actCanvas;
   47.70  extern int statusbarTime;
   47.71  extern QSettings settings;
   47.72  
   47.73 +extern QAction *actionViewToggleNoteEditor;
   47.74 +
   47.75 +extern QString iconPath;
   47.76 +
   47.77  using namespace std;
   47.78  
   47.79  
   47.80  ///////////////////////////////////////////////////////////////////////
   47.81  ///////////////////////////////////////////////////////////////////////
   47.82  
   47.83 +
   47.84  TextEditor::TextEditor()
   47.85  {
   47.86      printer = new QPrinter( QPrinter::HighResolution );
   47.87 +	printer->setPrinterName (settings.readEntry("/vym/mainwindow/printerName",printer->printerName()));
   47.88  
   47.89 -	// Editor
   47.90 -    e = new QTextEdit( this, "editor" );
   47.91 +	// Editor (use MyTextEdit to wrap verticalAlignmentChanged to 
   47.92 +	//         int argument. see header file)
   47.93 +    e = new MyTextEdit( this, "editor" );
   47.94      e->setFocus();
   47.95 -	e->setTextFormat(RichText);		// default
   47.96 +	e->setTextFormat(Qt::RichText);		// default
   47.97  	e->setTabStopWidth (20);		// unit is pixel
   47.98 -	e->setColor (black);
   47.99 +	e->setColor (Qt::black);
  47.100  	connect (e, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) );
  47.101      setCentralWidget( e );
  47.102      statusBar()->message( "Ready", statusbarTime);
  47.103 -	setCaption("VYM - Note Editor");
  47.104 +	setCaption(__VYM " - " +tr ("Note Editor"));
  47.105  
  47.106  	// Toolbars
  47.107  	setupFileActions();
  47.108 @@ -78,9 +75,9 @@
  47.109  	setupSettingsActions();
  47.110  	
  47.111  	// Various states
  47.112 -	emptyPaper   = QBrush(gray);
  47.113 -	filledPaper  = QBrush(white);
  47.114 -	inactivePaper= QBrush(black);
  47.115 +	emptyPaper   = QBrush(Qt::gray);
  47.116 +	filledPaper  = QBrush(Qt::white);
  47.117 +	inactivePaper= QBrush(Qt::black);
  47.118  	setInactive();
  47.119  
  47.120  	// Load Settings
  47.121 @@ -112,6 +109,10 @@
  47.122  		actionSettingsFonthintDefault->setOn (false);
  47.123  		e->setCurrentFont (varFont);
  47.124  	}	
  47.125 +	filenameHint="";
  47.126 +
  47.127 +	// Save settings in vymrc
  47.128 +	settings.writeEntry("/vym/mainwindow/printerName",printer->printerName());
  47.129  }
  47.130  
  47.131  
  47.132 @@ -204,6 +205,16 @@
  47.133  	return filename;
  47.134  }
  47.135  
  47.136 +void TextEditor::setFilenameHint(const QString &fnh)
  47.137 +{
  47.138 +	filenameHint=fnh;
  47.139 +}
  47.140 +
  47.141 +QString TextEditor::getFilenameHint()
  47.142 +{
  47.143 +	return filenameHint;
  47.144 +}
  47.145 +
  47.146  bool TextEditor::findText(const QString &t, const bool &cs)
  47.147  {
  47.148  	bool wo=false;	// word matches
  47.149 @@ -215,13 +226,15 @@
  47.150  
  47.151  void TextEditor::setupFileActions()
  47.152  {
  47.153 -    QToolBar *tb = new QToolBar( this );
  47.154 +    Q3ToolBar *tb = new Q3ToolBar( this );
  47.155      tb->setLabel( "File Actions" );
  47.156 -    QPopupMenu *menu = new QPopupMenu( this );
  47.157 +    Q3PopupMenu *menu = new Q3PopupMenu( this );
  47.158      menuBar()->insertItem( tr( "&File" ), menu );
  47.159  
  47.160      QAction *a;
  47.161 -    a = new QAction( tr( "Import" ), QPixmap( fileopen_xpm), tr( "&Import..." ), CTRL + Key_O, this, "fileImport" );
  47.162 +    a = new QAction( QPixmap( iconPath+"fileopen.png"), tr( "&Import..." ),this);
  47.163 +	a->setStatusTip (tr( "Import" ) );
  47.164 +	a->setShortcut( Qt::CTRL + Qt::Key_O );
  47.165      connect( a, SIGNAL( activated() ), this, SLOT( textLoad() ) );
  47.166  	a->setEnabled(false);
  47.167      a->addTo( tb );
  47.168 @@ -229,24 +242,31 @@
  47.169  	actionFileLoad=a;
  47.170  
  47.171      menu->insertSeparator();
  47.172 -    a = new QAction( tr( "Export Note (HTML)" ), QPixmap( filesave_xpm ), tr( "&Export..." ), CTRL + Key_S, this, "fileSave" );
  47.173 +    a = new QAction( QPixmap(iconPath+"filesave.png" ), tr( "&Export..." ),this);
  47.174 +	a->setStatusTip (tr( "Export Note (HTML)" ) );
  47.175 +	a->setShortcut( Qt::CTRL + Qt::Key_S );
  47.176      connect( a, SIGNAL( activated() ), this, SLOT( textSave() ) );
  47.177      a->addTo( tb );
  47.178      a->addTo( menu );
  47.179  	actionFileSave=a;
  47.180  	
  47.181 -    a = new QAction( tr( "Export Note As (HTML) " ), QPixmap(), tr( "Export &As... (HTML)" ), 0, this, "exportHTML" );
  47.182 +    a = new QAction(  QPixmap(), tr( "Export &As... (HTML)" ), this);
  47.183 +	a->setStatusTip (tr( "Export Note As (HTML) " ));
  47.184      connect( a, SIGNAL( activated() ), this, SLOT( textSaveAs() ) );
  47.185      a->addTo( menu );
  47.186  	actionFileSaveAs=a;
  47.187  
  47.188 -    a = new QAction( tr( "Export Note As (ASCII) " ), QPixmap(), tr( "Export &As...(ASCII)" ), ALT + Key_X, this, "exportASCII" );
  47.189 +    a = new QAction(QPixmap(), tr( "Export &As...(ASCII)" ), this);
  47.190 +	a->setStatusTip ( tr( "Export Note As (ASCII) " ) );
  47.191 +	a->setShortcut(Qt::ALT + Qt::Key_X );
  47.192      connect( a, SIGNAL( activated() ), this, SLOT( textExportAsASCII() ) );
  47.193      a->addTo( menu );
  47.194  	actionFileSaveAs=a;
  47.195  
  47.196      menu->insertSeparator();
  47.197 -    a = new QAction( tr( "Print Note" ), QPixmap( fileprint_xpm ), tr( "&Print..." ), CTRL + Key_P, this, "filePrint" );
  47.198 +    a = new QAction( QPixmap(iconPath+"fileprint.png" ), tr( "&Print..." ),this);
  47.199 +	a->setStatusTip (tr( "Print Note" ) );
  47.200 +	a->setShortcut( Qt::CTRL + Qt::Key_P );
  47.201      connect( a, SIGNAL( activated() ), this, SLOT( textPrint() ) );
  47.202      a->addTo( tb );
  47.203      a->addTo( menu );
  47.204 @@ -255,60 +275,77 @@
  47.205  
  47.206  void TextEditor::setupEditActions()
  47.207  {
  47.208 -    QToolBar *tb = new QToolBar( this );
  47.209 +    Q3ToolBar *tb = new Q3ToolBar( this );
  47.210      tb->setLabel( "Edit Actions" );
  47.211 -    QPopupMenu *menu = new QPopupMenu( this );
  47.212 +    Q3PopupMenu *menu = new Q3PopupMenu( this );
  47.213      menuBar()->insertItem( tr( "&Edit" ), menu );
  47.214  
  47.215      QAction *a;
  47.216 -    a = new QAction( tr( "Undo" ), QPixmap(editundo_xpm), tr( "&Undo" ), CTRL + Key_Z, this, "undoEvent" );
  47.217 +    a = new QAction(QPixmap(iconPath+"undo.png"), tr( "&Undo" ), this );
  47.218 +	a->setStatusTip ( tr( "Undo" ) );
  47.219 +	a->setShortcut(Qt::CTRL + Qt::Key_Z );
  47.220      connect( a, SIGNAL( activated() ), e, SLOT( undo() ) );
  47.221      a->addTo( menu );
  47.222      a->addTo( tb);
  47.223  	actionEditUndo=a;
  47.224  	
  47.225 -    a = new QAction( tr( "Redo" ), QPixmap( editredo_xpm ), tr( "&Redo" ), CTRL + Key_Y, this, "editRedo" ); 
  47.226 +    a = new QAction(QPixmap(iconPath+"redo.png" ), tr( "&Redo" ),this); 
  47.227 +	a->setStatusTip ( tr( "Redo" ) );
  47.228 +	a->setShortcut( Qt::CTRL + Qt::Key_Y );
  47.229      connect( a, SIGNAL( activated() ), e, SLOT( redo() ) );
  47.230      a->addTo( tb );
  47.231      a->addTo( menu );
  47.232  	actionEditRedo=a;
  47.233  
  47.234      menu->insertSeparator();
  47.235 -    a = new QAction( tr( "Select and copy all" ), QPixmap(), tr( "Select and copy &all" ), CTRL + Key_A, this, "editcopyall" ); 
  47.236 +    a = new QAction(QPixmap(), tr( "Select and copy &all" ),this); 
  47.237 +	a->setStatusTip ( tr( "Select and copy all" ) );
  47.238 +	a->setShortcut( Qt::CTRL + Qt::Key_A );
  47.239      connect( a, SIGNAL( activated() ), this, SLOT( editCopyAll() ) );
  47.240      a->addTo( menu );
  47.241  
  47.242      menu->insertSeparator();
  47.243 -    a = new QAction( tr( "Copy" ), QPixmap( editcopy_xpm ), tr( "&Copy" ), CTRL + Key_C, this, "editCopy" );
  47.244 +    a = new QAction(QPixmap(iconPath+"editcopy.png" ), tr( "&Copy" ),this);
  47.245 +	a->setStatusTip ( tr( "Copy" ) );
  47.246 +	a->setShortcut( Qt::CTRL + Qt::Key_C );
  47.247      connect( a, SIGNAL( activated() ), e, SLOT( copy() ) );
  47.248      a->addTo( tb );
  47.249      a->addTo( menu );
  47.250  	actionEditCopy=a;
  47.251  	
  47.252 -    a = new QAction( tr( "Cut" ), QPixmap( editcut_xpm ), tr( "Cu&t" ), CTRL + Key_X, this, "editCut" );
  47.253 +    a = new QAction(QPixmap(iconPath+"editcut.png" ), tr( "Cu&t" ),this);
  47.254 +	a->setStatusTip ( tr( "Cut" ) );
  47.255 +	a->setShortcut( Qt::CTRL + Qt::Key_X );
  47.256      connect( a, SIGNAL( activated() ), e, SLOT( cut() ) );
  47.257      a->addTo( tb );
  47.258      a->addTo( menu );
  47.259  	actionEditCut=a;
  47.260  
  47.261 -    a = new QAction( tr( "Paste" ), QPixmap( editpaste_xpm ), tr( "&Paste" ), CTRL + Key_V, this, "editPaste" );
  47.262 +    a = new QAction(QPixmap(iconPath+"editpaste.png" ), tr( "&Paste" ),this);
  47.263 +	a->setStatusTip ( tr( "Paste" ) );
  47.264 +	a->setShortcut( Qt::CTRL + Qt::Key_V );
  47.265      connect( a, SIGNAL( activated() ), e, SLOT( paste() ) );
  47.266      a->addTo( tb );
  47.267      a->addTo( menu );
  47.268  	actionEditPaste=a;
  47.269  	
  47.270 -    a = new QAction( tr( "Delete all" ), QPixmap( edittrash_xpm ), tr( "&Delete All" ), 0, this, "editDeleteAll" );
  47.271 +    a = new QAction( QPixmap( iconPath+"edittrash.png"), tr( "&Delete All" ), this);
  47.272 +	a->setStatusTip (tr( "Delete all" ) );
  47.273      connect( a, SIGNAL( activated() ), e, SLOT( clear() ) );
  47.274      a->addTo( tb );
  47.275      a->addTo( menu );
  47.276  	actionEditDeleteAll=a;
  47.277  
  47.278 -	a = new QAction( tr( "Convert paragraphs to linebreaks" ), QPixmap(), tr( "&Convert Paragraphs" ), ALT + Key_P, this, "editConvertPar" );
  47.279 +	a = new QAction(QPixmap(), tr( "&Convert Paragraphs" ),this);
  47.280 +	a->setStatusTip(tr( "Convert paragraphs to linebreaks" )); 
  47.281 +	a->setShortcut( Qt::ALT + Qt::Key_P );
  47.282      connect( a, SIGNAL( activated() ), this, SLOT( textConvertPar() ) );
  47.283      a->addTo( menu );
  47.284  	actionEditConvertPar=a;
  47.285  
  47.286 -	a = new QAction( tr( "Join all lines of a paragraph" ), QPixmap(), tr( "&Join lines" ), ALT + Key_J, this, "editJoinLines" );
  47.287 +	a = new QAction( QPixmap(), tr( "&Join lines" ), this);
  47.288 +	a->setStatusTip(tr( "Join all lines of a paragraph" ) ); 
  47.289 +	a->setShortcut(Qt::ALT + Qt::Key_J );
  47.290      connect( a, SIGNAL( activated() ), this, SLOT( textJoinLines() ) );
  47.291      a->addTo( menu );
  47.292  	actionEditJoinLines=a;
  47.293 @@ -316,14 +353,15 @@
  47.294  
  47.295  void TextEditor::setupFormatActions()
  47.296  {
  47.297 -    QToolBar *tb = new QToolBar( this );
  47.298 +    Q3ToolBar *tb = new Q3ToolBar( this );
  47.299      tb->setLabel( "Format Actions" );
  47.300 -    QPopupMenu *menu = new QPopupMenu( this );
  47.301 -    menuBar()->insertItem( tr( "&Format" ), menu );
  47.302 +    Q3PopupMenu *menu = new Q3PopupMenu( this );
  47.303 +    menuBar()->insertItem( tr( "F&ormat" ), menu );
  47.304  
  47.305      QAction *a;
  47.306  
  47.307 -    a = new QAction( tr( "Toggle font hint for the whole text" ), QPixmap(formatfixedfont_xpm), tr( "&Font hint" ), ALT + Key_I, this, "fontHint" );
  47.308 +    a = new QAction( QPixmap(iconPath+"formatfixedfont.png"), tr( "&Font hint" ), Qt::ALT + Qt::Key_I, this, "fontHint" );
  47.309 +	a->setStatusTip (tr( "Toggle font hint for the whole text" ) );
  47.310  	a->setToggleAction (true);
  47.311  	a->setOn (settings.readBoolEntry ("/vym/noteeditor/fonts/useFixedByDefault",false) );
  47.312      connect( a, SIGNAL( activated() ), this, SLOT( toggleFonthint() ) );
  47.313 @@ -341,8 +379,8 @@
  47.314      comboFont->lineEdit()->setText( QApplication::font().family() );
  47.315  
  47.316      comboSize = new QComboBox( true, tb );
  47.317 -    QValueList<int> sizes = db.standardSizes();
  47.318 -    QValueList<int>::Iterator it = sizes.begin();
  47.319 +    Q3ValueList<int> sizes = db.standardSizes();
  47.320 +    Q3ValueList<int>::Iterator it = sizes.begin();
  47.321      for ( ; it != sizes.end(); ++it )
  47.322  	comboSize->insertItem( QString::number( *it ) );
  47.323      connect( comboSize, SIGNAL( activated( const QString & ) ),
  47.324 @@ -353,69 +391,98 @@
  47.325  
  47.326      QPixmap pix( 16, 16 );
  47.327      pix.fill( e->color());
  47.328 -    actionTextColor = new QAction( pix, tr( "&Color..." ), 0, this, "textColor" );
  47.329 -    connect( actionTextColor, SIGNAL( activated() ), this, SLOT( textColor() ) );
  47.330 +    actionTextColor = new QAction( pix, tr( "&Color..." ), this);
  47.331      actionTextColor->addTo( tb );
  47.332      actionTextColor->addTo( menu );
  47.333 +    connect( actionTextColor, SIGNAL( activated() ), this, SLOT( textColor() ) );
  47.334  
  47.335 -    actionTextBold = new QAction( QPixmap (formattextbold_xpm), tr( "&Bold" ), CTRL + Key_B, this, "textBold" );
  47.336 +    actionTextBold = new QAction( QPixmap (iconPath+"text_bold.png"), tr( "&Bold" ), this);
  47.337 +	actionTextBold->setShortcut(Qt::CTRL + Qt::Key_B );
  47.338      connect( actionTextBold, SIGNAL( activated() ), this, SLOT( textBold() ) );
  47.339      actionTextBold->addTo( tb );
  47.340      actionTextBold->addTo( menu );
  47.341      actionTextBold->setToggleAction( true );
  47.342 -    actionTextItalic = new QAction( QPixmap(formattextitalic_xpm ), tr( "&Italic" ), CTRL + Key_I, this, "textItalic" );
  47.343 +    actionTextItalic = new QAction( QPixmap(iconPath+"text_italic.png"), tr( "&Italic" ),  this);
  47.344 +	actionTextItalic->setShortcut(Qt::CTRL + Qt::Key_I);
  47.345      connect( actionTextItalic, SIGNAL( activated() ), this, SLOT( textItalic() ) );
  47.346      actionTextItalic->addTo( tb );
  47.347      actionTextItalic->addTo( menu );
  47.348      actionTextItalic->setToggleAction( true );
  47.349 -    actionTextUnderline = new QAction( QPixmap (formattextunder_xpm ), tr( "&Underline" ), CTRL + Key_U, this, "textUnderline" );
  47.350 +    actionTextUnderline = new QAction( QPixmap (iconPath+"text_under.png"), tr( "&Underline" ), this);
  47.351 +	actionTextUnderline->setShortcut(Qt::CTRL + Qt::Key_U );
  47.352      connect( actionTextUnderline, SIGNAL( activated() ), this, SLOT( textUnderline() ) );
  47.353      actionTextUnderline->addTo( tb );
  47.354      actionTextUnderline->addTo( menu );
  47.355      actionTextUnderline->setToggleAction( true );
  47.356      menu->insertSeparator();
  47.357  
  47.358 -    QActionGroup *grp = new QActionGroup( this );
  47.359 +    Q3ActionGroup *grp = new Q3ActionGroup( this );
  47.360      connect( grp, SIGNAL( selected( QAction* ) ), this, SLOT( textAlign( QAction* ) ) );
  47.361  
  47.362 -    actionAlignLeft = new QAction( QPixmap (formattextleft_xpm ), tr( "&Left" ), CTRL + Key_L, grp, "textLeft" );
  47.363 +    actionAlignLeft = new QAction( QPixmap (iconPath+"text_left.png"), tr( "&Left" ),grp );
  47.364 +	actionAlignLeft->setShortcut( Qt::CTRL+Qt::Key_L );
  47.365      actionAlignLeft->setToggleAction( true );
  47.366 -    actionAlignCenter = new QAction( QPixmap (formattextcenter_xpm ), tr( "C&enter" ), CTRL + Key_E, grp, "textCenter" );
  47.367 +    actionAlignCenter = new QAction( QPixmap (iconPath+"text_center.png"), tr( "C&enter" ),grp);
  47.368 +    actionAlignCenter->setShortcut(  Qt::CTRL + Qt::Key_E);
  47.369      actionAlignCenter->setToggleAction( true );
  47.370 -    actionAlignRight = new QAction( QPixmap (formattextright_xpm ), tr( "&Right" ), CTRL + Key_R, grp, "textRight" );
  47.371 +    actionAlignRight = new QAction( QPixmap (iconPath+"text_right.png" ), tr( "&Right" ), grp);
  47.372 +	actionAlignRight->setShortcut(Qt::CTRL + Qt::Key_R );
  47.373      actionAlignRight->setToggleAction( true );
  47.374 -    actionAlignJustify = new QAction( QPixmap ( formattextjustify_xpm ), tr( "&Justify" ), CTRL + Key_J, grp, "textjustify" );
  47.375 +    actionAlignJustify = new QAction( QPixmap ( iconPath+"text_block.png"), tr( "&Justify" ), grp );
  47.376 +	actionAlignJustify->setShortcut(Qt::CTRL + Qt::Key_J );
  47.377      actionAlignJustify->setToggleAction( true );
  47.378  
  47.379      grp->addTo( tb );
  47.380      grp->addTo( menu );
  47.381  
  47.382 +    Q3ActionGroup *grp2 = new Q3ActionGroup( this );
  47.383 +    grp2->setExclusive(false);
  47.384 +    actionAlignSubScript = new QAction( QPixmap (iconPath+"text_sub.png"), tr( "Subs&cript" ),grp2 );
  47.385 +	actionAlignSubScript->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_B );
  47.386 +    actionAlignSubScript->setToggleAction( true );
  47.387 +    connect(actionAlignSubScript, SIGNAL(activated()), this, SLOT(textVAlign()));
  47.388 +
  47.389 +    actionAlignSuperScript = new QAction( QPixmap (iconPath+"text_super.png"), tr( "Su&perscript" ),grp2  );
  47.390 +	actionAlignSuperScript->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_P );
  47.391 +    actionAlignSuperScript->setToggleAction( true );
  47.392 +    connect(actionAlignSuperScript, SIGNAL(activated()), this, SLOT(textVAlign()));
  47.393 +
  47.394 +    menu->insertSeparator();
  47.395 +    
  47.396 +    grp2->addTo(tb);
  47.397 +    grp2->addTo(menu);
  47.398 +
  47.399      connect( e, SIGNAL( currentFontChanged( const QFont & ) ),
  47.400  	     this, SLOT( fontChanged( const QFont & ) ) );
  47.401      connect( e, SIGNAL( currentColorChanged( const QColor & ) ),
  47.402  	     this, SLOT( colorChanged( const QColor & ) ) );
  47.403      connect( e, SIGNAL( currentAlignmentChanged( int ) ),
  47.404  	     this, SLOT( alignmentChanged( int ) ) );
  47.405 +    connect( e, SIGNAL( currentVerticalAlignmentChanged(int)),
  47.406 +	     this, SLOT( verticalAlignmentChanged(int)));
  47.407  
  47.408  }
  47.409  
  47.410  void TextEditor::setupSettingsActions()
  47.411  {
  47.412 -    QPopupMenu *menu = new QPopupMenu( this );
  47.413 +    Q3PopupMenu *menu = new Q3PopupMenu( this );
  47.414      menuBar()->insertItem( tr( "&Settings" ), menu );
  47.415  
  47.416      QAction *a;
  47.417 -    a = new QAction( tr( "Set fixed font" ), QPixmap(), tr( "Set &fixed font" ), 0, this, "setFixedFont" );
  47.418 +    a = new QAction(tr( "Set &fixed font" ), this);
  47.419 +	a->setStatusTip ( tr( "Set fixed font" ));
  47.420      connect( a, SIGNAL( activated() ), this, SLOT( setFixedFont() ) );
  47.421      a->addTo( menu );
  47.422  	actionSettingsFixedFont=a;
  47.423  
  47.424 -    a = new QAction( tr( "Set variable font" ), QPixmap(), tr( "Set &variable font" ), 0, this, "setvariableFont" );
  47.425 +    a = new QAction(tr( "Set &variable font" ), this);
  47.426 +	a->setStatusTip ( tr( "Set variable font" ) );
  47.427      connect( a, SIGNAL( activated() ), this, SLOT( setVarFont() ) );
  47.428      a->addTo( menu );
  47.429  	actionSettingsVarFont=a;
  47.430  
  47.431 -    a = new QAction( tr( "Used fixed font by default" ), QPixmap(), tr( "&fixed font is default" ), 0, this, "fonthintDefault" );
  47.432 +    a = new QAction(tr( "&fixed font is default" ),  this);
  47.433 +	a->setStatusTip (tr( "Used fixed font by default" ) );
  47.434  	a->setToggleAction (true);
  47.435  	// set state later in constructor...
  47.436      a->addTo( menu );
  47.437 @@ -428,7 +495,7 @@
  47.438  	{
  47.439  		if (e->length()) 
  47.440  		{
  47.441 -			QMessageBox mb( "VYM - Note Editor",
  47.442 +			QMessageBox mb( __VYM " - " +tr("Note Editor"),
  47.443  				"Loading will overwrite the existing note",
  47.444  				QMessageBox::Warning,
  47.445  				QMessageBox::Yes | QMessageBox::Default,
  47.446 @@ -442,7 +509,7 @@
  47.447  			}
  47.448  		} 
  47.449  		// Load note
  47.450 -		QFileDialog *fd=new QFileDialog( this);
  47.451 +		Q3FileDialog *fd=new Q3FileDialog( this);
  47.452  		fd->addFilter ("ASCII texts (*.txt)");
  47.453  		fd->addFilter ("VYM notes (*.html)");
  47.454  		fd->show();
  47.455 @@ -453,7 +520,7 @@
  47.456  		if ( !fn.isEmpty() )
  47.457  		{
  47.458  			QFile f( fn );
  47.459 -			if ( !f.open( IO_ReadOnly ) )
  47.460 +			if ( !f.open( QIODevice::ReadOnly ) )
  47.461  			return;
  47.462  
  47.463  			QTextStream ts( &f );
  47.464 @@ -465,11 +532,10 @@
  47.465  
  47.466  void TextEditor::closeEvent( QCloseEvent* ce )
  47.467  {
  47.468 -    if ( !e->isModified() ) 
  47.469 -	{
  47.470 -		ce->accept();	// TextEditor can be reopened with show()
  47.471 -		return;
  47.472 -    }
  47.473 +    ce->accept();	// TextEditor can be reopened with show()
  47.474 +    actionViewToggleNoteEditor->setOn (false);
  47.475 +    showwithmain=false;
  47.476 +    return;
  47.477  }
  47.478  
  47.479  QString TextEditor::getText()
  47.480 @@ -479,21 +545,15 @@
  47.481  
  47.482  void TextEditor::editorChanged()
  47.483  {
  47.484 -	// received, when QTextEdit::text() has changed
  47.485 -	EditorState	oldstate=state;
  47.486 -
  47.487  	if (isEmpty())
  47.488  		state=emptyEditor;
  47.489  	else
  47.490  		state=filledEditor;
  47.491  
  47.492 -	if (state != oldstate)
  47.493 -	{
  47.494  		if (state==emptyEditor)
  47.495  			e->setPaper (emptyPaper);
  47.496  		else
  47.497  			e->setPaper (filledPaper);
  47.498 -	}
  47.499  	// SLOT is LinkableMapObj, which will update systemFlag
  47.500  	emit (textHasChanged() );
  47.501  }
  47.502 @@ -501,19 +561,19 @@
  47.503  
  47.504  void TextEditor::setText(QString t)
  47.505  {
  47.506 -	if ( !QStyleSheet::mightBeRichText( t ) )
  47.507 -		t = QStyleSheet::convertFromPlainText( t, QStyleSheetItem::WhiteSpaceNormal );
  47.508 +	if ( !Q3StyleSheet::mightBeRichText( t ) )
  47.509 +		t = Q3StyleSheet::convertFromPlainText( t, Q3StyleSheetItem::WhiteSpaceNormal );
  47.510  	e->setReadOnly(false);
  47.511  	e->setText(t);
  47.512 -	editorChanged();	//not called automagically
  47.513 +//	editorChanged();	//not called automagically  FIXME or is it?
  47.514  
  47.515  	enableActions();
  47.516  }
  47.517  
  47.518  void TextEditor::setInactive()
  47.519  {
  47.520 +	state=inactiveEditor;
  47.521  	setText("");
  47.522 -	state=inactiveEditor;
  47.523  	e->setPaper (inactivePaper);
  47.524  	e->setReadOnly (true);
  47.525  
  47.526 @@ -528,7 +588,7 @@
  47.527  
  47.528  void TextEditor::textSaveAs()
  47.529  {
  47.530 -    QString fn = QFileDialog::getSaveFileName( QString::null, "VYM Note (HTML) (*.html);;All files (*)",
  47.531 +    QString fn = Q3FileDialog::getSaveFileName( QString::null, "VYM Note (HTML) (*.html);;All files (*)",
  47.532  					       this,"export note dialog",tr("Export Note to single file") );
  47.533  
  47.534      if ( !fn.isEmpty() ) 
  47.535 @@ -536,14 +596,14 @@
  47.536  		QFile file (fn);
  47.537  		if (file.exists())
  47.538  		{
  47.539 -			QMessageBox mb( "VYM",
  47.540 +			QMessageBox mb( __VYM,
  47.541  				tr("The file ") + fn + 
  47.542  				tr(" exists already. "
  47.543  				"Do you want to overwrite it?"),
  47.544  			QMessageBox::Warning,
  47.545  			QMessageBox::Yes | QMessageBox::Default,
  47.546  			QMessageBox::Cancel | QMessageBox::Escape,
  47.547 -			QMessageBox::NoButton );
  47.548 +			Qt::NoButton );
  47.549  			mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
  47.550  			mb.setButtonText( QMessageBox::No, tr("Cancel"));
  47.551  			switch( mb.exec() ) {
  47.552 @@ -577,7 +637,7 @@
  47.553  
  47.554      QString text = e->text();
  47.555      QFile f( filename );
  47.556 -    if ( !f.open( IO_WriteOnly ) ) 
  47.557 +    if ( !f.open( QIODevice::WriteOnly ) ) 
  47.558  	{
  47.559  		statusBar()->message( QString("Could not write to %1").arg(filename),
  47.560  					  statusbarTime );
  47.561 @@ -659,38 +719,19 @@
  47.562  		e->setText(t);
  47.563  }
  47.564  
  47.565 -QString TextEditor::textConvertToASCII(const QString &t)
  47.566 -{
  47.567 -	QString r=t;
  47.568 -
  47.569 -	// convert all "<br*>" to "\n"
  47.570 -	QRegExp re("<br.*>");
  47.571 -	re.setMinimal(true);
  47.572 -	r.replace (re,"\n");
  47.573 -
  47.574 -	// convert all "</p>" to "\n"
  47.575 -	re.setPattern ("/p");
  47.576 -	r.replace (re,"\n");
  47.577 -	
  47.578 -	// remove all remaining tags 
  47.579 -	re.setPattern ("<.*>");
  47.580 -	r.replace (re,"");
  47.581 -
  47.582 -	// convert "&", "<" and ">"
  47.583 -	re.setPattern ("&gt;");
  47.584 -	r.replace (re,">");
  47.585 -	re.setPattern ("&lt;");
  47.586 -	r.replace (re,"<");
  47.587 -	re.setPattern ("&amp;");
  47.588 -	r.replace (re,"&");
  47.589 -	return r;
  47.590 -}
  47.591 -
  47.592  void TextEditor::textExportAsASCII()
  47.593  {
  47.594 -	QString text = textConvertToASCII( e->text());
  47.595 -    QString fn = QFileDialog::getSaveFileName( QString::null, "VYM Note (ASCII) (*.txt);;All files (*)",
  47.596 -					       this,"export note dialog",tr("Export Note to single file (ASCII)") );
  47.597 +	QString text = NoteObj (e->text()).getNoteASCII();
  47.598 +	QString fn,s;
  47.599 +	if (!filenameHint.isEmpty())
  47.600 +	{
  47.601 +		if (!filenameHint.contains (".txt"))
  47.602 +			s=filenameHint+".txt";
  47.603 +		else	
  47.604 +			s=filenameHint;
  47.605 +	} else	
  47.606 +		s=QString::null;
  47.607 +	fn = Q3FileDialog::getSaveFileName( s, "VYM Note (ASCII) (*.txt);;All files (*)", this,"export note dialog",tr("Export Note to single file (ASCII)") );
  47.608  	int ret=-1;
  47.609  
  47.610      if ( !fn.isEmpty() ) 
  47.611 @@ -705,7 +746,7 @@
  47.612  			QMessageBox::Warning,
  47.613  			QMessageBox::Yes | QMessageBox::Default,
  47.614  			QMessageBox::Cancel | QMessageBox::Escape,
  47.615 -			QMessageBox::NoButton );
  47.616 +			Qt::NoButton );
  47.617  			mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
  47.618  			mb.setButtonText( QMessageBox::No, tr("Cancel"));
  47.619  			ret=mb.exec();
  47.620 @@ -714,7 +755,7 @@
  47.621  			return;
  47.622  			
  47.623  		// save 
  47.624 -		if ( !file.open( IO_WriteOnly ) ) 
  47.625 +		if ( !file.open( QIODevice::WriteOnly ) ) 
  47.626  			statusBar()->message( QString("Could not write to %1").arg(filename),
  47.627  						  statusbarTime );
  47.628  		else
  47.629 @@ -737,14 +778,14 @@
  47.630  		QPainter p( printer );
  47.631  		// Check that there is a valid device to print to.
  47.632  		if ( !p.device() ) return;
  47.633 -		QPaintDeviceMetrics metrics( p.device() );
  47.634 +		Q3PaintDeviceMetrics metrics( p.device() );
  47.635  		int dpiy = metrics.logicalDpiY();
  47.636  		int margin = (int) ( (2/2.54)*dpiy ); // 2 cm margins
  47.637  		QRect body( margin, margin, metrics.width() - 2*margin, metrics.height() - 2*margin );
  47.638  		QFont font( e->currentFont() );
  47.639  		font.setPointSize( 10 ); // we define 10pt to be a nice base size for printing
  47.640  
  47.641 -		QSimpleRichText richText( e->text(), font,
  47.642 +		Q3SimpleRichText richText( e->text(), font,
  47.643  					  e->context(),
  47.644  					  e->styleSheet(),
  47.645  					  e->mimeSourceFactory(),
  47.646 @@ -838,22 +879,34 @@
  47.647  	return;
  47.648      e->setColor( col );
  47.649      QPixmap pix( 16, 16 );
  47.650 -    pix.fill( black );
  47.651 +    pix.fill( Qt::black );
  47.652      actionTextColor->setIconSet( pix );
  47.653  }
  47.654  
  47.655  void TextEditor::textAlign( QAction *a )
  47.656  {
  47.657      if ( a == actionAlignLeft )
  47.658 -	e->setAlignment( AlignLeft );
  47.659 +	e->setAlignment( Qt::AlignLeft );
  47.660      else if ( a == actionAlignCenter )
  47.661 -	e->setAlignment( AlignHCenter );
  47.662 +	e->setAlignment( Qt::AlignHCenter );
  47.663      else if ( a == actionAlignRight )
  47.664 -	e->setAlignment( AlignRight );
  47.665 +	e->setAlignment( Qt::AlignRight );
  47.666      else if ( a == actionAlignJustify )
  47.667 -	e->setAlignment( AlignJustify );
  47.668 +	e->setAlignment( Qt::AlignJustify );
  47.669  }
  47.670  
  47.671 +void TextEditor::textVAlign()
  47.672 +{
  47.673 +    if ( sender() == actionAlignSuperScript && actionAlignSuperScript->isOn()) {
  47.674 +	e->setVerticalAlignment( Q3TextEdit::AlignSuperScript);
  47.675 +    } else if (sender() == actionAlignSubScript && actionAlignSubScript->isOn()) {
  47.676 +	e->setVerticalAlignment( Q3TextEdit::AlignSubScript);
  47.677 +    } else {
  47.678 +	e->setVerticalAlignment( Q3TextEdit::AlignNormal);
  47.679 +    }
  47.680 +}
  47.681 +
  47.682 +
  47.683  void TextEditor::fontChanged( const QFont &f )
  47.684  {
  47.685      comboFont->lineEdit()->setText( f.family() );
  47.686 @@ -872,16 +925,30 @@
  47.687  
  47.688  void TextEditor::alignmentChanged( int a )
  47.689  {
  47.690 -    if ( ( a == AlignAuto ) || ( a & AlignLeft ))
  47.691 +    if ( ( a == Qt::AlignLeft ) || ( a & Qt::AlignLeft ))
  47.692  	actionAlignLeft->setOn( true );
  47.693 -    else if ( ( a & AlignHCenter ) )
  47.694 +    else if ( ( a & Qt::AlignHCenter ) )
  47.695  	actionAlignCenter->setOn( true );
  47.696 -    else if ( ( a & AlignRight ) )
  47.697 +    else if ( ( a & Qt::AlignRight ) )
  47.698  	actionAlignRight->setOn( true );
  47.699 -    else if ( ( a & AlignJustify ) )
  47.700 +    else if ( ( a & Qt::AlignJustify ) )
  47.701  	actionAlignJustify->setOn( true );
  47.702  }
  47.703  
  47.704 +void TextEditor::verticalAlignmentChanged(int a) 
  47.705 +{
  47.706 +    if (a == Q3TextEdit::AlignSuperScript ) {
  47.707 +	actionAlignSuperScript->setOn(true);
  47.708 +	actionAlignSubScript->setOn(false);
  47.709 +    } else if (a == Q3TextEdit::AlignSubScript ) {
  47.710 +	actionAlignSuperScript->setOn(false);
  47.711 +	actionAlignSubScript->setOn(true);
  47.712 +    } else {
  47.713 +	actionAlignSuperScript->setOn(false);
  47.714 +	actionAlignSubScript->setOn(false);
  47.715 +    }
  47.716 +}
  47.717 +
  47.718  
  47.719  
  47.720  void TextEditor::enableActions()
    48.1 --- a/texteditor.h	Sun Jan 30 12:58:47 2005 +0000
    48.2 +++ b/texteditor.h	Tue Jun 06 14:58:11 2006 +0000
    48.3 @@ -1,16 +1,21 @@
    48.4 +/* emacs: -*- Mode: C; c-style: "bsd"; c-basic-offset: 4; c-recognize-knr-p: nil; -*- */
    48.5  #ifndef TEXTEDITOR_H 
    48.6  #define TEXTEDITOR_H
    48.7  
    48.8 -#include <qmainwindow.h>
    48.9 -#include <qtextedit.h>
   48.10 +#include <q3mainwindow.h>
   48.11 +#include <q3textedit.h>
   48.12  #include <qaction.h>
   48.13  #include <qfontdatabase.h>
   48.14  #include <qcombobox.h>
   48.15 +//Added by qt3to4:
   48.16 +#include <QCloseEvent>
   48.17  
   48.18  
   48.19  enum EditorState {inactiveEditor,emptyEditor,filledEditor};
   48.20  
   48.21 -class TextEditor : public QMainWindow {
   48.22 +class MyTextEdit;
   48.23 +
   48.24 +class TextEditor : public Q3MainWindow {
   48.25      Q_OBJECT
   48.26  public:
   48.27      TextEditor();
   48.28 @@ -24,6 +29,8 @@
   48.29  	QString getFontHintDefault();
   48.30  	void setFilename (const QString&);
   48.31  	QString getFilename ();
   48.32 +	void setFilenameHint (const QString&);
   48.33 +	QString getFilenameHint ();
   48.34  	bool findText(const QString &, const bool &); // find Text 
   48.35  
   48.36  protected:
   48.37 @@ -54,7 +61,6 @@
   48.38      void textSave();
   48.39  	void textConvertPar();
   48.40  	void textJoinLines();
   48.41 -	QString textConvertToASCII(const QString &);
   48.42  	void textExportAsASCII();
   48.43      void textPrint();
   48.44  	void textEditUndo();
   48.45 @@ -68,17 +74,20 @@
   48.46      void textSize( const QString &p );
   48.47  	void textColor();
   48.48  	void textAlign(QAction*);
   48.49 +	void textVAlign();
   48.50      void fontChanged( const QFont &f );
   48.51      void colorChanged( const QColor &c );
   48.52      void alignmentChanged( int a );
   48.53 +    void verticalAlignmentChanged(int a);
   48.54  	void enableActions();
   48.55  	void disableActions();
   48.56  
   48.57  private:
   48.58      QPrinter *printer;
   48.59 -    QTextEdit *e;
   48.60 +    MyTextEdit *e;
   48.61  	QPoint lastPos;			// save last position of window
   48.62      QString filename;
   48.63 +    QString filenameHint;
   48.64  
   48.65  	QBrush emptyPaper;		// setting the background color
   48.66  	QBrush filledPaper;		// depending on the state
   48.67 @@ -115,9 +124,39 @@
   48.68  	*actionAlignLeft,
   48.69  	*actionAlignCenter,
   48.70  	*actionAlignRight,
   48.71 -	*actionAlignJustify;
   48.72 +	*actionAlignJustify,
   48.73 +	*actionAlignSubScript,
   48.74 +	*actionAlignSuperScript;
   48.75 +};
   48.76  
   48.77 -
   48.78 +/* Wraps currentVerticalAlignmentChanged(VerticalAlignment)
   48.79 + * to currentVerticalAlignmentChanged(int) 
   48.80 + * this way the signal can be used without use of the internal 
   48.81 + * VerticalAlignment enum of QTextEdit 
   48.82 + * If VerticalAlignment has been a global like the normal alignment there
   48.83 + * have been no problems!
   48.84 + */
   48.85 + 
   48.86 +class MyTextEdit : public Q3TextEdit 
   48.87 +{
   48.88 +    Q_OBJECT;
   48.89 + public:
   48.90 +    MyTextEdit(QWidget *parent, const char *name) : Q3TextEdit(parent, name) {
   48.91 +	connect(this, 
   48.92 +		SIGNAL(currentVerticalAlignmentChanged(VerticalAlignment)),
   48.93 +		this, 
   48.94 +		SLOT(verticalAlignmentChanged(VerticalAlignment)));
   48.95 +    }
   48.96 +    int verticalAlignment() const { return m_verticalAlignment; } 
   48.97 + signals:
   48.98 +    void currentVerticalAlignmentChanged(int a);
   48.99 + public slots:
  48.100 +    void verticalAlignmentChanged(VerticalAlignment a) {
  48.101 +     m_verticalAlignment = a;
  48.102 +	emit currentVerticalAlignmentChanged((int)a);
  48.103 +    }
  48.104 + private: 
  48.105 + int m_verticalAlignment;
  48.106  };
  48.107  
  48.108  #endif
    49.1 --- a/version.h	Sun Jan 30 12:58:47 2005 +0000
    49.2 +++ b/version.h	Tue Jun 06 14:58:11 2006 +0000
    49.3 @@ -1,7 +1,8 @@
    49.4  #ifndef VERSION_H 
    49.5  #define VERSION_H
    49.6  
    49.7 -#define __VYM_VERSION__ "1.6.0"
    49.8 -#define __BUILD_DATE__ "January 4, 2005"
    49.9 +#define __VYM "VYM"
   49.10 +#define __VYM_VERSION "1.7.50"
   49.11 +#define __BUILD_DATE "June 5, 2006"
   49.12  
   49.13  #endif
    50.1 --- a/vym.pro	Sun Jan 30 12:58:47 2005 +0000
    50.2 +++ b/vym.pro	Tue Jun 06 14:58:11 2006 +0000
    50.3 @@ -1,31 +1,15 @@
    50.4 -TARGET  = vym
    50.5 -TRANSLATIONS += vym_de.ts
    50.6 -
    50.7  TEMPLATE	= app
    50.8  LANGUAGE	= C++
    50.9  
   50.10  CONFIG	+= qt warn_on release
   50.11 +QT += qt3support
   50.12  
   50.13 -DESTROOT = /usr
   50.14 -
   50.15 -target.path = $${DESTROOT}/bin
   50.16 -INSTALLS += target
   50.17 -
   50.18 -support.files = styles/ scripts/ icons/
   50.19 -support.path = $${DESTROOT}/share/vym
   50.20 -INSTALLS += support 
   50.21 -
   50.22 -doc.files = doc/*
   50.23 -doc.path = $${DESTROOT}/share/doc/packages/vym
   50.24 -INSTALLS += doc
   50.25 -
   50.26 -demo.files = demos/
   50.27 -demo.path = $${DESTROOT}/share/vym
   50.28 -INSTALLS += demo
   50.29 -
   50.30 -
   50.31 -HEADERS	+= branchobj.h \
   50.32 +HEADERS	+= aboutdialog.h \
   50.33 +	api.h \
   50.34 +	branchobj.h \
   50.35 +	exportoofiledialog.h \
   50.36  	exports.h \
   50.37 +	file.h \
   50.38  	findwindow.h \
   50.39  	flagobj.h \
   50.40  	flagrowobj.h \
   50.41 @@ -34,7 +18,9 @@
   50.42  	frameobj.h \
   50.43  	headingobj.h \
   50.44  	imageobj.h \
   50.45 +	imports.h \
   50.46  	linkablemapobj.h \
   50.47 +	xlinkobj.h \
   50.48  	mainwindow.h \
   50.49  	mapcenterobj.h \
   50.50  	mapeditor.h \
   50.51 @@ -47,10 +33,16 @@
   50.52  	texteditor.h \
   50.53  	version.h \
   50.54  	xml.h \
   50.55 +	xsltproc.h \
   50.56  	settings.h \
   50.57  	options.h
   50.58 -SOURCES	+= branchobj.cpp \
   50.59 +
   50.60 +SOURCES	+= aboutdialog.cpp \
   50.61 +	api.cpp \
   50.62 +	branchobj.cpp \
   50.63 +	exportoofiledialog.cpp \
   50.64  	exports.cpp \
   50.65 +	file.cpp \
   50.66  	findwindow.cpp \
   50.67  	flagobj.cpp \
   50.68  	flagrowobj.cpp \
   50.69 @@ -59,7 +51,9 @@
   50.70  	frameobj.cpp \
   50.71  	headingobj.cpp \
   50.72  	imageobj.cpp \
   50.73 +	imports.cpp \
   50.74  	linkablemapobj.cpp \
   50.75 +	xlinkobj.cpp \
   50.76  	main.cpp \
   50.77  	mainwindow.cpp \
   50.78  	mapcenterobj.cpp \
   50.79 @@ -72,10 +66,44 @@
   50.80  	selection.cpp \
   50.81  	texteditor.cpp \
   50.82  	xml.cpp \
   50.83 +	xsltproc.cpp \
   50.84  	settings.cpp \
   50.85  	options.cpp
   50.86 -FORMS	= exporthtmldialog.ui \
   50.87 -	exportxhtmldialog.ui \
   50.88 +
   50.89 +#The following line was changed from FORMS to FORMS3 by qt3to4
   50.90 +FORMS3	= exportxhtmldialog.ui \
   50.91  	showtextdialog.ui \
   50.92 -	extrainfodialog.ui
   50.93 +	extrainfodialog.ui \
   50.94 +	editxlinkdialog.ui \
   50.95 +	warningdialog.ui
   50.96  
   50.97 +TARGET  = vym
   50.98 +TRANSLATIONS += lang/vym_de.ts
   50.99 +TRANSLATIONS += lang/vym_en.ts
  50.100 +TRANSLATIONS += lang/vym_es.ts
  50.101 +TRANSLATIONS += lang/vym_it.ts
  50.102 +
  50.103 +
  50.104 +
  50.105 +DESTROOT = /usr
  50.106 +
  50.107 +target.path = $${DESTROOT}/bin
  50.108 +INSTALLS += target
  50.109 +
  50.110 +support.files = styles/ scripts/ icons/ flags/ lang/
  50.111 +support.path = $${DESTROOT}/share/vym
  50.112 +INSTALLS += support 
  50.113 +
  50.114 +doc.files = tex/vym.pdf 
  50.115 +doc.path = $${DESTROOT}/share/doc/packages/vym
  50.116 +INSTALLS += doc
  50.117 +
  50.118 +demo.files = demos/
  50.119 +demo.path = $${DESTROOT}/share/doc/packages/vym
  50.120 +INSTALLS += demo
  50.121 +
  50.122 +#The following line was inserted by qt3to4
  50.123 +QT += xml  
  50.124 +#The following line was inserted by qt3to4
  50.125 +CONFIG += uic3
  50.126 +
    51.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.2 +++ b/warningdialog.ui.h	Tue Jun 06 14:58:11 2006 +0000
    51.3 @@ -0,0 +1,50 @@
    51.4 +//Added by qt3to4:
    51.5 +#include <QPixmap>
    51.6 +/****************************************************************************
    51.7 +** ui.h extension file, included from the uic-generated form implementation.
    51.8 +**
    51.9 +** If you want to add, delete, or rename functions or slots, use
   51.10 +** Qt Designer to update this file, preserving your code.
   51.11 +**
   51.12 +** You should not define a constructor or destructor in this file.
   51.13 +** Instead, write your code in functions called init() and destroy().
   51.14 +** These will automatically be called by the form's constructor and
   51.15 +** destructor.
   51.16 +*****************************************************************************/
   51.17 +
   51.18 +void WarningDialog::init()
   51.19 +{
   51.20 +	warningSign->setPixmap (QPixmap("icons/vym.png"));
   51.21 +	setCancelButton (false);
   51.22 +	okButton->setText(tr("Proceed"));
   51.23 +	showAgainBox->setText (tr("Show this message again"));
   51.24 +	useShowAgain=false;
   51.25 +	showAgainBox->hide();
   51.26 +}
   51.27 +
   51.28 +void WarningDialog::setCancelButton (bool b)
   51.29 +{
   51.30 +	if (b)
   51.31 +	{
   51.32 +		cancelButton->show();
   51.33 +		cancelButton->setText(tr("Cancel"));
   51.34 +	} else
   51.35 +		cancelButton->hide();
   51.36 +}
   51.37 +
   51.38 +void WarningDialog::setShowAgainName (const QString &s)
   51.39 +{
   51.40 +	showAgainName=s;
   51.41 +	useShowAgain=true;
   51.42 +	showAgainBox->show();
   51.43 +}
   51.44 +
   51.45 +void WarningDialog::setText (const QString &s)
   51.46 +{
   51.47 +	textLabel->setText(s);
   51.48 +}
   51.49 +
   51.50 +void WarningDialog::setCaption(const QString &s)
   51.51 +{
   51.52 +	QDialog::setCaption("VYM - "+s);
   51.53 +}
    52.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.2 +++ b/xlinkobj.cpp	Tue Jun 06 14:58:11 2006 +0000
    52.3 @@ -0,0 +1,302 @@
    52.4 +#include "xlinkobj.h"
    52.5 +#include "branchobj.h"
    52.6 +#include "mapeditor.h"
    52.7 +//Added by qt3to4:
    52.8 +#include <Q3PointArray>
    52.9 +
   52.10 +
   52.11 +/////////////////////////////////////////////////////////////////
   52.12 +// XLinkObj
   52.13 +/////////////////////////////////////////////////////////////////
   52.14 +
   52.15 +int XLinkObj::arrowSize=10;						// make instances 
   52.16 +
   52.17 +XLinkObj::XLinkObj ():MapObj() 
   52.18 +{
   52.19 +	//	cout << "Const XLinkObj ()\n";
   52.20 +	init();
   52.21 +}
   52.22 +
   52.23 +XLinkObj::XLinkObj (Q3Canvas* c):MapObj(c)
   52.24 +{
   52.25 +	//	cout << "Const XLinkObj (c)  called from MapCenterObj (c)\n";
   52.26 +	init();
   52.27 +}
   52.28 +
   52.29 +
   52.30 +XLinkObj::~XLinkObj ()
   52.31 +{
   52.32 +	//	cout << "Destr XLinkObj\n";
   52.33 +	if (xLinkState!=undefinedXLink)
   52.34 +		deactivate();
   52.35 +	delete (line);
   52.36 +	delete (poly);
   52.37 +}
   52.38 +
   52.39 +
   52.40 +void XLinkObj::init () 
   52.41 +{
   52.42 +	beginBranch=NULL;
   52.43 +	endBranch=NULL;
   52.44 +	visBranch=NULL;
   52.45 +	xLinkState=undefinedXLink;
   52.46 +
   52.47 +	color=QColor (180,180,180);
   52.48 +	line=new Q3CanvasLine (canvas);
   52.49 +	width=1;
   52.50 +	line->setPen (QPen(color, width));
   52.51 +	line->setZ (Z_XLINK);
   52.52 +
   52.53 +	poly=new Q3CanvasPolygon (canvas);
   52.54 +	poly->setBrush( color );
   52.55 +	poly->setZ (Z_XLINK);
   52.56 +
   52.57 +	setVisibility (false);
   52.58 +}
   52.59 +
   52.60 +void XLinkObj::copy (XLinkObj* other)
   52.61 +{
   52.62 +	// TODO copy not used yet
   52.63 +	MapObj::copy (other);
   52.64 +	setVisibility (other->visible);
   52.65 +	beginBranch=other->beginBranch;
   52.66 +	endBranch=other->endBranch;
   52.67 +	width=other->width;
   52.68 +}
   52.69 +
   52.70 +void XLinkObj::setBegin (BranchObj *bo)
   52.71 +{
   52.72 +	if (bo) 
   52.73 +	{
   52.74 +		xLinkState=initXLink;
   52.75 +		beginBranch=bo;
   52.76 +		beginPos=beginBranch->getChildPos();
   52.77 +	}	
   52.78 +}
   52.79 +
   52.80 +BranchObj* XLinkObj::getBegin ()
   52.81 +{
   52.82 +	return beginBranch;
   52.83 +}
   52.84 +
   52.85 +void XLinkObj::setEnd (BranchObj *bo)
   52.86 +{
   52.87 +	if (bo) 
   52.88 +	{
   52.89 +		xLinkState=initXLink;
   52.90 +		endBranch=bo;
   52.91 +		endPos=endBranch->getChildPos();
   52.92 +	}		
   52.93 +}
   52.94 +
   52.95 +BranchObj* XLinkObj::getEnd()
   52.96 +{
   52.97 +	return endBranch;
   52.98 +}
   52.99 +
  52.100 +void XLinkObj::setWidth (int w)
  52.101 +{
  52.102 +	width=w;
  52.103 +	setColor (color);
  52.104 +}
  52.105 +
  52.106 +int XLinkObj::getWidth()
  52.107 +{
  52.108 +	return width;
  52.109 +}
  52.110 +
  52.111 +void XLinkObj::setColor(QColor c)
  52.112 +{
  52.113 +	color=c;
  52.114 +	line->setPen (QPen(color, width));
  52.115 +	poly->setBrush( color );
  52.116 +}
  52.117 +
  52.118 +QColor XLinkObj::getColor()
  52.119 +{
  52.120 +	return color;
  52.121 +}
  52.122 +
  52.123 +void XLinkObj::setEnd (QPoint p)
  52.124 +{
  52.125 +	endPos=p;
  52.126 +}
  52.127 +
  52.128 +bool XLinkObj::activate ()
  52.129 +{
  52.130 +	if (beginBranch && endBranch)
  52.131 +	{
  52.132 +		if (beginBranch==endBranch) return false;
  52.133 +		xLinkState=activeXLink;
  52.134 +		beginBranch->addXLink (this);
  52.135 +		endBranch->addXLink (this);
  52.136 +		setVisibility ();
  52.137 +		return true;
  52.138 +	} else
  52.139 +		return false;
  52.140 +}
  52.141 +
  52.142 +void XLinkObj::deactivate ()
  52.143 +{
  52.144 +	if (beginBranch)
  52.145 +		beginBranch->removeXLinkRef (this);
  52.146 +	beginBranch=NULL;	
  52.147 +	if (endBranch)
  52.148 +		endBranch->removeXLinkRef (this);
  52.149 +	endBranch=NULL;	
  52.150 +	visBranch=NULL;
  52.151 +	xLinkState=undefinedXLink;
  52.152 +
  52.153 +	line->hide();
  52.154 +}
  52.155 +
  52.156 +bool XLinkObj::isUsed()
  52.157 +{
  52.158 +	if (beginBranch || endBranch || xLinkState!=undefinedXLink)
  52.159 +		return true;
  52.160 +	else
  52.161 +		return false;
  52.162 +}
  52.163 +
  52.164 +void XLinkObj::updateXLink()
  52.165 +{
  52.166 +	QPoint a,b;
  52.167 +	Q3PointArray pa (3);
  52.168 +	if (visBranch)
  52.169 +	{
  52.170 +		// Only one of the linked branches is visible
  52.171 +		a=b=visBranch->getChildPos();
  52.172 +		if (visBranch->getOrientation()==OrientRightOfCenter)
  52.173 +		{
  52.174 +			b.setX (b.x()+25);
  52.175 +			pa.putPoints (0,3,
  52.176 +				b.x(),b.y(),
  52.177 +				b.x()-arrowSize,b.y()-arrowSize,
  52.178 +				b.x()-arrowSize,b.y()+arrowSize
  52.179 +			);
  52.180 +			poly->setPoints (pa);
  52.181 +		} else
  52.182 +		{
  52.183 +			b.setX (b.x()-25);
  52.184 +			pa.putPoints (0,3,
  52.185 +				b.x(),b.y(),
  52.186 +				b.x()+arrowSize,b.y()-arrowSize,
  52.187 +				b.x()+arrowSize,b.y()+arrowSize);
  52.188 +			poly->setPoints (pa);
  52.189 +		}	
  52.190 +	} else
  52.191 +	{
  52.192 +		// Both linked branches are visible
  52.193 +		if (beginBranch)
  52.194 +			// If a link is just drawn in the editor,
  52.195 +			// we have already a beginBranch
  52.196 +			a=beginBranch->getChildPos();
  52.197 +		else
  52.198 +			// This shouldn't be reached normally...
  52.199 +			a=beginPos;
  52.200 +		if (xLinkState==activeXLink && endBranch)
  52.201 +			b=endBranch->getChildPos();
  52.202 +		else
  52.203 +			b=endPos;
  52.204 +	}
  52.205 +
  52.206 +
  52.207 +	if (line->startPoint()==a && line->endPoint()==b && !visBranch)
  52.208 +	{
  52.209 +		// update is called from both branches, so only
  52.210 +		// update if something has changed
  52.211 +		return;
  52.212 +	}	
  52.213 +	else
  52.214 +	{
  52.215 +		beginPos=a;
  52.216 +		endPos=b;
  52.217 +		line->setPen (QPen(color, width));
  52.218 +		line->setPoints (a.x(), a.y(), b.x(), b.y());
  52.219 +	}
  52.220 +}
  52.221 +
  52.222 +BranchObj* XLinkObj::otherBranch(BranchObj* thisBranch)
  52.223 +{
  52.224 +	if (!beginBranch && !endBranch)
  52.225 +		return NULL;
  52.226 +	if (thisBranch==beginBranch)
  52.227 +		return endBranch;
  52.228 +	else	
  52.229 +		return beginBranch;
  52.230 +}
  52.231 +
  52.232 +void XLinkObj::positionBBox()
  52.233 +{
  52.234 +}
  52.235 +
  52.236 +void XLinkObj::calcBBoxSize()
  52.237 +{
  52.238 +}
  52.239 +
  52.240 +void XLinkObj::setVisibility (bool b)
  52.241 +{
  52.242 +	MapObj::setVisibility (b);
  52.243 +	if (b)
  52.244 +	{
  52.245 +		line->show();
  52.246 +		if (visBranch) 
  52.247 +			poly->show();
  52.248 +		else	
  52.249 +			poly->hide();
  52.250 +	}	
  52.251 +	else
  52.252 +	{
  52.253 +		line->hide();
  52.254 +		poly->hide();
  52.255 +	}	
  52.256 +}
  52.257 +
  52.258 +void XLinkObj::setVisibility ()
  52.259 +{
  52.260 +	if (beginBranch && endBranch)
  52.261 +	{
  52.262 +		if(beginBranch->isVisibleObj() && endBranch->isVisibleObj())
  52.263 +		{	// Both ends are visible
  52.264 +			visBranch=NULL;
  52.265 +			setVisibility (true);
  52.266 +		} else
  52.267 +		{
  52.268 +			if(!beginBranch->isVisibleObj() && !endBranch->isVisibleObj())
  52.269 +			{	//None of the ends is visible
  52.270 +				visBranch=NULL;
  52.271 +				setVisibility (false);
  52.272 +			} else
  52.273 +			{	// Just one end is visible, draw a symbol that shows
  52.274 +				// that there is a link to a scrolled branch
  52.275 +				if (beginBranch->isVisibleObj())
  52.276 +					visBranch=beginBranch;
  52.277 +				else
  52.278 +					visBranch=endBranch;
  52.279 +				setVisibility (true);
  52.280 +			}
  52.281 +		}
  52.282 +	}
  52.283 +}
  52.284 +
  52.285 +QString XLinkObj::saveToDir ()
  52.286 +{
  52.287 +	QString s="";
  52.288 +	if (beginBranch && endBranch &&xLinkState==activeXLink)
  52.289 +	{
  52.290 +		if (beginBranch==endBranch && xLinkState)
  52.291 +			s="";
  52.292 +		else
  52.293 +		{
  52.294 +			QString colAttr=attribut ("color",color.name());
  52.295 +			QString widAttr=attribut ("width",QString().setNum(width,10));
  52.296 +			QString begSelAttr=attribut ("beginBranch",beginBranch->getSelectString());
  52.297 +			QString endSelAttr=attribut ("endBranch",  endBranch->getSelectString());
  52.298 +			s=beginElement ("xlink", colAttr +widAttr +begSelAttr +endSelAttr);
  52.299 +
  52.300 +			s+=endElement ("xlink");
  52.301 +		}
  52.302 +	}
  52.303 +	return s;
  52.304 +}
  52.305 +
    53.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.2 +++ b/xlinkobj.h	Tue Jun 06 14:58:11 2006 +0000
    53.3 @@ -0,0 +1,50 @@
    53.4 +#ifndef XLINKOBJ_H
    53.5 +#define XLINKOBJ_H
    53.6 +
    53.7 +#include "linkablemapobj.h"
    53.8 +
    53.9 +enum XLinkState {undefinedXLink,initXLink,activeXLink,deleteXLink};
   53.10 +
   53.11 +/////////////////////////////////////////////////////////////////////////////
   53.12 +class XLinkObj:public MapObj {
   53.13 +public:
   53.14 +    XLinkObj ();
   53.15 +    XLinkObj (Q3Canvas*);
   53.16 +    ~XLinkObj ();
   53.17 +    virtual void init ();
   53.18 +    virtual void copy (XLinkObj*);
   53.19 +	void setBegin (BranchObj*);
   53.20 +	BranchObj* getBegin();
   53.21 +	void setEnd   (BranchObj*);
   53.22 +	void setEnd   (QPoint);
   53.23 +	BranchObj* getEnd();
   53.24 +	void setColor(QColor);
   53.25 +	QColor getColor();
   53.26 +	void setWidth (int);
   53.27 +	int getWidth ();
   53.28 +	bool activate ();			// Sets pointers in branchObjects
   53.29 +	void deactivate();			// removes those pointers
   53.30 +	bool isUsed();				// true, if at least on branch uses it
   53.31 +	void updateXLink();
   53.32 +	BranchObj* otherBranch (BranchObj*);
   53.33 +	void positionBBox();
   53.34 +	void calcBBoxSize();
   53.35 +	void setVisibility (bool);
   53.36 +	void setVisibility ();
   53.37 +	QString saveToDir ();
   53.38 +
   53.39 +private:
   53.40 +	static int arrowSize;
   53.41 +	QColor color;
   53.42 +	int width;
   53.43 +	Q3CanvasLine *line;
   53.44 +	Q3CanvasPolygon *poly;
   53.45 +	BranchObj *beginBranch;
   53.46 +	BranchObj *endBranch;
   53.47 +	BranchObj *visBranch;	// the "visible" part of a partially scrolled link
   53.48 +	XLinkState xLinkState;	// init during drawing or active
   53.49 +	QPoint beginPos;
   53.50 +	QPoint   endPos;
   53.51 +};
   53.52 +
   53.53 +#endif
    54.1 --- a/xml.cpp	Sun Jan 30 12:58:47 2005 +0000
    54.2 +++ b/xml.cpp	Tue Jun 06 14:58:11 2006 +0000
    54.3 @@ -2,16 +2,20 @@
    54.4  
    54.5  #include <qmessagebox.h>
    54.6  #include <qcolor.h>
    54.7 -#include <qstylesheet.h>
    54.8 +#include <q3stylesheet.h>
    54.9 +//Added by qt3to4:
   54.10 +#include <QTextStream>
   54.11  #include <iostream>
   54.12  
   54.13  #include "misc.h"
   54.14  #include "settings.h"
   54.15 +#include "linkablemapobj.h"
   54.16  
   54.17  #include "version.h"
   54.18  
   54.19  static BranchObj *lastBranch;
   54.20  static FloatObj *lastFloat;
   54.21 +static OrnamentedObj *lastOO;
   54.22  
   54.23  extern Settings settings;
   54.24  
   54.25 @@ -47,7 +51,7 @@
   54.26                      const QString& eName, const QXmlAttributes& atts ) 
   54.27  {
   54.28      QColor col;
   54.29 -//	cout << "startElement <"<<eName<<">  state="<<state <<"  laststate="<<laststate<<endl;
   54.30 +	//cout << "startElement <"<<eName<<">  state="<<state <<"  laststate="<<laststate<<"   loadMode="<<loadMode<<endl;
   54.31      if ( state == StateInit && (eName == "vymmap")  ) 
   54.32  	{
   54.33          state = StateMap;
   54.34 @@ -59,7 +63,7 @@
   54.35  				   "<h3>Map is newer than VYM</h3>"
   54.36  				   "<p>The map you are just trying to load was "
   54.37  				   "saved using vym " +atts.value("version")+". "
   54.38 -				   "The version of this vym is " __VYM_VERSION__
   54.39 +				   "The version of this vym is " __VYM_VERSION
   54.40  				   ". If you run into problems after pressing "
   54.41  				   "the ok-button below, updating vym should help.");
   54.42  
   54.43 @@ -105,6 +109,15 @@
   54.44  				col.setNamedColor(atts.value("linkColor"));
   54.45  				me->setLinkColor(col);
   54.46  			}	
   54.47 +			if (!atts.value( "defXLinkColor").isEmpty() ) 
   54.48 +			{
   54.49 +				col.setNamedColor(atts.value("defXLinkColor"));
   54.50 +				me->setDefXLinkColor(col);
   54.51 +			}	
   54.52 +			if (!atts.value( "defXLinkWidth").isEmpty() ) 
   54.53 +			{
   54.54 +				me->setDefXLinkWidth(atts.value("defXLinkWidth").toInt ());
   54.55 +			}	
   54.56  		}	
   54.57  	} else if ( eName == "select" && state == StateMap ) 
   54.58  	{
   54.59 @@ -129,7 +142,7 @@
   54.60  			if (lmo && (typeid(*lmo) == typeid(BranchObj) ) 
   54.61  			        || (typeid(*lmo) == typeid(MapCenterObj) ) )
   54.62  			{
   54.63 -				lastBranch=(BranchObj*)(lmo);
   54.64 +				lastBranch=(BranchObj*)lmo;
   54.65  				if (loadMode==ImportAdd)
   54.66  				{
   54.67  					lastBranch->addBranch();
   54.68 @@ -149,7 +162,7 @@
   54.69  		if (!atts.value( "textColor").isEmpty() ) 
   54.70  		{
   54.71  			col.setNamedColor(atts.value("textColor"));
   54.72 -			lastBranch->setColor(col ,false );
   54.73 +			lastBranch->setColor(col );
   54.74  		}	    
   54.75  	} else if ( eName == "note" && state == StateMapCenter) 
   54.76  	{	// only for backward compatibility (<1.4.6). Use htmlnote now.
   54.77 @@ -165,26 +178,43 @@
   54.78          lastBranch->addFloatImage();
   54.79  		lastFloat=lastBranch->getLastFloatImage();
   54.80  		if (!readFloatImageAttr(atts)) return false;
   54.81 -	} else if ( eName == "branch" && state == StateMap) 
   54.82 +	} else if ( (eName == "branch"||eName=="floatimage") && state == StateMap) 
   54.83  	{
   54.84  		// This is used in vymparts, which have no mapcenter!
   54.85  		isVymPart=true;
   54.86 -		state=StateBranch;
   54.87  		LinkableMapObj* lmo=me->getSelection();
   54.88 +		if (!lmo)
   54.89 +		{
   54.90 +			// If a vym part is _loaded_ (not imported), 
   54.91 +			// selection==lmo==NULL
   54.92 +			// Treat it like ImportAdd then...
   54.93 +			loadMode=ImportAdd;
   54.94 +			lmo=mc;
   54.95 +		}	
   54.96  		if (lmo && (typeid(*lmo) == typeid(BranchObj) ) 
   54.97  				|| (typeid(*lmo) == typeid(MapCenterObj) ) )
   54.98  		{
   54.99  			lastBranch=(BranchObj*)(lmo);
  54.100 -			if (loadMode==ImportAdd)
  54.101 +			if (eName=="branch")
  54.102  			{
  54.103 -				lastBranch->addBranch();
  54.104 -				lastBranch=lastBranch->getLastBranch();
  54.105 -			} else
  54.106 -				lastBranch->clear();
  54.107 -		} else
  54.108 -			return false;
  54.109 -		branchDepth=1;
  54.110 -		readBranchAttr (atts);
  54.111 +				state=StateBranch;
  54.112 +				if (loadMode==ImportAdd)
  54.113 +				{
  54.114 +					lastBranch->addBranch();
  54.115 +					lastBranch=lastBranch->getLastBranch();
  54.116 +					
  54.117 +				} else
  54.118 +					lastBranch->clear();
  54.119 +				branchDepth=1;
  54.120 +				readBranchAttr (atts);
  54.121 +			} else if (eName=="floatimage")
  54.122 +			{
  54.123 +				state=StateFloatImage;
  54.124 +				lastBranch->addFloatImage();
  54.125 +				lastFloat=lastBranch->getLastFloatImage();
  54.126 +				if (!readFloatImageAttr(atts)) return false;
  54.127 +			} else return false;
  54.128 +		} else return false;
  54.129  	} else if ( eName == "branch" && state == StateMapCenter) 
  54.130  	{
  54.131  		state=StateBranch;
  54.132 @@ -201,7 +231,7 @@
  54.133  		if (!atts.value( "textColor").isEmpty() ) 
  54.134  		{
  54.135  			col.setNamedColor(atts.value("textColor"));
  54.136 -			lastBranch->setColor(col ,false );
  54.137 +			lastBranch->setColor(col );
  54.138  		}	    
  54.139      } else if ( eName == "note" && state == StateBranch) 
  54.140  	{
  54.141 @@ -220,6 +250,10 @@
  54.142          lastBranch->addFloatImage();
  54.143  		lastFloat=lastBranch->getLastFloatImage();
  54.144  		if (!readFloatImageAttr(atts)) return false;
  54.145 +    } else if ( eName == "xlink" && state == StateBranch ) 
  54.146 +	{
  54.147 +		state=StateBranchXLink;
  54.148 +		if (!readXLinkAttr (atts)) return false;
  54.149      } else if ( eName == "branch" && state == StateBranch ) 
  54.150  	{
  54.151          lastBranch->addBranch();
  54.152 @@ -255,6 +289,7 @@
  54.153          case StateMapCenterHeading: state=StateMapCenter;  return true;
  54.154          case StateMapCenterNote: state=StateMapCenter;  return true;
  54.155          case StateMapCenterFloatImage: state=StateMapCenter;  return true;
  54.156 +        case StateFloatImage: state=StateMap; return true;
  54.157          case StateBranch: 
  54.158              if (branchDepth>1) 
  54.159  			{
  54.160 @@ -274,6 +309,7 @@
  54.161          case StateBranchHeading: state=StateBranch;  return true;
  54.162          case StateBranchNote: state=StateBranch; return true;
  54.163          case StateBranchFloatImage: state=StateBranch;  return true;
  54.164 +        case StateBranchXLink: state=StateBranch;  return true;
  54.165          case StateHtmlNote: state=laststate; return true;
  54.166          case StateHtml: 
  54.167  			htmldata+="</"+eName+">";
  54.168 @@ -349,11 +385,27 @@
  54.169  
  54.170  bool mapBuilderHandler::fatalError( const QXmlParseException& exception ) 
  54.171  {
  54.172 -    errorProt += QString( "fatal parsing error: %1 in line %2, column %3\n")
  54.173 +    errorProt += QString( "Fatal parsing error: %1 in line %2, column %3\n")
  54.174      .arg( exception.message() )
  54.175      .arg( exception.lineNumber() )
  54.176      .arg( exception.columnNumber() );
  54.177 -
  54.178 +	// Try to read the bogus line
  54.179 +	errorProt+=QString("File is: %1\n").arg(inputFile);
  54.180 +	QString s;
  54.181 +	if (loadStringFromDisk (inputFile,s))
  54.182 +	{
  54.183 +		QStringList sl=QStringList::split ("\n",s);
  54.184 +		int i=1;
  54.185 +		QStringList::Iterator it = sl.begin();
  54.186 +		while (i<exception.lineNumber()-1)
  54.187 +		{
  54.188 +			it++;
  54.189 +			i++;
  54.190 +		}
  54.191 +		s=*it;
  54.192 +		s.insert (exception.columnNumber()-1,"<ERROR>");
  54.193 +		errorProt+=s;
  54.194 +    }
  54.195      return QXmlDefaultHandler::fatalError( exception );
  54.196  }
  54.197  
  54.198 @@ -368,6 +420,11 @@
  54.199  	tmpDir=tp;
  54.200  }
  54.201  
  54.202 +void mapBuilderHandler::setInputFile (QString f)
  54.203 +{
  54.204 +	inputFile=f;
  54.205 +}
  54.206 +
  54.207  void mapBuilderHandler::setLoadMode (const LoadMode &lm)
  54.208  {
  54.209  	loadMode=lm;
  54.210 @@ -375,28 +432,65 @@
  54.211  
  54.212  bool mapBuilderHandler::readBranchAttr (const QXmlAttributes& a)
  54.213  {
  54.214 -	bool okx,oky;
  54.215 -	int x,y;
  54.216 -	if (!a.value( "absPosX").isEmpty() && loadMode==NewMap && branchDepth<2) 
  54.217 -	{
  54.218 -		if (!a.value( "absPosY").isEmpty() ) 
  54.219 -		{
  54.220 -			x=a.value("absPosX").toInt (&okx, 10);
  54.221 -			y=a.value("absPosY").toInt (&oky, 10);
  54.222 -			if (okx && oky) 
  54.223 -				lastBranch->move(x,y);
  54.224 -			else
  54.225 -				return false;   // Couldn't read absPos
  54.226 -		}           
  54.227 -	}           
  54.228 +	lastOO=lastBranch;
  54.229 +	if (!readOOAttr(a)) return false;
  54.230 +
  54.231  	if (!a.value( "scrolled").isEmpty() )
  54.232  		lastBranch->toggleScroll();
  54.233 -	if (!a.value( "url").isEmpty() ) 
  54.234 -		lastBranch->setURL (a.value ("url"));
  54.235 -	if (!a.value( "vymLink").isEmpty() ) 
  54.236 -		lastBranch->setVymLink (a.value ("vymLink"));
  54.237  	if (!a.value( "frameType").isEmpty() ) 
  54.238  		lastBranch->setFrameType (a.value("frameType"));
  54.239 +
  54.240 +	if (!a.value( "incImgV").isEmpty() ) 
  54.241 +	{	
  54.242 +		if (a.value("incImgV")=="true")
  54.243 +			lastBranch->setIncludeImagesVer(true);
  54.244 +		else	
  54.245 +			lastBranch->setIncludeImagesVer(false);
  54.246 +	}	
  54.247 +	if (!a.value( "incImgH").isEmpty() ) 
  54.248 +	{	
  54.249 +		if (a.value("incImgH")=="true")
  54.250 +			lastBranch->setIncludeImagesHor(true);
  54.251 +		else	
  54.252 +			lastBranch->setIncludeImagesHor(false);
  54.253 +	}	
  54.254 +	return true;	
  54.255 +}
  54.256 +
  54.257 +bool mapBuilderHandler::readOOAttr (const QXmlAttributes& a)
  54.258 +{
  54.259 +	if (lastOO)
  54.260 +	{
  54.261 +		bool okx,oky;
  54.262 +		int x,y;
  54.263 +		if (!a.value( "absPosX").isEmpty() && loadMode==NewMap && branchDepth<2) 
  54.264 +		{
  54.265 +			if (!a.value( "absPosY").isEmpty() ) 
  54.266 +			{
  54.267 +				x=a.value("absPosX").toInt (&okx, 10);
  54.268 +				y=a.value("absPosY").toInt (&oky, 10);
  54.269 +				if (okx && oky  )
  54.270 +					lastOO->move(x,y);
  54.271 +				else
  54.272 +					return false;   // Couldn't read absPos
  54.273 +			}           
  54.274 +		}           
  54.275 +		if (!a.value( "url").isEmpty() ) 
  54.276 +			lastOO->setURL (a.value ("url"));
  54.277 +		if (!a.value( "vymLink").isEmpty() ) 
  54.278 +			lastOO->setVymLink (a.value ("vymLink"));
  54.279 +		if (!a.value( "hideInExport").isEmpty() ) 
  54.280 +			if (a.value("hideInExport")=="true")
  54.281 +				lastOO->setHideInExport(true);
  54.282 +
  54.283 +		if (!a.value( "hideLink").isEmpty()) 
  54.284 +		{
  54.285 +			if (a.value ("hideLink") =="true")
  54.286 +				lastOO->setHideLinkUnselected(true);
  54.287 +			else	
  54.288 +				lastOO->setHideLinkUnselected(false);
  54.289 +		}	
  54.290 +	}
  54.291  	return true;	
  54.292  }
  54.293  
  54.294 @@ -411,26 +505,26 @@
  54.295  		QFile file (fn);
  54.296  		QString s;						// Reading a note
  54.297  
  54.298 -		if ( !file.open( IO_ReadOnly) )
  54.299 +		if ( !file.open( QIODevice::ReadOnly) )
  54.300  		{
  54.301  			qWarning ("mapBuilderHandler::readNoteAttr:  Couldn't load "+fn);
  54.302  			return false;
  54.303  		}	
  54.304  		QTextStream stream( &file );
  54.305  		QString lines;
  54.306 -		while ( !stream.eof() ) {
  54.307 +		while ( !stream.atEnd() ) {
  54.308  			lines += stream.readLine()+"\n"; 
  54.309  		}
  54.310  		file.close();
  54.311  		// Convert to richtext
  54.312 -		if ( !QStyleSheet::mightBeRichText( lines ) )
  54.313 +		if ( !Q3StyleSheet::mightBeRichText( lines ) )
  54.314  		{
  54.315  			// Here we are workarounding the QT conversion method:
  54.316  			// convertFromPlainText does not generate valid xml, needed
  54.317  			// for the parser, but just <p> and <br> without closing tags.
  54.318  			// So we have to add those by ourselves
  54.319  			//lines=quotemeta (lines);
  54.320 -			lines = QStyleSheet::convertFromPlainText( lines, QStyleSheetItem::WhiteSpaceNormal );
  54.321 +			lines = Q3StyleSheet::convertFromPlainText( lines, Q3StyleSheetItem::WhiteSpaceNormal );
  54.322  			lines.replace ("<br>","<br />");
  54.323  		}	
  54.324  
  54.325 @@ -448,6 +542,10 @@
  54.326  
  54.327  bool mapBuilderHandler::readFloatImageAttr (const QXmlAttributes& a)
  54.328  {
  54.329 +	lastOO=lastFloat;
  54.330 +	
  54.331 +	//if (!readOOAttr(a)) return false;
  54.332 +
  54.333  	if (!a.value( "useOrientation").isEmpty() ) 
  54.334  	{
  54.335  		if (a.value ("useOrientation") =="true")
  54.336 @@ -470,8 +568,9 @@
  54.337  	}	
  54.338  	if (!a.value( "floatExport").isEmpty() ) 
  54.339  	{
  54.340 -		if (a.value ("floatExpofrt") =="true")
  54.341 -			lastFloat->setFloatExport (true);
  54.342 +		// Only for compatibility. THis is not used since 1.7.11 
  54.343 +		if (a.value ("floatExport") =="true")
  54.344 +			lastFloat->setFloatExport(true);
  54.345  		else	
  54.346  			lastFloat->setFloatExport (false);
  54.347  	}	
  54.348 @@ -487,15 +586,66 @@
  54.349  			x=a.value("relPosX").toInt (&okx, 10);
  54.350  			y=a.value("relPosY").toInt (&oky, 10);
  54.351  			if (okx && oky) 
  54.352 -				lastFloat->setRelPos (QPoint (x,y) );
  54.353 +				
  54.354 +				{
  54.355 +					lastFloat->setRelPos (QPoint (x,y) );
  54.356 +					// make sure floats in mapcenter are repositioned to relative pos
  54.357 +					if (mc==lastBranch) mc->positionContents();
  54.358 +				}
  54.359  			else
  54.360  				// Couldn't read relPos
  54.361  				return false;  
  54.362  		}           
  54.363  	}	
  54.364 +	
  54.365 +	if (!readOOAttr(a)) return false;
  54.366 +
  54.367 +	if (!a.value ("orgName").isEmpty() )
  54.368 +	{
  54.369 +		((FloatImageObj*)(lastFloat))->setOriginalFilename (a.value("orgName"));
  54.370 +	}
  54.371  	return true;
  54.372  }
  54.373  
  54.374 +bool mapBuilderHandler::readXLinkAttr (const QXmlAttributes& a)
  54.375 +{
  54.376 +	QColor col;
  54.377 +	bool okx;
  54.378 +	bool success=false;
  54.379 +	XLinkObj *xlo=new XLinkObj (mc->getCanvas());
  54.380 +	if (!a.value( "color").isEmpty() ) 
  54.381 +	{
  54.382 +		col.setNamedColor(a.value("color"));
  54.383 +		xlo->setColor (col);
  54.384 +	}
  54.385 +
  54.386 +	if (!a.value( "width").isEmpty() ) 
  54.387 +	{
  54.388 +		xlo->setWidth(a.value ("width").toInt (&okx, 10));
  54.389 +	}
  54.390 +
  54.391 +	if (!a.value( "beginBranch").isEmpty() ) 
  54.392 +	{
  54.393 +		if (!a.value( "endBranch").isEmpty() ) 
  54.394 +		{
  54.395 +			LinkableMapObj *lmo=mc->findObjBySelect (a.value( "beginBranch"));
  54.396 +			if (lmo && typeid (*lmo)==typeid (BranchObj))
  54.397 +			{
  54.398 +				xlo->setBegin ((BranchObj*)(lmo));
  54.399 +				lmo=mc->findObjBySelect (a.value( "endBranch"));
  54.400 +				if (lmo && typeid (*lmo)==typeid (BranchObj))
  54.401 +				{
  54.402 +					xlo->setEnd ((BranchObj*)(lmo));
  54.403 +					xlo->activate();
  54.404 +				}
  54.405 +			}
  54.406 +			success=true; // Not all branches there yet, no error
  54.407 +		}           
  54.408 +	}	
  54.409 +	if (!success) delete (xlo);
  54.410 +	return success;
  54.411 +}
  54.412 +
  54.413  bool mapBuilderHandler::readHtmlAttr (const QXmlAttributes& a)
  54.414  {
  54.415  	for (int i=1; i<=a.count(); i++)