Initial import. vendor
authorinsilmaril
Sun, 30 Jan 2005 12:58:47 +0000
branchvendor
changeset 07a96bd401351
child 1 9eb7767c2dfa
Initial import.
LICENSE
Makefile
branchobj.cpp
branchobj.h
doc/vym.pdf
exporthtmldialog.ui
exporthtmldialog.ui.h
exports.cpp
exports.h
exportxhtmldialog.ui
exportxhtmldialog.ui.h
extrainfodialog.ui
extrainfodialog.ui.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
linkablemapobj.cpp
linkablemapobj.h
main.cpp
mainwindow.cpp
mainwindow.h
mapcenterobj.cpp
mapcenterobj.h
mapeditor.cpp
mapeditor.h
mapobj.cpp
mapobj.h
misc.cpp
misc.h
noteobj.cpp
noteobj.h
options.cpp
options.h
ornamentedobj.cpp
ornamentedobj.h
process.cpp
process.h
selection.cpp
selection.h
settings.cpp
settings.h
showtextdialog.ui
showtextdialog.ui.h
tex/color-buttons.png
tex/default-flags.png
tex/example1.png
texteditor.cpp
texteditor.h
version.h
vym.pro
vym_de.ts
xml.cpp
xml.h
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/LICENSE	Sun Jan 30 12:58:47 2005 +0000
     1.3 @@ -0,0 +1,308 @@
     1.4 +    VYM - View Your Mind
     1.5 +    Copyright (C) 2004  Uwe Drechsel  
     1.6 +
     1.7 +    This program is free software; you can redistribute it and/or modify
     1.8 +    it under the terms of the GNU General Public License as published by
     1.9 +    the Free Software Foundation; either version 2 of the License, or
    1.10 +    (at your option) any later version.
    1.11 +
    1.12 +    This program is distributed in the hope that it will be useful,
    1.13 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.14 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.15 +    GNU General Public License below for more details.
    1.16 +
    1.17 +	In addition, as a special exception, Uwe Drechsel
    1.18 +	gives permission to link the code of this program with the QT 
    1.19 +	libraries from trolltech.com (or with modified versions of QT that
    1.20 +	use the same license as QT), and distribute linked combinations
    1.21 +	including the two. You must obey the GNU General Public License in
    1.22 +	all respects for all of the code used other than QT. If you modify
    1.23 +	this file, you may extend this exception to your version of the
    1.24 +	file, but you are not obligated to do so. If you do not wish to do
    1.25 +	so, delete this exception statement from your version.
    1.26 +
    1.27 +
    1.28 +	Uwe Drechsel can be contacted at <vym@insilmaril.de>
    1.29 +
    1.30 +-----------------------------------------------------------------------------
    1.31 +
    1.32 +            GNU GENERAL PUBLIC LICENSE
    1.33 +		       Version 2, June 1991
    1.34 +
    1.35 + Copyright (C) 1989, 1991 Free Software Foundation, Inc.
    1.36 +     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1.37 + Everyone is permitted to copy and distribute verbatim copies
    1.38 + of this license document, but changing it is not allowed.
    1.39 +
    1.40 +			    Preamble
    1.41 +
    1.42 +  The licenses for most software are designed to take away your
    1.43 +freedom to share and change it.  By contrast, the GNU General Public
    1.44 +License is intended to guarantee your freedom to share and change free
    1.45 +software--to make sure the software is free for all its users.  This
    1.46 +General Public License applies to most of the Free Software
    1.47 +Foundation's software and to any other program whose authors commit to
    1.48 +using it.  (Some other Free Software Foundation software is covered by
    1.49 +the GNU Library General Public License instead.)  You can apply it to
    1.50 +your programs, too.
    1.51 +
    1.52 +  When we speak of free software, we are referring to freedom, not
    1.53 +price.  Our General Public Licenses are designed to make sure that you
    1.54 +have the freedom to distribute copies of free software (and charge for
    1.55 +this service if you wish), that you receive source code or can get it
    1.56 +if you want it, that you can change the software or use pieces of it
    1.57 +in new free programs; and that you know you can do these things.
    1.58 +
    1.59 +  To protect your rights, we need to make restrictions that forbid
    1.60 +anyone to deny you these rights or to ask you to surrender the rights.
    1.61 +These restrictions translate to certain responsibilities for you if you
    1.62 +distribute copies of the software, or if you modify it.
    1.63 +
    1.64 +  For example, if you distribute copies of such a program, whether
    1.65 +gratis or for a fee, you must give the recipients all the rights that
    1.66 +you have.  You must make sure that they, too, receive or can get the
    1.67 +source code.  And you must show them these terms so they know their
    1.68 +rights.
    1.69 +
    1.70 +  We protect your rights with two steps: (1) copyright the software, and
    1.71 +(2) offer you this license which gives you legal permission to copy,
    1.72 +distribute and/or modify the software.
    1.73 +
    1.74 +  Also, for each author's protection and ours, we want to make certain
    1.75 +that everyone understands that there is no warranty for this free
    1.76 +software.  If the software is modified by someone else and passed on, we
    1.77 +want its recipients to know that what they have is not the original, so
    1.78 +that any problems introduced by others will not reflect on the original
    1.79 +authors' reputations.
    1.80 +
    1.81 +  Finally, any free program is threatened constantly by software
    1.82 +patents.  We wish to avoid the danger that redistributors of a free
    1.83 +program will individually obtain patent licenses, in effect making the
    1.84 +program proprietary.  To prevent this, we have made it clear that any
    1.85 +patent must be licensed for everyone's free use or not licensed at all.
    1.86 +
    1.87 +  The precise terms and conditions for copying, distribution and
    1.88 +modification follow.
    1.89 +
    1.90 +		    GNU GENERAL PUBLIC LICENSE
    1.91 +   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
    1.92 +
    1.93 +  0. This License applies to any program or other work which contains
    1.94 +a notice placed by the copyright holder saying it may be distributed
    1.95 +under the terms of this General Public License.  The "Program", below,
    1.96 +refers to any such program or work, and a "work based on the Program"
    1.97 +means either the Program or any derivative work under copyright law:
    1.98 +that is to say, a work containing the Program or a portion of it,
    1.99 +either verbatim or with modifications and/or translated into another
   1.100 +language.  (Hereinafter, translation is included without limitation in
   1.101 +the term "modification".)  Each licensee is addressed as "you".
   1.102 +
   1.103 +Activities other than copying, distribution and modification are not
   1.104 +covered by this License; they are outside its scope.  The act of
   1.105 +running the Program is not restricted, and the output from the Program
   1.106 +is covered only if its contents constitute a work based on the
   1.107 +Program (independent of having been made by running the Program).
   1.108 +Whether that is true depends on what the Program does.
   1.109 +
   1.110 +  1. You may copy and distribute verbatim copies of the Program's
   1.111 +source code as you receive it, in any medium, provided that you
   1.112 +conspicuously and appropriately publish on each copy an appropriate
   1.113 +copyright notice and disclaimer of warranty; keep intact all the
   1.114 +notices that refer to this License and to the absence of any warranty;
   1.115 +and give any other recipients of the Program a copy of this License
   1.116 +along with the Program.
   1.117 +
   1.118 +You may charge a fee for the physical act of transferring a copy, and
   1.119 +you may at your option offer warranty protection in exchange for a fee.
   1.120 +
   1.121 +  2. You may modify your copy or copies of the Program or any portion
   1.122 +of it, thus forming a work based on the Program, and copy and
   1.123 +distribute such modifications or work under the terms of Section 1
   1.124 +above, provided that you also meet all of these conditions:
   1.125 +
   1.126 +    a) You must cause the modified files to carry prominent notices
   1.127 +    stating that you changed the files and the date of any change.
   1.128 +
   1.129 +    b) You must cause any work that you distribute or publish, that in
   1.130 +    whole or in part contains or is derived from the Program or any
   1.131 +    part thereof, to be licensed as a whole at no charge to all third
   1.132 +    parties under the terms of this License.
   1.133 +
   1.134 +    c) If the modified program normally reads commands interactively
   1.135 +    when run, you must cause it, when started running for such
   1.136 +    interactive use in the most ordinary way, to print or display an
   1.137 +    announcement including an appropriate copyright notice and a
   1.138 +    notice that there is no warranty (or else, saying that you provide
   1.139 +    a warranty) and that users may redistribute the program under
   1.140 +    these conditions, and telling the user how to view a copy of this
   1.141 +    License.  (Exception: if the Program itself is interactive but
   1.142 +    does not normally print such an announcement, your work based on
   1.143 +    the Program is not required to print an announcement.)
   1.144 +
   1.145 +These requirements apply to the modified work as a whole.  If
   1.146 +identifiable sections of that work are not derived from the Program,
   1.147 +and can be reasonably considered independent and separate works in
   1.148 +themselves, then this License, and its terms, do not apply to those
   1.149 +sections when you distribute them as separate works.  But when you
   1.150 +distribute the same sections as part of a whole which is a work based
   1.151 +on the Program, the distribution of the whole must be on the terms of
   1.152 +this License, whose permissions for other licensees extend to the
   1.153 +entire whole, and thus to each and every part regardless of who wrote it.
   1.154 +
   1.155 +Thus, it is not the intent of this section to claim rights or contest
   1.156 +your rights to work written entirely by you; rather, the intent is to
   1.157 +exercise the right to control the distribution of derivative or
   1.158 +collective works based on the Program.
   1.159 +
   1.160 +In addition, mere aggregation of another work not based on the Program
   1.161 +with the Program (or with a work based on the Program) on a volume of
   1.162 +a storage or distribution medium does not bring the other work under
   1.163 +the scope of this License.
   1.164 +
   1.165 +  3. You may copy and distribute the Program (or a work based on it,
   1.166 +under Section 2) in object code or executable form under the terms of
   1.167 +Sections 1 and 2 above provided that you also do one of the following:
   1.168 +
   1.169 +    a) Accompany it with the complete corresponding machine-readable
   1.170 +    source code, which must be distributed under the terms of Sections
   1.171 +    1 and 2 above on a medium customarily used for software interchange; or,
   1.172 +
   1.173 +    b) Accompany it with a written offer, valid for at least three
   1.174 +    years, to give any third party, for a charge no more than your
   1.175 +    cost of physically performing source distribution, a complete
   1.176 +    machine-readable copy of the corresponding source code, to be
   1.177 +    distributed under the terms of Sections 1 and 2 above on a medium
   1.178 +    customarily used for software interchange; or,
   1.179 +
   1.180 +    c) Accompany it with the information you received as to the offer
   1.181 +    to distribute corresponding source code.  (This alternative is
   1.182 +    allowed only for noncommercial distribution and only if you
   1.183 +    received the program in object code or executable form with such
   1.184 +    an offer, in accord with Subsection b above.)
   1.185 +
   1.186 +The source code for a work means the preferred form of the work for
   1.187 +making modifications to it.  For an executable work, complete source
   1.188 +code means all the source code for all modules it contains, plus any
   1.189 +associated interface definition files, plus the scripts used to
   1.190 +control compilation and installation of the executable.  However, as a
   1.191 +special exception, the source code distributed need not include
   1.192 +anything that is normally distributed (in either source or binary
   1.193 +form) with the major components (compiler, kernel, and so on) of the
   1.194 +operating system on which the executable runs, unless that component
   1.195 +itself accompanies the executable.
   1.196 +
   1.197 +If distribution of executable or object code is made by offering
   1.198 +access to copy from a designated place, then offering equivalent
   1.199 +access to copy the source code from the same place counts as
   1.200 +distribution of the source code, even though third parties are not
   1.201 +compelled to copy the source along with the object code.
   1.202 +
   1.203 +  4. You may not copy, modify, sublicense, or distribute the Program
   1.204 +except as expressly provided under this License.  Any attempt
   1.205 +otherwise to copy, modify, sublicense or distribute the Program is
   1.206 +void, and will automatically terminate your rights under this License.
   1.207 +However, parties who have received copies, or rights, from you under
   1.208 +this License will not have their licenses terminated so long as such
   1.209 +parties remain in full compliance.
   1.210 +
   1.211 +  5. You are not required to accept this License, since you have not
   1.212 +signed it.  However, nothing else grants you permission to modify or
   1.213 +distribute the Program or its derivative works.  These actions are
   1.214 +prohibited by law if you do not accept this License.  Therefore, by
   1.215 +modifying or distributing the Program (or any work based on the
   1.216 +Program), you indicate your acceptance of this License to do so, and
   1.217 +all its terms and conditions for copying, distributing or modifying
   1.218 +the Program or works based on it.
   1.219 +
   1.220 +  6. Each time you redistribute the Program (or any work based on the
   1.221 +Program), the recipient automatically receives a license from the
   1.222 +original licensor to copy, distribute or modify the Program subject to
   1.223 +these terms and conditions.  You may not impose any further
   1.224 +restrictions on the recipients' exercise of the rights granted herein.
   1.225 +You are not responsible for enforcing compliance by third parties to
   1.226 +this License.
   1.227 +
   1.228 +  7. If, as a consequence of a court judgment or allegation of patent
   1.229 +infringement or for any other reason (not limited to patent issues),
   1.230 +conditions are imposed on you (whether by court order, agreement or
   1.231 +otherwise) that contradict the conditions of this License, they do not
   1.232 +excuse you from the conditions of this License.  If you cannot
   1.233 +distribute so as to satisfy simultaneously your obligations under this
   1.234 +License and any other pertinent obligations, then as a consequence you
   1.235 +may not distribute the Program at all.  For example, if a patent
   1.236 +license would not permit royalty-free redistribution of the Program by
   1.237 +all those who receive copies directly or indirectly through you, then
   1.238 +the only way you could satisfy both it and this License would be to
   1.239 +refrain entirely from distribution of the Program.
   1.240 +
   1.241 +If any portion of this section is held invalid or unenforceable under
   1.242 +any particular circumstance, the balance of the section is intended to
   1.243 +apply and the section as a whole is intended to apply in other
   1.244 +circumstances.
   1.245 +
   1.246 +It is not the purpose of this section to induce you to infringe any
   1.247 +patents or other property right claims or to contest validity of any
   1.248 +such claims; this section has the sole purpose of protecting the
   1.249 +integrity of the free software distribution system, which is
   1.250 +implemented by public license practices.  Many people have made
   1.251 +generous contributions to the wide range of software distributed
   1.252 +through that system in reliance on consistent application of that
   1.253 +system; it is up to the author/donor to decide if he or she is willing
   1.254 +to distribute software through any other system and a licensee cannot
   1.255 +impose that choice.
   1.256 +
   1.257 +This section is intended to make thoroughly clear what is believed to
   1.258 +be a consequence of the rest of this License.
   1.259 +
   1.260 +  8. If the distribution and/or use of the Program is restricted in
   1.261 +certain countries either by patents or by copyrighted interfaces, the
   1.262 +original copyright holder who places the Program under this License
   1.263 +may add an explicit geographical distribution limitation excluding
   1.264 +those countries, so that distribution is permitted only in or among
   1.265 +countries not thus excluded.  In such case, this License incorporates
   1.266 +the limitation as if written in the body of this License.
   1.267 +
   1.268 +  9. The Free Software Foundation may publish revised and/or new versions
   1.269 +of the General Public License from time to time.  Such new versions will
   1.270 +be similar in spirit to the present version, but may differ in detail to
   1.271 +address new problems or concerns.
   1.272 +
   1.273 +Each version is given a distinguishing version number.  If the Program
   1.274 +specifies a version number of this License which applies to it and "any
   1.275 +later version", you have the option of following the terms and conditions
   1.276 +either of that version or of any later version published by the Free
   1.277 +Software Foundation.  If the Program does not specify a version number of
   1.278 +this License, you may choose any version ever published by the Free Software
   1.279 +Foundation.
   1.280 +
   1.281 +  10. If you wish to incorporate parts of the Program into other free
   1.282 +programs whose distribution conditions are different, write to the author
   1.283 +to ask for permission.  For software which is copyrighted by the Free
   1.284 +Software Foundation, write to the Free Software Foundation; we sometimes
   1.285 +make exceptions for this.  Our decision will be guided by the two goals
   1.286 +of preserving the free status of all derivatives of our free software and
   1.287 +of promoting the sharing and reuse of software generally.
   1.288 +
   1.289 +			    NO WARRANTY
   1.290 +
   1.291 +  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
   1.292 +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
   1.293 +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
   1.294 +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
   1.295 +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   1.296 +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
   1.297 +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
   1.298 +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
   1.299 +REPAIR OR CORRECTION.
   1.300 +
   1.301 +  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
   1.302 +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
   1.303 +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
   1.304 +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
   1.305 +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
   1.306 +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
   1.307 +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
   1.308 +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
   1.309 +POSSIBILITY OF SUCH DAMAGES.
   1.310 +
   1.311 +		     END OF TERMS AND CONDITIONS
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/Makefile	Sun Jan 30 12:58:47 2005 +0000
     2.3 @@ -0,0 +1,737 @@
     2.4 +#############################################################################
     2.5 +# Makefile for building: vym
     2.6 +# Generated by qmake (1.07a) (Qt 3.3.1) on: Tue Jan  4 10:40:21 2005
     2.7 +# Project:  vym.pro
     2.8 +# Template: app
     2.9 +# Command: $(QMAKE) -o Makefile vym.pro
    2.10 +#############################################################################
    2.11 +
    2.12 +####### Compiler, tools and options
    2.13 +
    2.14 +CC       = gcc
    2.15 +CXX      = g++
    2.16 +LEX      = flex
    2.17 +YACC     = yacc
    2.18 +CFLAGS   = -pipe -O2 -fmessage-length=0 -Wall -fPIC -Wall -W -O2 -fmessage-length=0 -Wall -fPIC  -DQT_NO_DEBUG -DQT_SHARED -DQT_TABLET_SUPPORT -DQT_THREAD_SUPPORT
    2.19 +CXXFLAGS = -pipe -O2 -fmessage-length=0 -Wall -fPIC -Wall -W -O2 -fmessage-length=0 -Wall -fPIC  -DQT_NO_DEBUG -DQT_SHARED -DQT_TABLET_SUPPORT -DQT_THREAD_SUPPORT
    2.20 +LEXFLAGS = 
    2.21 +YACCFLAGS= -d
    2.22 +INCPATH  = -I/usr/lib/qt3/mkspecs/linux-g++ -I. -I/usr/include -I$(QTDIR)/include
    2.23 +LINK     = g++
    2.24 +LFLAGS   = 
    2.25 +LIBS     = $(SUBLIBS) -L/usr/lib64/ -L$(QTDIR)/lib64/ -L/usr/X11R6/lib64/ -lqt-mt -lXext -lX11 -lm
    2.26 +AR       = ar cqs
    2.27 +RANLIB   = 
    2.28 +MOC      = $(QTDIR)/bin/moc
    2.29 +UIC      = $(QTDIR)/bin/uic
    2.30 +QMAKE    = qmake
    2.31 +TAR      = tar -cf
    2.32 +GZIP     = gzip -9f
    2.33 +COPY     = cp -f
    2.34 +COPY_FILE= $(COPY)
    2.35 +COPY_DIR = $(COPY) -r
    2.36 +INSTALL_FILE= $(COPY_FILE)
    2.37 +INSTALL_DIR = $(COPY_DIR)
    2.38 +DEL_FILE = rm -f
    2.39 +SYMLINK  = ln -sf
    2.40 +DEL_DIR  = rmdir
    2.41 +MOVE     = mv -f
    2.42 +CHK_DIR_EXISTS= test -d
    2.43 +MKDIR    = mkdir -p
    2.44 +
    2.45 +####### Output directory
    2.46 +
    2.47 +OBJECTS_DIR = ./
    2.48 +
    2.49 +####### Files
    2.50 +
    2.51 +HEADERS = branchobj.h \
    2.52 +		exports.h \
    2.53 +		findwindow.h \
    2.54 +		flagobj.h \
    2.55 +		flagrowobj.h \
    2.56 +		floatimageobj.h \
    2.57 +		floatobj.h \
    2.58 +		frameobj.h \
    2.59 +		headingobj.h \
    2.60 +		imageobj.h \
    2.61 +		linkablemapobj.h \
    2.62 +		mainwindow.h \
    2.63 +		mapcenterobj.h \
    2.64 +		mapeditor.h \
    2.65 +		mapobj.h \
    2.66 +		misc.h \
    2.67 +		noteobj.h \
    2.68 +		ornamentedobj.h \
    2.69 +		process.h \
    2.70 +		selection.h \
    2.71 +		texteditor.h \
    2.72 +		version.h \
    2.73 +		xml.h \
    2.74 +		settings.h \
    2.75 +		options.h
    2.76 +SOURCES = branchobj.cpp \
    2.77 +		exports.cpp \
    2.78 +		findwindow.cpp \
    2.79 +		flagobj.cpp \
    2.80 +		flagrowobj.cpp \
    2.81 +		floatimageobj.cpp \
    2.82 +		floatobj.cpp \
    2.83 +		frameobj.cpp \
    2.84 +		headingobj.cpp \
    2.85 +		imageobj.cpp \
    2.86 +		linkablemapobj.cpp \
    2.87 +		main.cpp \
    2.88 +		mainwindow.cpp \
    2.89 +		mapcenterobj.cpp \
    2.90 +		mapeditor.cpp \
    2.91 +		mapobj.cpp \
    2.92 +		misc.cpp \
    2.93 +		noteobj.cpp \
    2.94 +		ornamentedobj.cpp \
    2.95 +		process.cpp \
    2.96 +		selection.cpp \
    2.97 +		texteditor.cpp \
    2.98 +		xml.cpp \
    2.99 +		settings.cpp \
   2.100 +		options.cpp
   2.101 +OBJECTS = branchobj.o \
   2.102 +		exports.o \
   2.103 +		findwindow.o \
   2.104 +		flagobj.o \
   2.105 +		flagrowobj.o \
   2.106 +		floatimageobj.o \
   2.107 +		floatobj.o \
   2.108 +		frameobj.o \
   2.109 +		headingobj.o \
   2.110 +		imageobj.o \
   2.111 +		linkablemapobj.o \
   2.112 +		main.o \
   2.113 +		mainwindow.o \
   2.114 +		mapcenterobj.o \
   2.115 +		mapeditor.o \
   2.116 +		mapobj.o \
   2.117 +		misc.o \
   2.118 +		noteobj.o \
   2.119 +		ornamentedobj.o \
   2.120 +		process.o \
   2.121 +		selection.o \
   2.122 +		texteditor.o \
   2.123 +		xml.o \
   2.124 +		settings.o \
   2.125 +		options.o \
   2.126 +		exporthtmldialog.o \
   2.127 +		exportxhtmldialog.o \
   2.128 +		showtextdialog.o \
   2.129 +		extrainfodialog.o
   2.130 +FORMS = exporthtmldialog.ui \
   2.131 +		exportxhtmldialog.ui \
   2.132 +		showtextdialog.ui \
   2.133 +		extrainfodialog.ui
   2.134 +UICDECLS = exporthtmldialog.h \
   2.135 +		exportxhtmldialog.h \
   2.136 +		showtextdialog.h \
   2.137 +		extrainfodialog.h
   2.138 +UICIMPLS = exporthtmldialog.cpp \
   2.139 +		exportxhtmldialog.cpp \
   2.140 +		showtextdialog.cpp \
   2.141 +		extrainfodialog.cpp
   2.142 +SRCMOC   = moc_findwindow.cpp \
   2.143 +		moc_linkablemapobj.cpp \
   2.144 +		moc_mainwindow.cpp \
   2.145 +		moc_mapeditor.cpp \
   2.146 +		moc_ornamentedobj.cpp \
   2.147 +		moc_process.cpp \
   2.148 +		moc_texteditor.cpp \
   2.149 +		moc_exporthtmldialog.cpp \
   2.150 +		moc_exportxhtmldialog.cpp \
   2.151 +		moc_showtextdialog.cpp \
   2.152 +		moc_extrainfodialog.cpp
   2.153 +OBJMOC = moc_findwindow.o \
   2.154 +		moc_linkablemapobj.o \
   2.155 +		moc_mainwindow.o \
   2.156 +		moc_mapeditor.o \
   2.157 +		moc_ornamentedobj.o \
   2.158 +		moc_process.o \
   2.159 +		moc_texteditor.o \
   2.160 +		moc_exporthtmldialog.o \
   2.161 +		moc_exportxhtmldialog.o \
   2.162 +		moc_showtextdialog.o \
   2.163 +		moc_extrainfodialog.o
   2.164 +DIST	   = vym.pro
   2.165 +QMAKE_TARGET = vym
   2.166 +DESTDIR  = 
   2.167 +TARGET   = vym
   2.168 +
   2.169 +first: all
   2.170 +####### Implicit rules
   2.171 +
   2.172 +.SUFFIXES: .c .o .cpp .cc .cxx .C
   2.173 +
   2.174 +.cpp.o:
   2.175 +	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
   2.176 +
   2.177 +.cc.o:
   2.178 +	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
   2.179 +
   2.180 +.cxx.o:
   2.181 +	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
   2.182 +
   2.183 +.C.o:
   2.184 +	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
   2.185 +
   2.186 +.c.o:
   2.187 +	$(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
   2.188 +
   2.189 +####### Build rules
   2.190 +
   2.191 +all: Makefile $(TARGET)
   2.192 +
   2.193 +$(TARGET):  $(UICDECLS) $(OBJECTS) $(OBJMOC)  
   2.194 +	$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(OBJCOMP) $(LIBS)
   2.195 +
   2.196 +mocables: $(SRCMOC)
   2.197 +uicables: $(UICDECLS) $(UICIMPLS)
   2.198 +
   2.199 +$(MOC): 
   2.200 +	( cd $(QTDIR)/src/moc && $(MAKE) )
   2.201 +
   2.202 +Makefile: vym.pro  /usr/lib/qt3/mkspecs/linux-g++/qmake.conf /usr/lib/qt3/lib64/libqt-mt.prl
   2.203 +	$(QMAKE) -o Makefile vym.pro
   2.204 +qmake: 
   2.205 +	@$(QMAKE) -o Makefile vym.pro
   2.206 +
   2.207 +dist: 
   2.208 +	@mkdir -p .tmp/vym && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) .tmp/vym/ && $(COPY_FILE) --parents vym_de.ts .tmp/vym/ && $(COPY_FILE) --parents exporthtmldialog.ui.h exportxhtmldialog.ui.h showtextdialog.ui.h extrainfodialog.ui.h .tmp/vym/ && ( cd `dirname .tmp/vym` && $(TAR) vym.tar vym && $(GZIP) vym.tar ) && $(MOVE) `dirname .tmp/vym`/vym.tar.gz . && $(DEL_FILE) -r .tmp/vym
   2.209 +
   2.210 +mocclean:
   2.211 +	-$(DEL_FILE) $(OBJMOC)
   2.212 +	-$(DEL_FILE) $(SRCMOC)
   2.213 +
   2.214 +uiclean:
   2.215 +	-$(DEL_FILE) $(UICIMPLS) $(UICDECLS)
   2.216 +
   2.217 +yaccclean:
   2.218 +lexclean:
   2.219 +clean: mocclean uiclean
   2.220 +	-$(DEL_FILE) $(OBJECTS)
   2.221 +	-$(DEL_FILE) *~ core *.core
   2.222 +
   2.223 +
   2.224 +####### Sub-libraries
   2.225 +
   2.226 +distclean: clean
   2.227 +	-$(DEL_FILE) $(TARGET) $(TARGET)
   2.228 +
   2.229 +
   2.230 +FORCE:
   2.231 +
   2.232 +####### Compile
   2.233 +
   2.234 +branchobj.o: branchobj.cpp branchobj.h \
   2.235 +		texteditor.h \
   2.236 +		mapeditor.h \
   2.237 +		mainwindow.h \
   2.238 +		floatimageobj.h \
   2.239 +		linkablemapobj.h \
   2.240 +		ornamentedobj.h \
   2.241 +		floatobj.h \
   2.242 +		frameobj.h \
   2.243 +		noteobj.h \
   2.244 +		headingobj.h \
   2.245 +		flagrowobj.h \
   2.246 +		mapobj.h \
   2.247 +		misc.h \
   2.248 +		flagobj.h \
   2.249 +		imageobj.h \
   2.250 +		mapcenterobj.h \
   2.251 +		version.h \
   2.252 +		xml.h \
   2.253 +		findwindow.h
   2.254 +
   2.255 +exports.o: exports.cpp exports.h \
   2.256 +		linkablemapobj.h \
   2.257 +		mapcenterobj.h \
   2.258 +		branchobj.h \
   2.259 +		version.h \
   2.260 +		floatimageobj.h \
   2.261 +		ornamentedobj.h \
   2.262 +		floatobj.h \
   2.263 +		frameobj.h \
   2.264 +		noteobj.h \
   2.265 +		headingobj.h \
   2.266 +		flagrowobj.h \
   2.267 +		mapobj.h \
   2.268 +		misc.h \
   2.269 +		flagobj.h \
   2.270 +		imageobj.h
   2.271 +
   2.272 +findwindow.o: findwindow.cpp findwindow.h
   2.273 +
   2.274 +flagobj.o: flagobj.cpp flagobj.h \
   2.275 +		mapobj.h \
   2.276 +		imageobj.h \
   2.277 +		misc.h
   2.278 +
   2.279 +flagrowobj.o: flagrowobj.cpp flagrowobj.h \
   2.280 +		mapobj.h \
   2.281 +		flagobj.h \
   2.282 +		misc.h \
   2.283 +		imageobj.h
   2.284 +
   2.285 +floatimageobj.o: floatimageobj.cpp floatimageobj.h \
   2.286 +		branchobj.h \
   2.287 +		floatobj.h \
   2.288 +		linkablemapobj.h \
   2.289 +		frameobj.h \
   2.290 +		noteobj.h \
   2.291 +		headingobj.h \
   2.292 +		flagrowobj.h \
   2.293 +		mapobj.h \
   2.294 +		misc.h \
   2.295 +		flagobj.h \
   2.296 +		imageobj.h \
   2.297 +		ornamentedobj.h
   2.298 +
   2.299 +floatobj.o: floatobj.cpp floatobj.h \
   2.300 +		linkablemapobj.h \
   2.301 +		frameobj.h \
   2.302 +		noteobj.h \
   2.303 +		headingobj.h \
   2.304 +		flagrowobj.h \
   2.305 +		mapobj.h \
   2.306 +		misc.h \
   2.307 +		flagobj.h \
   2.308 +		imageobj.h
   2.309 +
   2.310 +frameobj.o: frameobj.cpp frameobj.h \
   2.311 +		mapobj.h \
   2.312 +		misc.h
   2.313 +
   2.314 +headingobj.o: headingobj.cpp headingobj.h \
   2.315 +		mapobj.h \
   2.316 +		misc.h
   2.317 +
   2.318 +imageobj.o: imageobj.cpp imageobj.h \
   2.319 +		mapobj.h \
   2.320 +		misc.h
   2.321 +
   2.322 +linkablemapobj.o: linkablemapobj.cpp linkablemapobj.h \
   2.323 +		branchobj.h \
   2.324 +		mapeditor.h \
   2.325 +		version.h \
   2.326 +		frameobj.h \
   2.327 +		noteobj.h \
   2.328 +		headingobj.h \
   2.329 +		flagrowobj.h \
   2.330 +		mapobj.h \
   2.331 +		misc.h \
   2.332 +		flagobj.h \
   2.333 +		imageobj.h \
   2.334 +		floatimageobj.h \
   2.335 +		ornamentedobj.h \
   2.336 +		floatobj.h \
   2.337 +		mapcenterobj.h
   2.338 +
   2.339 +main.o: main.cpp settings.h \
   2.340 +		options.h \
   2.341 +		mainwindow.h \
   2.342 +		icons/vym-48x48.xpm \
   2.343 +		icons/vym-editor.xpm \
   2.344 +		flagrowobj.h \
   2.345 +		misc.h \
   2.346 +		xml.h \
   2.347 +		texteditor.h \
   2.348 +		mapeditor.h \
   2.349 +		findwindow.h \
   2.350 +		mapcenterobj.h \
   2.351 +		branchobj.h \
   2.352 +		version.h \
   2.353 +		floatimageobj.h \
   2.354 +		linkablemapobj.h \
   2.355 +		ornamentedobj.h \
   2.356 +		floatobj.h \
   2.357 +		frameobj.h \
   2.358 +		noteobj.h \
   2.359 +		headingobj.h \
   2.360 +		mapobj.h \
   2.361 +		flagobj.h \
   2.362 +		imageobj.h
   2.363 +
   2.364 +mainwindow.o: mainwindow.cpp mainwindow.h \
   2.365 +		version.h \
   2.366 +		icons/filenew.xpm \
   2.367 +		icons/fileopen.xpm \
   2.368 +		icons/filesave.xpm \
   2.369 +		icons/fileprint.xpm \
   2.370 +		icons/editundo.xpm \
   2.371 +		icons/editcopy.xpm \
   2.372 +		icons/editcut.xpm \
   2.373 +		icons/editpaste.xpm \
   2.374 +		icons/editmoveup.xpm \
   2.375 +		icons/editmovedown.xpm \
   2.376 +		icons/formatcoloritem.xpm \
   2.377 +		icons/formatcolorbranch.xpm \
   2.378 +		icons/formatcolorpicker.xpm \
   2.379 +		icons/viewzoomreset.xpm \
   2.380 +		icons/viewzoomin.xpm \
   2.381 +		icons/viewzoomout.xpm \
   2.382 +		icons/vym-48x48.xpm \
   2.383 +		icons/flag-note.xpm \
   2.384 +		icons/flag-url.xpm \
   2.385 +		icons/flag-vymlink.xpm \
   2.386 +		icons/flag-scrolled-right.xpm \
   2.387 +		flagrowobj.h \
   2.388 +		texteditor.h \
   2.389 +		mapeditor.h \
   2.390 +		exporthtmldialog.h \
   2.391 +		exportxhtmldialog.h \
   2.392 +		showtextdialog.h \
   2.393 +		process.h \
   2.394 +		settings.h \
   2.395 +		options.h \
   2.396 +		xml.h \
   2.397 +		findwindow.h \
   2.398 +		mapcenterobj.h \
   2.399 +		branchobj.h \
   2.400 +		floatimageobj.h \
   2.401 +		linkablemapobj.h \
   2.402 +		ornamentedobj.h \
   2.403 +		floatobj.h \
   2.404 +		frameobj.h \
   2.405 +		noteobj.h \
   2.406 +		headingobj.h \
   2.407 +		mapobj.h \
   2.408 +		misc.h \
   2.409 +		flagobj.h \
   2.410 +		imageobj.h
   2.411 +
   2.412 +mapcenterobj.o: mapcenterobj.cpp mapcenterobj.h \
   2.413 +		floatimageobj.h \
   2.414 +		mapeditor.h \
   2.415 +		branchobj.h \
   2.416 +		version.h \
   2.417 +		linkablemapobj.h \
   2.418 +		ornamentedobj.h \
   2.419 +		floatobj.h \
   2.420 +		frameobj.h \
   2.421 +		noteobj.h \
   2.422 +		headingobj.h \
   2.423 +		flagrowobj.h \
   2.424 +		mapobj.h \
   2.425 +		misc.h \
   2.426 +		flagobj.h \
   2.427 +		imageobj.h
   2.428 +
   2.429 +mapeditor.o: mapeditor.cpp mapeditor.h \
   2.430 +		version.h \
   2.431 +		xml.h \
   2.432 +		texteditor.h \
   2.433 +		linkablemapobj.h \
   2.434 +		exports.h \
   2.435 +		misc.h \
   2.436 +		mainwindow.h \
   2.437 +		extrainfodialog.h \
   2.438 +		settings.h \
   2.439 +		icons/flag-note.xpm \
   2.440 +		icons/flag-url.xpm \
   2.441 +		icons/flag-vymlink.xpm \
   2.442 +		icons/flag-scrolled-right.xpm \
   2.443 +		icons/flag-tmpUnscrolled-right.xpm \
   2.444 +		icons/flag-questionmark.xpm \
   2.445 +		icons/flag-exclamationmark.xpm \
   2.446 +		icons/flag-hook-green.xpm \
   2.447 +		icons/flag-cross-red.xpm \
   2.448 +		icons/flag-stopsign.xpm \
   2.449 +		icons/flag-smiley-good.xpm \
   2.450 +		icons/flag-smiley-sad.xpm \
   2.451 +		icons/flag-clock.xpm \
   2.452 +		icons/flag-lamp.xpm \
   2.453 +		icons/flag-arrow-up.xpm \
   2.454 +		icons/flag-arrow-down.xpm \
   2.455 +		icons/flag-thumb-up.xpm \
   2.456 +		icons/flag-thumb-down.xpm \
   2.457 +		icons/flag-heart.xpm \
   2.458 +		icons/flag-flash.xpm \
   2.459 +		icons/flag-lifebelt.xpm \
   2.460 +		mapcenterobj.h \
   2.461 +		branchobj.h \
   2.462 +		floatimageobj.h \
   2.463 +		ornamentedobj.h \
   2.464 +		floatobj.h \
   2.465 +		frameobj.h \
   2.466 +		noteobj.h \
   2.467 +		headingobj.h \
   2.468 +		flagrowobj.h \
   2.469 +		mapobj.h \
   2.470 +		flagobj.h \
   2.471 +		imageobj.h \
   2.472 +		findwindow.h
   2.473 +
   2.474 +mapobj.o: mapobj.cpp mapobj.h \
   2.475 +		misc.h
   2.476 +
   2.477 +misc.o: misc.cpp misc.h
   2.478 +
   2.479 +noteobj.o: noteobj.cpp noteobj.h \
   2.480 +		misc.h
   2.481 +
   2.482 +ornamentedobj.o: ornamentedobj.cpp ornamentedobj.h \
   2.483 +		texteditor.h \
   2.484 +		mapeditor.h \
   2.485 +		linkablemapobj.h \
   2.486 +		frameobj.h \
   2.487 +		noteobj.h \
   2.488 +		headingobj.h \
   2.489 +		flagrowobj.h \
   2.490 +		mapobj.h \
   2.491 +		misc.h \
   2.492 +		flagobj.h \
   2.493 +		imageobj.h \
   2.494 +		mapcenterobj.h \
   2.495 +		branchobj.h \
   2.496 +		version.h \
   2.497 +		floatimageobj.h \
   2.498 +		floatobj.h
   2.499 +
   2.500 +process.o: process.cpp process.h
   2.501 +
   2.502 +selection.o: selection.cpp selection.h \
   2.503 +		linkablemapobj.h \
   2.504 +		frameobj.h \
   2.505 +		noteobj.h \
   2.506 +		headingobj.h \
   2.507 +		flagrowobj.h \
   2.508 +		mapobj.h \
   2.509 +		misc.h \
   2.510 +		flagobj.h \
   2.511 +		imageobj.h
   2.512 +
   2.513 +texteditor.o: texteditor.cpp texteditor.h \
   2.514 +		icons/fileopen.xpm \
   2.515 +		icons/filesave.xpm \
   2.516 +		icons/fileprint.xpm \
   2.517 +		icons/editundo.xpm \
   2.518 +		icons/editredo.xpm \
   2.519 +		icons/editcopy.xpm \
   2.520 +		icons/editcut.xpm \
   2.521 +		icons/editpaste.xpm \
   2.522 +		icons/edittrash.xpm \
   2.523 +		icons/formatfixedfont.xpm \
   2.524 +		icons/formattextbold.xpm \
   2.525 +		icons/formattextitalic.xpm \
   2.526 +		icons/formattextunder.xpm \
   2.527 +		icons/formattextleft.xpm \
   2.528 +		icons/formattextcenter.xpm \
   2.529 +		icons/formattextright.xpm \
   2.530 +		icons/formattextjustify.xpm
   2.531 +
   2.532 +xml.o: xml.cpp xml.h \
   2.533 +		misc.h \
   2.534 +		settings.h \
   2.535 +		version.h \
   2.536 +		mapcenterobj.h \
   2.537 +		mapeditor.h \
   2.538 +		branchobj.h \
   2.539 +		floatimageobj.h \
   2.540 +		linkablemapobj.h \
   2.541 +		ornamentedobj.h \
   2.542 +		floatobj.h \
   2.543 +		frameobj.h \
   2.544 +		noteobj.h \
   2.545 +		headingobj.h \
   2.546 +		flagrowobj.h \
   2.547 +		mapobj.h \
   2.548 +		flagobj.h \
   2.549 +		imageobj.h
   2.550 +
   2.551 +settings.o: settings.cpp settings.h \
   2.552 +		misc.h
   2.553 +
   2.554 +options.o: options.cpp options.h
   2.555 +
   2.556 +exporthtmldialog.h: exporthtmldialog.ui showtextdialog.h
   2.557 +	$(UIC) exporthtmldialog.ui -o exporthtmldialog.h
   2.558 +
   2.559 +exporthtmldialog.cpp: exporthtmldialog.h exporthtmldialog.ui showtextdialog.h
   2.560 +	$(UIC) exporthtmldialog.ui -i exporthtmldialog.h -o exporthtmldialog.cpp
   2.561 +
   2.562 +exportxhtmldialog.h: exportxhtmldialog.ui process.h \
   2.563 +		showtextdialog.h
   2.564 +	$(UIC) exportxhtmldialog.ui -o exportxhtmldialog.h
   2.565 +
   2.566 +exportxhtmldialog.cpp: exportxhtmldialog.h exportxhtmldialog.ui process.h \
   2.567 +		showtextdialog.h
   2.568 +	$(UIC) exportxhtmldialog.ui -i exportxhtmldialog.h -o exportxhtmldialog.cpp
   2.569 +
   2.570 +showtextdialog.h: showtextdialog.ui 
   2.571 +	$(UIC) showtextdialog.ui -o showtextdialog.h
   2.572 +
   2.573 +showtextdialog.cpp: showtextdialog.h showtextdialog.ui 
   2.574 +	$(UIC) showtextdialog.ui -i showtextdialog.h -o showtextdialog.cpp
   2.575 +
   2.576 +extrainfodialog.h: extrainfodialog.ui 
   2.577 +	$(UIC) extrainfodialog.ui -o extrainfodialog.h
   2.578 +
   2.579 +extrainfodialog.cpp: extrainfodialog.h extrainfodialog.ui 
   2.580 +	$(UIC) extrainfodialog.ui -i extrainfodialog.h -o extrainfodialog.cpp
   2.581 +
   2.582 +exporthtmldialog.o: exporthtmldialog.cpp settings.h \
   2.583 +		misc.h \
   2.584 +		icons/flag-url.xpm \
   2.585 +		exporthtmldialog.ui.h \
   2.586 +		exporthtmldialog.h
   2.587 +
   2.588 +exportxhtmldialog.o: exportxhtmldialog.cpp settings.h \
   2.589 +		icons/flag-url.xpm \
   2.590 +		exportxhtmldialog.ui.h \
   2.591 +		exportxhtmldialog.h
   2.592 +
   2.593 +showtextdialog.o: showtextdialog.cpp showtextdialog.ui.h \
   2.594 +		showtextdialog.h
   2.595 +
   2.596 +extrainfodialog.o: extrainfodialog.cpp extrainfodialog.ui.h \
   2.597 +		extrainfodialog.h
   2.598 +
   2.599 +moc_findwindow.o: moc_findwindow.cpp  findwindow.h 
   2.600 +
   2.601 +moc_linkablemapobj.o: moc_linkablemapobj.cpp  linkablemapobj.h frameobj.h \
   2.602 +		noteobj.h \
   2.603 +		headingobj.h \
   2.604 +		flagrowobj.h \
   2.605 +		mapobj.h \
   2.606 +		misc.h \
   2.607 +		flagobj.h \
   2.608 +		imageobj.h
   2.609 +
   2.610 +moc_mainwindow.o: moc_mainwindow.cpp  mainwindow.h xml.h \
   2.611 +		texteditor.h \
   2.612 +		mapeditor.h \
   2.613 +		findwindow.h \
   2.614 +		mapcenterobj.h \
   2.615 +		branchobj.h \
   2.616 +		version.h \
   2.617 +		floatimageobj.h \
   2.618 +		linkablemapobj.h \
   2.619 +		ornamentedobj.h \
   2.620 +		floatobj.h \
   2.621 +		frameobj.h \
   2.622 +		noteobj.h \
   2.623 +		headingobj.h \
   2.624 +		flagrowobj.h \
   2.625 +		mapobj.h \
   2.626 +		misc.h \
   2.627 +		flagobj.h \
   2.628 +		imageobj.h
   2.629 +
   2.630 +moc_mapeditor.o: moc_mapeditor.cpp  mapeditor.h mapcenterobj.h \
   2.631 +		misc.h \
   2.632 +		branchobj.h \
   2.633 +		version.h \
   2.634 +		floatimageobj.h \
   2.635 +		linkablemapobj.h \
   2.636 +		ornamentedobj.h \
   2.637 +		floatobj.h \
   2.638 +		frameobj.h \
   2.639 +		noteobj.h \
   2.640 +		headingobj.h \
   2.641 +		flagrowobj.h \
   2.642 +		mapobj.h \
   2.643 +		flagobj.h \
   2.644 +		imageobj.h
   2.645 +
   2.646 +moc_ornamentedobj.o: moc_ornamentedobj.cpp  ornamentedobj.h linkablemapobj.h \
   2.647 +		frameobj.h \
   2.648 +		noteobj.h \
   2.649 +		headingobj.h \
   2.650 +		flagrowobj.h \
   2.651 +		mapobj.h \
   2.652 +		misc.h \
   2.653 +		flagobj.h \
   2.654 +		imageobj.h
   2.655 +
   2.656 +moc_process.o: moc_process.cpp  process.h 
   2.657 +
   2.658 +moc_texteditor.o: moc_texteditor.cpp  texteditor.h 
   2.659 +
   2.660 +moc_exporthtmldialog.o: moc_exporthtmldialog.cpp  exporthtmldialog.h showtextdialog.h
   2.661 +
   2.662 +moc_exportxhtmldialog.o: moc_exportxhtmldialog.cpp  exportxhtmldialog.h process.h \
   2.663 +		showtextdialog.h
   2.664 +
   2.665 +moc_showtextdialog.o: moc_showtextdialog.cpp  showtextdialog.h 
   2.666 +
   2.667 +moc_extrainfodialog.o: moc_extrainfodialog.cpp  extrainfodialog.h 
   2.668 +
   2.669 +moc_findwindow.cpp: $(MOC) findwindow.h
   2.670 +	$(MOC) findwindow.h -o moc_findwindow.cpp
   2.671 +
   2.672 +moc_linkablemapobj.cpp: $(MOC) linkablemapobj.h
   2.673 +	$(MOC) linkablemapobj.h -o moc_linkablemapobj.cpp
   2.674 +
   2.675 +moc_mainwindow.cpp: $(MOC) mainwindow.h
   2.676 +	$(MOC) mainwindow.h -o moc_mainwindow.cpp
   2.677 +
   2.678 +moc_mapeditor.cpp: $(MOC) mapeditor.h
   2.679 +	$(MOC) mapeditor.h -o moc_mapeditor.cpp
   2.680 +
   2.681 +moc_ornamentedobj.cpp: $(MOC) ornamentedobj.h
   2.682 +	$(MOC) ornamentedobj.h -o moc_ornamentedobj.cpp
   2.683 +
   2.684 +moc_process.cpp: $(MOC) process.h
   2.685 +	$(MOC) process.h -o moc_process.cpp
   2.686 +
   2.687 +moc_texteditor.cpp: $(MOC) texteditor.h
   2.688 +	$(MOC) texteditor.h -o moc_texteditor.cpp
   2.689 +
   2.690 +moc_exporthtmldialog.cpp: $(MOC) exporthtmldialog.h
   2.691 +	$(MOC) exporthtmldialog.h -o moc_exporthtmldialog.cpp
   2.692 +
   2.693 +moc_exportxhtmldialog.cpp: $(MOC) exportxhtmldialog.h
   2.694 +	$(MOC) exportxhtmldialog.h -o moc_exportxhtmldialog.cpp
   2.695 +
   2.696 +moc_showtextdialog.cpp: $(MOC) showtextdialog.h
   2.697 +	$(MOC) showtextdialog.h -o moc_showtextdialog.cpp
   2.698 +
   2.699 +moc_extrainfodialog.cpp: $(MOC) extrainfodialog.h
   2.700 +	$(MOC) extrainfodialog.h -o moc_extrainfodialog.cpp
   2.701 +
   2.702 +####### Install
   2.703 +
   2.704 +install_target: all 
   2.705 +	@$(CHK_DIR_EXISTS) "$(INSTALL_ROOT)/usr/bin/" || $(MKDIR) "$(INSTALL_ROOT)/usr/bin/"
   2.706 +	-$(INSTALL_FILE) "$(QMAKE_TARGET)" "$(INSTALL_ROOT)/usr/bin/$(QMAKE_TARGET)"
   2.707 +
   2.708 +uninstall_target: 
   2.709 +	-$(DEL_FILE) "$(INSTALL_ROOT)/usr/bin/$(QMAKE_TARGET)"
   2.710 +	-$(DEL_DIR) "$(INSTALL_ROOT)/usr/bin/"
   2.711 +
   2.712 +
   2.713 +install_support: all 
   2.714 +	@$(CHK_DIR_EXISTS) "$(INSTALL_ROOT)/usr/share/vym/" || $(MKDIR) "$(INSTALL_ROOT)/usr/share/vym/"
   2.715 +	-$(INSTALL_DIR) "styles" "$(INSTALL_ROOT)/usr/share/vym/"
   2.716 +	-$(INSTALL_DIR) "scripts" "$(INSTALL_ROOT)/usr/share/vym/"
   2.717 +	-$(INSTALL_DIR) "icons" "$(INSTALL_ROOT)/usr/share/vym/"
   2.718 +
   2.719 +
   2.720 +uninstall_support: 
   2.721 +	-$(DEL_FILE) -r "$(INSTALL_ROOT)/usr/share/vym/styles"
   2.722 +	-$(DEL_FILE) -r "$(INSTALL_ROOT)/usr/share/vym/scripts"
   2.723 +	-$(DEL_FILE) -r "$(INSTALL_ROOT)/usr/share/vym/icons"
   2.724 +	-$(DEL_DIR) "$(INSTALL_ROOT)/usr/share/vym/"
   2.725 +
   2.726 +
   2.727 +install_demo: all 
   2.728 +	@$(CHK_DIR_EXISTS) "$(INSTALL_ROOT)/usr/share/vym/" || $(MKDIR) "$(INSTALL_ROOT)/usr/share/vym/"
   2.729 +	-$(INSTALL_DIR) "demos" "$(INSTALL_ROOT)/usr/share/vym/"
   2.730 +
   2.731 +
   2.732 +uninstall_demo: 
   2.733 +	-$(DEL_FILE) -r "$(INSTALL_ROOT)/usr/share/vym/demos"
   2.734 +	-$(DEL_DIR) "$(INSTALL_ROOT)/usr/share/vym/"
   2.735 +
   2.736 +
   2.737 +install: install_target install_support install_demo  
   2.738 +
   2.739 +uninstall: uninstall_target uninstall_support uninstall_demo  
   2.740 +
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/branchobj.cpp	Sun Jan 30 12:58:47 2005 +0000
     3.3 @@ -0,0 +1,1184 @@
     3.4 +#include "branchobj.h"
     3.5 +#include "texteditor.h"
     3.6 +#include "mapeditor.h"
     3.7 +#include "mainwindow.h"
     3.8 +
     3.9 +extern TextEditor *textEditor;
    3.10 +extern Main *mainWindow;
    3.11 +extern FlagRowObj *standardFlagsDefault;
    3.12 +extern QAction *actionEditOpenURL;
    3.13 +
    3.14 +
    3.15 +/////////////////////////////////////////////////////////////////
    3.16 +// BranchObj
    3.17 +/////////////////////////////////////////////////////////////////
    3.18 +
    3.19 +BranchObj* BranchObj::itLast=NULL;
    3.20 +
    3.21 +
    3.22 +BranchObj::BranchObj () :OrnamentedObj()
    3.23 +{
    3.24 +//    cout << "Const BranchObj ()\n";
    3.25 +    setParObj (this);	
    3.26 +    init();
    3.27 +    depth=-1;
    3.28 +}
    3.29 +
    3.30 +BranchObj::BranchObj (QCanvas* c):OrnamentedObj (c)
    3.31 +{
    3.32 +//    cout << "Const BranchObj (c)  called from MapCenterObj (c)\n";
    3.33 +    canvas=c;
    3.34 +}
    3.35 +
    3.36 +BranchObj::BranchObj (QCanvas* c, LinkableMapObj* p):OrnamentedObj (c)
    3.37 +{
    3.38 +//    cout << "Const BranchObj (c,p)\n";
    3.39 +    canvas=c;
    3.40 +    setParObj (p);	
    3.41 +    depth=p->getDepth()+1;
    3.42 +	if (depth==1)
    3.43 +		// Calc angle to mapCenter if I am a mainbranch
    3.44 +		// needed for reordering the mainbranches clockwise 
    3.45 +		// around mapcenter 
    3.46 +		angle=getAngle (QPoint ((int)(x() - parObj->getChildPos().x() ), 
    3.47 +								(int)(y() - parObj->getChildPos().y() ) ) );
    3.48 +    init();
    3.49 +}
    3.50 +
    3.51 +BranchObj::~BranchObj ()
    3.52 +{
    3.53 +    //cout << "Destr BranchObj\n";
    3.54 +	// Check, if this branch was the last child to be deleted
    3.55 +	// If so, unset the scrolled flags
    3.56 +
    3.57 +	BranchObj *po=(BranchObj*)(parObj);
    3.58 +	if (po)
    3.59 +	{
    3.60 +		BranchObj *bo=((BranchObj*)(parObj))->getLastBranch();
    3.61 +		if (!bo) po->unScroll();
    3.62 +	}
    3.63 +}
    3.64 +
    3.65 +bool BranchObj::operator< ( const BranchObj & other )
    3.66 +{
    3.67 +    return  angle < other.angle;
    3.68 +}
    3.69 +
    3.70 +bool BranchObj::operator== ( const BranchObj & other )
    3.71 +{
    3.72 +    return angle == other.angle;
    3.73 +}
    3.74 +
    3.75 +int BranchObjPtrList::compareItems ( QPtrCollection::Item i, QPtrCollection::Item j)
    3.76 +{
    3.77 +	// Make sure PtrList::find works
    3.78 +	if (i==j) return 0;
    3.79 +
    3.80 +	if ( ((BranchObj*)(i))->angle > ((BranchObj*)(j))->angle )
    3.81 +		return 1;
    3.82 +	else
    3.83 +		return -1;
    3.84 +}
    3.85 +
    3.86 +void BranchObj::init () 
    3.87 +{
    3.88 +    branch.setAutoDelete (true);
    3.89 +    floatimage.setAutoDelete (true);
    3.90 +
    3.91 +	absPos=getRandPos();
    3.92 +	absPos+=parObj->getChildPos();
    3.93 +
    3.94 +    // TODO This should be done in TextObj later
    3.95 +    QFont font("Sans Serif,8,-1,5,50,0,0,0,0,0");
    3.96 +//    font.setPointSize(12);
    3.97 +   heading->setFont(font );
    3.98 +//    heading->setText(QObject::tr("new branch"));
    3.99 +
   3.100 +    lastSelectedBranch=-1;
   3.101 +
   3.102 +    setChildObj(this);
   3.103 +
   3.104 +	scrolled=false;
   3.105 +	tmpUnscrolled=false;
   3.106 +
   3.107 +	url="";
   3.108 +	vymLink="";
   3.109 +}
   3.110 +
   3.111 +void BranchObj::copy (BranchObj* other)
   3.112 +{
   3.113 +    OrnamentedObj::copy(other);
   3.114 +
   3.115 +	branch.clear();
   3.116 +    BranchObj* b;
   3.117 +    for (b=other->branch.first(); b;b=other->branch.next() ) 
   3.118 +		// Make deep copy of b
   3.119 +		// Because addBranch again calls copy for the childs,
   3.120 +		// Those will get a deep copy, too
   3.121 +		addBranch(b);	
   3.122 +
   3.123 +	FloatImageObj *fi;
   3.124 +	for (fi=other->floatimage.first(); fi;fi=other->floatimage.next() )
   3.125 +		addFloatImage (fi);
   3.126 +
   3.127 +	scrolled=other->scrolled;
   3.128 +	tmpUnscrolled=other->tmpUnscrolled;
   3.129 +	setVisibility (other->visible);
   3.130 +
   3.131 +	url=other->url;
   3.132 +	vymLink=other->vymLink;
   3.133 +
   3.134 +	angle=other->angle;
   3.135 +
   3.136 +    positionBBox();
   3.137 +}
   3.138 +
   3.139 +void BranchObj::clear() 
   3.140 +{
   3.141 +	branch.clear();
   3.142 +	floatimage.clear();
   3.143 +}
   3.144 +
   3.145 +int BranchObj::getNum()
   3.146 +{
   3.147 +	if (parObj)
   3.148 +		return ((BranchObj*)(parObj))->getNum ((BranchObj*)(this));
   3.149 +	else
   3.150 +		return 0;
   3.151 +}
   3.152 +
   3.153 +int BranchObj::getNum(BranchObj *bo)
   3.154 +{
   3.155 +	return branch.findRef (bo);
   3.156 +}
   3.157 +
   3.158 +int BranchObj::getFloatImageNum(FloatImageObj *fio)
   3.159 +{
   3.160 +	return floatimage.findRef (fio);
   3.161 +}
   3.162 +
   3.163 +int BranchObj::countBranches()
   3.164 +{
   3.165 +	return branch.count();
   3.166 +}
   3.167 +
   3.168 +int BranchObj::countFloatImages()
   3.169 +{
   3.170 +	return floatimage.count();
   3.171 +}
   3.172 +
   3.173 +void BranchObj::setParObjTmp(LinkableMapObj* lmo, QPoint m, int off)
   3.174 +{
   3.175 +	// Temporary link to lmo
   3.176 +	// m is position of mouse pointer 
   3.177 +	// offset 0: default 1: below lmo   -1 above lmo  (if possible)
   3.178 +
   3.179 +
   3.180 +	BranchObj* o=(BranchObj*)(lmo);
   3.181 +	if (!parObjTmpBuf) 
   3.182 +		parObjTmpBuf=parObj;
   3.183 +
   3.184 +	// ignore mapcenter and mainbranch
   3.185 +	if (lmo->getDepth()<2) off=0;
   3.186 +	if (off==0)
   3.187 +	{
   3.188 +		link2ParPos=false;
   3.189 +		parObj=o;
   3.190 +	}	
   3.191 +	else
   3.192 +	{	
   3.193 +		link2ParPos=true;
   3.194 +		if (off>0)
   3.195 +			parObj=o->getParObj();
   3.196 +		else	
   3.197 +			parObj=o->getParObj();
   3.198 +		parObj=o;
   3.199 +	}		
   3.200 +
   3.201 +	depth=parObj->getDepth()+1;
   3.202 +
   3.203 +	// setLinkStyle calls updateLink, only set it once
   3.204 +	if (style!=getDefLinkStyle() ) setLinkStyle (getDefLinkStyle());
   3.205 +
   3.206 +	// Move temporary to new position at destination
   3.207 +	// Usually the positioning would be done by reposition(),
   3.208 +	// but then also the destination branch would "Jump" around...
   3.209 +	// Better just do it approximately
   3.210 +	if (depth==1)
   3.211 +	{	// new parent is the mapcenter itself
   3.212 +
   3.213 +		QPoint p= normalise ( QPoint (m.x() - o->getChildPos().x(),
   3.214 +									  m.y() - o->getChildPos().y() ));
   3.215 +		if (p.x()<0) p.setX( p.x()-bbox.width() );
   3.216 +		move2RelPos (p);
   3.217 +	} else
   3.218 +	{	
   3.219 +		int y;
   3.220 +		if (off==0)
   3.221 +		{
   3.222 +			// new parent is just a branch, link to it
   3.223 +			QRect t=o->getBBoxSizeWithChilds();
   3.224 +			if (o->getLastBranch())
   3.225 +				y=t.y() + t.height() ;
   3.226 +			else
   3.227 +				y=t.y();
   3.228 +
   3.229 +		} else
   3.230 +		{
   3.231 +			if (off<0)
   3.232 +				// we want to link above lmo
   3.233 +				y=o->y() - height() + 5;
   3.234 +			else	
   3.235 +				// we want to link below lmo
   3.236 +				// Bottom of sel should be 5 pixels above
   3.237 +				// the bottom of the branch _below_ the target:
   3.238 +				// Don't try to find that branch, guess 12 pixels
   3.239 +				y=o->getChildPos().y()  -height() + 12; 
   3.240 +		}	
   3.241 +		if (o->getOrientation()==OrientLeftOfCenter)
   3.242 +			move ( o->getChildPos().x() - linkwidth, y );
   3.243 +		else	
   3.244 +			move (o->getChildPos().x() + linkwidth, y );
   3.245 +	}	
   3.246 +
   3.247 +	// updateLink is called implicitly in move
   3.248 +	reposition();	// FIXME shouldn't be this a request?
   3.249 +}
   3.250 +
   3.251 +void BranchObj::unsetParObjTmp()
   3.252 +{
   3.253 +	if (parObjTmpBuf) 
   3.254 +	{
   3.255 +		link2ParPos=false;
   3.256 +		parObj=parObjTmpBuf;
   3.257 +		parObjTmpBuf=NULL;
   3.258 +		depth=parObj->getDepth()+1;
   3.259 +		setLinkStyle (getDefLinkStyle() );
   3.260 +	}		
   3.261 +}
   3.262 +
   3.263 +void BranchObj::unScroll()
   3.264 +{
   3.265 +	if (tmpUnscrolled) resetTmpUnscroll();
   3.266 +	if (scrolled) toggleScroll();
   3.267 +}
   3.268 +
   3.269 +void BranchObj::toggleScroll()
   3.270 +{
   3.271 +	BranchObj *bo;
   3.272 +	if (scrolled)
   3.273 +	{
   3.274 +		scrolled=false;
   3.275 +		systemFlags->deactivate("scrolledright");
   3.276 +		for (bo=branch.first(); bo; bo=branch.next() )
   3.277 +		{
   3.278 +			bo->setVisibility(true);
   3.279 +		}
   3.280 +	} else
   3.281 +	{
   3.282 +		scrolled=true;
   3.283 +		systemFlags->activate("scrolledright");
   3.284 +		for (bo=branch.first(); bo; bo=branch.next() )
   3.285 +		{
   3.286 +			bo->setVisibility(false);
   3.287 +		}
   3.288 +	}
   3.289 +	calcBBoxSize();
   3.290 +	positionBBox();	
   3.291 +	move (absPos.x(), absPos.y() );
   3.292 +	forceReposition();
   3.293 +}
   3.294 +
   3.295 +bool BranchObj::isScrolled()
   3.296 +{
   3.297 +	return scrolled;
   3.298 +}
   3.299 +
   3.300 +bool BranchObj::hasScrolledParent(BranchObj *start)
   3.301 +{
   3.302 +	// Calls parents recursivly to
   3.303 +	// find out, if we are scrolled at all.
   3.304 +	// But ignore myself, just look at parents.
   3.305 +
   3.306 +	if (this !=start && scrolled) return true;
   3.307 +
   3.308 +	BranchObj* bo=(BranchObj*)(parObj);
   3.309 +	if (bo) 
   3.310 +		return bo->hasScrolledParent(start);
   3.311 +	else
   3.312 +		return false;
   3.313 +}
   3.314 +
   3.315 +void BranchObj::tmpUnscroll()
   3.316 +{
   3.317 +	// Unscroll parent (recursivly)
   3.318 +	BranchObj* bo=(BranchObj*)(parObj);
   3.319 +	if (bo) bo->tmpUnscroll();
   3.320 +		
   3.321 +	// Unscroll myself
   3.322 +	if (scrolled)
   3.323 +	{
   3.324 +		tmpUnscrolled=true;
   3.325 +		systemFlags->activate("tmpUnscrolledright");
   3.326 +		toggleScroll();
   3.327 +	}	
   3.328 +}
   3.329 +
   3.330 +void BranchObj::resetTmpUnscroll()
   3.331 +{
   3.332 +	// Unscroll parent (recursivly)
   3.333 +	BranchObj* bo=(BranchObj*)(parObj);
   3.334 +	if (bo)
   3.335 +		bo->resetTmpUnscroll();
   3.336 +		
   3.337 +	// Unscroll myself
   3.338 +	if (tmpUnscrolled)
   3.339 +	{
   3.340 +		tmpUnscrolled=false;
   3.341 +		systemFlags->deactivate("tmpUnscrolledright");
   3.342 +		toggleScroll();
   3.343 +	}	
   3.344 +}
   3.345 +
   3.346 +void BranchObj::setVisibility(bool v, int toDepth)
   3.347 +{
   3.348 +    if (depth <= toDepth)
   3.349 +    {
   3.350 +		frame->setVisibility(v);
   3.351 +		heading->setVisibility(v);
   3.352 +		systemFlags->setVisibility(v);
   3.353 +		standardFlags->setVisibility(v);
   3.354 +		LinkableMapObj::setVisibility (v);
   3.355 +		
   3.356 +		if (!scrolled && (depth < toDepth))
   3.357 +		{
   3.358 +			// Now go recursivly through all childs
   3.359 +			BranchObj* b;
   3.360 +			for (b=branch.first(); b;b=branch.next() ) 
   3.361 +				b->setVisibility (v,toDepth);	
   3.362 +			FloatImageObj *fio;
   3.363 +			for (fio=floatimage.first(); fio; fio=floatimage.next())
   3.364 +				fio->setVisibility (v);
   3.365 +		}
   3.366 +    } // depth <= toDepth	
   3.367 +	move (absPos.x(), absPos.y() );
   3.368 +	requestReposition();
   3.369 +}	
   3.370 +
   3.371 +void BranchObj::setVisibility(bool v)
   3.372 +{
   3.373 +    setVisibility (v,MAX_DEPTH);
   3.374 +}
   3.375 +
   3.376 +
   3.377 +void BranchObj::setLinkColor ()
   3.378 +{
   3.379 +	// Overloaded from LinkableMapObj
   3.380 +	// BranchObj can use color of heading
   3.381 +
   3.382 +	if (mapEditor->getLinkColorHint()==HeadingColor)
   3.383 +		LinkableMapObj::setLinkColor (heading->getColor() );
   3.384 +	else	
   3.385 +		LinkableMapObj::setLinkColor ();
   3.386 +}
   3.387 +
   3.388 +void BranchObj::setColor (QColor col, bool colorChilds)
   3.389 +{
   3.390 +    heading->setColor(col);
   3.391 +	setLinkColor();
   3.392 +    if (colorChilds) 
   3.393 +    {
   3.394 +		BranchObj *bo;
   3.395 +		for (bo=branch.first(); bo; bo=branch.next() )
   3.396 +			bo->setColor(col,colorChilds);
   3.397 +    }	
   3.398 +}
   3.399 +
   3.400 +
   3.401 +BranchObj* BranchObj::first()
   3.402 +{
   3.403 +	itLast=NULL;	
   3.404 +	return this; 
   3.405 +}
   3.406 +	
   3.407 +BranchObj* BranchObj::next()
   3.408 +{
   3.409 +	BranchObj *lmo;
   3.410 +	BranchObj *bo=branch.first();
   3.411 +	BranchObj *po=(BranchObj*)(parObj);
   3.412 +
   3.413 +	if (!itLast)
   3.414 +	{	// We are just beginning at the mapCenter
   3.415 +		if (bo) 
   3.416 +		{
   3.417 +			itLast=this;
   3.418 +			return bo;
   3.419 +		}	
   3.420 +		else
   3.421 +		{
   3.422 +			itLast=NULL;
   3.423 +			return NULL;
   3.424 +		}	
   3.425 +	}
   3.426 +
   3.427 +	if (itLast==parObj)
   3.428 +	{	// We come from above
   3.429 +		if (bo)
   3.430 +		{
   3.431 +			// there are childs, go there
   3.432 +			itLast=this;
   3.433 +			return bo;
   3.434 +		}	
   3.435 +		else
   3.436 +		{	// no childs, try to go up again
   3.437 +			if (po)
   3.438 +			{
   3.439 +				// go up
   3.440 +				itLast=this;
   3.441 +				lmo=po->next();
   3.442 +				itLast=this;
   3.443 +				return lmo;
   3.444 +
   3.445 +			}	
   3.446 +			else
   3.447 +			{
   3.448 +				// can't go up, I am mapCenter
   3.449 +				itLast=NULL;
   3.450 +				return NULL;
   3.451 +			}	
   3.452 +		}
   3.453 +	}
   3.454 +
   3.455 +	// Try to find last child, we came from, in my own childs
   3.456 +	bool searching=true;
   3.457 +	while (bo && searching)
   3.458 +	{
   3.459 +		if (itLast==bo) searching=false;
   3.460 +		bo=branch.next();
   3.461 +	}
   3.462 +	if (!searching)
   3.463 +	{	// found lastLMO in my childs
   3.464 +		if (bo)
   3.465 +		{
   3.466 +			// found a brother of lastLMO 
   3.467 +			itLast=this;
   3.468 +			return bo;
   3.469 +		}	
   3.470 +		else
   3.471 +		{
   3.472 +			if (po)
   3.473 +			{
   3.474 +				// go up
   3.475 +				itLast=this;
   3.476 +				lmo=po->next();
   3.477 +				itLast=this;
   3.478 +				return lmo;
   3.479 +			}
   3.480 +			else
   3.481 +			{
   3.482 +				// can't go up, I am mapCenter
   3.483 +				itLast=NULL;
   3.484 +				return NULL;
   3.485 +			}	
   3.486 +		}
   3.487 +	}
   3.488 +
   3.489 +	// couldn't find last child, it must be a nephew of mine
   3.490 +	bo=branch.first();
   3.491 +	if (bo)
   3.492 +	{
   3.493 +		// proceed with my first child
   3.494 +		itLast=this;	
   3.495 +		return bo;
   3.496 +	}	
   3.497 +	else
   3.498 +	{
   3.499 +		// or go back to my parents
   3.500 +		if (po)
   3.501 +		{
   3.502 +			// go up
   3.503 +			itLast=this;
   3.504 +			lmo=po->next();
   3.505 +			itLast=this;
   3.506 +			return lmo;
   3.507 +		}	
   3.508 +		else
   3.509 +		{
   3.510 +			// can't go up, I am mapCenter
   3.511 +			itLast=NULL;
   3.512 +			return NULL;
   3.513 +		}	
   3.514 +	}	
   3.515 +}
   3.516 +
   3.517 +BranchObj* BranchObj::getLastIterator()
   3.518 +{
   3.519 +	return itLast;
   3.520 +}
   3.521 +
   3.522 +void BranchObj::setLastIterator(BranchObj* it)
   3.523 +{
   3.524 +	itLast=it;
   3.525 +}
   3.526 +
   3.527 +
   3.528 +void BranchObj::move (double x, double y)
   3.529 +{
   3.530 +	OrnamentedObj::move (x,y);
   3.531 +    positionBBox();
   3.532 +}
   3.533 +
   3.534 +void BranchObj::move (QPoint p)
   3.535 +{
   3.536 +	move (p.x(), p.y());
   3.537 +}
   3.538 +
   3.539 +void BranchObj::moveBy (double x, double y)
   3.540 +{
   3.541 +	OrnamentedObj::moveBy (x,y);
   3.542 +    positionBBox();
   3.543 +    BranchObj* b;
   3.544 +    for (b=branch.first(); b;b=branch.next() ) 
   3.545 +		b->moveBy (x,y);
   3.546 +}
   3.547 +
   3.548 +void BranchObj::moveBy (QPoint p)
   3.549 +{
   3.550 +	moveBy (p.x(), p.y());
   3.551 +}
   3.552 +
   3.553 +
   3.554 +void BranchObj::positionBBox()
   3.555 +{
   3.556 +
   3.557 +    heading->positionBBox();
   3.558 +	systemFlags->positionBBox();
   3.559 +	standardFlags->positionBBox();
   3.560 +	// It seems that setting x,y also affects width,height
   3.561 +	int w_old=bbox.width();
   3.562 +	int h_old=bbox.height();
   3.563 +    bbox.setX (absPos.x() );
   3.564 +	bbox.setY (absPos.y() );
   3.565 +	bbox.setWidth(w_old);
   3.566 +	bbox.setHeight(h_old);
   3.567 +
   3.568 +
   3.569 +	setSelBox();
   3.570 +
   3.571 +	// set the frame
   3.572 +	frame->setRect(QRect(bbox.x(),bbox.y(),bbox.width(),bbox.height() ) );
   3.573 +}
   3.574 +
   3.575 +void BranchObj::calcBBoxSize()
   3.576 +{
   3.577 +    QSize heading_r=heading->getSize();
   3.578 +    int heading_w=static_cast <int> (heading_r.width() );
   3.579 +    int heading_h=static_cast <int> (heading_r.height() );
   3.580 +    QSize sysflags_r=systemFlags->getSize();
   3.581 +	int sysflags_h=sysflags_r.height();
   3.582 +	int sysflags_w=sysflags_r.width();
   3.583 +    QSize stanflags_r=standardFlags->getSize();
   3.584 +	int stanflags_h=stanflags_r.height();
   3.585 +	int stanflags_w=stanflags_r.width();
   3.586 +    int w;
   3.587 +    int h;
   3.588 +
   3.589 +	// set width to sum of all widths
   3.590 +	w=heading_w + sysflags_w + stanflags_w;
   3.591 +	// set height to maximum needed height
   3.592 +	h=max (sysflags_h,stanflags_h);
   3.593 +	h=max (h,heading_h);
   3.594 +
   3.595 +    w+=frame->getBorder();
   3.596 +    h+=frame->getBorder();
   3.597 +    bbox.setSize (QSize (w,h));
   3.598 +}
   3.599 +
   3.600 +LinkableMapObj* BranchObj::findMapObj(QPoint p, LinkableMapObj* excludeLMO)
   3.601 +{
   3.602 +	// Search branches
   3.603 +    BranchObj *b;
   3.604 +    LinkableMapObj *lmo;
   3.605 +    for (b=branch.first(); b; b=branch.next() )
   3.606 +    {	
   3.607 +		lmo=b->findMapObj(p, excludeLMO);
   3.608 +		if (lmo != NULL) return lmo;
   3.609 +    }
   3.610 +	
   3.611 +	// Search myself
   3.612 +    if (inBBox (p) && (this != excludeLMO) && isVisibleObj() ) 
   3.613 +		return this;
   3.614 +
   3.615 +	// Search float images
   3.616 +	FloatImageObj *foi;
   3.617 +    for (foi=floatimage.first(); foi; foi=floatimage.next() )
   3.618 +		if (foi->inBBox(p) && (foi != excludeLMO) && foi->getParObj()!= excludeLMO) return foi;
   3.619 +
   3.620 +    return NULL;
   3.621 +}
   3.622 +
   3.623 +void BranchObj::setHeading(QString s)
   3.624 +{
   3.625 +    // Adjusting font size
   3.626 +    QFont font=heading->getFont();
   3.627 +	if (depth==0)
   3.628 +		font.setPointSize(16);
   3.629 +	else	
   3.630 +		if (depth>1) 
   3.631 +			font.setPointSize(10);
   3.632 +		else
   3.633 +			font.setPointSize(12);
   3.634 +    heading->setFont(font);
   3.635 +    heading->setText(s);	// set new heading
   3.636 +	calcBBoxSize();			// recalculate bbox
   3.637 +    positionBBox();			// rearrange contents
   3.638 +	requestReposition();
   3.639 +}
   3.640 +
   3.641 +void BranchObj::setURL(QString s)
   3.642 +{
   3.643 +	url=s;
   3.644 +	if (!url.isEmpty())
   3.645 +		systemFlags->activate("url");
   3.646 +	else	
   3.647 +		systemFlags->deactivate("url");
   3.648 +	calcBBoxSize();			// recalculate bbox
   3.649 +    positionBBox();			// rearrange contents
   3.650 +	forceReposition();
   3.651 +}
   3.652 +
   3.653 +QString BranchObj::getURL()
   3.654 +{
   3.655 +	return url;
   3.656 +}
   3.657 +
   3.658 +void BranchObj::setVymLink(QString s)
   3.659 +{
   3.660 +	if (!s.isEmpty())
   3.661 +	{
   3.662 +		// We need the relative (from loading) 
   3.663 +		// or absolute path (from User event)
   3.664 +		// and build the absolute path.
   3.665 +		// Note: If we have relative, use path of
   3.666 +		// current map to build absolute path
   3.667 +		QDir d(s);
   3.668 +		if (!d.path().startsWith ("/"))
   3.669 +		{
   3.670 +			QString p=mapEditor->getDestPath();
   3.671 +			int i=p.findRev("/",-1);
   3.672 +			d.setPath(p.left(i)+"/"+s);
   3.673 +			d.convertToAbs();
   3.674 +		}
   3.675 +		vymLink=d.path();
   3.676 +		systemFlags->activate("vymLink");
   3.677 +	}	
   3.678 +	else	
   3.679 +	{
   3.680 +		systemFlags->deactivate("vymLink");
   3.681 +		vymLink="";
   3.682 +	}	
   3.683 +	calcBBoxSize();			// recalculate bbox
   3.684 +    positionBBox();			// rearrange contents
   3.685 +	forceReposition();
   3.686 +}
   3.687 +
   3.688 +QString BranchObj::getVymLink()
   3.689 +{
   3.690 +	return vymLink;
   3.691 +}
   3.692 +
   3.693 +QString BranchObj::saveToDir (const QString &tmpdir,const QString &prefix, const QPoint& offset)
   3.694 +{
   3.695 +    QString s,a;
   3.696 +	QString scrolledAttr;
   3.697 +	if (scrolled) 
   3.698 +		scrolledAttr=attribut ("scrolled","yes");
   3.699 +	else
   3.700 +		scrolledAttr="";
   3.701 +
   3.702 +	QString posAttr;
   3.703 +	if (depth<2) posAttr=
   3.704 +		attribut("absPosX",QString().setNum(absPos.x(),10)) +
   3.705 +		attribut("absPosY",QString().setNum(absPos.y(),10)); 
   3.706 +	else
   3.707 +		posAttr="";
   3.708 +
   3.709 +	QString urlAttr;
   3.710 +	if (!url.isEmpty())
   3.711 +		urlAttr=attribut ("url",url);
   3.712 +
   3.713 +	QString vymLinkAttr;
   3.714 +	if (!vymLink.isEmpty())
   3.715 +		vymLinkAttr=attribut ("vymLink",convertToRel(mapEditor->getDestPath(),vymLink) );
   3.716 +
   3.717 +	QString frameAttr;
   3.718 +	if (frame->getFrameType()!=NoFrame)
   3.719 +		frameAttr=attribut ("frameType",frame->getFrameTypeName());
   3.720 +	else
   3.721 +		frameAttr="";
   3.722 +
   3.723 +	// save area, if not scrolled
   3.724 +	QString areaAttr;
   3.725 +	if (!((BranchObj*)(parObj))->isScrolled() )
   3.726 +	{
   3.727 +		areaAttr=
   3.728 +			attribut("x1",QString().setNum(absPos.x()-offset.x(),10)) +
   3.729 +			attribut("y1",QString().setNum(absPos.y()-offset.y(),10)) +
   3.730 +			attribut("x2",QString().setNum(absPos.x()+width()-offset.x(),10)) +
   3.731 +			attribut("y2",QString().setNum(absPos.y()+height()-offset.y(),10));
   3.732 +
   3.733 +	} else
   3.734 +		areaAttr="";
   3.735 +	
   3.736 +    s=beginElement ("branch" +scrolledAttr +posAttr +urlAttr +vymLinkAttr +frameAttr +areaAttr);
   3.737 +    incIndent();
   3.738 +
   3.739 +	// save heading
   3.740 +    s=s+valueElement("heading", getHeading(),
   3.741 +		attribut ("textColor",QColor(heading->getColor()).name()));
   3.742 +
   3.743 +	// save names of flags set
   3.744 +	s+=standardFlags->saveToDir(tmpdir,prefix,0);
   3.745 +	
   3.746 +	// save note
   3.747 +	if (!note.isEmpty() )
   3.748 +		s+=note.saveToDir();
   3.749 +	
   3.750 +	// Save branches
   3.751 +    BranchObj *bo;
   3.752 +    for (bo=branch.first(); bo; bo=branch.next() )
   3.753 +		s+=bo->saveToDir(tmpdir,prefix,offset);
   3.754 +    decIndent();
   3.755 +
   3.756 +	// Save FloatImages
   3.757 +	FloatImageObj *fio;
   3.758 +	for (fio=floatimage.first(); fio; fio=floatimage.next() )
   3.759 +		s+=fio->saveToDir (tmpdir,prefix);
   3.760 +
   3.761 +    s+=endElement   ("branch");
   3.762 +    return s;
   3.763 +}
   3.764 +
   3.765 +LinkableMapObj* BranchObj::addFloatImage ()
   3.766 +{
   3.767 +	FloatImageObj *newfi=new FloatImageObj (canvas,this);
   3.768 +	floatimage.append (newfi);
   3.769 +	if (hasScrolledParent(this) )
   3.770 +		newfi->setVisibility (false);
   3.771 +	else	
   3.772 +		newfi->setVisibility(visible);
   3.773 +	requestReposition();
   3.774 +	return newfi;
   3.775 +}
   3.776 +
   3.777 +LinkableMapObj* BranchObj::addFloatImage (FloatImageObj *fio)
   3.778 +{
   3.779 +	FloatImageObj *newfi=new FloatImageObj (canvas,this);
   3.780 +	floatimage.append (newfi);
   3.781 +	newfi->copy (fio);
   3.782 +	if (hasScrolledParent(this) )
   3.783 +		newfi->setVisibility (false);
   3.784 +	else	
   3.785 +		newfi->setVisibility(visible);
   3.786 +	requestReposition();
   3.787 +	return newfi;
   3.788 +}
   3.789 +
   3.790 +FloatImageObj* BranchObj::getFirstFloatImage ()
   3.791 +{
   3.792 +    return floatimage.first();
   3.793 +}
   3.794 +
   3.795 +FloatImageObj* BranchObj::getLastFloatImage ()
   3.796 +{
   3.797 +    return floatimage.last();
   3.798 +}
   3.799 +
   3.800 +FloatImageObj* BranchObj::getFloatImageNum (const uint &i)
   3.801 +{
   3.802 +    return floatimage.at(i);
   3.803 +}
   3.804 +
   3.805 +void BranchObj::removeFloatImage (FloatImageObj *fio)
   3.806 +{
   3.807 +	floatimage.remove (fio);
   3.808 +	requestReposition();
   3.809 +}
   3.810 +
   3.811 +void BranchObj::savePosInAngle ()
   3.812 +{
   3.813 +	// Save position in angle
   3.814 +    BranchObj *b;
   3.815 +	int i=0;
   3.816 +    for (b=branch.first(); b; b=branch.next() )
   3.817 +	{
   3.818 +		b->angle=i;
   3.819 +		i++;
   3.820 +	}
   3.821 +}
   3.822 +
   3.823 +BranchObj* BranchObj::addBranch()
   3.824 +{
   3.825 +    BranchObj* newbo=new BranchObj(canvas,this);
   3.826 +    branch.append (newbo);
   3.827 +    newbo->setParObj(this);
   3.828 +    newbo->setColor(getColor(),false);	
   3.829 +    newbo->setLinkColor();	
   3.830 +    newbo->setHeading ("new");
   3.831 +	newbo->setLinkStyle (newbo->getDefLinkStyle());
   3.832 +	if (scrolled)
   3.833 +		newbo->setVisibility (false);
   3.834 +	else	
   3.835 +		newbo->setVisibility(visible);
   3.836 +	requestReposition();
   3.837 +	return newbo;
   3.838 +}
   3.839 +
   3.840 +BranchObj* BranchObj::addBranch(BranchObj* bo)
   3.841 +{
   3.842 +    BranchObj* newbo=new BranchObj(canvas,this);
   3.843 +    branch.append (newbo);
   3.844 +    newbo->copy(bo);
   3.845 +    newbo->setParObj(this);
   3.846 +	newbo->setHeading (newbo->getHeading());	// adjust fontsize to depth
   3.847 +	newbo->setLinkStyle (newbo->getDefLinkStyle());
   3.848 +	if (scrolled)
   3.849 +		newbo->setVisibility (false);
   3.850 +	else	
   3.851 +		newbo->setVisibility(bo->visible);
   3.852 +	requestReposition();
   3.853 +	return newbo;
   3.854 +}
   3.855 +
   3.856 +BranchObj* BranchObj::insertBranch(int pos)
   3.857 +{
   3.858 +	savePosInAngle();
   3.859 +	// Add new bo and resort branches
   3.860 +	BranchObj *newbo=addBranch ();
   3.861 +	newbo->angle=pos-0.5;
   3.862 +	branch.sort();
   3.863 +	return newbo;
   3.864 +}
   3.865 +
   3.866 +BranchObj* BranchObj::insertBranch(BranchObj* bo, int pos)
   3.867 +{
   3.868 +	savePosInAngle();
   3.869 +	// Add new bo and resort branches
   3.870 +	bo->angle=pos-0.5;
   3.871 +	BranchObj *newbo=addBranch (bo);
   3.872 +	branch.sort();
   3.873 +	return newbo;
   3.874 +}
   3.875 +
   3.876 +void BranchObj::removeBranch(BranchObj* bo)
   3.877 +{
   3.878 +    // if bo is not in branch remove returns false, we
   3.879 +    // don't care...
   3.880 +    branch.remove (bo);
   3.881 +	requestReposition();
   3.882 +}
   3.883 +
   3.884 +void BranchObj::setLastSelectedBranch (BranchObj* bo)
   3.885 +{
   3.886 +    lastSelectedBranch=branch.find(bo);
   3.887 +}
   3.888 +
   3.889 +BranchObj* BranchObj::getLastSelectedBranch ()
   3.890 +{
   3.891 +    if (lastSelectedBranch>=0) 
   3.892 +	{
   3.893 +		BranchObj* bo=branch.at(lastSelectedBranch);
   3.894 +		if (bo) return bo;
   3.895 +    }	
   3.896 +    return branch.first();
   3.897 +}
   3.898 +
   3.899 +BranchObj* BranchObj::getFirstBranch ()
   3.900 +{
   3.901 +    return branch.first();
   3.902 +}
   3.903 +
   3.904 +BranchObj* BranchObj::getLastBranch ()
   3.905 +{
   3.906 +    return branch.last();
   3.907 +}
   3.908 +
   3.909 +BranchObj* BranchObj::getBranchNum (const uint &i)
   3.910 +{
   3.911 +    return branch.at(i);
   3.912 +}
   3.913 +
   3.914 +
   3.915 +BranchObj* BranchObj::moveBranchUp(BranchObj* bo1) // move a branch up (modify myself)
   3.916 +{
   3.917 +	savePosInAngle();
   3.918 +    int i=branch.find(bo1);
   3.919 +    if (i>0) 
   3.920 +	{	// -1 if bo1 not found 
   3.921 +		branch.at(i)->angle--;
   3.922 +		branch.at(i-1)->angle++;
   3.923 +		branch.sort();
   3.924 +		return branch.at(i-1);
   3.925 +	} else
   3.926 +		return branch.at(i);
   3.927 +}
   3.928 +
   3.929 +BranchObj* BranchObj::moveBranchDown(BranchObj* bo1)
   3.930 +{
   3.931 +	savePosInAngle();
   3.932 +    int i=branch.find(bo1);
   3.933 +	int j;
   3.934 +	if (branch.next())
   3.935 +	{
   3.936 +		j = branch.at();
   3.937 +		branch.at(i)->angle++;
   3.938 +		branch.at(j)->angle--;
   3.939 +		branch.sort();
   3.940 +		return branch.at(j);
   3.941 +	} else
   3.942 +		return branch.at(i);
   3.943 +}
   3.944 +
   3.945 +void BranchObj::alignRelativeTo (QPoint ref)
   3.946 +{
   3.947 +/* FIXME testing
   3.948 +	if (!getHeading().isEmpty())
   3.949 +		cout << "BO::alignRelTo "<<getHeading()<<endl;
   3.950 +	else	
   3.951 +		cout << "BO::alignRelTo  ???"<<endl;
   3.952 +	cout << "  d="<<depth<<endl;
   3.953 +*/	
   3.954 +	int th = bboxTotal.height();	
   3.955 +
   3.956 +	// If I am the mapcenter or a mainbranch, reposition heading
   3.957 +	if (depth<2)
   3.958 +	{
   3.959 +		move (absPos.x(),absPos.y());
   3.960 +		if (depth==1)
   3.961 +		{
   3.962 +			// Calc angle to mapCenter if I am a mainbranch
   3.963 +			// needed for reordering the mainbranches clockwise 
   3.964 +			// around mapcenter 
   3.965 +			angle=getAngle (QPoint ((int)(x() - parObj->getChildPos().x() ), 
   3.966 +									(int)(y() - parObj->getChildPos().y() ) ) );
   3.967 +		}	
   3.968 +	} 
   3.969 +	else
   3.970 +    {
   3.971 +		// Align myself depending on orientation and parent, but
   3.972 +		// only if I am not the mainbranch or mapcenter itself
   3.973 +		switch (orientation) 
   3.974 +		{
   3.975 +			case OrientLeftOfCenter:
   3.976 +				move (ref.x()-bbox.width(), ref.y() + (th-bbox.height())/2 );
   3.977 +			break;
   3.978 +			case OrientRightOfCenter:	
   3.979 +				move (ref.x(), ref.y() + (th-bbox.height())/2 );
   3.980 +			break;
   3.981 +			default:
   3.982 +				cout <<"LMO::alignRelativeTo: oops, no orientation given...\n";
   3.983 +			break;
   3.984 +		}		
   3.985 +    }		
   3.986 +
   3.987 +	FloatImageObj *fio;
   3.988 +    for (fio=floatimage.first(); fio; fio=floatimage.next() )
   3.989 +		fio->reposition();
   3.990 +
   3.991 +	if (scrolled) return;
   3.992 +
   3.993 +    // Set reference point for alignment of childs
   3.994 +    QPoint ref2;
   3.995 +    if (orientation==OrientLeftOfCenter)
   3.996 +		ref2.setX(childPos.x() - linkwidth);
   3.997 +    else	
   3.998 +		ref2.setX(childPos.x() + linkwidth);
   3.999 +
  3.1000 +	if (depth==1)
  3.1001 +		ref2.setY(absPos.y()-(bboxTotal.height()-bbox.height())/2);
  3.1002 +	else	
  3.1003 +		ref2.setY(ref.y() );	
  3.1004 +
  3.1005 +    // Align the childs depending on reference point 
  3.1006 +    BranchObj *b;
  3.1007 +    for (b=branch.first(); b; b=branch.next() )
  3.1008 +    {	
  3.1009 +		b->alignRelativeTo (ref2);
  3.1010 +		ref2.setY(ref2.y() + b->getBBoxSizeWithChilds().height() );
  3.1011 +    }
  3.1012 +}
  3.1013 +
  3.1014 +
  3.1015 +void BranchObj::reposition()
  3.1016 +{	
  3.1017 +/* FIXME testing
  3.1018 +	if (!getHeading().isEmpty())
  3.1019 +		cout << "BO::reposition  "<<getHeading()<<endl;
  3.1020 +	else	
  3.1021 +		cout << "BO::reposition  ???"<<endl;
  3.1022 +*/		
  3.1023 +	if (depth==0)
  3.1024 +	{
  3.1025 +		// only calculate the sizes once. If the deepest LMO 
  3.1026 +		// changes its height,
  3.1027 +		// all upper LMOs have to change, too.
  3.1028 +		calcBBoxSizeWithChilds();
  3.1029 +	    alignRelativeTo ( QPoint (absPos.x(),
  3.1030 +			absPos.y()-(bboxTotal.height()-bbox.height())/2) );
  3.1031 +		branch.sort();	
  3.1032 +	} else
  3.1033 +	{
  3.1034 +		// This is only important for moving branches:
  3.1035 +		// For editing a branch it isn't called...
  3.1036 +	    alignRelativeTo ( QPoint (absPos.x(),
  3.1037 +							absPos.y()-(bboxTotal.height()-bbox.height())/2) );
  3.1038 +	}
  3.1039 +}
  3.1040 +
  3.1041 +
  3.1042 +QRect BranchObj::getTotalBBox()
  3.1043 +{
  3.1044 +	QRect r=bbox;
  3.1045 +
  3.1046 +	if (scrolled) return r;
  3.1047 +
  3.1048 +	BranchObj* b;
  3.1049 +	for (b=branch.first();b ;b=branch.next() )
  3.1050 +		r=addBBox(b->getTotalBBox(),r);
  3.1051 +
  3.1052 +	FloatImageObj* fio;
  3.1053 +	for (fio=floatimage.first();fio ;fio=floatimage.next() )
  3.1054 +		r=addBBox(fio->getTotalBBox(),r);
  3.1055 +		
  3.1056 +	return r;
  3.1057 +}
  3.1058 +
  3.1059 +QRect BranchObj::getBBoxSizeWithChilds()
  3.1060 +{
  3.1061 +	return bboxTotal;
  3.1062 +}
  3.1063 +
  3.1064 +void BranchObj::calcBBoxSizeWithChilds()
  3.1065 +{
  3.1066 +	// This is called only from reposition and
  3.1067 +	// and only for mapcenter. So it won't be
  3.1068 +	// called more than once for a single user 
  3.1069 +	// action
  3.1070 +	
  3.1071 +	// Calculate size of LMO including all childs (to align them later)
  3.1072 +
  3.1073 +	bboxTotal.setX(bbox.x() );
  3.1074 +	bboxTotal.setY(bbox.y() );
  3.1075 +
  3.1076 +	// if branch is scrolled, ignore childs, but still consider floatimages
  3.1077 +	if (scrolled)
  3.1078 +	{
  3.1079 +		bboxTotal.setWidth (bbox.width());
  3.1080 +		bboxTotal.setHeight(bbox.height());
  3.1081 +		return;
  3.1082 +	}
  3.1083 +	
  3.1084 +	QRect r(0,0,0,0);
  3.1085 +	QRect br;
  3.1086 +	// Now calculate recursivly
  3.1087 +	// sum of heights 
  3.1088 +	// maximum of widths 
  3.1089 +	// minimum of y
  3.1090 +	BranchObj* b;
  3.1091 +	for (b=branch.first();b ;b=branch.next() )
  3.1092 +	{
  3.1093 +		b->calcBBoxSizeWithChilds();
  3.1094 +		br=b->getBBoxSizeWithChilds();
  3.1095 +		r.setWidth( max (br.width(), r.width() ));
  3.1096 +		r.setHeight(br.height() + r.height() );
  3.1097 +		if (br.y()<bboxTotal.y()) bboxTotal.setY(br.y());
  3.1098 +	}
  3.1099 +	// Add myself and also
  3.1100 +	// add width of link to sum if necessary
  3.1101 +	if (branch.isEmpty())
  3.1102 +		bboxTotal.setWidth (bbox.width() + r.width() );
  3.1103 +	else	
  3.1104 +		bboxTotal.setWidth (bbox.width() + r.width() + linkwidth);
  3.1105 +	bboxTotal.setHeight(max (r.height(),  bbox.height() ) );
  3.1106 +//	frame->setRect(QRect(bbox.x(),bbox.y(),bbox.width(),bbox.height() ) );
  3.1107 +}
  3.1108 +
  3.1109 +void BranchObj::select()
  3.1110 +{
  3.1111 +    LinkableMapObj::select();
  3.1112 +	// Tell parent that I am selected now:
  3.1113 +	BranchObj* po=(BranchObj*)(parObj);
  3.1114 +    if (po)	// TODO	    Try to get rid of this cast...
  3.1115 +        po->setLastSelectedBranch(this);
  3.1116 +		
  3.1117 +	// temporary unscroll, if we have scrolled parents somewhere
  3.1118 +	if (parObj) ((BranchObj*)(parObj))->tmpUnscroll();
  3.1119 +
  3.1120 +	// set Text in Editor	
  3.1121 +	textEditor->setText(note.getNote() );
  3.1122 +	textEditor->setFilename(note.getFilenameHint() );
  3.1123 +	textEditor->setFontHint (note.getFontHint() );
  3.1124 +	connect (textEditor, SIGNAL (textHasChanged() ), this, SLOT (updateNoteFlag() ) ); 
  3.1125 +	connect (textEditor, SIGNAL (fontSizeHasChanged() ), this, SLOT (updateNoteFlag() ) ); 
  3.1126 +
  3.1127 +	// Show URL and link in statusbar
  3.1128 +	QString status;
  3.1129 +	if (!url.isEmpty()) status+="URL: "+url+"  ";
  3.1130 +	if (!vymLink.isEmpty()) status+="Link: "+vymLink;
  3.1131 +	if (!status.isEmpty()) mainWindow->statusMessage (status);
  3.1132 +
  3.1133 +	// Update Toolbar
  3.1134 +	standardFlags->updateToolBar();
  3.1135 +
  3.1136 +	// Update Browserbutton
  3.1137 +	if (!url.isEmpty())
  3.1138 +		actionEditOpenURL->setEnabled (true);
  3.1139 +	else	
  3.1140 +		actionEditOpenURL->setEnabled (false);
  3.1141 +
  3.1142 +	// Update actions in mapeditor
  3.1143 +	mapEditor->updateActions();
  3.1144 +}
  3.1145 +
  3.1146 +void BranchObj::unselect()
  3.1147 +{
  3.1148 +	LinkableMapObj::unselect();
  3.1149 +	// Delete any messages like vymLink in StatusBar
  3.1150 +	mainWindow->statusMessage ("");
  3.1151 +
  3.1152 +	// save note from editor and set flag
  3.1153 +	// text is done by updateNoteFlag(), just save
  3.1154 +	// filename here
  3.1155 +	note.setFilenameHint (textEditor->getFilename());
  3.1156 +
  3.1157 +	// reset temporary unscroll, if we have scrolled parents somewhere
  3.1158 +	if (parObj) ((BranchObj*)(parObj))->resetTmpUnscroll();
  3.1159 +
  3.1160 +	// Disconnect textEditor from this LMO
  3.1161 +	disconnect( textEditor, SIGNAL(textHasChanged()), 0, 0 );
  3.1162 +	disconnect( textEditor, SIGNAL (fontSizeHasChanged()),0,0 ); 
  3.1163 +
  3.1164 +	// Erase content of editor 
  3.1165 +	textEditor->setInactive();
  3.1166 +
  3.1167 +	// unselect all buttons in toolbar
  3.1168 +	standardFlagsDefault->updateToolBar();
  3.1169 +}
  3.1170 +
  3.1171 +QString BranchObj::getSelectString()
  3.1172 +{
  3.1173 +	QString s;
  3.1174 +	if (parObj)
  3.1175 +	{
  3.1176 +		if (parObj->getDepth()==0)
  3.1177 +			s= "bo:" + QString("%1").arg(getNum());
  3.1178 +		else	
  3.1179 +			s= ((BranchObj*)(parObj))->getSelectString() + ",bo:" + QString("%1").arg(getNum());
  3.1180 +	} else
  3.1181 +	{
  3.1182 +		s="mc:";
  3.1183 +	}
  3.1184 +	
  3.1185 +	return s;
  3.1186 +}
  3.1187 +
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/branchobj.h	Sun Jan 30 12:58:47 2005 +0000
     4.3 @@ -0,0 +1,113 @@
     4.4 +#ifndef BRANCHOBJ_H
     4.5 +#define BRANCHOBJ_H
     4.6 +
     4.7 +#include "floatimageobj.h"
     4.8 +#include "linkablemapobj.h"
     4.9 +#include "ornamentedobj.h"
    4.10 +
    4.11 +class BranchObjPtrList : public QPtrList<BranchObj>
    4.12 +{
    4.13 +	virtual int compareItems (QPtrCollection::Item i, QPtrCollection::Item j);
    4.14 +};
    4.15 +
    4.16 +/////////////////////////////////////////////////////////////////////////////
    4.17 +class BranchObj:public OrnamentedObj {
    4.18 +public:
    4.19 +    BranchObj ();
    4.20 +    BranchObj (QCanvas*);
    4.21 +    BranchObj (QCanvas*, LinkableMapObj* parent);
    4.22 +    ~BranchObj ();
    4.23 +	bool operator< ( const BranchObj & );
    4.24 +	bool operator== ( const BranchObj & );
    4.25 +    virtual void init ();
    4.26 +    virtual void copy (BranchObj*);
    4.27 +    void clear();
    4.28 +	virtual int getNum();				// return number of this in parent
    4.29 +	virtual int getNum(BranchObj*);		// return number of this in parent
    4.30 +	virtual int getFloatImageNum(FloatImageObj*);		
    4.31 +	virtual int countBranches();		
    4.32 +	virtual int countFloatImages();		
    4.33 +    virtual void setParObjTmp (LinkableMapObj*,QPoint,int);// Only for moving Obj around
    4.34 +	virtual void unsetParObjTmp();			// reuse original ParObj
    4.35 +
    4.36 +	virtual void unScroll();				
    4.37 +	virtual void toggleScroll();			// scroll or unscroll
    4.38 +	virtual bool isScrolled();				// returns scroll state
    4.39 +	virtual bool hasScrolledParent(BranchObj*);	// true, if any of the parents is scrolled
    4.40 +	virtual void tmpUnscroll();				// unscroll scrolled parents temporary e.g. during "find" process
    4.41 +	virtual void resetTmpUnscroll();		// scroll all tmp scrolled parents again e.g. when unselecting
    4.42 +
    4.43 +	virtual void setVisibility(bool,int);	// set visibility
    4.44 +    virtual void setVisibility(bool);	    // set vis. for w
    4.45 +	virtual void setLinkColor();			// set the color of link
    4.46 +	virtual void setColor(QColor,bool);		// set the color of heading
    4.47 +
    4.48 +
    4.49 +	BranchObj* first ();				// set Iterator to first LMO
    4.50 +	BranchObj* next ();					// find next LMO after given one
    4.51 +	BranchObj* getLastIterator();		// to interrupt and resume next iteration
    4.52 +	void setLastIterator (BranchObj*);	// needed by next() 
    4.53 +
    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 LinkableMapObj* findMapObj(QPoint,LinkableMapObj*);	// find MapObj 
    4.61 +    virtual void setHeading (QString);
    4.62 +    virtual void setURL (QString);
    4.63 +    virtual QString getURL ();
    4.64 +    virtual void setVymLink (QString);
    4.65 +    virtual QString getVymLink ();
    4.66 +	virtual QString saveToDir (const QString&,const QString&, const QPoint&);// Save data recursivly to tempdir
    4.67 +	virtual LinkableMapObj* addFloatImage();
    4.68 +	virtual LinkableMapObj* addFloatImage(FloatImageObj*);
    4.69 +	virtual void removeFloatImage(FloatImageObj*);
    4.70 +    virtual FloatImageObj* getFirstFloatImage();
    4.71 +    virtual FloatImageObj* getLastFloatImage();
    4.72 +	virtual FloatImageObj* getFloatImageNum(const uint &);
    4.73 +protected:	
    4.74 +	virtual void savePosInAngle();			// write pos in angle for resorting			
    4.75 +public:	
    4.76 +    virtual BranchObj* addBranch();
    4.77 +    virtual BranchObj* addBranch(BranchObj*);		// makes deep copy of BranchObj
    4.78 +    virtual BranchObj* insertBranch(int);
    4.79 +    virtual BranchObj* insertBranch(BranchObj*,int);
    4.80 +    virtual void removeBranch(BranchObj*);  
    4.81 +    virtual void setLastSelectedBranch(BranchObj*);
    4.82 +    virtual BranchObj* getLastSelectedBranch();
    4.83 +    virtual BranchObj* getFirstBranch();
    4.84 +    virtual BranchObj* getLastBranch();
    4.85 +	virtual BranchObj* getBranchNum(const uint &);
    4.86 +    virtual BranchObj* moveBranchUp(BranchObj*);
    4.87 +    virtual BranchObj* moveBranchDown(BranchObj*);
    4.88 +
    4.89 +    virtual void alignRelativeTo(const QPoint );
    4.90 +	virtual void reposition();
    4.91 +
    4.92 +	virtual QRect getTotalBBox();			// return BBox including childs			
    4.93 +	virtual QRect getBBoxSizeWithChilds();	// return size of BBox including childs  
    4.94 +	virtual void calcBBoxSizeWithChilds();	// calc size of  BBox including childs recursivly
    4.95 +
    4.96 +    virtual void select();
    4.97 +    virtual void unselect();
    4.98 +	virtual QString getSelectString();
    4.99 +
   4.100 +protected:
   4.101 +	static BranchObj* itLast;		// iterator for first(), next()
   4.102 +    BranchObjPtrList branch;		// all child branches
   4.103 +	QPtrList<FloatImageObj> floatimage;	// child images
   4.104 +public:	
   4.105 +	float angle;					// used in mainbranch to reorder mainbranches
   4.106 +protected:	
   4.107 +    int lastSelectedBranch;			// for going deeper into tree
   4.108 +	bool scrolled;					// true if all childs are scrolled and thus invisible
   4.109 +	bool tmpUnscrolled;				// can only be true (temporary) for a scrolled subtree
   4.110 +	QString url;					// url to external doc
   4.111 +	QString vymLink;				// path to another map
   4.112 +};
   4.113 +
   4.114 +
   4.115 +#endif
   4.116 +
     5.1 Binary file doc/vym.pdf has changed
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/exporthtmldialog.ui	Sun Jan 30 12:58:47 2005 +0000
     6.3 @@ -0,0 +1,321 @@
     6.4 +<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
     6.5 +<class>ExportHTMLDialog</class>
     6.6 +<author>Uwe Drechsel</author>
     6.7 +<widget class="QDialog">
     6.8 +    <property name="name">
     6.9 +        <cstring>ExportHTMLDialog</cstring>
    6.10 +    </property>
    6.11 +    <property name="geometry">
    6.12 +        <rect>
    6.13 +            <x>0</x>
    6.14 +            <y>0</y>
    6.15 +            <width>364</width>
    6.16 +            <height>346</height>
    6.17 +        </rect>
    6.18 +    </property>
    6.19 +    <property name="caption">
    6.20 +        <string>Export HTML</string>
    6.21 +    </property>
    6.22 +    <property name="modal">
    6.23 +        <bool>false</bool>
    6.24 +    </property>
    6.25 +    <vbox>
    6.26 +        <property name="name">
    6.27 +            <cstring>unnamed</cstring>
    6.28 +        </property>
    6.29 +        <widget class="QLayoutWidget">
    6.30 +            <property name="name">
    6.31 +                <cstring>layout33</cstring>
    6.32 +            </property>
    6.33 +            <hbox>
    6.34 +                <property name="name">
    6.35 +                    <cstring>unnamed</cstring>
    6.36 +                </property>
    6.37 +                <widget class="QLabel">
    6.38 +                    <property name="name">
    6.39 +                        <cstring>textLabel1</cstring>
    6.40 +                    </property>
    6.41 +                    <property name="text">
    6.42 +                        <string>Directory:</string>
    6.43 +                    </property>
    6.44 +                </widget>
    6.45 +                <widget class="QLineEdit">
    6.46 +                    <property name="name">
    6.47 +                        <cstring>lineEdit1</cstring>
    6.48 +                    </property>
    6.49 +                </widget>
    6.50 +                <widget class="QPushButton">
    6.51 +                    <property name="name">
    6.52 +                        <cstring>browseButton</cstring>
    6.53 +                    </property>
    6.54 +                    <property name="text">
    6.55 +                        <string>Browse</string>
    6.56 +                    </property>
    6.57 +                </widget>
    6.58 +            </hbox>
    6.59 +        </widget>
    6.60 +        <widget class="QButtonGroup">
    6.61 +            <property name="name">
    6.62 +                <cstring>buttonGroup2</cstring>
    6.63 +            </property>
    6.64 +            <property name="sizePolicy">
    6.65 +                <sizepolicy>
    6.66 +                    <hsizetype>3</hsizetype>
    6.67 +                    <vsizetype>5</vsizetype>
    6.68 +                    <horstretch>0</horstretch>
    6.69 +                    <verstretch>0</verstretch>
    6.70 +                </sizepolicy>
    6.71 +            </property>
    6.72 +            <property name="minimumSize">
    6.73 +                <size>
    6.74 +                    <width>0</width>
    6.75 +                    <height>230</height>
    6.76 +                </size>
    6.77 +            </property>
    6.78 +            <property name="title">
    6.79 +                <string>Options</string>
    6.80 +            </property>
    6.81 +            <vbox>
    6.82 +                <property name="name">
    6.83 +                    <cstring>unnamed</cstring>
    6.84 +                </property>
    6.85 +                <widget class="QCheckBox">
    6.86 +                    <property name="name">
    6.87 +                        <cstring>checkBox4</cstring>
    6.88 +                    </property>
    6.89 +                    <property name="text">
    6.90 +                        <string>Include image of map</string>
    6.91 +                    </property>
    6.92 +                </widget>
    6.93 +                <widget class="QCheckBox">
    6.94 +                    <property name="name">
    6.95 +                        <cstring>checkBox5_2</cstring>
    6.96 +                    </property>
    6.97 +                    <property name="text">
    6.98 +                        <string>create image only</string>
    6.99 +                    </property>
   6.100 +                </widget>
   6.101 +                <widget class="QCheckBox">
   6.102 +                    <property name="name">
   6.103 +                        <cstring>checkBox5</cstring>
   6.104 +                    </property>
   6.105 +                    <property name="text">
   6.106 +                        <string>use WIKI style</string>
   6.107 +                    </property>
   6.108 +                </widget>
   6.109 +                <widget class="QCheckBox">
   6.110 +                    <property name="name">
   6.111 +                        <cstring>checkBox4_2</cstring>
   6.112 +                    </property>
   6.113 +                    <property name="text">
   6.114 +                        <string>use heading for URLs (instead of link target)</string>
   6.115 +                    </property>
   6.116 +                </widget>
   6.117 +                <widget class="QCheckBox">
   6.118 +                    <property name="name">
   6.119 +                        <cstring>checkBox6</cstring>
   6.120 +                    </property>
   6.121 +                    <property name="text">
   6.122 +                        <string>use image of earth to mark URLs in text</string>
   6.123 +                    </property>
   6.124 +                </widget>
   6.125 +                <widget class="QCheckBox">
   6.126 +                    <property name="name">
   6.127 +                        <cstring>checkBox7</cstring>
   6.128 +                    </property>
   6.129 +                    <property name="text">
   6.130 +                        <string>use default CSS file</string>
   6.131 +                    </property>
   6.132 +                </widget>
   6.133 +                <widget class="QCheckBox">
   6.134 +                    <property name="name">
   6.135 +                        <cstring>checkBox3</cstring>
   6.136 +                    </property>
   6.137 +                    <property name="sizePolicy">
   6.138 +                        <sizepolicy>
   6.139 +                            <hsizetype>1</hsizetype>
   6.140 +                            <vsizetype>0</vsizetype>
   6.141 +                            <horstretch>0</horstretch>
   6.142 +                            <verstretch>0</verstretch>
   6.143 +                        </sizepolicy>
   6.144 +                    </property>
   6.145 +                    <property name="text">
   6.146 +                        <string>show output of external scripts</string>
   6.147 +                    </property>
   6.148 +                </widget>
   6.149 +            </vbox>
   6.150 +        </widget>
   6.151 +        <spacer>
   6.152 +            <property name="name">
   6.153 +                <cstring>spacer6</cstring>
   6.154 +            </property>
   6.155 +            <property name="orientation">
   6.156 +                <enum>Vertical</enum>
   6.157 +            </property>
   6.158 +            <property name="sizeType">
   6.159 +                <enum>Expanding</enum>
   6.160 +            </property>
   6.161 +            <property name="sizeHint">
   6.162 +                <size>
   6.163 +                    <width>21</width>
   6.164 +                    <height>60</height>
   6.165 +                </size>
   6.166 +            </property>
   6.167 +        </spacer>
   6.168 +        <widget class="QLayoutWidget">
   6.169 +            <property name="name">
   6.170 +                <cstring>layout17</cstring>
   6.171 +            </property>
   6.172 +            <hbox>
   6.173 +                <property name="name">
   6.174 +                    <cstring>unnamed</cstring>
   6.175 +                </property>
   6.176 +                <spacer>
   6.177 +                    <property name="name">
   6.178 +                        <cstring>spacer5</cstring>
   6.179 +                    </property>
   6.180 +                    <property name="orientation">
   6.181 +                        <enum>Horizontal</enum>
   6.182 +                    </property>
   6.183 +                    <property name="sizeType">
   6.184 +                        <enum>Expanding</enum>
   6.185 +                    </property>
   6.186 +                    <property name="sizeHint">
   6.187 +                        <size>
   6.188 +                            <width>61</width>
   6.189 +                            <height>21</height>
   6.190 +                        </size>
   6.191 +                    </property>
   6.192 +                </spacer>
   6.193 +                <widget class="QPushButton">
   6.194 +                    <property name="name">
   6.195 +                        <cstring>pushButton4</cstring>
   6.196 +                    </property>
   6.197 +                    <property name="text">
   6.198 +                        <string>Export</string>
   6.199 +                    </property>
   6.200 +                    <property name="default">
   6.201 +                        <bool>true</bool>
   6.202 +                    </property>
   6.203 +                </widget>
   6.204 +                <widget class="QPushButton">
   6.205 +                    <property name="name">
   6.206 +                        <cstring>pushButton5</cstring>
   6.207 +                    </property>
   6.208 +                    <property name="text">
   6.209 +                        <string>Cancel</string>
   6.210 +                    </property>
   6.211 +                </widget>
   6.212 +            </hbox>
   6.213 +        </widget>
   6.214 +    </vbox>
   6.215 +</widget>
   6.216 +<connections>
   6.217 +    <connection>
   6.218 +        <sender>pushButton5</sender>
   6.219 +        <signal>pressed()</signal>
   6.220 +        <receiver>ExportHTMLDialog</receiver>
   6.221 +        <slot>reject()</slot>
   6.222 +    </connection>
   6.223 +    <connection>
   6.224 +        <sender>pushButton4</sender>
   6.225 +        <signal>clicked()</signal>
   6.226 +        <receiver>ExportHTMLDialog</receiver>
   6.227 +        <slot>accept()</slot>
   6.228 +    </connection>
   6.229 +    <connection>
   6.230 +        <sender>browseButton</sender>
   6.231 +        <signal>pressed()</signal>
   6.232 +        <receiver>ExportHTMLDialog</receiver>
   6.233 +        <slot>browseDirectory()</slot>
   6.234 +    </connection>
   6.235 +    <connection>
   6.236 +        <sender>checkBox4</sender>
   6.237 +        <signal>toggled(bool)</signal>
   6.238 +        <receiver>ExportHTMLDialog</receiver>
   6.239 +        <slot>includeImage(bool)</slot>
   6.240 +    </connection>
   6.241 +    <connection>
   6.242 +        <sender>checkBox5</sender>
   6.243 +        <signal>toggled(bool)</signal>
   6.244 +        <receiver>ExportHTMLDialog</receiver>
   6.245 +        <slot>useWIKIpressed(bool)</slot>
   6.246 +    </connection>
   6.247 +    <connection>
   6.248 +        <sender>lineEdit1</sender>
   6.249 +        <signal>textChanged(const QString&amp;)</signal>
   6.250 +        <receiver>ExportHTMLDialog</receiver>
   6.251 +        <slot>dirChanged()</slot>
   6.252 +    </connection>
   6.253 +    <connection>
   6.254 +        <sender>checkBox3</sender>
   6.255 +        <signal>toggled(bool)</signal>
   6.256 +        <receiver>ExportHTMLDialog</receiver>
   6.257 +        <slot>showOut(bool)</slot>
   6.258 +    </connection>
   6.259 +    <connection>
   6.260 +        <sender>checkBox4_2</sender>
   6.261 +        <signal>toggled(bool)</signal>
   6.262 +        <receiver>ExportHTMLDialog</receiver>
   6.263 +        <slot>useHeadingPressed(bool)</slot>
   6.264 +    </connection>
   6.265 +    <connection>
   6.266 +        <sender>checkBox5_2</sender>
   6.267 +        <signal>toggled(bool)</signal>
   6.268 +        <receiver>ExportHTMLDialog</receiver>
   6.269 +        <slot>imgOnly(bool)</slot>
   6.270 +    </connection>
   6.271 +    <connection>
   6.272 +        <sender>checkBox6</sender>
   6.273 +        <signal>toggled(bool)</signal>
   6.274 +        <receiver>ExportHTMLDialog</receiver>
   6.275 +        <slot>useURLImagePressed(bool)</slot>
   6.276 +    </connection>
   6.277 +</connections>
   6.278 +<includes>
   6.279 +    <include location="local" impldecl="in declaration">showtextdialog.h</include>
   6.280 +    <include location="global" impldecl="in declaration">qprocess.h</include>
   6.281 +    <include location="global" impldecl="in implementation">iostream</include>
   6.282 +    <include location="local" impldecl="in implementation">settings.h</include>
   6.283 +    <include location="global" impldecl="in implementation">qfiledialog.h</include>
   6.284 +    <include location="global" impldecl="in implementation">qmessagebox.h</include>
   6.285 +    <include location="local" impldecl="in implementation">misc.h</include>
   6.286 +    <include location="local" impldecl="in implementation">icons/flag-url.xpm</include>
   6.287 +    <include location="local" impldecl="in implementation">exporthtmldialog.ui.h</include>
   6.288 +</includes>
   6.289 +<variables>
   6.290 +    <variable>QString css;</variable>
   6.291 +    <variable>QString xsl;</variable>
   6.292 +    <variable>QString scriptpath;</variable>
   6.293 +    <variable>QString stylepath;</variable>
   6.294 +    <variable>QString dir;</variable>
   6.295 +    <variable>bool image;</variable>
   6.296 +    <variable>bool wikistyle;</variable>
   6.297 +    <variable>QString script;</variable>
   6.298 +    <variable>bool showOutput;</variable>
   6.299 +    <variable>QProcess *proc;</variable>
   6.300 +    <variable>ShowTextDialog *dia;</variable>
   6.301 +    <variable>bool imageOnly;</variable>
   6.302 +    <variable>bool useHeading;</variable>
   6.303 +    <variable>bool useURLImage;</variable>
   6.304 +</variables>
   6.305 +<slots>
   6.306 +    <slot>browseDirectory()</slot>
   6.307 +    <slot>useWIKIpressed( bool b )</slot>
   6.308 +    <slot>includeImage( bool b )</slot>
   6.309 +    <slot>imgOnly( bool b )</slot>
   6.310 +    <slot>useHeadingPressed( bool b )</slot>
   6.311 +    <slot>useURLImagePressed( bool b )</slot>
   6.312 +    <slot>showOut( bool b )</slot>
   6.313 +    <slot>dirChanged()</slot>
   6.314 +    <slot>doExport( const QString &amp; mapname )</slot>
   6.315 +    <slot returnType="QString">getDir()</slot>
   6.316 +    <slot>readOutput()</slot>
   6.317 +</slots>
   6.318 +<functions>
   6.319 +    <function access="private" specifier="non virtual">init()</function>
   6.320 +    <function access="private" specifier="non virtual">destroy()</function>
   6.321 +</functions>
   6.322 +<pixmapinproject/>
   6.323 +<layoutdefaults spacing="6" margin="11"/>
   6.324 +</UI>
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/exporthtmldialog.ui.h	Sun Jan 30 12:58:47 2005 +0000
     7.3 @@ -0,0 +1,218 @@
     7.4 +/****************************************************************************
     7.5 +** ui.h extension file, included from the uic-generated form implementation.
     7.6 +**
     7.7 +** If you wish to add, delete or rename functions or slots use
     7.8 +** Qt Designer which will update this file, preserving your code. Create an
     7.9 +** init() function in place of a constructor, and a destroy() function in
    7.10 +** place of a destructor.
    7.11 +*****************************************************************************/
    7.12 +
    7.13 +
    7.14 +extern Settings settings;
    7.15 +
    7.16 +void ExportHTMLDialog::init()
    7.17 +{
    7.18 +	dir=settings.readEntry ("/vym/export/html/dir","" );
    7.19 +	lineEdit1->setText(dir);
    7.20 +	
    7.21 +    if ( settings.readEntry ("/vym/export/html/image","yes")=="yes")
    7.22 +		image=true;
    7.23 +	else	
    7.24 +		image=false;
    7.25 +	checkBox4->setChecked(image);
    7.26 +	
    7.27 +	if ( settings.readEntry ("/vym/export/html/imageOnly","no")=="yes")
    7.28 +		imageOnly=true;
    7.29 +	else	
    7.30 +		imageOnly=false;
    7.31 +	checkBox5_2->setChecked(imageOnly);
    7.32 +		
    7.33 +    if ( settings.readEntry ("/vym/export/html/wiki","no")=="yes")
    7.34 +		wikistyle=true;
    7.35 +	else	
    7.36 +		wikistyle=false;
    7.37 +	checkBox5->setChecked(wikistyle);
    7.38 +	
    7.39 +	if ( settings.readEntry ("/vym/export/html/useHeading","no")=="yes")
    7.40 +		useHeading=true;
    7.41 +	else	
    7.42 +		useHeading=false;
    7.43 +	checkBox4_2->setChecked(useHeading);
    7.44 +		
    7.45 +	if ( settings.readEntry ("/vym/export/html/useURLImage","yes")=="yes")
    7.46 +		useURLImage=true;
    7.47 +	else	
    7.48 +		useURLImage=false;
    7.49 +	checkBox6->setChecked(useURLImage);
    7.50 +	
    7.51 +	if ( settings.readEntry ("/vym/export/html/showOutput","no")=="yes")
    7.52 +		showOutput=true;
    7.53 +	else	
    7.54 +		showOutput=false;
    7.55 +	checkBox3->setChecked(showOutput);
    7.56 +		
    7.57 +	stylepath=settings.readEntry
    7.58 +		("/vym/export/html/styles","styles");
    7.59 +	scriptpath=settings.readEntry 
    7.60 +		("/vym/export/html/scripts","scripts");
    7.61 +	xsl=settings.readEntry 
    7.62 +		("/vym/export/html/xsl","vym2html.xsl");
    7.63 +	css=settings.readEntry 
    7.64 +		("/vym/export/html/css","vym.css");	
    7.65 +	script=settings.readEntry 
    7.66 +		("/vym/export/html/script","vym2html.sh");	
    7.67 +	
    7.68 +	proc = new QProcess( this );
    7.69 +	connect( proc, SIGNAL(readyReadStdout()),
    7.70 +			 this, SLOT(readOutput()) );
    7.71 +
    7.72 +	dia=new ShowTextDialog ();
    7.73 +}
    7.74 +
    7.75 +void ExportHTMLDialog::destroy()
    7.76 +{
    7.77 +	delete (proc);
    7.78 +	delete (dia);
    7.79 +}
    7.80 +
    7.81 +void ExportHTMLDialog::browseDirectory()
    7.82 +{
    7.83 +   	QFileDialog fd( this, tr("VYM - Export HTML to directory"));
    7.84 +	fd.setMode (QFileDialog::DirectoryOnly);
    7.85 +	fd.setCaption(tr("VYM - Export HTML to directory"));
    7.86 +	fd.setModal (true);
    7.87 +	fd.show();
    7.88 +
    7.89 +	if ( fd.exec() == QDialog::Accepted )
    7.90 +	{
    7.91 +		dir=fd.selectedFile();
    7.92 +		lineEdit1->setText (dir );
    7.93 +	}
    7.94 +}
    7.95 +
    7.96 +void ExportHTMLDialog::useWIKIpressed(bool b)
    7.97 +{
    7.98 +	wikistyle=b;
    7.99 +}
   7.100 +
   7.101 +void ExportHTMLDialog::includeImage(bool b)
   7.102 +{
   7.103 +	image=b;
   7.104 +}
   7.105 +
   7.106 +void ExportHTMLDialog::imgOnly(bool b)
   7.107 +{
   7.108 +	imageOnly=b;
   7.109 +}
   7.110 +
   7.111 +void ExportHTMLDialog::useHeadingPressed(bool b)
   7.112 +{
   7.113 +	useHeading=b;
   7.114 +}
   7.115 +
   7.116 +void ExportHTMLDialog::useURLImagePressed(bool b)
   7.117 +{
   7.118 +	useURLImage=b;
   7.119 +}
   7.120 +
   7.121 +void ExportHTMLDialog::showOut(bool b)
   7.122 +{
   7.123 +	showOutput=b;
   7.124 +}
   7.125 +
   7.126 +void ExportHTMLDialog::dirChanged()
   7.127 +{
   7.128 +	dir=lineEdit1->text();
   7.129 +}
   7.130 +
   7.131 +
   7.132 +
   7.133 +
   7.134 +void ExportHTMLDialog::doExport (const QString &mapname)
   7.135 +{
   7.136 +	// Save options to settings file 
   7.137 +	// (but don't save at destructor, which
   7.138 +	// is called for "cancel", too)
   7.139 +	settings.writeEntry ("/vym/export/html/dir",lineEdit1->text() );
   7.140 +
   7.141 +	if (wikistyle)
   7.142 +		settings.writeEntry ("/vym/export/html/wiki","yes");
   7.143 +	else	
   7.144 +		settings.writeEntry ("/vym/export/html/wiki","no");
   7.145 +
   7.146 +    if (image)
   7.147 +		settings.writeEntry ("/vym/export/html/image","yes");
   7.148 +    else
   7.149 +		settings.writeEntry ("/vym/export/html/image","no");	
   7.150 +	
   7.151 +  if (imageOnly)
   7.152 +		settings.writeEntry ("/vym/export/html/imageOnly","yes");
   7.153 +    else
   7.154 +		settings.writeEntry ("/vym/export/html/imageOnly","no");	
   7.155 +	
   7.156 +  if (useHeading)
   7.157 +		settings.writeEntry ("/vym/export/html/useHeading","yes");
   7.158 +    else
   7.159 +		settings.writeEntry ("/vym/export/html/useHeading","no");	
   7.160 +			
   7.161 +    if (showOutput)
   7.162 +		settings.writeEntry ("/vym/export/html/showOutput","yes");
   7.163 +    else
   7.164 +		settings.writeEntry ("/vym/export/html/showOutput","no");	
   7.165 +		
   7.166 +	settings.writeEntry
   7.167 +		("/vym/export/html/styles",stylepath);
   7.168 +	settings.writeEntry 
   7.169 +		("/vym/export/html/scripts",scriptpath);
   7.170 +	settings.writeEntry 
   7.171 +		("/vym/export/html/xsl",xsl);
   7.172 +	settings.writeEntry 
   7.173 +		("/vym/export/html/css",css);	
   7.174 +	settings.writeEntry 
   7.175 +		("/vym/export/html/script",script);	
   7.176 +
   7.177 +	proc->addArgument (scriptpath + "/" + script );
   7.178 +	proc->addArgument(dir + maskPath(mapname) + ".xml");
   7.179 +	proc->addArgument("-sp=" + stylepath +"/" + xsl );
   7.180 +	proc->addArgument("-css=" + css );
   7.181 +	if (image) proc->addArgument("-image" );
   7.182 +	if (wikistyle) proc->addArgument("-wikistyle" );
   7.183 +	if (useHeading) proc->addArgument("-useURLHeading" );
   7.184 +	if (useURLImage) 
   7.185 +	{	
   7.186 +		proc->addArgument("-useURLImage" );
   7.187 +		QPixmap pm (flag_url_xpm);
   7.188 +		pm.save (dir + "/flags/url.png","PNG");
   7.189 +	}	
   7.190 +
   7.191 +	dia->append ("vym is executing: " + proc->arguments().join(" ") );
   7.192 +	if ( !proc->start() ) 
   7.193 +	{
   7.194 +		// error handling
   7.195 +		dia->show();
   7.196 +		QString s;
   7.197 +		QStringList list = proc->arguments();
   7.198 +		QStringList::Iterator it = list.begin();
   7.199 +		while( it != list.end() ) 
   7.200 +		{
   7.201 +			s+= ( *it ) + "\n";
   7.202 +			++it;
   7.203 +		}
   7.204 +		QMessageBox::critical(0, tr("Critcal export error"),"Couldn't start script to export:\n"+s);
   7.205 +	} else 
   7.206 +		if (showOutput) dia->exec();
   7.207 +	
   7.208 +
   7.209 +}
   7.210 +
   7.211 +
   7.212 +QString ExportHTMLDialog::getDir()
   7.213 +{
   7.214 +	return dir;
   7.215 +}
   7.216 +
   7.217 +
   7.218 +void ExportHTMLDialog::readOutput()
   7.219 +{
   7.220 +	dia->append (proc->readStdout() );
   7.221 +}
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/exports.cpp	Sun Jan 30 12:58:47 2005 +0000
     8.3 @@ -0,0 +1,132 @@
     8.4 +#include "exports.h"
     8.5 +
     8.6 +#include "linkablemapobj.h"
     8.7 +
     8.8 +
     8.9 +Export::Export()
    8.10 +{
    8.11 +	indentPerDepth="  ";
    8.12 +}
    8.13 +
    8.14 +bool Export::setOutputDir(QString dirname)
    8.15 +{
    8.16 +	outdir.setPath (dirname);
    8.17 +	if ( outdir.exists() )
    8.18 +	{
    8.19 +		// FIXME
    8.20 +		// ask for confirmation
    8.21 +		// then delete outdir
    8.22 +		return true;
    8.23 +	} else
    8.24 +	{
    8.25 +		// try to create directory
    8.26 +		//return outdir.mkdir (outdir.absPath());
    8.27 +		// FIXME
    8.28 +		return true;
    8.29 +	}
    8.30 +}
    8.31 +
    8.32 +void Export::setPath (const QString &p)
    8.33 +{
    8.34 +	filepath=p;
    8.35 +}
    8.36 +
    8.37 +void Export::setMapCenter(MapCenterObj *mc)
    8.38 +{
    8.39 +	mapCenter=mc;
    8.40 +}
    8.41 +
    8.42 +void Export::exportMap()
    8.43 +{
    8.44 +	QFile file (filepath);
    8.45 +	if ( !file.open( IO_WriteOnly ) )
    8.46 +	{
    8.47 +		// FIXME
    8.48 +		cout << "Export::exportMap  couldn't open "<<filepath<<endl;
    8.49 +		return;
    8.50 +	}
    8.51 +	QTextStream ts( &file );	// use LANG decoding here...
    8.52 +
    8.53 +	// Main loop over all branches
    8.54 +	QString s;
    8.55 +	QString actIndent("");
    8.56 +	int i;
    8.57 +	BranchObj *bo;
    8.58 +	bo=mapCenter->first();
    8.59 +	while (bo) 
    8.60 +	{
    8.61 +		// Make indentstring
    8.62 +		for (i=0;i<bo->getDepth();i++) actIndent+= indentPerDepth;
    8.63 +
    8.64 +		// Write heading
    8.65 +		//	write (actIndent + getSectionString(bo) + bo->getHeading()+ "\n");
    8.66 +		if (bo->getDepth()==1)
    8.67 +			ts << (getSectionString(bo) + bo->getHeading()+ "\n");
    8.68 +		else	
    8.69 +			ts << (actIndent + " - " + bo->getHeading()+ "\n");
    8.70 +		
    8.71 +		// If necessary, write note
    8.72 +		if (!bo->getNote().isEmpty())
    8.73 +		{
    8.74 +			ts << ("-------------------Begin of Note-----------------\n");
    8.75 +			ts << (bo->getNote());
    8.76 +			ts << ("\n");
    8.77 +			ts << ("-------------------End of Note-------------------\n");
    8.78 +		}
    8.79 +		
    8.80 +		bo=bo->next();
    8.81 +		actIndent="";
    8.82 +	}
    8.83 +	file.close();
    8.84 +}
    8.85 +
    8.86 +QString Export::getSectionString(BranchObj *bostart)
    8.87 +{
    8.88 +	QString r;
    8.89 +	BranchObj *bo=bostart;
    8.90 +	int depth=bo->getDepth();
    8.91 +	while (depth>0)
    8.92 +	{
    8.93 +		r=QString("%1").arg(1+bo->getNum(),0,10)+"." + r;
    8.94 +		bo=(BranchObj*)(bo->getParObj());
    8.95 +		depth=bo->getDepth();
    8.96 +	}	
    8.97 +	if (r.isEmpty())
    8.98 +		return r;
    8.99 +	else	
   8.100 +		return r + " ";
   8.101 +}
   8.102 +
   8.103 +void Export::exportAsHTML()
   8.104 +{
   8.105 +	// FIXME  just testing...
   8.106 +	// Main loop over all branches
   8.107 +	QString s;
   8.108 +	QString actIndent("");
   8.109 +	int i;
   8.110 +	BranchObj *bo;
   8.111 +	bo=mapCenter->first();
   8.112 +	while (bo) 
   8.113 +	{
   8.114 +		// Make indentstring
   8.115 +		for (i=0;i<bo->getDepth();i++) actIndent+= indentPerDepth;
   8.116 +
   8.117 +		// Write heading
   8.118 +		write (actIndent + getSectionString(bo) + bo->getHeading()+ "\n");
   8.119 +		
   8.120 +		// If necessary, write note
   8.121 +		if (!bo->getNote().isEmpty())
   8.122 +		{
   8.123 +			write (bo->getNote());
   8.124 +		}
   8.125 +		
   8.126 +		bo=bo->next();
   8.127 +		actIndent="";
   8.128 +	}
   8.129 +}
   8.130 +
   8.131 +void Export::write(QString s)
   8.132 +{
   8.133 +	cout << s;
   8.134 +}
   8.135 +
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/exports.h	Sun Jan 30 12:58:47 2005 +0000
     9.3 @@ -0,0 +1,34 @@
     9.4 +#ifndef EXPORTS_H
     9.5 +#define EXPORTS_H
     9.6 +
     9.7 +#include <qdir.h>
     9.8 +#include <qstring.h>
     9.9 +#include <iostream>
    9.10 +
    9.11 +#include "mapcenterobj.h"
    9.12 +
    9.13 +using namespace std;
    9.14 +
    9.15 +/////////////////////////////////////////////////////////////////////////////
    9.16 +class Export
    9.17 +{
    9.18 +public:
    9.19 +	Export();
    9.20 +	bool setOutputDir (QString);
    9.21 +	void setPath(const QString &);
    9.22 +	void setMapCenter (MapCenterObj*);
    9.23 +	void setIndentPerDepth (QString);
    9.24 +	void exportMap();
    9.25 +	void exportAsHTML();
    9.26 +protected:  
    9.27 +	QString getSectionString (BranchObj*);
    9.28 +	void write (QString);
    9.29 +
    9.30 +private:
    9.31 +	QDir outdir;
    9.32 +	QString filepath;
    9.33 +	MapCenterObj *mapCenter;
    9.34 +	QString	indentPerDepth;
    9.35 +};
    9.36 +
    9.37 +#endif
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/exportxhtmldialog.ui	Sun Jan 30 12:58:47 2005 +0000
    10.3 @@ -0,0 +1,555 @@
    10.4 +<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
    10.5 +<class>ExportXHTMLDialog</class>
    10.6 +<widget class="QDialog">
    10.7 +    <property name="name">
    10.8 +        <cstring>ExportXHTMLDialog</cstring>
    10.9 +    </property>
   10.10 +    <property name="geometry">
   10.11 +        <rect>
   10.12 +            <x>0</x>
   10.13 +            <y>0</y>
   10.14 +            <width>582</width>
   10.15 +            <height>599</height>
   10.16 +        </rect>
   10.17 +    </property>
   10.18 +    <property name="minimumSize">
   10.19 +        <size>
   10.20 +            <width>0</width>
   10.21 +            <height>130</height>
   10.22 +        </size>
   10.23 +    </property>
   10.24 +    <property name="caption">
   10.25 +        <string>Export XHTML</string>
   10.26 +    </property>
   10.27 +    <vbox>
   10.28 +        <property name="name">
   10.29 +            <cstring>unnamed</cstring>
   10.30 +        </property>
   10.31 +        <widget class="QLayoutWidget">
   10.32 +            <property name="name">
   10.33 +                <cstring>layout33</cstring>
   10.34 +            </property>
   10.35 +            <hbox>
   10.36 +                <property name="name">
   10.37 +                    <cstring>unnamed</cstring>
   10.38 +                </property>
   10.39 +                <widget class="QLabel">
   10.40 +                    <property name="name">
   10.41 +                        <cstring>textLabel1</cstring>
   10.42 +                    </property>
   10.43 +                    <property name="text">
   10.44 +                        <string>Export to directory:</string>
   10.45 +                    </property>
   10.46 +                </widget>
   10.47 +                <widget class="QLineEdit">
   10.48 +                    <property name="name">
   10.49 +                        <cstring>lineEditDir</cstring>
   10.50 +                    </property>
   10.51 +                </widget>
   10.52 +                <widget class="QPushButton">
   10.53 +                    <property name="name">
   10.54 +                        <cstring>browseExportDirButton</cstring>
   10.55 +                    </property>
   10.56 +                    <property name="text">
   10.57 +                        <string>Browse</string>
   10.58 +                    </property>
   10.59 +                </widget>
   10.60 +            </hbox>
   10.61 +        </widget>
   10.62 +        <widget class="QButtonGroup">
   10.63 +            <property name="name">
   10.64 +                <cstring>buttonGroup2</cstring>
   10.65 +            </property>
   10.66 +            <property name="sizePolicy">
   10.67 +                <sizepolicy>
   10.68 +                    <hsizetype>3</hsizetype>
   10.69 +                    <vsizetype>3</vsizetype>
   10.70 +                    <horstretch>0</horstretch>
   10.71 +                    <verstretch>0</verstretch>
   10.72 +                </sizepolicy>
   10.73 +            </property>
   10.74 +            <property name="minimumSize">
   10.75 +                <size>
   10.76 +                    <width>0</width>
   10.77 +                    <height>160</height>
   10.78 +                </size>
   10.79 +            </property>
   10.80 +            <property name="title">
   10.81 +                <string>Options</string>
   10.82 +            </property>
   10.83 +            <vbox>
   10.84 +                <property name="name">
   10.85 +                    <cstring>unnamed</cstring>
   10.86 +                </property>
   10.87 +                <widget class="QCheckBox">
   10.88 +                    <property name="name">
   10.89 +                        <cstring>imageButton</cstring>
   10.90 +                    </property>
   10.91 +                    <property name="text">
   10.92 +                        <string>Include image</string>
   10.93 +                    </property>
   10.94 +                </widget>
   10.95 +                <widget class="QCheckBox">
   10.96 +                    <property name="name">
   10.97 +                        <cstring>textColorButton</cstring>
   10.98 +                    </property>
   10.99 +                    <property name="text">
  10.100 +                        <string>Colored headings in text</string>
  10.101 +                    </property>
  10.102 +                </widget>
  10.103 +                <widget class="QCheckBox">
  10.104 +                    <property name="name">
  10.105 +                        <cstring>saveSettingsInMapButton</cstring>
  10.106 +                    </property>
  10.107 +                    <property name="text">
  10.108 +                        <string>Save settings in map</string>
  10.109 +                    </property>
  10.110 +                </widget>
  10.111 +                <widget class="QCheckBox">
  10.112 +                    <property name="name">
  10.113 +                        <cstring>warningsButton</cstring>
  10.114 +                    </property>
  10.115 +                    <property name="text">
  10.116 +                        <string>showWarnings e.g. if directory is not empty</string>
  10.117 +                    </property>
  10.118 +                </widget>
  10.119 +                <widget class="QCheckBox">
  10.120 +                    <property name="name">
  10.121 +                        <cstring>outputButton</cstring>
  10.122 +                    </property>
  10.123 +                    <property name="sizePolicy">
  10.124 +                        <sizepolicy>
  10.125 +                            <hsizetype>1</hsizetype>
  10.126 +                            <vsizetype>0</vsizetype>
  10.127 +                            <horstretch>0</horstretch>
  10.128 +                            <verstretch>0</verstretch>
  10.129 +                        </sizepolicy>
  10.130 +                    </property>
  10.131 +                    <property name="text">
  10.132 +                        <string>show output of external scripts</string>
  10.133 +                    </property>
  10.134 +                </widget>
  10.135 +            </vbox>
  10.136 +        </widget>
  10.137 +        <widget class="QButtonGroup">
  10.138 +            <property name="name">
  10.139 +                <cstring>buttonGroup2_2</cstring>
  10.140 +            </property>
  10.141 +            <property name="sizePolicy">
  10.142 +                <sizepolicy>
  10.143 +                    <hsizetype>3</hsizetype>
  10.144 +                    <vsizetype>3</vsizetype>
  10.145 +                    <horstretch>0</horstretch>
  10.146 +                    <verstretch>0</verstretch>
  10.147 +                </sizepolicy>
  10.148 +            </property>
  10.149 +            <property name="title">
  10.150 +                <string>Stylesheets</string>
  10.151 +            </property>
  10.152 +            <widget class="QLayoutWidget">
  10.153 +                <property name="name">
  10.154 +                    <cstring>layout7</cstring>
  10.155 +                </property>
  10.156 +                <property name="geometry">
  10.157 +                    <rect>
  10.158 +                        <x>10</x>
  10.159 +                        <y>30</y>
  10.160 +                        <width>540</width>
  10.161 +                        <height>84</height>
  10.162 +                    </rect>
  10.163 +                </property>
  10.164 +                <vbox>
  10.165 +                    <property name="name">
  10.166 +                        <cstring>unnamed</cstring>
  10.167 +                    </property>
  10.168 +                    <widget class="QLayoutWidget">
  10.169 +                        <property name="name">
  10.170 +                            <cstring>layout5</cstring>
  10.171 +                        </property>
  10.172 +                        <hbox>
  10.173 +                            <property name="name">
  10.174 +                                <cstring>unnamed</cstring>
  10.175 +                            </property>
  10.176 +                            <widget class="QLabel">
  10.177 +                                <property name="name">
  10.178 +                                    <cstring>textLabel1_2</cstring>
  10.179 +                                </property>
  10.180 +                                <property name="text">
  10.181 +                                    <string>CSS:</string>
  10.182 +                                </property>
  10.183 +                            </widget>
  10.184 +                            <widget class="QLineEdit">
  10.185 +                                <property name="name">
  10.186 +                                    <cstring>lineEditCSS</cstring>
  10.187 +                                </property>
  10.188 +                            </widget>
  10.189 +                            <widget class="QPushButton">
  10.190 +                                <property name="name">
  10.191 +                                    <cstring>browseCSSButton</cstring>
  10.192 +                                </property>
  10.193 +                                <property name="text">
  10.194 +                                    <string>Browse</string>
  10.195 +                                </property>
  10.196 +                            </widget>
  10.197 +                        </hbox>
  10.198 +                    </widget>
  10.199 +                    <widget class="QLayoutWidget">
  10.200 +                        <property name="name">
  10.201 +                            <cstring>layout6</cstring>
  10.202 +                        </property>
  10.203 +                        <hbox>
  10.204 +                            <property name="name">
  10.205 +                                <cstring>unnamed</cstring>
  10.206 +                            </property>
  10.207 +                            <widget class="QLabel">
  10.208 +                                <property name="name">
  10.209 +                                    <cstring>textLabel2</cstring>
  10.210 +                                </property>
  10.211 +                                <property name="text">
  10.212 +                                    <string>XSL:</string>
  10.213 +                                </property>
  10.214 +                            </widget>
  10.215 +                            <widget class="QLineEdit">
  10.216 +                                <property name="name">
  10.217 +                                    <cstring>lineEditXSL</cstring>
  10.218 +                                </property>
  10.219 +                            </widget>
  10.220 +                            <widget class="QPushButton">
  10.221 +                                <property name="name">
  10.222 +                                    <cstring>browseXSLButton</cstring>
  10.223 +                                </property>
  10.224 +                                <property name="text">
  10.225 +                                    <string>Browse</string>
  10.226 +                                </property>
  10.227 +                            </widget>
  10.228 +                        </hbox>
  10.229 +                    </widget>
  10.230 +                </vbox>
  10.231 +            </widget>
  10.232 +        </widget>
  10.233 +        <widget class="QGroupBox">
  10.234 +            <property name="name">
  10.235 +                <cstring>groupBox1</cstring>
  10.236 +            </property>
  10.237 +            <property name="title">
  10.238 +                <string>Scripts</string>
  10.239 +            </property>
  10.240 +            <widget class="QLabel">
  10.241 +                <property name="name">
  10.242 +                    <cstring>textLabel1_3</cstring>
  10.243 +                </property>
  10.244 +                <property name="geometry">
  10.245 +                    <rect>
  10.246 +                        <x>12</x>
  10.247 +                        <y>22</y>
  10.248 +                        <width>110</width>
  10.249 +                        <height>36</height>
  10.250 +                    </rect>
  10.251 +                </property>
  10.252 +                <property name="text">
  10.253 +                    <string>Before export:</string>
  10.254 +                </property>
  10.255 +            </widget>
  10.256 +            <widget class="QLineEdit">
  10.257 +                <property name="name">
  10.258 +                    <cstring>lineEditPreScript</cstring>
  10.259 +                </property>
  10.260 +                <property name="geometry">
  10.261 +                    <rect>
  10.262 +                        <x>128</x>
  10.263 +                        <y>26</y>
  10.264 +                        <width>322</width>
  10.265 +                        <height>28</height>
  10.266 +                    </rect>
  10.267 +                </property>
  10.268 +            </widget>
  10.269 +            <widget class="QPushButton">
  10.270 +                <property name="name">
  10.271 +                    <cstring>browsePreExportButton</cstring>
  10.272 +                </property>
  10.273 +                <property name="geometry">
  10.274 +                    <rect>
  10.275 +                        <x>456</x>
  10.276 +                        <y>22</y>
  10.277 +                        <width>94</width>
  10.278 +                        <height>36</height>
  10.279 +                    </rect>
  10.280 +                </property>
  10.281 +                <property name="text">
  10.282 +                    <string>Browse</string>
  10.283 +                </property>
  10.284 +            </widget>
  10.285 +            <widget class="QLabel">
  10.286 +                <property name="name">
  10.287 +                    <cstring>textLabel2_2</cstring>
  10.288 +                </property>
  10.289 +                <property name="geometry">
  10.290 +                    <rect>
  10.291 +                        <x>11</x>
  10.292 +                        <y>61</y>
  10.293 +                        <width>99</width>
  10.294 +                        <height>36</height>
  10.295 +                    </rect>
  10.296 +                </property>
  10.297 +                <property name="text">
  10.298 +                    <string>After Export:</string>
  10.299 +                </property>
  10.300 +            </widget>
  10.301 +            <widget class="QLineEdit">
  10.302 +                <property name="name">
  10.303 +                    <cstring>lineEditPostScript</cstring>
  10.304 +                </property>
  10.305 +                <property name="geometry">
  10.306 +                    <rect>
  10.307 +                        <x>116</x>
  10.308 +                        <y>65</y>
  10.309 +                        <width>333</width>
  10.310 +                        <height>28</height>
  10.311 +                    </rect>
  10.312 +                </property>
  10.313 +            </widget>
  10.314 +            <widget class="QPushButton">
  10.315 +                <property name="name">
  10.316 +                    <cstring>browsePostExportButton</cstring>
  10.317 +                </property>
  10.318 +                <property name="geometry">
  10.319 +                    <rect>
  10.320 +                        <x>455</x>
  10.321 +                        <y>61</y>
  10.322 +                        <width>94</width>
  10.323 +                        <height>36</height>
  10.324 +                    </rect>
  10.325 +                </property>
  10.326 +                <property name="text">
  10.327 +                    <string>Browse</string>
  10.328 +                </property>
  10.329 +            </widget>
  10.330 +        </widget>
  10.331 +        <spacer>
  10.332 +            <property name="name">
  10.333 +                <cstring>spacer3</cstring>
  10.334 +            </property>
  10.335 +            <property name="orientation">
  10.336 +                <enum>Vertical</enum>
  10.337 +            </property>
  10.338 +            <property name="sizeType">
  10.339 +                <enum>Expanding</enum>
  10.340 +            </property>
  10.341 +            <property name="sizeHint">
  10.342 +                <size>
  10.343 +                    <width>20</width>
  10.344 +                    <height>31</height>
  10.345 +                </size>
  10.346 +            </property>
  10.347 +        </spacer>
  10.348 +        <widget class="QLayoutWidget">
  10.349 +            <property name="name">
  10.350 +                <cstring>layout17</cstring>
  10.351 +            </property>
  10.352 +            <hbox>
  10.353 +                <property name="name">
  10.354 +                    <cstring>unnamed</cstring>
  10.355 +                </property>
  10.356 +                <spacer>
  10.357 +                    <property name="name">
  10.358 +                        <cstring>spacer5</cstring>
  10.359 +                    </property>
  10.360 +                    <property name="orientation">
  10.361 +                        <enum>Horizontal</enum>
  10.362 +                    </property>
  10.363 +                    <property name="sizeType">
  10.364 +                        <enum>Expanding</enum>
  10.365 +                    </property>
  10.366 +                    <property name="sizeHint">
  10.367 +                        <size>
  10.368 +                            <width>61</width>
  10.369 +                            <height>21</height>
  10.370 +                        </size>
  10.371 +                    </property>
  10.372 +                </spacer>
  10.373 +                <widget class="QPushButton">
  10.374 +                    <property name="name">
  10.375 +                        <cstring>exportButton</cstring>
  10.376 +                    </property>
  10.377 +                    <property name="text">
  10.378 +                        <string>Export</string>
  10.379 +                    </property>
  10.380 +                    <property name="default">
  10.381 +                        <bool>true</bool>
  10.382 +                    </property>
  10.383 +                </widget>
  10.384 +                <widget class="QPushButton">
  10.385 +                    <property name="name">
  10.386 +                        <cstring>cancelButton</cstring>
  10.387 +                    </property>
  10.388 +                    <property name="text">
  10.389 +                        <string>Cancel</string>
  10.390 +                    </property>
  10.391 +                </widget>
  10.392 +            </hbox>
  10.393 +        </widget>
  10.394 +    </vbox>
  10.395 +</widget>
  10.396 +<connections>
  10.397 +    <connection>
  10.398 +        <sender>outputButton</sender>
  10.399 +        <signal>toggled(bool)</signal>
  10.400 +        <receiver>ExportXHTMLDialog</receiver>
  10.401 +        <slot>outputButtonPressed(bool)</slot>
  10.402 +    </connection>
  10.403 +    <connection>
  10.404 +        <sender>exportButton</sender>
  10.405 +        <signal>pressed()</signal>
  10.406 +        <receiver>ExportXHTMLDialog</receiver>
  10.407 +        <slot>accept()</slot>
  10.408 +    </connection>
  10.409 +    <connection>
  10.410 +        <sender>cancelButton</sender>
  10.411 +        <signal>pressed()</signal>
  10.412 +        <receiver>ExportXHTMLDialog</receiver>
  10.413 +        <slot>close()</slot>
  10.414 +    </connection>
  10.415 +    <connection>
  10.416 +        <sender>browseExportDirButton</sender>
  10.417 +        <signal>pressed()</signal>
  10.418 +        <receiver>ExportXHTMLDialog</receiver>
  10.419 +        <slot>browseDirectoryPressed()</slot>
  10.420 +    </connection>
  10.421 +    <connection>
  10.422 +        <sender>browseXSLButton</sender>
  10.423 +        <signal>pressed()</signal>
  10.424 +        <receiver>ExportXHTMLDialog</receiver>
  10.425 +        <slot>browseXSLPressed()</slot>
  10.426 +    </connection>
  10.427 +    <connection>
  10.428 +        <sender>browseCSSButton</sender>
  10.429 +        <signal>pressed()</signal>
  10.430 +        <receiver>ExportXHTMLDialog</receiver>
  10.431 +        <slot>browseCSSPressed()</slot>
  10.432 +    </connection>
  10.433 +    <connection>
  10.434 +        <sender>imageButton</sender>
  10.435 +        <signal>toggled(bool)</signal>
  10.436 +        <receiver>ExportXHTMLDialog</receiver>
  10.437 +        <slot>imageButtonPressed(bool)</slot>
  10.438 +    </connection>
  10.439 +    <connection>
  10.440 +        <sender>textColorButton</sender>
  10.441 +        <signal>toggled(bool)</signal>
  10.442 +        <receiver>ExportXHTMLDialog</receiver>
  10.443 +        <slot>textcolorButtonPressed(bool)</slot>
  10.444 +    </connection>
  10.445 +    <connection>
  10.446 +        <sender>lineEditDir</sender>
  10.447 +        <signal>textChanged(const QString&amp;)</signal>
  10.448 +        <receiver>ExportXHTMLDialog</receiver>
  10.449 +        <slot>dirChanged()</slot>
  10.450 +    </connection>
  10.451 +    <connection>
  10.452 +        <sender>lineEditCSS</sender>
  10.453 +        <signal>textChanged(const QString&amp;)</signal>
  10.454 +        <receiver>ExportXHTMLDialog</receiver>
  10.455 +        <slot>cssChanged()</slot>
  10.456 +    </connection>
  10.457 +    <connection>
  10.458 +        <sender>lineEditXSL</sender>
  10.459 +        <signal>textChanged(const QString&amp;)</signal>
  10.460 +        <receiver>ExportXHTMLDialog</receiver>
  10.461 +        <slot>xslChanged()</slot>
  10.462 +    </connection>
  10.463 +    <connection>
  10.464 +        <sender>browsePreExportButton</sender>
  10.465 +        <signal>pressed()</signal>
  10.466 +        <receiver>ExportXHTMLDialog</receiver>
  10.467 +        <slot>browsePreExportButtonPressed()</slot>
  10.468 +    </connection>
  10.469 +    <connection>
  10.470 +        <sender>browsePostExportButton</sender>
  10.471 +        <signal>pressed()</signal>
  10.472 +        <receiver>ExportXHTMLDialog</receiver>
  10.473 +        <slot>browsePostExportButtonPressed()</slot>
  10.474 +    </connection>
  10.475 +    <connection>
  10.476 +        <sender>lineEditPreScript</sender>
  10.477 +        <signal>textChanged(const QString&amp;)</signal>
  10.478 +        <receiver>ExportXHTMLDialog</receiver>
  10.479 +        <slot>prescriptChanged()</slot>
  10.480 +    </connection>
  10.481 +    <connection>
  10.482 +        <sender>lineEditPostScript</sender>
  10.483 +        <signal>textChanged(const QString&amp;)</signal>
  10.484 +        <receiver>ExportXHTMLDialog</receiver>
  10.485 +        <slot>postscriptChanged()</slot>
  10.486 +    </connection>
  10.487 +    <connection>
  10.488 +        <sender>warningsButton</sender>
  10.489 +        <signal>toggled(bool)</signal>
  10.490 +        <receiver>ExportXHTMLDialog</receiver>
  10.491 +        <slot>warningsButtonPressed(bool)</slot>
  10.492 +    </connection>
  10.493 +    <connection>
  10.494 +        <sender>saveSettingsInMapButton</sender>
  10.495 +        <signal>toggled(bool)</signal>
  10.496 +        <receiver>ExportXHTMLDialog</receiver>
  10.497 +        <slot>saveSettingsInMapButtonPressed(bool)</slot>
  10.498 +    </connection>
  10.499 +</connections>
  10.500 +<includes>
  10.501 +    <include location="local" impldecl="in declaration">process.h</include>
  10.502 +    <include location="local" impldecl="in declaration">showtextdialog.h</include>
  10.503 +    <include location="global" impldecl="in implementation">qfiledialog.h</include>
  10.504 +    <include location="global" impldecl="in implementation">qmessagebox.h</include>
  10.505 +    <include location="local" impldecl="in implementation">settings.h</include>
  10.506 +    <include location="local" impldecl="in implementation">icons/flag-url.xpm</include>
  10.507 +    <include location="local" impldecl="in implementation">exportxhtmldialog.ui.h</include>
  10.508 +</includes>
  10.509 +<variables>
  10.510 +    <variable>bool useTextColor;</variable>
  10.511 +    <variable>bool showWarnings;</variable>
  10.512 +    <variable>QString xsl;</variable>
  10.513 +    <variable>QString css;</variable>
  10.514 +    <variable>bool useImage;</variable>
  10.515 +    <variable>bool showOutput;</variable>
  10.516 +    <variable>Process *xsltProc;</variable>
  10.517 +    <variable>ShowTextDialog *dia;</variable>
  10.518 +    <variable>QString dir;</variable>
  10.519 +    <variable>QString xsltprocessor;</variable>
  10.520 +    <variable>QString filepath;</variable>
  10.521 +    <variable>QString prescript;</variable>
  10.522 +    <variable>QString postscript;</variable>
  10.523 +    <variable>bool settingsChanged;</variable>
  10.524 +    <variable>QString mapname;</variable>
  10.525 +    <variable>bool saveSettingsInMap;</variable>
  10.526 +</variables>
  10.527 +<slots>
  10.528 +    <slot>readSettings()</slot>
  10.529 +    <slot>dirChanged()</slot>
  10.530 +    <slot>browseDirectoryPressed()</slot>
  10.531 +    <slot>imageButtonPressed( bool b )</slot>
  10.532 +    <slot>textcolorButtonPressed( bool b )</slot>
  10.533 +    <slot>saveSettingsInMapButtonPressed( bool b )</slot>
  10.534 +    <slot>warningsButtonPressed( bool b )</slot>
  10.535 +    <slot>outputButtonPressed( bool b )</slot>
  10.536 +    <slot>cssChanged()</slot>
  10.537 +    <slot>browseCSSPressed()</slot>
  10.538 +    <slot>xslChanged()</slot>
  10.539 +    <slot>prescriptChanged()</slot>
  10.540 +    <slot>browseXSLPressed()</slot>
  10.541 +    <slot>postscriptChanged()</slot>
  10.542 +    <slot>browsePreExportButtonPressed()</slot>
  10.543 +    <slot>browsePostExportButtonPressed()</slot>
  10.544 +    <slot>doExport( const QString &amp; mapname )</slot>
  10.545 +    <slot>setFilePath( const QString &amp; s )</slot>
  10.546 +    <slot>setMapName( const QString &amp; s )</slot>
  10.547 +</slots>
  10.548 +<functions>
  10.549 +    <function access="private" specifier="non virtual">init()</function>
  10.550 +    <function access="private" specifier="non virtual">destroy()</function>
  10.551 +    <function returnType="QString">getDir()</function>
  10.552 +    <function returnType="bool">warnings()</function>
  10.553 +    <function returnType="bool">hasChanged()</function>
  10.554 +    <function access="private" specifier="non virtual">runScript( QString spath, QString fpath )</function>
  10.555 +</functions>
  10.556 +<pixmapinproject/>
  10.557 +<layoutdefaults spacing="6" margin="11"/>
  10.558 +</UI>
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/exportxhtmldialog.ui.h	Sun Jan 30 12:58:47 2005 +0000
    11.3 @@ -0,0 +1,412 @@
    11.4 +/****************************************************************************
    11.5 +** ui.h extension file, included from the uic-generated form implementation.
    11.6 +**
    11.7 +** If you wish to add, delete or rename functions or slots use
    11.8 +** Qt Designer which will update this file, preserving your code. Create an
    11.9 +** init() function in place of a constructor, and a destroy() function in
   11.10 +** place of a destructor.
   11.11 +*****************************************************************************/
   11.12 +
   11.13 +
   11.14 +extern Settings settings;
   11.15 +
   11.16 +void ExportXHTMLDialog::init()
   11.17 +{
   11.18 +	dia=new ShowTextDialog ();
   11.19 +	xsltprocessor="xsltproc";
   11.20 +	filepath="";
   11.21 +	settingsChanged=false;
   11.22 +}
   11.23 +
   11.24 +void ExportXHTMLDialog::readSettings()
   11.25 +{
   11.26 +
   11.27 +	dir=settings.readLocalEntry (filepath,"/vym/export/xhtml/exportDir","./" );
   11.28 +	lineEditDir->setText(dir);
   11.29 +	
   11.30 +	
   11.31 +    if ( settings.readLocalEntry (filepath,"/vym/export/xhtml/useImage","yes")=="yes")
   11.32 +		useImage=true;
   11.33 +	else	
   11.34 +		useImage=false;
   11.35 +	imageButton->setChecked(useImage);
   11.36 +		
   11.37 +	if ( settings.readLocalEntry (filepath,"/vym/export/xhtml/useTextColor","no")=="yes")
   11.38 +		useTextColor=true;
   11.39 +	else	
   11.40 +		useTextColor=false;
   11.41 +	textColorButton->setChecked(useTextColor);
   11.42 +	
   11.43 +/* FIXME this was used in old html export, is not yet in new stylesheet
   11.44 +	if ( settings.readEntry ("/vym/export/html/useHeading","no")=="yes")
   11.45 +		useHeading=true;
   11.46 +	else	
   11.47 +		useHeading=false;
   11.48 +	checkBox4_2->setChecked(useHeading);
   11.49 +*/		
   11.50 +
   11.51 +	if ( settings.readLocalEntry (filepath,"/vym/export/xhtml/saveSettingsInMap","no")=="yes")
   11.52 +		saveSettingsInMap=true;
   11.53 +	else	
   11.54 +		saveSettingsInMap=false;
   11.55 +	saveSettingsInMapButton->setChecked(saveSettingsInMap);
   11.56 +
   11.57 +	if ( settings.readEntry ("/vym/export/xhtml/showWarnings","yes")=="yes")
   11.58 +		showWarnings=true;
   11.59 +	else	
   11.60 +		showWarnings=false;
   11.61 +	warningsButton->setChecked(showWarnings);
   11.62 +	
   11.63 +	if ( settings.readEntry ("/vym/export/xhtml/showOutput","no")=="yes")
   11.64 +		showOutput=true;
   11.65 +	else	
   11.66 +		showOutput=false;
   11.67 +	outputButton->setChecked(showOutput);
   11.68 +
   11.69 +	xsl=settings.readLocalEntry 
   11.70 +		(filepath,"/vym/export/xhtml/xsl","/usr/share/vym/styles/vym2xhtml.xsl");
   11.71 +	lineEditXSL->setText(xsl);
   11.72 +	
   11.73 +	css=settings.readLocalEntry 
   11.74 +		(filepath,"/vym/export/xhtml/css","/usr/share/vym/styles/vym.css");	
   11.75 +	lineEditCSS->setText(css);
   11.76 +	
   11.77 +	prescript=settings.readLocalEntry
   11.78 +		(filepath,"/vym/export/xhtml/prescript","");
   11.79 +	lineEditPreScript->setText (prescript);	
   11.80 +	
   11.81 +	postscript=settings.readLocalEntry
   11.82 +		(filepath,"/vym/export/xhtml/postscript","");
   11.83 +	lineEditPostScript->setText (postscript);	
   11.84 +
   11.85 +	if (!prescript.isEmpty() || !postscript.isEmpty())
   11.86 +	{
   11.87 +		QMessageBox::warning( 0, tr( "Warning" ),tr(
   11.88 +		"The settings saved in the map "
   11.89 +		"would like to run scripts:\n\n") +
   11.90 +		prescript +"  "+postscript +"\n\n"+
   11.91 +		tr("Please check, if you really\n"
   11.92 +		"want to allow this in your system!"));
   11.93 +		
   11.94 +	}
   11.95 +}
   11.96 +
   11.97 +void ExportXHTMLDialog::destroy()
   11.98 +{
   11.99 +	delete (dia);
  11.100 +}
  11.101 +
  11.102 +void ExportXHTMLDialog::dirChanged()
  11.103 +{
  11.104 +	dir=lineEditDir->text();
  11.105 +	if (dir.right(1)!="/")
  11.106 +		dir+="/";
  11.107 +	settingsChanged=true;
  11.108 +}
  11.109 +
  11.110 +void ExportXHTMLDialog::browseDirectoryPressed()
  11.111 +{
  11.112 +   	QFileDialog fd( this, tr("VYM - Export HTML to directory"));
  11.113 +	fd.setMode (QFileDialog::DirectoryOnly);
  11.114 +	fd.setCaption(tr("VYM - Export HTML to directory"));
  11.115 +	fd.setModal (true);
  11.116 +	fd.show();
  11.117 +
  11.118 +	if ( fd.exec() == QDialog::Accepted )
  11.119 +	{
  11.120 +		dir=fd.selectedFile();
  11.121 +		lineEditDir->setText (dir );
  11.122 +		settingsChanged=true;
  11.123 +	}
  11.124 +}
  11.125 +
  11.126 +void ExportXHTMLDialog::imageButtonPressed(bool b)
  11.127 +{
  11.128 +	useImage=b;
  11.129 +	settingsChanged=true;
  11.130 +}
  11.131 +
  11.132 +void ExportXHTMLDialog::textcolorButtonPressed(bool b)
  11.133 +{
  11.134 +	useTextColor=b;	
  11.135 +	settingsChanged=true;
  11.136 +}
  11.137 +
  11.138 +void ExportXHTMLDialog::saveSettingsInMapButtonPressed(bool b)
  11.139 +{
  11.140 +	saveSettingsInMap=b;	
  11.141 +	settingsChanged=true;
  11.142 +}
  11.143 +
  11.144 +void ExportXHTMLDialog::warningsButtonPressed(bool b)
  11.145 +{
  11.146 +	showWarnings=b;
  11.147 +	settingsChanged=true;
  11.148 +}
  11.149 +
  11.150 +
  11.151 +void ExportXHTMLDialog::outputButtonPressed(bool b)
  11.152 +{
  11.153 +	showOutput=b;
  11.154 +	settingsChanged=true;
  11.155 +}
  11.156 +
  11.157 +void ExportXHTMLDialog::cssChanged()
  11.158 +{
  11.159 +	css=lineEditCSS->text();
  11.160 +	settingsChanged=true;
  11.161 +}
  11.162 +
  11.163 +void ExportXHTMLDialog::browseCSSPressed()
  11.164 +{
  11.165 +   	QFileDialog fd( this, tr("VYM - Path to CSS file"));
  11.166 +	fd.setModal (true);
  11.167 +	fd.addFilter ("Cascading Stylesheet (*.css)");
  11.168 +	fd.show();
  11.169 +
  11.170 +	if ( fd.exec() == QDialog::Accepted )
  11.171 +	{
  11.172 +		css=fd.selectedFile();
  11.173 +		lineEditCSS->setText (css );
  11.174 +		settingsChanged=true;
  11.175 +	}
  11.176 +}
  11.177 +
  11.178 +void ExportXHTMLDialog::xslChanged()
  11.179 +{
  11.180 +	xsl=lineEditXSL->text();
  11.181 +	settingsChanged=true;
  11.182 +}
  11.183 +
  11.184 +void ExportXHTMLDialog::prescriptChanged()
  11.185 +{
  11.186 +	prescript=lineEditPreScript->text();
  11.187 +	settingsChanged=true;
  11.188 +}
  11.189 +
  11.190 +void ExportXHTMLDialog::browseXSLPressed()
  11.191 +{
  11.192 +   	QFileDialog fd( this, tr("VYM - Path to XSL file"));
  11.193 +	fd.setModal (true);
  11.194 +	fd.addFilter ("Extensible Styleshee Language (*.xsl)");
  11.195 +	fd.show();
  11.196 +
  11.197 +	if ( fd.exec() == QDialog::Accepted )
  11.198 +	{
  11.199 +		xsl=fd.selectedFile();
  11.200 +		lineEditXSL->setText (xsl );
  11.201 +		settingsChanged=true;
  11.202 +	}
  11.203 +}
  11.204 +
  11.205 +void ExportXHTMLDialog::postscriptChanged()
  11.206 +{
  11.207 +	postscript=lineEditPostScript->text();
  11.208 +	settingsChanged=true;
  11.209 +}
  11.210 +
  11.211 +void ExportXHTMLDialog::browsePreExportButtonPressed()
  11.212 +{
  11.213 +	QFileDialog fd( this, tr("VYM - Path to pre export script"));
  11.214 +	fd.setModal (true);
  11.215 +	fd.addFilter ("Scripts (*.sh *.pl *.py *.php)");
  11.216 +	fd.show();
  11.217 +
  11.218 +	if ( fd.exec() == QDialog::Accepted )
  11.219 +	{
  11.220 +		prescript=fd.selectedFile();
  11.221 +		lineEditPreScript->setText (prescript );
  11.222 +		settingsChanged=true;
  11.223 +	}
  11.224 +
  11.225 +}
  11.226 +
  11.227 +void ExportXHTMLDialog::browsePostExportButtonPressed()
  11.228 +{
  11.229 +	QFileDialog fd( this, tr("VYM - Path to post export script"));
  11.230 +	fd.setModal (true);
  11.231 +	fd.addFilter ("Scripts (*.sh *.pl *.py *.php)");
  11.232 +	fd.show();
  11.233 +
  11.234 +	if ( fd.exec() == QDialog::Accepted )
  11.235 +	{
  11.236 +		postscript=fd.selectedFile();
  11.237 +		lineEditPostScript->setText (postscript );
  11.238 +		settingsChanged=true;
  11.239 +	}
  11.240 +}
  11.241 +
  11.242 +
  11.243 +void ExportXHTMLDialog::doExport (const QString &mapname)
  11.244 +{
  11.245 +	// Save options to settings file 
  11.246 +	// (but don't save at destructor, which
  11.247 +	// is called for "cancel", too)
  11.248 +	settings.setLocalEntry (filepath,"/vym/export/xhtml/exportDir",dir);
  11.249 +
  11.250 +	settings.setLocalEntry (filepath,"/vym/export/xhtml/prescript",prescript);
  11.251 +	settings.setLocalEntry (filepath,"/vym/export/xhtml/postscript",postscript);
  11.252 +
  11.253 +    if (useImage)
  11.254 +		settings.setLocalEntry (filepath,"/vym/export/xhtml/useImage","yes");
  11.255 +    else
  11.256 +		settings.setLocalEntry (filepath,"/vym/export/xhtml/useImage","no");	
  11.257 +	
  11.258 +  if (useTextColor)
  11.259 +		settings.setLocalEntry (filepath,"/vym/export/xhtml/useTextColor","yes");
  11.260 +    else
  11.261 +		settings.setLocalEntry (filepath,"/vym/export/xhtml/useTextColor","no");	
  11.262 +	
  11.263 +   if (showWarnings)
  11.264 +		settings.writeEntry ("/vym/export/xhtml/showWarnings","yes");
  11.265 +    else
  11.266 +		settings.writeEntry ("/vym/export/xhtml/showWarnings","no");	
  11.267 +			
  11.268 +	if (showOutput)
  11.269 +		settings.writeEntry ("/vym/export/xhtml/showOutput","yes");
  11.270 +	else
  11.271 +		settings.writeEntry ("/vym/export/xhtml/showOutput","no");	
  11.272 +		
  11.273 +	settings.setLocalEntry 
  11.274 +		(filepath,"/vym/export/xhtml/xsl",xsl);
  11.275 +	settings.setLocalEntry 
  11.276 +		(filepath,"/vym/export/xhtml/css",css);	
  11.277 +
  11.278 +	//FIXME add option for url image (globe flag) here	
  11.279 +	if (true) 
  11.280 +	{	
  11.281 +		QPixmap pm (flag_url_xpm);
  11.282 +		pm.save (dir + "/flags/url.png","PNG");
  11.283 +	}
  11.284 +
  11.285 +	if (!saveSettingsInMap)
  11.286 +		settings.clearLocal("/vym/export/xhtml");
  11.287 +	else	
  11.288 +		settings.setLocalEntry 
  11.289 +			(filepath,"/vym/export/xhtml/saveSettingsInMap","yes");
  11.290 +
  11.291 +	// Copy CSS file
  11.292 +	QFile css_src (css);
  11.293 +	QFile css_dst (dir+"vym.css");
  11.294 +	if (!css_src.open ( IO_ReadOnly))
  11.295 +		QMessageBox::warning( 0, tr( "Warning" ),css +tr(" could not be opened!"));
  11.296 +	else
  11.297 +	{
  11.298 +		if (!css_dst.open( IO_WriteOnly))
  11.299 +			QMessageBox::warning( 0, tr( "Warning" ), dir+"vym.css" +tr(" could not be opened!"));
  11.300 +		else
  11.301 +		{	
  11.302 +		
  11.303 +			QTextStream tsout( &css_dst);
  11.304 +			QTextStream tsin ( &css_src);
  11.305 +			QString s= tsin.read();
  11.306 +			tsout << s;
  11.307 +			css_dst.close();
  11.308 +		}	
  11.309 +		css_src.close();
  11.310 +	}
  11.311 +
  11.312 +	if (!prescript.isEmpty()) runScript (prescript,dir+mapname+".xml");
  11.313 +	
  11.314 +	Process *xsltProc=new Process ();
  11.315 +	xsltProc->clearArguments();
  11.316 +	xsltProc->addArgument (xsltprocessor);	
  11.317 +	if (useImage)
  11.318 +	{
  11.319 +		xsltProc->addArgument ("--stringparam");
  11.320 +		xsltProc->addArgument ("imagemap");
  11.321 +		xsltProc->addArgument ("images/"+mapname+".png");
  11.322 +	}	
  11.323 +	if (useTextColor)
  11.324 +	{
  11.325 +		xsltProc->addArgument ("--stringparam");
  11.326 +		xsltProc->addArgument ("use.textcolor");
  11.327 +		xsltProc->addArgument ("1");
  11.328 +	}	
  11.329 +	xsltProc->addArgument ("--stringparam");
  11.330 +	xsltProc->addArgument ("mapname");
  11.331 +	xsltProc->addArgument (mapname+".vym");
  11.332 +	
  11.333 +	xsltProc->addArgument ("--output");
  11.334 +	xsltProc->addArgument (dir+mapname+".html");
  11.335 +	xsltProc->addArgument (xsl);
  11.336 +	xsltProc->addArgument (dir+mapname+".xml");
  11.337 +	dia->append ("vym is executing: \n" + xsltProc->arguments().join(" ") );	
  11.338 +	if (!xsltProc->start() )
  11.339 +	{
  11.340 +		QMessageBox::critical( 0, tr( "Critical Error" ),
  11.341 +					   tr("Couldn't start ") + xsltprocessor );
  11.342 +	} else
  11.343 +	{
  11.344 +		xsltProc->waitFinished();
  11.345 +		if (!xsltProc->normalExit() )
  11.346 +			QMessageBox::critical( 0, tr( "Critical Error" ),
  11.347 +			   xsltprocessor +" " +tr("didn't exit normally") +
  11.348 +			   xsltProc->getErrout() );
  11.349 +		else
  11.350 +			if (xsltProc->exitStatus()>0) showOutput=true;
  11.351 +			
  11.352 +	}	
  11.353 +	dia->append ("\n");
  11.354 +	dia->append (xsltProc->getErrout());
  11.355 +	dia->append (xsltProc->getStdout());
  11.356 +	
  11.357 +	if (!postscript.isEmpty()) runScript (postscript,dir+mapname+".html");
  11.358 +
  11.359 +	if (showOutput) dia->exec();
  11.360 +}
  11.361 +
  11.362 +void ExportXHTMLDialog::setFilePath(const QString &s)
  11.363 +{
  11.364 +	filepath=s;
  11.365 +}
  11.366 +
  11.367 +void ExportXHTMLDialog::setMapName(const QString &s)
  11.368 +{
  11.369 +	mapname=s;
  11.370 +}
  11.371 +
  11.372 +QString ExportXHTMLDialog::getDir()
  11.373 +{
  11.374 +	return dir;
  11.375 +}
  11.376 +
  11.377 +bool ExportXHTMLDialog::warnings()
  11.378 +{
  11.379 +	return showWarnings;
  11.380 +}
  11.381 +
  11.382 +bool ExportXHTMLDialog::hasChanged()
  11.383 +{
  11.384 +	return settingsChanged;
  11.385 +}
  11.386 +
  11.387 +
  11.388 +void ExportXHTMLDialog::runScript(QString spath, QString fpath)
  11.389 +{
  11.390 +	spath.replace ("%f",fpath);
  11.391 +	QStringList args=QStringList::split (' ',spath,false);
  11.392 +		
  11.393 +	Process *scriptProc=new Process ();
  11.394 +	scriptProc->clearArguments();
  11.395 +	scriptProc->setArguments (args);	
  11.396 +	dia->append ("vym is executing: \n" + scriptProc->arguments().join(" ") );	
  11.397 +	if (!scriptProc->start() )
  11.398 +	{
  11.399 +		QMessageBox::critical( 0, tr( "Critical Error" ),
  11.400 +					   tr("Couldn't start ") + spath );
  11.401 +	} else
  11.402 +	{
  11.403 +		scriptProc->waitFinished();
  11.404 +		if (!scriptProc->normalExit() )
  11.405 +			QMessageBox::critical( 0, tr( "Critical Error" ),
  11.406 +			   spath +" " +tr("didn't exit normally") +
  11.407 +			   scriptProc->getErrout() );
  11.408 +		else
  11.409 +			if (scriptProc->exitStatus()>0) showOutput=true;
  11.410 +			
  11.411 +	}	
  11.412 +	dia->append ("\n");
  11.413 +	dia->append (scriptProc->getErrout());
  11.414 +	dia->append (scriptProc->getStdout());
  11.415 +}
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/extrainfodialog.ui	Sun Jan 30 12:58:47 2005 +0000
    12.3 @@ -0,0 +1,204 @@
    12.4 +<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
    12.5 +<class>ExtraInfoDialog</class>
    12.6 +<author>Uwe Drechsel</author>
    12.7 +<widget class="QDialog">
    12.8 +    <property name="name">
    12.9 +        <cstring>ExtraInfoDialog</cstring>
   12.10 +    </property>
   12.11 +    <property name="geometry">
   12.12 +        <rect>
   12.13 +            <x>0</x>
   12.14 +            <y>0</y>
   12.15 +            <width>338</width>
   12.16 +            <height>410</height>
   12.17 +        </rect>
   12.18 +    </property>
   12.19 +    <property name="caption">
   12.20 +        <string>VYM - Info</string>
   12.21 +    </property>
   12.22 +    <vbox>
   12.23 +        <property name="name">
   12.24 +            <cstring>unnamed</cstring>
   12.25 +        </property>
   12.26 +        <widget class="QLabel">
   12.27 +            <property name="name">
   12.28 +                <cstring>textLabel1_2</cstring>
   12.29 +            </property>
   12.30 +            <property name="text">
   12.31 +                <string>Map:</string>
   12.32 +            </property>
   12.33 +        </widget>
   12.34 +        <widget class="QLineEdit">
   12.35 +            <property name="name">
   12.36 +                <cstring>lineEdit7</cstring>
   12.37 +            </property>
   12.38 +            <property name="paletteBackgroundColor">
   12.39 +                <color>
   12.40 +                    <red>225</red>
   12.41 +                    <green>225</green>
   12.42 +                    <blue>225</blue>
   12.43 +                </color>
   12.44 +            </property>
   12.45 +            <property name="backgroundOrigin">
   12.46 +                <enum>WidgetOrigin</enum>
   12.47 +            </property>
   12.48 +            <property name="readOnly">
   12.49 +                <bool>true</bool>
   12.50 +            </property>
   12.51 +        </widget>
   12.52 +        <widget class="QLabel">
   12.53 +            <property name="name">
   12.54 +                <cstring>textLabel1</cstring>
   12.55 +            </property>
   12.56 +            <property name="text">
   12.57 +                <string>Author:</string>
   12.58 +            </property>
   12.59 +        </widget>
   12.60 +        <widget class="QLineEdit">
   12.61 +            <property name="name">
   12.62 +                <cstring>lineEdit2</cstring>
   12.63 +            </property>
   12.64 +        </widget>
   12.65 +        <widget class="QLabel">
   12.66 +            <property name="name">
   12.67 +                <cstring>textLabel2</cstring>
   12.68 +            </property>
   12.69 +            <property name="text">
   12.70 +                <string>Comment:</string>
   12.71 +            </property>
   12.72 +        </widget>
   12.73 +        <widget class="QTextEdit">
   12.74 +            <property name="name">
   12.75 +                <cstring>textEdit4</cstring>
   12.76 +            </property>
   12.77 +            <property name="sizePolicy">
   12.78 +                <sizepolicy>
   12.79 +                    <hsizetype>7</hsizetype>
   12.80 +                    <vsizetype>4</vsizetype>
   12.81 +                    <horstretch>0</horstretch>
   12.82 +                    <verstretch>0</verstretch>
   12.83 +                </sizepolicy>
   12.84 +            </property>
   12.85 +            <property name="maximumSize">
   12.86 +                <size>
   12.87 +                    <width>32767</width>
   12.88 +                    <height>76</height>
   12.89 +                </size>
   12.90 +            </property>
   12.91 +        </widget>
   12.92 +        <widget class="QLabel">
   12.93 +            <property name="name">
   12.94 +                <cstring>textLabel2_2</cstring>
   12.95 +            </property>
   12.96 +            <property name="text">
   12.97 +                <string>Statistics:</string>
   12.98 +            </property>
   12.99 +        </widget>
  12.100 +        <widget class="QTextEdit">
  12.101 +            <property name="name">
  12.102 +                <cstring>textEdit4_2</cstring>
  12.103 +            </property>
  12.104 +            <property name="paletteBackgroundColor">
  12.105 +                <color>
  12.106 +                    <red>225</red>
  12.107 +                    <green>225</green>
  12.108 +                    <blue>225</blue>
  12.109 +                </color>
  12.110 +            </property>
  12.111 +            <property name="font">
  12.112 +                <font>
  12.113 +                    <family>Courier</family>
  12.114 +                    <pointsize>12</pointsize>
  12.115 +                </font>
  12.116 +            </property>
  12.117 +            <property name="textFormat">
  12.118 +                <enum>PlainText</enum>
  12.119 +            </property>
  12.120 +            <property name="readOnly">
  12.121 +                <bool>true</bool>
  12.122 +            </property>
  12.123 +        </widget>
  12.124 +        <widget class="QLayoutWidget">
  12.125 +            <property name="name">
  12.126 +                <cstring>layout21</cstring>
  12.127 +            </property>
  12.128 +            <hbox>
  12.129 +                <property name="name">
  12.130 +                    <cstring>unnamed</cstring>
  12.131 +                </property>
  12.132 +                <spacer>
  12.133 +                    <property name="name">
  12.134 +                        <cstring>spacer10</cstring>
  12.135 +                    </property>
  12.136 +                    <property name="orientation">
  12.137 +                        <enum>Horizontal</enum>
  12.138 +                    </property>
  12.139 +                    <property name="sizeType">
  12.140 +                        <enum>Expanding</enum>
  12.141 +                    </property>
  12.142 +                    <property name="sizeHint">
  12.143 +                        <size>
  12.144 +                            <width>160</width>
  12.145 +                            <height>21</height>
  12.146 +                        </size>
  12.147 +                    </property>
  12.148 +                </spacer>
  12.149 +                <widget class="QPushButton">
  12.150 +                    <property name="name">
  12.151 +                        <cstring>pushButton13</cstring>
  12.152 +                    </property>
  12.153 +                    <property name="text">
  12.154 +                        <string>Cancel</string>
  12.155 +                    </property>
  12.156 +                </widget>
  12.157 +                <widget class="QPushButton">
  12.158 +                    <property name="name">
  12.159 +                        <cstring>pushButton7</cstring>
  12.160 +                    </property>
  12.161 +                    <property name="text">
  12.162 +                        <string>Close</string>
  12.163 +                    </property>
  12.164 +                </widget>
  12.165 +            </hbox>
  12.166 +        </widget>
  12.167 +    </vbox>
  12.168 +</widget>
  12.169 +<connections>
  12.170 +    <connection>
  12.171 +        <sender>pushButton7</sender>
  12.172 +        <signal>clicked()</signal>
  12.173 +        <receiver>ExtraInfoDialog</receiver>
  12.174 +        <slot>accept()</slot>
  12.175 +    </connection>
  12.176 +    <connection>
  12.177 +        <sender>pushButton13</sender>
  12.178 +        <signal>clicked()</signal>
  12.179 +        <receiver>ExtraInfoDialog</receiver>
  12.180 +        <slot>reject()</slot>
  12.181 +    </connection>
  12.182 +</connections>
  12.183 +<tabstops>
  12.184 +    <tabstop>lineEdit2</tabstop>
  12.185 +    <tabstop>textEdit4</tabstop>
  12.186 +    <tabstop>pushButton7</tabstop>
  12.187 +    <tabstop>pushButton13</tabstop>
  12.188 +    <tabstop>lineEdit7</tabstop>
  12.189 +    <tabstop>textEdit4_2</tabstop>
  12.190 +</tabstops>
  12.191 +<includes>
  12.192 +    <include location="global" impldecl="in implementation">qstring.h</include>
  12.193 +    <include location="local" impldecl="in implementation">extrainfodialog.ui.h</include>
  12.194 +</includes>
  12.195 +<slots>
  12.196 +    <slot>setMapName( const QString &amp; s )</slot>
  12.197 +    <slot>setComment( const QString &amp; s )</slot>
  12.198 +    <slot>setAuthor( const QString &amp; s )</slot>
  12.199 +</slots>
  12.200 +<functions>
  12.201 +    <function returnType="QString">getComment()</function>
  12.202 +    <function returnType="QString">getAuthor()</function>
  12.203 +    <function>setStats( const QString &amp; s )</function>
  12.204 +</functions>
  12.205 +<pixmapinproject/>
  12.206 +<layoutdefaults spacing="6" margin="11"/>
  12.207 +</UI>
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/extrainfodialog.ui.h	Sun Jan 30 12:58:47 2005 +0000
    13.3 @@ -0,0 +1,39 @@
    13.4 +/****************************************************************************
    13.5 +** ui.h extension file, included from the uic-generated form implementation.
    13.6 +**
    13.7 +** If you wish to add, delete or rename functions or slots use
    13.8 +** Qt Designer which will update this file, preserving your code. Create an
    13.9 +** init() function in place of a constructor, and a destroy() function in
   13.10 +** place of a destructor.
   13.11 +*****************************************************************************/
   13.12 +
   13.13 +void ExtraInfoDialog::setMapName(const QString &s)
   13.14 +{
   13.15 +	lineEdit7->setText (s);
   13.16 +}
   13.17 +
   13.18 +void ExtraInfoDialog::setComment (const QString &s)
   13.19 +{
   13.20 +	textEdit4->setText (s);
   13.21 +}
   13.22 +
   13.23 +QString ExtraInfoDialog::getComment()
   13.24 +{
   13.25 +	return textEdit4->text();
   13.26 +}	
   13.27 +
   13.28 +
   13.29 +void ExtraInfoDialog::setAuthor(const QString &s)
   13.30 +{
   13.31 +	lineEdit2->setText (s);
   13.32 +}
   13.33 +
   13.34 +QString ExtraInfoDialog::getAuthor()
   13.35 +{
   13.36 +	return lineEdit2->text();
   13.37 +}
   13.38 +
   13.39 +void ExtraInfoDialog::setStats(const QString &s)
   13.40 +{
   13.41 +	textEdit4_2->setText (s);
   13.42 +}
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/findwindow.cpp	Sun Jan 30 12:58:47 2005 +0000
    14.3 @@ -0,0 +1,85 @@
    14.4 +#include <qlineedit.h>
    14.5 +
    14.6 +#include "findwindow.h"
    14.7 +
    14.8 +
    14.9 +FindWindow::FindWindow(QWidget* parent, const char* name, WFlags f) 
   14.10 +	: QGroupBox( 0, Horizontal, "Find", parent, name )
   14.11 +
   14.12 +{
   14.13 +	setCaption ("VYM - Find Text");
   14.14 +	//resize (180,130);
   14.15 +	move (130,130);
   14.16 +
   14.17 +	setMargin( 100 );
   14.18 +
   14.19 +    QVBoxLayout* box = new QVBoxLayout( layout() );
   14.20 +    
   14.21 +    QHBoxLayout *row1 = new QHBoxLayout( box );
   14.22 +    row1->setMargin( 10 );
   14.23 +
   14.24 +    // Create a Label
   14.25 +    QLabel* label = new QLabel( "Text to find: ", this);
   14.26 +    row1->addWidget( label );
   14.27 +
   14.28 +	// Create LineEdit (here QComboBox)
   14.29 +    QHBoxLayout *row2 = new QHBoxLayout( box );
   14.30 +    row2->setMargin( 10 );
   14.31 +    findcombo = new QComboBox( true, this );
   14.32 +	findcombo->setMinimumWidth(150);
   14.33 +    row2->addWidget( findcombo );
   14.34 +	connect ( findcombo, SIGNAL( highlighted(int) ), 
   14.35 +		this, SLOT( findPressed() ) );
   14.36 +	connect ( findcombo, SIGNAL( textChanged(const QString &) ), 
   14.37 +		this, SLOT( findTextChanged(const QString&) ) );
   14.38 +    //findcombo->insertItem( "Normal", -1 );
   14.39 +
   14.40 +	// Create Buttons
   14.41 +    QHBoxLayout *row3 = new QHBoxLayout( box );
   14.42 +    row3->setMargin( 10 );
   14.43 +	clearbutton = new QPushButton (tr("Clear"),this);
   14.44 +	connect ( clearbutton, SIGNAL( clicked() ), 
   14.45 +		findcombo, SLOT( clearEdit() ) );
   14.46 +	row3->addWidget (clearbutton);
   14.47 +	
   14.48 +	QSpacerItem *si1= new QSpacerItem (10,0,QSizePolicy::Minimum, QSizePolicy::Expanding );
   14.49 +	row3->addItem(si1);
   14.50 +	
   14.51 +	cancelbutton = new QPushButton (tr("Cancel"),this);
   14.52 +	cancelbutton->setAccel (Key_Escape);
   14.53 +	connect ( cancelbutton, SIGNAL( clicked() ), 
   14.54 +		this, SLOT( cancelPressed() ) );
   14.55 +	row3->addWidget (cancelbutton);
   14.56 +
   14.57 +	QSpacerItem *si2= new QSpacerItem (10,0,QSizePolicy::Fixed, QSizePolicy::Fixed);
   14.58 +	row3->addItem(si2);
   14.59 +	
   14.60 +	findbutton = new QPushButton (tr("Find"),this);
   14.61 +	findbutton->setDefault (true);
   14.62 +	connect ( findbutton, SIGNAL( clicked() ), 
   14.63 +		this, SLOT( findPressed() ) );
   14.64 +	row3->add(findbutton);
   14.65 +	
   14.66 +	findcombo->setFocus();
   14.67 +}
   14.68 +
   14.69 +void FindWindow::popup()
   14.70 +{
   14.71 +	findcombo->lineEdit()->selectAll();
   14.72 +	show();
   14.73 +}
   14.74 +
   14.75 +void FindWindow::cancelPressed()
   14.76 +{
   14.77 +	hide();
   14.78 +}
   14.79 +
   14.80 +void FindWindow::findPressed()
   14.81 +{
   14.82 +	emit (findButton(findcombo->currentText() ) );
   14.83 +}
   14.84 +
   14.85 +void FindWindow::findTextChanged(const QString&)
   14.86 +{
   14.87 +	emit (somethingChanged() );
   14.88 +}
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/findwindow.h	Sun Jan 30 12:58:47 2005 +0000
    15.3 @@ -0,0 +1,38 @@
    15.4 +#ifndef FINDWINDOW_H 
    15.5 +#define FINDWINDOW_H
    15.6 +
    15.7 +#include <qmainwindow.h>
    15.8 +#include <qcombobox.h>
    15.9 +#include <qpushbutton.h>
   15.10 +#include <qgroupbox.h>
   15.11 +#include <qlayout.h>
   15.12 +#include <qlabel.h>
   15.13 +
   15.14 +
   15.15 +class FindWindow : public QGroupBox
   15.16 +{
   15.17 +	Q_OBJECT
   15.18 +
   15.19 +public:
   15.20 +	FindWindow (QWidget* parent=0, const char* namme=0, WFlags f=0);
   15.21 +
   15.22 +public slots:	
   15.23 +	void popup();
   15.24 +	void cancelPressed();
   15.25 +	void findPressed();
   15.26 +	void findTextChanged(const QString&);
   15.27 +
   15.28 +signals:
   15.29 +	void findButton(QString);		// emit to mainwindow
   15.30 +	void somethingChanged();	// emit to mainwindow
   15.31 +
   15.32 +private:
   15.33 +	QGroupBox *findbox;
   15.34 +	QComboBox *findcombo;
   15.35 +	QPushButton *clearbutton;
   15.36 +	QPushButton *findbutton;
   15.37 +	QPushButton *cancelbutton;
   15.38 +};
   15.39 +
   15.40 +
   15.41 +#endif
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/flagobj.cpp	Sun Jan 30 12:58:47 2005 +0000
    16.3 @@ -0,0 +1,201 @@
    16.4 +#include "flagobj.h"
    16.5 +
    16.6 +/////////////////////////////////////////////////////////////////
    16.7 +// FlagObj
    16.8 +/////////////////////////////////////////////////////////////////
    16.9 +FlagObj::FlagObj()
   16.10 +{
   16.11 +//    cout << "Const FlagObj ()\n";
   16.12 +    init ();
   16.13 +}
   16.14 +
   16.15 +FlagObj::FlagObj(QCanvas* c):MapObj(c) 
   16.16 +{
   16.17 +//    cout << "Const FlagObj\n";
   16.18 +    init ();
   16.19 +}
   16.20 +
   16.21 +FlagObj::FlagObj (FlagObj* io)
   16.22 +{
   16.23 +    copy (io);
   16.24 +}
   16.25 +
   16.26 +FlagObj::~FlagObj()
   16.27 +{
   16.28 +//    cout << "Destr FlagObj  " << name << "\n";
   16.29 +	delete (icon);
   16.30 +}
   16.31 +
   16.32 +
   16.33 +void FlagObj::init ()
   16.34 +{
   16.35 +	name="undefined";
   16.36 +
   16.37 +	icon=new ImageObj (canvas);
   16.38 +	icon->move (absPos.x(), absPos.y() );
   16.39 +	button=NULL;
   16.40 +	state=false;
   16.41 +}
   16.42 +
   16.43 +void FlagObj::copy (FlagObj* other)
   16.44 +{
   16.45 +    MapObj::copy(other);
   16.46 +	name=other->name;
   16.47 +	tooltip=other->tooltip;
   16.48 +	state=other->state;
   16.49 +	icon->copy(other->icon);
   16.50 +	setVisibility (other->isVisibleObj() );
   16.51 +	// button is not copied, because
   16.52 +	// we won't copy to a parentRow and
   16.53 +	// all others don't need a button
   16.54 +}
   16.55 +
   16.56 +void FlagObj::move(double x, double y)
   16.57 +{
   16.58 +    MapObj::move(x,y);
   16.59 +	icon->move(x,y);
   16.60 +	positionBBox();
   16.61 +}
   16.62 +
   16.63 +void FlagObj::moveBy(double x, double y)
   16.64 +{
   16.65 +    move (x+absPos.x(),y+absPos.y() );
   16.66 +}
   16.67 +
   16.68 +void FlagObj::setVisibility (bool v)
   16.69 +{
   16.70 +    MapObj::setVisibility(v);
   16.71 +	if (v && state)
   16.72 +	    icon->setVisibility(true);
   16.73 +	else
   16.74 +	    icon->setVisibility(false);
   16.75 +}
   16.76 +
   16.77 +void FlagObj::load (const QString &fn)
   16.78 +{
   16.79 +	icon->load(fn);
   16.80 +	calcBBoxSize();
   16.81 +	positionBBox();
   16.82 +}
   16.83 +
   16.84 +void FlagObj::load (const QPixmap &pm)
   16.85 +{
   16.86 +	icon->load(pm);
   16.87 +	calcBBoxSize();
   16.88 +	positionBBox();
   16.89 +}
   16.90 +
   16.91 +void FlagObj::setName(const QString &n)
   16.92 +{
   16.93 +	name=n;
   16.94 +}
   16.95 +
   16.96 +const QString FlagObj::getName()
   16.97 +{
   16.98 +	return name;
   16.99 +}
  16.100 +
  16.101 +void FlagObj::setToolTip(const QString &n)
  16.102 +{
  16.103 +	tooltip=n;
  16.104 +}
  16.105 +
  16.106 +const QString FlagObj::getToolTip()
  16.107 +{
  16.108 +	return tooltip;
  16.109 +}
  16.110 +
  16.111 +void FlagObj::setButton(QAction* b)
  16.112 +{
  16.113 +    button=b;
  16.114 +}
  16.115 +
  16.116 +void FlagObj::updateButton()
  16.117 +{
  16.118 +	if (button)
  16.119 +		button->setOn(state);
  16.120 +	else
  16.121 +		qWarning ("FlagObj::updateButton  no button defined");
  16.122 +}
  16.123 +
  16.124 +QPixmap FlagObj::getPixmap()
  16.125 +{
  16.126 +	return icon->getPixmap();
  16.127 +}
  16.128 +
  16.129 +bool FlagObj::isActive()
  16.130 +{
  16.131 +	return state;
  16.132 +}
  16.133 +
  16.134 +void FlagObj::toggle()
  16.135 +{
  16.136 +	if (state)
  16.137 +		deactivate();
  16.138 +	else
  16.139 +		activate();
  16.140 +}
  16.141 +
  16.142 +void FlagObj::activate()
  16.143 +{
  16.144 +	state=true;
  16.145 +	// only show icon, if flag itself is visible 
  16.146 +	if (visible) 
  16.147 +	{
  16.148 +		icon->setVisibility (true);
  16.149 +		calcBBoxSize();
  16.150 +	}	
  16.151 +}
  16.152 +
  16.153 +void FlagObj::deactivate()
  16.154 +{
  16.155 +	state=false;
  16.156 +	// if flag itself is invisible we don't need to call 
  16.157 +	if (visible) 
  16.158 +	{
  16.159 +		icon->setVisibility (false);
  16.160 +		calcBBoxSize();
  16.161 +	}	
  16.162 +}
  16.163 +
  16.164 +void FlagObj::setEnabled(bool b)
  16.165 +{
  16.166 +	button->setEnabled (b);
  16.167 +}	
  16.168 +	
  16.169 +
  16.170 +void FlagObj::setUsed (bool b)
  16.171 +{
  16.172 +	used=b;
  16.173 +}
  16.174 +
  16.175 +bool FlagObj::isUsed()
  16.176 +{
  16.177 +	return used;
  16.178 +}
  16.179 +
  16.180 +void FlagObj::saveToDir (const QString &tmpdir, const QString &prefix)
  16.181 +{
  16.182 +	QString fn=tmpdir + prefix + name + ".png";
  16.183 +	icon->save (fn,"PNG");
  16.184 +}
  16.185 +
  16.186 +void FlagObj::positionBBox()
  16.187 +{
  16.188 +    bbox.setX (absPos.x() );
  16.189 +    bbox.setY (absPos.y() );
  16.190 +}
  16.191 +
  16.192 +void FlagObj::calcBBoxSize()
  16.193 +{
  16.194 +	if (visible && state)
  16.195 +	{
  16.196 +		bbox.setSize (	QSize(
  16.197 +			icon->boundingRect().width(), 
  16.198 +			icon->boundingRect().height() ) );
  16.199 +	} else
  16.200 +	{
  16.201 +		bbox.setSize (QSize(0,0));
  16.202 +	}
  16.203 +}
  16.204 +
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/flagobj.h	Sun Jan 30 12:58:47 2005 +0000
    17.3 @@ -0,0 +1,53 @@
    17.4 +#ifndef FLAGOBJ_H
    17.5 +#define FLAGOBJ_H
    17.6 +
    17.7 +
    17.8 +#include <qcanvas.h>
    17.9 +#include <qaction.h>
   17.10 +
   17.11 +#include "mapobj.h"
   17.12 +#include "imageobj.h"
   17.13 +
   17.14 +/////////////////////////////////////////////////////////////////////////////
   17.15 +class FlagObj:public MapObj {
   17.16 +public:
   17.17 +    FlagObj ();
   17.18 +    FlagObj (QCanvas*);
   17.19 +    FlagObj (FlagObj*);
   17.20 +    ~FlagObj ();
   17.21 +    virtual void init ();
   17.22 +    virtual void copy (FlagObj*);
   17.23 +    virtual void move (double x,double y);      // move to absolute Position
   17.24 +    virtual void moveBy (double x,double y);    // move to relative Position
   17.25 +    virtual void setVisibility(bool);
   17.26 +	void load (const QString&);
   17.27 +	void load (const QPixmap&);
   17.28 +	void setName (const QString&);
   17.29 +	const QString getName ();
   17.30 +	void setToolTip(const QString&);
   17.31 +	const QString getToolTip();
   17.32 +	void setButton (QAction*);
   17.33 +	void updateButton ();
   17.34 +	QPixmap getPixmap();
   17.35 +	bool isActive();
   17.36 +	void toggle();
   17.37 +	void activate();
   17.38 +	void deactivate();
   17.39 +	void setEnabled (bool);
   17.40 +	void setUsed (bool);
   17.41 +	bool isUsed();
   17.42 +	void saveToDir (const QString&, const QString&);
   17.43 +	
   17.44 +protected:	
   17.45 +	QString name;
   17.46 +	QString tooltip;
   17.47 +	bool state;
   17.48 +	bool used;
   17.49 +    virtual void positionBBox();
   17.50 +    virtual void calcBBoxSize();
   17.51 +private:
   17.52 +	ImageObj* icon;
   17.53 +	QAction* button;
   17.54 +};
   17.55 +
   17.56 +#endif
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/flagrowobj.cpp	Sun Jan 30 12:58:47 2005 +0000
    18.3 @@ -0,0 +1,322 @@
    18.4 +#include "flagrowobj.h"
    18.5 +
    18.6 +/////////////////////////////////////////////////////////////////
    18.7 +// FlagRowObj
    18.8 +/////////////////////////////////////////////////////////////////
    18.9 +FlagRowObj::FlagRowObj()
   18.10 +{
   18.11 +    cout << "Const FlagRowObj ()\n";
   18.12 +    init ();
   18.13 +}
   18.14 +
   18.15 +FlagRowObj::FlagRowObj(QCanvas* c):MapObj(c) 
   18.16 +{
   18.17 +//    cout << "Const FlagRowObj\n";
   18.18 +    init ();
   18.19 +}
   18.20 +
   18.21 +FlagRowObj::~FlagRowObj()
   18.22 +{
   18.23 +//    cout << "Destr FlagRowObj\n";
   18.24 +	flag.clear();
   18.25 +}
   18.26 +
   18.27 +void FlagRowObj::init ()
   18.28 +{
   18.29 +    flag.setAutoDelete (true);
   18.30 +	parentRow=NULL;
   18.31 +}
   18.32 +
   18.33 +void FlagRowObj::copy (FlagRowObj* other)
   18.34 +{
   18.35 +    MapObj::copy(other);
   18.36 +	parentRow=other->parentRow;
   18.37 +	flag.clear();
   18.38 +	FlagObj *fo;
   18.39 +    for (fo=other->flag.first(); fo; fo=other->flag.next() )
   18.40 +		addFlag (fo);
   18.41 +}
   18.42 +
   18.43 +void FlagRowObj::clone (FlagRowObj* pr)
   18.44 +{
   18.45 +	// Difference to copy:
   18.46 +	// We don't copy the flags here, they
   18.47 +	// are created on the fly by toggle and activate
   18.48 +	// This saves lots of canvas objects.
   18.49 +	MapObj::copy(pr);
   18.50 +	flag.clear();
   18.51 +	parentRow=pr;
   18.52 +}
   18.53 +
   18.54 +void FlagRowObj::move(double x, double y)
   18.55 +{
   18.56 +    MapObj::move(x,y);
   18.57 +	int dx=0;
   18.58 +	FlagObj *fo;
   18.59 +    for (fo=flag.first(); fo; fo=flag.next() )
   18.60 +	{
   18.61 +		fo->move(x+dx,y);
   18.62 +		dx+=QSize(fo->getSize() ).width();
   18.63 +	}
   18.64 +}
   18.65 +
   18.66 +void FlagRowObj::moveBy(double x, double y)
   18.67 +{
   18.68 +    move (x+absPos.x(),y+absPos.y() );
   18.69 +}
   18.70 +
   18.71 +void FlagRowObj::setVisibility (bool v)
   18.72 +{
   18.73 +	MapObj::setVisibility(v);
   18.74 +	FlagObj *fo;
   18.75 +	for (fo=flag.first(); fo; fo=flag.next() )
   18.76 +		fo->setVisibility (v);
   18.77 +}
   18.78 +
   18.79 +FlagObj* FlagRowObj::addFlag (FlagObj *fo)
   18.80 +{
   18.81 +	FlagObj *newfo=new FlagObj (canvas);
   18.82 +	newfo->move (absPos.x() + bbox.width(), absPos.y() );
   18.83 +	newfo->copy (fo);	// create a deep copy of fo
   18.84 +	flag.append(newfo);
   18.85 +	calcBBoxSize();
   18.86 +	positionBBox();
   18.87 +	return newfo;
   18.88 +}
   18.89 +
   18.90 +void FlagRowObj::positionBBox()
   18.91 +{
   18.92 +    bbox.setX (absPos.x() );
   18.93 +    bbox.setY (absPos.y() );
   18.94 +}
   18.95 +
   18.96 +void FlagRowObj::calcBBoxSize()
   18.97 +{
   18.98 +	QSize size(0,0);
   18.99 +	QSize boxsize(0,0);
  18.100 +	FlagObj *fo;
  18.101 +    for (fo=flag.first(); fo; fo=flag.next() )
  18.102 +	{
  18.103 +		size=fo->getSize();
  18.104 +		// add widths
  18.105 +		boxsize.setWidth(boxsize.width() + size.width() );
  18.106 +		// maximize height
  18.107 +		if (size.height() > boxsize.height() ) 
  18.108 +			boxsize.setHeight(size.height() );
  18.109 +	}
  18.110 +	bbox.setSize (QSize(boxsize.width(), boxsize.height() ));
  18.111 +}
  18.112 +
  18.113 +QString FlagRowObj::getFlagName (const QPoint &p)
  18.114 +{
  18.115 +	if (!inBBox (p)) return "";
  18.116 +	FlagObj *fo;
  18.117 +	for (fo=flag.first();fo; fo=flag.next() )
  18.118 +		if (fo->inBBox (p)) return fo->getName();
  18.119 +	return "";	
  18.120 +
  18.121 +	
  18.122 +}
  18.123 +
  18.124 +bool FlagRowObj::isActive (const QString &foname)
  18.125 +{
  18.126 +	FlagObj *fo=findFlag (foname);
  18.127 +	if (parentRow)
  18.128 +	{
  18.129 +		if (fo)
  18.130 +			return fo->isActive();
  18.131 +		else
  18.132 +			qWarning ("FlagRowObj::isActive of "+name+" couldn't find "+foname);
  18.133 +			
  18.134 +	} else
  18.135 +		if (fo) return true;
  18.136 +	return false;
  18.137 +}
  18.138 +
  18.139 +void FlagRowObj::toggle (const QString &foname)
  18.140 +{
  18.141 +	FlagObj *fo=findFlag (foname);
  18.142 +	if (fo)
  18.143 +	{
  18.144 +		// FlagObj is here, it will be active, too.
  18.145 +		// Deactivate it by removing it from this row.
  18.146 +		flag.remove (fo);
  18.147 +	} else
  18.148 +	{
  18.149 +		// FlagObj is not present in this row.
  18.150 +		// Copy it from parentRow
  18.151 +		fo=parentRow->findFlag (foname);
  18.152 +		if (fo)
  18.153 +		{
  18.154 +			fo=addFlag (fo);
  18.155 +			fo->activate();
  18.156 +		} else
  18.157 +			qWarning ("FlagRowObj ("+name+")::toggle ("+foname+")  failed - could not find it in parentRow");
  18.158 +	}	
  18.159 +	calcBBoxSize();
  18.160 +	positionBBox();	
  18.161 +}
  18.162 +
  18.163 +void FlagRowObj::activate (const QString &foname)
  18.164 +{
  18.165 +	FlagObj *fo=findFlag (foname);
  18.166 +	if (parentRow)
  18.167 +	{
  18.168 +		if (!fo)
  18.169 +		{
  18.170 +			// FlagObj is not present in this row.
  18.171 +			// Copy it from parentRow and activate there
  18.172 +			fo=parentRow->findFlag (foname);
  18.173 +			if (fo)
  18.174 +			{
  18.175 +				fo=addFlag (fo);
  18.176 +				fo->activate();
  18.177 +				fo->setVisibility (visible);
  18.178 +				calcBBoxSize();
  18.179 +				positionBBox();
  18.180 +			} else
  18.181 +				qWarning ("FlagRowObj ("+name+")::activate ("+foname+")  failed - could not find it in parentRow");
  18.182 +		}	
  18.183 +	} else
  18.184 +	{
  18.185 +		// I am the parentRow, mark flag as used
  18.186 +		if (fo)
  18.187 +		{
  18.188 +			fo->setUsed(true);
  18.189 +			fo->activate();
  18.190 +		}	
  18.191 +		else
  18.192 +			qWarning ("FlagRowObj::activate no FlagObj \""+foname+"\" found in parentRow");
  18.193 +	}
  18.194 +}
  18.195 +
  18.196 +void FlagRowObj::deactivate (const QString &foname)
  18.197 +{
  18.198 +	FlagObj *fo=findFlag (foname);
  18.199 +	if (fo) flag.remove(fo);
  18.200 +	calcBBoxSize();
  18.201 +	positionBBox();
  18.202 +}
  18.203 +
  18.204 +void FlagRowObj::deactivateAll ()
  18.205 +{
  18.206 +	if (!parentRow)
  18.207 +	{
  18.208 +		FlagObj *fo;
  18.209 +		for (fo=flag.first();fo; fo=flag.next() )
  18.210 +		{
  18.211 +			fo->deactivate();
  18.212 +		}
  18.213 +	} else
  18.214 +		qWarning ("FlagRowObj::deactivateAll mustn't be called for ordinary rows");
  18.215 +}
  18.216 +
  18.217 +void FlagRowObj::setEnabled (bool b)
  18.218 +{
  18.219 +	// If we have no parent, we are the default FlagRowObj
  18.220 +	// and have QToolbarButtons
  18.221 +	if (!parentRow)
  18.222 +	{
  18.223 +		FlagObj *fo;
  18.224 +		for (fo=flag.first();fo; fo=flag.next() )
  18.225 +			fo->setEnabled (b);
  18.226 +	}
  18.227 +}
  18.228 +
  18.229 +void FlagRowObj::resetUsedCounter()
  18.230 +{
  18.231 +	FlagObj *fo;
  18.232 +	for (fo=flag.first();fo; fo=flag.next() )
  18.233 +		fo->setUsed (false);
  18.234 +}
  18.235 +
  18.236 +QString FlagRowObj::saveToDir (const QString &tmpdir,const QString &prefix, bool writeflags)
  18.237 +{
  18.238 +	// Build xml string
  18.239 +	QString s;
  18.240 +	FlagObj *fo;
  18.241 +	if (parentRow)
  18.242 +		for (fo=flag.first();fo; fo=flag.next() )
  18.243 +		{
  18.244 +			// save flag to xml, if flag is set 
  18.245 +			s+=valueElement("standardflag",fo->getName() );
  18.246 +
  18.247 +			// and tell parentRow, that this flag is used
  18.248 +			parentRow->activate(fo->getName() );
  18.249 +		}	
  18.250 +	else
  18.251 +		// Save icons to dir, if verbose is set (xml export)
  18.252 +		// and I am a parentRow 
  18.253 +		// and this flag is really used somewhere
  18.254 +		if (writeflags)
  18.255 +			for (fo=flag.first();fo; fo=flag.next() )
  18.256 +				if (fo->isUsed()) fo->saveToDir (tmpdir,prefix);
  18.257 +	return s;		
  18.258 +
  18.259 +}
  18.260 +
  18.261 +void FlagRowObj::setName (const QString &n)
  18.262 +{
  18.263 +	name=n;
  18.264 +}
  18.265 +
  18.266 +void FlagRowObj::makeToolbar (QMainWindow *w, const QString &n)
  18.267 +{
  18.268 +	if (!parentRow)
  18.269 +	{
  18.270 +		// create bar and buttons
  18.271 +		QToolBar* tb = new QToolBar( w);
  18.272 +		tb->setLabel (n);
  18.273 +		QAction *a;
  18.274 +		FlagObj *fo;
  18.275 +		for (fo=flag.first();fo; fo=flag.next() )
  18.276 +		{
  18.277 +			a=new QAction (
  18.278 +				fo->getToolTip(),
  18.279 +				fo->getPixmap(),
  18.280 +				fo->getName(),
  18.281 +				0,
  18.282 +				w,
  18.283 +				fo->getName()
  18.284 +			);
  18.285 +			a->setToggleAction(true);
  18.286 +			// FIXME should not be enabled by default, later in updateToolbar
  18.287 +			a->setEnabled(true);
  18.288 +			a->addTo (tb);
  18.289 +			fo->setButton (a);
  18.290 +			connect(a, SIGNAL( activated() ), 
  18.291 +					w, SLOT( standardFlagChanged() ) );
  18.292 +		}
  18.293 +	} else
  18.294 +		qWarning ("FlagRowObj::makeToolbar mustn't be called for ordinary rows");
  18.295 +}
  18.296 +
  18.297 +void  FlagRowObj::updateToolBar()
  18.298 +{
  18.299 +	FlagObj *fo;
  18.300 +	if (parentRow)
  18.301 +	{
  18.302 +		// We are just a branch, not the toolbar default
  18.303 +		parentRow->deactivateAll();
  18.304 +		// In parentRow activate all existing (==active) flags
  18.305 +		for (fo=flag.first();fo; fo=flag.next() ) 
  18.306 +			parentRow->activate(fo->getName());
  18.307 +		parentRow->updateToolBar();	
  18.308 +	} else
  18.309 +	{
  18.310 +		// We are the toolbar default
  18.311 +		for (fo=flag.first();fo; fo=flag.next() ) 
  18.312 +			fo->updateButton();
  18.313 +	}
  18.314 +}
  18.315 +
  18.316 +FlagObj* FlagRowObj::findFlag (const QString &name)
  18.317 +{
  18.318 +	FlagObj *fo;
  18.319 +	for (fo=flag.first();fo; fo=flag.next() )
  18.320 +	{
  18.321 +		if (fo->getName()==name) return fo;
  18.322 +	}
  18.323 +	return NULL;
  18.324 +}
  18.325 +
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/flagrowobj.h	Sun Jan 30 12:58:47 2005 +0000
    19.3 @@ -0,0 +1,41 @@
    19.4 +#ifndef FLAGROWOBJ_H
    19.5 +#define FLAGROWOBJ_H
    19.6 +
    19.7 +#include <qmainwindow.h>
    19.8 +
    19.9 +#include "mapobj.h"
   19.10 +#include "flagobj.h"
   19.11 +
   19.12 +class FlagRowObj:public QObject,public MapObj {
   19.13 +public:
   19.14 +    FlagRowObj ();
   19.15 +    FlagRowObj (QCanvas*);
   19.16 +    ~FlagRowObj ();
   19.17 +    virtual void init ();
   19.18 +    virtual void copy (FlagRowObj*);
   19.19 +    virtual void clone(FlagRowObj*);
   19.20 +    virtual void move   (double,double);
   19.21 +    virtual void moveBy (double,double);
   19.22 +    virtual void setVisibility(bool);
   19.23 +    virtual FlagObj* addFlag (FlagObj *fo);			// make deep copy of FlagObj
   19.24 +    virtual void positionBBox();
   19.25 +    virtual void calcBBoxSize();
   19.26 +	virtual QString getFlagName (const QPoint &p);	// Find flag by position
   19.27 +	bool isActive(const QString&);
   19.28 +	void toggle (const QString&);
   19.29 +	void activate(const QString&);
   19.30 +	void deactivate(const QString&);
   19.31 +	void deactivateAll();
   19.32 +	void setEnabled (bool);
   19.33 +	void resetUsedCounter();
   19.34 +	QString saveToDir (const QString &,const QString &,bool);
   19.35 +	void setName (const QString&);			// prefix for exporting flags to dir
   19.36 +	void makeToolbar (QMainWindow*, const QString &);	// Create Toolbar buttons
   19.37 +	void updateToolBar();					// Update Toolbar buttons	
   19.38 +private:	
   19.39 +	FlagRowObj* parentRow;					// look for flags in this row
   19.40 +	FlagObj* findFlag (const QString&);
   19.41 +    QPtrList <FlagObj> flag; 
   19.42 +	QString name;
   19.43 +};
   19.44 +#endif
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/floatimageobj.cpp	Sun Jan 30 12:58:47 2005 +0000
    20.3 @@ -0,0 +1,219 @@
    20.4 +#include "floatimageobj.h"
    20.5 +#include "branchobj.h"
    20.6 +#include <math.h>
    20.7 +
    20.8 +
    20.9 +/////////////////////////////////////////////////////////////////
   20.10 +// FloatImageObj
   20.11 +/////////////////////////////////////////////////////////////////
   20.12 +
   20.13 +int FloatImageObj::counter=0;		// make instance 
   20.14 +
   20.15 +
   20.16 +FloatImageObj::FloatImageObj ():FloatObj()
   20.17 +{
   20.18 +//    cout << "Const FloatImageObj ()\n";
   20.19 +    setParObj (this);	
   20.20 +    init();
   20.21 +    depth=-1;
   20.22 +}
   20.23 +
   20.24 +FloatImageObj::FloatImageObj (QCanvas* c):FloatObj(c)
   20.25 +{
   20.26 + //   cout << "Const FloatImageObj (c)  called from MapCenterObj (c)\n";
   20.27 +    setParObj (this);	
   20.28 +    init();
   20.29 +    depth=-1;
   20.30 +}
   20.31 +
   20.32 +FloatImageObj::FloatImageObj (QCanvas* c, LinkableMapObj* p):FloatObj(c,p)
   20.33 +{
   20.34 + //   cout << "Const FloatImageObj (c,p)\n";
   20.35 +    init();
   20.36 +}
   20.37 +
   20.38 +FloatImageObj::~FloatImageObj ()
   20.39 +{
   20.40 +//	cout << "Destr FloatImageObj "<<this<<"\n";
   20.41 +	delete(icon);
   20.42 +}
   20.43 +
   20.44 +void FloatImageObj::init () 
   20.45 +{
   20.46 +	icon=new ImageObj (canvas);
   20.47 +	icon->move (absPos.x(), absPos.y() );
   20.48 +	icon->setVisibility (true);
   20.49 +	bbox.setSize (QSize(icon->size().width(), icon->size().height()));
   20.50 +	filename="";
   20.51 +	originalFilename="no original name available";
   20.52 +	filetype="";
   20.53 +	saveInMap=true;
   20.54 +}
   20.55 +
   20.56 +void FloatImageObj::copy (FloatImageObj* other)
   20.57 +{					
   20.58 +	FloatObj::copy (other);
   20.59 +	icon->copy (other->icon);
   20.60 +	filename=other->filename;
   20.61 +	saveInMap=other->saveInMap;
   20.62 +    positionBBox();
   20.63 +}
   20.64 +
   20.65 +void FloatImageObj::setZ (const int &i)
   20.66 +{
   20.67 +	icon->setZ (i);
   20.68 +	zPlane=i;
   20.69 +}
   20.70 +
   20.71 +int FloatImageObj::z ()
   20.72 +{
   20.73 +	return lrint (icon->z());
   20.74 +}
   20.75 +
   20.76 +bool FloatImageObj::load (const QString &fn)
   20.77 +{	
   20.78 +	if( icon->load (fn))
   20.79 +	{
   20.80 +		bbox.setSize (QSize(icon->size().width()+8, icon->size().height()+8));
   20.81 +		positionBBox();
   20.82 +		filename=fn;
   20.83 +		filetype=QPixmap::imageFormat (fn);
   20.84 +		return true;
   20.85 +	} else
   20.86 +		return false;
   20.87 +	
   20.88 +}
   20.89 +
   20.90 +void FloatImageObj::save (const QString &fn, const char *format)
   20.91 +{	
   20.92 +	icon->save (fn,format);
   20.93 +}
   20.94 +
   20.95 +void FloatImageObj::setOriginalFilename(const QString & fn)
   20.96 +{
   20.97 +	originalFilename=fn;
   20.98 +}
   20.99 +
  20.100 +QString FloatImageObj::getOriginalFilename()
  20.101 +{
  20.102 +	return originalFilename;
  20.103 +}
  20.104 +
  20.105 +void FloatImageObj::setVisibility(bool v)
  20.106 +{
  20.107 +    LinkableMapObj::setVisibility(v);
  20.108 +	if (v)
  20.109 +	    icon->setVisibility(true);
  20.110 +	else
  20.111 +	    icon->setVisibility(false);
  20.112 +}
  20.113 +
  20.114 +void FloatImageObj::move (double x, double y)
  20.115 +{
  20.116 +	FloatObj::move(x,y);
  20.117 +	icon->move (x+4,y+4);
  20.118 +    positionBBox();
  20.119 +}
  20.120 +
  20.121 +void FloatImageObj::move (QPoint p)
  20.122 +{
  20.123 +	move (p.x(), p.y());
  20.124 +}
  20.125 +
  20.126 +void FloatImageObj::positionBBox()
  20.127 +{
  20.128 +	// TODO
  20.129 +}
  20.130 +
  20.131 +void FloatImageObj::calcBBoxSize()
  20.132 +{
  20.133 +	// TODO
  20.134 +}
  20.135 +
  20.136 +QString FloatImageObj::saveToDir (const QString &tmpdir,const QString &prefix)
  20.137 +{
  20.138 +	counter++;
  20.139 +
  20.140 +	QString posAttr=
  20.141 +		attribut("relPosX",QString().setNum(relPos.x(),10)) +
  20.142 +		attribut("relPosY",QString().setNum(relPos.y(),10)); 
  20.143 +
  20.144 +	QString useOrientAttr;
  20.145 +	if (useOrientation)
  20.146 +		useOrientAttr=attribut ("useOrientation","true");
  20.147 +	else	
  20.148 +		useOrientAttr=attribut ("useOrientation","false");
  20.149 +		
  20.150 +	QString saveInMapAttr;
  20.151 +	if (saveInMap)
  20.152 +		saveInMapAttr=attribut ("saveInMap","true");
  20.153 +	else	
  20.154 +		
  20.155 +		saveInMapAttr=attribut ("saveInMap","false");
  20.156 +
  20.157 +	QString exportAttr;
  20.158 +	if (floatExport)
  20.159 +		exportAttr=attribut ("floatExport","true");
  20.160 +	else	
  20.161 +		exportAttr=attribut ("floatExport","false");
  20.162 +
  20.163 +	QString zAttr=attribut ("zPlane",QString().setNum(zPlane));
  20.164 +	QString url;
  20.165 +
  20.166 +	// prevent saving as GIF
  20.167 +	if (filetype=="GIF")
  20.168 +		filetype="PNG";
  20.169 +		
  20.170 +	url="images/"+prefix+"image-" + QString().number(counter,10) + "." +filetype;
  20.171 +
  20.172 +	// And really save the image
  20.173 +	icon->save (tmpdir + "/" + url, filetype);
  20.174 +
  20.175 +    return singleElement ("floatimage",  
  20.176 +		posAttr + 
  20.177 +		useOrientAttr + 
  20.178 +		saveInMapAttr + 
  20.179 +		exportAttr + 
  20.180 +		zAttr + 
  20.181 +		attribut ("href",QString ("file:")+url)
  20.182 +	);	
  20.183 +}
  20.184 +
  20.185 +void FloatImageObj::resetSaveCounter()
  20.186 +{
  20.187 +	counter=0;
  20.188 +}
  20.189 +
  20.190 +
  20.191 +QRect FloatImageObj::getTotalBBox()
  20.192 +{
  20.193 +	return bbox;
  20.194 +}
  20.195 +
  20.196 +QRect FloatImageObj::getBBoxSizeWithChilds()
  20.197 +{
  20.198 +	//FIXME  abstract in linkablemapobj.h, not calculated
  20.199 +	return bboxTotal;
  20.200 +}
  20.201 +
  20.202 +void FloatImageObj::calcBBoxSizeWithChilds()
  20.203 +{
  20.204 +	//FIXME  abstract in linkablemapobj.h
  20.205 +}
  20.206 +
  20.207 +QString FloatImageObj::getSelectString()
  20.208 +{
  20.209 +	QString s;
  20.210 +	if (parObj)
  20.211 +	{
  20.212 +		if (parObj->getDepth()==0)
  20.213 +			s= "fi:" + QString("%1").arg( ((BranchObj*)(parObj))->getFloatImageNum(this));
  20.214 +		else	
  20.215 +			s= ((BranchObj*)(parObj))->getSelectString() + ",fi:" + QString("%1").arg( ((BranchObj*)(parObj))->getFloatImageNum(this));
  20.216 +	} else
  20.217 +		s="mc:";
  20.218 +	
  20.219 +	return s;
  20.220 +
  20.221 +}
  20.222 +
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/floatimageobj.h	Sun Jan 30 12:58:47 2005 +0000
    21.3 @@ -0,0 +1,44 @@
    21.4 +#ifndef FLOATIMAGEOBJ_H
    21.5 +#define FLOATIMAGEOBJ_H
    21.6 +
    21.7 +#include "floatobj.h"
    21.8 +
    21.9 +/////////////////////////////////////////////////////////////////////////////
   21.10 +class FloatImageObj:public FloatObj {
   21.11 +public:
   21.12 +    FloatImageObj ();
   21.13 +    FloatImageObj (QCanvas*);
   21.14 +    FloatImageObj (QCanvas*, LinkableMapObj* parent);
   21.15 +    ~FloatImageObj ();
   21.16 +    virtual void init ();
   21.17 +    virtual void copy (FloatImageObj*);
   21.18 +	virtual void setZ (const int&);
   21.19 +	virtual int z();
   21.20 +
   21.21 +	virtual bool load (const QString &);
   21.22 +	virtual void save (const QString &, const char *);
   21.23 +	virtual void setOriginalFilename(const QString &);
   21.24 +	virtual QString getOriginalFilename();
   21.25 +    virtual void setVisibility(bool);	    // set vis. for w
   21.26 +    virtual void move (double x,double y);
   21.27 +    virtual void move (QPoint);
   21.28 +	virtual void positionBBox();
   21.29 +	virtual void calcBBoxSize();
   21.30 +	virtual QRect getTotalBBox();			// return BBox including childs			
   21.31 +	virtual QRect getBBoxSizeWithChilds();	// return size of BBox including childs  
   21.32 +	virtual void calcBBoxSizeWithChilds();	// calc size of  BBox including childs recursivly
   21.33 +	virtual QString saveToDir(const QString &,const QString&);
   21.34 +	virtual void resetSaveCounter();
   21.35 +	virtual QString getSelectString();
   21.36 +
   21.37 +
   21.38 +protected:
   21.39 +	ImageObj *icon;
   21.40 +	bool saveInMap;
   21.41 +	static int counter;			// numerate the files during saveToDir
   21.42 +	QString filetype;
   21.43 +	QString filename;
   21.44 +	QString originalFilename;
   21.45 +};
   21.46 +
   21.47 +#endif
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/floatobj.cpp	Sun Jan 30 12:58:47 2005 +0000
    22.3 @@ -0,0 +1,163 @@
    22.4 +#include "floatobj.h"
    22.5 +
    22.6 +extern QAction* actionEditToggleFloatExport;
    22.7 +
    22.8 +/////////////////////////////////////////////////////////////////
    22.9 +// FloatObj
   22.10 +/////////////////////////////////////////////////////////////////
   22.11 +
   22.12 +FloatObj::FloatObj ():LinkableMapObj() 
   22.13 +{
   22.14 +//    cout << "Const FloatObj ()\n";
   22.15 +    setParObj (this);	
   22.16 +    init();
   22.17 +    depth=-1;
   22.18 +}
   22.19 +
   22.20 +FloatObj::FloatObj (QCanvas* c):LinkableMapObj(c)
   22.21 +{
   22.22 +//	cout << "Const FloatObj (c)  called from MapCenterObj (c)\n";
   22.23 +    setParObj (this);	
   22.24 +    init();
   22.25 +    depth=-1;
   22.26 +}
   22.27 +
   22.28 +FloatObj::FloatObj (QCanvas* c, LinkableMapObj* p):LinkableMapObj (c)
   22.29 +{
   22.30 +//    cout << "Const FloatObj (c,p)\n";
   22.31 +    setParObj (p);	
   22.32 +    depth=p->getDepth()+1;
   22.33 +    init();
   22.34 +}
   22.35 +
   22.36 +FloatObj::~FloatObj ()
   22.37 +{
   22.38 +//   cout << "Destr FloatObj\n";
   22.39 +}
   22.40 +
   22.41 +void FloatObj::init () 
   22.42 +{
   22.43 +    setChildObj(this);
   22.44 +	relPos=getRandPos();
   22.45 +	useOrientation=true;
   22.46 +	floatExport=true;
   22.47 +	zPlane=Z_ICON;
   22.48 +}
   22.49 +
   22.50 +void FloatObj::copy (FloatObj* other)
   22.51 +{
   22.52 +	LinkableMapObj::copy (other);
   22.53 +	relPos=other->relPos;
   22.54 +	useOrientation=other->useOrientation;
   22.55 +	setVisibility (other->visible);
   22.56 +}
   22.57 +
   22.58 +void FloatObj::setRelPos()
   22.59 +{
   22.60 +	if (useOrientation)
   22.61 +	{
   22.62 +		if (parObj->getOrientation()==OrientLeftOfCenter)
   22.63 +			relPos.setX ( parObj->x() +parObj->width() - bbox.width() -absPos.x());
   22.64 +		else	
   22.65 +			relPos.setX (absPos.x() - parObj->x() );
   22.66 +	}
   22.67 +	else
   22.68 +		relPos.setX (absPos.x() - parObj->x() );
   22.69 +	relPos.setY (absPos.y() - parObj->y() );
   22.70 +}
   22.71 +
   22.72 +void FloatObj::setRelPos(const QPoint &p)
   22.73 +{
   22.74 +	relPos=p;
   22.75 +}
   22.76 +
   22.77 +void FloatObj::setZ(const int &i)
   22.78 +{
   22.79 +	zPlane=i;
   22.80 +}
   22.81 +
   22.82 +int FloatObj::z()
   22.83 +{
   22.84 +	return zPlane;
   22.85 +}
   22.86 +
   22.87 +
   22.88 +void FloatObj::setUseOrientation (const bool &b)
   22.89 +{	
   22.90 +	if (useOrientation!=b)
   22.91 +	{
   22.92 +		useOrientation=b;
   22.93 +		requestReposition();
   22.94 +	}	
   22.95 +}
   22.96 +
   22.97 +void FloatObj::setFloatExport(const bool& b)
   22.98 +{
   22.99 +	floatExport=b;
  22.100 +}
  22.101 +
  22.102 +bool FloatObj::getFloatExport()
  22.103 +{
  22.104 +	return floatExport;
  22.105 +}
  22.106 +
  22.107 +void FloatObj::move (double x, double y)
  22.108 +{
  22.109 +	MapObj::move(x,y);
  22.110 +	selbox->move(x,y);
  22.111 +}
  22.112 +
  22.113 +void FloatObj::move (QPoint p)
  22.114 +{
  22.115 +	move (p.x(), p.y());
  22.116 +}
  22.117 +
  22.118 +void FloatObj::reposition()
  22.119 +{
  22.120 +	if (useOrientation)
  22.121 +	{
  22.122 +		if (parObj->getOrientation()==OrientLeftOfCenter)
  22.123 +			move (parObj->x() - relPos.x() + parObj->width() - bbox.width(), parObj->y()+relPos.y());
  22.124 +		else	
  22.125 +			move (parObj->x()+relPos.x(), parObj->y()+relPos.y());
  22.126 +	}		
  22.127 +	else
  22.128 +		move (parObj->x()+relPos.x(), parObj->y()+relPos.y());
  22.129 +	updateLink();	
  22.130 +}
  22.131 +
  22.132 +QRect FloatObj::getTotalBBox()
  22.133 +{
  22.134 +	return bbox;
  22.135 +}
  22.136 +
  22.137 +QRect FloatObj::getBBoxSizeWithChilds()
  22.138 +{
  22.139 +	return bboxTotal;
  22.140 +}
  22.141 +
  22.142 +void FloatObj::select()
  22.143 +{
  22.144 +    LinkableMapObj::select();
  22.145 +	// Temporary draw the link while FO is selected
  22.146 +	if (style==StyleUndef) 
  22.147 +	{
  22.148 +		setLinkStyle(getDefLinkStyle());
  22.149 +		setLinkColor(parObj->getLinkColor());
  22.150 +	}	
  22.151 +
  22.152 +	// Update FloatExport switch in context menu
  22.153 +	if (floatExport)
  22.154 +		actionEditToggleFloatExport->setEnabled (true);
  22.155 +	else	
  22.156 +		actionEditToggleFloatExport->setEnabled (true);
  22.157 +
  22.158 +
  22.159 +}
  22.160 +
  22.161 +void FloatObj::unselect()
  22.162 +{
  22.163 +	LinkableMapObj::unselect();
  22.164 +	setLinkStyle (StyleUndef);
  22.165 +}
  22.166 +
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/floatobj.h	Sun Jan 30 12:58:47 2005 +0000
    23.3 @@ -0,0 +1,45 @@
    23.4 +#ifndef FLOATOBJ_H
    23.5 +#define FLOATOBJ_H
    23.6 +
    23.7 +#include "linkablemapobj.h"
    23.8 +
    23.9 +/////////////////////////////////////////////////////////////////////////////
   23.10 +class FloatObj:public LinkableMapObj {
   23.11 +public:
   23.12 +    FloatObj ();
   23.13 +    FloatObj (QCanvas*);
   23.14 +    FloatObj (QCanvas*, LinkableMapObj* parent);
   23.15 +    ~FloatObj ();
   23.16 +    virtual void init ();
   23.17 +    virtual void copy (FloatObj*);
   23.18 +	virtual bool load (const QString&)=0;
   23.19 +	virtual void setRelPos();				// set relPos to current parentPos
   23.20 +	virtual void setRelPos(const QPoint&);	
   23.21 +	virtual void setZ(const int&);		// set zPlane
   23.22 +	virtual int z();
   23.23 +	virtual void setUseOrientation (const bool &);
   23.24 +	virtual void setFloatExport (const bool &);
   23.25 +	virtual bool getFloatExport ();
   23.26 +
   23.27 +	virtual void move (double,double);
   23.28 +	virtual void move (QPoint);
   23.29 +
   23.30 +	virtual void reposition();
   23.31 +											
   23.32 +	virtual QRect getTotalBBox();			// return BBox including childs			
   23.33 +	virtual QRect getBBoxSizeWithChilds();	// return size of BBox including childs  
   23.34 +
   23.35 +	virtual QString saveToDir(const QString &,const QString&)=0;
   23.36 +	virtual void resetSaveCounter()=0;
   23.37 +
   23.38 +	virtual void select();
   23.39 +	virtual void unselect();
   23.40 +
   23.41 +protected:
   23.42 +	QPoint relPos;
   23.43 +	bool useOrientation;		
   23.44 +	bool floatExport;
   23.45 +	int zPlane;
   23.46 +};
   23.47 +
   23.48 +#endif
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/frameobj.cpp	Sun Jan 30 12:58:47 2005 +0000
    24.3 @@ -0,0 +1,146 @@
    24.4 +#include "frameobj.h"
    24.5 +
    24.6 +#include <qcolor.h>
    24.7 +
    24.8 +/////////////////////////////////////////////////////////////////
    24.9 +// FrameObj
   24.10 +/////////////////////////////////////////////////////////////////
   24.11 +FrameObj::FrameObj() : MapObj()
   24.12 +{
   24.13 +//    cout << "Const FrameObj ()\n";
   24.14 +    init ();
   24.15 +}
   24.16 +
   24.17 +FrameObj::FrameObj(QCanvas* c) :MapObj(c)
   24.18 +{
   24.19 +//    cout << "Const FrameObj\n";
   24.20 +    init ();
   24.21 +}
   24.22 +
   24.23 +FrameObj::~FrameObj()
   24.24 +{
   24.25 +	clear();
   24.26 +}
   24.27 +
   24.28 +void FrameObj::init()
   24.29 +{
   24.30 +    type=NoFrame;
   24.31 +    border=0;
   24.32 +}
   24.33 +
   24.34 +void FrameObj::clear()
   24.35 +{
   24.36 +    switch (type)
   24.37 +    {
   24.38 +		case NoFrame:
   24.39 +			break;
   24.40 +		case Rectangle:
   24.41 +			delete rectFrame;
   24.42 +			break;
   24.43 +    }
   24.44 +	type=NoFrame;
   24.45 +	border=0;
   24.46 +}
   24.47 +
   24.48 +void FrameObj::move(double x, double y)
   24.49 +{
   24.50 +    switch (type)
   24.51 +    {
   24.52 +		case NoFrame:
   24.53 +			break;
   24.54 +		case Rectangle:
   24.55 +			rectFrame->move (x,y);
   24.56 +			break;
   24.57 +    }
   24.58 +}
   24.59 +
   24.60 +void FrameObj::moveBy(double x, double y)
   24.61 +{
   24.62 +	MapObj::moveBy (x,y);
   24.63 +}
   24.64 +
   24.65 +void FrameObj::positionBBox()
   24.66 +{
   24.67 +}
   24.68 +
   24.69 +void FrameObj::calcBBoxSize()
   24.70 +{
   24.71 +}
   24.72 +
   24.73 +void FrameObj::setRect(const QRect &r)
   24.74 +{
   24.75 +	bbox=r;
   24.76 +    switch (type)
   24.77 +    {
   24.78 +		case NoFrame:
   24.79 +			break;
   24.80 +		case Rectangle:
   24.81 +			rectFrame->setX (bbox.x() );
   24.82 +			rectFrame->setY (bbox.y() );
   24.83 +			rectFrame->setSize (bbox.width(),bbox.height() );
   24.84 +			break;
   24.85 +    }
   24.86 +}
   24.87 +
   24.88 +int FrameObj::getBorder()
   24.89 +{
   24.90 +	return border;
   24.91 +}
   24.92 +
   24.93 +FrameType FrameObj::getFrameType()
   24.94 +{
   24.95 +	return type;
   24.96 +}
   24.97 +
   24.98 +QString FrameObj::getFrameTypeName()
   24.99 +{
  24.100 +    switch (type)
  24.101 +    {
  24.102 +		case Rectangle:
  24.103 +			return "Rectangle";
  24.104 +			break;
  24.105 +		default:
  24.106 +			return "NoFrame";
  24.107 +    }
  24.108 +}
  24.109 +
  24.110 +void FrameObj::setFrameType(const FrameType &t)
  24.111 +{
  24.112 +	if (t!=type)
  24.113 +	{
  24.114 +		clear();
  24.115 +		type=t;
  24.116 +		switch (type)
  24.117 +		{
  24.118 +			case NoFrame:
  24.119 +				border=0;
  24.120 +				break;
  24.121 +			case Rectangle:
  24.122 +				border=10;
  24.123 +				rectFrame = new QCanvasRectangle (canvas);
  24.124 +				rectFrame->setZ(Z_FRAME);
  24.125 +				rectFrame->setBrush( QColor("white") );
  24.126 +				rectFrame->setPen( QPen(QColor("black") ));
  24.127 +				if (visible)
  24.128 +					rectFrame->show();
  24.129 +				else    
  24.130 +					rectFrame->hide();
  24.131 +				break;
  24.132 +		}
  24.133 +	}
  24.134 +}
  24.135 +
  24.136 +void FrameObj::setFrameType(const QString &t)
  24.137 +{
  24.138 +	if (t=="Rectangle")
  24.139 +		FrameObj::setFrameType (Rectangle);
  24.140 +	else	
  24.141 +		FrameObj::setFrameType (NoFrame);
  24.142 +}
  24.143 +
  24.144 +void FrameObj::setVisibility (bool v)
  24.145 +{
  24.146 +    MapObj::setVisibility(v);
  24.147 +    setFrameType (type);    // changes on visibility depend on type...
  24.148 +}
  24.149 +
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/frameobj.h	Sun Jan 30 12:58:47 2005 +0000
    25.3 @@ -0,0 +1,33 @@
    25.4 +#ifndef FRAMEOBJ_H
    25.5 +#define FRAMEOBJ_H
    25.6 +
    25.7 +#include "mapobj.h"
    25.8 +
    25.9 +enum FrameType {NoFrame,Rectangle};
   25.10 +
   25.11 +class FrameObj:public MapObj {
   25.12 +public:
   25.13 +    FrameObj();
   25.14 +    FrameObj(QCanvas*);
   25.15 +    ~FrameObj();
   25.16 +    void init();
   25.17 +    void clear();
   25.18 +    void move (double x,double y);    // move to absolute Position
   25.19 +    void moveBy (double x,double y);  // move to relative Position
   25.20 +	void positionBBox();			 
   25.21 +	void calcBBoxSize();			
   25.22 +	void setRect (const QRect &);	  // set dimensions			
   25.23 +    int getBorder();
   25.24 +    FrameType getFrameType ();
   25.25 +    QString getFrameTypeName ();
   25.26 +    void setFrameType (const FrameType &);
   25.27 +    void setFrameType (const QString &);
   25.28 +    void setVisibility(bool);
   25.29 +
   25.30 +protected:
   25.31 +    FrameType type;
   25.32 +    QCanvasRectangle* rectFrame;
   25.33 +    int border;									// distance text - frame
   25.34 +};
   25.35 +#endif
   25.36 +
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/headingobj.cpp	Sun Jan 30 12:58:47 2005 +0000
    26.3 @@ -0,0 +1,246 @@
    26.4 +#include "headingobj.h"
    26.5 +
    26.6 +/////////////////////////////////////////////////////////////////
    26.7 +// HeadingObj
    26.8 +/////////////////////////////////////////////////////////////////
    26.9 +HeadingObj::HeadingObj() : MapObj()
   26.10 +{
   26.11 +//    cout << "Const HeadingObj ()\n";
   26.12 +    init ();
   26.13 +}
   26.14 +
   26.15 +HeadingObj::HeadingObj(QCanvas* c) :MapObj(c)
   26.16 +{
   26.17 +//    cout << "Const HeadingObj\n";
   26.18 +    init ();
   26.19 +}
   26.20 +
   26.21 +HeadingObj::~HeadingObj()
   26.22 +{
   26.23 +    textline.clear();
   26.24 +}
   26.25 +
   26.26 +void HeadingObj::init()
   26.27 +{
   26.28 +    textline.setAutoDelete (TRUE);
   26.29 +    textwidth=40;
   26.30 +    color=QColor ("black");
   26.31 +    font=QFont();
   26.32 +}
   26.33 +
   26.34 +void HeadingObj::copy(HeadingObj *other)
   26.35 +{
   26.36 +    MapObj::copy (other);
   26.37 +    textwidth=other->textwidth;
   26.38 +    color=other->color;
   26.39 +    font=other->font;
   26.40 +    setText (other->text() );
   26.41 +}
   26.42 +
   26.43 +void HeadingObj::move(double x, double y)
   26.44 +{
   26.45 +    MapObj::move(x,y);
   26.46 +    int h;	// height of a textline
   26.47 +    int ho;	// offset of height while drawing all lines
   26.48 +    if (textline.first() )
   26.49 +		h=textline.first()->boundingRect().height();
   26.50 +    else
   26.51 +		h=2;
   26.52 +    QCanvasText *t;
   26.53 +    ho=0;
   26.54 +    for (t=textline.first(); t; t=textline.next() )
   26.55 +    {
   26.56 +		t->move(x,y+ho);
   26.57 +		ho=ho+h;
   26.58 +    }	
   26.59 +}
   26.60 +
   26.61 +
   26.62 +void HeadingObj::moveBy(double x, double y)
   26.63 +{
   26.64 +    move (x+absPos.x(),y+absPos.y() );
   26.65 +}
   26.66 +
   26.67 +void HeadingObj::positionBBox()
   26.68 +{
   26.69 +    bbox.setX (absPos.x());
   26.70 +    bbox.setY (absPos.y());
   26.71 +}
   26.72 +
   26.73 +void HeadingObj::calcBBoxSize()
   26.74 +{	
   26.75 +	int w=0;
   26.76 +	int h=0;
   26.77 +	// Using Backspace an empty heading might easily be created, then there
   26.78 +	// would be textline.first()==NULL This can be worked around by the following, but
   26.79 +	// then no selection would be visible, thus we prevent it in ::setText()
   26.80 +	if (!textline.isEmpty() )
   26.81 +	{
   26.82 +		QCanvasText *t;
   26.83 +		for (t=textline.first(); t; t=textline.next() )
   26.84 +		{
   26.85 +			h+=t->boundingRect().height();
   26.86 +			if (w<t->boundingRect().width() )
   26.87 +				w=t->boundingRect().width();
   26.88 +		}	
   26.89 +	} 
   26.90 +    bbox.setSize (QSize(w,h));
   26.91 +}
   26.92 +
   26.93 +QCanvasText* HeadingObj::newLine(QString s)
   26.94 +{
   26.95 +    QCanvasText *t;
   26.96 +    t = new QCanvasText(canvas);
   26.97 +    t->setFont (font);
   26.98 +    t->setColor (color);
   26.99 +    t->setZ(Z_TEXT);
  26.100 +    t->setText(s);
  26.101 +    t->show();
  26.102 +    return t;
  26.103 +}
  26.104 +
  26.105 +void HeadingObj::setText (QString s)
  26.106 +{
  26.107 +    heading=s;
  26.108 +
  26.109 +    // remove old textlines and prepare generating new ones
  26.110 +    textline.clear();
  26.111 +
  26.112 +	// prevent empty textline, so at least a small selection stays
  26.113 +	// visible for this heading
  26.114 +	if (s.length()==0) s="  ";
  26.115 +
  26.116 +    int i=0;	// index for actual search for ws
  26.117 +    int j=0;	// index of last ws
  26.118 +	int k=0;	// index of "<br>" or similar linebreak
  26.119 +	int br=0;	// width of found break, e.g. for <br> it is 4
  26.120 +
  26.121 +    // set the text and wrap lines
  26.122 +    while (s.length()>0)
  26.123 +    {
  26.124 +		// ok, some people wanted manual linebreaks, here we go
  26.125 +		k=s.find ("<br>",i,false);
  26.126 +		if (k>=0)
  26.127 +		{
  26.128 +			br=4;
  26.129 +			i=k;
  26.130 +		} else
  26.131 +			i=s.find (" ",i,false);
  26.132 +		if (i<0 && j==0)
  26.133 +		{   // no ws found at all in s
  26.134 +			// append whole s
  26.135 +			textline.append (newLine(s));
  26.136 +			s="";
  26.137 +		} else
  26.138 +		{
  26.139 +			if (i<0 && j>0)
  26.140 +			{	// no ws found in actual search
  26.141 +				if (s.length()<=textwidth)
  26.142 +				{
  26.143 +					textline.append (newLine(s));
  26.144 +					s="";
  26.145 +				} else
  26.146 +				{
  26.147 +					textline.append (newLine(s.left(j)));
  26.148 +					s=s.mid(j+1,s.length());
  26.149 +					j=0;
  26.150 +				}		    
  26.151 +			} else
  26.152 +			{
  26.153 +				if (i>= 0 && i<=static_cast <int> (textwidth))
  26.154 +				{   // there is a ws in textwidth
  26.155 +					if (br>0)
  26.156 +					{
  26.157 +						// here is a linebreak
  26.158 +						textline.append (newLine(s.left(i)));
  26.159 +						s=s.mid(i+br,s.length());
  26.160 +						i=0;
  26.161 +						j=0;
  26.162 +						br=0;
  26.163 +					} else
  26.164 +					{
  26.165 +						j=i;
  26.166 +						i++;
  26.167 +					}
  26.168 +				} else
  26.169 +				{
  26.170 +					if (i>static_cast <int> (textwidth)  )
  26.171 +					{	
  26.172 +						if (j>0)
  26.173 +						{   // a ws out of textwidth, but we have also one in
  26.174 +							textline.append (newLine(s.left(j)));
  26.175 +							s=s.mid(j+1,s.length());
  26.176 +							i=0;
  26.177 +							j=0;
  26.178 +						} else
  26.179 +						{   // a ws out of text, but none in
  26.180 +							textline.append (newLine(s.left(i)));
  26.181 +							s=s.mid(i+1,s.length());
  26.182 +							i=0;
  26.183 +						}
  26.184 +					}
  26.185 +				} 
  26.186 +			}	  
  26.187 +		}		    
  26.188 +    }
  26.189 +	setVisibility (visible);
  26.190 +	calcBBoxSize();
  26.191 +}
  26.192 +
  26.193 +QString HeadingObj::text ()
  26.194 +{
  26.195 +    return heading;
  26.196 +}
  26.197 +
  26.198 +void HeadingObj::setFont (QFont f)
  26.199 +{
  26.200 +    if (font!=f) 
  26.201 +    {
  26.202 +		font=f;
  26.203 +		setText (text());
  26.204 +    }
  26.205 +}
  26.206 +
  26.207 +QFont HeadingObj::getFont()
  26.208 +{
  26.209 +    return font;
  26.210 +}    
  26.211 +	
  26.212 +	
  26.213 +void HeadingObj::setColor (QColor c)
  26.214 +{
  26.215 +    if (color!=c)
  26.216 +    {
  26.217 +		color=c;
  26.218 +		QCanvasText *t;
  26.219 +		for (t=textline.first(); t; t=textline.next() )
  26.220 +			t->setColor(c);
  26.221 +    }	    
  26.222 +}
  26.223 +
  26.224 +QColor HeadingObj::getColor()
  26.225 +{
  26.226 +    return color;
  26.227 +}    
  26.228 +
  26.229 +void HeadingObj::setVisibility (bool v)
  26.230 +{
  26.231 +    MapObj::setVisibility(v);
  26.232 +    QCanvasText *t;
  26.233 +    for (t=textline.first(); t; t=textline.next() )
  26.234 +		if (v)
  26.235 +			t->show();
  26.236 +		else
  26.237 +			t->hide();
  26.238 +}
  26.239 +
  26.240 +int HeadingObj::getHeight ()
  26.241 +{
  26.242 +	return bbox.height();
  26.243 +}
  26.244 +
  26.245 +int HeadingObj::getWidth()
  26.246 +{
  26.247 +	return bbox.width();
  26.248 +}
  26.249 +
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/headingobj.h	Sun Jan 30 12:58:47 2005 +0000
    27.3 @@ -0,0 +1,37 @@
    27.4 +#ifndef HEADINGOBJ_H
    27.5 +#define HEADINGOBJ_H
    27.6 +
    27.7 +#include "mapobj.h"
    27.8 +
    27.9 +class HeadingObj:public MapObj {
   27.10 +public:
   27.11 +    HeadingObj();
   27.12 +    HeadingObj(QCanvas*);
   27.13 +    virtual ~HeadingObj();
   27.14 +    virtual void init();
   27.15 +    virtual void copy(HeadingObj*);
   27.16 +    virtual void move (double x,double y);      // move to absolute Position
   27.17 +    virtual void moveBy (double x,double y);    // move to relative Position
   27.18 +    virtual void positionBBox();
   27.19 +	virtual void calcBBoxSize();
   27.20 +private:
   27.21 +    QCanvasText* newLine(QString);				// generate new textline
   27.22 +public:    
   27.23 +    virtual void setText(QString);
   27.24 +    virtual QString text();
   27.25 +    virtual void setFont(QFont);
   27.26 +    virtual QFont getFont();
   27.27 +    virtual void setColor(QColor);
   27.28 +    virtual QColor getColor();
   27.29 +    virtual void setVisibility(bool);
   27.30 +	virtual int getHeight();
   27.31 +	virtual int getWidth();
   27.32 +
   27.33 +protected:
   27.34 +    QString heading;
   27.35 +    uint textwidth;								// width for formatting text
   27.36 +    QPtrList <QCanvasText> textline;			// a part of e.g. the parabel
   27.37 +    QColor color;
   27.38 +    QFont font;
   27.39 +};
   27.40 +#endif
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/imageobj.cpp	Sun Jan 30 12:58:47 2005 +0000
    28.3 @@ -0,0 +1,100 @@
    28.4 +#include "imageobj.h"
    28.5 +
    28.6 +/////////////////////////////////////////////////////////////////
    28.7 +// ImageObj
    28.8 +/////////////////////////////////////////////////////////////////
    28.9 +ImageObj::ImageObj( QCanvas *canvas )
   28.10 +    : QCanvasRectangle( canvas )
   28.11 +{
   28.12 +//	cout << "Const ImageObj (canvas)\n";
   28.13 +    setZ(Z_ICON);	
   28.14 +	type=undef;
   28.15 +}
   28.16 +
   28.17 +ImageObj::~ImageObj()
   28.18 +{
   28.19 +//   cout << "Destr ImageObj\n";
   28.20 +}
   28.21 +
   28.22 +void ImageObj::copy(ImageObj* other)
   28.23 +{
   28.24 +	setSize (other->width(), other->height() );
   28.25 +	setVisibility (other->isVisible() );
   28.26 +	type=other->type;
   28.27 +//	if (type==qimage)
   28.28 +		image=other->image;
   28.29 +//	if (type==qpixmap)
   28.30 +		pixmap=other->pixmap;
   28.31 +}
   28.32 +
   28.33 +void ImageObj::setVisibility (bool v)
   28.34 +{
   28.35 +	if (v)	
   28.36 +		show();
   28.37 +	else
   28.38 +		hide();
   28.39 +}
   28.40 +
   28.41 +void ImageObj::save(const QString &fn, const char *format)
   28.42 +{
   28.43 +	switch (type)
   28.44 +	{
   28.45 +		case undef: qWarning("undef");break;
   28.46 +		case qimage: image.save (fn,format,-1);break;
   28.47 +		case qpixmap: pixmap.save (fn,format,-1);break;
   28.48 +	}
   28.49 +}
   28.50 +
   28.51 +bool ImageObj::load (const QString &fn)
   28.52 +{
   28.53 +	if (!image.load( fn) )
   28.54 +		//cout << "Fatal Error in ImageObj::load ("<<fn<<")\n";
   28.55 +		return false;
   28.56 +    setSize( image.width(), image.height() );
   28.57 +	type=qimage;
   28.58 +
   28.59 +#if !defined(Q_WS_QWS)
   28.60 +    pixmap.convertFromImage(image, OrderedAlphaDither);
   28.61 +#endif
   28.62 +	return true;
   28.63 +}
   28.64 +
   28.65 +bool ImageObj::load (QPixmap pm)
   28.66 +{
   28.67 +#if !defined(Q_WS_QWS)
   28.68 +    //pixmap.convertFromImage(image, OrderedAlphaDither);
   28.69 +	type=qpixmap;
   28.70 +	pixmap=pm;
   28.71 +    setSize( pm.width(), pm.height() );
   28.72 +#else
   28.73 +	type=qimage;
   28.74 +	image=pm;
   28.75 +    setSize( image.width(), image.height() );
   28.76 +#endif
   28.77 +	return true;
   28.78 +}
   28.79 +
   28.80 +void ImageObj::setImage(QImage img)
   28.81 +{
   28.82 +	type=qimage;
   28.83 +	image=img;
   28.84 +    pixmap.convertFromImage(image, OrderedAlphaDither);
   28.85 +}
   28.86 +
   28.87 +QPixmap ImageObj::getPixmap()
   28.88 +{
   28.89 +	return pixmap;
   28.90 +}
   28.91 +
   28.92 +void ImageObj::drawShape( QPainter &p )
   28.93 +{
   28.94 +// On Qt/Embedded, we can paint a QImage as fast as a QPixmap,
   28.95 +// but on other platforms, we need to use a QPixmap.
   28.96 +#if defined(Q_WS_QWS)
   28.97 +    p.drawImage( int(x()), int(y()), image, 0, 0, -1, -1, OrderedAlphaDither );
   28.98 +#else
   28.99 +    p.drawPixmap( int(x()), int(y()), pixmap );
  28.100 +#endif
  28.101 +}
  28.102 +
  28.103 +
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/imageobj.h	Sun Jan 30 12:58:47 2005 +0000
    29.3 @@ -0,0 +1,31 @@
    29.4 +#ifndef IMAGEOBJ_H
    29.5 +#define IMAGEOBJ_H
    29.6 +
    29.7 +#include <qimage.h>
    29.8 +#include <qcanvas.h>
    29.9 +#include <qpainter.h>
   29.10 +
   29.11 +#include "mapobj.h"
   29.12 +
   29.13 +enum ImageType {qimage,qpixmap,undef};
   29.14 +
   29.15 +class ImageObj: public QCanvasRectangle
   29.16 +{
   29.17 +public:
   29.18 +    ImageObj( QCanvas *canvas );
   29.19 +    ~ImageObj();
   29.20 +	virtual void copy (ImageObj*);
   29.21 +    virtual void setVisibility(bool);
   29.22 +	void save (const QString &, const char *);
   29.23 +	bool load (const QString &);
   29.24 +	bool load (QPixmap);
   29.25 +	void setImage(QImage img);
   29.26 +	QPixmap getPixmap();
   29.27 +protected:
   29.28 +    void drawShape( QPainter & );
   29.29 +private:
   29.30 +    QImage image;
   29.31 +    QPixmap pixmap;
   29.32 +	ImageType type;
   29.33 +};
   29.34 +#endif
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/linkablemapobj.cpp	Sun Jan 30 12:58:47 2005 +0000
    30.3 @@ -0,0 +1,693 @@
    30.4 +//#include <math.h>
    30.5 +
    30.6 +#include "linkablemapobj.h"
    30.7 +#include "branchobj.h"
    30.8 +#include "mapeditor.h"
    30.9 +
   30.10 +#include "version.h"
   30.11 +
   30.12 +
   30.13 +/////////////////////////////////////////////////////////////////
   30.14 +// LinkableMapObj
   30.15 +/////////////////////////////////////////////////////////////////
   30.16 +
   30.17 +LinkableMapObj::LinkableMapObj():MapObj()
   30.18 +{
   30.19 +  //  cout << "Const LinkableMapObj ()\n";
   30.20 +    init ();
   30.21 +}
   30.22 +
   30.23 +LinkableMapObj::LinkableMapObj(QCanvas* c) :MapObj(c)
   30.24 +{
   30.25 +//    cout << "Const LinkableMapObj\n";
   30.26 +    init ();
   30.27 +}
   30.28 +
   30.29 +LinkableMapObj::LinkableMapObj (LinkableMapObj* lmo) : MapObj (lmo->canvas)
   30.30 +{
   30.31 +    copy (lmo);
   30.32 +}
   30.33 +
   30.34 +LinkableMapObj::~LinkableMapObj()
   30.35 +{
   30.36 +    delete (bottomline);
   30.37 +    delete (selbox);
   30.38 +	delete (frame);
   30.39 +	delLink();
   30.40 +}
   30.41 +
   30.42 +void LinkableMapObj::delLink()
   30.43 +{
   30.44 +	switch (style)
   30.45 +	{
   30.46 +		case StyleLine:
   30.47 +			delete (l);
   30.48 +			break;
   30.49 +		case StyleParabel:
   30.50 +			segment.clear();
   30.51 +			break;
   30.52 +		case StylePolyLine:
   30.53 +			delete (p);
   30.54 +			delete (l);
   30.55 +			break;
   30.56 +		case StylePolyParabel:
   30.57 +			delete (p);
   30.58 +			segment.clear();
   30.59 +			break;
   30.60 +		default:
   30.61 +			break;
   30.62 +	}		
   30.63 +}
   30.64 +
   30.65 +void LinkableMapObj::init ()
   30.66 +{
   30.67 +    depth=-1;	
   30.68 +    childObj=NULL;
   30.69 +    parObj=NULL;
   30.70 +    parObjTmpBuf=NULL;
   30.71 +    parPos=QPoint(0,0);
   30.72 +    childPos=QPoint(0,0);
   30.73 +	link2ParPos=false;
   30.74 +    l=NULL;
   30.75 +    orientation=OrientUndef;
   30.76 +    linkwidth=20;		
   30.77 +	thickness_start=8;
   30.78 +    style=StyleUndef;
   30.79 +	linkpos=LinkBottom;
   30.80 +    segment.setAutoDelete (TRUE);
   30.81 +    arcsegs=13;
   30.82 +	QPointArray pa(arcsegs*2+2);
   30.83 +    
   30.84 +    bottomline=new QCanvasLine(canvas);
   30.85 +    bottomline->setPen( QPen(linkcolor, 1) );
   30.86 +    bottomline->setZ(Z_LINK);
   30.87 +    bottomline->show();
   30.88 +
   30.89 +    // Prepare showing the selection of a MapObj
   30.90 +    selbox = new QCanvasRectangle (canvas);
   30.91 +    selbox->setZ(Z_SELBOX);
   30.92 +    selbox->setBrush( QColor(255,255,0) );
   30.93 +    selbox->setPen( QPen(QColor(255,255,0) ));
   30.94 +    selbox->hide();
   30.95 +    selected=false;
   30.96 +
   30.97 +	// initialize frame
   30.98 +	frame = new FrameObj (canvas);
   30.99 +	
  30.100 +	repositionRequest=false;
  30.101 +}
  30.102 +
  30.103 +void LinkableMapObj::copy (LinkableMapObj* other)
  30.104 +{
  30.105 +    MapObj::copy(other);
  30.106 +	bboxTotal=other->bboxTotal;
  30.107 +//    linkwidth=other->linkwidth;		
  30.108 +
  30.109 +    setLinkStyle(other->style);
  30.110 +    setLinkColor (other->linkcolor);
  30.111 +}
  30.112 +
  30.113 +void LinkableMapObj::setChildObj(LinkableMapObj* o)
  30.114 +{
  30.115 +    childObj=o;
  30.116 +}
  30.117 +
  30.118 +void LinkableMapObj::setParObj(LinkableMapObj* o)
  30.119 +{
  30.120 +    parObj=o;
  30.121 +	mapEditor=parObj->getMapEditor();
  30.122 +}
  30.123 +
  30.124 +void LinkableMapObj::setParObjTmp(LinkableMapObj*,QPoint,int)
  30.125 +{
  30.126 +}
  30.127 +
  30.128 +void LinkableMapObj::unsetParObjTmp()
  30.129 +{
  30.130 +}
  30.131 +
  30.132 +LinkStyle LinkableMapObj::getDefLinkStyle ()
  30.133 +{
  30.134 +	LinkStyle ls=mapEditor->getLinkStyle();
  30.135 +	switch (ls)
  30.136 +	{
  30.137 +		case StyleLine: 
  30.138 +			return ls;
  30.139 +			break;
  30.140 +		case StyleParabel:
  30.141 +			return ls;
  30.142 +			break;
  30.143 +		case StylePolyLine:	
  30.144 +			if (depth>1)
  30.145 +				return StyleLine;
  30.146 +			else	
  30.147 +				return ls;
  30.148 +			break;
  30.149 +		case StylePolyParabel:	
  30.150 +			if (depth>1)
  30.151 +				return StyleParabel;
  30.152 +			else	
  30.153 +				return ls;
  30.154 +			break;
  30.155 +		default: 
  30.156 +			break;	
  30.157 +	}	
  30.158 +	return StyleUndef;
  30.159 +}
  30.160 +
  30.161 +void LinkableMapObj::setLinkStyle(LinkStyle newstyle)
  30.162 +{
  30.163 +	delLink();
  30.164 +		
  30.165 +	style=newstyle;
  30.166 +
  30.167 +    if (childObj!=NULL && parObj != NULL)
  30.168 +    {
  30.169 +		int i;
  30.170 +		QCanvasLine* cl;
  30.171 +		switch (style)
  30.172 +		{
  30.173 +			case StyleUndef:
  30.174 +				bottomline->hide();
  30.175 +				break;
  30.176 +			case StyleLine: 
  30.177 +				l = new QCanvasLine(canvas);
  30.178 +				l->setPen( QPen(linkcolor, 1) );
  30.179 +				l->setZ(Z_LINK);
  30.180 +				if (visible)
  30.181 +					l->show();
  30.182 +				else
  30.183 +					l->hide();
  30.184 +				break;
  30.185 +			case StyleParabel:
  30.186 +				for (i=0;i<arcsegs;i++)
  30.187 +				{
  30.188 +					cl = new QCanvasLine(canvas);
  30.189 +					cl->setPen( QPen(linkcolor, 1) );
  30.190 +					cl->setPoints( 0,0,i*10,100);
  30.191 +					cl->setZ(Z_LINK);
  30.192 +					if (visible)
  30.193 +						cl->show();
  30.194 +					else
  30.195 +						cl->hide();
  30.196 +					segment.append(cl);
  30.197 +				}
  30.198 +				pa0.resize (arcsegs+1);
  30.199 +				break;
  30.200 +			case StylePolyLine:	
  30.201 +				p = new QCanvasPolygon(canvas);
  30.202 +				p->setBrush( linkcolor );
  30.203 +				p->setZ(Z_LINK);
  30.204 +				if (visible)
  30.205 +					p->show();
  30.206 +				else
  30.207 +					p->hide();
  30.208 +				pa0.resize (3);
  30.209 +				// TODO
  30.210 +				// a bit awkward: draw the lines additionally to polygon, to avoid
  30.211 +				// missing pixels, when polygon is extremly flat
  30.212 +				l = new QCanvasLine(canvas);
  30.213 +				l->setPen( QPen(linkcolor, 1) );
  30.214 +				l->setZ(Z_LINK);
  30.215 +				if (visible)
  30.216 +					l->show();
  30.217 +				else
  30.218 +					l->hide();
  30.219 +				break;
  30.220 +			case StylePolyParabel:	
  30.221 +				p = new QCanvasPolygon(canvas);
  30.222 +				p->setBrush( linkcolor );
  30.223 +				p->setZ(Z_LINK);
  30.224 +				if (visible)
  30.225 +					p->show();
  30.226 +				else
  30.227 +					p->hide();
  30.228 +				pa0.resize (arcsegs*2+2);
  30.229 +				pa1.resize (arcsegs+1);
  30.230 +				pa2.resize (arcsegs+1);
  30.231 +
  30.232 +				// TODO
  30.233 +				// a bit awkward: draw the lines additionally 
  30.234 +				// to polygon, to avoid missing pixels, 
  30.235 +				// if polygon is extremly flat
  30.236 +				for (i=0;i<arcsegs;i++)
  30.237 +				{
  30.238 +					cl = new QCanvasLine(canvas);
  30.239 +					cl->setPen( QPen(linkcolor, 1) );
  30.240 +					cl->setPoints( 0,0,i*10,100);
  30.241 +					cl->setZ(Z_LINK);
  30.242 +					if (visible)
  30.243 +						cl->show();
  30.244 +					else
  30.245 +						cl->hide();
  30.246 +					segment.append(cl);
  30.247 +				}
  30.248 +				break;
  30.249 +			default: 
  30.250 +				break;	
  30.251 +		}	
  30.252 +	} else
  30.253 +	{
  30.254 +		cout << "Error: ChildObj or parObj == NULL in LinkableMapObj::setLinkStyle\n";
  30.255 +	}
  30.256 +}
  30.257 +
  30.258 +LinkStyle LinkableMapObj::getLinkStyle()
  30.259 +{
  30.260 +	return style;
  30.261 +}
  30.262 +
  30.263 +void LinkableMapObj::setLinkPos(LinkPos lp)
  30.264 +{
  30.265 +	linkpos=lp;
  30.266 +}
  30.267 +
  30.268 +LinkPos LinkableMapObj::getLinkPos()
  30.269 +{
  30.270 +	return linkpos;
  30.271 +}
  30.272 +
  30.273 +
  30.274 +void LinkableMapObj::setLinkColor()
  30.275 +{
  30.276 +	// Overloaded in BranchObj and childs
  30.277 +	// here only set default color
  30.278 +	setLinkColor (mapEditor->getDefLinkColor());
  30.279 +}
  30.280 +
  30.281 +void LinkableMapObj::setLinkColor(QColor col)
  30.282 +{
  30.283 +	linkcolor=col;
  30.284 +    bottomline->setPen( QPen(linkcolor, 1) );
  30.285 +	QCanvasLine *cl;
  30.286 +	switch (style)
  30.287 +	{
  30.288 +		case StyleLine:
  30.289 +			l->setPen( QPen(col,1));
  30.290 +			break;	
  30.291 +		case StyleParabel:	
  30.292 +			for (cl=segment.first(); cl; cl=segment.next() )
  30.293 +				cl->setPen( QPen(col,1));
  30.294 +			break;
  30.295 +		case StylePolyLine:
  30.296 +			p->setBrush( QBrush(col));
  30.297 +			l->setPen( QPen(col,1));
  30.298 +			break;
  30.299 +		case StylePolyParabel:	
  30.300 +			p->setBrush( QBrush(col));
  30.301 +			for (cl=segment.first(); cl; cl=segment.next() )
  30.302 +				cl->setPen( QPen(col,1));
  30.303 +			break;
  30.304 +		default:
  30.305 +			break;
  30.306 +	} // switch (style)	
  30.307 +	updateLink();
  30.308 +}
  30.309 +
  30.310 +QColor LinkableMapObj::getLinkColor()
  30.311 +{
  30.312 +	return linkcolor;
  30.313 +}
  30.314 +
  30.315 +FrameType LinkableMapObj::getFrameType()
  30.316 +{
  30.317 +	return frame->getFrameType();
  30.318 +}
  30.319 +
  30.320 +void LinkableMapObj::setFrameType(const FrameType &t)
  30.321 +{
  30.322 +	frame->setFrameType(t);
  30.323 +	calcBBoxSize();
  30.324 +	positionBBox();
  30.325 +	requestReposition();
  30.326 +}
  30.327 +
  30.328 +void LinkableMapObj::setFrameType(const QString &t)
  30.329 +{
  30.330 +	frame->setFrameType(t);
  30.331 +	calcBBoxSize();
  30.332 +	positionBBox();
  30.333 +	requestReposition();
  30.334 +}
  30.335 +
  30.336 +void LinkableMapObj::setVisibility (bool v)
  30.337 +{
  30.338 +	MapObj::setVisibility (v);
  30.339 +	if (visible) 
  30.340 +	{
  30.341 +		bottomline->show();
  30.342 +		// FIXME lines and segments should be done in LMO?
  30.343 +		if (style==StyleLine && l) 
  30.344 +		{
  30.345 +			l->show();
  30.346 +		} else
  30.347 +		{
  30.348 +			QCanvasLine* cl;
  30.349 +			for (cl=segment.first(); cl; cl=segment.next() )
  30.350 +				cl->show();
  30.351 +		} 
  30.352 +	} else 
  30.353 +	{
  30.354 +		bottomline->hide();
  30.355 +		if (style==StyleLine && l) 
  30.356 +		{
  30.357 +			l->hide();
  30.358 +		} else
  30.359 +		{
  30.360 +			QCanvasLine* cl;
  30.361 +			for (cl=segment.first(); cl; cl=segment.next() )
  30.362 +				cl->hide();
  30.363 +		} 
  30.364 +	}	
  30.365 +}
  30.366 +
  30.367 +void LinkableMapObj::updateLink()
  30.368 +{
  30.369 +    // needs:
  30.370 +    //	childPos of parent
  30.371 +    //	orient   of parent
  30.372 +    //	style
  30.373 +    // 
  30.374 +    // sets:
  30.375 +    //	orientation
  30.376 +    //	childPos
  30.377 +    //	parPos
  30.378 +	//  offset
  30.379 +    //	drawing of the link itself
  30.380 +
  30.381 +
  30.382 +	// updateLink is called from move, but called from constructor we don't
  30.383 +	// have parents yet...
  30.384 +	if (style==StyleUndef) return;	
  30.385 +
  30.386 +	if (frame->getFrameType() == NoFrame)
  30.387 +		linkpos=LinkBottom;
  30.388 +	else	
  30.389 +		linkpos=LinkMiddle;
  30.390 +	switch (linkpos)
  30.391 +	{
  30.392 +		case LinkMiddle:
  30.393 +			offset=bbox.height() /2;
  30.394 +			break;
  30.395 +		default :
  30.396 +			offset=bbox.height()-1;			// draw link to bottom of bbox
  30.397 +			break;
  30.398 +	}
  30.399 +	
  30.400 +    double p2x,p2y;								// Set P2 Before setting
  30.401 +	if (!link2ParPos)
  30.402 +	{
  30.403 +		p2x=QPoint( parObj->getChildPos() ).x();	// P1, we have to look at
  30.404 +		p2y=QPoint( parObj->getChildPos() ).y();	// orientation
  30.405 +	} else	
  30.406 +	{
  30.407 +		p2x=QPoint( parObj->getParPos() ).x();	
  30.408 +		p2y=QPoint( parObj->getParPos() ).y();
  30.409 +	} 
  30.410 +
  30.411 +	LinkOrient orientOld=orientation;
  30.412 +
  30.413 +    // Set orientation, first look for orientation of parent
  30.414 +    if (parObj->getOrientation() != OrientUndef ) 
  30.415 +		// use the orientation of the parent:
  30.416 +		orientation=parObj->getOrientation();
  30.417 +    else
  30.418 +    {
  30.419 +		// calc orientation depending on position rel to mapCenter
  30.420 +		if (absPos.x() < QPoint(parObj->getChildPos() ).x() )
  30.421 +			orientation=OrientLeftOfCenter; 
  30.422 +		else
  30.423 +			orientation=OrientRightOfCenter;
  30.424 +    }
  30.425 +
  30.426 +	if ((orientation!=orientOld) && (orientOld!= OrientUndef))
  30.427 +	{
  30.428 +		// Orientation just changed. Reorient this subbranch, because move is called
  30.429 +		// before updateLink => Position is still the old one, which could lead to 
  30.430 +		// linking of subranch to itself => segfault
  30.431 +		//
  30.432 +		// Also possible: called in BranchObj::init(), then orientOld==OrientUndef,
  30.433 +		// no need to reposition now
  30.434 +		reposition();
  30.435 +	}
  30.436 +	
  30.437 +    if (orientation==OrientLeftOfCenter )
  30.438 +    {
  30.439 +		childPos=QPoint (absPos.x(),absPos.y()+offset);
  30.440 +		parPos=QPoint (absPos.x()+ bbox.width(), absPos.y() + offset );
  30.441 +    } else
  30.442 +    {
  30.443 +		childPos=QPoint (absPos.x()+ bbox.width(), absPos.y() + offset ); 
  30.444 +		parPos=QPoint (absPos.x(),absPos.y()+offset);
  30.445 +    }
  30.446 +	/* FIXME
  30.447 +		cout << "      LMO::updateLink   absPos="<<absPos<<endl;
  30.448 +		cout << "      LMO::updateLink childPos="<<childPos<<endl;
  30.449 +		cout << "      LMO::updateLink   parPos="<<parPos<<endl;
  30.450 +		cout << "      LMO::updateLink   offset="<<offset<<endl;
  30.451 +		cout << "      LMO::updateLink   bbox.w="<<bbox.width()<<endl;
  30.452 +		cout << "      LMO::updateLink   bbox.h="<<bbox.height()<<endl;
  30.453 +	*/	
  30.454 +
  30.455 +	double p1x=parPos.x();	// Link is drawn from P1 to P2
  30.456 +	double p1y=parPos.y();
  30.457 +
  30.458 +	double vx=p2x - p1x;	// V=P2-P1
  30.459 +	double vy=p2y - p1y;
  30.460 +
  30.461 +	// Draw the horizontal line below heading (from ChildPos to ParPos)
  30.462 +	bottomline->setPoints (lrint(childPos.x()),
  30.463 +		lrint(childPos.y()),
  30.464 +		lrint(p1x),
  30.465 +		lrint(p1y) );
  30.466 +
  30.467 +	double a;	// angle
  30.468 +	if (vx > -0.000001 && vx < 0.000001)
  30.469 +		a=M_PI_2;
  30.470 +	else
  30.471 +		a=atan( vy / vx );
  30.472 +	// "turning point" for drawing polygonal links
  30.473 +	QPoint tp (-lrint(sin (a)*thickness_start), lrint(cos (a)*thickness_start));	
  30.474 +	
  30.475 +	QCanvasLine *cl;
  30.476 +
  30.477 +	int i;
  30.478 +
  30.479 +    // Draw the link
  30.480 +	switch (style)
  30.481 +	{
  30.482 +		case StyleLine:
  30.483 +			l->setPoints( lrint (parPos.x()),
  30.484 +				lrint(parPos.y()),
  30.485 +				lrint(p2x),
  30.486 +				lrint(p2y) );
  30.487 +			break;	
  30.488 +		case StyleParabel:	
  30.489 +			parabel (pa0, p1x,p1y,p2x,p2y);
  30.490 +			i=0;
  30.491 +			for (cl=segment.first(); cl; cl=segment.next() )
  30.492 +			{	
  30.493 +				cl->setPoints( pa0.point(i).x(), pa0.point(i).y(),pa0.point(i+1).x(),pa0.point(i+1).y());
  30.494 +				i++;
  30.495 +			}
  30.496 +			break;
  30.497 +		case StylePolyLine:
  30.498 +			pa0[0]=QPoint (lrint(p2x+tp.x()), lrint(p2y+tp.y()));
  30.499 +			pa0[1]=QPoint (lrint(p2x-tp.x()), lrint(p2y-tp.y()));
  30.500 +			pa0[2]=QPoint (lrint (parPos.x()), lrint(parPos.y()) );
  30.501 +			p->setPoints (pa0);
  30.502 +			// here too, draw line to avoid missing pixels
  30.503 +			l->setPoints( lrint (parPos.x()),
  30.504 +				lrint(parPos.y()),
  30.505 +				lrint(p2x),
  30.506 +				lrint(p2y) );
  30.507 +			break;
  30.508 +		case StylePolyParabel:	
  30.509 +			parabel (pa1, p1x,p1y,p2x+tp.x(),p2y+tp.y());
  30.510 +			parabel (pa2, p1x,p1y,p2x-tp.x(),p2y-tp.y());
  30.511 +			for (i=0;i<=arcsegs;i++)
  30.512 +			{
  30.513 +				// Combine the arrays to a single one
  30.514 +				pa0[i]=pa1[i];
  30.515 +				pa0[i+arcsegs+1]=pa2[arcsegs-i];
  30.516 +			}	
  30.517 +			p->setPoints (pa0);
  30.518 +			i=0;
  30.519 +			for (cl=segment.first(); cl; cl=segment.next() )
  30.520 +			{	
  30.521 +				cl->setPoints( pa1.point(i).x(), pa1.point(i).y(),pa1.point(i+1).x(),pa1.point(i+1).y());
  30.522 +				i++;
  30.523 +			}
  30.524 +			break;
  30.525 +		default:
  30.526 +			break;
  30.527 +	} // switch (style)	
  30.528 +}
  30.529 +	
  30.530 +LinkableMapObj* LinkableMapObj::getChildObj()
  30.531 +{
  30.532 +    return childObj;
  30.533 +}
  30.534 +
  30.535 +LinkableMapObj* LinkableMapObj::getParObj()
  30.536 +{
  30.537 +    return parObj;
  30.538 +}
  30.539 +
  30.540 +QPoint LinkableMapObj::getChildPos()
  30.541 +{
  30.542 +    return childPos;
  30.543 +}
  30.544 +
  30.545 +QPoint LinkableMapObj::getParPos()
  30.546 +{
  30.547 +    return parPos;
  30.548 +}
  30.549 +
  30.550 +QPoint LinkableMapObj::getRelPos()
  30.551 +{
  30.552 +	if (!parObj) return QPoint (0,0);
  30.553 +    return QPoint(
  30.554 +		absPos.x() - parObj->x(),
  30.555 +		absPos.y() - parObj->y()
  30.556 +	);
  30.557 +}
  30.558 +
  30.559 +LinkOrient LinkableMapObj::getOrientation()
  30.560 +{
  30.561 +    return orientation;
  30.562 +}
  30.563 +
  30.564 +int LinkableMapObj::getDepth()
  30.565 +{
  30.566 +    return depth;
  30.567 +}
  30.568 +
  30.569 +void LinkableMapObj::setMapEditor (MapEditor *me)
  30.570 +{
  30.571 +	mapEditor=me;
  30.572 +}
  30.573 +
  30.574 +MapEditor* LinkableMapObj::getMapEditor ()
  30.575 +{
  30.576 +	return mapEditor;
  30.577 +}
  30.578 +
  30.579 +QPoint LinkableMapObj::getRandPos()
  30.580 +{
  30.581 +	// Choose a random position with given distance to parent:
  30.582 +	double a=rand()%360 * 2 * M_PI / 360;
  30.583 +    return QPoint ( (int)( + 150*cos (a)),
  30.584 +                    (int)( + 150*sin (a)));
  30.585 +}
  30.586 +
  30.587 +void LinkableMapObj::alignRelativeTo (QPoint ref)
  30.588 +{
  30.589 +}
  30.590 +
  30.591 +void LinkableMapObj::reposition()
  30.592 +{
  30.593 +cout << "LMO::reposition  ???"<<endl;
  30.594 +	if (depth==0)
  30.595 +	{
  30.596 +		// only calculate the sizes once. If the deepest LMO changes its height,
  30.597 +		// all upper LMOs have to change, too.
  30.598 +		calcBBoxSizeWithChilds();
  30.599 +
  30.600 +	    alignRelativeTo ( QPoint (absPos.x(),
  30.601 +							absPos.y()-(bboxTotal.height()-bbox.height())/2) );
  30.602 +	} else
  30.603 +	{
  30.604 +		// This is only important for moving branches:
  30.605 +		// For editing a branch it isn't called...
  30.606 +	    alignRelativeTo ( QPoint (absPos.x(),
  30.607 +							absPos.y()-(bboxTotal.height()-bbox.height())/2) );
  30.608 +	}
  30.609 +}
  30.610 +
  30.611 +void LinkableMapObj::requestReposition()
  30.612 +{
  30.613 +	if (!repositionRequest)
  30.614 +	{
  30.615 +		// Pass on the request to parental objects, if this hasn't
  30.616 +		// been done yet
  30.617 +		repositionRequest=true;
  30.618 +		if (parObj) parObj->requestReposition();
  30.619 +	}
  30.620 +}
  30.621 +
  30.622 +void LinkableMapObj::forceReposition()
  30.623 +{
  30.624 +	// Sometimes a reposition has to be done immediatly: For example
  30.625 +	// if the note editor flag changes, there is no user event in mapeditor
  30.626 +	// which could collect requests for a reposition.
  30.627 +	// Then we have to call forceReposition()
  30.628 +	// But no rule without exception: While loading a map or undoing it,
  30.629 +	// we want to block expensive repositioning, but just do it once at
  30.630 +	// the end, thus check first:
  30.631 +
  30.632 +	if (mapEditor->blockReposition()) return;
  30.633 +	
  30.634 +	// Pass on the request to parental objects, if this hasn't been done yet
  30.635 +	
  30.636 +	if (parObj) 
  30.637 +		parObj->forceReposition(); 
  30.638 +	else 
  30.639 +		reposition(); }
  30.640 +
  30.641 +bool LinkableMapObj::repositionRequested()
  30.642 +{
  30.643 +	return repositionRequest;
  30.644 +}
  30.645 +
  30.646 +
  30.647 +void LinkableMapObj::setSelBox()
  30.648 +{
  30.649 +    selbox->setX (bbox.x() );
  30.650 +    selbox->setY (bbox.y() );
  30.651 +    selbox->setSize (bbox.width(), bbox.height() );
  30.652 +}
  30.653 +
  30.654 +void LinkableMapObj::select()
  30.655 +{
  30.656 +	setSelBox();
  30.657 +    selected=true;
  30.658 +    selbox->show();
  30.659 +}
  30.660 +
  30.661 +
  30.662 +void LinkableMapObj::unselect()
  30.663 +{
  30.664 +    selected=false;
  30.665 +    selbox->hide();
  30.666 +}
  30.667 +
  30.668 +void LinkableMapObj::parabel (QPointArray &ya, double p1x, double p1y, double p2x, double p2y)
  30.669 +
  30.670 +{
  30.671 +	double vx=p2x - p1x;	// V=P2-P1
  30.672 +	double vy=p2y - p1y;
  30.673 +
  30.674 +	double dx;				// delta x during calculation of parabel
  30.675 +	
  30.676 +	double pnx;				// next point
  30.677 +	double pny;
  30.678 +	double m;
  30.679 +
  30.680 +	if (vx > -0.0001 && vx < 0.0001)
  30.681 +		m=0;
  30.682 +	else	
  30.683 +		m=(vy / (vx*vx));
  30.684 +	dx=vx/(arcsegs);
  30.685 +	int i;
  30.686 +	ya.setPoint (0,QPoint (lrint(p1x),lrint(p1y)));
  30.687 +	for (i=1;i<=arcsegs;i++)
  30.688 +	{	
  30.689 +		pnx=p1x+dx;
  30.690 +		pny=m*(pnx-parPos.x())*(pnx-parPos.x())+parPos.y();
  30.691 +		ya.setPoint (i,QPoint (lrint(pnx),lrint(pny)));
  30.692 +		p1x=pnx;
  30.693 +		p1y=pny;
  30.694 +	}	
  30.695 +}
  30.696 +
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/linkablemapobj.h	Sun Jan 30 12:58:47 2005 +0000
    31.3 @@ -0,0 +1,113 @@
    31.4 +#ifndef LINKABLEMAPOBJ_H
    31.5 +#define LINKABLEMAPOBJ_H
    31.6 +
    31.7 +#include "frameobj.h"
    31.8 +#include "noteobj.h"
    31.9 +#include "headingobj.h"
   31.10 +#include "flagrowobj.h"
   31.11 +
   31.12 +#define MAX_DEPTH 999
   31.13 +
   31.14 +enum LinkOrient {OrientUndef,OrientLeftOfCenter, OrientRightOfCenter};
   31.15 +enum LinkStyle {
   31.16 +	StyleUndef,
   31.17 +	StyleLine, 
   31.18 +	StyleParabel, 
   31.19 +	StylePolyLine,
   31.20 +	StylePolyParabel
   31.21 +};
   31.22 +enum LinkPos {LinkMiddle,LinkBottom};
   31.23 +enum LinkColorHint {DefaultColor,HeadingColor};
   31.24 +
   31.25 +class LinkableMapObj:public QObject, public MapObj {
   31.26 +	Q_OBJECT
   31.27 +public:
   31.28 +    LinkableMapObj ();
   31.29 +    LinkableMapObj (QCanvas*);
   31.30 +    LinkableMapObj (LinkableMapObj*);
   31.31 +    ~LinkableMapObj ();
   31.32 +	virtual void delLink();
   31.33 +    virtual void init ();
   31.34 +    virtual void copy (LinkableMapObj*);
   31.35 +    void setChildObj (LinkableMapObj*);
   31.36 +    virtual void setParObj (LinkableMapObj*);
   31.37 +    virtual void setParObjTmp (LinkableMapObj*,QPoint,int);	// Only for moving Obj around
   31.38 +	virtual void unsetParObjTmp();						// reuse original ParObj
   31.39 +	LinkStyle getDefLinkStyle();
   31.40 +    void setLinkStyle(LinkStyle);            
   31.41 +	LinkStyle getLinkStyle();
   31.42 +	void setLinkPos (LinkPos);
   31.43 +	LinkPos getLinkPos ();
   31.44 +
   31.45 +	virtual void setLinkColor();					// sets color according to colorhint, overloaded
   31.46 +	virtual void setLinkColor(QColor);
   31.47 +	QColor getLinkColor();
   31.48 +	virtual FrameType getFrameType ();
   31.49 +	virtual void setFrameType (const FrameType &);
   31.50 +	virtual void setFrameType (const QString &);
   31.51 +	virtual void setVisibility (bool);
   31.52 +    virtual void updateLink();				// update parPos and childPos
   31.53 +											// depending on pos
   31.54 +											// redraw link with given style
   31.55 +    LinkableMapObj* getChildObj();			// returns pointer to fromObj
   31.56 +    LinkableMapObj* getParObj();			// returns pointer to toObj
   31.57 +    QPoint getChildPos();					// returns pos where childs dock
   31.58 +    QPoint getParPos();						// returns pos where parents dock
   31.59 +    QPoint getRelPos();						// get position relative to parent (or (0,0))
   31.60 +    LinkOrient getOrientation();			// get orientation
   31.61 +    virtual int getDepth();					// return depth
   31.62 +	virtual void setMapEditor(MapEditor*);	// set MapEditor (needed in LMO::updateNoteFlag)
   31.63 +	virtual MapEditor* getMapEditor();		// get MapEditor (usually from parent);
   31.64 +	virtual QPoint getRandPos();			// make randomised position
   31.65 +
   31.66 +    virtual void alignRelativeTo(const QPoint );
   31.67 +	virtual void reposition();
   31.68 +	virtual void requestReposition();		// do reposition after next user event
   31.69 +	virtual void forceReposition();			// to force a reposition now (outside
   31.70 +											// of mapeditor e.g. in noteeditor
   31.71 +	virtual bool repositionRequested();
   31.72 +
   31.73 +	virtual QRect getTotalBBox()=0;			// return BBox including childs			
   31.74 +	virtual QRect getBBoxSizeWithChilds()=0;// return size of BBox including childs  
   31.75 +	virtual void calcBBoxSizeWithChilds()=0;// calc size of  BBox including childs recursivly
   31.76 +
   31.77 +	virtual void setSelBox();
   31.78 +    virtual void select();
   31.79 +    virtual void unselect();
   31.80 +	virtual	QString getSelectString()=0;
   31.81 +
   31.82 +protected:
   31.83 +	void parabel(QPointArray &,double,double,double,double);	// Create Parabel connecting two points
   31.84 +    QPoint childPos;
   31.85 +    QPoint parPos;
   31.86 +	bool link2ParPos;				// While moving around, sometimes link to parent
   31.87 +	MapEditor* mapEditor;			// for updateNoteFlag() and toggleScroll()
   31.88 +    LinkOrient orientation;     
   31.89 +    int linkwidth;					// width of a link
   31.90 +    int depth;						// depth: undef=-1 mapCenter=0 branch=1..n
   31.91 +	QRect bboxTotal;				// bounding box including childs
   31.92 +
   31.93 +    LinkableMapObj* childObj;
   31.94 +    LinkableMapObj* parObj;
   31.95 +    LinkableMapObj* parObjTmpBuf;	// temporary buffer the original parent
   31.96 +    int offset;                     // vertical offset of dockpos to pos
   31.97 +
   31.98 +	int thickness_start;			// for StylePoly*	
   31.99 +    LinkStyle style;
  31.100 +	LinkPos linkpos;
  31.101 +    QColor linkcolor;               // Link color
  31.102 +    QCanvasLine* l;                 // line style
  31.103 +	QCanvasPolygon* p;				// poly styles
  31.104 +    int arcsegs;                    // arc: number of segments
  31.105 +    QPtrList <QCanvasLine> segment; // a part of e.g. the parabel
  31.106 +	QPointArray pa0;				// For drawing of PolyParabel and PolyLine
  31.107 +	QPointArray pa1;				// For drawing of PolyParabel 
  31.108 +	QPointArray pa2;				// For drawing of PolyParabel	
  31.109 +    QCanvasLine* bottomline;        // on bottom of BBox
  31.110 +	bool repositionRequest;			// 
  31.111 +
  31.112 +	bool selected;					// Used for marking the selection
  31.113 +	QCanvasRectangle* selbox;
  31.114 +	FrameObj *frame;				// frame around object
  31.115 +};
  31.116 +#endif
    32.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.2 +++ b/main.cpp	Sun Jan 30 12:58:47 2005 +0000
    32.3 @@ -0,0 +1,177 @@
    32.4 +#include <qapplication.h>
    32.5 +#include <qpixmap.h>
    32.6 +#include <qtranslator.h>
    32.7 +
    32.8 +#include "settings.h"
    32.9 +#include "options.h"
   32.10 +#include "mainwindow.h"
   32.11 +
   32.12 +#include "icons/vym-48x48.xpm"
   32.13 +#include "icons/vym-editor.xpm"
   32.14 +
   32.15 +#include "flagrowobj.h"
   32.16 +
   32.17 +// Global variables
   32.18 +TextEditor *textEditor;			// used in Constr. of LinkableMapObj
   32.19 +								// initialized in mainwindow
   32.20 +
   32.21 +Main *mainWindow;				// used in BranchObj::select()								
   32.22 +MapEditor *clipboardME;			
   32.23 +FlagRowObj *systemFlagsDefault;	// used to copy from in LinkableMapObj
   32.24 +FlagRowObj *standardFlagsDefault;
   32.25 +
   32.26 +// Actions which change sometimes
   32.27 +QAction *actionFileSave;
   32.28 +QAction *actionFilePrint;
   32.29 +QAction *actionEditUndo;
   32.30 +QAction *actionEditCopy;
   32.31 +QAction *actionEditCut;
   32.32 +QAction *actionEditPaste;
   32.33 +QAction *actionEditMoveUp;
   32.34 +QAction *actionEditMoveDown;
   32.35 +QAction *actionEditToggleScroll;
   32.36 +QAction *actionEditOpenURL;
   32.37 +QAction *actionEditURL;
   32.38 +QAction *actionEditHeading2URL;
   32.39 +QAction *actionEditBugzilla2URL;
   32.40 +QAction *actionEditOpenVymLink;
   32.41 +QAction *actionEditVymLink;
   32.42 +QAction *actionEditDeleteVymLink;
   32.43 +QAction *actionEditMapInfo;
   32.44 +QAction *actionEditHeading;
   32.45 +QAction *actionEditDelete;
   32.46 +QAction *actionEditAddBranch;
   32.47 +QAction *actionEditAddBranchAbove;
   32.48 +QAction *actionEditAddBranchBelow;
   32.49 +QAction *actionEditImportAdd;
   32.50 +QAction *actionEditImportReplace;
   32.51 +QAction *actionEditSaveBranch;
   32.52 +QAction *actionEditSelectFirst;
   32.53 +QAction *actionEditSelectLast;
   32.54 +QAction *actionEditLoadImage;
   32.55 +QAction *actionEditToggleFloatExport;
   32.56 +
   32.57 +QAction *actionFormatColor;		
   32.58 +QAction *actionFormatPickColor;		
   32.59 +QAction *actionFormatColorBranch;
   32.60 +QAction *actionFormatColorSubtree;
   32.61 +QAction *actionFormatBackColor;
   32.62 +QAction *actionFormatLinkColorHint;
   32.63 +QAction *actionFormatLinkColor;		
   32.64 +
   32.65 +QActionGroup *actionGroupFormatFrameTypes;
   32.66 +QAction *actionFormatFrameNone;
   32.67 +QAction *actionFormatFrameRectangle;
   32.68 +
   32.69 +QActionGroup *actionGroupFormatLinkStyles;
   32.70 +QAction *actionFormatLinkStyleLine;
   32.71 +QAction *actionFormatLinkStyleParabel;
   32.72 +QAction *actionFormatLinkStylePolyLine;
   32.73 +QAction *actionFormatLinkStylePolyParabel;
   32.74 +
   32.75 +QAction *actionViewToggleNoteEditor;
   32.76 +
   32.77 +QAction *actionSettingsAutoselectHeading;
   32.78 +QAction *actionSettingsAutoselectText;
   32.79 +QAction *actionSettingsPasteNewHeading;
   32.80 +QAction *actionSettingsAutoedit;
   32.81 +QAction *actionSettingsUseDelKey;
   32.82 +
   32.83 +QPopupMenu *branchContextMenu;
   32.84 +QPopupMenu *floatimageContextMenu;
   32.85 +QPopupMenu *saveImageFormatMenu;
   32.86 +QPopupMenu *canvasContextMenu;
   32.87 +QPopupMenu *lastMapsMenu;
   32.88 +QPopupMenu *exportMenu;
   32.89 +QPopupMenu *exportImageFormatMenu;
   32.90 +
   32.91 +
   32.92 +Settings settings;
   32.93 +Options options;
   32.94 +
   32.95 +int statusbarTime=3500;
   32.96 +
   32.97 +int main(int argc, char** argv)
   32.98 +{
   32.99 +    QApplication app(argc,argv);
  32.100 +
  32.101 +
  32.102 +	// Initialize translations
  32.103 +	QTranslator translator (0);
  32.104 +	translator.load( "vym_de", "." );
  32.105 +    app.installTranslator( &translator );
  32.106 +
  32.107 +	// Initializing the row of system flags
  32.108 +	// is done in first call to MapEditor(),
  32.109 +	// because we need at least one canvas first
  32.110 +	systemFlagsDefault=NULL;
  32.111 +	standardFlagsDefault=NULL;
  32.112 +
  32.113 +	// Reading and initializing options commandline options
  32.114 +	options.add ("version", SwitchOption, "v","version");
  32.115 +	options.add ("help", SwitchOption, "h", "help");
  32.116 +	options.add ("quit", SwitchOption, "q", "quit");
  32.117 +	options.add ("test", StringOption, "t", "test");
  32.118 +	options.setHelpText (
  32.119 +		"VYM - View Your Mind\n"
  32.120 +		"--------------------\n\n"
  32.121 +		"Information about vym can be found in vym.pdf,\n"
  32.122 +		"which should be part of the vym package.\n"
  32.123 +		"It is also available at the project homepage:\n\n"
  32.124 +		"http://www.InSilmaril.de/vym\n");
  32.125 +	if (options.parse())
  32.126 +	{
  32.127 +		cout << endl << options.getHelpText()<<endl;
  32.128 +		return 1;
  32.129 +	}
  32.130 +
  32.131 +	if (options.isOn ("version"))
  32.132 +	{
  32.133 +		cout << "vym version "<<__VYM_VERSION__
  32.134 +			<<"  (c) 2004 Uwe Drechsel - "
  32.135 +			<<__BUILD_DATE__<<endl;
  32.136 +			
  32.137 +		return 0;	
  32.138 +	}		
  32.139 +	
  32.140 +	if (options.isOn ("help"))
  32.141 +	{
  32.142 +		cout << options.getHelpText()<<endl;
  32.143 +		return 0;	
  32.144 +	}	
  32.145 +
  32.146 +	if (options.isOn ("test"))
  32.147 +	{
  32.148 +		// FIXME testing string option only
  32.149 +		cout << "Testing: "<<options.getArg("test")<< endl;
  32.150 +	}	
  32.151 +
  32.152 +	// Initialize window of TextEditor
  32.153 +	textEditor = new TextEditor();
  32.154 +	textEditor->setIcon (QPixmap (vym_editor_xpm));
  32.155 +	if (textEditor->showWithMain()) textEditor->show();
  32.156 +
  32.157 +	clipboardME = new MapEditor();
  32.158 +	clipboardME->resize (800,600);
  32.159 +	clipboardME->setCaption("VYM - clipboard");
  32.160 +	clipboardME->hide();
  32.161 +
  32.162 +	// Initialize mainwindow after Mapeditors (because of Flags)
  32.163 +    Main m;
  32.164 +	//m.resize(m.sizeHint());
  32.165 +	m.setIcon (QPixmap (vym_logo_xpm));
  32.166 +	m.show();
  32.167 +	m.fileNew();
  32.168 +	m.loadCmdLine();
  32.169 +
  32.170 +	// For benchmarking we may want to quit immediatly after drawing
  32.171 +	if (options.isOn ("quit"))
  32.172 +	{
  32.173 +		return 0;
  32.174 +	}	
  32.175 +
  32.176 +    QObject::connect( &app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) );
  32.177 +
  32.178 +    return app.exec();
  32.179 +}
  32.180 +
    33.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.2 +++ b/mainwindow.cpp	Sun Jan 30 12:58:47 2005 +0000
    33.3 @@ -0,0 +1,2213 @@
    33.4 +#include "mainwindow.h"
    33.5 +
    33.6 +#include <qstatusbar.h>
    33.7 +#include <qmessagebox.h>
    33.8 +#include <qmenubar.h>
    33.9 +#include <qapplication.h>
   33.10 +#include <qpainter.h>
   33.11 +#include <qprinter.h>
   33.12 +#include <qfile.h>
   33.13 +#include <qfiledialog.h>
   33.14 +#include <qcolor.h>
   33.15 +#include <qcolordialog.h>
   33.16 +#include <qbitmap.h>
   33.17 +#include <qinputdialog.h>
   33.18 +
   33.19 +
   33.20 +#include <iostream>
   33.21 +#include <stdlib.h>
   33.22 +#include <typeinfo>
   33.23 +
   33.24 +#include "version.h"
   33.25 +
   33.26 +#include "icons/filenew.xpm"
   33.27 +#include "icons/fileopen.xpm"
   33.28 +#include "icons/filesave.xpm"
   33.29 +#include "icons/fileprint.xpm"
   33.30 +#include "icons/editundo.xpm"
   33.31 +//#include "icons/editredo.xpm"	// TODO
   33.32 +#include "icons/editcopy.xpm"
   33.33 +#include "icons/editcut.xpm"
   33.34 +#include "icons/editpaste.xpm"
   33.35 +#include "icons/editmoveup.xpm"
   33.36 +#include "icons/editmovedown.xpm"
   33.37 +#include "icons/formatcoloritem.xpm"
   33.38 +#include "icons/formatcolorbranch.xpm"
   33.39 +#include "icons/formatcolorpicker.xpm"
   33.40 +#include "icons/viewzoomreset.xpm"
   33.41 +#include "icons/viewzoomin.xpm"
   33.42 +#include "icons/viewzoomout.xpm"
   33.43 +#include "icons/vym-48x48.xpm"
   33.44 +#include "icons/flag-note.xpm"
   33.45 +#include "icons/flag-url.xpm"
   33.46 +#include "icons/flag-vymlink.xpm"	
   33.47 +#include "icons/flag-scrolled-right.xpm"
   33.48 +
   33.49 +#include "flagrowobj.h"
   33.50 +#include "texteditor.h"
   33.51 +#include "mapeditor.h"
   33.52 +#include "exporthtmldialog.h"
   33.53 +#include "exportxhtmldialog.h"
   33.54 +#include "showtextdialog.h"
   33.55 +#include "process.h"
   33.56 +#include "settings.h"
   33.57 +#include "options.h"
   33.58 +
   33.59 +extern TextEditor *textEditor;
   33.60 +extern Main *mainWindow;
   33.61 +extern int statusbarTime;
   33.62 +extern MapEditor *clipboardME;
   33.63 +extern FlagRowObj* standardFlagsDefault;
   33.64 +
   33.65 +extern QAction* actionFileSave;
   33.66 +extern QAction* actionFilePrint;
   33.67 +extern QAction* actionEditUndo;
   33.68 +extern QAction *actionEditCopy;
   33.69 +extern QAction *actionEditCut;
   33.70 +extern QAction *actionEditPaste;
   33.71 +extern QAction *actionEditMoveUp;
   33.72 +extern QAction *actionEditMoveDown;
   33.73 +extern QAction *actionEditToggleScroll;
   33.74 +extern QAction* actionEditOpenURL;
   33.75 +extern QAction* actionEditURL;
   33.76 +extern QAction* actionEditHeading2URL;
   33.77 +extern QAction* actionEditBugzilla2URL;
   33.78 +extern QAction *actionEditOpenVymLink;
   33.79 +extern QAction *actionEditVymLink;
   33.80 +extern QAction *actionEditDeleteVymLink;
   33.81 +extern QAction *actionEditMapInfo;
   33.82 +extern QAction *actionEditHeading;
   33.83 +extern QAction *actionEditDelete;
   33.84 +extern QAction *actionEditAddBranch;
   33.85 +extern QAction *actionEditAddBranchAbove;
   33.86 +extern QAction *actionEditAddBranchBelow;
   33.87 +extern QAction *actionEditImportAdd;
   33.88 +extern QAction *actionEditImportReplace;
   33.89 +extern QAction *actionEditSaveBranch;
   33.90 +extern QAction *actionEditSelectFirst;
   33.91 +extern QAction *actionEditSelectLast;
   33.92 +extern QAction *actionEditLoadImage;
   33.93 +extern QAction *actionEditToggleFloatExport;
   33.94 +
   33.95 +extern QAction* actionFormatColor;
   33.96 +extern QAction* actionFormatPickColor;
   33.97 +extern QAction* actionFormatColorBranch;
   33.98 +extern QAction* actionFormatColorSubtree;
   33.99 +extern QAction* actionFormatLinkColorHint;
  33.100 +extern QAction* actionFormatBackColor;
  33.101 +extern QAction* actionFormatLinkColor;
  33.102 +
  33.103 +extern QActionGroup *actionGroupFormatFrameTypes;
  33.104 +extern QAction *actionFormatFrameNone;
  33.105 +extern QAction *actionFormatFrameRectangle;
  33.106 +
  33.107 +extern QActionGroup *actionGroupFormatLinkStyles;
  33.108 +extern QAction *actionFormatLinkStyleLine;
  33.109 +extern QAction *actionFormatLinkStyleParabel;
  33.110 +extern QAction *actionFormatLinkStylePolyLine;
  33.111 +extern QAction *actionFormatLinkStylePolyParabel;
  33.112 +
  33.113 +extern QAction *actionViewToggleNoteEditor;
  33.114 +
  33.115 +extern QAction* actionSettingsAutoedit;
  33.116 +extern QAction* actionSettingsAutoselectHeading;
  33.117 +extern QAction* actionSettingsAutoselectHeading;
  33.118 +extern QAction* actionSettingsAutoselectText;
  33.119 +extern QAction* actionSettingsPasteNewHeading;
  33.120 +extern QAction* actionSettingsUseDelKey;
  33.121 +
  33.122 +extern QPopupMenu* branchContextMenu;
  33.123 +extern QPopupMenu* floatimageContextMenu;
  33.124 +extern QPopupMenu* saveImageFormatMenu;
  33.125 +extern QPopupMenu* canvasContextMenu;
  33.126 +extern QPopupMenu* lastMapsMenu;
  33.127 +extern QPopupMenu* exportMenu;
  33.128 +extern QPopupMenu* exportImageFormatMenu;
  33.129 +
  33.130 +
  33.131 +extern Settings settings;
  33.132 +extern Options options;
  33.133 +
  33.134 +#if defined(Q_OS_LINUX)
  33.135 +extern void qt_wait_for_window_manager( QWidget* w );
  33.136 +#endif
  33.137 +
  33.138 +Main::Main(QWidget* parent, const char* name, WFlags f) :
  33.139 +    QMainWindow(parent,name,f)
  33.140 +{
  33.141 +	mainWindow=this;
  33.142 +
  33.143 +	setCaption ("VYM - View Your Mind");
  33.144 +
  33.145 +	// Load window settings
  33.146 +	resize (settings.readNumEntry( "/vym/mainwindow/geometry/width", 800),
  33.147 +	        settings.readNumEntry( "/vym/mainwindow/geometry/height",600));
  33.148 +	move   (settings.readNumEntry( "/vym/mainwindow/geometry/posX", 100),
  33.149 +	        settings.readNumEntry( "/vym/mainwindow/geometry/posY", 100));
  33.150 +
  33.151 +
  33.152 +	// Initialize some settings, which are platform dependant
  33.153 +	QString p,s;
  33.154 +
  33.155 +		// application to open URLs
  33.156 +		p="/vym/mainwindow/readerURL";
  33.157 +		#if defined(Q_OS_LINUX)
  33.158 +			s=settings.readEntry (p,"konqueror");
  33.159 +		#else
  33.160 +			#if defined(Q_OS_MACX)
  33.161 +				s=settings.readEntry (p,"/Applications/Safari.app/Contents/MacOS/Safari");
  33.162 +			#else
  33.163 +				s=settings.readEntry (p,"mozilla");
  33.164 +			#endif
  33.165 +		#endif
  33.166 +		settings.writeEntry( p,s);
  33.167 +
  33.168 +		// application to open PDFs
  33.169 +		p="/vym/mainwindow/readerPDF";
  33.170 +		#if defined(Q_OS_LINUX)
  33.171 +			s=settings.readEntry (p,"acroread");
  33.172 +		#else
  33.173 +			#if defined(Q_OS_MACX)
  33.174 +				s=settings.readEntry (p,"/Applications/Safari.app/Contents/MacOS/Safari");
  33.175 +			#else
  33.176 +				s=settings.readEntry (p,"acroread");
  33.177 +			#endif
  33.178 +		#endif
  33.179 +		settings.writeEntry( p,s);
  33.180 +
  33.181 +	
  33.182 +	maxLastMaps=9;
  33.183 +
  33.184 +	// Create tab widget which holds the maps
  33.185 +	tabWidget= new QTabWidget (this);
  33.186 +	connect( tabWidget, SIGNAL( currentChanged( QWidget * ) ), 
  33.187 +		this, SLOT( editorChanged( QWidget * ) ) );
  33.188 +
  33.189 +	setCentralWidget(tabWidget);	
  33.190 +
  33.191 +    setupFileActions();
  33.192 +    setupEditActions();
  33.193 +    setupFormatActions();
  33.194 +    setupViewActions();
  33.195 +	setupFlagActions();
  33.196 +    setupSettingsActions();
  33.197 +	setupContextMenus();
  33.198 +    if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) setupTestActions();
  33.199 +    setupHelpActions();
  33.200 +    
  33.201 +	// After menu is created, we can enable some actions
  33.202 +	actionFilePrint->setEnabled (true);
  33.203 +
  33.204 +    statusBar();
  33.205 +
  33.206 +	// Create the default map into first tab
  33.207 +//	fileNew();
  33.208 +//	tabWidget->addTab (new MapEditor(tabWidget,true), "unnamed");
  33.209 +//	currentMapEditor()->show();
  33.210 +
  33.211 +	// Initialize Find window
  33.212 +	findWindow=new FindWindow(NULL,"findwindow");
  33.213 +	connect (findWindow, SIGNAL( findButton(QString) ), 
  33.214 +		this, SLOT(editFind(QString) ) );	
  33.215 +	connect (findWindow, SIGNAL( somethingChanged() ), 
  33.216 +		this, SLOT(editFindChanged() ) );	
  33.217 +
  33.218 +	updateGeometry();
  33.219 +}
  33.220 +
  33.221 +Main::~Main()
  33.222 +{
  33.223 +	// Save Settings
  33.224 +	settings.writeEntry( "/vym/mainwindow/geometry/width", width() );
  33.225 +	settings.writeEntry( "/vym/mainwindow/geometry/height", height() );
  33.226 +	settings.writeEntry( "/vym/mainwindow/geometry/posX", pos().x() );
  33.227 +	settings.writeEntry( "/vym/mainwindow/geometry/posY", pos().y() );
  33.228 +
  33.229 +	settings.writeEntry( "/vym/version/version", __VYM_VERSION__ );
  33.230 +	settings.writeEntry( "/vym/version/builddate", __BUILD_DATE__ );
  33.231 +
  33.232 +	settings.writeEntry( "/vym/mapeditor/editmode/autoselectheading",actionSettingsAutoselectHeading->isOn() );
  33.233 +	settings.writeEntry( "/vym/mapeditor/editmode/autoselecttext",actionSettingsAutoselectText->isOn() );
  33.234 +	settings.writeEntry( "/vym/mapeditor/editmode/pastenewheading",actionSettingsPasteNewHeading->isOn() );
  33.235 +	settings.writeEntry( "/vym/mapeditor/editmode/autoedit",actionSettingsAutoedit->isOn() );
  33.236 +	settings.writeEntry( "/vym/mapeditor/editmode/useDelKey",actionSettingsUseDelKey->isOn() );
  33.237 +
  33.238 +	QString s;
  33.239 +	int maps=lastMaps.count();
  33.240 +	settings.writeEntry( "/vym/lastMaps/number",maps );
  33.241 +	for (int i=1;i<=maps;i++)
  33.242 +	{
  33.243 +		QStringList::Iterator it = lastMaps.at(i-1);
  33.244 +		s=QString("/vym/lastMaps/map-%1").arg(i);
  33.245 +		if (!s.isEmpty() && i<=maxLastMaps) 
  33.246 +			settings.writeEntry (s, *it);
  33.247 +	}
  33.248 +
  33.249 +
  33.250 +	// To make the texteditor save its settings, call the destructor
  33.251 +	delete (textEditor);
  33.252 +}
  33.253 +
  33.254 +void Main::loadCmdLine()
  33.255 +{
  33.256 +	/* TODO draw some kind of splashscreen while loading...
  33.257 +	if (qApp->argc()>1)
  33.258 +	{
  33.259 +	}
  33.260 +	*/
  33.261 +	
  33.262 +	QStringList flist=options.getFileList();
  33.263 +	QStringList::Iterator it=flist.begin();
  33.264 +
  33.265 +	while (it !=flist.end() )
  33.266 +	{
  33.267 +		fileLoad (*it, NewMap);
  33.268 +		*it++;
  33.269 +	}	
  33.270 +}
  33.271 +
  33.272 +
  33.273 +void Main::statusMessage(const QString &s)
  33.274 +{
  33.275 +	statusBar()->message (s);
  33.276 +}
  33.277 +
  33.278 +void Main::closeEvent (QCloseEvent* )
  33.279 +{
  33.280 +	fileExitVYM();
  33.281 +}
  33.282 +
  33.283 +// File Actions
  33.284 +void Main::setupFileActions()
  33.285 +{
  33.286 +    QToolBar *tb = new QToolBar( this );
  33.287 +    tb->setLabel( "File Actions" );
  33.288 +    QPopupMenu *menu = new QPopupMenu( this );
  33.289 +    menuBar()->insertItem( tr( "&File" ), menu );
  33.290 +
  33.291 +	// Keycodes:  /usr/lib64/qt3/include/qnamespace.h
  33.292 +
  33.293 +    QAction *a;
  33.294 +    a = new QAction( tr( "New map" ), QPixmap( filenew_xpm ), tr( "&New..." ), CTRL + Key_N, this, "fileNew" );
  33.295 +    connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
  33.296 +    a->addTo( tb );
  33.297 +    a->addTo( menu );
  33.298 +	
  33.299 +    a = new QAction( tr( "Open" ), QPixmap( fileopen_xpm), tr( "&Open..." ), CTRL + Key_O, this, "fileOpen" );
  33.300 +    connect( a, SIGNAL( activated() ), this, SLOT( fileLoad() ) );
  33.301 +    a->addTo( tb );
  33.302 +    a->addTo( menu );
  33.303 +	
  33.304 +	lastMapsMenu = new QPopupMenu (this);
  33.305 +
  33.306 +    menu->insertItem (tr("Open Recent"),lastMapsMenu );
  33.307 +    menu->insertSeparator();
  33.308 +	
  33.309 +    a = new QAction( tr( "Save" ), QPixmap( filesave_xpm ), tr( "&Save..." ), CTRL + Key_S, this, "fileSave" );
  33.310 +    connect( a, SIGNAL( activated() ), this, SLOT( fileSave() ) );
  33.311 +    a->addTo( tb );
  33.312 +    a->addTo( menu );
  33.313 +	actionFileSave=a;
  33.314 +	
  33.315 +    a = new QAction( tr( "Save &As" ), QPixmap(), tr( "Save &As..." ), 0, this, "fileSaveAs" );
  33.316 +    connect( a, SIGNAL( activated() ), this, SLOT( fileSaveAs() ) );
  33.317 +    a->addTo( menu );
  33.318 +
  33.319 +    menu->insertSeparator();
  33.320 +
  33.321 +    a = new QAction( tr( "Import directory structure (experimental)" ), QPixmap(), tr( "Import Dir" ), 0, this, "export" );
  33.322 +    connect( a, SIGNAL( activated() ), this, SLOT( fileImportDir() ) );
  33.323 +    a->addTo( menu );
  33.324 +
  33.325 +	exportMenu = new QPopupMenu (this);
  33.326 +    menu->insertItem (tr("Export"),exportMenu );
  33.327 +
  33.328 +    menu->insertSeparator();
  33.329 +
  33.330 +
  33.331 +    a = new QAction( tr( "Print" ), QPixmap( fileprint_xpm ), tr( "&Print..." ), CTRL + Key_P, this, "filePrint" );
  33.332 +    connect( a, SIGNAL( activated() ), this, SLOT( filePrint() ) );
  33.333 +    a->addTo( tb );
  33.334 +    a->addTo( menu );
  33.335 +	actionFilePrint=a;
  33.336 +
  33.337 +    a = new QAction( tr( "Close Map" ), QPixmap(), tr( "&Close Map" ), ALT + Key_C, this, "fileCloseMap" );
  33.338 +    connect( a, SIGNAL( activated() ), this, SLOT( fileCloseMap() ) );
  33.339 +    a->addTo( menu );
  33.340 +
  33.341 +    a = new QAction( tr( "Exit VYM" ), QPixmap(), tr( "E&xit VYM" ), CTRL + Key_Q, this, "fileExitVYM" );
  33.342 +    connect( a, SIGNAL( activated() ), this, SLOT( fileExitVYM() ) );
  33.343 +    a->addTo( menu );
  33.344 +}
  33.345 +
  33.346 +
  33.347 +//Edit Actions
  33.348 +void Main::setupEditActions()
  33.349 +{
  33.350 +    QToolBar *tb = new QToolBar( this );
  33.351 +    tb->setLabel( "Edit Actions" );
  33.352 +    QPopupMenu *menu = new QPopupMenu( this );
  33.353 +    menuBar()->insertItem( tr( "&Edit" ), menu );
  33.354 +
  33.355 +    QAction *a;
  33.356 +    a = new QAction( tr( "Undo" ), QPixmap( editundo_xpm ), tr( "&Undo" ), CTRL + Key_Z, this, "editUndo" );
  33.357 +    connect( a, SIGNAL( activated() ), this, SLOT( editUndo() ) );
  33.358 +	a->setEnabled (false);
  33.359 +    a->addTo( tb );
  33.360 +    a->addTo( menu );
  33.361 +	actionEditUndo=a;
  33.362 +    /*
  33.363 +    a = new QAction( tr( "Redo" ), QPixmap( editredo_xpm ), tr( "&Redo" ), CTRL + Key_Y, this, "editRedo" ); 
  33.364 +    connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) );
  33.365 +    a->addTo( tb );
  33.366 +    a->addTo( menu );
  33.367 +    */
  33.368 +    menu->insertSeparator();
  33.369 +    a = new QAction( tr( "Copy" ), QPixmap( editcopy_xpm ), tr( "&Copy" ), CTRL + Key_C, this, "editCopy" );
  33.370 +    connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
  33.371 +	a->setEnabled (false);
  33.372 +    a->addTo( tb );
  33.373 +    a->addTo( menu );
  33.374 +	actionEditCopy=a;
  33.375 +    a = new QAction( tr( "Cut" ), QPixmap( editcut_xpm ), tr( "Cu&t" ), CTRL + Key_X, this, "editCut" );
  33.376 +    connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
  33.377 +	a->setEnabled (false);
  33.378 +    a->addTo( tb );
  33.379 +    a->addTo( menu );
  33.380 +	actionEditCut=a;
  33.381 +    a = new QAction( tr( "Paste" ), QPixmap( editpaste_xpm ), tr( "&Paste" ), CTRL + Key_V, this, "editPaste" );
  33.382 +    connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) );
  33.383 +	a->setEnabled (false);
  33.384 +    a->addTo( tb );
  33.385 +    a->addTo( menu );
  33.386 +	actionEditPaste=a;
  33.387 +    a = new QAction( tr( "Move branch up" ), QPixmap( editmoveup_xpm ), tr( "Move up" ), Key_PageUp, this, "editMoveUp" );
  33.388 +    connect( a, SIGNAL( activated() ), this, SLOT( editMoveUp() ) );
  33.389 +	a->setEnabled (false);
  33.390 +    a->addTo( tb );
  33.391 +    a->addTo( menu );
  33.392 +	actionEditMoveUp=a;
  33.393 +    a = new QAction( tr( "Move branch down" ), QPixmap( editmovedown_xpm ), tr( "Move down" ), Key_PageDown, this, "editMoveDown" );
  33.394 +    connect( a, SIGNAL( activated() ), this, SLOT( editMoveDown() ) );
  33.395 +	a->setEnabled (false);
  33.396 +    a->addTo( tb );
  33.397 +    a->addTo( menu );
  33.398 +	actionEditMoveDown=a;
  33.399 +
  33.400 +    a = new QAction( tr( "Scroll branch" ), QPixmap(flag_scrolled_right_xpm), tr( "Scroll branch" ), Key_ScrollLock, this, "scroll" );
  33.401 +    connect( a, SIGNAL( activated() ), this, SLOT( editToggleScroll() ) );
  33.402 +	a->setEnabled (false);
  33.403 +    a->addTo( tb );
  33.404 +    a->addTo( menu );
  33.405 +	actionEditToggleScroll=a;
  33.406 +	
  33.407 +    a = new QAction( tr( "Unscroll all" ), QPixmap(), tr( "Unscroll all scrolled branches" ), 0, this, "scroll" );
  33.408 +    connect( a, SIGNAL( activated() ), this, SLOT( editUnScrollAll() ) );
  33.409 +    a->addTo( menu );
  33.410 +	
  33.411 +    menu->insertSeparator();
  33.412 +
  33.413 +	a = new QAction( tr( "Find" ), QPixmap(), tr( "Find" ), CTRL + Key_F, this, "find" );
  33.414 +    connect( a, SIGNAL( activated() ), this, SLOT( editOpenFindWindow() ) );
  33.415 +    a->addTo( menu );
  33.416 +    
  33.417 +	menu->insertSeparator();
  33.418 +
  33.419 +	a = new QAction( tr( "Open URL" ), QPixmap(flag_url_xpm), tr( "Open URL" ), CTRL + Key_U, this, "url" );
  33.420 +    connect( a, SIGNAL( activated() ), this, SLOT( editOpenURL() ) );
  33.421 +    a->addTo( menu );
  33.422 +    a->addTo( tb );
  33.423 +	a->setEnabled (false);
  33.424 +	actionEditOpenURL=a;
  33.425 +
  33.426 +	a = new QAction( tr( "Edit URL" ), QPixmap(), tr( "Edit URL" ), SHIFT + CTRL + Key_U, this, "url" );
  33.427 +    connect( a, SIGNAL( activated() ), this, SLOT( editURL() ) );
  33.428 +    a->addTo( menu );
  33.429 +	a->setEnabled (false);
  33.430 +	actionEditURL=a;
  33.431 +	
  33.432 +	a = new QAction( tr( "Use heading of selected branch as URL" ), QPixmap(), tr( "Use heading for URL" ), 0, this, "heading2url" );
  33.433 +    connect( a, SIGNAL( activated() ), this, SLOT( editHeading2URL() ) );
  33.434 +    a->addTo( menu );
  33.435 +	a->setEnabled (false);
  33.436 +	actionEditHeading2URL=a;
  33.437 +    
  33.438 +	a = new QAction( tr( "Create URL to Bugzilla" ), QPixmap(), tr( "Create URL to Bugzilla" ), 0, this, "bugzilla2url" );
  33.439 +    connect( a, SIGNAL( activated() ), this, SLOT( editBugzilla2URL() ) );
  33.440 +	a->setEnabled (false);
  33.441 +	actionEditBugzilla2URL=a;
  33.442 +    
  33.443 +	menu->insertSeparator();
  33.444 +	
  33.445 +    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" );
  33.446 +    connect( a, SIGNAL( activated() ), this, SLOT( editOpenVymLink() ) );
  33.447 +    a->addTo( menu );
  33.448 +    a->addTo( tb );
  33.449 +	a->setEnabled (false);
  33.450 +	actionEditOpenVymLink=a;
  33.451 +	
  33.452 +    a = new QAction( tr( "Edit link to another vym map" ), QPixmap(), tr( "Edit vym link" ), 0, this, "editLinkMap" );
  33.453 +    connect( a, SIGNAL( activated() ), this, SLOT( editVymLink() ) );
  33.454 +    a->addTo( menu );
  33.455 +	a->setEnabled (false);
  33.456 +	actionEditVymLink=a;
  33.457 +
  33.458 +    a = new QAction( tr( "Delete link to another vym map" ), QPixmap(), tr( "Delete vym link" ), 0, this, "deleteLinkMap" );
  33.459 +    connect( a, SIGNAL( activated() ), this, SLOT( editDeleteVymLink() ) );
  33.460 +    a->addTo( menu );
  33.461 +	a->setEnabled (false);
  33.462 +	actionEditDeleteVymLink=a;
  33.463 +
  33.464 +	menu->insertSeparator();
  33.465 +
  33.466 +    a = new QAction( tr( "Edit Map Info" ), QPixmap(), tr( "Edit Map Info" ), 0, this, "editMapInfo" );
  33.467 +    connect( a, SIGNAL( activated() ), this, SLOT( editMapInfo() ) );
  33.468 +    a->addTo( menu );
  33.469 +	a->setEnabled (true);
  33.470 +	actionEditMapInfo=a;
  33.471 +
  33.472 +	menu->insertSeparator();
  33.473 +
  33.474 +    // Shortcuts to modify heading:
  33.475 +    a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_Enter, this, "editHeading" );
  33.476 +    connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
  33.477 +	a->setEnabled (false);
  33.478 +    a->addTo ( menu );
  33.479 +	actionEditHeading=a;
  33.480 +    a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_Return, this, "editHeading" );
  33.481 +    connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
  33.482 +    //a->addTo ( menu );
  33.483 +    
  33.484 +    // Shortcut to delete selection
  33.485 +    a = new QAction( tr( "Delete Selection" ),tr( "Delete Selection" ), Key_Delete, this, "deleteBranch" );
  33.486 +    connect( a, SIGNAL( activated() ), this, SLOT( editDeleteSelection() ) );
  33.487 +	a->setEnabled (false);
  33.488 +    a->addTo ( menu );
  33.489 +	actionEditDelete=a;
  33.490 +    
  33.491 +    // Shortcut to add branch
  33.492 +	#if defined (Q_OS_MACX)
  33.493 +		a = new QAction( tr( "Add a branch as child of selection" ),tr( "Add branch as child" ), CTRL + Key_I, this, "newBranch" );
  33.494 +	#else
  33.495 +		a = new QAction( tr( "Add a branch as child of selection" ),tr( "Add branch as child" ), Key_Insert, this, "newBranch" );
  33.496 +	#endif
  33.497 +    connect( a, SIGNAL( activated() ), this, SLOT( editNewBranch() ) );
  33.498 +	a->setEnabled (false);
  33.499 +    a->addTo ( menu );
  33.500 +	actionEditAddBranch=a;
  33.501 +
  33.502 +	// Add branch above
  33.503 +    a = new QAction( tr( "Add a branch above selection" ),tr( "Add branch above" ), SHIFT+Key_Insert, this, "newBranch" );
  33.504 +    connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchAbove() ) );
  33.505 +	a->setEnabled (false);
  33.506 +    a->addTo ( menu );
  33.507 +	actionEditAddBranchAbove=a;
  33.508 +
  33.509 +	// Add branch below 
  33.510 +    a = new QAction( tr( "Add a branch below selection" ),tr( "Add branch below" ), CTRL +Key_Insert, this, "newBranch" );
  33.511 +    connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchBelow() ) );
  33.512 +	a->setEnabled (false);
  33.513 +    a->addTo ( menu );
  33.514 +	actionEditAddBranchBelow=a;
  33.515 +
  33.516 +	// Import at selection (adding to selection)
  33.517 +    a = new QAction( tr( "Add map at selection" ),tr( "Import (add)" ), 0, this, "importAdd" );
  33.518 +    connect( a, SIGNAL( activated() ), this, SLOT( editImportAdd() ) );
  33.519 +	a->setEnabled (false);
  33.520 +    a->addTo ( menu );
  33.521 +	actionEditImportAdd=a;
  33.522 +
  33.523 +	// Import at selection (replacing selection)
  33.524 +    a = new QAction( tr( "Replace selection with map" ),tr( "Import (replace)" ), 0, this, "importReplace" );
  33.525 +    connect( a, SIGNAL( activated() ), this, SLOT( editImportReplace() ) );
  33.526 +	a->setEnabled (false);
  33.527 +    a->addTo ( menu );
  33.528 +	actionEditImportReplace=a;
  33.529 +
  33.530 +	// Save selection 
  33.531 +    a = new QAction( tr( "Save selction" ),tr( "Save selection" ), 0, this, "saveSelection" );
  33.532 +    connect( a, SIGNAL( activated() ), this, SLOT( editSaveBranch() ) );
  33.533 +	a->setEnabled (false);
  33.534 +    a->addTo ( menu );
  33.535 +	actionEditSaveBranch=a;
  33.536 +
  33.537 +    // Shortcuts for navigating with cursor:
  33.538 +    a = new QAction( tr( "Select upper branch" ),tr( "Select upper branch" ), Key_Up, this, "upperBranch" );
  33.539 +    connect( a, SIGNAL( activated() ), this, SLOT( editUpperBranch() ) );
  33.540 +    a = new QAction( tr( "Select lower branch" ),tr( "Select lower branch" ), Key_Down, this, "lowerBranch" );
  33.541 +    connect( a, SIGNAL( activated() ), this, SLOT( editLowerBranch() ) );
  33.542 +    a = new QAction( tr( "Select left branch" ),tr( "Select left branch" ), Key_Left, this, "upperBranch" );
  33.543 +    connect( a, SIGNAL( activated() ), this, SLOT( editLeftBranch() ) );
  33.544 +    a = new QAction( tr( "Select right branch" ),tr( "Select child branch" ), Key_Right, this, "rightBranch" );
  33.545 +    connect( a, SIGNAL( activated() ), this, SLOT( editRightBranch() ) );
  33.546 +    a = new QAction( tr( "Select first branch" ),tr( "Select first branch" ), Key_Home, this, "firstBranch" );
  33.547 +	a->setEnabled (false);
  33.548 +    a->addTo ( menu );
  33.549 +	actionEditSelectFirst=a;
  33.550 +    connect( a, SIGNAL( activated() ), this, SLOT( editFirstBranch() ) );
  33.551 +    a = new QAction( tr( "Select last branch" ),tr( "Select last branch" ), Key_End, this, "lastBranch" );
  33.552 +    connect( a, SIGNAL( activated() ), this, SLOT( editLastBranch() ) );
  33.553 +	a->setEnabled (false);
  33.554 +    a->addTo ( menu );
  33.555 +	actionEditSelectLast=a;
  33.556 +
  33.557 +    a = new QAction( tr( "Add Image" ),tr( "Add Image" ), 0, this, "loadImage" );
  33.558 +    connect( a, SIGNAL( activated() ), this, SLOT( editLoadImage() ) );
  33.559 +	actionEditLoadImage=a;
  33.560 +}
  33.561 +
  33.562 +// Format Actions
  33.563 +void Main::setupFormatActions()
  33.564 +{
  33.565 +    QPopupMenu *menu = new QPopupMenu( this );
  33.566 +    menuBar()->insertItem( tr( "&Format" ), menu );
  33.567 +
  33.568 +    QToolBar *tb = new QToolBar( this );
  33.569 +    QAction *a;
  33.570 +    QPixmap pix( 16,16);
  33.571 +    pix.fill (black);
  33.572 +    actionFormatColor= new QAction( tr( "Set Color" ), pix, tr( "Set &Color" ), 0, this, "formatColor" );
  33.573 +    connect( actionFormatColor, SIGNAL( activated() ), this, SLOT( formatSelectColor() ) );
  33.574 +    actionFormatColor->addTo( tb );
  33.575 +    actionFormatColor->addTo( menu );
  33.576 +    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" );
  33.577 +    connect( a, SIGNAL( activated() ), this, SLOT( formatPickColor() ) );
  33.578 +	a->setEnabled (false);
  33.579 +    a->addTo( tb );
  33.580 +    a->addTo( menu );
  33.581 +	actionFormatPickColor=a;
  33.582 +    a= new QAction( tr( "Color branch" ), QPixmap(formatcoloritem_xpm), tr( "Color &branch" ), CTRL + Key_I, this, "colorItem" );
  33.583 +    connect( a, SIGNAL( activated() ), this, SLOT( formatColorItem() ) );
  33.584 +	a->setEnabled (false);
  33.585 +    a->addTo( tb );
  33.586 +    a->addTo( menu );
  33.587 +	actionFormatColorBranch=a;
  33.588 +    a= new QAction( tr( "Color Subtree" ), QPixmap(formatcolorbranch_xpm), tr( "Color sub&tree" ), CTRL + Key_T, this, "colorBranch" );
  33.589 +    connect( a, SIGNAL( activated() ), this, SLOT( formatColorBranch() ) );
  33.590 +	a->setEnabled (false);
  33.591 +    a->addTo( menu );
  33.592 +    a->addTo( tb );
  33.593 +	actionFormatColorSubtree=a;
  33.594 +
  33.595 +    menu->insertSeparator();
  33.596 +	actionGroupFormatLinkStyles=new QActionGroup ( this, "formatLinkStyles");
  33.597 +	actionGroupFormatLinkStyles->setExclusive (true);
  33.598 +    a= new QAction( tr( "Line" ), QPixmap(), tr( "Linkstyle Line" ), 0, actionGroupFormatLinkStyles, "formatLinkStyleLine" );
  33.599 +	a->setToggleAction(true);
  33.600 +    connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStyleLine() ) );
  33.601 +	actionFormatLinkStyleLine=a;
  33.602 +    a= new QAction( tr( "Line" ), QPixmap(), tr( "Linkstyle Parabel" ), 0, actionGroupFormatLinkStyles, "formatLinkStyleLine" );
  33.603 +	a->setToggleAction(true);
  33.604 +    connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStyleParabel() ) );
  33.605 +	actionFormatLinkStyleParabel=a;
  33.606 +    a= new QAction( tr( "PolyLine" ), QPixmap(), tr( "Linkstyle Thick Line" ), 0, actionGroupFormatLinkStyles, "formatLinkStyleLine" );
  33.607 +	a->setToggleAction(true);
  33.608 +    connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStylePolyLine() ) );
  33.609 +	actionFormatLinkStylePolyLine=a;
  33.610 +    a= new QAction( tr( "PolyParabel" ), QPixmap(), tr( "Linkstyle Thick Parabel" ), 0, actionGroupFormatLinkStyles, "formatLinkStylePolyParabel" );
  33.611 +	a->setToggleAction(true);
  33.612 +    connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStylePolyParabel() ) );
  33.613 +	actionFormatLinkStylePolyParabel=a;
  33.614 +	actionGroupFormatLinkStyles->addTo (menu);
  33.615 +	
  33.616 +	actionGroupFormatFrameTypes=new QActionGroup ( this, "formatFrameTypes");
  33.617 +	actionGroupFormatFrameTypes->setExclusive (true);
  33.618 +    a = new QAction( tr( "No Frame" ),tr( "No Frame" ), 0, actionGroupFormatFrameTypes, "frameNone" );
  33.619 +	a->setToggleAction(true);
  33.620 +    connect( a, SIGNAL( activated() ), this, SLOT( formatFrameNone() ) );
  33.621 +	actionFormatFrameNone=a;
  33.622 +    a = new QAction( tr( "Rectangle" ),tr( "Rectangle" ), 0, actionGroupFormatFrameTypes, "frameRectangle" );
  33.623 +	a->setToggleAction(true);
  33.624 +    connect( a, SIGNAL( activated() ), this, SLOT( formatFrameRectangle() ) );
  33.625 +	actionFormatFrameRectangle=a;
  33.626 +
  33.627 +    menu->insertSeparator();
  33.628 +    a= new QAction( tr( "Use same color for links and headings" ), QPixmap(), tr( "&Use color of heading for link" ), 0, this, "formatLinkColorHint" );
  33.629 +	a->setToggleAction(true);
  33.630 +    connect( a, SIGNAL( activated() ), this, SLOT( formatToggleLinkColorHint() ) );
  33.631 +	a->addTo( menu );
  33.632 +	actionFormatLinkColorHint=a;
  33.633 +    pix.fill (white);
  33.634 +    actionFormatLinkColor= new QAction( tr( "Set Link Color" ), pix, tr( "Set &Link Color" ), 0, this, "formatLinkColor" );
  33.635 +    connect( actionFormatLinkColor, SIGNAL( activated() ), this, SLOT( formatSelectLinkColor() ) );
  33.636 +    actionFormatLinkColor->addTo( menu );
  33.637 +    actionFormatBackColor= new QAction( tr( "Set Background Color" ), pix, tr( "Set &Background Color" ), 0, this, "formatBackColor" );
  33.638 +    connect( actionFormatBackColor, SIGNAL( activated() ), this, SLOT( formatSelectBackColor() ) );
  33.639 +    actionFormatBackColor->addTo( menu );
  33.640 +}
  33.641 +
  33.642 +// View Actions
  33.643 +void Main::setupViewActions()
  33.644 +{
  33.645 +    QToolBar *tb = new QToolBar( this );
  33.646 +    tb->setLabel( "View Actions" );
  33.647 +    QPopupMenu *menu = new QPopupMenu( this );
  33.648 +    menuBar()->insertItem( tr( "&View" ), menu );
  33.649 +
  33.650 +    QAction *a;
  33.651 +    a = new QAction( tr( "Zoom reset" ), QPixmap(viewzoomreset_xpm), tr( "reset Zoom" ), 0, this, "zoomReset" );
  33.652 +    connect( a, SIGNAL( activated() ), this, SLOT(viewZoomReset() ) );
  33.653 +    a->addTo( tb );
  33.654 +    a->addTo( menu );
  33.655 +    a = new QAction( tr( "Zoom in" ), QPixmap(viewzoomin_xpm), tr( "Zoom in" ), CTRL + Key_Plus, this, "zoomIn" );
  33.656 +    connect( a, SIGNAL( activated() ), this, SLOT(viewZoomIn() ) );
  33.657 +    a->addTo( tb );
  33.658 +    a->addTo( menu );
  33.659 +    a = new QAction( tr( "Zoom out" ), QPixmap(viewzoomout_xpm), tr( "Zoom out" ), CTRL + Key_Minus, this, "zoomOut" );
  33.660 +    connect( a, SIGNAL( activated() ), this, SLOT( viewZoomOut() ) );
  33.661 +    a->addTo( tb );
  33.662 +    a->addTo( menu );
  33.663 +    a = new QAction( tr( "Toggle Note Editor" ), QPixmap(flag_note_xpm), tr( "Toggle Note Editor" ), CTRL + Key_E , this, "noteEditor" );
  33.664 +    connect( a, SIGNAL( activated() ), this, SLOT(windowToggleNoteEditor() ) );
  33.665 +	a->setToggleAction(true);
  33.666 +	if (textEditor->showWithMain())
  33.667 +		a->setOn(true);
  33.668 +	else	
  33.669 +		a->setOn(false);
  33.670 +    a->addTo( tb );
  33.671 +    a->addTo( menu );
  33.672 +	actionViewToggleNoteEditor=a;
  33.673 +    a = new QAction( tr( "&Next Window" ), QPixmap(), tr( "Next Window" ), ALT + Key_N , this, "nextWindow" );
  33.674 +    connect( a, SIGNAL( activated() ), this, SLOT(windowNextEditor() ) );
  33.675 +    a->addTo( menu );
  33.676 +    a = new QAction( tr( "&Previous Window" ), QPixmap(), tr( "Previous Window" ), ALT + Key_P , this, "previousWindow" );
  33.677 +    connect( a, SIGNAL( activated() ), this, SLOT(windowPreviousEditor() ) );
  33.678 +    a->addTo( menu );
  33.679 +}
  33.680 +
  33.681 +// Flag Actions
  33.682 +void Main::setupFlagActions()
  33.683 +{
  33.684 +	standardFlagsDefault->makeToolbar(this, "Standard Flags");
  33.685 +}
  33.686 +
  33.687 +// Settings Actions
  33.688 +void Main::setupSettingsActions()
  33.689 +{
  33.690 +    QPopupMenu *menu = new QPopupMenu( this );
  33.691 +    menuBar()->insertItem( tr( "&Settings" ), menu );
  33.692 +
  33.693 +	QAction *a;
  33.694 +
  33.695 +
  33.696 +    a = new QAction( tr( "Set application to open pdf files" ), QPixmap(), tr( "Set application to open pdf files" ), 0, this, "setPDF" );
  33.697 +    connect( a, SIGNAL( activated() ), this, SLOT( settingsPDF() ) );
  33.698 +    a->addTo( menu );
  33.699 +
  33.700 +    a = new QAction( tr( "Set application to open an URL" ), QPixmap(), tr( "Set application to open an URL" ), 0, this, "setURL" );
  33.701 +    connect( a, SIGNAL( activated() ), this, SLOT( settingsURL() ) );
  33.702 +    a->addTo( menu );
  33.703 +
  33.704 +    menu->insertSeparator();
  33.705 +    a = new QAction( tr( "Edit branch after adding it" ), QPixmap(), tr( "Edit branch after adding it" ), 0, this, "autoedit" );
  33.706 +	a->setToggleAction(true);
  33.707 +	a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/autoedit",true) );
  33.708 +    a->addTo( menu );
  33.709 +	actionSettingsAutoedit=a;
  33.710 +
  33.711 +    a= new QAction( tr( "Select branch after adding it" ), QPixmap(), tr( "Select branch after adding it" ), 0, this, "autoselectheading" );
  33.712 +	a->setToggleAction(true);
  33.713 +	a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/autoselect",false) );
  33.714 +    a->addTo( menu );
  33.715 +	actionSettingsAutoselectHeading=a;
  33.716 +	
  33.717 +    a= new QAction( tr( "Select heading before editing" ), QPixmap(), tr( "Select existing heading" ), 0, this, "autoselectexistingtext" );
  33.718 +	a->setToggleAction(true);
  33.719 +	a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/autoselectexistingtext",true) );
  33.720 +    a->addTo( menu );
  33.721 +	actionSettingsAutoselectText=a;
  33.722 +	
  33.723 +    a= new QAction( tr( "Enable pasting into new branch" ), QPixmap(), tr( "Enable pasting into new branch" ), 0, this, "pastenewheading" );
  33.724 +	a->setToggleAction(true);
  33.725 +	a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/newheadingisempty",true) );
  33.726 +    a->addTo( menu );
  33.727 +	actionSettingsPasteNewHeading=a;
  33.728 +	
  33.729 +    a= new QAction( tr( "Enable Delete key for deleting branches" ), QPixmap(), tr( "Enable Delete key" ), 0, this, "delkey" );
  33.730 +	a->setToggleAction(true);
  33.731 +	a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/useDelKey",false) );
  33.732 +    a->addTo( menu );
  33.733 +	actionSettingsUseDelKey=a;
  33.734 +}
  33.735 +
  33.736 +// Test Actions
  33.737 +void Main::setupTestActions()
  33.738 +{
  33.739 +    QPopupMenu *menu = new QPopupMenu( this );
  33.740 +    menuBar()->insertItem( tr( "&Test" ), menu );
  33.741 +
  33.742 +    QAction *a;
  33.743 +    a = new QAction( tr( "Test Flag" ), QPixmap(), tr( "test flag" ), 0, this, "flag" );
  33.744 +    connect( a, SIGNAL( activated() ), this, SLOT( testFunction() ) );
  33.745 +    a->addTo( menu );
  33.746 +
  33.747 +	a = new QAction( tr( "Show Clipboard" ), QPixmap(), tr( "Show clipboard" ), 0, this, "clipboard" );
  33.748 +    connect( a, SIGNAL( activated() ), this, SLOT( testShowClipboard() ) );
  33.749 +    a->addTo( menu );
  33.750 +}
  33.751 +
  33.752 +// Help Actions
  33.753 +void Main::setupHelpActions()
  33.754 +{
  33.755 +    QPopupMenu *menu = new QPopupMenu( this );
  33.756 +    menuBar()->insertItem( tr( "&Help" ), menu );
  33.757 +
  33.758 +    QAction *a;
  33.759 +    a = new QAction( tr( "Open VYM Documentation (pdf)" ), QPixmap(), tr( "Open VYM Documentation (pdf) " ), 0, this, "about" );
  33.760 +    connect( a, SIGNAL( activated() ), this, SLOT( helpDoc() ) );
  33.761 +    a->addTo( menu );
  33.762 +
  33.763 +    a = new QAction( tr( "Information about VYM" ), QPixmap(), tr( "About VYM" ), 0, this, "about" );
  33.764 +    connect( a, SIGNAL( activated() ), this, SLOT( helpAbout() ) );
  33.765 +    a->addTo( menu );
  33.766 +
  33.767 +    a = new QAction( tr( "Information about QT toolkit" ), QPixmap(), tr( "About QT" ), 0, this, "about" );
  33.768 +    connect( a, SIGNAL( activated() ), this, SLOT( helpAboutQT() ) );
  33.769 +    a->addTo( menu );
  33.770 +}
  33.771 +
  33.772 +// Context Menus
  33.773 +void Main::setupContextMenus()
  33.774 +{
  33.775 +	QAction*a;
  33.776 +
  33.777 +	// Context Menu for branch or mapcenter
  33.778 +	branchContextMenu =new QPopupMenu (this);
  33.779 +	actionEditAddBranch->addTo ( branchContextMenu );
  33.780 +	actionEditAddBranchAbove->addTo ( branchContextMenu );
  33.781 +	actionEditAddBranchBelow->addTo ( branchContextMenu );
  33.782 +	actionEditSaveBranch->addTo( branchContextMenu );
  33.783 +	branchContextMenu->insertSeparator();	
  33.784 +	actionEditImportAdd->addTo ( branchContextMenu );
  33.785 +	actionEditImportReplace->addTo ( branchContextMenu );
  33.786 +	branchContextMenu->insertSeparator();	
  33.787 +	actionEditOpenURL->addTo ( branchContextMenu );
  33.788 +	actionEditURL->addTo ( branchContextMenu );
  33.789 +	actionEditHeading2URL->addTo ( branchContextMenu );
  33.790 +    if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) 
  33.791 +		actionEditBugzilla2URL->addTo( branchContextMenu );
  33.792 +	branchContextMenu->insertSeparator();	
  33.793 +	actionEditOpenVymLink->addTo ( branchContextMenu );
  33.794 +	actionEditVymLink->addTo ( branchContextMenu );
  33.795 +	actionEditDeleteVymLink->addTo ( branchContextMenu );
  33.796 +	branchContextMenu->insertSeparator();	
  33.797 +	actionEditLoadImage->addTo( branchContextMenu );
  33.798 +	branchContextMenu->insertSeparator();	
  33.799 +	actionEditCopy->addTo( branchContextMenu );
  33.800 +	actionEditCut->addTo( branchContextMenu );
  33.801 +	actionEditPaste->addTo( branchContextMenu );
  33.802 +	branchContextMenu->insertSeparator();	
  33.803 +	actionGroupFormatFrameTypes->addTo( branchContextMenu );
  33.804 +
  33.805 +	// Context menu for floatimage
  33.806 +	floatimageContextMenu =new QPopupMenu (this);
  33.807 +	saveImageFormatMenu=new QPopupMenu (this);
  33.808 +	exportImageFormatMenu=new QPopupMenu (this);
  33.809 +
  33.810 +	QStrList fmt = QImage::outputFormats();
  33.811 +	for (const char* f = fmt.first(); f; f = fmt.next()) 
  33.812 +	{
  33.813 +		saveImageFormatMenu->insertItem( f );
  33.814 +		exportImageFormatMenu->insertItem( f );
  33.815 +	}	
  33.816 +	connect( saveImageFormatMenu, SIGNAL( activated(int) ), this, SLOT( editSaveImage(int ) ) );
  33.817 +	connect( exportImageFormatMenu, SIGNAL( activated(int) ), this, SLOT( fileExportImage(int ) ) );
  33.818 +	floatimageContextMenu->insertItem( tr("Save image"),saveImageFormatMenu );
  33.819 +	
  33.820 +	floatimageContextMenu->insertSeparator();	
  33.821 +	actionEditCopy->addTo( floatimageContextMenu );
  33.822 +	actionEditCut->addTo( floatimageContextMenu );
  33.823 +
  33.824 +	floatimageContextMenu->insertSeparator();	
  33.825 +    a = new QAction( tr( "Use for Export" ), QPixmap(), tr( "Use for Export"), 0, this, "useForExport" );
  33.826 +	a->setToggleAction(true);
  33.827 +    connect( a, SIGNAL( activated() ), this, SLOT( editToggleFloatExport() ) );
  33.828 +    a->addTo( floatimageContextMenu);
  33.829 +	actionEditToggleFloatExport=a;
  33.830 +
  33.831 +
  33.832 +
  33.833 +	// Context menu for exports
  33.834 +	exportMenu->insertItem ( tr("Export map as image"),exportImageFormatMenu);
  33.835 +
  33.836 +    a = new QAction( tr( "Export as ASCII (still experimental)" ), QPixmap(), tr( "Export (ASCII)" ), 0, this, "exportASCII" );
  33.837 +    connect( a, SIGNAL( activated() ), this, SLOT( fileExportASCII() ) );
  33.838 +    a->addTo( exportMenu );
  33.839 +
  33.840 +	a = new QAction( tr( "Export XML" ), QPixmap(), tr( "Export XML" ),  0, this, "exportXML" );
  33.841 +    connect( a, SIGNAL( activated() ), this, SLOT( fileExportXML() ) );
  33.842 +    a->addTo( exportMenu );
  33.843 +	
  33.844 +    if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) 
  33.845 +	{
  33.846 +		a = new QAction( tr( "Export HTML" ), QPixmap(), tr( "Export HTML" ), 0, this, "exportHTML" );
  33.847 +		connect( a, SIGNAL( activated() ), this, SLOT( fileExportHTML() ) );
  33.848 +		a->addTo( exportMenu );
  33.849 +	}
  33.850 +
  33.851 +	a = new QAction( tr( "Export XHTML" ), QPixmap(), tr( "Export XHTML" ), ALT + Key_X, this, "exportXHTML" );
  33.852 +    connect( a, SIGNAL( activated() ), this, SLOT( fileExportXHTML() ) );
  33.853 +    a->addTo( exportMenu );
  33.854 +
  33.855 +	
  33.856 +	// Context menu for canvas
  33.857 +	canvasContextMenu =new QPopupMenu (this);
  33.858 +	actionEditMapInfo->addTo( canvasContextMenu );
  33.859 +	canvasContextMenu->insertSeparator();	
  33.860 +	actionGroupFormatLinkStyles->addTo( canvasContextMenu );
  33.861 +	canvasContextMenu->insertSeparator();	
  33.862 +	actionFormatLinkColorHint->addTo( canvasContextMenu );
  33.863 +	actionFormatLinkColor->addTo( canvasContextMenu );
  33.864 +	actionFormatBackColor->addTo( canvasContextMenu );
  33.865 +
  33.866 +	// Menu for last opened files
  33.867 +	// Read settings initially
  33.868 +	QString s;
  33.869 +	int j=settings.readNumEntry( "/vym/lastMaps/number",0);
  33.870 +	for (int i=1;i<=j;i++)
  33.871 +	{
  33.872 +		s=settings.readEntry(QString("/vym/lastMaps/map-%1").arg(i),"");
  33.873 +		if (!s.isEmpty() && j<=maxLastMaps) 
  33.874 +			lastMaps.append(s);
  33.875 +	}
  33.876 +	setupLastMapsMenu();
  33.877 +	connect( lastMapsMenu, SIGNAL( activated(int) ), this, SLOT( fileLoadLast(int ) ) );
  33.878 +}
  33.879 +
  33.880 +void Main::setupLastMapsMenu()
  33.881 +{
  33.882 +	// Remove double entries
  33.883 +	QStringList::Iterator it=lastMaps.begin();
  33.884 +	QStringList::Iterator jt;
  33.885 +	while (it!=lastMaps.end() )
  33.886 +	{
  33.887 +		jt=it;
  33.888 +		++jt;
  33.889 +		while (jt!=lastMaps.end() )
  33.890 +		{
  33.891 +			if (*it == *jt)		
  33.892 +				jt=lastMaps.remove(jt);
  33.893 +			else	
  33.894 +				jt++;
  33.895 +		}
  33.896 +		it++;
  33.897 +	}	
  33.898 +
  33.899 +	// Limit length of list to maxLastMaps
  33.900 +	while ((int)(lastMaps.count()) > maxLastMaps) lastMaps.pop_back();
  33.901 +	
  33.902 +	// build Menu from lastMaps string list
  33.903 +	lastMapsMenu->clear();
  33.904 +	for (it = lastMaps.begin(); it != lastMaps.end(); ++it ) 
  33.905 +		lastMapsMenu->insertItem (*it );
  33.906 +		
  33.907 +}
  33.908 +
  33.909 +void Main::hideEvent (QHideEvent * )
  33.910 +{
  33.911 +	if (!textEditor->isMinimized() ) textEditor->hide();
  33.912 +}
  33.913 +
  33.914 +void Main::showEvent (QShowEvent * )
  33.915 +{
  33.916 +	if (textEditor->showWithMain()) textEditor->show();
  33.917 +}
  33.918 +
  33.919 +bool Main::reallyWriteDirectory(const QString &dir)
  33.920 +{
  33.921 +	QStringList eList = QDir(dir).entryList();
  33.922 +	if (eList.first() ==".")  eList.pop_front();	// remove "."
  33.923 +	if (eList.first() =="..") eList.pop_front();	// remove "."
  33.924 +	if (!eList.isEmpty())
  33.925 +	{
  33.926 +		QMessageBox mb( "VYM",
  33.927 +			tr("The directory ") + dir + 
  33.928 +			tr(" is not empty. Do you risk to overwrite its contents?"),
  33.929 +		QMessageBox::Warning,
  33.930 +		QMessageBox::Yes ,
  33.931 +		QMessageBox::Cancel | QMessageBox::Default,
  33.932 +		QMessageBox::QMessageBox::NoButton );
  33.933 +
  33.934 +		mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
  33.935 +		mb.setButtonText( QMessageBox::No, tr("Cancel"));
  33.936 +		switch( mb.exec() ) 
  33.937 +		{
  33.938 +			case QMessageBox::Yes:
  33.939 +				// save 
  33.940 +				return true;
  33.941 +			case QMessageBox::Cancel:
  33.942 +				// do nothing
  33.943 +				return false;
  33.944 +		}
  33.945 +	}
  33.946 +	return true;
  33.947 +}
  33.948 +
  33.949 +QString Main::browseDirectory (const QString &caption)
  33.950 +{
  33.951 +	QFileDialog fd(this,caption);
  33.952 +	fd.setMode (QFileDialog::DirectoryOnly);
  33.953 +	fd.setCaption("VYM - "+caption);
  33.954 +	fd.show();
  33.955 +	
  33.956 +	if ( fd.exec() == QDialog::Accepted )
  33.957 +		return fd.selectedFile();
  33.958 +	else
  33.959 +		return "";
  33.960 +}
  33.961 +
  33.962 +MapEditor* Main::currentMapEditor() const
  33.963 +{
  33.964 +    if ( tabWidget->currentPage() &&
  33.965 +	 tabWidget->currentPage()->inherits( "MapEditor" ) )
  33.966 +		return (MapEditor*)tabWidget->currentPage();
  33.967 +    return NULL;	
  33.968 +}
  33.969 +
  33.970 +//TODO not used now, maybe use this for overview window later
  33.971 +void Main::newView() 
  33.972 +{
  33.973 +    // Open a new view... have it delete when closed.
  33.974 +    Main *m = new Main(0, 0, WDestructiveClose);
  33.975 +    qApp->setMainWidget(m);
  33.976 +    m->show();
  33.977 +    qApp->setMainWidget(0);
  33.978 +}
  33.979 +
  33.980 +void Main::editorChanged(QWidget *)
  33.981 +{
  33.982 +	// Unselect all possibly selected objects
  33.983 +	// (Important to update note editor)
  33.984 +	int i;
  33.985 +	MapEditor *me;
  33.986 +	for (i=0;i<=tabWidget->count() -1;i++)
  33.987 +	{
  33.988 +		
  33.989 +		me=(MapEditor*)tabWidget->page(i);
  33.990 +		me->unselect();
  33.991 +	}	
  33.992 +	currentMapEditor()->reselect();
  33.993 +
  33.994 +	// Update actions to in menus and toolbars according to editor
  33.995 +	currentMapEditor()->updateActions();
  33.996 +}
  33.997 +
  33.998 +void Main::fileNew()
  33.999 +{
 33.1000 +	QString fn="unnamed";
 33.1001 +	MapEditor* medit = new MapEditor (tabWidget, true);
 33.1002 +	tabWidget->addTab (medit,fn);
 33.1003 +	tabWidget->showPage(medit);
 33.1004 +	medit->viewport()->setFocus();
 33.1005 +	medit->select("mc:");
 33.1006 +}
 33.1007 +
 33.1008 +void Main::fileLoad(QString fn, const LoadMode &lmode)
 33.1009 +{
 33.1010 +	// Error codes
 33.1011 +	enum errorCode {success,aborted};
 33.1012 +	errorCode err=success;
 33.1013 +	
 33.1014 +	// fn is usually the archive, mapfile the file after uncompressing
 33.1015 +	QString mapfile;
 33.1016 +
 33.1017 +	// Make fn absolute (needed for unzip)
 33.1018 +	fn=QDir (fn).absPath();
 33.1019 +
 33.1020 +	MapEditor *me;
 33.1021 +
 33.1022 +	if (lmode==NewMap)
 33.1023 +	{
 33.1024 +		// Check, if map is already loaded
 33.1025 +		int i=0;
 33.1026 +		while (i<=tabWidget->count() -1)
 33.1027 +		{
 33.1028 +			me=(MapEditor*)tabWidget->page(i);
 33.1029 +			if (me->getFilePath() == fn)
 33.1030 +			{
 33.1031 +				// Already there, ask for confirmation
 33.1032 +				QMessageBox mb( "VYM",
 33.1033 +					tr("The map ") + fn + tr ("\n is already opened."
 33.1034 +					"Opening the same map in multiple editors may lead \n"
 33.1035 +					"to confusion when finishing working with vym."
 33.1036 +					"Do you want to"),
 33.1037 +					QMessageBox::Warning,
 33.1038 +					QMessageBox::Yes | QMessageBox::Default,
 33.1039 +					QMessageBox::Cancel | QMessageBox::Escape,
 33.1040 +					QMessageBox::QMessageBox::NoButton);
 33.1041 +				mb.setButtonText( QMessageBox::Yes, tr("Open anyway") );
 33.1042 +				mb.setButtonText( QMessageBox::Cancel, tr("Cancel"));
 33.1043 +				switch( mb.exec() ) 
 33.1044 +				{
 33.1045 +					case QMessageBox::Yes:
 33.1046 +						// load anyway
 33.1047 +						i=tabWidget->count();
 33.1048 +						break;
 33.1049 +					case QMessageBox::Cancel:
 33.1050 +						// do nothing
 33.1051 +						return;
 33.1052 +						break;
 33.1053 +				}
 33.1054 +			}
 33.1055 +			i++;
 33.1056 +		}
 33.1057 +	}
 33.1058 +
 33.1059 +
 33.1060 +	// Try to load map
 33.1061 +    if ( !fn.isEmpty() )
 33.1062 +	{
 33.1063 +		me = currentMapEditor();
 33.1064 +		int tabIndex=tabWidget->currentPageIndex();
 33.1065 +		// Check first, if mapeditor exists
 33.1066 +		// If it is not default AND we want a new map, 
 33.1067 +		// create a new mapeditor in a new tab
 33.1068 +		if ( lmode==NewMap && (!me || !me->isDefault() ) )
 33.1069 +		{
 33.1070 +			me = new MapEditor (tabWidget,true);
 33.1071 +			tabWidget->addTab (me,fn);
 33.1072 +			tabIndex=tabWidget->indexOf (me);
 33.1073 +			tabWidget->setCurrentPage (tabIndex);
 33.1074 +		}
 33.1075 +		
 33.1076 +		// Check, if file exists (important for creating new files
 33.1077 +		// from command line
 33.1078 +		if (!QFile(fn).exists() )
 33.1079 +		{
 33.1080 +			QMessageBox mb( "VYM",
 33.1081 +				tr("The map") + fn + 
 33.1082 +				tr(" does not exist.\n Do you want to create a new one?"),
 33.1083 +				QMessageBox::Question,
 33.1084 +				QMessageBox::Yes ,
 33.1085 +				QMessageBox::Cancel | QMessageBox::Default,
 33.1086 +				QMessageBox::QMessageBox::NoButton );
 33.1087 +
 33.1088 +			mb.setButtonText( QMessageBox::Yes, tr("Create"));
 33.1089 +			mb.setButtonText( QMessageBox::No, tr("Cancel"));
 33.1090 +			switch( mb.exec() ) 
 33.1091 +			{
 33.1092 +				case QMessageBox::Yes:
 33.1093 +					// Create new map
 33.1094 +					currentMapEditor()->setFilePath(fn);
 33.1095 +					tabWidget->setTabLabel (currentMapEditor(),
 33.1096 +						currentMapEditor()->getFileName() );
 33.1097 +					statusBar()->message( "Created " + fn , statusbarTime );
 33.1098 +					return;
 33.1099 +						
 33.1100 +				case QMessageBox::Cancel:
 33.1101 +					// don't create new map
 33.1102 +					statusBar()->message( "Loading " + fn + " failed!", statusbarTime );
 33.1103 +					fileCloseMap();
 33.1104 +					return;
 33.1105 +			}
 33.1106 +		}	
 33.1107 +
 33.1108 +
 33.1109 +		//tabWidget->currentPage() won't be NULL here, because of above...
 33.1110 +		tabWidget->showPage(me);
 33.1111 +		me->viewport()->setFocus();
 33.1112 +
 33.1113 +		// Create temporary directory for packing
 33.1114 +		char tmpdir1[]="/tmp/vym-XXXXXX";	
 33.1115 +		QString tmpMapDir=mkdtemp(tmpdir1);
 33.1116 +
 33.1117 +		// Try to unzip file
 33.1118 +		Process *zipProc=new Process ();
 33.1119 +		zipProc->clearArguments();
 33.1120 +		zipProc->setWorkingDirectory (QDir(tmpMapDir));
 33.1121 +		zipProc->addArgument ("unzip");
 33.1122 +		zipProc->addArgument (fn );
 33.1123 +		zipProc->addArgument ("-d");
 33.1124 +		zipProc->addArgument (tmpMapDir);
 33.1125 +
 33.1126 +		if (!zipProc->start() )
 33.1127 +		{
 33.1128 +			QMessageBox::critical( 0, tr( "Critical Load Error" ),
 33.1129 +						   tr("Couldn't start unzip to decompress data."));
 33.1130 +			err=aborted;
 33.1131 +			
 33.1132 +		} else
 33.1133 +		{
 33.1134 +			zipProc->waitFinished();
 33.1135 +			if (!zipProc->normalExit() )
 33.1136 +			{
 33.1137 +				QMessageBox::critical( 0, tr( "Critical Load Error" ),
 33.1138 +							   tr("unzip didn't exit normally") +
 33.1139 +							   zipProc->getErrout() );
 33.1140 +				err=aborted;
 33.1141 +			} else
 33.1142 +			{
 33.1143 +				if (zipProc->exitStatus()>0)
 33.1144 +				{
 33.1145 +					if (zipProc->exitStatus()==9)
 33.1146 +					{
 33.1147 +						// no zipped file, but maybe .xml or old version? Try again.
 33.1148 +						mapfile=fn;
 33.1149 +						me->setZipped(false);
 33.1150 +					}	
 33.1151 +					else	
 33.1152 +					{
 33.1153 +						QMessageBox::critical( 0, tr( "Critical Load Error" ),
 33.1154 +									   QString("unzip exit code:  %1").arg(zipProc->exitStatus() ) +
 33.1155 +									   zipProc->getErrout() );
 33.1156 +						err=aborted;
 33.1157 +					}
 33.1158 +				} else
 33.1159 +				{	// Uncompressing was successfull,
 33.1160 +					// load from uncompressed temporary directory
 33.1161 +
 33.1162 +					me->setZipped(true);
 33.1163 +
 33.1164 +					
 33.1165 +					// Look for mapname.xml
 33.1166 +					mapfile= fn.left(fn.findRev(".",-1,true));
 33.1167 +					mapfile=mapfile.section( '/', -1 );
 33.1168 +					QFile file( tmpMapDir + "/" + mapfile + ".xml");
 33.1169 +					if (!file.exists() )
 33.1170 +					{
 33.1171 +						// mapname.xml does not exist, well, 
 33.1172 +						// maybe some renamed the mapname.vym file...
 33.1173 +						// Try to find any .xml in the toplevel 
 33.1174 +						// directory of the .vym file
 33.1175 +						QStringList flist=QDir (tmpMapDir).entryList("*.xml");
 33.1176 +						if (flist.count()==1) 
 33.1177 +						{
 33.1178 +							// Only one entry, take this one
 33.1179 +							mapfile=tmpMapDir + "/"+flist.first();
 33.1180 +						} else
 33.1181 +						{
 33.1182 +							for ( QStringList::Iterator it = flist.begin(); it != flist.end(); ++it ) 
 33.1183 +								*it=tmpMapDir + "/" + *it;
 33.1184 +							// FIXME	
 33.1185 +							// Multiple entries, load all (but only the first one into this ME)
 33.1186 +							//mainWindow->fileLoadFromTmp (flist);
 33.1187 +							//returnCode=1;	// Silently forget this attempt to load
 33.1188 +							qWarning ("MainWindow::load (fn)  multimap found...");
 33.1189 +						}	
 33.1190 +							
 33.1191 +						if (flist.isEmpty() )
 33.1192 +						{
 33.1193 +							QMessageBox::critical( 0, tr( "Critical Load Error" ),
 33.1194 +									   tr("Couldn't find a map (*.xml) in .vym archive.\n"));
 33.1195 +							err=aborted;				   
 33.1196 +						}	
 33.1197 +					} //file doesn't exist	
 33.1198 +					else
 33.1199 +						mapfile=file.name();
 33.1200 +				} // Uncompressing successfull
 33.1201 +			}
 33.1202 +		}
 33.1203 +
 33.1204 +		// Finally load map into mapEditor
 33.1205 +		me->setFilePath (mapfile,fn);
 33.1206 +		if (me->load(mapfile,lmode))
 33.1207 +			err=aborted;
 33.1208 +
 33.1209 +		// Delete tmpDir
 33.1210 +		system ( "rm -rf "+tmpMapDir);
 33.1211 +
 33.1212 +		// Check for errors
 33.1213 +		if (err==success) 
 33.1214 +		{
 33.1215 +			if (lmode==NewMap)
 33.1216 +			{
 33.1217 +				me->setFilePath (fn);
 33.1218 +				tabWidget->changeTab(tabWidget->page(tabIndex), me->getFileName());
 33.1219 +				lastMaps.prepend(me->getFilePath() );
 33.1220 +				setupLastMapsMenu();
 33.1221 +				actionFilePrint->setEnabled (true);
 33.1222 +			}	
 33.1223 +			statusBar()->message( "Loaded " + fn, statusbarTime );
 33.1224 +			return;
 33.1225 +		} else 
 33.1226 +		{
 33.1227 +			if (lmode==NewMap)
 33.1228 +				fileCloseMap();
 33.1229 +		}	
 33.1230 +
 33.1231 +
 33.1232 +	}
 33.1233 +	statusBar()->message( "Could not load " + fn, statusbarTime );
 33.1234 +}
 33.1235 +
 33.1236 +
 33.1237 +void Main::fileLoad(const LoadMode &lmode)
 33.1238 +{
 33.1239 +	QFileDialog *fd=new QFileDialog( this);
 33.1240 +	if (!lastFileDir.isEmpty()) 
 33.1241 +		fd->setDir (lastFileDir);
 33.1242 +	fd->addFilter ("XML (*.xml)");
 33.1243 +	fd->addFilter ("VYM map (*.vym *.vyp)");
 33.1244 +	switch (lmode)
 33.1245 +	{
 33.1246 +		case NewMap:
 33.1247 +			fd->setCaption(tr("Load vym map"));
 33.1248 +			break;
 33.1249 +		case ImportAdd:
 33.1250 +			fd->setCaption(tr("Import: Add vym map to selection"));
 33.1251 +			break;
 33.1252 +		case ImportReplace:
 33.1253 +			fd->setCaption(tr("Import: Replace selection with vym map"));
 33.1254 +			break;
 33.1255 +	}
 33.1256 +	fd->show();
 33.1257 +
 33.1258 +	QString fn;
 33.1259 +	if ( fd->exec() == QDialog::Accepted )
 33.1260 +	{
 33.1261 +		lastFileDir=fd->dirPath();
 33.1262 +        fn = fd->selectedFile();
 33.1263 +		fileLoad(fn, lmode);				   
 33.1264 +	}
 33.1265 +}
 33.1266 +
 33.1267 +void Main::fileLoad()
 33.1268 +{
 33.1269 +	fileLoad (NewMap);
 33.1270 +}
 33.1271 +
 33.1272 +void Main::fileLoadLast(int i)
 33.1273 +{
 33.1274 +	fileLoad(*lastMaps.at(lastMapsMenu->indexOf (i) ),NewMap);			   
 33.1275 +}
 33.1276 +
 33.1277 +void Main::fileSave(const SaveMode &savemode)
 33.1278 +{
 33.1279 +	// tmp dir for zipping 
 33.1280 +	QString tmpMapDir;
 33.1281 +	
 33.1282 +	// Error codes
 33.1283 +	enum errorCode {success,aborted};
 33.1284 +	errorCode err=success;
 33.1285 +	
 33.1286 +	QString safeFilePath;
 33.1287 +
 33.1288 +	bool saveZipped=currentMapEditor()->saveZipped();
 33.1289 +
 33.1290 +	if (currentMapEditor())
 33.1291 +	{
 33.1292 +		QString fn=currentMapEditor()->getFilePath();
 33.1293 +		// filename=unnamed, filepath="" in constructor...
 33.1294 +		if ( !fn.isEmpty() ) 
 33.1295 +		{	
 33.1296 +			// We have a filepath, go on saving			
 33.1297 +			// First remove existing file, we 
 33.1298 +			// don't want to add to old zip archives
 33.1299 +			QFile f(fn);
 33.1300 +			if (f.exists() ) 
 33.1301 +				if (!f.remove())
 33.1302 +					QMessageBox::warning( 0, tr( "Save Error" ),
 33.1303 +						fn+   tr("\ncould not be removed before saving"));
 33.1304 +
 33.1305 +			// Look, if we should zip the data:
 33.1306 +			if (!saveZipped)
 33.1307 +			{
 33.1308 +				QMessageBox mb( "VYM",
 33.1309 +					tr("The map ") + fn + 
 33.1310 +					tr ("\ndid not use the compressed "
 33.1311 +					"vym file format.\nWriting it uncompressed will also write images \n"
 33.1312 +					"and flags and thus may overwrite files in the "
 33.1313 +					"given directory\n\nDo you want to write the map"),
 33.1314 +					QMessageBox::Warning,
 33.1315 +					QMessageBox::Yes | QMessageBox::Default,
 33.1316 +					QMessageBox::No ,
 33.1317 +					QMessageBox::Cancel | QMessageBox::Escape);
 33.1318 +				mb.setButtonText( QMessageBox::Yes, tr("compressed (vym default)") );
 33.1319 +				mb.setButtonText( QMessageBox::No, tr("uncompressed") );
 33.1320 +				mb.setButtonText( QMessageBox::Cancel, tr("Cancel"));
 33.1321 +				switch( mb.exec() ) 
 33.1322 +				{
 33.1323 +					case QMessageBox::Yes:
 33.1324 +						// save compressed (default file format)
 33.1325 +						saveZipped=true;
 33.1326 +						break;
 33.1327 +					case QMessageBox::No:
 33.1328 +						// save uncompressed
 33.1329 +						saveZipped=false;
 33.1330 +						break;
 33.1331 +					case QMessageBox::Cancel:
 33.1332 +						// do nothing
 33.1333 +						return;
 33.1334 +						break;
 33.1335 +				}
 33.1336 +			}
 33.1337 +
 33.1338 +			if (saveZipped)
 33.1339 +			{
 33.1340 +				char tmpdir1[]="/tmp/vym-XXXXXX";	
 33.1341 +				tmpMapDir=mkdtemp(tmpdir1);
 33.1342 +			
 33.1343 +				safeFilePath=currentMapEditor()->getFilePath();
 33.1344 +				currentMapEditor()->setFilePath (tmpMapDir+"/"+
 33.1345 +					currentMapEditor()->getMapName()+ ".xml",
 33.1346 +					safeFilePath);
 33.1347 +				currentMapEditor()->save (savemode);
 33.1348 +				currentMapEditor()->setFilePath (safeFilePath);
 33.1349 +				
 33.1350 +				// zip the temporary directory
 33.1351 +				Process *zipProc=new Process ();
 33.1352 +				zipProc->clearArguments();
 33.1353 +				zipProc->setWorkingDirectory (QDir(tmpMapDir));
 33.1354 +				zipProc->addArgument ("zip");
 33.1355 +				zipProc->addArgument ("-r");
 33.1356 +				zipProc->addArgument (fn);
 33.1357 +				zipProc->addArgument (".");
 33.1358 +
 33.1359 +				if (!zipProc->start() )
 33.1360 +				{	
 33.1361 +					// zip could not be started
 33.1362 +					QMessageBox::critical( 0, tr( "Critical Save Error" ),
 33.1363 +								   tr("Couldn't start zip to compress data."));
 33.1364 +					err=aborted;
 33.1365 +				} else
 33.1366 +				{
 33.1367 +					// zip could be started
 33.1368 +					zipProc->waitFinished();
 33.1369 +					if (!zipProc->normalExit() )
 33.1370 +					{
 33.1371 +						QMessageBox::critical( 0, tr( "Critical Save Error" ),
 33.1372 +									   tr("zip didn't exit normally")+
 33.1373 +									   "\n" + zipProc->getErrout());
 33.1374 +						err=aborted;
 33.1375 +					} else
 33.1376 +					{
 33.1377 +						if (zipProc->exitStatus()>0)
 33.1378 +						{
 33.1379 +							QMessageBox::critical( 0, tr( "Critical Save Error" ),
 33.1380 +									   QString("zip exit code:  %1").arg(zipProc->exitStatus() )+
 33.1381 +									   "\n" + zipProc->getErrout() );
 33.1382 +							err=aborted;
 33.1383 +						}
 33.1384 +					}
 33.1385 +				}	// zip could be started
 33.1386 +			} // save zipped
 33.1387 +			else
 33.1388 +			{
 33.1389 +				// Save unzipped. 
 33.1390 +				safeFilePath=currentMapEditor()->getFilePath();
 33.1391 +				currentMapEditor()->setFilePath (fn, safeFilePath);
 33.1392 +				currentMapEditor()->save (savemode);
 33.1393 +				currentMapEditor()->setFilePath (safeFilePath);
 33.1394 +			} // save zipped 	
 33.1395 +		} // filepath available
 33.1396 +		else
 33.1397 +		{
 33.1398 +			// We have  no filepath yet,
 33.1399 +			// call fileSaveAs() now, this will call fileSave() 
 33.1400 +			// again.
 33.1401 +			fileSaveAs(savemode);
 33.1402 +		}
 33.1403 +    }
 33.1404 +
 33.1405 +	if (currentMapEditor()->saveZipped())
 33.1406 +	{
 33.1407 +		// Delete tmpDir
 33.1408 +		system ( "rm -rf "+ tmpMapDir );
 33.1409 +	} 
 33.1410 +
 33.1411 +	if (err==success)
 33.1412 +		statusBar()->message( 
 33.1413 +			tr("Saved")+" " + currentMapEditor()->getFilePath(), 
 33.1414 +			statusbarTime );
 33.1415 +	else		
 33.1416 +		statusBar()->message( 
 33.1417 +			tr("Couldn't save")+" " + currentMapEditor()->getFilePath(), 
 33.1418 +			statusbarTime );
 33.1419 +}
 33.1420 +
 33.1421 +void Main::fileSave()
 33.1422 +{
 33.1423 +	fileSave (CompleteMap);
 33.1424 +}
 33.1425 +
 33.1426 +void Main::fileSaveAs(const SaveMode& savemode)
 33.1427 +{
 33.1428 +	QString tmpMapDir;
 33.1429 +	QString fn;
 33.1430 +
 33.1431 +	if (currentMapEditor())
 33.1432 +	{
 33.1433 +		if (savemode==CompleteMap)
 33.1434 +			fn = QFileDialog::getSaveFileName( QString::null, "VYM map (*.vym)", this );
 33.1435 +		else		
 33.1436 +			fn = QFileDialog::getSaveFileName( QString::null, "VYM part of map (*.vyp)", this );
 33.1437 +		if ( !fn.isEmpty() ) 
 33.1438 +		{
 33.1439 +			// Check for existing file
 33.1440 +			if (QFile (fn).exists())
 33.1441 +			{
 33.1442 +				QMessageBox mb( "VYM",
 33.1443 +					tr("The file ") + fn + tr ("\nexists already. Do you want to"),
 33.1444 +					QMessageBox::Warning,
 33.1445 +					QMessageBox::Yes | QMessageBox::Default,
 33.1446 +					QMessageBox::Cancel | QMessageBox::Escape,
 33.1447 +					QMessageBox::QMessageBox::NoButton);
 33.1448 +				mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
 33.1449 +				mb.setButtonText( QMessageBox::Cancel, tr("Cancel"));
 33.1450 +				switch( mb.exec() ) 
 33.1451 +				{
 33.1452 +					case QMessageBox::Yes:
 33.1453 +						// save 
 33.1454 +						break;
 33.1455 +					case QMessageBox::Cancel:
 33.1456 +						// do nothing
 33.1457 +						return;
 33.1458 +						break;
 33.1459 +				}
 33.1460 +			} else
 33.1461 +			{
 33.1462 +				// New file, add extension to filename, if missing
 33.1463 +				// This is always .vym or .vyp, depending on savemode
 33.1464 +				if (savemode==CompleteMap)
 33.1465 +				{
 33.1466 +					if (!fn.contains (".vym") && !fn.contains (".xml"))
 33.1467 +						fn +=".vym";
 33.1468 +				} else		
 33.1469 +				{
 33.1470 +					if (!fn.contains (".vyp") && !fn.contains (".xml"))
 33.1471 +						fn +=".vyp";
 33.1472 +				}
 33.1473 +			}
 33.1474 +	
 33.1475 +
 33.1476 +
 33.1477 +
 33.1478 +			// Save now
 33.1479 +			currentMapEditor()->setFilePath(fn);
 33.1480 +			fileSave(savemode);
 33.1481 +
 33.1482 +			// Set name of tab
 33.1483 +			tabWidget->setTabLabel (currentMapEditor(),
 33.1484 +				currentMapEditor()->getFileName() );
 33.1485 +			return;
 33.1486 +		} 
 33.1487 +	}
 33.1488 +}
 33.1489 +
 33.1490 +void Main::fileSaveAs()
 33.1491 +{
 33.1492 +	fileSaveAs (CompleteMap);
 33.1493 +}
 33.1494 +
 33.1495 +void Main::fileImportDir()
 33.1496 +{
 33.1497 +	if (currentMapEditor())
 33.1498 +		currentMapEditor()->importDir();	
 33.1499 +}
 33.1500 +
 33.1501 +void Main::fileExportXML()
 33.1502 +{
 33.1503 +	if (currentMapEditor())
 33.1504 +	{
 33.1505 +		QString dir=browseDirectory(tr("Export XML to directory"));
 33.1506 +		if (dir !="" && reallyWriteDirectory(dir) )
 33.1507 +			currentMapEditor()->exportXML(dir);
 33.1508 +	}	
 33.1509 +}
 33.1510 +
 33.1511 +void Main::fileExportHTML()
 33.1512 +{
 33.1513 +	if (currentMapEditor())
 33.1514 +	{
 33.1515 +		ExportHTMLDialog dia(this);
 33.1516 +		
 33.1517 +		if (dia.exec()==QDialog::Accepted)
 33.1518 +		{
 33.1519 +			QString dir=dia.getDir();
 33.1520 +			if (reallyWriteDirectory(dir) )
 33.1521 +			{
 33.1522 +				currentMapEditor()->exportXML (dia.getDir() );
 33.1523 +				dia.doExport(currentMapEditor()->getMapName() );
 33.1524 +			}	
 33.1525 +		}
 33.1526 +	}	
 33.1527 +}
 33.1528 +
 33.1529 +void Main::fileExportXHTML()
 33.1530 +{
 33.1531 +	QString dir;
 33.1532 +	if (currentMapEditor())
 33.1533 +	{
 33.1534 +		ExportXHTMLDialog dia(this);
 33.1535 +		dia.setFilePath (currentMapEditor()->getFilePath() );
 33.1536 +		dia.setMapName (currentMapEditor()->getMapName() );
 33.1537 +		dia.readSettings();
 33.1538 +		
 33.1539 +		if (dia.exec()==QDialog::Accepted)
 33.1540 +		{
 33.1541 +			QString dir=dia.getDir();
 33.1542 +			// Check, if warnings should be used before overwriting
 33.1543 +			// the output directory
 33.1544 +			bool ok;
 33.1545 +			if (dia.warnings()) 
 33.1546 +				ok=reallyWriteDirectory(dir);
 33.1547 +			else
 33.1548 +				ok=true;
 33.1549 +
 33.1550 +			if (ok)
 33.1551 +			{
 33.1552 +				currentMapEditor()->exportXML (dia.getDir() );
 33.1553 +				dia.doExport(currentMapEditor()->getMapName() );
 33.1554 +				if (dia.hasChanged())
 33.1555 +					currentMapEditor()->setChanged();
 33.1556 +			}	
 33.1557 +		}
 33.1558 +	}	
 33.1559 +}
 33.1560 +
 33.1561 +void Main::fileExportImage(int item)
 33.1562 +{
 33.1563 +	if (currentMapEditor())
 33.1564 +	{
 33.1565 +		QString fn = QFileDialog::getSaveFileName( QString::null, "Image  (*.bmp *.jpg *.pbm *.pgm *.png *.ppm *xbm *.xpm)",
 33.1566 +							   this );
 33.1567 +		if ( !fn.isEmpty() ) 
 33.1568 +		{
 33.1569 +			currentMapEditor()->exportImage(fn,item);
 33.1570 +		} else {
 33.1571 +			statusBar()->message( tr("Couldn't save") + fn, statusbarTime );
 33.1572 +		}
 33.1573 +	}
 33.1574 +}
 33.1575 +
 33.1576 +void Main::fileExportASCII()
 33.1577 +{
 33.1578 +	if (currentMapEditor())
 33.1579 +		currentMapEditor()->exportASCII();	
 33.1580 +}
 33.1581 +
 33.1582 +void Main::fileCloseMap()
 33.1583 +{
 33.1584 +	if (currentMapEditor())
 33.1585 +	{
 33.1586 +		if (currentMapEditor()->hasChanged())
 33.1587 +		{
 33.1588 +			QMessageBox mb( "VYM",
 33.1589 +				tr("The map ") + currentMapEditor()->getFileName() +
 33.1590 +				tr(" has been modified but not saved yet. Do you want to"),
 33.1591 +				QMessageBox::Warning,
 33.1592 +				QMessageBox::Yes | QMessageBox::Default,
 33.1593 +				QMessageBox::No,
 33.1594 +				QMessageBox::Cancel | QMessageBox::Escape );
 33.1595 +			mb.setButtonText( QMessageBox::Yes, tr("Save modified map before closing it") );
 33.1596 +			mb.setButtonText( QMessageBox::No, tr("Discard changes"));
 33.1597 +			switch( mb.exec() ) 
 33.1598 +			{
 33.1599 +				case QMessageBox::Yes:
 33.1600 +					// save and close
 33.1601 +					fileSave(CompleteMap);
 33.1602 +					break;
 33.1603 +				case QMessageBox::No:
 33.1604 +				// close  without saving
 33.1605 +					break;
 33.1606 +				case QMessageBox::Cancel:
 33.1607 +					// do nothing
 33.1608 +				return;
 33.1609 +			}
 33.1610 +		} 
 33.1611 +		currentMapEditor()->closeMap();
 33.1612 +		tabWidget->removePage(currentMapEditor());
 33.1613 +		if (tabWidget->count()==0)
 33.1614 +			actionFilePrint->setEnabled (false);
 33.1615 +	}	
 33.1616 +}
 33.1617 +
 33.1618 +void Main::filePrint()
 33.1619 +{
 33.1620 +	if (currentMapEditor())
 33.1621 +		currentMapEditor()->print();
 33.1622 +}
 33.1623 +
 33.1624 +void Main::fileExitVYM()
 33.1625 +{
 33.1626 +	// Check if one or more editors have changed
 33.1627 +	MapEditor *me;
 33.1628 +	int i;
 33.1629 +	for (i=0;i<=tabWidget->count() -1;i++)
 33.1630 +	{
 33.1631 +		
 33.1632 +		me=(MapEditor*)tabWidget->page(i);
 33.1633 +
 33.1634 +		// If something changed, ask what to do
 33.1635 +		if (me->isUnsaved())
 33.1636 +		{
 33.1637 +			tabWidget->setCurrentPage(i);
 33.1638 +			QMessageBox mb( "VYM",
 33.1639 +				tr("This map is not saved yet. Do you want to"),
 33.1640 +				QMessageBox::Warning,
 33.1641 +				QMessageBox::Yes | QMessageBox::Default,
 33.1642 +				QMessageBox::No,
 33.1643 +				QMessageBox::Cancel | QMessageBox::Escape );
 33.1644 +			mb.setButtonText( QMessageBox::Yes, tr("Save map") );
 33.1645 +			mb.setButtonText( QMessageBox::No, tr("Discard changes") );
 33.1646 +			mb.show();
 33.1647 +			// Call undocumented function: setActiveWindow is only
 33.1648 +			// possible, if widget is visible. This depends on
 33.1649 +			// windowmanager...
 33.1650 +#if defined(Q_OS_LINUX)
 33.1651 +			qt_wait_for_window_manager( this);
 33.1652 +#endif			
 33.1653 +			mb.setActiveWindow();
 33.1654 +			switch( mb.exec() ) {
 33.1655 +				case QMessageBox::Yes:
 33.1656 +					// save (the changed editors) and exit
 33.1657 +					fileSave(CompleteMap);
 33.1658 +					break;
 33.1659 +				case QMessageBox::No:
 33.1660 +					// exit without saving
 33.1661 +					break;
 33.1662 +				case QMessageBox::Cancel:
 33.1663 +					// don't save and don't exit
 33.1664 +				return;
 33.1665 +			}
 33.1666 +		}
 33.1667 +	} // loop over all MEs	
 33.1668 +    qApp->quit();
 33.1669 +}
 33.1670 +
 33.1671 +void Main::editUndo()
 33.1672 +{
 33.1673 +	if (currentMapEditor())
 33.1674 +		currentMapEditor()->undo();
 33.1675 +}
 33.1676 +
 33.1677 +void Main::editRedo()	    // TODO
 33.1678 +{
 33.1679 +}
 33.1680 +
 33.1681 +void Main::editCopy()
 33.1682 +{
 33.1683 +	if (currentMapEditor())
 33.1684 +		currentMapEditor()->copy();
 33.1685 +}
 33.1686 +
 33.1687 +void Main::editPaste()
 33.1688 +{
 33.1689 +	if (currentMapEditor())
 33.1690 +		currentMapEditor()->paste();
 33.1691 +}
 33.1692 +
 33.1693 +void Main::editCut()
 33.1694 +{
 33.1695 +	if (currentMapEditor())
 33.1696 +		currentMapEditor()->cut();
 33.1697 +}
 33.1698 +
 33.1699 +void Main::editOpenFindWindow()
 33.1700 +{
 33.1701 +	findWindow->popup();
 33.1702 +	findWindow->raise();
 33.1703 +
 33.1704 +	// Call undocumented function: setActiveWindow is only
 33.1705 +	// possible, if widget is visible. This depends on
 33.1706 +	// windowmanager...
 33.1707 +#if defined(Q_OS_LINUX)
 33.1708 +	qt_wait_for_window_manager( this);
 33.1709 +#endif	
 33.1710 +	findWindow->setActiveWindow();
 33.1711 +}
 33.1712 +
 33.1713 +void Main::editFind(QString s)
 33.1714 +{
 33.1715 +	bool cs=false;
 33.1716 +	BranchObj *bo=currentMapEditor()->findText(s, cs);
 33.1717 +	if (bo)
 33.1718 +	{	
 33.1719 +		statusBar()->message( "Found: " + bo->getHeading(), statusbarTime );
 33.1720 +	} else
 33.1721 +	{
 33.1722 +		QMessageBox::information( findWindow, tr( "VYM -Information:" ),
 33.1723 +							   tr("No matches found for ")+
 33.1724 +							   "'<b>"+s+"</b>'");
 33.1725 +	}	
 33.1726 +}
 33.1727 +
 33.1728 +void Main::editFindChanged()
 33.1729 +{	// Notify editor, to abort the current find process
 33.1730 +	currentMapEditor()->findReset();
 33.1731 +}
 33.1732 +
 33.1733 +void Main::editOpenURL()
 33.1734 +{
 33.1735 +	if (currentMapEditor())
 33.1736 +	    currentMapEditor()->openURL();
 33.1737 +}
 33.1738 +
 33.1739 +void Main::editURL()
 33.1740 +{
 33.1741 +	if (currentMapEditor())
 33.1742 +	    currentMapEditor()->editURL();
 33.1743 +}
 33.1744 +
 33.1745 +void Main::editHeading2URL()
 33.1746 +{
 33.1747 +	if (currentMapEditor())
 33.1748 +	    currentMapEditor()->editHeading2URL();
 33.1749 +}
 33.1750 +
 33.1751 +void Main::editBugzilla2URL()
 33.1752 +{
 33.1753 +	if (currentMapEditor())
 33.1754 +	    currentMapEditor()->editBugzilla2URL();
 33.1755 +}
 33.1756 +
 33.1757 +void Main::editOpenVymLink()
 33.1758 +{
 33.1759 +	// Get current path to map
 33.1760 +	QString currentVymLink;
 33.1761 +	if (currentMapEditor())
 33.1762 +	{
 33.1763 +		currentVymLink=currentMapEditor()->getVymLink();	
 33.1764 +		// compare path with already loaded maps
 33.1765 +		int index=-1;
 33.1766 +		int i;
 33.1767 +		MapEditor *me;
 33.1768 +		for (i=0;i<=tabWidget->count() -1;i++)
 33.1769 +		{
 33.1770 +			me=(MapEditor*)tabWidget->page(i);
 33.1771 +			if (currentVymLink==me->getFilePath() )
 33.1772 +			{
 33.1773 +				index=i;
 33.1774 +				break;
 33.1775 +			}
 33.1776 +		}	
 33.1777 +		if (index<0)
 33.1778 +		// Load map
 33.1779 +		{
 33.1780 +			if (!QFile(currentVymLink).exists() )
 33.1781 +				QMessageBox::critical( 0, tr( "Critical Error" ),
 33.1782 +				   tr("Couldn't open map " +currentVymLink)+".");
 33.1783 +			else
 33.1784 +			{
 33.1785 +				fileLoad (currentVymLink, NewMap);
 33.1786 +				tabWidget->setCurrentPage (tabWidget->count()-1);	
 33.1787 +			}
 33.1788 +		} else
 33.1789 +			// Go to tab containing the map
 33.1790 +			tabWidget->setCurrentPage (index);	
 33.1791 +	}
 33.1792 +}
 33.1793 +
 33.1794 +void Main::editVymLink()
 33.1795 +{
 33.1796 +	if (currentMapEditor())
 33.1797 +		currentMapEditor()->editVymLink();	
 33.1798 +}
 33.1799 +
 33.1800 +void Main::editDeleteVymLink()
 33.1801 +{
 33.1802 +	if (currentMapEditor())
 33.1803 +		currentMapEditor()->deleteVymLink();	
 33.1804 +}
 33.1805 +
 33.1806 +void Main::editMapInfo()
 33.1807 +{
 33.1808 +	if (currentMapEditor())
 33.1809 +		currentMapEditor()->editMapInfo();	
 33.1810 +}
 33.1811 +
 33.1812 +void Main::editMoveUp()
 33.1813 +{
 33.1814 +	if (currentMapEditor())
 33.1815 +	    currentMapEditor()->moveBranchUp();
 33.1816 +}
 33.1817 +
 33.1818 +void Main::editMoveDown()
 33.1819 +{
 33.1820 +	if (currentMapEditor())
 33.1821 +		currentMapEditor()->moveBranchDown();
 33.1822 +}
 33.1823 +
 33.1824 +void Main::editToggleScroll()
 33.1825 +{
 33.1826 +	if (currentMapEditor())
 33.1827 +	{
 33.1828 +		currentMapEditor()->toggleScroll();	
 33.1829 +	}	
 33.1830 +}
 33.1831 +
 33.1832 +void Main::editUnScrollAll()
 33.1833 +{
 33.1834 +	if (currentMapEditor())
 33.1835 +	{
 33.1836 +		currentMapEditor()->unScrollAll();	
 33.1837 +	}	
 33.1838 +}
 33.1839 +
 33.1840 +void Main::editHeading()
 33.1841 +{
 33.1842 +	if (currentMapEditor())
 33.1843 +		currentMapEditor()->editHeading();
 33.1844 +}
 33.1845 +
 33.1846 +void Main::editNewBranch()
 33.1847 +{
 33.1848 +	if (currentMapEditor())
 33.1849 +		currentMapEditor()->addNewBranch(0);
 33.1850 +}
 33.1851 +
 33.1852 +void Main::editNewBranchAbove()
 33.1853 +{
 33.1854 +	if (currentMapEditor())
 33.1855 +		currentMapEditor()->addNewBranch(-1);
 33.1856 +}
 33.1857 +
 33.1858 +void Main::editNewBranchBelow()
 33.1859 +{
 33.1860 +	if (currentMapEditor())
 33.1861 +		currentMapEditor()->addNewBranch(1);
 33.1862 +}
 33.1863 +
 33.1864 +void Main::editImportAdd()
 33.1865 +{
 33.1866 +	fileLoad (ImportAdd);
 33.1867 +}
 33.1868 +
 33.1869 +void Main::editImportReplace()
 33.1870 +{
 33.1871 +	fileLoad (ImportReplace);
 33.1872 +}
 33.1873 +
 33.1874 +void Main::editSaveBranch()
 33.1875 +{
 33.1876 +	fileSaveAs (PartOfMap);
 33.1877 +}
 33.1878 +
 33.1879 +void Main::editDeleteSelection()
 33.1880 +{
 33.1881 +	if (currentMapEditor())
 33.1882 +		currentMapEditor()->deleteSelection();
 33.1883 +}
 33.1884 +
 33.1885 +void Main::editUpperBranch()
 33.1886 +{
 33.1887 +	if (currentMapEditor())
 33.1888 +		currentMapEditor()->selectUpperBranch();
 33.1889 +}
 33.1890 +
 33.1891 +void Main::editLowerBranch()
 33.1892 +{
 33.1893 +	if (currentMapEditor())
 33.1894 +		currentMapEditor()->selectLowerBranch();
 33.1895 +}
 33.1896 +
 33.1897 +void Main::editLeftBranch()
 33.1898 +{
 33.1899 +	if (currentMapEditor())
 33.1900 +		currentMapEditor()->selectLeftBranch();
 33.1901 +}
 33.1902 +
 33.1903 +void Main::editRightBranch()
 33.1904 +{
 33.1905 +	if (currentMapEditor())
 33.1906 +		currentMapEditor()->selectRightBranch();
 33.1907 +}
 33.1908 +
 33.1909 +void Main::editFirstBranch()
 33.1910 +{
 33.1911 +	if (currentMapEditor())
 33.1912 +		currentMapEditor()->selectFirstBranch();
 33.1913 +}
 33.1914 +
 33.1915 +void Main::editLastBranch()
 33.1916 +{
 33.1917 +	if (currentMapEditor())
 33.1918 +		currentMapEditor()->selectLastBranch();
 33.1919 +}
 33.1920 +
 33.1921 +void Main::editLoadImage()
 33.1922 +{
 33.1923 +	if (currentMapEditor())
 33.1924 +		currentMapEditor()->loadFloatImage();
 33.1925 +}
 33.1926 +
 33.1927 +void Main::editSaveImage(int item)
 33.1928 +{
 33.1929 +	if (currentMapEditor())
 33.1930 +		currentMapEditor()->saveFloatImage(item);
 33.1931 +}
 33.1932 +
 33.1933 +void Main::editToggleFloatExport()
 33.1934 +{
 33.1935 +	if (currentMapEditor())
 33.1936 +		currentMapEditor()->toggleFloatExport();
 33.1937 +}
 33.1938 +
 33.1939 +void Main::formatSelectColor()
 33.1940 +{
 33.1941 +	if (currentMapEditor())
 33.1942 +	{
 33.1943 +		QColor col = QColorDialog::getColor( currentMapEditor()->color(), this );
 33.1944 +		if ( !col.isValid() ) return;
 33.1945 +		currentMapEditor()->setColor( col );
 33.1946 +		colorChanged( col );
 33.1947 +	}	
 33.1948 +}
 33.1949 +
 33.1950 +void Main::formatPickColor()
 33.1951 +{
 33.1952 +	if (currentMapEditor())
 33.1953 +		colorChanged( currentMapEditor()->pickColor() );
 33.1954 +}
 33.1955 +
 33.1956 +void Main::colorChanged(QColor c)
 33.1957 +{
 33.1958 +    QPixmap pix( 16, 16 );
 33.1959 +    pix.fill( c );
 33.1960 +    actionFormatColor->setIconSet( pix );
 33.1961 +}
 33.1962 +
 33.1963 +void Main::formatColorItem()
 33.1964 +{
 33.1965 +	if (currentMapEditor())
 33.1966 +		currentMapEditor()->colorItem();
 33.1967 +}
 33.1968 +
 33.1969 +void Main::formatColorBranch()
 33.1970 +{
 33.1971 +	if (currentMapEditor())
 33.1972 +		currentMapEditor()->colorBranch();
 33.1973 +}
 33.1974 +
 33.1975 +void Main::formatLinkStyleLine()
 33.1976 +{
 33.1977 +	if (currentMapEditor())
 33.1978 +		currentMapEditor()->setLinkStyle(StyleLine);
 33.1979 +}
 33.1980 +
 33.1981 +void Main::formatLinkStyleParabel()
 33.1982 +{
 33.1983 +	if (currentMapEditor())
 33.1984 +		currentMapEditor()->setLinkStyle(StyleParabel);
 33.1985 +}
 33.1986 +
 33.1987 +void Main::formatLinkStylePolyLine()
 33.1988 +{
 33.1989 +	if (currentMapEditor())
 33.1990 +		currentMapEditor()->setLinkStyle(StylePolyLine);
 33.1991 +}
 33.1992 +
 33.1993 +void Main::formatLinkStylePolyParabel()
 33.1994 +{
 33.1995 +	if (currentMapEditor())
 33.1996 +		currentMapEditor()->setLinkStyle(StylePolyParabel);
 33.1997 +}
 33.1998 +
 33.1999 +void Main::formatSelectBackColor()
 33.2000 +{
 33.2001 +	if (currentMapEditor())
 33.2002 +		currentMapEditor()->selectBackgroundColor();
 33.2003 +}
 33.2004 +
 33.2005 +void Main::formatSelectLinkColor()
 33.2006 +{
 33.2007 +	if (currentMapEditor())
 33.2008 +		currentMapEditor()->selectLinkColor();
 33.2009 +}
 33.2010 +
 33.2011 +void Main::formatToggleLinkColorHint()
 33.2012 +{
 33.2013 +	currentMapEditor()->toggleLinkColorHint();
 33.2014 +}
 33.2015 +
 33.2016 +void Main::formatFrameNone()
 33.2017 +{
 33.2018 +	if (currentMapEditor())
 33.2019 +		currentMapEditor()->setFrame(NoFrame);
 33.2020 +}
 33.2021 +
 33.2022 +void Main::formatFrameRectangle()
 33.2023 +{
 33.2024 +	if (currentMapEditor())
 33.2025 +		currentMapEditor()->setFrame(Rectangle);
 33.2026 +}
 33.2027 +
 33.2028 +void Main::viewZoomReset()
 33.2029 +{
 33.2030 +	if (currentMapEditor())
 33.2031 +	{
 33.2032 +		QWMatrix m;
 33.2033 +		m.reset();
 33.2034 +		currentMapEditor()->setWorldMatrix( m );
 33.2035 +		currentMapEditor()->setViewCenter();
 33.2036 +		currentMapEditor()->adjustCanvasSize();
 33.2037 +	}	
 33.2038 +}
 33.2039 +
 33.2040 +void Main::viewZoomIn()
 33.2041 +{
 33.2042 +	if (currentMapEditor())
 33.2043 +	{
 33.2044 +		QWMatrix m = currentMapEditor()->worldMatrix();
 33.2045 +		m.scale( 1.25, 1.25 );
 33.2046 +		currentMapEditor()->setWorldMatrix( m );
 33.2047 +		currentMapEditor()->setViewCenter();
 33.2048 +		currentMapEditor()->adjustCanvasSize();
 33.2049 +	}	
 33.2050 +}
 33.2051 +
 33.2052 +void Main::viewZoomOut()
 33.2053 +{
 33.2054 +	if (currentMapEditor())
 33.2055 +	{
 33.2056 +		QWMatrix m = currentMapEditor()->worldMatrix();
 33.2057 +		m.scale( 0.8, 0.8 );
 33.2058 +		currentMapEditor()->setWorldMatrix( m );
 33.2059 +		currentMapEditor()->setViewCenter();
 33.2060 +		currentMapEditor()->adjustCanvasSize();
 33.2061 +	}	
 33.2062 +}
 33.2063 +bool Main::settingsPDF()
 33.2064 +{
 33.2065 +	// Default browser is set in constructor
 33.2066 +	bool ok;
 33.2067 +	QString text = QInputDialog::getText(
 33.2068 +		"VYM", tr("Enter path for pdf reader:"), QLineEdit::Normal,
 33.2069 +		settings.readEntry("/vym/mainwindow/readerPDF"), &ok, this );
 33.2070 +	if (ok)
 33.2071 +		settings.writeEntry ("/vym/mainwindow/readerPDF",text);
 33.2072 +	return ok;
 33.2073 +}
 33.2074 +
 33.2075 +
 33.2076 +bool Main::settingsURL()
 33.2077 +{
 33.2078 +	// Default browser is set in constructor
 33.2079 +	bool ok;
 33.2080 +	QString text = QInputDialog::getText(
 33.2081 +		"VYM", tr("Enter path for application to open an URL:"), QLineEdit::Normal,
 33.2082 +		settings.readEntry("/vym/mainwindow/readerURL")
 33.2083 +		, &ok, this );
 33.2084 +	if (ok)
 33.2085 +		settings.writeEntry ("/vym/mainwindow/readerURL",text);
 33.2086 +	return ok;
 33.2087 +}
 33.2088 +
 33.2089 +void Main::windowToggleNoteEditor()
 33.2090 +{
 33.2091 +	if (textEditor->showWithMain() )
 33.2092 +		windowHideNoteEditor();
 33.2093 +	else	
 33.2094 +		windowShowNoteEditor();
 33.2095 +}
 33.2096 +
 33.2097 +void Main::windowShowNoteEditor()
 33.2098 +{
 33.2099 +	textEditor->setShowWithMain(true);
 33.2100 +	textEditor->show();
 33.2101 +	actionViewToggleNoteEditor->setOn (true);
 33.2102 +}
 33.2103 +
 33.2104 +void Main::windowHideNoteEditor()
 33.2105 +{
 33.2106 +	textEditor->setShowWithMain(false);
 33.2107 +	textEditor->hide();
 33.2108 +	actionViewToggleNoteEditor->setOn (false);
 33.2109 +}
 33.2110 +
 33.2111 +void Main::windowNextEditor()
 33.2112 +{
 33.2113 +	if (tabWidget->currentPageIndex() < tabWidget->count())
 33.2114 +		tabWidget->setCurrentPage (tabWidget->currentPageIndex() +1);
 33.2115 +}
 33.2116 +
 33.2117 +void Main::windowPreviousEditor()
 33.2118 +{
 33.2119 +	if (tabWidget->currentPageIndex() >0)
 33.2120 +		tabWidget->setCurrentPage (tabWidget->currentPageIndex() -1);
 33.2121 +}
 33.2122 +
 33.2123 +void Main::standardFlagChanged()
 33.2124 +{
 33.2125 +	currentMapEditor()->toggleStandardFlag(sender()->name());
 33.2126 +}
 33.2127 +
 33.2128 +void Main::testFunction()
 33.2129 +{
 33.2130 +	//textEditor->stackUnder(this);
 33.2131 +	currentMapEditor()->testFunction();
 33.2132 +}
 33.2133 +
 33.2134 +void Main::testShowClipboard()
 33.2135 +{
 33.2136 +	clipboardME->show();
 33.2137 +}
 33.2138 +
 33.2139 +void Main::helpDoc()
 33.2140 +{
 33.2141 +	QString docpath;
 33.2142 +	// default path in SUSE LINUX
 33.2143 +	docpath="/usr/share/doc/packages/vym/doc/vym.pdf";
 33.2144 +
 33.2145 +	if (!QFile (docpath).exists() )
 33.2146 +	{
 33.2147 +		// relative path for easy testing in tarball
 33.2148 +		docpath="doc/vym.pdf";
 33.2149 +		if (!QFile (docpath).exists() )
 33.2150 +		{
 33.2151 +			// relative path for testing while still writing vym.tex
 33.2152 +			docpath="doc/tex/vym.pdf";
 33.2153 +			if (!QFile (docpath).exists() )
 33.2154 +			{
 33.2155 +				QMessageBox::critical(0, 
 33.2156 +				tr("Critcal error"),
 33.2157 +				tr("Couldn't find the documentation\n"
 33.2158 +				"vym.pdf in various places."));
 33.2159 +				return;
 33.2160 +			}	
 33.2161 +		}
 33.2162 +	}
 33.2163 +	
 33.2164 +	Process *pdfProc = new Process();
 33.2165 +	pdfProc->clearArguments();
 33.2166 +	pdfProc->addArgument( settings.readEntry("/vym/mainwindow/readerPDF"));
 33.2167 +	pdfProc->addArgument( docpath);
 33.2168 +
 33.2169 +	if ( !pdfProc->start() ) 
 33.2170 +	{
 33.2171 +		// error handling
 33.2172 +		QMessageBox::critical(0, 
 33.2173 +		tr("Critcal error"),
 33.2174 +		tr("Couldn't find a viewer to read vym.pdf.\n"
 33.2175 +		"Please use Settings->")+tr("Set application to open pdf files"));
 33.2176 +		return;
 33.2177 +	}
 33.2178 +}
 33.2179 +
 33.2180 +
 33.2181 +void Main::helpAbout()
 33.2182 +{
 33.2183 +    static QMessageBox* about = new QMessageBox( "VYM",
 33.2184 +			"<h3>VYM - View Your Mind </h3>"
 33.2185 +			"<p> A tool to put the things you have got in your mind into a map.</p>"
 33.2186 +			"<ul>"
 33.2187 +				"<li> (c) by Uwe Drechsel (vym@InSilmaril.de)</li>"
 33.2188 +				"<li> vym is released under the GPL (Gnu General Public License)"
 33.2189 +				", with one exception (see the file \"LICENSE\"which "
 33.2190 +				"comes with vym). This exception is needed to build vym with QT libraries for proprietary operating systems.</li>"
 33.2191 +				"<li> Project homepage <a href=\"http:/www.InSilmaril.de/vym\">"
 33.2192 +    					"http:/www.InSilmaril.de/vym</a></li>"
 33.2193 +			"<li> Credits " 
 33.2194 +				"<ul>"
 33.2195 +					"<li>Thomas Schraitle for the stylesheet  used for XHTML-export </li>"
 33.2196 +					"<li>Clemens Kraus for stylesheets and script used for HTML-export "
 33.2197 +					"<a href=\"http://www.clemens-kraus.de\">(www.clemens-kraus.de)</a></li>"
 33.2198 +					"<li>Alexander Johannesen for providing stylesheets from his xsiteable project " 
 33.2199 +					"<a href=\"http://www.shelter.nu/xsiteable/xsiteable.html\">(www.shelter.nu/xsiteable/xsiteable.html)</a>. </li>"
 33.2200 +					"<li>Ken Wimer and Olaf Hering for Mac support</li>"
 33.2201 +				"</ul>"
 33.2202 +			"</li>"
 33.2203 +			"<li> Version "  __VYM_VERSION__  "</li>"
 33.2204 +				"<li> Build date "  __BUILD_DATE__"</li>"
 33.2205 +			"</ul>", QMessageBox::Information, 1, 0, 0, this, 0, FALSE );
 33.2206 +    about->setButtonText( 1, "Dismiss" );
 33.2207 +    about->setMinimumSize(QSize(300,300));
 33.2208 +	about->setIconPixmap (QPixmap(vym_logo_xpm));
 33.2209 +    about->show();
 33.2210 +}
 33.2211 +
 33.2212 +void Main::helpAboutQT()
 33.2213 +{
 33.2214 +	QMessageBox::aboutQt( this, "Qt Application Example" );
 33.2215 +}
 33.2216 +
    34.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.2 +++ b/mainwindow.h	Sun Jan 30 12:58:47 2005 +0000
    34.3 @@ -0,0 +1,168 @@
    34.4 +#ifndef MAINWINDOW_H 
    34.5 +#define MAINWINDOW_H
    34.6 +
    34.7 +#include <qpopupmenu.h>
    34.8 +#include <qmainwindow.h>
    34.9 +#include <qtextedit.h>
   34.10 +#include <qintdict.h>
   34.11 +#include <qcanvas.h>
   34.12 +#include <qlineedit.h>
   34.13 +#include <qaction.h>
   34.14 +#include <qcursor.h>
   34.15 +#include <qtabwidget.h>
   34.16 +#include <qmap.h>
   34.17 +
   34.18 +#include "xml.h"
   34.19 +#include "texteditor.h"
   34.20 +#include "mapeditor.h"
   34.21 +#include "findwindow.h"
   34.22 +
   34.23 +class Main : public QMainWindow 
   34.24 +{
   34.25 +    Q_OBJECT
   34.26 +
   34.27 +public:
   34.28 +    Main(QWidget* parent=0, const char* name=0, WFlags f=0);
   34.29 +    ~Main();
   34.30 +	void loadCmdLine();
   34.31 +	void statusMessage (const QString &);
   34.32 +
   34.33 +public slots:
   34.34 +    void fileNew();
   34.35 +
   34.36 +protected:
   34.37 +	void closeEvent( QCloseEvent* );
   34.38 +
   34.39 +private:
   34.40 +    void setupFileActions();
   34.41 +    void setupEditActions();
   34.42 +    void setupFormatActions();
   34.43 +    void setupViewActions();
   34.44 +    void setupWindowActions();
   34.45 +    void setupFlagActions();
   34.46 +    void setupSettingsActions();
   34.47 +    void setupTestActions();
   34.48 +    void setupHelpActions();
   34.49 +    void setupContextMenus();
   34.50 +	void setupLastMapsMenu();
   34.51 +	void hideEvent (QHideEvent * );
   34.52 +	void showEvent (QShowEvent * );
   34.53 +	bool reallyWriteDirectory(const QString&);
   34.54 +	QString browseDirectory(const QString&);
   34.55 +	MapEditor* currentMapEditor() const;
   34.56 +    
   34.57 +private slots:
   34.58 +    void newView();
   34.59 +	void editorChanged(QWidget*);
   34.60 +
   34.61 +    void fileLoad(QString ,const LoadMode &);
   34.62 +    void fileLoad(const LoadMode &);
   34.63 +    void fileLoad();
   34.64 +	void fileLoadLast(int);
   34.65 +    void fileSave(const SaveMode & );
   34.66 +    void fileSave();
   34.67 +    void fileSaveAs(const SaveMode &);
   34.68 +    void fileSaveAs();
   34.69 +    void fileImportDir();
   34.70 +    void fileExportXML();
   34.71 +    void fileExportHTML();
   34.72 +    void fileExportXHTML();
   34.73 +    void fileExportImage(int);
   34.74 +    void fileExportASCII();
   34.75 +    void fileCloseMap();
   34.76 +    void filePrint();
   34.77 +    void fileExitVYM();
   34.78 +
   34.79 +    void editUndo();	
   34.80 +    void editRedo();	
   34.81 +    void editCopy();	
   34.82 +    void editPaste();	
   34.83 +    void editCut();	
   34.84 +    void editOpenFindWindow();
   34.85 +	void editFind(QString);
   34.86 +	void editFindChanged();
   34.87 +public slots:
   34.88 +	void editOpenURL();
   34.89 +private slots:
   34.90 +	void editURL();
   34.91 +	void editHeading2URL();
   34.92 +	void editBugzilla2URL();
   34.93 +	void editVymLink();
   34.94 +public slots:
   34.95 +	void editOpenVymLink();
   34.96 +private slots:
   34.97 +	void editDeleteVymLink();
   34.98 +	void editMapInfo();
   34.99 +    void editMoveUp();	
  34.100 +    void editMoveDown();	
  34.101 +    void editToggleScroll();
  34.102 +    void editUnScrollAll();
  34.103 +    void editHeading();
  34.104 +    void editNewBranch();
  34.105 +    void editNewBranchAbove();
  34.106 +    void editNewBranchBelow();
  34.107 +    void editImportAdd();
  34.108 +    void editImportReplace();
  34.109 +    void editSaveBranch();
  34.110 +    void editDeleteSelection();
  34.111 +    void editUpperBranch();
  34.112 +    void editLowerBranch();
  34.113 +    void editLeftBranch();
  34.114 +    void editRightBranch();
  34.115 +    void editFirstBranch();
  34.116 +    void editLastBranch();
  34.117 +    void editLoadImage();
  34.118 +    void editSaveImage(int);
  34.119 +    void editToggleFloatExport();
  34.120 +
  34.121 +    void formatSelectColor();
  34.122 +    void formatPickColor();
  34.123 +    void colorChanged(QColor);
  34.124 +    void formatColorItem();
  34.125 +    void formatColorBranch();
  34.126 +	void formatLinkStyleLine();
  34.127 +	void formatLinkStyleParabel();
  34.128 +	void formatLinkStylePolyLine();
  34.129 +	void formatLinkStylePolyParabel();
  34.130 +    void formatSelectBackColor();
  34.131 +    void formatSelectLinkColor();
  34.132 +    void formatToggleLinkColorHint();
  34.133 +	void formatFrameNone();
  34.134 +	void formatFrameRectangle();
  34.135 +
  34.136 +    void viewZoomReset();
  34.137 +    void viewZoomIn();
  34.138 +    void viewZoomOut();
  34.139 +
  34.140 +public slots:
  34.141 +	bool settingsPDF();
  34.142 +	bool settingsURL();
  34.143 +
  34.144 +	void windowToggleNoteEditor();
  34.145 +private slots:
  34.146 +	void windowNextEditor();
  34.147 +	void windowPreviousEditor();
  34.148 +	void windowShowNoteEditor();
  34.149 +	void windowHideNoteEditor();
  34.150 +
  34.151 +	void standardFlagChanged();
  34.152 +
  34.153 +    void testFunction();
  34.154 +    void testShowClipboard();
  34.155 +
  34.156 +    void helpDoc();
  34.157 +    void helpAbout();
  34.158 +    void helpAboutQT();
  34.159 +
  34.160 +private:
  34.161 +    QCanvas* canvas;
  34.162 +	QTabWidget *tabWidget;
  34.163 +	FindWindow *findWindow;
  34.164 +	QStringList lastMaps;
  34.165 +	int maxLastMaps;
  34.166 +	QString lastFileDir;
  34.167 +};
  34.168 +
  34.169 +
  34.170 +#endif
  34.171 +
    35.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.2 +++ b/mapcenterobj.cpp	Sun Jan 30 12:58:47 2005 +0000
    35.3 @@ -0,0 +1,235 @@
    35.4 +#include <qdatetime.h>
    35.5 +
    35.6 +#include "mapcenterobj.h"
    35.7 +#include "floatimageobj.h"
    35.8 +#include "mapeditor.h"
    35.9 +
   35.10 +/////////////////////////////////////////////////////////////////
   35.11 +// MapCenterObj
   35.12 +/////////////////////////////////////////////////////////////////
   35.13 +MapCenterObj::MapCenterObj() : BranchObj ()
   35.14 +{
   35.15 +//    cout << "Const MapCenterObj\n";
   35.16 +    init();
   35.17 +}
   35.18 +
   35.19 +MapCenterObj::MapCenterObj(QCanvas* c) : BranchObj (c)
   35.20 +{
   35.21 +//    cout << "Const MapCenterObj   canvas="<<c<<"\n";
   35.22 +    init();
   35.23 +}
   35.24 +
   35.25 +MapCenterObj::~MapCenterObj() 
   35.26 +{
   35.27 +//    cout << "Destr MapCenterObj\n";
   35.28 +}	
   35.29 +
   35.30 +void MapCenterObj::clear() 
   35.31 +{
   35.32 +	BranchObj::clear();
   35.33 +    init();
   35.34 +}
   35.35 +
   35.36 +void MapCenterObj::init () 
   35.37 +{
   35.38 +    orientation=OrientUndef;
   35.39 +    absPos=QPoint (canvas->width()/2, canvas->height()/2);
   35.40 +
   35.41 +	// FIXME this should be done in TextObj later...
   35.42 +	QFont font ("Sans Serif,16,-1,5,50,0,0,0,0,0");		
   35.43 +	heading->setFont(font);
   35.44 +
   35.45 +	branch.setAutoDelete (TRUE);
   35.46 +	floatimage.setAutoDelete (TRUE);
   35.47 +
   35.48 +	move (absPos.x(), absPos.y() );
   35.49 +	depth=0;
   35.50 +
   35.51 +	scrolled=false;
   35.52 +	tmpUnscrolled=false;
   35.53 +
   35.54 +	frame->setFrameType (Rectangle);
   35.55 +}
   35.56 +
   35.57 +void MapCenterObj::move (double x, double y)
   35.58 +{
   35.59 +	BranchObj::move(x,y);
   35.60 +	positionBBox();
   35.61 +}
   35.62 +
   35.63 +void MapCenterObj::moveBy (double x, double y)
   35.64 +{
   35.65 +	BranchObj::moveBy(x,y);
   35.66 +	positionBBox();
   35.67 +}
   35.68 +
   35.69 +void MapCenterObj::moveAll (double x, double y)
   35.70 +{
   35.71 +	// Get rel. position
   35.72 +	double dx=x-absPos.x();
   35.73 +	double dy=y-absPos.y();
   35.74 +
   35.75 +	// Move myself and branches
   35.76 +	moveAllBy (dx,dy);
   35.77 +}
   35.78 +
   35.79 +void MapCenterObj::moveAllBy (double dx, double dy)
   35.80 +{
   35.81 +	// Move myself
   35.82 +	moveBy(dx,dy);
   35.83 +
   35.84 +	positionBBox();
   35.85 +}
   35.86 +
   35.87 +void MapCenterObj::updateLink()
   35.88 +{
   35.89 +	// set childPos to middle of MapCenterObj
   35.90 +	childPos=QPoint(
   35.91 +		absPos.x() + QSize(getSize() ).width()/2, 
   35.92 +		absPos.y() + QSize(getSize() ).height()/2);
   35.93 +	parPos=childPos;		
   35.94 +	BranchObj *b;
   35.95 +	for (b=branch.first(); b; b=branch.next() )
   35.96 +		b->updateLink();
   35.97 +}
   35.98 +
   35.99 +LinkableMapObj* MapCenterObj::findMapObj(QPoint p, LinkableMapObj *excludeLMO)
  35.100 +	{
  35.101 +	BranchObj *bo;
  35.102 +	LinkableMapObj *lmo;
  35.103 +
  35.104 +	// Search through child branches
  35.105 +	for (bo=branch.first(); bo; bo=branch.next() )
  35.106 +	{	
  35.107 +		lmo = bo->findMapObj(p, excludeLMO);
  35.108 +		
  35.109 +		if (lmo!= NULL) 
  35.110 +		{
  35.111 +			return lmo;
  35.112 +		}	
  35.113 +	}
  35.114 +	// is p in MapCenter?
  35.115 +	if (inBBox (p) && (this != excludeLMO) ) return this;
  35.116 +
  35.117 +	// Search float images
  35.118 +	FloatImageObj *foi;
  35.119 +	for (foi=floatimage.first(); foi; foi=floatimage.next() )
  35.120 +		if (foi->inBBox(p) && (foi != excludeLMO) && foi->getParObj()!= excludeLMO) return foi;
  35.121 +
  35.122 +	// nothing found
  35.123 +	return NULL;
  35.124 +}
  35.125 +
  35.126 +QString MapCenterObj::saveToDir (const QString &tmpdir,const QString &prefix, int verbose, const QPoint &offset)
  35.127 +{
  35.128 +    QString s,a;
  35.129 +
  35.130 +	// save area, if not scrolled
  35.131 +	QString areaAttr=
  35.132 +		attribut("x1",QString().setNum(absPos.x()-offset.x(),10)) +
  35.133 +		attribut("y1",QString().setNum(absPos.y()-offset.y(),10)) +
  35.134 +		attribut("x2",QString().setNum(absPos.x()+width()-offset.x(),10)) +
  35.135 +		attribut("y2",QString().setNum(absPos.y()+height()-offset.y(),10));
  35.136 +	
  35.137 +    s=beginElement ("mapcenter" 
  35.138 +		+attribut("absPosX",QString().setNum(absPos.x(),10))
  35.139 +		+attribut("absPosY",QString().setNum(absPos.y(),10))
  35.140 +		+attribut("frameType",frame->getFrameTypeName()) 
  35.141 +		+areaAttr 
  35.142 +		);
  35.143 +		
  35.144 +    incIndent();
  35.145 +    if (heading->getColor()!=QColor("black"))
  35.146 +		a=attribut ("textColor",QColor(heading->getColor()).name() );
  35.147 +    else	
  35.148 +		a="";
  35.149 +    
  35.150 +	// Save flags. If verbose is set (export to xml dir), also write
  35.151 +	// the flags as picture
  35.152 +	s+=standardFlags->saveToDir(tmpdir+"/flags", "/standardFlag-", verbose);
  35.153 +    s=s+valueElement("heading", getHeading(),a);
  35.154 +
  35.155 +	// Reset the counters before saving
  35.156 +	FloatImageObj (canvas).resetSaveCounter();
  35.157 +
  35.158 +	// add link to file in s
  35.159 +	if (!note.isEmpty() )
  35.160 +		s+=note.saveToDir();
  35.161 +	
  35.162 +	// Save FloatImages
  35.163 +	FloatImageObj *fio;
  35.164 +	for (fio=floatimage.first(); fio; fio=floatimage.next() )
  35.165 +		s+=fio->saveToDir (tmpdir,prefix);
  35.166 +
  35.167 +	// Save branches
  35.168 +    BranchObj *bo;
  35.169 +    for (bo=branch.first(); bo; bo=branch.next() )
  35.170 +		s+=bo->saveToDir(tmpdir,prefix, offset);
  35.171 +
  35.172 +    decIndent();
  35.173 +    s+=endElement   ("mapcenter");
  35.174 +    return s;
  35.175 +}
  35.176 +
  35.177 +void MapCenterObj::setVersion (const QString &s)
  35.178 +{
  35.179 +	version=s;
  35.180 +}
  35.181 +
  35.182 +bool MapCenterObj::checkVersion ()
  35.183 +{
  35.184 +	// returns true, if vym is able to read file regarding 
  35.185 +	// the version set with setVersion
  35.186 +	QString s1=version.section (".",0,0);
  35.187 +	QString s2=version.section (".",1,1);
  35.188 +	QString s3=version.section (".",2,2);
  35.189 +	bool ok;
  35.190 +	int vv1 =QString(__VYM_VERSION__).section (".",0,0).toInt(&ok,10);
  35.191 +	int vv2 =QString(__VYM_VERSION__).section (".",1,1).toInt(&ok,10);
  35.192 +	int vv3 =QString(__VYM_VERSION__).section (".",2,2).toInt(&ok,10);
  35.193 +	int mv1=0;
  35.194 +	int mv2=0;
  35.195 +	int mv3=0;
  35.196 +	if (!s1.isEmpty() ) mv1=s1.toInt(&ok,10);
  35.197 +	if (!s2.isEmpty() ) mv2=s2.toInt(&ok,10);
  35.198 +	if (!s3.isEmpty() ) mv3=s3.toInt(&ok,10);
  35.199 +	
  35.200 +	if (vv1 > mv1)
  35.201 +		return true;
  35.202 +	if (vv1 < mv1)
  35.203 +		return false;
  35.204 +	if (vv2 > mv2)
  35.205 +		return true;
  35.206 +	if (vv2 < mv2)
  35.207 +		return false;
  35.208 +	if (vv3 > mv3)
  35.209 +		return true;
  35.210 +	if (vv3 < mv3)
  35.211 +		return false;
  35.212 +	return true;	
  35.213 +}
  35.214 +
  35.215 +void MapCenterObj::setAuthor (const QString &s)
  35.216 +{
  35.217 +	author=s;
  35.218 +}
  35.219 +
  35.220 +QString MapCenterObj::getAuthor()
  35.221 +{
  35.222 +	return author;
  35.223 +}
  35.224 +
  35.225 +void MapCenterObj::setComment (const QString &s)
  35.226 +{
  35.227 +	comment=s;
  35.228 +}
  35.229 +
  35.230 +QString MapCenterObj::getComment ()
  35.231 +{
  35.232 +	return comment;
  35.233 +}
  35.234 +
  35.235 +QString MapCenterObj::getDate ()
  35.236 +{
  35.237 +	return QDate::currentDate().toString ("yyyy-MM-dd");
  35.238 +}
    36.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.2 +++ b/mapcenterobj.h	Sun Jan 30 12:58:47 2005 +0000
    36.3 @@ -0,0 +1,35 @@
    36.4 +#ifndef MAPCENTEROBJ_H
    36.5 +#define MAPCENTEROBJ_H
    36.6 +
    36.7 +#include "branchobj.h"
    36.8 +#include "version.h"
    36.9 +
   36.10 +/////////////////////////////////////////////////////////////////////////////
   36.11 +class MapCenterObj:public BranchObj {
   36.12 +public:
   36.13 +    MapCenterObj ();
   36.14 +    MapCenterObj (QCanvas*);
   36.15 +    ~MapCenterObj ();
   36.16 +    void clear();
   36.17 +    void init();
   36.18 +    virtual void move      (double,double);
   36.19 +    virtual void moveBy    (double,double);
   36.20 +    virtual void moveAll   (double,double);
   36.21 +    virtual void moveAllBy (double,double);
   36.22 +    virtual void updateLink();
   36.23 +    LinkableMapObj* findMapObj(QPoint,LinkableMapObj*);	// find MapObj 
   36.24 +	virtual QString saveToDir (const QString&,const QString&,int, const QPoint&);// Save data recursivly to tempdir
   36.25 +	void setVersion(const  QString &);
   36.26 +	bool checkVersion();				// check if program version is higher than saved version
   36.27 +	void setAuthor  (const QString &);
   36.28 +	QString getAuthor ();
   36.29 +	void setComment (const QString &);
   36.30 +	QString getComment ();
   36.31 +	QString getDate();
   36.32 +private:
   36.33 +	QString version;					// version string saved in vym file
   36.34 +	QString author;
   36.35 +	QString comment;
   36.36 +	QDate date;
   36.37 +};
   36.38 +#endif
    37.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.2 +++ b/mapeditor.cpp	Sun Jan 30 12:58:47 2005 +0000
    37.3 @@ -0,0 +1,3062 @@
    37.4 +#include "mapeditor.h"
    37.5 +
    37.6 +#include <qstatusbar.h>
    37.7 +#include <qmessagebox.h>
    37.8 +#include <qapplication.h>
    37.9 +#include <qpainter.h>
   37.10 +#include <qpopupmenu.h>
   37.11 +#include <qprinter.h>
   37.12 +#include <qpaintdevicemetrics.h>
   37.13 +#include <qfile.h>
   37.14 +#include <qfiledialog.h>
   37.15 +#include <qdir.h>
   37.16 +#include <qcolor.h>
   37.17 +#include <qcolordialog.h>
   37.18 +#include <qbitmap.h>
   37.19 +#include <qprocess.h>
   37.20 +#include <qinputdialog.h>
   37.21 +
   37.22 +#include <iostream>
   37.23 +#include <stdlib.h>
   37.24 +#include <typeinfo>
   37.25 +
   37.26 +#include "version.h"
   37.27 +
   37.28 +#include "xml.h"
   37.29 +#include "texteditor.h"
   37.30 +#include "linkablemapobj.h"
   37.31 +#include "exports.h"
   37.32 +#include "misc.h"
   37.33 +#include "mainwindow.h"
   37.34 +#include "extrainfodialog.h"
   37.35 +#include "settings.h"
   37.36 +
   37.37 +#include "icons/flag-note.xpm"
   37.38 +#include "icons/flag-url.xpm"
   37.39 +#include "icons/flag-vymlink.xpm"	
   37.40 +#include "icons/flag-scrolled-right.xpm"
   37.41 +#include "icons/flag-tmpUnscrolled-right.xpm"
   37.42 +#include "icons/flag-questionmark.xpm"
   37.43 +#include "icons/flag-exclamationmark.xpm"
   37.44 +#include "icons/flag-hook-green.xpm"
   37.45 +#include "icons/flag-cross-red.xpm"
   37.46 +#include "icons/flag-stopsign.xpm"
   37.47 +#include "icons/flag-smiley-good.xpm"
   37.48 +#include "icons/flag-smiley-sad.xpm"
   37.49 +#include "icons/flag-clock.xpm"
   37.50 +#include "icons/flag-lamp.xpm"
   37.51 +#include "icons/flag-arrow-up.xpm"
   37.52 +#include "icons/flag-arrow-down.xpm"
   37.53 +#include "icons/flag-thumb-up.xpm"
   37.54 +#include "icons/flag-thumb-down.xpm"
   37.55 +#include "icons/flag-heart.xpm"
   37.56 +#include "icons/flag-flash.xpm"
   37.57 +#include "icons/flag-lifebelt.xpm"
   37.58 +
   37.59 +extern TextEditor *textEditor;
   37.60 +extern int statusbarTime;
   37.61 +extern Main *mainWindow;
   37.62 +extern FlagRowObj *systemFlagsDefault;
   37.63 +extern FlagRowObj *standardFlagsDefault;
   37.64 +extern MapEditor *clipboardME;
   37.65 +
   37.66 +extern QAction *actionFileSave;
   37.67 +extern QAction *actionEditUndo;
   37.68 +extern QAction *actionEditCopy;
   37.69 +extern QAction *actionEditCut;
   37.70 +extern QAction *actionEditPaste;
   37.71 +extern QAction *actionEditMoveUp;
   37.72 +extern QAction *actionEditMoveDown;
   37.73 +extern QAction *actionEditToggleScroll;
   37.74 +extern QAction *actionEditOpenURL;
   37.75 +extern QAction *actionEditURL;
   37.76 +extern QAction *actionEditHeading2URL;
   37.77 +extern QAction *actionEditBugzilla2URL;
   37.78 +extern QAction *actionEditOpenVymLink;
   37.79 +extern QAction *actionEditVymLink;
   37.80 +extern QAction *actionEditDeleteVymLink;
   37.81 +extern QAction *actionEditHeading;
   37.82 +extern QAction *actionEditDelete;
   37.83 +extern QAction *actionEditAddBranch;
   37.84 +extern QAction *actionEditAddBranchAbove;
   37.85 +extern QAction *actionEditAddBranchBelow;
   37.86 +extern QAction *actionEditImportAdd;
   37.87 +extern QAction *actionEditImportReplace;
   37.88 +extern QAction *actionEditSaveBranch;
   37.89 +extern QAction *actionEditSelectFirst;
   37.90 +extern QAction *actionEditSelectLast;
   37.91 +extern QAction *actionEditLoadImage;
   37.92 +extern QAction *actionEditToggleFloatExport;
   37.93 +
   37.94 +extern QAction* actionFormatPickColor;
   37.95 +extern QAction* actionFormatColorBranch;
   37.96 +extern QAction* actionFormatColorSubtree;
   37.97 +extern QAction *actionFormatLinkColorHint;
   37.98 +extern QAction *actionFormatBackColor;
   37.99 +extern QAction *actionFormatLinkColor;
  37.100 +
  37.101 +extern QActionGroup *actionGroupFormatFrameTypes;
  37.102 +extern QAction *actionFormatFrameNone;
  37.103 +extern QAction *actionFormatFrameRectangle;
  37.104 +
  37.105 +extern QActionGroup *actionGroupFormatLinkStyles;
  37.106 +extern QAction *actionFormatLinkStyleLine;
  37.107 +extern QAction *actionFormatLinkStyleParabel;
  37.108 +extern QAction *actionFormatLinkStylePolyLine;
  37.109 +extern QAction *actionFormatLinkStylePolyParabel;
  37.110 +
  37.111 +extern QAction *actionViewToggleNoteEditor;
  37.112 +
  37.113 +extern QAction *actionSettingsAutoedit;
  37.114 +extern QAction *actionSettingsAutoselectHeading;
  37.115 +extern QAction *actionSettingsAutoselectText;
  37.116 +extern QAction *actionSettingsPasteNewHeading;
  37.117 +
  37.118 +extern QPopupMenu *branchContextMenu;
  37.119 +extern QPopupMenu *floatimageContextMenu;
  37.120 +extern QPopupMenu *saveImageFormatMenu;
  37.121 +extern QPopupMenu *exportImageFormatMenu;
  37.122 +extern QPopupMenu *canvasContextMenu;
  37.123 +
  37.124 +extern Settings settings;
  37.125 +
  37.126 +
  37.127 +///////////////////////////////////////////////////////////////////////
  37.128 +///////////////////////////////////////////////////////////////////////
  37.129 +MapEditor::MapEditor(
  37.130 +	QWidget* parent, bool interactive, const char* name, WFlags f) :
  37.131 +    QCanvasView(parent,name,f)
  37.132 +{
  37.133 +	//cout << "Constructor ME "<<this<<endl;
  37.134 +
  37.135 +    mapCanvas = new QCanvas(1000,800);
  37.136 +	mapCanvas->setAdvancePeriod(30);
  37.137 +
  37.138 +    setCanvas (mapCanvas);
  37.139 +	
  37.140 +	setVScrollBarMode ( QScrollView::AlwaysOn );
  37.141 +	setHScrollBarMode ( QScrollView::AlwaysOn );
  37.142 +
  37.143 +	// Now create the _global_ system flags _once_:
  37.144 +	// (Later all OrnamentedObj copy from this 
  37.145 +	// and set their own canvas)
  37.146 +	if (!systemFlagsDefault)
  37.147 +	{
  37.148 +		systemFlagsDefault = new FlagRowObj (mapCanvas);
  37.149 +		systemFlagsDefault->setVisibility (false);
  37.150 +		systemFlagsDefault->setName ("systemFlagsDef");
  37.151 +
  37.152 +		FlagObj *fo = new FlagObj (mapCanvas);
  37.153 +		fo->load(QPixmap(flag_note_xpm));
  37.154 +		fo->setName("note");
  37.155 +		fo->setToolTip(tr("Note"));
  37.156 +		systemFlagsDefault->addFlag (fo);	// makes deep copy
  37.157 +
  37.158 +		fo->load(QPixmap(flag_url_xpm));
  37.159 +		fo->setName("url");
  37.160 +		fo->setToolTip(tr("WWW Document (external)"));
  37.161 +		systemFlagsDefault->addFlag (fo);
  37.162 +		
  37.163 +		fo->load(QPixmap(flag_vymlink_xpm));
  37.164 +		fo->setName("vymLink");
  37.165 +		fo->setToolTip(tr("Link to another vym map"));
  37.166 +		systemFlagsDefault->addFlag (fo);	
  37.167 +
  37.168 +		fo->load(QPixmap(flag_scrolled_right_xpm));
  37.169 +		fo->setName("scrolledright");
  37.170 +		fo->setToolTip(tr("subtree is scrolled"));
  37.171 +		systemFlagsDefault->addFlag (fo);
  37.172 +		
  37.173 +		fo->load(QPixmap(flag_tmpUnscrolled_right_xpm));
  37.174 +		fo->setName("tmpUnscrolledright");
  37.175 +		fo->setToolTip(tr("subtree is temporary scrolled"));
  37.176 +		systemFlagsDefault->addFlag (fo);
  37.177 +		delete (fo);
  37.178 +	}
  37.179 +	if (!standardFlagsDefault)
  37.180 +	{
  37.181 +		standardFlagsDefault = new FlagRowObj (mapCanvas);
  37.182 +		standardFlagsDefault->setVisibility (false);
  37.183 +		standardFlagsDefault->setName ("standardFlagsDef");
  37.184 +
  37.185 +		FlagObj *fo = new FlagObj (mapCanvas);
  37.186 +		fo->load(QPixmap(flag_exclamationmark_xpm));
  37.187 +		fo->setName("exclamationmark");
  37.188 +		fo->setToolTip(tr("Take care!"));
  37.189 +		standardFlagsDefault->addFlag (fo);	// makes deep copy
  37.190 +		
  37.191 +		fo->load(QPixmap(flag_questionmark_xpm));
  37.192 +		fo->setName("questionmark");
  37.193 +		fo->setToolTip(tr("Really?"));
  37.194 +		standardFlagsDefault->addFlag (fo);	
  37.195 +
  37.196 +		fo->load(QPixmap(flag_hook_green_xpm));
  37.197 +		fo->setName("hook-green");
  37.198 +		fo->setToolTip(tr("ok!"));
  37.199 +		standardFlagsDefault->addFlag (fo);	
  37.200 +
  37.201 +		fo->load(QPixmap(flag_cross_red_xpm));
  37.202 +		fo->setName("cross-red");
  37.203 +		fo->setToolTip(tr("Not ok!"));
  37.204 +		standardFlagsDefault->addFlag (fo);	
  37.205 +
  37.206 +		fo->load(QPixmap(flag_stopsign_xpm));
  37.207 +		fo->setName("stopsign");
  37.208 +		fo->setToolTip(tr("This won't work!"));
  37.209 +		standardFlagsDefault->addFlag (fo);	
  37.210 +
  37.211 +		fo->load(QPixmap(flag_smiley_good_xpm));
  37.212 +		fo->setName("smiley-good");
  37.213 +		fo->setToolTip(tr("Good"));
  37.214 +		standardFlagsDefault->addFlag (fo);	
  37.215 +
  37.216 +		fo->load(QPixmap(flag_smiley_sad_xpm));
  37.217 +		fo->setName("smiley-sad");
  37.218 +		fo->setToolTip(tr("Bad"));
  37.219 +		standardFlagsDefault->addFlag (fo);	
  37.220 +
  37.221 +		fo->load(QPixmap(flag_clock_xpm));
  37.222 +		fo->setName("clock");
  37.223 +		fo->setToolTip(tr("Time critical"));
  37.224 +		standardFlagsDefault->addFlag (fo);	
  37.225 +
  37.226 +		fo->load(QPixmap(flag_lamp_xpm));
  37.227 +		fo->setName("lamp");
  37.228 +		fo->setToolTip(tr("Idea!"));
  37.229 +		standardFlagsDefault->addFlag (fo);	
  37.230 +
  37.231 +		fo->load(QPixmap(flag_arrow_up_xpm));
  37.232 +		fo->setName("arrow-up");
  37.233 +		fo->setToolTip(tr("Important"));
  37.234 +		standardFlagsDefault->addFlag (fo);	
  37.235 +
  37.236 +		fo->load(QPixmap(flag_arrow_down_xpm));
  37.237 +		fo->setName("arrow-down");
  37.238 +		fo->setToolTip(tr("Unimportant"));
  37.239 +		standardFlagsDefault->addFlag (fo);	
  37.240 +
  37.241 +		fo->load(QPixmap(flag_thumb_up_xpm));
  37.242 +		fo->setName("thumb-up");
  37.243 +		fo->setToolTip(tr("I like this"));
  37.244 +		standardFlagsDefault->addFlag (fo);	
  37.245 +
  37.246 +		fo->load(QPixmap(flag_thumb_down_xpm));
  37.247 +		fo->setName("thumb-down");
  37.248 +		fo->setToolTip(tr("I do not like this"));
  37.249 +		standardFlagsDefault->addFlag (fo);	
  37.250 +		
  37.251 +		fo->load(QPixmap(flag_heart_xpm));
  37.252 +		fo->setName("heart");
  37.253 +		fo->setToolTip(tr("I just love... "));
  37.254 +		standardFlagsDefault->addFlag (fo);	
  37.255 +
  37.256 +		fo->load(QPixmap(flag_flash_xpm));
  37.257 +		fo->setName("flash");
  37.258 +		fo->setToolTip(tr("Dangerous"));
  37.259 +		standardFlagsDefault->addFlag (fo);	
  37.260 +		
  37.261 +		fo->load(QPixmap(flag_lifebelt_xpm));
  37.262 +		fo->setName("lifebelt");
  37.263 +		fo->setToolTip(tr("This will help"));
  37.264 +		standardFlagsDefault->addFlag (fo);	
  37.265 +		delete (fo);
  37.266 +
  37.267 +	}
  37.268 +	
  37.269 +    mapCenter = new MapCenterObj(mapCanvas);
  37.270 +    mapCenter->setVisibility (true);
  37.271 +	mapCenter->setMapEditor (this);
  37.272 +	mapCenter->setHeading (tr("New Map"));
  37.273 +
  37.274 +    printer=NULL;
  37.275 +
  37.276 +    lineedit = new QLineEdit(this, "lineedit"  );
  37.277 +    connect( lineedit, SIGNAL( returnPressed() ), SLOT( finishedLineEditNoSave() ) );
  37.278 +    lineedit->hide();
  37.279 +
  37.280 +    actColor=black; setColor (actColor);
  37.281 +	deflinkcolor=QColor (0,0,255);
  37.282 +	linkcolorhint=DefaultColor;
  37.283 +	linkstyle=StylePolyParabel;
  37.284 +	mapCanvas->setBackgroundColor (white);
  37.285 +
  37.286 +	// Create bitmap cursors, patform dependant
  37.287 +	#if defined(Q_OS_MACX)
  37.288 +		#include "icons/cursorhandopen16.xpm"
  37.289 +		#include "icons/cursorcolorpicker16.xpm"
  37.290 +		QBitmap cb( 16, 16, chandopen, TRUE );
  37.291 +		QBitmap cm( 16, 16, chandopenmask, TRUE );
  37.292 +		handOpenCursor=QCursor ( cb, cm );		
  37.293 +		// set hot spot to tip of picker			
  37.294 +		pickColorCursor=QCursor ( cursorcolorpicker_xpm, 1,15 ); 
  37.295 +	#else
  37.296 +		#include "icons/cursorhandopen.xpm"
  37.297 +		#include "icons/cursorcolorpicker.xpm"
  37.298 +
  37.299 +		QBitmap cb( 32, 32, chandopen, TRUE );
  37.300 +		QBitmap cm( 32, 32, chandopenmask, TRUE );
  37.301 +		handOpenCursor=QCursor ( cb, cm );		
  37.302 +		// set hot spot to tip of picker			
  37.303 +		pickColorCursor=QCursor ( cursorcolorpicker_xpm, 5,27 ); 
  37.304 +	#endif
  37.305 +
  37.306 +
  37.307 +	pickingColor=false;
  37.308 +
  37.309 +    editingBO=NULL;
  37.310 +    selection=NULL;
  37.311 +    selectionLast=NULL;
  37.312 +    movingObj=NULL;
  37.313 +
  37.314 +    mapChanged=false;
  37.315 +	mapDefault=true;
  37.316 +	mapUnsaved=false;
  37.317 +	undoSelection=NULL;
  37.318 +	
  37.319 +	zipped=true;
  37.320 +	filePath="";
  37.321 +	fileName="unnamed";
  37.322 +	mapName="";
  37.323 +
  37.324 +	// Initialize find routine
  37.325 +	itFind=NULL;				
  37.326 +	EOFind=false;
  37.327 +
  37.328 +	printFrame=true;
  37.329 +	printFooter=true;
  37.330 +
  37.331 +	blockreposition=false;
  37.332 +	isInteractive=interactive;
  37.333 +	if (isInteractive)
  37.334 +		// Create temporary files
  37.335 +		makeTmpDirs();
  37.336 +
  37.337 +	// Initially set movingCentre
  37.338 +	updateViewCenter();
  37.339 +
  37.340 +	mapCenter->reposition();	//	for positioning heading
  37.341 +}
  37.342 +
  37.343 +MapEditor::~MapEditor()
  37.344 +{
  37.345 +	//cout <<"Destructor MapEditor\n";
  37.346 +	if (isInteractive) delTmpDirs();
  37.347 +
  37.348 +	// Save Settings
  37.349 +	//settings.writeEntry( "/vym/mapeditor/editmode/autoselect",  );
  37.350 +
  37.351 +}
  37.352 +
  37.353 +QColor MapEditor::color()
  37.354 +{
  37.355 +    return actColor;
  37.356 +}
  37.357 +
  37.358 +QColor MapEditor::backgroundColor()
  37.359 +{
  37.360 +    return mapCanvas->backgroundColor();
  37.361 +}
  37.362 +
  37.363 +MapCenterObj* MapEditor::getMapCenter()
  37.364 +{
  37.365 +    return mapCenter;
  37.366 +}
  37.367 +
  37.368 +QCanvas* MapEditor::getCanvas()
  37.369 +{
  37.370 +    return mapCanvas;
  37.371 +}
  37.372 +
  37.373 +void MapEditor::adjustCanvasSize()
  37.374 +{
  37.375 +	// To adjust the canvas to map, viewport size and position, we have to
  37.376 +	// do some coordinate magic...
  37.377 +	//
  37.378 +	// Get rectangle of (scroll-)view. 
  37.379 +	// We want to be in canvas coords, so
  37.380 +	// we map. Important if view is zoomed...
  37.381 +	QRect view = inverseWorldMatrix().mapRect( QRect( contentsX(), contentsY(),
  37.382 +												visibleWidth(), visibleHeight()) );	
  37.383 +												
  37.384 +	// Now we need the bounding box of view AND map to calc the correct canvas size.
  37.385 +	// Why? Because if the map itself is moved out of view, the view has to be enlarged
  37.386 +	// to avoid jumping aroung...
  37.387 +	QRect map=mapCenter->getTotalBBox();
  37.388 +
  37.389 +	// right edge - left edge
  37.390 +	int cw= max(map.x() + map.width(),  view.x() + view.width())  - min(map.x(), view.x());
  37.391 +	int ch= max(map.y() + map.height(), view.y() + view.height()) - min(map.y(), view.y());
  37.392 +
  37.393 +
  37.394 +	if ( (cw!=mapCanvas->width()) || (ch!=mapCanvas->height()) ||
  37.395 +		!mapCanvas->onCanvas (map.topLeft()) || !mapCanvas->onCanvas (map.bottomRight())
  37.396 +	)	
  37.397 +	{	
  37.398 +		// move the map on canvas (in order to not move it on screen) this is neccessary
  37.399 +		// a) if topleft corner of canvas is left or above topleft corner of view and also left of
  37.400 +		//    above topleft corner of map. E.g. if map is completly inside view, but it would be possible 
  37.401 +		//    to scroll to an empty area of canvas to the left.
  37.402 +		// b) if topleft corner of map left of or above topleft of canvas
  37.403 +		int dx=0;
  37.404 +		int dy=0;
  37.405 +
  37.406 +		if (cw > mapCanvas->width() )
  37.407 +		{
  37.408 +			if (map.x()<0) dx=-map.x();	
  37.409 +		}
  37.410 +		if (cw <  mapCanvas->width() )
  37.411 +			dx=-min (view.x(),map.x());
  37.412 +		if (ch > mapCanvas->height() )
  37.413 +		{
  37.414 +			if (map.y()<0) dy=-map.y();	
  37.415 +		}
  37.416 +		if (ch <  mapCanvas->height() )
  37.417 +		{
  37.418 +			dy=-min (view.y(),map.y());
  37.419 +		}
  37.420 +		// We really have to resize now. Let's go...
  37.421 +		mapCanvas->resize (cw,ch);
  37.422 +		if ( (dx!=0) || (dy!=0) ) 
  37.423 +		{
  37.424 +			mapCenter->moveAllBy(dx,dy);
  37.425 +			mapCenter->reposition();
  37.426 +
  37.427 +			// scroll the view (in order to not move map on screen)
  37.428 +			scrollBy (dx,dy);
  37.429 +		}	
  37.430 +	}
  37.431 +}
  37.432 +
  37.433 +bool MapEditor::blockReposition()
  37.434 +{
  37.435 +	return blockreposition;
  37.436 +}
  37.437 +
  37.438 +void MapEditor::makeTmpDirs()
  37.439 +{
  37.440 +	// Create unique temporary directories
  37.441 +	char tmpdir[]="/tmp/vym-XXXXXX";	
  37.442 +	bakMapDir=mkdtemp(tmpdir);
  37.443 +	makeSubDirs(bakMapDir);
  37.444 +	// FIXME set permissions
  37.445 +	// and maybe use QT method for portability
  37.446 +}
  37.447 +
  37.448 +void MapEditor::delTmpDirs()
  37.449 +{
  37.450 +	//FIXME delete tmp directory, better use QT methods here:
  37.451 +	system ( "rm -rf "+ bakMapDir );
  37.452 +}
  37.453 +
  37.454 +
  37.455 +void MapEditor::makeSubDirs(const QString &s)
  37.456 +{
  37.457 +	QDir d(s);
  37.458 +	d.mkdir ("images");	
  37.459 +	d.mkdir ("flags");	
  37.460 +}
  37.461 +
  37.462 +
  37.463 +QString MapEditor::saveToDir(const QString &tmpdir, const QString &prefix, bool writeflags, const QPoint &offset, SaveMode savemode)
  37.464 +{
  37.465 +	// tmpdir		temporary directory to which data will be writte
  37.466 +	// prefix		mapname, which will be appended to images etc.
  37.467 +	// writeflags	Only write flags for "real" save of map, not undo
  37.468 +	// offset		offset of bbox of whole map in canvas. 
  37.469 +	//				Needed for XML export
  37.470 +	// completeMap	if false, only vympart will be written, without
  37.471 +	//				mapcenter
  37.472 +	
  37.473 +	// Save Header
  37.474 +	QString ls;
  37.475 +	switch (linkstyle)
  37.476 +	{
  37.477 +		case StyleLine: 
  37.478 +			ls="StyleLine";
  37.479 +			break;
  37.480 +		case StyleParabel:
  37.481 +			ls="StyleParabel";
  37.482 +			break;
  37.483 +		case StylePolyLine:	
  37.484 +			ls="StylePolyLine";
  37.485 +			break;
  37.486 +		default:
  37.487 +			ls="StylePolyParabel";
  37.488 +			break;
  37.489 +	}	
  37.490 +
  37.491 +	QString s="<?xml version=\"1.0\" encoding=\"utf-8\"?><!DOCTYPE vymmap>\n";
  37.492 +	QString colhint="";
  37.493 +	if (linkcolorhint==HeadingColor) 
  37.494 +		colhint=attribut("linkColorHint","HeadingColor");
  37.495 +
  37.496 +	QString mapAttr=attribut("version",__VYM_VERSION__);
  37.497 +	if (savemode==CompleteMap)
  37.498 +		mapAttr+= attribut("author",mapCenter->getAuthor()) +
  37.499 +				  attribut("comment",mapCenter->getComment()) +
  37.500 +			      attribut("date",mapCenter->getDate()) +
  37.501 +		          attribut("backgroundColor", mapCanvas->backgroundColor().name() ) +
  37.502 +		          attribut("linkStyle", ls ) +
  37.503 +		          attribut("linkColor", deflinkcolor.name() ) +
  37.504 +		          colhint; 
  37.505 +	s+=beginElement("vymmap",mapAttr);
  37.506 +	incIndent();
  37.507 +
  37.508 +	// Find the used flags while traversing the tree
  37.509 +	standardFlagsDefault->resetUsedCounter();
  37.510 +	
  37.511 +	// Build xml recursivly
  37.512 +	if (savemode==CompleteMap)
  37.513 +		s+=mapCenter->saveToDir(tmpdir,prefix,writeflags,offset);
  37.514 +	else
  37.515 +	{
  37.516 +		if ( undoSelection &&
  37.517 +			typeid(*undoSelection) == typeid(BranchObj) )
  37.518 +			s+=((BranchObj*)(undoSelection))->saveToDir(tmpdir,prefix,offset);
  37.519 +	}
  37.520 +
  37.521 +	// Save local settings
  37.522 +	s+=settings.getXMLData (destPath);
  37.523 +
  37.524 +	// Save selection
  37.525 +	if (selection) 
  37.526 +		s+=valueElement("select",selection->getSelectString());
  37.527 +
  37.528 +	decIndent();
  37.529 +	s+=endElement("vymmap");
  37.530 +
  37.531 +	if (writeflags)
  37.532 +		standardFlagsDefault->saveToDir (tmpdir+"/flags/","",writeflags);
  37.533 +	
  37.534 +	return s;
  37.535 +}
  37.536 +
  37.537 +void MapEditor::saveState()
  37.538 +{
  37.539 +	saveState (CompleteMap,NULL);
  37.540 +}
  37.541 +
  37.542 +void MapEditor::saveState(const SaveMode &mode, LinkableMapObj *part)
  37.543 +{
  37.544 +	// all binary data is saved in bakMapDir (created in Constructor)
  37.545 +	// the xml data itself is kept in memory in backupXML
  37.546 +	// 
  37.547 +	// For faster write/read of data, a part of the map can be
  37.548 +	// written. Then the undoSelection will mark, which part of the
  37.549 +	// map should be replaced if an undo is wanted later.
  37.550 +
  37.551 +	if (mode==PartOfMap && part && (typeid(*part) == typeid (BranchObj) ) ) 
  37.552 +	{
  37.553 +		// Writing a vympart only is useful for BranchObj
  37.554 +		undoSelection=part;
  37.555 +		backupXML=saveToDir (bakMapDir,mapName+"-",false, QPoint (),PartOfMap);
  37.556 +	} else	
  37.557 +	{
  37.558 +		undoSelection=NULL;
  37.559 +		backupXML=saveToDir (bakMapDir,mapName+"-",false, QPoint (),CompleteMap);
  37.560 +	}	
  37.561 +}
  37.562 +
  37.563 +void MapEditor::finishedLineEditNoSave()
  37.564 +{
  37.565 +	// This is called by finishedLineEdit or any MapEditor method,
  37.566 +	// which wants to assure, that lineedits finish, before e.g. a branch is 
  37.567 +	// deleted
  37.568 +    
  37.569 +	// After calling LineEdit and using the clipboard, the 
  37.570 +    // focus is not any longer on the main widget, we
  37.571 +    // have to restore it using parentWidget()->setFocus()
  37.572 +
  37.573 +    if (editingBO!=NULL) 
  37.574 +	{
  37.575 +		editingBO->setHeading(lineedit->text() );
  37.576 +		editingBO=NULL;
  37.577 +		lineedit->releaseKeyboard();
  37.578 +		lineedit->hide();
  37.579 +		parentWidget()->setFocus();
  37.580 +		mapCenter->reposition();
  37.581 +		adjustCanvasSize();
  37.582 +		ensureSelectionVisible();
  37.583 +    }		
  37.584 +}
  37.585 +
  37.586 +
  37.587 +bool MapEditor::isDefault()
  37.588 +{
  37.589 +    return mapDefault;
  37.590 +}
  37.591 +
  37.592 +bool MapEditor::isUnsaved()
  37.593 +{
  37.594 +    return mapUnsaved;
  37.595 +}
  37.596 +
  37.597 +bool MapEditor::hasChanged()
  37.598 +{
  37.599 +    return mapChanged;
  37.600 +}
  37.601 +
  37.602 +void MapEditor::setChanged()
  37.603 +{
  37.604 +	mapChanged=true;
  37.605 +	mapDefault=false;
  37.606 +	mapUnsaved=true;
  37.607 +	actionEditUndo->setEnabled (true);
  37.608 +	actionFileSave->setEnabled (true);
  37.609 +	findReset();
  37.610 +}
  37.611 +
  37.612 +void MapEditor::closeMap()
  37.613 +{
  37.614 +	// Finish open lineEdits
  37.615 +	if (lineedit) finishedLineEditNoSave();
  37.616 +
  37.617 +	// Unselect before disabling the toolbar actions
  37.618 +	if (selection) selection->unselect();
  37.619 +	selection=NULL;
  37.620 +	updateActions();
  37.621 +
  37.622 +    clear();
  37.623 +	close();
  37.624 +}
  37.625 +
  37.626 +void MapEditor::setFilePath(QString fname)
  37.627 +{
  37.628 +	setFilePath (fname,fname);
  37.629 +}
  37.630 +
  37.631 +void MapEditor::setFilePath(QString fname, QString destname)
  37.632 +{
  37.633 +	filePath=fname;
  37.634 +	fileName=fname;
  37.635 +	destPath=destname;
  37.636 +
  37.637 +	// If fname is not an absolute path, complete it
  37.638 +	filePath=QDir(fname).absPath();
  37.639 +	fileDir=filePath.left (1+filePath.findRev ("/"));
  37.640 +
  37.641 +	// Set short name, too. Search from behind:
  37.642 +	int i=fileName.findRev("/");
  37.643 +	if (i>=0) fileName=fileName.remove (0,i+1);
  37.644 +
  37.645 +	// Forget the .vym (or .xml) for name of map
  37.646 +	mapName=fileName.left(fileName.findRev(".",-1,true) );
  37.647 +}
  37.648 +
  37.649 +QString MapEditor::getFilePath()
  37.650 +{
  37.651 +	return filePath;
  37.652 +}
  37.653 +
  37.654 +QString MapEditor::getFileName()
  37.655 +{
  37.656 +	return fileName;
  37.657 +}
  37.658 +
  37.659 +QString MapEditor::getMapName()
  37.660 +{
  37.661 +	return mapName;
  37.662 +}
  37.663 +
  37.664 +QString MapEditor::getDestPath()
  37.665 +{
  37.666 +	return destPath;
  37.667 +}
  37.668 +
  37.669 +int MapEditor::load (QString &fname, const LoadMode &lmode)
  37.670 +{
  37.671 +	// Finish open lineEdits
  37.672 +	if (lineedit) finishedLineEditNoSave();
  37.673 +
  37.674 +	int returnCode=0;
  37.675 +
  37.676 +	if (lmode==NewMap)
  37.677 +	{
  37.678 +		if (selection) selection->unselect();
  37.679 +		selection=NULL;
  37.680 +		mapCenter->clear();
  37.681 +		mapCenter->setMapEditor(this);
  37.682 +		// (map state is set later at end of load...)
  37.683 +	} else
  37.684 +	{
  37.685 +		setChanged();
  37.686 +		saveState(PartOfMap,selection);
  37.687 +	}	
  37.688 +	
  37.689 +    
  37.690 +    mapBuilderHandler handler;
  37.691 +	QFile file( fname );
  37.692 +
  37.693 +	// I am paranoid: file should exist anyway
  37.694 +	// according to check in mainwindow.
  37.695 +	if (!file.exists() )
  37.696 +	{
  37.697 +		QMessageBox::critical( 0, tr( "Critical Parse Error" ),
  37.698 +				   tr("Couldn't open map " +fname)+".");
  37.699 +		returnCode=1;	
  37.700 +	} else
  37.701 +	{
  37.702 +		blockreposition=true;
  37.703 +		QXmlInputSource source( file);
  37.704 +		QXmlSimpleReader reader;
  37.705 +		reader.setContentHandler( &handler );
  37.706 +		reader.setErrorHandler( &handler );
  37.707 +		handler.setMapEditor( this );
  37.708 +		handler.setTmpDir (filePath.left(filePath.findRev("/",-1)));	// needed to load files with rel. path
  37.709 +		handler.setLoadMode (lmode);
  37.710 +		bool ok = reader.parse( source );
  37.711 +		blockreposition=false;
  37.712 +		file.close();
  37.713 +		if ( ok ) 
  37.714 +		{
  37.715 +			mapCenter->reposition();
  37.716 +			adjustCanvasSize();
  37.717 +			if (lmode==NewMap)
  37.718 +			{
  37.719 +				mapDefault=false;
  37.720 +				mapChanged=false;
  37.721 +				mapUnsaved=false;
  37.722 +			}
  37.723 +		} else 
  37.724 +		{
  37.725 +			QMessageBox::critical( 0, tr( "Critical Parse Error" ),
  37.726 +					   tr( handler.errorProtocol() ) );
  37.727 +			// returnCode=1;	
  37.728 +			// Still return "success": the map maybe at least
  37.729 +			// partially read by the parser
  37.730 +		}	
  37.731 +	}	
  37.732 +	updateActions();
  37.733 +	return returnCode;
  37.734 +}
  37.735 +
  37.736 +int MapEditor::save (const SaveMode &savemode)
  37.737 +{
  37.738 +	// Finish open lineEdits
  37.739 +	if (lineedit) finishedLineEditNoSave();
  37.740 +
  37.741 +	int returnCode=0;
  37.742 +
  37.743 +	// Create mapName and fileDir
  37.744 +	makeSubDirs (fileDir);
  37.745 +	QString fname;
  37.746 +	if (saveZipped())
  37.747 +		// save as .xml
  37.748 +		fname=mapName+".xml";
  37.749 +	else
  37.750 +		// use name given by user, even if he chooses .doc
  37.751 +		fname=fileName;
  37.752 +
  37.753 +
  37.754 +	// Check if fname is writeable
  37.755 +	QFile file( fileDir+fname);
  37.756 +	if (!file.open( IO_WriteOnly ) ) 
  37.757 +	{
  37.758 +		QMessageBox::critical( 0, tr( "Critical Save Error" ),
  37.759 +					   tr("Couldn't write to ") +fileDir+fname);
  37.760 +		return 1;
  37.761 +	}	
  37.762 +	file.close();
  37.763 +
  37.764 +	QString saveFile;
  37.765 +	saveFile=saveToDir (fileDir,mapName+"-",true,QPoint(),savemode);
  37.766 +
  37.767 +	file.setName ( fileDir  + fname);
  37.768 +	if ( !file.open( IO_WriteOnly ) )
  37.769 +	{
  37.770 +		// This should neverever happen
  37.771 +		QMessageBox::critical(0, tr("Critcal save error"),"MapEditor::save() Couldn't open "+file.name());
  37.772 +		return 1;
  37.773 +	}	
  37.774 +
  37.775 +	// Write it finally, and write in UTF8, no matter what 
  37.776 +	QTextStream ts( &file );
  37.777 +	ts.setEncoding (QTextStream::UnicodeUTF8);
  37.778 +	ts << saveFile;
  37.779 +	file.close();
  37.780 +
  37.781 +	if (returnCode==0)
  37.782 +	{
  37.783 +		mapChanged=false;
  37.784 +		mapUnsaved=false;
  37.785 +		actionFileSave->setEnabled(false);
  37.786 +	}
  37.787 +
  37.788 +	return returnCode;
  37.789 +}
  37.790 +
  37.791 +void MapEditor::setZipped (bool z)
  37.792 +{
  37.793 +	zipped=z;
  37.794 +}
  37.795 +
  37.796 +bool MapEditor::saveZipped ()
  37.797 +{
  37.798 +	return zipped;
  37.799 +}
  37.800 +
  37.801 +void MapEditor::print()
  37.802 +{
  37.803 +	// Finish open lineEdits
  37.804 +	if (lineedit) finishedLineEditNoSave();
  37.805 +
  37.806 +	if ( !printer ) 
  37.807 +	{
  37.808 +		printer = new QPrinter;
  37.809 +		printer->setColorMode (QPrinter::Color);
  37.810 +	}
  37.811 +
  37.812 +	QRect totalBBox=mapCenter->getTotalBBox();
  37.813 +
  37.814 +	// Try to set orientation automagically
  37.815 +	// Note: Interpretation of generated postscript is amibiguous, if 
  37.816 +	// there are problems with landscape mode, see
  37.817 +	// http://sdb.suse.de/de/sdb/html/jsmeix_print-cups-landscape-81.html
  37.818 +
  37.819 +	if (totalBBox.width()>totalBBox.height())
  37.820 +		// recommend landscape
  37.821 +		printer->setOrientation (QPrinter::Landscape);
  37.822 +	else	
  37.823 +		// recommend portrait
  37.824 +		printer->setOrientation (QPrinter::Portrait);
  37.825 +
  37.826 +	if ( printer->setup(this) ) 
  37.827 +	// returns false, if printing is canceled
  37.828 +	{
  37.829 +		QPainter pp(printer);
  37.830 +
  37.831 +		// Don't print the visualisation of selection
  37.832 +		LinkableMapObj *oldselection=NULL;
  37.833 +		if (selection) 
  37.834 +		{
  37.835 +			oldselection=selection;
  37.836 +			selection->unselect();
  37.837 +		}
  37.838 +
  37.839 +		// Handle sizes of map and paper:
  37.840 +		//
  37.841 +		// setWindow defines which part of the canvas will be transformed 
  37.842 +		// setViewport defines area on paper in device coordinates (dpi)
  37.843 +		// e.g. (0,50,700,700) is upper part on A4
  37.844 +		// see also /usr/lib/qt3/doc/html/coordsys.html
  37.845 +
  37.846 +		QPaintDeviceMetrics metrics (printer);
  37.847 +
  37.848 +		double paperAspect = (double)metrics.width()   / (double)metrics.height();
  37.849 +		double   mapAspect = (double)totalBBox.width() / (double)totalBBox.height();
  37.850 +
  37.851 +		QRect mapRect=mapCenter->getTotalBBox();
  37.852 +		QCanvasRectangle *frame=NULL;
  37.853 +		QCanvasText *footerFN=NULL;
  37.854 +		QCanvasText *footerDate=NULL;
  37.855 +		if (printFrame || printFooter)
  37.856 +		{
  37.857 +			
  37.858 +			if (printFrame) 
  37.859 +			{
  37.860 +				// Print frame around map
  37.861 +				mapRect.setRect (mapRect.x()-10, mapRect.y()-10, 
  37.862 +					mapRect.width()+20, mapRect.height()+20);
  37.863 +				frame=new QCanvasRectangle (mapRect,mapCanvas);
  37.864 +				frame->setBrush (QColor(white));
  37.865 +				frame->setPen (QColor(black));
  37.866 +				frame->setZ(0);
  37.867 +				frame->show();    
  37.868 +			}		
  37.869 +			if (printFooter) 
  37.870 +			{
  37.871 +				// Print footer below map
  37.872 +				QFont font;		
  37.873 +				font.setPointSize(10);
  37.874 +				footerFN=new QCanvasText (mapCanvas);
  37.875 +				footerFN->setText ("VYM - " + fileName);
  37.876 +				footerFN->setFont(font);
  37.877 +				footerFN->move (mapRect.x(), mapRect.y() + mapRect.height() );
  37.878 +				footerFN->setZ(Z_TEXT);
  37.879 +				footerFN->show();    
  37.880 +				footerDate=new QCanvasText (mapCanvas);
  37.881 +				footerDate->setText (QDate::currentDate().toString(Qt::TextDate));
  37.882 +				footerDate->setFont(font);
  37.883 +				footerDate->move (mapRect.x()+mapRect.width()-footerDate->boundingRect().width(), mapRect.y() + mapRect.height() );
  37.884 +				footerDate->setZ(Z_TEXT);
  37.885 +				footerDate->show();    
  37.886 +				mapRect.setRect (mapRect.x(), mapRect.y(), 
  37.887 +					mapRect.width(), mapRect.height()+20);
  37.888 +			}
  37.889 +			pp.setWindow (mapRect.x(), mapRect.y(), mapRect.width(), mapRect.height());
  37.890 +		}	else	
  37.891 +		{
  37.892 +			pp.setWindow (mapRect);
  37.893 +		}	
  37.894 +
  37.895 +		if (mapAspect>=paperAspect)
  37.896 +		{
  37.897 +			// Fit horizontally to paper width
  37.898 +			pp.setViewport(0,0, metrics.width(),(int)(metrics.width()/mapAspect) );	
  37.899 +		}	else
  37.900 +		{
  37.901 +			// Fit vertically to paper height
  37.902 +			pp.setViewport(0,0,(int)(metrics.height()*mapAspect),metrics.height());	
  37.903 +		}	
  37.904 +
  37.905 +		mapCanvas->drawArea(mapRect, &pp);	// draw Canvas to printer
  37.906 +
  37.907 +		// Delete Frame and footer
  37.908 +		if (footerFN) 
  37.909 +		{
  37.910 +			delete (footerFN);
  37.911 +			delete (footerDate);
  37.912 +		}	
  37.913 +		if (frame)  delete (frame);
  37.914 +
  37.915 +		// Restore selection
  37.916 +		if (oldselection) 
  37.917 +		{
  37.918 +			selection=oldselection;
  37.919 +			selection->select();
  37.920 +		}	
  37.921 +	}
  37.922 +}
  37.923 +
  37.924 +QPixmap MapEditor::getPixmap()
  37.925 +{
  37.926 +	QRect mapRect=mapCenter->getTotalBBox();
  37.927 +	QPixmap pix (mapRect.size());
  37.928 +	QPainter pp (&pix);
  37.929 +
  37.930 +	// Don't print the visualisation of selection
  37.931 +	LinkableMapObj *oldselection=NULL;
  37.932 +	if (selection) 
  37.933 +	{
  37.934 +		oldselection=selection;
  37.935 +		selection->unselect();
  37.936 +	}
  37.937 +
  37.938 +	pp.setWindow (mapRect);
  37.939 +
  37.940 +	mapCanvas->drawArea(mapRect, &pp);	// draw Canvas to painter
  37.941 +
  37.942 +
  37.943 +	// Restore selection
  37.944 +	if (oldselection) 
  37.945 +	{
  37.946 +		selection=oldselection;
  37.947 +		selection->select();
  37.948 +	}	
  37.949 +	
  37.950 +	return pix;
  37.951 +}
  37.952 +
  37.953 +void MapEditor::exportImage(QString fn)
  37.954 +{
  37.955 +	// Finish open lineEdits
  37.956 +	if (lineedit) finishedLineEditNoSave();
  37.957 +
  37.958 +	QPixmap pix (getPixmap());
  37.959 +	pix.save(fn, "PNG");
  37.960 +}
  37.961 +
  37.962 +void MapEditor::exportImage(QString fn, int item)
  37.963 +{
  37.964 +	// Finish open lineEdits
  37.965 +	if (lineedit) finishedLineEditNoSave();
  37.966 +
  37.967 +	QPixmap pix (getPixmap());
  37.968 +	pix.save(fn, exportImageFormatMenu->text(item) );
  37.969 +}
  37.970 +
  37.971 +void MapEditor::exportASCII()
  37.972 +{
  37.973 +	// FIXME still experimental
  37.974 +	QFileDialog *fd=new QFileDialog( this, tr("VYM - Export (ASCII)"));
  37.975 +	fd->addFilter ("TXT (*.txt)");
  37.976 +	fd->setCaption("VYM - Export (ASCII) (still experimental)");
  37.977 +	fd->setMode( QFileDialog::AnyFile );
  37.978 +	fd->show();
  37.979 +
  37.980 +	if ( fd->exec() == QDialog::Accepted )
  37.981 +	{
  37.982 +		if (QFile (fd->selectedFile()).exists() )
  37.983 +		{
  37.984 +			QMessageBox mb( "VYM",
  37.985 +				tr("The file ") + fd->selectedFile() + 
  37.986 +				tr(" exists already. Do you want to overwrite it?"),
  37.987 +			QMessageBox::Warning,
  37.988 +			QMessageBox::Yes | QMessageBox::Default,
  37.989 +			QMessageBox::Cancel | QMessageBox::Escape,
  37.990 +			QMessageBox::NoButton );
  37.991 +
  37.992 +			mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
  37.993 +			mb.setButtonText( QMessageBox::No, tr("Cancel"));
  37.994 +			Export ex;
  37.995 +			switch( mb.exec() ) 
  37.996 +			{
  37.997 +				case QMessageBox::Yes:
  37.998 +					// save 
  37.999 +					if (!ex.setOutputDir ("out"))
 37.1000 +					{
 37.1001 +						QMessageBox::critical (0,tr("Critical Export Error "),tr("Couldn't create directory ") + "out");
 37.1002 +						return;
 37.1003 +					}
 37.1004 +					break;;
 37.1005 +				case QMessageBox::Cancel:
 37.1006 +					// do nothing
 37.1007 +					return;
 37.1008 +					break;
 37.1009 +			}
 37.1010 +		}
 37.1011 +		Export ex;
 37.1012 +		ex.setPath (fd->selectedFile() );
 37.1013 +		ex.setMapCenter(mapCenter);
 37.1014 +		ex.exportMap();
 37.1015 +	}
 37.1016 +}
 37.1017 +
 37.1018 +
 37.1019 +void MapEditor::exportXML(const QString &dir)
 37.1020 +{
 37.1021 +	// Create subdirectories
 37.1022 +	makeSubDirs (dir);
 37.1023 +
 37.1024 +	// write to directory
 37.1025 +	QString saveFile=saveToDir (dir,mapName+"-",true,mapCenter->getTotalBBox().topLeft() ,CompleteMap);
 37.1026 +	QFile file;
 37.1027 +
 37.1028 +	file.setName ( dir + "/"+mapName+".xml");
 37.1029 +	if ( !file.open( IO_WriteOnly ) )
 37.1030 +	{
 37.1031 +		// This should neverever happen
 37.1032 +		QMessageBox::critical (0,tr("Critical Export Error"),tr("MapEditor::exportXML couldn't open ")+file.name());
 37.1033 +		return;
 37.1034 +	}	
 37.1035 +
 37.1036 +	// Write it finally, and write in UTF8, no matter what 
 37.1037 +	QTextStream ts( &file );
 37.1038 +	ts.setEncoding (QTextStream::UnicodeUTF8);
 37.1039 +	ts << saveFile;
 37.1040 +	file.close();
 37.1041 +
 37.1042 +	// Now write image, too
 37.1043 +	exportImage (dir+"/images/"+mapName+".png");
 37.1044 +}
 37.1045 +
 37.1046 +void MapEditor::clear()
 37.1047 +{
 37.1048 +	if (selection)
 37.1049 +	{
 37.1050 +		selection->unselect();
 37.1051 +		selection=NULL;
 37.1052 +	}	
 37.1053 +
 37.1054 +	mapCenter->clear();
 37.1055 +}
 37.1056 +
 37.1057 +void MapEditor::undo()
 37.1058 +{
 37.1059 +	QDir d;
 37.1060 +	d.setPath(bakMapDir);
 37.1061 +	if (d.exists() )
 37.1062 +	{
 37.1063 +		// Finish open lineEdits
 37.1064 +		if (lineedit) finishedLineEditNoSave();
 37.1065 +
 37.1066 +		if (selection) 
 37.1067 +		{
 37.1068 +			selection->unselect();
 37.1069 +			selection=NULL;
 37.1070 +		}	
 37.1071 +		
 37.1072 +		mapBuilderHandler handler;
 37.1073 +		QXmlInputSource source;
 37.1074 +		source.setData(backupXML);
 37.1075 +		QXmlSimpleReader reader;
 37.1076 +		reader.setContentHandler( &handler );
 37.1077 +		reader.setErrorHandler( &handler );
 37.1078 +		handler.setMapEditor( this );
 37.1079 +		handler.setTmpDir ( bakMapDir );	// needed to load files with rel. path
 37.1080 +		if (undoSelection)
 37.1081 +		{
 37.1082 +			selection=undoSelection;
 37.1083 +			selection->select();
 37.1084 +			handler.setLoadMode (ImportReplace);
 37.1085 +
 37.1086 +		} else	
 37.1087 +		{
 37.1088 +			mapCenter->clear();
 37.1089 +			handler.setLoadMode (NewMap);
 37.1090 +		}	
 37.1091 +		blockreposition=true;
 37.1092 +		bool ok = reader.parse( source );
 37.1093 +		blockreposition=false;
 37.1094 +		if ( ok ) 
 37.1095 +			mapCenter->reposition();
 37.1096 +			
 37.1097 +		else 
 37.1098 +		{	
 37.1099 +			// This should never ever happen
 37.1100 +			QMessageBox::critical( 0, tr( "Critical Parse Error by reading backupFile" ),
 37.1101 +								   tr( handler.errorProtocol() )+" in "+backupXML );
 37.1102 +		}
 37.1103 +		// Undo not longer available now
 37.1104 +		actionEditUndo->setEnabled (false);
 37.1105 +		undoSelection=false;
 37.1106 +		mapChanged=false;
 37.1107 +		return;
 37.1108 +	} else	
 37.1109 +	{
 37.1110 +		QMessageBox::critical( 0, tr( "Critical Error" ),
 37.1111 +			"Temporary directory " +bakMapDir + 
 37.1112 +			tr (" used for undo is gone. \n"
 37.1113 +			"I will create a new one, but at the moment no undo is available.\n"
 37.1114 +			"Maybe you want to reload your original data.\n\n"
 37.1115 +			"Sorry for any inconveniences.") );
 37.1116 +		makeTmpDirs();	
 37.1117 +	}							
 37.1118 +}
 37.1119 +
 37.1120 +void MapEditor::copy()
 37.1121 +{
 37.1122 +	// Finish open lineEdits
 37.1123 +	if (lineedit) finishedLineEditNoSave();
 37.1124 +
 37.1125 +	if (selection) 
 37.1126 +	{
 37.1127 +		if (typeid(*selection) == typeid(BranchObj) ) 
 37.1128 +		{
 37.1129 +			BranchObj* to;
 37.1130 +			BranchObj* from;
 37.1131 +			clipboardME->clear();
 37.1132 +			clipboardME->getMapCenter()->addBranch();
 37.1133 +			to=clipboardME->getMapCenter()->getLastBranch();
 37.1134 +			if (to) 
 37.1135 +			{
 37.1136 +				from=(BranchObj*)(selection);
 37.1137 +				to->copy(from);
 37.1138 +
 37.1139 +				// keep position relative to parent
 37.1140 +				to->move2RelPos ( from->getRelPos());
 37.1141 +
 37.1142 +				// select data in clipboard
 37.1143 +				clipboardME->select ("bo:0");
 37.1144 +
 37.1145 +				// repositioning makes testing nicer,
 37.1146 +				// but is not needed usually:
 37.1147 +				if (clipboardME->isVisible())
 37.1148 +				{
 37.1149 +					clipboardME->getMapCenter()->reposition();  
 37.1150 +				}	
 37.1151 +				else
 37.1152 +					clipboardME->hide();
 37.1153 +			}
 37.1154 +		}    
 37.1155 +		if (typeid(*selection) == typeid(FloatImageObj) ) 
 37.1156 +		{
 37.1157 +			FloatImageObj* to;
 37.1158 +			FloatImageObj* from;
 37.1159 +			clipboardME->clear();
 37.1160 +			clipboardME->getMapCenter()->addFloatImage();
 37.1161 +			to=clipboardME->getMapCenter()->getLastFloatImage();
 37.1162 +			if (to) 
 37.1163 +			{
 37.1164 +				from=(FloatImageObj*)(selection);
 37.1165 +				to->copy(from);
 37.1166 +
 37.1167 +				// select data in clipboard
 37.1168 +				clipboardME->select ("fi:0");
 37.1169 +
 37.1170 +				// repositioning makes testing nicer,
 37.1171 +				// but is not needed usually:
 37.1172 +				if (clipboardME->isVisible())
 37.1173 +				{
 37.1174 +					clipboardME->getMapCenter()->reposition();  
 37.1175 +				}	
 37.1176 +				else
 37.1177 +					clipboardME->hide();
 37.1178 +			}
 37.1179 +		}    
 37.1180 +	}	    
 37.1181 +}
 37.1182 +
 37.1183 +LinkableMapObj* MapEditor::pasteNoSave()
 37.1184 +{
 37.1185 +	return pasteAtNoSave (-1);
 37.1186 +}
 37.1187 +
 37.1188 +LinkableMapObj* MapEditor::pasteAtNoSave(int pos)
 37.1189 +{
 37.1190 +	// Finish open lineEdits
 37.1191 +	if (lineedit) finishedLineEditNoSave();
 37.1192 +
 37.1193 +	LinkableMapObj *fromLMO=clipboardME->getSelection();
 37.1194 +	LinkableMapObj *returnLMO=NULL;
 37.1195 +
 37.1196 +	if (selection && fromLMO) 
 37.1197 +	{
 37.1198 +
 37.1199 +		if (typeid(*fromLMO) == typeid(BranchObj) ) 
 37.1200 +		{
 37.1201 +			if (typeid(*selection) == typeid(MapCenterObj)) 
 37.1202 +			{
 37.1203 +				returnLMO=mapCenter->addBranch( (BranchObj*)(fromLMO) );
 37.1204 +				((BranchObj*)(returnLMO))->move2RelPos(normalise(fromLMO->getRelPos() ) );
 37.1205 +			}     
 37.1206 +			if (typeid(*selection) == typeid(BranchObj)) 
 37.1207 +				if (pos<0)
 37.1208 +					returnLMO=((BranchObj*)(selection))->addBranch((BranchObj*)(fromLMO) );
 37.1209 +				else
 37.1210 +				{
 37.1211 +					BranchObj *par=(BranchObj*)(selection->getParObj());
 37.1212 +					if (par) returnLMO=par->insertBranch((BranchObj*)(fromLMO),pos );
 37.1213 +				}	
 37.1214 +		}
 37.1215 +		
 37.1216 +		if (typeid(*fromLMO) == typeid(FloatImageObj) &&
 37.1217 +			(typeid(*selection) == typeid (BranchObj) || 
 37.1218 +			 typeid(*selection)==typeid(MapCenterObj)) )
 37.1219 +			returnLMO=((BranchObj*) (selection))->addFloatImage ((FloatImageObj*)(fromLMO));
 37.1220 +		
 37.1221 +	}	    
 37.1222 +	return returnLMO;
 37.1223 +}
 37.1224 +
 37.1225 +void MapEditor::cutNoSave()
 37.1226 +{
 37.1227 +	// Finish open lineEdits
 37.1228 +	if (lineedit) finishedLineEditNoSave();
 37.1229 +
 37.1230 +	BranchObj* bo;
 37.1231 +	BranchObj* par; 
 37.1232 +	if (selection != NULL) {
 37.1233 +		if (typeid(*selection) == typeid(BranchObj) ) 
 37.1234 +		{
 37.1235 +			bo=(BranchObj*)(selection);
 37.1236 +			par=(BranchObj*)(bo->getParObj());
 37.1237 +			bo->unselect();
 37.1238 +			selection=NULL;
 37.1239 +			par->removeBranch(bo);
 37.1240 +			selection=par;
 37.1241 +			selection->select();
 37.1242 +		}
 37.1243 +		if (typeid(*selection) == typeid(FloatImageObj) ) 
 37.1244 +		{
 37.1245 +			FloatImageObj* fio=(FloatImageObj*)(selection);
 37.1246 +			par=(BranchObj*)(fio->getParObj());
 37.1247 +			fio->unselect();
 37.1248 +			selection=NULL;
 37.1249 +			par->removeFloatImage(fio);
 37.1250 +			selection=par;
 37.1251 +			selection->select();
 37.1252 +		}
 37.1253 +	}	    
 37.1254 +}
 37.1255 +
 37.1256 +void MapEditor::paste()
 37.1257 +{   
 37.1258 +	setChanged();
 37.1259 +	saveState(PartOfMap,selection);
 37.1260 +	pasteNoSave();
 37.1261 +	mapCenter->reposition();
 37.1262 +	adjustCanvasSize();
 37.1263 +}
 37.1264 +
 37.1265 +void MapEditor::cut()
 37.1266 +{
 37.1267 +	setChanged();
 37.1268 +	saveState(PartOfMap,selection->getParObj());
 37.1269 +	copy();
 37.1270 +	cutNoSave();
 37.1271 +	mapCenter->reposition();
 37.1272 +	adjustCanvasSize();
 37.1273 +}
 37.1274 +
 37.1275 +void MapEditor::moveBranchUp()
 37.1276 +{
 37.1277 +	// Finish open lineEdits
 37.1278 +	if (lineedit) finishedLineEditNoSave();
 37.1279 +
 37.1280 +	BranchObj* bo;
 37.1281 +	BranchObj* par;
 37.1282 +	if (typeid(*selection) == typeid(BranchObj)  ) 
 37.1283 +	{
 37.1284 +		setChanged();
 37.1285 +		saveState(PartOfMap,selection->getParObj());
 37.1286 +		bo=(BranchObj*)(selection);
 37.1287 +		par=(BranchObj*)(bo->getParObj());
 37.1288 +		selection->unselect();
 37.1289 +		selection=par->moveBranchUp (bo);
 37.1290 +		selection->select();
 37.1291 +		mapCenter->reposition();
 37.1292 +		ensureSelectionVisible();
 37.1293 +	}
 37.1294 +}
 37.1295 +
 37.1296 +void MapEditor::moveBranchDown()
 37.1297 +{
 37.1298 +	// Finish open lineEdits
 37.1299 +	if (lineedit) finishedLineEditNoSave();
 37.1300 +
 37.1301 +	BranchObj* bo;
 37.1302 +	BranchObj* par;
 37.1303 +	if (typeid(*selection) == typeid(BranchObj)  ) 
 37.1304 +	{
 37.1305 +		setChanged();
 37.1306 +		saveState(PartOfMap,selection->getParObj());
 37.1307 +		bo=(BranchObj*)(selection);
 37.1308 +		par=(BranchObj*)(bo->getParObj());
 37.1309 +		selection->unselect(); 
 37.1310 +		selection=par->moveBranchDown(bo);
 37.1311 +		selection->select();
 37.1312 +		mapCenter->reposition();
 37.1313 +		ensureSelectionVisible();
 37.1314 +	}	
 37.1315 +}
 37.1316 +
 37.1317 +void MapEditor::editHeading()
 37.1318 +{
 37.1319 +	// Finish open lineEdits
 37.1320 +	if (lineedit) finishedLineEditNoSave();
 37.1321 +
 37.1322 +	if (selection  &&  
 37.1323 +		 (typeid(*selection) == typeid(BranchObj) || 
 37.1324 +		  typeid(*selection) == typeid(MapCenterObj) ) ) 
 37.1325 +	{
 37.1326 +		setChanged();
 37.1327 +		saveState(PartOfMap,selection);
 37.1328 +
 37.1329 +		ensureSelectionVisible();
 37.1330 +		BranchObj *bo=(BranchObj*)(selection);
 37.1331 +		editingBO=(BranchObj*)(selection);
 37.1332 +		QPoint p = worldMatrix().map(QPoint (bo->x(),bo->y()));
 37.1333 +		lineedit->setGeometry(p.x()-contentsX(),p.y()-contentsY(),200,25);
 37.1334 +		QString s=bo->getHeading();
 37.1335 +		lineedit->setText(s);
 37.1336 +		lineedit->setCursorPosition(1);
 37.1337 +		if (actionSettingsAutoselectText->isOn() && !s.isEmpty() && actionSettingsPasteNewHeading->isOn() )
 37.1338 +			lineedit->selectAll();
 37.1339 +		lineedit->show();
 37.1340 +
 37.1341 +		lineedit->grabKeyboard();
 37.1342 +		lineedit->setFocus();
 37.1343 +	}				
 37.1344 +}
 37.1345 +
 37.1346 +
 37.1347 +void MapEditor::addNewBranch(int pos)
 37.1348 +{
 37.1349 +	// Finish open lineEdits
 37.1350 +	if (lineedit) finishedLineEditNoSave();
 37.1351 +
 37.1352 +	if (selection  &&  
 37.1353 +		 (typeid(*selection) == typeid(BranchObj) || 
 37.1354 +		  typeid(*selection) == typeid(MapCenterObj) ) ) 
 37.1355 +	{
 37.1356 +		setChanged();
 37.1357 +		saveState(PartOfMap,selection);
 37.1358 +
 37.1359 +		BranchObj* bo1 = (BranchObj*) (selection);
 37.1360 +		bool wasScrolled=false;
 37.1361 +		BranchObj *newbo=NULL;
 37.1362 +		if (pos==0)
 37.1363 +		{
 37.1364 +			// save scroll state. If scrolled, automatically select
 37.1365 +			// new branch in order to tmp unscroll parent...
 37.1366 +			wasScrolled=bo1->isScrolled();
 37.1367 +			newbo=bo1->addBranch();
 37.1368 +		}	else 
 37.1369 +		{
 37.1370 +			BranchObj *parbo=(BranchObj*)(selection->getParObj());
 37.1371 +			if (parbo)
 37.1372 +			{
 37.1373 +				if (pos<0)
 37.1374 +					// add above selection
 37.1375 +					newbo=parbo->insertBranch(bo1->getNum());
 37.1376 +				else
 37.1377 +					// add below selection
 37.1378 +					newbo=parbo->insertBranch(bo1->getNum()+1);
 37.1379 +			} else
 37.1380 +				// This should not happen...
 37.1381 +				return;
 37.1382 +			
 37.1383 +		}	
 37.1384 +
 37.1385 +		LinkableMapObj *oldselection=selection;
 37.1386 +
 37.1387 +		mapCenter->reposition();
 37.1388 +		adjustCanvasSize();
 37.1389 +		if (actionSettingsAutoedit->isOn() ||
 37.1390 +			actionSettingsAutoselectHeading->isOn() )
 37.1391 +		{
 37.1392 +			selection->unselect();
 37.1393 +			selection=newbo;
 37.1394 +			selection->select();
 37.1395 +			if (actionSettingsPasteNewHeading->isOn() )
 37.1396 +			{
 37.1397 +				BranchObj *bo2= (BranchObj*)(selection);
 37.1398 +				bo2->setHeading("");
 37.1399 +			}	
 37.1400 +			if (actionSettingsAutoedit->isOn() )
 37.1401 +				editHeading();
 37.1402 +			if (!actionSettingsAutoselectHeading->isOn()
 37.1403 +				&& !wasScrolled)
 37.1404 +			{
 37.1405 +				selection->unselect();
 37.1406 +				selection=oldselection;
 37.1407 +				selection->select();
 37.1408 +			}
 37.1409 +		}	
 37.1410 +	}	
 37.1411 +}
 37.1412 +
 37.1413 +void MapEditor::deleteSelection()
 37.1414 +{
 37.1415 +	// Finish open lineEdits
 37.1416 +	if (lineedit) finishedLineEditNoSave();
 37.1417 +
 37.1418 +	if (selection  && typeid(*selection) ==typeid(BranchObj) ) 
 37.1419 +	{
 37.1420 +		setChanged();
 37.1421 +		saveState(PartOfMap,selection->getParObj());
 37.1422 +		BranchObj* bo=dynamic_cast <BranchObj*> (selection);
 37.1423 +		BranchObj* par=(BranchObj*)(bo->getParObj());
 37.1424 +		bo->unselect();
 37.1425 +		selection=NULL;
 37.1426 +		par->removeBranch(bo);
 37.1427 +		selection=par;
 37.1428 +		selection->select();
 37.1429 +		ensureSelectionVisible();
 37.1430 +		mapCenter->reposition();
 37.1431 +		adjustCanvasSize();
 37.1432 +	}
 37.1433 +	if (selection  && typeid(*selection) ==typeid(FloatImageObj) ) 
 37.1434 +	{
 37.1435 +		setChanged();
 37.1436 +		saveState(PartOfMap,selection->getParObj());
 37.1437 +		FloatImageObj* fio=dynamic_cast <FloatImageObj*> (selection);
 37.1438 +		BranchObj* par=(BranchObj*)(fio->getParObj());
 37.1439 +		fio->unselect();
 37.1440 +		selection=NULL;
 37.1441 +		par->removeFloatImage(fio);
 37.1442 +		selection=par;
 37.1443 +		selection->select();
 37.1444 +		ensureSelectionVisible();
 37.1445 +		mapCenter->reposition();
 37.1446 +		adjustCanvasSize();
 37.1447 +	}
 37.1448 +}
 37.1449 +
 37.1450 +LinkableMapObj* MapEditor::getSelection()
 37.1451 +{
 37.1452 +	return selection;
 37.1453 +}
 37.1454 +
 37.1455 +bool MapEditor::select (QString s)
 37.1456 +{
 37.1457 +	LinkableMapObj *lmo=mapCenter;
 37.1458 +	QString part;
 37.1459 +	QString typ;
 37.1460 +	QString num;
 37.1461 +	while (!s.isEmpty() )
 37.1462 +	{
 37.1463 +		part=s.section(",",0,0);
 37.1464 +		typ=part.left (3);
 37.1465 +		num=part.right(part.length() - 3);
 37.1466 +		
 37.1467 +		if (typ=="mc:")
 37.1468 +		{
 37.1469 +			if (num=="")
 37.1470 +				break;
 37.1471 +			else
 37.1472 +				lmo=mapCenter->getBranchNum (num.toUInt());
 37.1473 +		} else
 37.1474 +			if (typ=="bo:")
 37.1475 +				lmo=((BranchObj*)(lmo))->getBranchNum (num.toUInt());
 37.1476 +			else
 37.1477 +				if (typ=="fi:")
 37.1478 +					lmo=((BranchObj*)(lmo))->getFloatImageNum (num.toUInt());
 37.1479 +				
 37.1480 +		
 37.1481 +		
 37.1482 +		if (!lmo) break;
 37.1483 +		
 37.1484 +		if (s.contains(","))
 37.1485 +			s=s.right(s.length() - part.length() -1 );
 37.1486 +		else	
 37.1487 +			break;
 37.1488 +	}
 37.1489 +
 37.1490 +	// Finally select the found object
 37.1491 +	if (lmo)
 37.1492 +	{
 37.1493 +		if (selection) selection->unselect();
 37.1494 +		selection=lmo;
 37.1495 +		selection->select();
 37.1496 +		adjustCanvasSize();
 37.1497 +		ensureSelectionVisible();
 37.1498 +		return true;
 37.1499 +	} else
 37.1500 +		return false;
 37.1501 +	
 37.1502 +	
 37.1503 +}
 37.1504 +
 37.1505 +void MapEditor::unselect()
 37.1506 +{
 37.1507 +	if (selection) 
 37.1508 +	{
 37.1509 +		selectionLast=selection;
 37.1510 +		selection->unselect();
 37.1511 +		selection=NULL;
 37.1512 +	}
 37.1513 +}	
 37.1514 +
 37.1515 +void MapEditor::reselect()
 37.1516 +{
 37.1517 +	if (selectionLast)
 37.1518 +	{
 37.1519 +		selection=selectionLast;
 37.1520 +		selection->select();
 37.1521 +		selectionLast=NULL;
 37.1522 +	}
 37.1523 +}	
 37.1524 +
 37.1525 +void MapEditor::selectNextBranch()
 37.1526 +{
 37.1527 +	// Increase number of branch
 37.1528 +	if (selection)
 37.1529 +	{
 37.1530 +		QString s=selection->getSelectString();
 37.1531 +		QString part;
 37.1532 +		QString typ;
 37.1533 +		QString num;
 37.1534 +
 37.1535 +		// Where am I? 
 37.1536 +		part=s.section(",",-1);
 37.1537 +		typ=part.left (3);
 37.1538 +		num=part.right(part.length() - 3);
 37.1539 +
 37.1540 +		s=s.left (s.length() -num.length());
 37.1541 +
 37.1542 +		// Go to next lmo
 37.1543 +		num=QString ("%1").arg(num.toUInt()+1);
 37.1544 +
 37.1545 +		s=s+num;
 37.1546 +		
 37.1547 +		// Try to select this one
 37.1548 +		if (select (s)) return;
 37.1549 +
 37.1550 +		// We have no direct successor, 
 37.1551 +		// try to increase the parental number in order to
 37.1552 +		// find a successor with same depth
 37.1553 +
 37.1554 +		int d=selection->getDepth();
 37.1555 +		int oldDepth=d;
 37.1556 +		int i;
 37.1557 +		bool found=false;
 37.1558 +		bool b;
 37.1559 +		while (!found && d>0)
 37.1560 +		{
 37.1561 +			s=s.section (",",0,d-1);
 37.1562 +			// replace substring of current depth in s with "1"
 37.1563 +			part=s.section(",",-1);
 37.1564 +			typ=part.left (3);
 37.1565 +			num=part.right(part.length() - 3);
 37.1566 +
 37.1567 +			if (d>1)
 37.1568 +			{	
 37.1569 +				// increase number of parent
 37.1570 +				num=QString ("%1").arg(num.toUInt()+1);
 37.1571 +				s=s.section (",",0,d-2) + ","+ typ+num;
 37.1572 +			} else
 37.1573 +			{
 37.1574 +				// Special case, look at orientation
 37.1575 +				if (selection->getOrientation()==OrientRightOfCenter)
 37.1576 +					num=QString ("%1").arg(num.toUInt()+1);
 37.1577 +				else	
 37.1578 +					num=QString ("%1").arg(num.toUInt()-1);
 37.1579 +				s=typ+num;
 37.1580 +			}	
 37.1581 +
 37.1582 +			if (select (s))
 37.1583 +				// pad to oldDepth, select the first branch for each depth
 37.1584 +				for (i=d;i<oldDepth;i++)
 37.1585 +				{
 37.1586 +					b=select (s);
 37.1587 +					if (b)
 37.1588 +					{	
 37.1589 +						if ( ((BranchObj*)(selection))->countBranches()>0)
 37.1590 +							s+=",bo:0";
 37.1591 +						else	
 37.1592 +							break;
 37.1593 +					} else
 37.1594 +						break;
 37.1595 +				}	
 37.1596 +
 37.1597 +			// try to select the freshly built string
 37.1598 +			found=select(s);
 37.1599 +			d--;
 37.1600 +		}
 37.1601 +		return;
 37.1602 +	}	
 37.1603 +}
 37.1604 +
 37.1605 +void MapEditor::selectPrevBranch()
 37.1606 +{
 37.1607 +	// Decrease number of branch
 37.1608 +	if (selection)
 37.1609 +	{
 37.1610 +		QString s=selection->getSelectString();
 37.1611 +		QString part;
 37.1612 +		QString typ;
 37.1613 +		QString num;
 37.1614 +
 37.1615 +		// Where am I? 
 37.1616 +		part=s.section(",",-1);
 37.1617 +		typ=part.left (3);
 37.1618 +		num=part.right(part.length() - 3);
 37.1619 +
 37.1620 +		s=s.left (s.length() -num.length());
 37.1621 +
 37.1622 +		// Go to next lmo
 37.1623 +		num=QString ("%1").arg(num.toUInt()-1);
 37.1624 +
 37.1625 +		s=s+num;
 37.1626 +		
 37.1627 +		// Try to select this one
 37.1628 +		if (select (s)) return;
 37.1629 +
 37.1630 +		// We have no direct precessor, 
 37.1631 +		// try to decrease the parental number in order to
 37.1632 +		// find a precessor with same depth
 37.1633 +
 37.1634 +		int d=selection->getDepth();
 37.1635 +		int oldDepth=d;
 37.1636 +		int i;
 37.1637 +		bool found=false;
 37.1638 +		bool b;
 37.1639 +		while (!found && d>0)
 37.1640 +		{
 37.1641 +			s=s.section (",",0,d-1);
 37.1642 +			// replace substring of current depth in s with "1"
 37.1643 +			part=s.section(",",-1);
 37.1644 +			typ=part.left (3);
 37.1645 +			num=part.right(part.length() - 3);
 37.1646 +
 37.1647 +			if (d>1)
 37.1648 +			{
 37.1649 +				// decrease number of parent
 37.1650 +				num=QString ("%1").arg(num.toUInt()-1);
 37.1651 +				s=s.section (",",0,d-2) + ","+ typ+num;
 37.1652 +			} else
 37.1653 +			{
 37.1654 +				// Special case, look at orientation
 37.1655 +				if (selection->getOrientation()==OrientRightOfCenter)
 37.1656 +					num=QString ("%1").arg(num.toUInt()-1);
 37.1657 +				else	
 37.1658 +					num=QString ("%1").arg(num.toUInt()+1);
 37.1659 +				s=typ+num;
 37.1660 +			}	
 37.1661 +
 37.1662 +			if (select(s))
 37.1663 +				// pad to oldDepth, select the last branch for each depth
 37.1664 +				for (i=d;i<oldDepth;i++)
 37.1665 +				{
 37.1666 +					b=select (s);
 37.1667 +					if (b)
 37.1668 +						if ( ((BranchObj*)(selection))->countBranches()>0)
 37.1669 +							s+=",bo:"+ QString ("%1").arg( ((BranchObj*)(selection))->countBranches()-1 );
 37.1670 +						else	
 37.1671 +							break;
 37.1672 +					else
 37.1673 +						break;
 37.1674 +				}	
 37.1675 +			
 37.1676 +			// try to select the freshly built string
 37.1677 +			found=select(s);
 37.1678 +			d--;
 37.1679 +		}
 37.1680 +		return;
 37.1681 +	}	
 37.1682 +}
 37.1683 +
 37.1684 +void MapEditor::selectUpperBranch()
 37.1685 +{
 37.1686 +	// Finish open lineEdits
 37.1687 +	if (lineedit) finishedLineEditNoSave();
 37.1688 +
 37.1689 +	if (selection) 
 37.1690 +	{
 37.1691 +		if (typeid(*selection) == typeid(BranchObj))
 37.1692 +		{
 37.1693 +			if (selection->getOrientation()==OrientRightOfCenter)
 37.1694 +				selectPrevBranch();
 37.1695 +			else
 37.1696 +				if (selection->getDepth()==1)
 37.1697 +					selectNextBranch();
 37.1698 +				else
 37.1699 +					selectPrevBranch();
 37.1700 +		}		
 37.1701 +	}
 37.1702 +}
 37.1703 +
 37.1704 +void MapEditor::selectLowerBranch()
 37.1705 +{
 37.1706 +	// Finish open lineEdits
 37.1707 +	if (lineedit) finishedLineEditNoSave();
 37.1708 +
 37.1709 +	if (selection) 
 37.1710 +	{
 37.1711 +		if (typeid(*selection) == typeid(BranchObj))
 37.1712 +		{
 37.1713 +			if (selection->getOrientation()==OrientRightOfCenter)
 37.1714 +				selectNextBranch();
 37.1715 +			else
 37.1716 +				if (selection->getDepth()==1)
 37.1717 +					selectPrevBranch();
 37.1718 +				else
 37.1719 +					selectNextBranch();
 37.1720 +		}		
 37.1721 +	}
 37.1722 +}
 37.1723 +
 37.1724 +
 37.1725 +void MapEditor::selectLeftBranch()
 37.1726 +{
 37.1727 +	// Finish open lineEdits
 37.1728 +	if (lineedit) finishedLineEditNoSave();
 37.1729 +
 37.1730 +	BranchObj* bo;
 37.1731 +	BranchObj* par;
 37.1732 +	if (selection) 
 37.1733 +	{
 37.1734 +		if (typeid(*selection) == typeid(MapCenterObj))
 37.1735 +		{
 37.1736 +			par=  (BranchObj*) (selection);
 37.1737 +			bo=par->getLastSelectedBranch();
 37.1738 +			if (bo)
 37.1739 +			{
 37.1740 +				// Workaround for reselecting on left and right side
 37.1741 +				if (bo->getOrientation()==OrientRightOfCenter)
 37.1742 +				{
 37.1743 +					bo=par->getLastBranch();
 37.1744 +				}	
 37.1745 +				if (bo)
 37.1746 +				{
 37.1747 +					par->unselect();
 37.1748 +					selection=bo;
 37.1749 +					selection->select();
 37.1750 +					adjustCanvasSize();
 37.1751 +					ensureSelectionVisible();
 37.1752 +				}
 37.1753 +			}	
 37.1754 +		} else
 37.1755 +		{
 37.1756 +			par=(BranchObj*)(selection->getParObj());
 37.1757 +			if (selection->getOrientation()==OrientRightOfCenter)
 37.1758 +			{
 37.1759 +				if (typeid(*selection) == typeid(BranchObj) ||
 37.1760 +					typeid(*selection) == typeid(FloatImageObj))
 37.1761 +				{
 37.1762 +					selection->unselect();
 37.1763 +					selection=par;
 37.1764 +					selection->select();
 37.1765 +					adjustCanvasSize();
 37.1766 +					ensureSelectionVisible();
 37.1767 +				}
 37.1768 +			} else
 37.1769 +			{
 37.1770 +				if (typeid(*selection) == typeid(BranchObj) )
 37.1771 +				{
 37.1772 +					bo=((BranchObj*)(selection))->getLastSelectedBranch();
 37.1773 +					if (bo) 
 37.1774 +					{
 37.1775 +						selection->unselect();
 37.1776 +						selection=bo;
 37.1777 +						selection->select();
 37.1778 +						adjustCanvasSize();
 37.1779 +						ensureSelectionVisible();
 37.1780 +					}
 37.1781 +				}
 37.1782 +			}
 37.1783 +		}	
 37.1784 +	}
 37.1785 +}
 37.1786 +
 37.1787 +void MapEditor::selectRightBranch()
 37.1788 +{
 37.1789 +	// Finish open lineEdits
 37.1790 +	if (lineedit) finishedLineEditNoSave();
 37.1791 +
 37.1792 +	BranchObj* bo;
 37.1793 +	BranchObj* par;
 37.1794 +
 37.1795 +	if (selection) 
 37.1796 +	{
 37.1797 +		if (typeid(*selection) == typeid(MapCenterObj))
 37.1798 +		{
 37.1799 +			par=  (BranchObj*) (selection);
 37.1800 +			bo=par->getLastSelectedBranch();
 37.1801 +			if (bo)
 37.1802 +			{
 37.1803 +				// Workaround for relecting on left and right side
 37.1804 +				if (bo->getOrientation()==OrientLeftOfCenter)
 37.1805 +					bo=par->getFirstBranch();
 37.1806 +				if (bo)
 37.1807 +				{
 37.1808 +					par->unselect();
 37.1809 +					selection=bo;
 37.1810 +					selection->select();
 37.1811 +					ensureSelectionVisible();
 37.1812 +				}
 37.1813 +			}
 37.1814 +		} else
 37.1815 +		{
 37.1816 +			par=(BranchObj*)(selection->getParObj());
 37.1817 +			if (selection->getOrientation()==OrientLeftOfCenter)
 37.1818 +			{
 37.1819 +				if (typeid(*selection) == typeid(BranchObj) ||
 37.1820 +					typeid(*selection) == typeid(FloatImageObj))
 37.1821 +				{
 37.1822 +					selection->unselect();
 37.1823 +					selection=par;
 37.1824 +					selection->select();
 37.1825 +					adjustCanvasSize();
 37.1826 +					ensureSelectionVisible();
 37.1827 +				}
 37.1828 +			} else
 37.1829 +			{
 37.1830 +				if (typeid(*selection) == typeid(BranchObj) )
 37.1831 +				{
 37.1832 +					bo=((BranchObj*)(selection))->getLastSelectedBranch();
 37.1833 +					if (bo) 
 37.1834 +					{
 37.1835 +						selection->unselect();
 37.1836 +						selection=bo;
 37.1837 +						selection->select();
 37.1838 +						adjustCanvasSize();
 37.1839 +						ensureSelectionVisible();
 37.1840 +					}
 37.1841 +				}
 37.1842 +			}
 37.1843 +		}
 37.1844 +	}
 37.1845 +}
 37.1846 +
 37.1847 +void MapEditor::selectFirstBranch()
 37.1848 +{
 37.1849 +	// Finish open lineEdits
 37.1850 +	if (lineedit) finishedLineEditNoSave();
 37.1851 +
 37.1852 +	BranchObj *bo1;
 37.1853 +	BranchObj *bo2;
 37.1854 +	BranchObj* par;
 37.1855 +	if (selection) {
 37.1856 +		if (typeid(*selection) == typeid(BranchObj))
 37.1857 +		{
 37.1858 +			bo1=  (BranchObj*) (selection);
 37.1859 +			par=(BranchObj*)(bo1->getParObj());
 37.1860 +			bo2=par->getFirstBranch();
 37.1861 +			if (bo2) {
 37.1862 +				bo1->unselect();
 37.1863 +				selection=bo2;
 37.1864 +				selection->select();
 37.1865 +				ensureSelectionVisible();
 37.1866 +			}
 37.1867 +		}		
 37.1868 +		adjustCanvasSize();
 37.1869 +	}
 37.1870 +}
 37.1871 +
 37.1872 +void MapEditor::selectLastBranch()
 37.1873 +{
 37.1874 +	// Finish open lineEdits
 37.1875 +	if (lineedit) finishedLineEditNoSave();
 37.1876 +
 37.1877 +	BranchObj *bo1;
 37.1878 +	BranchObj *bo2;
 37.1879 +	BranchObj* par;
 37.1880 +	if (selection) {
 37.1881 +		if (typeid(*selection) == typeid(BranchObj))
 37.1882 +		{
 37.1883 +			bo1=  (BranchObj*) (selection);
 37.1884 +			par=(BranchObj*)(bo1->getParObj());
 37.1885 +			bo2=par->getLastBranch();
 37.1886 +			if (bo2) {
 37.1887 +				bo1->unselect();
 37.1888 +				selection=bo2;
 37.1889 +				selection->select();
 37.1890 +				ensureSelectionVisible();
 37.1891 +			}
 37.1892 +		}		
 37.1893 +		adjustCanvasSize();
 37.1894 +	}
 37.1895 +}
 37.1896 +
 37.1897 +void MapEditor::setColor(QColor c)
 37.1898 +{
 37.1899 +	actColor=c;
 37.1900 +}
 37.1901 +
 37.1902 +void MapEditor::selectBackgroundColor()
 37.1903 +{
 37.1904 +	// Finish open lineEdits
 37.1905 +	if (lineedit) finishedLineEditNoSave();
 37.1906 +
 37.1907 +	QColor col = QColorDialog::getColor( mapCanvas->backgroundColor(), this );
 37.1908 +	if ( !col.isValid() ) return;
 37.1909 +	setBackgroundColor( col );
 37.1910 +	setChanged();
 37.1911 +}
 37.1912 +
 37.1913 +void MapEditor::setBackgroundColor(QColor c)
 37.1914 +{
 37.1915 +	mapCanvas->setBackgroundColor (c);
 37.1916 +}
 37.1917 +
 37.1918 +QColor MapEditor::pickColor()
 37.1919 +{
 37.1920 +	if (selection) 
 37.1921 +	{
 37.1922 +		if (typeid(*selection) == typeid(BranchObj) ||
 37.1923 +			typeid(*selection) == typeid(MapCenterObj))
 37.1924 +		{
 37.1925 +			BranchObj *bo=(BranchObj*)(selection);
 37.1926 +			actColor=bo->getColor(); 
 37.1927 +		}    
 37.1928 +	}
 37.1929 +	return actColor;
 37.1930 +}
 37.1931 +
 37.1932 +void MapEditor::colorItem()
 37.1933 +{
 37.1934 +	if (selection) 
 37.1935 +	{
 37.1936 +		if (typeid(*selection) == typeid(BranchObj) ||
 37.1937 +			typeid(*selection) == typeid(MapCenterObj))
 37.1938 +		{
 37.1939 +			setChanged();
 37.1940 +			saveState(PartOfMap,selection);
 37.1941 +			BranchObj *bo=(BranchObj*)(selection);
 37.1942 +			bo->setColor(actColor, false); // color links, color childs
 37.1943 +		}    
 37.1944 +	}
 37.1945 +}
 37.1946 +
 37.1947 +void MapEditor::colorBranch()
 37.1948 +{
 37.1949 +	if (selection) 
 37.1950 +	{
 37.1951 +		if (typeid(*selection) == typeid(BranchObj) ||
 37.1952 +			typeid(*selection) == typeid(MapCenterObj))
 37.1953 +		{
 37.1954 +			setChanged();
 37.1955 +			saveState(PartOfMap,selection);
 37.1956 +			BranchObj *bo=(BranchObj*)(selection);
 37.1957 +			bo->setColor(actColor, true); // color links, color childs
 37.1958 +		}    
 37.1959 +	}
 37.1960 +}
 37.1961 +
 37.1962 +
 37.1963 +void MapEditor::toggleStandardFlag(QString f)
 37.1964 +{
 37.1965 +	if (selection)
 37.1966 +	{
 37.1967 +		setChanged();
 37.1968 +		saveState(PartOfMap,selection);	
 37.1969 +		((BranchObj*)(selection))->toggleStandardFlag (f);
 37.1970 +	}	
 37.1971 +}
 37.1972 +
 37.1973 +void MapEditor::setViewCenter()
 37.1974 +{
 37.1975 +	// transform to CanvasView Coord:
 37.1976 +	QPoint p=worldMatrix().map(movingCenter);
 37.1977 +	center ( p.x(), p.y());
 37.1978 +}
 37.1979 +
 37.1980 +
 37.1981 +BranchObj* MapEditor::findText (QString s, bool cs)
 37.1982 +{
 37.1983 +	if (!itFind) 
 37.1984 +	{	// Nothing found or new find process
 37.1985 +		if (EOFind)
 37.1986 +			// nothing found, start again
 37.1987 +			EOFind=false;
 37.1988 +		itFind=mapCenter->first();
 37.1989 +	}	
 37.1990 +	bool searching=true;
 37.1991 +	bool foundNote=false;
 37.1992 +	while (searching && !EOFind)
 37.1993 +	{
 37.1994 +		if (itFind)
 37.1995 +		{
 37.1996 +			// Searching in Note
 37.1997 +			if (itFind->getNote().contains(s,cs))
 37.1998 +			{
 37.1999 +				if (selection!=itFind) 
 37.2000 +				{
 37.2001 +					if (selection) ((BranchObj*)(selection))->unselect();
 37.2002 +					selection=itFind;
 37.2003 +					selection->select();
 37.2004 +					adjustCanvasSize();
 37.2005 +					ensureSelectionVisible();
 37.2006 +				}
 37.2007 +				if (textEditor->findText(s,cs)) 
 37.2008 +				{
 37.2009 +					searching=false;
 37.2010 +					foundNote=true;
 37.2011 +				}	
 37.2012 +			}
 37.2013 +			// Searching in Heading
 37.2014 +			if (searching && itFind->getHeading().contains (s,cs) ) 
 37.2015 +			{
 37.2016 +				if (selection) ((BranchObj*)(selection))->unselect();
 37.2017 +				selection=itFind;
 37.2018 +				selection->select();
 37.2019 +				adjustCanvasSize();
 37.2020 +				ensureSelectionVisible();
 37.2021 +				searching=false;
 37.2022 +			}
 37.2023 +		}	
 37.2024 +		if (!foundNote)
 37.2025 +		{
 37.2026 +			itFind=itFind->next();
 37.2027 +			if (!itFind) EOFind=true;
 37.2028 +		}
 37.2029 +	}	
 37.2030 +	if (!searching)
 37.2031 +	{
 37.2032 +		adjustCanvasSize();
 37.2033 +		return (BranchObj*)(selection);
 37.2034 +	}	else
 37.2035 +		return NULL;
 37.2036 +}
 37.2037 +
 37.2038 +void MapEditor::findReset()
 37.2039 +{	// Necessary if text to find changes during a find process
 37.2040 +	itFind=NULL;
 37.2041 +	EOFind=false;
 37.2042 +}
 37.2043 +
 37.2044 +void MapEditor::openURL()
 37.2045 +{
 37.2046 +	if (selection )
 37.2047 +	{
 37.2048 +		if (typeid(*selection) == typeid(BranchObj) ||
 37.2049 +			typeid(*selection) == typeid(MapCenterObj))
 37.2050 +		{
 37.2051 +			QString url=((BranchObj*)(selection))->getURL();
 37.2052 +
 37.2053 +			QProcess *proc = new QProcess( this );
 37.2054 +
 37.2055 +#if !defined(Q_OS_MACX)
 37.2056 +			proc->addArgument( settings.readEntry("/vym/mainwindow/readerURL","konqueror" ));
 37.2057 +#else			
 37.2058 +			proc->addArgument( settings.readEntry("/vym/mainwindow/readerURL",
 37.2059 +				"/Applications/Safari.app/Contents/MacOS/Safari" ));
 37.2060 +#endif			
 37.2061 +
 37.2062 +			proc->addArgument( url);
 37.2063 +
 37.2064 +			if ( !proc->start() ) 
 37.2065 +				// error handling
 37.2066 +				if (mainWindow->settingsURL() ) 
 37.2067 +					openURL();
 37.2068 +		}	
 37.2069 +	}	
 37.2070 +}
 37.2071 +
 37.2072 +void MapEditor::editURL()
 37.2073 +{
 37.2074 +	if (selection && (typeid(*selection) == typeid(BranchObj) ||
 37.2075 +			typeid(*selection) == typeid(MapCenterObj)) )
 37.2076 +	{		
 37.2077 +		bool ok;
 37.2078 +		QString text = QInputDialog::getText(
 37.2079 +				"VYM", tr("Enter URL:"), QLineEdit::Normal,
 37.2080 +				((BranchObj*)(selection))->getURL(), &ok, this );
 37.2081 +		if ( ok) 
 37.2082 +		{
 37.2083 +			// user entered something and pressed OK
 37.2084 +			((BranchObj*)(selection))->setURL (text);
 37.2085 +			updateActions();
 37.2086 +			setChanged();
 37.2087 +		}	
 37.2088 +	}
 37.2089 +}
 37.2090 +
 37.2091 +void MapEditor::editHeading2URL()
 37.2092 +{
 37.2093 +	if (selection && (typeid(*selection) == typeid(BranchObj) ||
 37.2094 +			typeid(*selection) == typeid(MapCenterObj)) )
 37.2095 +	{		
 37.2096 +		BranchObj *b=(BranchObj*)(selection);
 37.2097 +		b->setURL (b->getHeading());
 37.2098 +		updateActions();
 37.2099 +		setChanged();
 37.2100 +	}
 37.2101 +}	
 37.2102 +
 37.2103 +void MapEditor::editBugzilla2URL()
 37.2104 +{
 37.2105 +	if (selection && (typeid(*selection) == typeid(BranchObj) ||
 37.2106 +			typeid(*selection) == typeid(MapCenterObj)) )
 37.2107 +	{		
 37.2108 +		BranchObj *b=(BranchObj*)(selection);
 37.2109 +		b->setURL ("http://bugzilla.suse.de/show_bug.cgi?id="+b->getHeading());
 37.2110 +		updateActions();
 37.2111 +		setChanged();
 37.2112 +	}
 37.2113 +}	
 37.2114 +
 37.2115 +void MapEditor::editVymLink()
 37.2116 +{
 37.2117 +	if (selection && (typeid(*selection) == typeid(BranchObj) ||
 37.2118 +			typeid(*selection) == typeid(MapCenterObj)) )
 37.2119 +	{		
 37.2120 +		QFileDialog *fd=new QFileDialog( this,tr("VYM - Link to another map"));
 37.2121 +		fd->addFilter (QString (tr("vym map") + " (*.vym)"));
 37.2122 +		fd->setCaption(tr("VYM - Link to another map"));
 37.2123 +		if (! ((BranchObj*)(selection))->getVymLink().isEmpty() )
 37.2124 +			fd->setSelection( ((BranchObj*)(selection))->getVymLink() );
 37.2125 +		fd->show();
 37.2126 +
 37.2127 +		QString fn;
 37.2128 +		if ( fd->exec() == QDialog::Accepted )
 37.2129 +			((BranchObj*)(selection))->setVymLink (fd->selectedFile() );
 37.2130 +		updateActions();
 37.2131 +		mapCenter->reposition();
 37.2132 +		adjustCanvasSize();
 37.2133 +		canvas()->update();
 37.2134 +		setChanged();
 37.2135 +	}
 37.2136 +}
 37.2137 +
 37.2138 +void MapEditor::deleteVymLink()
 37.2139 +{
 37.2140 +	if (selection && (typeid(*selection) == typeid(BranchObj) ||
 37.2141 +			typeid(*selection) == typeid(MapCenterObj)) )
 37.2142 +	{		
 37.2143 +		((BranchObj*)(selection))->setVymLink ("" );
 37.2144 +		updateActions();
 37.2145 +		mapCenter->reposition();
 37.2146 +		adjustCanvasSize();
 37.2147 +		canvas()->update();
 37.2148 +		setChanged();
 37.2149 +	}
 37.2150 +}
 37.2151 +
 37.2152 +QString MapEditor::getVymLink()
 37.2153 +{
 37.2154 +	if (selection && (typeid(*selection) == typeid(BranchObj) ||
 37.2155 +			typeid(*selection) == typeid(MapCenterObj)) )
 37.2156 +	{		
 37.2157 +		return ((BranchObj*)(selection))->getVymLink();
 37.2158 +	}
 37.2159 +	return "";
 37.2160 +	
 37.2161 +}
 37.2162 +
 37.2163 +void MapEditor::editMapInfo()
 37.2164 +{
 37.2165 +	ExtraInfoDialog dia;
 37.2166 +	dia.setMapName (getFileName() );
 37.2167 +	dia.setAuthor (mapCenter->getAuthor() );
 37.2168 +	dia.setComment(mapCenter->getComment() );
 37.2169 +
 37.2170 +	// Calc some stats
 37.2171 +	QString stats;
 37.2172 +    int i=0;
 37.2173 +    QCanvasItemList l=canvas()->allItems();
 37.2174 +    for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) 
 37.2175 +        i++;
 37.2176 +    stats+=QString ("%1 items on canvas\n").arg (i,6);
 37.2177 +
 37.2178 +	uint b=0;
 37.2179 +	uint f=0;
 37.2180 +	uint n=0;
 37.2181 +	BranchObj *bo;
 37.2182 +	bo=mapCenter->first();
 37.2183 +	while (bo) 
 37.2184 +	{
 37.2185 +		if (!bo->getNote().isEmpty() ) n++;
 37.2186 +		f+= bo->countFloatImages();
 37.2187 +		b++;
 37.2188 +		bo=bo->next();
 37.2189 +	}
 37.2190 +    stats+=QString ("%1 branches\n").arg (b-1,6);
 37.2191 +    stats+=QString ("%1 notes\n").arg (n,6);
 37.2192 +    stats+=QString ("%1 images\n").arg (f,6);
 37.2193 +	dia.setStats (stats);
 37.2194 +
 37.2195 +	// Finally show dialog
 37.2196 +	if (dia.exec() == QDialog::Accepted)
 37.2197 +	{
 37.2198 +		mapCenter->setAuthor (dia.getAuthor() );
 37.2199 +		mapCenter->setComment (dia.getComment() );
 37.2200 +		setChanged();
 37.2201 +	}
 37.2202 +}
 37.2203 +
 37.2204 +void MapEditor::updateActions()
 37.2205 +{
 37.2206 +	if (getLinkColorHint()==HeadingColor) 
 37.2207 +		actionFormatLinkColorHint->setOn(true);
 37.2208 +	else	
 37.2209 +		actionFormatLinkColorHint->setOn(false);
 37.2210 +
 37.2211 +	switch (linkstyle)
 37.2212 +	{
 37.2213 +		case StyleLine: 
 37.2214 +			actionFormatLinkStyleLine->setOn(true);
 37.2215 +			break;
 37.2216 +		case StyleParabel:
 37.2217 +			actionFormatLinkStyleParabel->setOn(true);
 37.2218 +			break;
 37.2219 +		case StylePolyLine:	
 37.2220 +			actionFormatLinkStylePolyLine->setOn(true);
 37.2221 +			break;
 37.2222 +		case StylePolyParabel:	
 37.2223 +			actionFormatLinkStylePolyParabel->setOn(true);
 37.2224 +			break;
 37.2225 +		default:
 37.2226 +			break;
 37.2227 +	}	
 37.2228 +
 37.2229 +	QPixmap pix( 16, 16 );
 37.2230 +    pix.fill( mapCanvas->backgroundColor() );
 37.2231 +    actionFormatBackColor->setIconSet( pix );
 37.2232 +    pix.fill( deflinkcolor );
 37.2233 +    actionFormatLinkColor->setIconSet( pix );
 37.2234 +
 37.2235 +	actionEditUndo->setEnabled( mapChanged );
 37.2236 +	actionFileSave->setEnabled( mapUnsaved );
 37.2237 +
 37.2238 +	if (selection)
 37.2239 +	{
 37.2240 +		if ( (typeid(*selection) == typeid(BranchObj)) || 
 37.2241 +			(typeid(*selection) == typeid(MapCenterObj))  )
 37.2242 +		{
 37.2243 +			standardFlagsDefault->setEnabled (true);
 37.2244 +
 37.2245 +			if ( ((BranchObj*)(selection))->getURL().isEmpty() )
 37.2246 +				actionEditOpenURL->setEnabled (false);
 37.2247 +			else	
 37.2248 +				actionEditOpenURL->setEnabled (true);
 37.2249 +			actionEditURL->setEnabled (true);	
 37.2250 +			actionEditHeading2URL->setEnabled (true);	
 37.2251 +			actionEditBugzilla2URL->setEnabled (true);	
 37.2252 +
 37.2253 +			if ( ((BranchObj*)(selection))->getVymLink().isEmpty() )
 37.2254 +			{
 37.2255 +				actionEditOpenVymLink->setEnabled (false);
 37.2256 +				actionEditDeleteVymLink->setEnabled (false);
 37.2257 +			} else	
 37.2258 +			{
 37.2259 +				actionEditOpenVymLink->setEnabled (true);
 37.2260 +				actionEditDeleteVymLink->setEnabled (true);
 37.2261 +			}	
 37.2262 +			actionEditVymLink->setEnabled (true);	
 37.2263 +
 37.2264 +			actionEditCopy->setEnabled (true);	
 37.2265 +			actionEditCut->setEnabled (true);	
 37.2266 +			actionEditPaste->setEnabled (true);	
 37.2267 +			actionEditMoveUp->setEnabled (true);	
 37.2268 +			actionEditMoveDown->setEnabled (true);	
 37.2269 +			actionEditToggleScroll->setEnabled (true);	
 37.2270 +			actionEditHeading->setEnabled (true);
 37.2271 +			actionEditDelete->setEnabled (true);
 37.2272 +			actionEditAddBranch->setEnabled (true);
 37.2273 +			actionEditAddBranchAbove->setEnabled (true);
 37.2274 +			actionEditAddBranchBelow->setEnabled (true);
 37.2275 +			actionEditImportAdd->setEnabled (true);
 37.2276 +			actionEditImportReplace->setEnabled (true);
 37.2277 +			actionEditSaveBranch->setEnabled (true);
 37.2278 +			actionEditSelectFirst->setEnabled (true);
 37.2279 +			actionEditSelectLast->setEnabled (true);
 37.2280 +			actionEditToggleFloatExport->setEnabled (false);
 37.2281 +			actionFormatPickColor->setEnabled (true);
 37.2282 +			actionFormatColorBranch->setEnabled (true);
 37.2283 +			actionFormatColorSubtree->setEnabled (true);
 37.2284 +			switch (selection->getFrameType())
 37.2285 +			{
 37.2286 +				case NoFrame: 
 37.2287 +					actionFormatFrameNone->setOn(true);
 37.2288 +					break;
 37.2289 +				case Rectangle:
 37.2290 +					actionFormatFrameRectangle->setOn(true);
 37.2291 +					break;
 37.2292 +				default:
 37.2293 +					break;
 37.2294 +			}	
 37.2295 +		}
 37.2296 +		if ( (typeid(*selection) == typeid(FloatImageObj)) )
 37.2297 +		{
 37.2298 +			standardFlagsDefault->setEnabled (false);
 37.2299 +
 37.2300 +			actionEditOpenURL->setEnabled (false);
 37.2301 +			actionEditURL->setEnabled (false);	
 37.2302 +			actionEditHeading2URL->setEnabled (false);	
 37.2303 +			actionEditBugzilla2URL->setEnabled (false);	
 37.2304 +			actionEditOpenVymLink->setEnabled (false);
 37.2305 +			actionEditVymLink->setEnabled (false);	
 37.2306 +			actionEditDeleteVymLink->setEnabled (false);	
 37.2307 +
 37.2308 +			actionEditCopy->setEnabled (true);
 37.2309 +			actionEditCut->setEnabled (true);	
 37.2310 +			actionEditPaste->setEnabled (false);	//FIXME
 37.2311 +			actionEditMoveUp->setEnabled (false);	
 37.2312 +			actionEditMoveDown->setEnabled (false);	
 37.2313 +			actionEditToggleScroll->setEnabled (false);	
 37.2314 +			actionEditHeading->setEnabled (false);
 37.2315 +			actionEditDelete->setEnabled (true);
 37.2316 +			actionEditAddBranch->setEnabled (false);
 37.2317 +			actionEditAddBranchAbove->setEnabled (false);
 37.2318 +			actionEditAddBranchBelow->setEnabled (false);
 37.2319 +			actionEditImportAdd->setEnabled (false);
 37.2320 +			actionEditSaveBranch->setEnabled (false);
 37.2321 +			actionEditImportReplace->setEnabled (false);
 37.2322 +			actionEditSelectFirst->setEnabled (false);
 37.2323 +			actionEditSelectLast->setEnabled (false);
 37.2324 +			actionEditToggleFloatExport->setOn
 37.2325 +				( ((FloatImageObj*)(selection))->getFloatExport() );
 37.2326 +			actionFormatPickColor->setEnabled (false);
 37.2327 +			actionFormatColorBranch->setEnabled (false);
 37.2328 +			actionFormatColorSubtree->setEnabled (false);
 37.2329 +		}
 37.2330 +
 37.2331 +	} else
 37.2332 +	{
 37.2333 +		standardFlagsDefault->setEnabled (false);
 37.2334 +
 37.2335 +		actionEditCopy->setEnabled (false);	
 37.2336 +		actionEditCut->setEnabled (false);	
 37.2337 +		actionEditPaste->setEnabled (false);	
 37.2338 +		actionEditMoveUp->setEnabled (false);	
 37.2339 +		actionEditMoveDown->setEnabled (false);	
 37.2340 +		actionEditToggleScroll->setEnabled (false);	
 37.2341 +		actionEditOpenURL->setEnabled (false);
 37.2342 +		actionEditURL->setEnabled (false);	
 37.2343 +		actionEditOpenVymLink->setEnabled (false);
 37.2344 +		actionEditVymLink->setEnabled (false);	
 37.2345 +		actionEditDeleteVymLink->setEnabled (false);	
 37.2346 +		actionEditHeading2URL->setEnabled (false);	
 37.2347 +		actionEditBugzilla2URL->setEnabled (false);	
 37.2348 +		actionEditHeading->setEnabled (false);
 37.2349 +		actionEditDelete->setEnabled (false);
 37.2350 +		actionEditAddBranch->setEnabled (false);
 37.2351 +		actionEditAddBranchAbove->setEnabled (false);
 37.2352 +		actionEditAddBranchBelow->setEnabled (false);
 37.2353 +		actionEditSaveBranch->setEnabled (false);
 37.2354 +		actionEditImportReplace->setEnabled (false);
 37.2355 +		actionEditSelectFirst->setEnabled (false);
 37.2356 +		actionEditSelectLast->setEnabled (false);
 37.2357 +		actionEditToggleFloatExport->setEnabled (false);
 37.2358 +		actionFormatPickColor->setEnabled (false);
 37.2359 +		actionFormatColorBranch->setEnabled (false);
 37.2360 +		actionFormatColorSubtree->setEnabled (false);
 37.2361 +	}	
 37.2362 +}
 37.2363 +
 37.2364 +void MapEditor::setLinkStyle (LinkStyle ls)
 37.2365 +{
 37.2366 +	linkstyle=ls;
 37.2367 +
 37.2368 +	BranchObj *bo;
 37.2369 +	bo=mapCenter->first();
 37.2370 +	bo=bo->next();
 37.2371 +	while (bo) 
 37.2372 +	{
 37.2373 +		bo->setLinkStyle(bo->getDefLinkStyle());
 37.2374 +		bo=bo->next();
 37.2375 +	}
 37.2376 +	//setChanged();
 37.2377 +	//saveState();
 37.2378 +}
 37.2379 +
 37.2380 +LinkStyle MapEditor::getLinkStyle ()
 37.2381 +{
 37.2382 +	return linkstyle;
 37.2383 +}	
 37.2384 +
 37.2385 +void MapEditor::setLinkColor(QColor c)
 37.2386 +{
 37.2387 +	deflinkcolor=c;
 37.2388 +	updateActions();
 37.2389 +}
 37.2390 +
 37.2391 +void MapEditor::setLinkColorHint()
 37.2392 +{
 37.2393 +	// called from setLinkColorHint(lch) or at end of parse
 37.2394 +	BranchObj *bo;
 37.2395 +	bo=mapCenter->first();
 37.2396 +	while (bo) 
 37.2397 +	{
 37.2398 +		bo->setLinkColor();
 37.2399 +		bo=bo->next();
 37.2400 +	}
 37.2401 +}
 37.2402 +
 37.2403 +void MapEditor::setLinkColorHint(LinkColorHint lch)
 37.2404 +{
 37.2405 +	linkcolorhint=lch;
 37.2406 +	setLinkColorHint();
 37.2407 +}
 37.2408 +
 37.2409 +void MapEditor::toggleLinkColorHint()
 37.2410 +{
 37.2411 +	if (linkcolorhint==HeadingColor)
 37.2412 +		linkcolorhint=DefaultColor;
 37.2413 +	else	
 37.2414 +		linkcolorhint=HeadingColor;
 37.2415 +	BranchObj *bo;
 37.2416 +	bo=mapCenter->first();
 37.2417 +	while (bo) 
 37.2418 +	{
 37.2419 +		bo->setLinkColor();
 37.2420 +		bo=bo->next();
 37.2421 +	}
 37.2422 +}
 37.2423 +
 37.2424 +LinkColorHint MapEditor::getLinkColorHint()
 37.2425 +{
 37.2426 +	return linkcolorhint;
 37.2427 +}
 37.2428 +
 37.2429 +QColor MapEditor::getDefLinkColor()
 37.2430 +{
 37.2431 +	return deflinkcolor;
 37.2432 +}
 37.2433 +
 37.2434 +void MapEditor::selectLinkColor()
 37.2435 +{
 37.2436 +	// Finish open lineEdits
 37.2437 +	if (lineedit) finishedLineEditNoSave();
 37.2438 +
 37.2439 +	QColor col = QColorDialog::getColor( deflinkcolor, this );
 37.2440 +	if ( !col.isValid() ) return;
 37.2441 +	setLinkColor( col );
 37.2442 +	setChanged();
 37.2443 +}
 37.2444 +
 37.2445 +void MapEditor::toggleScroll()
 37.2446 +{
 37.2447 +	if (selection && (typeid(*selection) == typeid(BranchObj)) )
 37.2448 +	{
 37.2449 +		BranchObj *bo=((BranchObj*)(selection));
 37.2450 +		if (bo->countBranches()==0) return;
 37.2451 +		if (bo->getDepth()==0) return;
 37.2452 +		setChanged();
 37.2453 +		saveState(PartOfMap,selection);
 37.2454 +		bo->toggleScroll();
 37.2455 +		adjustCanvasSize();
 37.2456 +		canvas()->update();
 37.2457 +	}
 37.2458 +}
 37.2459 +
 37.2460 +void MapEditor::unScrollAll()
 37.2461 +{
 37.2462 +	BranchObj *bo;
 37.2463 +	bo=mapCenter->first();
 37.2464 +	while (bo) 
 37.2465 +	{
 37.2466 +		if (bo->isScrolled()) bo->toggleScroll();
 37.2467 +		bo=bo->next();
 37.2468 +	}
 37.2469 +}
 37.2470 +
 37.2471 +void MapEditor::loadFloatImage ()
 37.2472 +{
 37.2473 +	if (selection && 
 37.2474 +		(typeid(*selection) == typeid(BranchObj)) || 
 37.2475 +		(typeid(*selection) == typeid(MapCenterObj))  )
 37.2476 +	{
 37.2477 +		BranchObj *bo=((BranchObj*)(selection));
 37.2478 +
 37.2479 +		QFileDialog *fd=new QFileDialog( this,tr("vym - load image"));
 37.2480 +		fd->addFilter (QString (tr("Images") + " (*.png *.bmp *.xbm *.jpg *.png *.xpm *.gif *.pnm)"));
 37.2481 +		ImagePreview *p =new ImagePreview (fd);
 37.2482 +		fd->setContentsPreviewEnabled( TRUE );
 37.2483 +		fd->setContentsPreview( p, p );
 37.2484 +		fd->setPreviewMode( QFileDialog::Contents );
 37.2485 +		fd->setCaption(tr("vym - Load image"));
 37.2486 +		fd->setDir (lastImageDir);
 37.2487 +		fd->show();
 37.2488 +
 37.2489 +		QString fn;
 37.2490 +		if ( fd->exec() == QDialog::Accepted )
 37.2491 +		{
 37.2492 +			setChanged();
 37.2493 +			saveState(PartOfMap,selection);
 37.2494 +			QString fn=fd->selectedFile();
 37.2495 +			lastImageDir=fn.left(fn.findRev ("/"));
 37.2496 +			bo->addFloatImage();
 37.2497 +			// FIXME check if load was successful
 37.2498 +			bo->getLastFloatImage()->load(fn);
 37.2499 +			bo->getLastFloatImage()->setOriginalFilename(fn);
 37.2500 +			mapCenter->reposition();
 37.2501 +			adjustCanvasSize();
 37.2502 +			canvas()->update();
 37.2503 +		}
 37.2504 +	}
 37.2505 +}
 37.2506 +
 37.2507 +void MapEditor::saveFloatImage (int item)
 37.2508 +{
 37.2509 +	if (selection && 
 37.2510 +		(typeid(*selection) == typeid(FloatImageObj)) )
 37.2511 +	{
 37.2512 +		FloatImageObj *fio=((FloatImageObj*)(selection));
 37.2513 +		const char* fmt = saveImageFormatMenu->text(item);
 37.2514 +
 37.2515 +		QFileDialog *fd=new QFileDialog( this, tr("vym - save image as") + fmt);
 37.2516 +		fd->addFilter ("PNG (*.png)");
 37.2517 +		fd->addFilter ("BMP (*.bmp)");
 37.2518 +		fd->addFilter ("XBM (*.xbm)");
 37.2519 +		fd->addFilter ("JPG (*.jpg)");
 37.2520 +		fd->addFilter ("XPM (*.xpm)");
 37.2521 +		fd->addFilter ("GIF (*.gif)");
 37.2522 +		fd->addFilter ("PNM (*.pnm)");
 37.2523 +		fd->addFilter (QString (tr("Images") + " (*.png *.bmp *.xbm *.jpg *.png *.xpm *.gif *.pnm)"));
 37.2524 +		fd->setCaption(tr("vym - Save image as ") + fmt);
 37.2525 +		fd->setMode( QFileDialog::AnyFile );
 37.2526 +		fd->setSelection (fio->getOriginalFilename());
 37.2527 +		fd->show();
 37.2528 +
 37.2529 +		QString fn;
 37.2530 +		if ( fd->exec() == QDialog::Accepted )
 37.2531 +		{
 37.2532 +			if (QFile (fd->selectedFile()).exists() )
 37.2533 +			{
 37.2534 +				QMessageBox mb( "VYM",
 37.2535 +					tr("The file ") + fd->selectedFile() + 
 37.2536 +					tr(" exists already. "
 37.2537 +					"Do you want to overwrite it?"),
 37.2538 +				QMessageBox::Warning,
 37.2539 +				QMessageBox::Yes | QMessageBox::Default,
 37.2540 +				QMessageBox::Cancel | QMessageBox::Escape,
 37.2541 +				QMessageBox::QMessageBox::NoButton );
 37.2542 +
 37.2543 +				mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
 37.2544 +				mb.setButtonText( QMessageBox::No, tr("Cancel"));
 37.2545 +				switch( mb.exec() ) 
 37.2546 +				{
 37.2547 +					case QMessageBox::Yes:
 37.2548 +						// save 
 37.2549 +						break;;
 37.2550 +					case QMessageBox::Cancel:
 37.2551 +						// do nothing
 37.2552 +						return;
 37.2553 +						break;
 37.2554 +				}
 37.2555 +			}
 37.2556 +			fio->save (fd->selectedFile(),fmt);
 37.2557 +		}
 37.2558 +	}
 37.2559 +}
 37.2560 +
 37.2561 +void MapEditor::toggleFloatExport()
 37.2562 +{
 37.2563 +	if (selection && 
 37.2564 +		(typeid(*selection) == typeid(FloatImageObj))|| 
 37.2565 +		(typeid(*selection) == typeid(FloatObj)) )
 37.2566 +	{
 37.2567 +		FloatImageObj *fio=((FloatImageObj*)(selection));
 37.2568 +		fio->setFloatExport (actionEditToggleFloatExport->isOn() );
 37.2569 +	}
 37.2570 +}
 37.2571 +
 37.2572 +void MapEditor::setFrame(const FrameType &t)
 37.2573 +{
 37.2574 +	if (selection && 
 37.2575 +		(typeid(*selection) == typeid(BranchObj)) || 
 37.2576 +		(typeid(*selection) == typeid(MapCenterObj))  )
 37.2577 +	{
 37.2578 +		selection->setFrameType (t);
 37.2579 +		mapCenter->reposition();
 37.2580 +		selection->updateLink();
 37.2581 +	}
 37.2582 +}
 37.2583 +
 37.2584 +void MapEditor::importDir(BranchObj *dst, QDir d)
 37.2585 +{
 37.2586 +	if (selection && 
 37.2587 +		(typeid(*selection) == typeid(BranchObj)) || 
 37.2588 +		(typeid(*selection) == typeid(MapCenterObj))  )
 37.2589 +	{
 37.2590 +		BranchObj *bo;
 37.2591 +		
 37.2592 +		// Traverse directories
 37.2593 +		d.setFilter( QDir::Dirs| QDir::Hidden | QDir::NoSymLinks );
 37.2594 +		const QFileInfoList *dirlist = d.entryInfoList();
 37.2595 +		QFileInfoListIterator itdir( *dirlist );
 37.2596 +		QFileInfo *fi;
 37.2597 +
 37.2598 +		while ( (fi = itdir.current()) != 0 ) 
 37.2599 +		{
 37.2600 +			if (fi->fileName() != "." && fi->fileName() != ".." )
 37.2601 +			{
 37.2602 +				dst->addBranch();
 37.2603 +				bo=dst->getLastBranch();
 37.2604 +				bo->setHeading (fi->fileName() );
 37.2605 +				bo->setColor (QColor("blue"),false);
 37.2606 +				bo->toggleScroll();
 37.2607 +				if ( !d.cd(fi->fileName()) ) 
 37.2608 +					QMessageBox::critical (0,tr("Critical Import Error"),tr("Cannot find the directory"));
 37.2609 +				else 
 37.2610 +				{
 37.2611 +					importDir (bo,d);
 37.2612 +					d.cdUp();
 37.2613 +				}
 37.2614 +			}	
 37.2615 +			++itdir;
 37.2616 +		}		
 37.2617 +		// Traverse files
 37.2618 +		d.setFilter( QDir::Files| QDir::Hidden | QDir::NoSymLinks );
 37.2619 +		const QFileInfoList *filelist = d.entryInfoList();
 37.2620 +		QFileInfoListIterator itfile( *filelist );
 37.2621 +
 37.2622 +		while ( (fi = itfile.current()) != 0 ) 
 37.2623 +		{
 37.2624 +			dst->addBranch();
 37.2625 +			bo=dst->getLastBranch();
 37.2626 +			bo->setHeading (fi->fileName() );
 37.2627 +			bo->setColor (QColor("black"),false);
 37.2628 +			++itfile;
 37.2629 +		}	
 37.2630 +	}		
 37.2631 +}
 37.2632 +
 37.2633 +void MapEditor::importDir()
 37.2634 +{
 37.2635 +	if (selection && 
 37.2636 +		(typeid(*selection) == typeid(BranchObj)) || 
 37.2637 +		(typeid(*selection) == typeid(MapCenterObj))  )
 37.2638 +	{
 37.2639 +		QFileDialog *fd=new QFileDialog( this,tr("VYM - Choose directory structur to import"));
 37.2640 +		fd->setMode (QFileDialog::DirectoryOnly);
 37.2641 +		fd->addFilter (QString (tr("vym map") + " (*.vym)"));
 37.2642 +		fd->setCaption(tr("VYM - Choose directory structur to import"));
 37.2643 +		fd->show();
 37.2644 +
 37.2645 +		QString fn;
 37.2646 +		if ( fd->exec() == QDialog::Accepted )
 37.2647 +		{
 37.2648 +			BranchObj *bo=((BranchObj*)(selection));
 37.2649 +			importDir (bo,QDir(fd->selectedFile()) );
 37.2650 +			mapCenter->reposition();
 37.2651 +			adjustCanvasSize();
 37.2652 +			canvas()->update();
 37.2653 +		}
 37.2654 +	}	
 37.2655 +}
 37.2656 +
 37.2657 +void MapEditor::testFunction()
 37.2658 +{
 37.2659 +	cout << "MapEditor::testFunction() called\n";
 37.2660 +}
 37.2661 +
 37.2662 +void MapEditor::ensureSelectionVisible()
 37.2663 +{
 37.2664 +	LinkableMapObj* lmo= dynamic_cast <LinkableMapObj*> (selection);
 37.2665 +	QPoint p;
 37.2666 +	if (selection->getOrientation() == OrientLeftOfCenter)
 37.2667 +		p= worldMatrix().map(QPoint (lmo->x(),lmo->y()));
 37.2668 +	else	
 37.2669 +		p= worldMatrix().map(QPoint (lmo->x()+lmo->width(),lmo->y()+lmo->height()));
 37.2670 +	ensureVisible (p.x(), p.y() );
 37.2671 +
 37.2672 +}
 37.2673 +
 37.2674 +void MapEditor::updateViewCenter()
 37.2675 +{
 37.2676 +	// Update movingCenter, so that we can zoom comfortably later
 37.2677 +	QRect rc = QRect( contentsX(), contentsY(),
 37.2678 +				  visibleWidth(), visibleHeight() );
 37.2679 +	QRect canvasRect = inverseWorldMatrix().mapRect(rc);
 37.2680 +	movingCenter.setX((canvasRect.right() + canvasRect.left())/2);
 37.2681 +	movingCenter.setY((canvasRect.top() + canvasRect.bottom())/2);
 37.2682 +}
 37.2683 +
 37.2684 +void MapEditor::contentsContextMenuEvent ( QContextMenuEvent * e )
 37.2685 +{
 37.2686 +	// Lineedits are already closed by preceding
 37.2687 +	// mouseEvent, we don't need to close here.
 37.2688 +
 37.2689 +    QPoint p = inverseWorldMatrix().map(e->pos());
 37.2690 +    LinkableMapObj* lmo=mapCenter->findMapObj(p, NULL);
 37.2691 +	
 37.2692 +    if (lmo) 
 37.2693 +	{	// MapObj was found
 37.2694 +		if (selection != lmo)
 37.2695 +		{
 37.2696 +			// select the MapObj
 37.2697 +			if (selection) selection->unselect();
 37.2698 +			selection=lmo;
 37.2699 +			selection->select();
 37.2700 +			adjustCanvasSize();
 37.2701 +		}
 37.2702 +		// Context Menu 
 37.2703 +		if (selection) 
 37.2704 +		{
 37.2705 +			if (typeid(*selection)==typeid(BranchObj) ||
 37.2706 +				typeid(*selection)==typeid(MapCenterObj) )
 37.2707 +			{
 37.2708 +				// Context Menu on branch or mapcenter
 37.2709 +				updateActions();
 37.2710 +				branchContextMenu->popup(e->globalPos() );
 37.2711 +			}	
 37.2712 +			if (typeid(*selection)==typeid(FloatImageObj))
 37.2713 +			{
 37.2714 +				// Context Menu on floatimage
 37.2715 +				updateActions();
 37.2716 +				floatimageContextMenu->popup(e->globalPos() );
 37.2717 +			}	
 37.2718 +		}	
 37.2719 +	} else 
 37.2720 +	{ // No MapObj found, we are on the Canvas itself
 37.2721 +		// Context Menu on Canvas
 37.2722 +		updateActions();
 37.2723 +		canvasContextMenu->popup(e->globalPos() );
 37.2724 +    } 
 37.2725 +}
 37.2726 +
 37.2727 +void MapEditor::contentsMousePressEvent(QMouseEvent* e)
 37.2728 +{
 37.2729 +	// Finish open lineEdits
 37.2730 +	if (lineedit) finishedLineEditNoSave();
 37.2731 +	
 37.2732 +    QPoint p = inverseWorldMatrix().map(e->pos());
 37.2733 +    LinkableMapObj* lmo=mapCenter->findMapObj(p, NULL);
 37.2734 +	
 37.2735 +	// Special case: CTRL is pressed, don't select anything
 37.2736 +	if (e->state() & QMouseEvent::ControlButton)
 37.2737 +	{
 37.2738 +		pickingColor=true;
 37.2739 +		setCursor (pickColorCursor);
 37.2740 +		return;
 37.2741 +	}
 37.2742 +
 37.2743 +    if (lmo) 
 37.2744 +	{	// MapObj was found
 37.2745 +		if (selection != lmo)
 37.2746 +		{
 37.2747 +			// select the MapObj
 37.2748 +			if (selection) selection->unselect();
 37.2749 +			selection=lmo;
 37.2750 +			selection->select();
 37.2751 +				
 37.2752 +			adjustCanvasSize();
 37.2753 +		}
 37.2754 +
 37.2755 +		// Check, if systemFlag clicked
 37.2756 +		if (typeid(*selection)==typeid(BranchObj) ||
 37.2757 +			typeid(*selection)==typeid(MapCenterObj) )
 37.2758 +		{
 37.2759 +			QString foname=((BranchObj*)(selection))->getSystemFlagName(p);
 37.2760 +			if (!foname.isEmpty())
 37.2761 +			{
 37.2762 +				// Do not move, if systemFlag clicked
 37.2763 +				if (foname=="url") 
 37.2764 +					openURL();
 37.2765 +				else
 37.2766 +					if (foname=="vymLink")
 37.2767 +					{
 37.2768 +						mainWindow->editOpenVymLink();
 37.2769 +						// tabWidget may change, better return now
 37.2770 +						// before segfaulting...
 37.2771 +						return;
 37.2772 +					} else
 37.2773 +						if (foname=="note")
 37.2774 +							mainWindow->windowToggleNoteEditor();
 37.2775 +			}			
 37.2776 +		}	
 37.2777 +			
 37.2778 +		// Left Button	    Move Branches
 37.2779 +		if (e->button() == QMouseEvent::LeftButton )
 37.2780 +		{
 37.2781 +			movingObj=selection;	
 37.2782 +			movingObj_start.setX( p.x() - selection->x() );	
 37.2783 +			movingObj_start.setY( p.y() - selection->y() );	
 37.2784 +		} else
 37.2785 +			// Middle Button    Toggle Scroll
 37.2786 +			// (On Mac OS X this won't work, but we still have 
 37.2787 +			// a button in the toolbar)
 37.2788 +			if (e->button() == QMouseEvent::MidButton )
 37.2789 +			{
 37.2790 +				toggleScroll();
 37.2791 +			} 
 37.2792 +		updateActions();
 37.2793 +	} else 
 37.2794 +	{ // No MapObj found, we are on the Canvas itself
 37.2795 +		// Left Button	    move Pos of CanvasView
 37.2796 +		if (e->button() == QMouseEvent::LeftButton )
 37.2797 +		{
 37.2798 +			movingObj=NULL;	// move Content not Obj
 37.2799 +			movingObj_start=e->globalPos();
 37.2800 +			movingCont_start=QPoint (contentsX(), contentsY() );
 37.2801 +			movingVec=QPoint(0,0);
 37.2802 +			setCursor(handOpenCursor);
 37.2803 +		} 
 37.2804 +    } 
 37.2805 +}
 37.2806 +
 37.2807 +void MapEditor::contentsMouseMoveEvent(QMouseEvent* e)
 37.2808 +{
 37.2809 +    // Move the selected MapObj
 37.2810 +    if ( selection && movingObj) 
 37.2811 +    {	
 37.2812 +		QPoint p = inverseWorldMatrix().map(e->pos());
 37.2813 +		
 37.2814 +		// Now move the selection, but add relative position (movingObj_start) 
 37.2815 +		// where selection 
 37.2816 +		// was chosen with mousepointer. (This avoids flickering resp. jumping 
 37.2817 +		// of selection back to absPos)
 37.2818 +		
 37.2819 +		LinkableMapObj *lmosel;
 37.2820 +		lmosel =  dynamic_cast <LinkableMapObj*> (selection);
 37.2821 +
 37.2822 +		// Check if we could link 
 37.2823 +		LinkableMapObj* lmo=mapCenter->findMapObj(p, lmosel);
 37.2824 +		
 37.2825 +
 37.2826 +		if (typeid(*selection) == typeid(FloatImageObj))
 37.2827 +		{
 37.2828 +			setChanged();
 37.2829 +			saveState();
 37.2830 +			FloatObj *fo=(FloatObj*)(selection);
 37.2831 +			if (fo->getLinkStyle()==StyleUndef) 
 37.2832 +			{
 37.2833 +				fo->setLinkStyle(fo->getDefLinkStyle());
 37.2834 +				fo->setLinkColor(fo->getParObj()->getLinkColor());
 37.2835 +			}	
 37.2836 +			fo->move   (p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );		
 37.2837 +			fo->setRelPos();
 37.2838 +			fo->reposition();
 37.2839 +
 37.2840 +			// Relink float to new mapcenter or branch, if shift is pressed	
 37.2841 +			// Only relink, if selection really has a new parent
 37.2842 +			if ( (e->state() & QMouseEvent::ShiftButton) && lmo &&
 37.2843 +				( (typeid(*lmo)==typeid(BranchObj)) ||
 37.2844 +				  (typeid(*lmo)==typeid(MapCenterObj)) ) &&
 37.2845 +				( lmo != fo->getParObj())  
 37.2846 +				)
 37.2847 +			{
 37.2848 +				if (typeid(*fo) == typeid(FloatImageObj)) 
 37.2849 +				{
 37.2850 +					FloatImageObj *fio=(FloatImageObj*)(fo);
 37.2851 +					((BranchObj*)(lmo))->addFloatImage (fio);
 37.2852 +					fio->unselect();
 37.2853 +					((BranchObj*)(fio->getParObj()))->removeFloatImage (fio);
 37.2854 +					fio=((BranchObj*)(lmo))->getLastFloatImage();
 37.2855 +					fio->setRelPos();
 37.2856 +					fio->reposition();
 37.2857 +					selection=(LinkableMapObj*)(fio);
 37.2858 +					selection->select();
 37.2859 +					movingObj=(MapObj*)(fio);
 37.2860 +					// setLinkStyle calls updateLink, only set it once
 37.2861 +					if (fio->getLinkStyle()!=fio->getDefLinkStyle() ) 
 37.2862 +						fio->setLinkStyle (fio->getDefLinkStyle());
 37.2863 +
 37.2864 +				}	
 37.2865 +				// TODO if (typeid(*selection) == typeid(FloatTextObj))
 37.2866 +			}
 37.2867 +		} else	// selection != a FloatObj
 37.2868 +		{
 37.2869 +			if (lmosel->getDepth()==0)
 37.2870 +			{
 37.2871 +				if (e->state() == (LeftButton | !ShiftButton)) 
 37.2872 +					// If mapCenter is moved, move all the rest by default, too.
 37.2873 +					mapCenter->moveAll(p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );		
 37.2874 +				else	
 37.2875 +					mapCenter->move   (p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );		
 37.2876 +			} else
 37.2877 +			{	
 37.2878 +				if (lmosel->getDepth()==1)
 37.2879 +				{
 37.2880 +					// depth==1, mainbranch
 37.2881 +					setChanged();
 37.2882 +					saveState(PartOfMap,lmosel);
 37.2883 +					lmosel->move(p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );		
 37.2884 +				} else
 37.2885 +				{
 37.2886 +					// depth>1
 37.2887 +					if (lmosel->getOrientation() == OrientLeftOfCenter)
 37.2888 +						// Add width of bbox here, otherwise alignRelTo will cause jumping around
 37.2889 +						lmosel->move(p.x() -movingObj_start.x()+lmosel->getBBox().width(), 
 37.2890 +							p.y()-movingObj_start.y() );		
 37.2891 +					else	
 37.2892 +						lmosel->move(p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );
 37.2893 +				} 
 37.2894 +				// reposition subbranch
 37.2895 +				lmosel->reposition();	
 37.2896 +				ensureSelectionVisible();
 37.2897 +
 37.2898 +				if (lmo && (lmo!=selection) &&  
 37.2899 +					(typeid(*lmo) == typeid(BranchObj) ||
 37.2900 +					(typeid(*lmo) == typeid(MapCenterObj) )
 37.2901 +					) )
 37.2902 +				{
 37.2903 +					if (e->state() & QMouseEvent::ControlButton)
 37.2904 +					{
 37.2905 +						// Special case: CTRL to link below lmo
 37.2906 +						lmosel->setParObjTmp (lmo,p,+1);
 37.2907 +					}
 37.2908 +					else if (e->state() & QMouseEvent::ShiftButton)
 37.2909 +						lmosel->setParObjTmp (lmo,p,-1);
 37.2910 +					else
 37.2911 +						lmosel->setParObjTmp (lmo,p,0);
 37.2912 +				} else	
 37.2913 +				{
 37.2914 +					if (lmo &&(lmo==selection))   
 37.2915 +						// Could link to myself (happens sometimes...)
 37.2916 +						lmosel->unsetParObjTmp();
 37.2917 +					if (!lmo)  
 37.2918 +						// no Obj under selection, go back to original Parent
 37.2919 +						lmosel->unsetParObjTmp();
 37.2920 +				}		
 37.2921 +			} // depth>0
 37.2922 +
 37.2923 +		} // no FloatImageObj
 37.2924 +
 37.2925 +		canvas()->update();
 37.2926 +		return;
 37.2927 +	} // selection && moving_obj
 37.2928 +		
 37.2929 +    // Move CanvasView 
 37.2930 +    if (!movingObj && !pickingColor) 
 37.2931 +	{
 37.2932 +		QPoint p=e->globalPos();
 37.2933 +		movingVec.setX(-p.x() + movingObj_start.x() );
 37.2934 +		movingVec.setY(-p.y() + movingObj_start.y() );
 37.2935 +		setContentsPos( movingCont_start.x() + movingVec.x(),
 37.2936 +	    movingCont_start.y() + movingVec.y());
 37.2937 +
 37.2938 +		updateViewCenter();
 37.2939 +    }
 37.2940 +}
 37.2941 +
 37.2942 +
 37.2943 +void MapEditor::contentsMouseReleaseEvent(QMouseEvent* e)
 37.2944 +{
 37.2945 +	LinkableMapObj *dst;
 37.2946 +	// Have we been picking color?
 37.2947 +	if (pickingColor)
 37.2948 +	{
 37.2949 +		pickingColor=false;
 37.2950 +		setCursor (ArrowCursor);
 37.2951 +		// Check if we are over another branch
 37.2952 +		dst=mapCenter->findMapObj(inverseWorldMatrix().map(e->pos() ), NULL);
 37.2953 +		if (dst && selection) 
 37.2954 +		{	
 37.2955 +			if (e->state() & QMouseEvent::ShiftButton)
 37.2956 +			{
 37.2957 +				((BranchObj*)(selection))->setColor (((BranchObj*)(dst))->getColor(),false);
 37.2958 +				((BranchObj*)(selection))->setLinkColor ();
 37.2959 +			}	
 37.2960 +			else	
 37.2961 +			{
 37.2962 +				((BranchObj*)(selection))->setColor (((BranchObj*)(dst))->getColor(),true);
 37.2963 +				((BranchObj*)(selection))->setLinkColor ();
 37.2964 +			}	
 37.2965 +		} 
 37.2966 +		return;
 37.2967 +	}
 37.2968 +    // Have we been moving something?
 37.2969 +    if ( selection && movingObj ) 
 37.2970 +    {	
 37.2971 +		// Check if we are over another branch, but ignore 
 37.2972 +		// any found LMOs, which are FloatObjs
 37.2973 +		dst=mapCenter->findMapObj(inverseWorldMatrix().map(e->pos() ), 
 37.2974 +			((LinkableMapObj*)(selection)) );
 37.2975 +
 37.2976 +		if (dst &&
 37.2977 +		(typeid(*dst)!=typeid(BranchObj)&&typeid(*dst)!=typeid(MapCenterObj))) 
 37.2978 +		{
 37.2979 +			dst=NULL;
 37.2980 +		}	
 37.2981 +		
 37.2982 +		// Now check, if we have been moving a branch 
 37.2983 +		if (typeid(*selection) == typeid(BranchObj)  )
 37.2984 +		{
 37.2985 +			// save the position in case we link to mapcenter
 37.2986 +			QPoint savePos=QPoint (selection->x(),selection->y() );
 37.2987 +
 37.2988 +			// Reset the temporary drawn link to the original one
 37.2989 +			((LinkableMapObj*)(selection))->unsetParObjTmp();
 37.2990 +
 37.2991 +			if (dst ) 
 37.2992 +			{   
 37.2993 +				setChanged();
 37.2994 +				saveState();
 37.2995 +				// TODO we also could check, if dest and src are on same branch,
 37.2996 +				// then it would be sufficient to saveState of this branch
 37.2997 +
 37.2998 +				// FIXME better introduce BO::move  to speed up and keep IDs
 37.2999 +				copy();			// copy selection to clipboard
 37.3000 +				cutNoSave();	// remove selection here
 37.3001 +
 37.3002 +				selection->unselect();	
 37.3003 +				selection=dst;
 37.3004 +				// Modifiers allow to insert above/below dst
 37.3005 +				if (e->state() & QMouseEvent::ShiftButton)
 37.3006 +				{
 37.3007 +					selection=pasteAtNoSave (((BranchObj*)(dst))->getNum());
 37.3008 +					if (selection) selection->select();
 37.3009 +				}	
 37.3010 +				else if (e->state() & QMouseEvent::ControlButton)
 37.3011 +				{
 37.3012 +					selection=pasteAtNoSave (((BranchObj*)(dst))->getNum()+1);
 37.3013 +					if (selection) selection->select();
 37.3014 +				}	
 37.3015 +				else	
 37.3016 +				{
 37.3017 +					selection=pasteNoSave();
 37.3018 +					selection->select();
 37.3019 +					if (dst->getDepth()==0) 
 37.3020 +						((BranchObj*)(selection))->move (savePos);
 37.3021 +				}	
 37.3022 +			} 
 37.3023 +			// Draw the original link, before selection was moved around
 37.3024 +			mapCenter->reposition();
 37.3025 +		}
 37.3026 +		// Finally resize canvas, if needed
 37.3027 +		adjustCanvasSize();
 37.3028 +		canvas()->update();
 37.3029 +		movingObj=NULL;		
 37.3030 +	} else 
 37.3031 +	{	// maybe we moved View: set old cursor
 37.3032 +		setCursor (ArrowCursor);
 37.3033 +    }
 37.3034 +}
 37.3035 +
 37.3036 +void MapEditor::contentsMouseDoubleClickEvent(QMouseEvent* e)
 37.3037 +{
 37.3038 +	// Finish open lineEdits
 37.3039 +	if (lineedit) finishedLineEditNoSave();
 37.3040 +	
 37.3041 +	if (e->button() == QMouseEvent::LeftButton )
 37.3042 +	{
 37.3043 +		QPoint p = inverseWorldMatrix().map(e->pos());
 37.3044 +		LinkableMapObj *lmo=mapCenter->findMapObj(p, NULL);
 37.3045 +		if (lmo) {	// MapObj was found
 37.3046 +			// First select the MapObj than edit heading
 37.3047 +			if (selection) selection->unselect();
 37.3048 +			selection=lmo;
 37.3049 +			selection->select();
 37.3050 +			setChanged();
 37.3051 +			saveState(PartOfMap,selection);
 37.3052 +			editHeading();
 37.3053 +		}
 37.3054 +	}
 37.3055 +}
 37.3056 +
 37.3057 +void MapEditor::resizeEvent (QResizeEvent* e)
 37.3058 +{
 37.3059 +	QCanvasView::resizeEvent( e );
 37.3060 +	
 37.3061 +	QString s="";
 37.3062 +	if (!fileName.isEmpty()) s=fileName;
 37.3063 +	adjustCanvasSize();
 37.3064 +}
 37.3065 +
    38.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.2 +++ b/mapeditor.h	Sun Jan 30 12:58:47 2005 +0000
    38.3 @@ -0,0 +1,197 @@
    38.4 +#ifndef MAPEDITOR_H
    38.5 +#define MAPEDITOR_H
    38.6 +
    38.7 +#include <qcanvas.h>
    38.8 +#include <qlineedit.h>
    38.9 +#include <qcursor.h>
   38.10 +#include <qfiledialog.h>
   38.11 +#include <qevent.h>
   38.12 +#include <qprocess.h>
   38.13 +
   38.14 +#include "mapcenterobj.h"
   38.15 +#include "misc.h"
   38.16 +
   38.17 +class MapEditor : public QCanvasView , public xmlObj {
   38.18 +    Q_OBJECT
   38.19 +
   38.20 +public:
   38.21 +    MapEditor(QWidget* parent=0, bool interactive=false, const char* name=0, WFlags f=0);
   38.22 +	~MapEditor();
   38.23 +    QColor color();
   38.24 +    QColor backgroundColor();
   38.25 +    MapCenterObj* getMapCenter();
   38.26 +	QCanvas* getCanvas();
   38.27 +	void adjustCanvasSize();// adjust canvas size to map and scrollview
   38.28 +	bool blockReposition(); // block while load or undo
   38.29 +	
   38.30 +private:
   38.31 +	void makeTmpDirs();		// create temporary directories
   38.32 +	void delTmpDirs();		// delete temporary directories
   38.33 +	void makeSubDirs(const QString&);		
   38.34 +							// create subdirs in dir
   38.35 +    QString saveToDir(const QString&,const QString &,bool, const QPoint
   38.36 +	&,SaveMode);
   38.37 +    void saveState();		// save actual state to backup
   38.38 +    void saveState(const SaveMode&, LinkableMapObj *);
   38.39 +
   38.40 +private slots:
   38.41 +    void finishedLineEditNoSave();
   38.42 +
   38.43 +public:
   38.44 +	bool isDefault();		// false, if map was changed once
   38.45 +    bool isUnsaved();		// save necessary
   38.46 +    bool hasChanged();		// undo possible
   38.47 +	void setChanged();		// called from NoteEditor via LMO
   38.48 +	void closeMap();
   38.49 +	void setFilePath (QString);	
   38.50 +	void setFilePath (QString,QString);	
   38.51 +	QString getFilePath ();	// Full path e.g. "/home/tux/map.xml"
   38.52 +	QString getFileName ();	// e.g. "map.xml"
   38.53 +	QString getMapName ();	// e.g. "map"
   38.54 +	QString getDestPath (); // e.g. "/home/tux/map.vym"
   38.55 +    int load (QString&, const LoadMode &);	// newmap, import/replace selection
   38.56 +    int save(const SaveMode &);	// Save map 
   38.57 +	void setZipped(bool);		// save map zipped
   38.58 +	bool saveZipped();			// 1 if file will be saved zipped
   38.59 +    void print();				// print canvas
   38.60 +private:
   38.61 +    QPixmap getPixmap();
   38.62 +public:
   38.63 +    void exportImage (QString fn);		// export as PNG	
   38.64 +    void exportImage (QString fn, int);	// export in given format
   38.65 +    void exportASCII();
   38.66 +    void exportXML(const QString&);		// export to directory
   38.67 +    void clear();		// clear map
   38.68 +    void undo();		// undo last action
   38.69 +    void copy();		// copy branch to clipboard
   38.70 +private:	
   38.71 +    LinkableMapObj* pasteNoSave();		// paste clipboard to branch
   38.72 +    LinkableMapObj* pasteAtNoSave(int);	// paste clipboard to branch at position i
   38.73 +    void cutNoSave();	// cut to clipboard
   38.74 +public:	
   38.75 +    void paste();		// paste clipboard to branch and backup
   38.76 +    void cut();			// cut to clipboard and backup
   38.77 +    void moveBranchUp();
   38.78 +    void moveBranchDown();
   38.79 +    void editHeading();
   38.80 +    void addNewBranch(int);			// pos allows to add above/below selection
   38.81 +    void deleteSelection();
   38.82 +	LinkableMapObj* getSelection();	// returns selection
   38.83 +	bool select(QString );			// Select 
   38.84 +	void unselect();				// before changing current noteedit
   38.85 +	void reselect();				// after  changing current noteedit
   38.86 +private:	
   38.87 +	void selectNextBranch();		// Increment number of branch
   38.88 +	void selectPrevBranch();		// Decrement number of branch
   38.89 +public:	
   38.90 +    void selectUpperBranch();
   38.91 +    void selectLowerBranch();
   38.92 +    void selectLeftBranch();
   38.93 +    void selectRightBranch();
   38.94 +    void selectFirstBranch();
   38.95 +    void selectLastBranch();
   38.96 +    void setColor(QColor);
   38.97 +    void selectBackgroundColor();
   38.98 +    void setBackgroundColor(QColor);
   38.99 +    QColor pickColor();
  38.100 +    void colorItem();
  38.101 +    void colorBranch();
  38.102 +	void toggleStandardFlag(QString);
  38.103 +	virtual void setViewCenter();			// needed for zooming
  38.104 +    BranchObj* findText(QString,bool);		// Find object
  38.105 +    void findReset();						// Reset Find 
  38.106 +	void openURL();							// open URL in external browser
  38.107 +	void editURL();							// edit the URL
  38.108 +	void editHeading2URL();					// copy heading to URL
  38.109 +	void editBugzilla2URL();				// create URL to Bugzilla
  38.110 +	void editVymLink();						// edit link to another map
  38.111 +	void deleteVymLink();					// delete link to another map
  38.112 +	QString getVymLink();					// return path to map
  38.113 +	void editMapInfo();						// dialog to enter author, ...
  38.114 +	void updateActions();					// update e.g. format buttons
  38.115 +	void setLinkStyle (LinkStyle);			// Set style of link
  38.116 +	LinkStyle getLinkStyle ();				// requested in LMO
  38.117 +	void setLinkColor(QColor);				// default color of links
  38.118 +	void setLinkColorHint();				// color of links
  38.119 +	void setLinkColorHint(LinkColorHint);	// color of links
  38.120 +	LinkColorHint getLinkColorHint();
  38.121 +	QColor getDefLinkColor();
  38.122 +	void toggleLinkColorHint();				// after changing linkStyles
  38.123 +    void selectLinkColor();
  38.124 +    void toggleScroll();
  38.125 +    void unScrollAll();
  38.126 +	void loadFloatImage ();
  38.127 +	void saveFloatImage (int);
  38.128 +	void toggleFloatExport();
  38.129 +	void setFrame(const FrameType &);
  38.130 +private:	
  38.131 +    void importDir(BranchObj *,QDir);
  38.132 +public:	
  38.133 +    void importDir();
  38.134 +    void testFunction();				// FIXME just testing
  38.135 +
  38.136 +protected:
  38.137 +	void ensureSelectionVisible();		
  38.138 +	virtual void updateViewCenter();	// needed for zooming
  38.139 +	virtual void contentsContextMenuEvent ( QContextMenuEvent *e );
  38.140 +    virtual void contentsMousePressEvent(QMouseEvent*);
  38.141 +    virtual void contentsMouseReleaseEvent(QMouseEvent*);
  38.142 +    virtual void contentsMouseDoubleClickEvent(QMouseEvent*);
  38.143 +    virtual void contentsMouseMoveEvent(QMouseEvent*);
  38.144 +
  38.145 +private:
  38.146 +    QCanvas* mapCanvas;
  38.147 +    MapCenterObj* mapCenter;
  38.148 +
  38.149 +	bool adjustCanvasRequested;	// collect requests until end of user event
  38.150 +	BranchObj *editingBO;		// entering Text into BO
  38.151 +    QLineEdit* lineedit;
  38.152 +
  38.153 +    QColor actColor;			// actual color
  38.154 +	QColor deflinkcolor;		// default color for links
  38.155 +	LinkColorHint linkcolorhint;// use heading color or own color
  38.156 +	LinkStyle linkstyle;		// default style for links
  38.157 +
  38.158 +    QCursor handOpenCursor;		// cursor while moving canvas view
  38.159 +	QCursor pickColorCursor;	// cursor while picking color 
  38.160 +	bool pickingColor;			// true while picking Color CTRL-LeftButton
  38.161 +	
  38.162 +    LinkableMapObj* selection;		// select a LinkableMapObj
  38.163 +    LinkableMapObj* selectionLast;	// last selection 
  38.164 +    MapObj* movingObj;				// moving a MapObj
  38.165 +    QPoint movingObj_start;			// rel. pos of mouse to absPos 
  38.166 +    QPoint movingCont_start;		// inital pos of moving Content or
  38.167 +    QPoint movingVec;				// how far has Content moved
  38.168 +	QPoint movingCenter;			// used when zooming
  38.169 +    QPrinter* printer;				// Printing
  38.170 +
  38.171 +    bool mapDefault;				// Flag if map is untouched
  38.172 +    bool mapChanged;				// Flag if undo is possible
  38.173 +	bool mapUnsaved;				// Flag if map should be saved
  38.174 +    QString backupXML;				// backup (XML) for undo
  38.175 +	LinkableMapObj* undoSelection;	// replace this LMO with vympart from backup
  38.176 +									// if != NULL
  38.177 +
  38.178 +	bool printFrame;			// Print frame around map
  38.179 +	bool printFooter;			// Print footer below map
  38.180 +
  38.181 +	bool zipped;				// should map be zipped
  38.182 +	QString fileName;			// short name of file (for tab)
  38.183 +	QString filePath;			// path to file which will be saved
  38.184 +	QString fileDir;			// dir where file is saved
  38.185 +	QString destPath;			// path to .vym file (needed for vymlinks)
  38.186 +	QString mapName;			// fileName without ".vym"
  38.187 +	QString lastImageDir;		// save dir for adding images
  38.188 +
  38.189 +	bool isInteractive;			// non interactive don't need tmpdirs
  38.190 +	QString bakMapDir;			// tmp directory with data for undo
  38.191 +	bool blockreposition;		// block while load or undo
  38.192 +
  38.193 +	BranchObj* itFind;			// next object in find process
  38.194 +	bool EOFind;				// true, if search failed
  38.195 +
  38.196 +	QPoint exportOffset;		// set before export, used in save
  38.197 +    void resizeEvent( QResizeEvent * );
  38.198 +};
  38.199 +#endif
  38.200 +
    39.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.2 +++ b/mapobj.cpp	Sun Jan 30 12:58:47 2005 +0000
    39.3 @@ -0,0 +1,143 @@
    39.4 +#include "mapobj.h"
    39.5 +
    39.6 +/////////////////////////////////////////////////////////////////
    39.7 +// MapObj
    39.8 +/////////////////////////////////////////////////////////////////
    39.9 +MapObj::MapObj ()
   39.10 +{
   39.11 +	// TODO not used any longer...
   39.12 +	cout << "Const MapObj (): Please set canvas somehow!!!\n";
   39.13 +    // canvas=actMapEditor->getCanvas();
   39.14 +    init ();
   39.15 +}
   39.16 +
   39.17 +MapObj::MapObj (QCanvas* c)
   39.18 +{
   39.19 +//  cout << "Const MapObj\n";
   39.20 +    canvas=c;
   39.21 +    init ();
   39.22 +}
   39.23 +
   39.24 +
   39.25 +MapObj::MapObj (MapObj* mo)
   39.26 +{
   39.27 +//    cout << "CopyConst MapObj\n";
   39.28 +    copy (mo);
   39.29 +}
   39.30 +
   39.31 +MapObj::~MapObj ()
   39.32 +{
   39.33 +//    cout << "Destr MapObj\n";
   39.34 +}
   39.35 +
   39.36 +void MapObj::init ()
   39.37 +{
   39.38 +    absPos=QPoint(0,0);
   39.39 +    visible=true;
   39.40 +}
   39.41 +
   39.42 +void MapObj::copy(MapObj* other)
   39.43 +{
   39.44 +//    canvas=other->canvas;	// already set in constr. of child, use that one...
   39.45 +    absPos=other->absPos;
   39.46 +	bbox.setX (other->bbox.x() );
   39.47 +	bbox.setY (other->bbox.y() );
   39.48 +	bbox.setSize (QSize(other->bbox.width(), other->bbox.height() ) );
   39.49 +}
   39.50 +
   39.51 +QCanvas* MapObj::getCanvas()
   39.52 +{
   39.53 +	return canvas;
   39.54 +}
   39.55 +
   39.56 +int MapObj::x() 
   39.57 +{
   39.58 +    return absPos.x();
   39.59 +}
   39.60 +
   39.61 +int MapObj::y() 
   39.62 +{
   39.63 +    return absPos.y();
   39.64 +}
   39.65 +
   39.66 +int MapObj::width() 
   39.67 +{
   39.68 +    return bbox.width();
   39.69 +}
   39.70 +
   39.71 +int MapObj::height() 
   39.72 +{
   39.73 +    return bbox.height();
   39.74 +}
   39.75 +
   39.76 +void MapObj::move (double x, double y) 
   39.77 +{
   39.78 +    int xi=static_cast <int> (x);
   39.79 +    int yi=static_cast <int> (y);
   39.80 +    absPos.setX( xi);
   39.81 +    absPos.setY( yi);
   39.82 +    bbox.moveTopLeft(QPoint(xi,yi));
   39.83 +}
   39.84 +
   39.85 +void MapObj::moveBy (double x, double y) 
   39.86 +{
   39.87 +    move (x+absPos.x(),y+absPos.y() );
   39.88 +}
   39.89 +
   39.90 +bool MapObj::inBBox(QPoint p)
   39.91 +{
   39.92 +    if (p.x() >= bbox.left() && p.x() <= bbox.right()  
   39.93 +	&& p.y() <= bbox.bottom() && p.y() >= bbox.top() )
   39.94 +	return true;
   39.95 +    return false;	
   39.96 +}
   39.97 +
   39.98 +QRect MapObj::getBBox()
   39.99 +{
  39.100 +    return bbox;
  39.101 +}
  39.102 +
  39.103 +QRect MapObj::addBBox(QRect r1, QRect r2)
  39.104 +{
  39.105 +	QRect n;
  39.106 +	// Set left border
  39.107 +	if (r1.left() <= r2.left() )
  39.108 +		n.setLeft(r1.left() );
  39.109 +	else
  39.110 +		n.setLeft(r2.left() );
  39.111 +		
  39.112 +	// Set top border		
  39.113 +	if (r1.top() <= r2.top() )
  39.114 +		n.setTop(r1.top() );
  39.115 +	else
  39.116 +		n.setTop(r2.top() );
  39.117 +		
  39.118 +	// Set right border
  39.119 +	if (r1.right() <= r2.right() )
  39.120 +		n.setRight(r2.right() );
  39.121 +	else
  39.122 +		n.setRight(r1.right() );
  39.123 +		
  39.124 +	// Set bottom 
  39.125 +	if (r1.bottom() <= r2.bottom() )
  39.126 +		n.setBottom(r2.bottom() );
  39.127 +	else
  39.128 +		n.setBottom(r1.bottom() );
  39.129 +	return n;
  39.130 +}
  39.131 +
  39.132 +QSize MapObj::getSize()
  39.133 +{
  39.134 +    return bbox.size();
  39.135 +}
  39.136 +
  39.137 +
  39.138 +bool MapObj::isVisibleObj()
  39.139 +{
  39.140 +    return visible;
  39.141 +}
  39.142 +
  39.143 +void MapObj::setVisibility(bool v)
  39.144 +{
  39.145 +    visible=v;
  39.146 +}
    40.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.2 +++ b/mapobj.h	Sun Jan 30 12:58:47 2005 +0000
    40.3 @@ -0,0 +1,48 @@
    40.4 +#ifndef MAPOBJ_H
    40.5 +#define MAPOBJ_H
    40.6 +
    40.7 +#include <qcanvas.h>
    40.8 +#include <iostream>
    40.9 +
   40.10 +#include "misc.h"
   40.11 +
   40.12 +using namespace std;
   40.13 +
   40.14 +#define Z_BBOX     0
   40.15 +#define Z_LINK    20
   40.16 +#define Z_FRAME   50
   40.17 +#define Z_SELBOX  60
   40.18 +#define Z_ICON    80
   40.19 +#define Z_TEXT   100
   40.20 +
   40.21 +class MapObj:public xmlObj {
   40.22 +public:
   40.23 +    MapObj ();
   40.24 +    MapObj (QCanvas*);
   40.25 +    MapObj (MapObj*);
   40.26 +    virtual ~MapObj ();
   40.27 +    virtual void init ();
   40.28 +    virtual void copy (MapObj*);
   40.29 +	virtual QCanvas* getCanvas();
   40.30 +    virtual int x();
   40.31 +    virtual int y();
   40.32 +	virtual int width();
   40.33 +	virtual int height();
   40.34 +    virtual void move (double x,double y);      // move to absolute Position
   40.35 +    virtual void moveBy (double x,double y);    // move to relative Position
   40.36 +    virtual bool inBBox(QPoint);				// Check if Point is in bbox
   40.37 +    virtual QRect getBBox();					// returns bounding box
   40.38 +    virtual QRect addBBox(QRect,QRect);			// returns bbox which includes both boxes
   40.39 +    virtual QSize getSize();					// returns size of bounding box
   40.40 +    virtual bool isVisibleObj();
   40.41 +    virtual void setVisibility(bool);
   40.42 +protected:  
   40.43 +    QCanvas* canvas;
   40.44 +    QRect bbox;									// bounding box of MO itself
   40.45 +    virtual void positionBBox()=0;       
   40.46 +	virtual void calcBBoxSize()=0;
   40.47 +    QPoint absPos;							    // Position on canvas
   40.48 +    bool visible;
   40.49 +};
   40.50 +
   40.51 +#endif
    41.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.2 +++ b/misc.cpp	Sun Jan 30 12:58:47 2005 +0000
    41.3 @@ -0,0 +1,238 @@
    41.4 +#include <qregexp.h>
    41.5 +#include <qpoint.h>
    41.6 +
    41.7 +#include <math.h>
    41.8 +
    41.9 +#include "misc.h"
   41.10 +
   41.11 +
   41.12 +ostream &operator<< (ostream &stream, QPoint const &p)
   41.13 +{ 
   41.14 +    return (stream << "(" << p.x() << "," << p.y() << ")");
   41.15 +}
   41.16 +
   41.17 +float getAngle(const QPoint &p)
   41.18 +{	
   41.19 +	// Calculate angle of vector to y-axis
   41.20 +	if (p.y()==0)
   41.21 +	{
   41.22 +		if (p.x()>=0)
   41.23 +			return M_PI_2;
   41.24 +		else
   41.25 +			return 3* M_PI_2;
   41.26 +	} else
   41.27 +	{
   41.28 +		if (p.y()>0) 
   41.29 +			return (float)(M_PI  - atan ( (double)(p.x()) / (double)(p.y()) ) );
   41.30 +		else	
   41.31 +			if (p.x()<0)
   41.32 +				return (float)( 2*M_PI - atan ( (double)(p.x()) / (double)(p.y()) ) );
   41.33 +			else	
   41.34 +				return (float)( - atan ( (double)(p.x()) / (double)(p.y()) ) );
   41.35 +	}	
   41.36 +}
   41.37 +
   41.38 +QPoint normalise(const QPoint &p)
   41.39 +{	
   41.40 +	// Calculate normalised position (fixed length) 
   41.41 +
   41.42 +	double px=p.x();
   41.43 +	double py=p.y();
   41.44 +	double x;
   41.45 +	double y;
   41.46 +	double r=150;
   41.47 +
   41.48 +	if (px==0)
   41.49 +	{
   41.50 +		x=0;
   41.51 +		if (py>=0)
   41.52 +			y=r;
   41.53 +		else
   41.54 +			y=-r;
   41.55 +	} else
   41.56 +	{
   41.57 +		double sign;
   41.58 +		double a;
   41.59 +		if (px>0) 
   41.60 +			sign=1; 
   41.61 +		else 
   41.62 +			sign=-1;
   41.63 +		
   41.64 +		a=atan (py / px);
   41.65 +		x=cos (a) * r *sign;
   41.66 +		y=sin (a) * r *sign;
   41.67 +	}	
   41.68 +	return QPoint ((int) (x),(int) (y));
   41.69 +}
   41.70 +
   41.71 +QString maskPath(QString p)
   41.72 +{
   41.73 +	// Change " " to "\ " to enable blanks in filenames
   41.74 +	p=p.replace(QChar('&'),"\\&");
   41.75 +	return p.replace(QChar(' '),"\\ ");
   41.76 +}
   41.77 +
   41.78 +QString convertToRel (const QString &src, const QString &dst)
   41.79 +{
   41.80 +	QString s=src;
   41.81 +	QString d=dst;
   41.82 +	int i;
   41.83 +	// Find relative path from src to dst
   41.84 +
   41.85 +	// Remove the first "/"
   41.86 +	if (s.section ("/",0,0).isEmpty()) 
   41.87 +	{
   41.88 +		s=s.right (s.length()-1);
   41.89 +		d=d.right (d.length()-1);
   41.90 +	}
   41.91 +	
   41.92 +	// remove identical left parts
   41.93 +	while (s.section("/",0,0) == d.section("/",0,0) ) 
   41.94 +	{
   41.95 +		i=s.find ("/");
   41.96 +		s=s.right (s.length()-i-1);
   41.97 +		d=d.right (d.length()-i-1);
   41.98 +	}
   41.99 +
  41.100 +	int srcsep=s.contains("/");
  41.101 +	int dstsep=d.contains("/");
  41.102 +	if (srcsep >=  dstsep )
  41.103 +	{
  41.104 +		// find path to go up first and then back to dst
  41.105 +		i=1;
  41.106 +		while (i<=srcsep) 
  41.107 +		{
  41.108 +			d="../"+d;
  41.109 +			i++;
  41.110 +		}	
  41.111 +	}
  41.112 +	return d;
  41.113 +}
  41.114 +
  41.115 +// returns masked "<" ">" "&"
  41.116 +QString quotemeta(const QString &s)
  41.117 +{
  41.118 +	QString r=s;
  41.119 +    QRegExp  rx("&(?!amp;)");
  41.120 +    r.replace ( rx,"&amp;");
  41.121 +    rx.setPattern( ">");
  41.122 +    r.replace ( rx,"&gt;");
  41.123 +    rx.setPattern( "<");
  41.124 +    r.replace ( rx,"&lt;");
  41.125 +    rx.setPattern( "\"");
  41.126 +    r.replace ( rx,"&quot;");
  41.127 +    return r;
  41.128 +}
  41.129 +
  41.130 +int max(int a, int b)
  41.131 +{
  41.132 +	if (a>b)
  41.133 +		return a;
  41.134 +	return b;
  41.135 +}
  41.136 +
  41.137 +int xmlObj::actindent=0;		// make instance of actindent
  41.138 +
  41.139 +xmlObj::xmlObj()
  41.140 +{
  41.141 +    indentwidth=4;
  41.142 +}
  41.143 +
  41.144 +
  41.145 +// returns <s at />
  41.146 +QString xmlObj::singleElement(QString s, QString at)
  41.147 +{
  41.148 +    return indent() + "<" + s +" " + at +" " + "/>\n";
  41.149 +}
  41.150 +
  41.151 +// returns <s>
  41.152 +QString xmlObj::beginElement(QString s)
  41.153 +{
  41.154 +    return indent() + "<" + s + ">\n";
  41.155 +}
  41.156 +
  41.157 +// returns <s at>
  41.158 +QString xmlObj::beginElement(QString s, QString at)
  41.159 +{
  41.160 +    return indent() + "<" + s + " " + at + ">\n";
  41.161 +}
  41.162 +
  41.163 +// returns </s>
  41.164 +QString xmlObj::endElement(QString s)
  41.165 +{
  41.166 +    return indent() + "</" + s + ">\n";
  41.167 +}
  41.168 +
  41.169 +// returns  at="val"
  41.170 +QString xmlObj::attribut(QString at, QString val)
  41.171 +{
  41.172 +    return " " + at + "=\"" + quotemeta (val) + "\""; 
  41.173 +}
  41.174 +
  41.175 +// returns <s> val </s>
  41.176 +QString xmlObj::valueElement(QString el, QString val)
  41.177 +{
  41.178 +    return indent() + "<" + el + ">" + quotemeta(val) + "</" +el + ">\n";
  41.179 +}
  41.180 +
  41.181 +// returns <s at> val </s>
  41.182 +QString xmlObj::valueElement(QString el, QString val, QString at)
  41.183 +{
  41.184 +    return indent() + "<" + el + " " + at + ">" + quotemeta(val) + "</" +el + ">\n";
  41.185 +}
  41.186 +
  41.187 +void xmlObj::incIndent()
  41.188 +{
  41.189 +    actindent++;
  41.190 +}	
  41.191 +
  41.192 +void xmlObj::decIndent()
  41.193 +{
  41.194 +    actindent--;
  41.195 +    if (actindent<0) actindent=0;
  41.196 +}	
  41.197 +
  41.198 +QString xmlObj::indent()
  41.199 +{
  41.200 +    QString s;
  41.201 +    int i;
  41.202 +    for (i=0; i<actindent*indentwidth; i++)
  41.203 +    {
  41.204 +		s= s + " ";
  41.205 +    }
  41.206 +    return s;
  41.207 +}	
  41.208 +
  41.209 +
  41.210 +
  41.211 +ImagePreview::ImagePreview (QWidget *parent=0): QLabel (parent)
  41.212 +{
  41.213 +}
  41.214 +
  41.215 +void ImagePreview::previewUrl( const QUrl &u )
  41.216 +{
  41.217 +    QString path = u.path();
  41.218 +    QPixmap pix( path );
  41.219 +    if ( pix.isNull() )
  41.220 +        setText( QObject::tr("This is not an image.") );
  41.221 +    else
  41.222 +	{
  41.223 +		float max_w=300;
  41.224 +		float max_h=300;
  41.225 +		float r;
  41.226 +		if (pix.width()>max_w)
  41.227 +		{
  41.228 +			r=max_w / pix.width();
  41.229 +			pix.resize(lrint(pix.width()*r), lrint(pix.height()*r));
  41.230 +			// TODO not a resize, but a shrink/enlarge is needed here...
  41.231 +		}
  41.232 +		if (pix.height()>max_h)
  41.233 +		{
  41.234 +			r=max_h / pix.height();
  41.235 +			pix.resize(lrint(pix.width()*r), lrint(pix.height()*r));
  41.236 +			// TODO not a resize, but a shrink/enlarge is needed here...
  41.237 +		}
  41.238 +        setPixmap( pix );
  41.239 +	}	
  41.240 +}
  41.241 +
    42.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.2 +++ b/misc.h	Sun Jan 30 12:58:47 2005 +0000
    42.3 @@ -0,0 +1,64 @@
    42.4 +#ifndef MISC_H
    42.5 +#define MISC_H
    42.6 +
    42.7 +#include <qpoint.h>
    42.8 +#include <iostream>
    42.9 +
   42.10 +using namespace std;
   42.11 +
   42.12 +#define Z_BBOX     0
   42.13 +#define Z_LINK    20
   42.14 +#define Z_FRAME   50
   42.15 +#define Z_SELBOX  60
   42.16 +#define Z_ICON    80
   42.17 +#define Z_TEXT   100
   42.18 +
   42.19 +enum LoadMode {NewMap,ImportAdd,ImportReplace};
   42.20 +enum SaveMode {PartOfMap,CompleteMap};
   42.21 +
   42.22 +/////////////////////////////////////////////////////////////////////////////
   42.23 +extern ostream &operator<< (ostream &stream, QPoint const &p);
   42.24 +float getAngle(const QPoint &);
   42.25 +QPoint normalise (const QPoint &);
   42.26 +QString maskPath (QString );
   42.27 +QString convertToRel (const QString &,const QString &);
   42.28 +QString quotemeta(const QString&);	
   42.29 +int max (int,int);
   42.30 +class BranchObj;
   42.31 +class MapEditor;
   42.32 +
   42.33 +/////////////////////////////////////////////////////////////////////////////
   42.34 +class xmlObj
   42.35 +{
   42.36 +public:
   42.37 +    xmlObj();
   42.38 +    QString singleElement(QString,QString);
   42.39 +    QString beginElement(QString,QString);
   42.40 +    QString beginElement(QString);
   42.41 +    QString endElement  (QString);
   42.42 +    QString attribut    (QString,QString);
   42.43 +    QString valueElement(QString,QString);
   42.44 +    QString valueElement(QString,QString,QString);
   42.45 +    void incIndent();
   42.46 +    void decIndent();
   42.47 +    static int actindent;
   42.48 +
   42.49 +protected:  
   42.50 +    QString indent();
   42.51 +    int indentwidth;
   42.52 +};
   42.53 +
   42.54 +/////////////////////////////////////////////////////////////////////////////
   42.55 +
   42.56 +#include <qlabel.h>
   42.57 +#include <qfiledialog.h>
   42.58 +#include <qpixmap.h>
   42.59 +
   42.60 +class ImagePreview : public QLabel, public QFilePreview
   42.61 +{
   42.62 +public:
   42.63 +    ImagePreview( QWidget * );
   42.64 +    void previewUrl( const QUrl & );
   42.65 +};
   42.66 +
   42.67 +#endif
    43.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.2 +++ b/noteobj.cpp	Sun Jan 30 12:58:47 2005 +0000
    43.3 @@ -0,0 +1,105 @@
    43.4 +#include <qfile.h>
    43.5 +#include <qtextstream.h>
    43.6 +#include <qmessagebox.h>
    43.7 +#include <qregexp.h>
    43.8 +
    43.9 +#include "noteobj.h"
   43.10 +
   43.11 +/////////////////////////////////////////////////////////////////
   43.12 +// NoteObj
   43.13 +/////////////////////////////////////////////////////////////////
   43.14 +
   43.15 +NoteObj::NoteObj()
   43.16 +{
   43.17 +	clear();
   43.18 +}
   43.19 +
   43.20 +void NoteObj::copy (NoteObj other)
   43.21 +{
   43.22 +	note=other.note;
   43.23 +	fonthint=other.fonthint;
   43.24 +	filenamehint="";
   43.25 +}
   43.26 +
   43.27 +void NoteObj::clear()
   43.28 +{
   43.29 +	note="";
   43.30 +	fonthint="undef";
   43.31 +	filenamehint="";
   43.32 +}
   43.33 +
   43.34 +void NoteObj::setNote (const QString &s)
   43.35 +{
   43.36 +	note=s;
   43.37 +}
   43.38 +
   43.39 +QString NoteObj::getNote()
   43.40 +{
   43.41 +	return note;
   43.42 +}
   43.43 +
   43.44 +void NoteObj::setFontHint (const QString &s)
   43.45 +{
   43.46 +	// only for backward compatibility (pre 1.5 )
   43.47 +	fonthint=s;
   43.48 +}
   43.49 +
   43.50 +QString NoteObj::getFontHint()
   43.51 +{
   43.52 +	// only for backward compatibility (pre 1.5 )
   43.53 +	return fonthint;
   43.54 +}
   43.55 +
   43.56 +void NoteObj::setFilenameHint (const QString &s)
   43.57 +{
   43.58 +	filenamehint=s;
   43.59 +}
   43.60 +
   43.61 +QString NoteObj::getFilenameHint()
   43.62 +{
   43.63 +	return filenamehint;
   43.64 +}
   43.65 +
   43.66 +bool NoteObj::isEmpty ()
   43.67 +{
   43.68 +	return note.isEmpty();
   43.69 +}
   43.70 +
   43.71 +QString NoteObj::saveToDir ()
   43.72 +{
   43.73 +	// QTextEdit may generate fontnames with unquoted &, like
   43.74 +	// in "Lucida B&H". This is invalid in XML and thus would crash
   43.75 +	// the XML parser
   43.76 +	uint pos=0;
   43.77 +	uint pos2;
   43.78 +	bool inbracket=false;
   43.79 +	bool inquot=false;
   43.80 +	while (pos<note.length())
   43.81 +	{
   43.82 +		if (note.mid(pos,1)=="<") inbracket=true;
   43.83 +		if (note.mid(pos,1)==">") inbracket=false;
   43.84 +		if (note.mid(pos,1)=="\"" && inbracket)
   43.85 +		{
   43.86 +			if (!inquot)
   43.87 +				inquot=true;
   43.88 +			else
   43.89 +				inquot=false;
   43.90 +		}
   43.91 +		if (note.mid(pos,1)=="&" && inquot)
   43.92 +		{
   43.93 +			// Now we are inside  <  "  "  >
   43.94 +			// look for ending "
   43.95 +			pos2=pos+1;
   43.96 +			while (note.mid(pos2,1)!=";" && note.mid(pos2,1)!="\"")
   43.97 +				pos2++;
   43.98 +			if (note.mid(pos2,1)=="\"")
   43.99 +			{
  43.100 +				note.replace(pos,1,"&amp;");
  43.101 +				pos=pos2;
  43.102 +			}
  43.103 +		}
  43.104 +		pos++;
  43.105 +	}
  43.106 +	return beginElement ("htmlnote",attribut("fonthint",fonthint)) + "\n"+ note+ "\n" +endElement ("htmlnote");
  43.107 +}
  43.108 +
    44.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.2 +++ b/noteobj.h	Sun Jan 30 12:58:47 2005 +0000
    44.3 @@ -0,0 +1,30 @@
    44.4 +#ifndef NOTEOBJ_H
    44.5 +#define NOTEOBJ_H
    44.6 +
    44.7 +#include <qstring.h>
    44.8 +
    44.9 +class NoteObj;
   44.10 +
   44.11 +#include "misc.h"
   44.12 +
   44.13 +class NoteObj:public xmlObj
   44.14 +{
   44.15 +public:
   44.16 +	NoteObj();
   44.17 +	void copy (NoteObj);
   44.18 +	void clear();
   44.19 +	void setNote (const QString&);
   44.20 +	QString getNote();
   44.21 +	void setFontHint (const QString&);
   44.22 +	QString getFontHint ();
   44.23 +	void setFilenameHint (const QString&);
   44.24 +	QString getFilenameHint ();
   44.25 +	bool isEmpty();
   44.26 +	QString	saveToDir();
   44.27 +
   44.28 +private:
   44.29 +	QString note;
   44.30 +	QString fonthint;
   44.31 +	QString filenamehint;
   44.32 +};
   44.33 +#endif
    45.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.2 +++ b/options.cpp	Sun Jan 30 12:58:47 2005 +0000
    45.3 @@ -0,0 +1,144 @@
    45.4 +#include "options.h"
    45.5 +#include <iostream>
    45.6 +
    45.7 +#include <qapplication.h>
    45.8 +
    45.9 +using namespace std;
   45.10 +
   45.11 +
   45.12 +Option::Option()
   45.13 +{
   45.14 +	name="";
   45.15 +	sName="";
   45.16 +	lName="";
   45.17 +	type=SwitchOption;
   45.18 +	sarg="";
   45.19 +	active=false;
   45.20 +}
   45.21 +
   45.22 +void Option::set(const QString &n, const OptionType &t, const QString &s, const QString &l)
   45.23 +{
   45.24 +	sName="-"+s;
   45.25 +	lName="--"+l;
   45.26 +	type=t;
   45.27 +	name=n;
   45.28 +}
   45.29 +
   45.30 +QString Option::getName () { return name; }
   45.31 +QString Option::getShort () { return sName; }
   45.32 +QString Option::getLong() { return lName; }
   45.33 +OptionType Option::getType() { return type; }
   45.34 +void Option::setArg(const QString& s) { sarg=s; }
   45.35 +QString Option::getArg() { return sarg; }	
   45.36 +void Option::setActive() { active=true; }	
   45.37 +bool Option::isActive() { return active; }
   45.38 +
   45.39 +///////////////////////////////////////////////////////////////
   45.40 +Options::Options() {}	
   45.41 +
   45.42 +int Options::parse()
   45.43 +{
   45.44 +	QStringList arglist;
   45.45 +	int i=0;
   45.46 +	while (i<qApp->argc())
   45.47 +	{	
   45.48 +		arglist.append (qApp->argv()[i]);
   45.49 +		i++;
   45.50 +	}
   45.51 +
   45.52 +	// Get program name
   45.53 +	progname=arglist.first();
   45.54 +	arglist.pop_front();
   45.55 +
   45.56 +	// Work through rest of options
   45.57 +	bool isFile;
   45.58 +	OptionList::iterator itopt;
   45.59 +	QStringList::iterator itarg;
   45.60 +	itarg=arglist.begin();
   45.61 +	while (itarg!=arglist.end())
   45.62 +	{
   45.63 +		isFile=true;
   45.64 +		if ((*itarg).left(1)=="-")
   45.65 +		{
   45.66 +			// Compare given option to all defined options
   45.67 +			itopt=optlist.begin();
   45.68 +			while (itopt!=optlist.end())
   45.69 +			{
   45.70 +				if ((*itarg)==(*itopt).getShort() || 
   45.71 +					(*itarg)==(*itopt).getLong())
   45.72 +				{	
   45.73 +					(*itopt).setActive();
   45.74 +					isFile=false;
   45.75 +					if ((*itopt).getType()==StringOption)
   45.76 +					{
   45.77 +						itarg++;
   45.78 +						if (itarg==arglist.end())
   45.79 +						{
   45.80 +							cout << "Error: argument to option missing\n";
   45.81 +							return 1;
   45.82 +						}
   45.83 +						(*itopt).setArg (*itarg);
   45.84 +						isFile=false;
   45.85 +					}
   45.86 +					break;
   45.87 +				} 
   45.88 +				itopt++;
   45.89 +			}
   45.90 +			if (isFile)
   45.91 +			{
   45.92 +				cout << "Error: Unknown argument "<<*itarg<<endl;
   45.93 +				return 1;
   45.94 +			}
   45.95 +		} else
   45.96 +			filelist.append (*itarg);
   45.97 +		itarg++;
   45.98 +	}
   45.99 +	return 0;
  45.100 +}
  45.101 +
  45.102 +void Options::add (const QString &n, const OptionType &t=SwitchOption, const QString &s="", const QString &l="")
  45.103 +{
  45.104 +	Option o;
  45.105 +	o.set (n,t,s,l);
  45.106 +	optlist.append (o);
  45.107 +}
  45.108 +
  45.109 +void Options::setHelpText (const QString &s)
  45.110 +{
  45.111 +	helptext=s;
  45.112 +}
  45.113 +	
  45.114 +QString Options::getHelpText ()
  45.115 +{
  45.116 +	return helptext;
  45.117 +}
  45.118 +
  45.119 +QString Options::getProgramName()
  45.120 +{
  45.121 +	return progname;
  45.122 +}
  45.123 +
  45.124 +QStringList Options::getFileList ()
  45.125 +{
  45.126 +	return filelist;
  45.127 +}
  45.128 +
  45.129 +bool Options::isOn(const QString &s)
  45.130 +{
  45.131 +	OptionList::iterator it;
  45.132 +	for ( it = optlist.begin(); it != optlist.end(); ++it )
  45.133 +		if ((*it).getName()==s && (*it).isActive() )
  45.134 +			return true;
  45.135 +	return false;
  45.136 +}
  45.137 +
  45.138 +QString Options::getArg(const QString &s)
  45.139 +{
  45.140 +	OptionList::iterator it;
  45.141 +	for ( it = optlist.begin(); it != optlist.end(); ++it )
  45.142 +	{
  45.143 +		if ((*it).getName()==s)
  45.144 +			return (*it).getArg();
  45.145 +	}	
  45.146 +	return "";
  45.147 +}
    46.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.2 +++ b/options.h	Sun Jan 30 12:58:47 2005 +0000
    46.3 @@ -0,0 +1,55 @@
    46.4 +#ifndef OPTIONS_H
    46.5 +#define OPTIONS_H
    46.6 +
    46.7 +#include <qstring.h>
    46.8 +#include <qstringlist.h>
    46.9 +
   46.10 +enum OptionType  {SwitchOption,StringOption};
   46.11 +
   46.12 +class Option
   46.13 +{
   46.14 +public:
   46.15 +	Option();
   46.16 +	void set (const QString &, const OptionType &, const QString &, const QString &);
   46.17 +	QString getName();
   46.18 +	QString getShort();
   46.19 +	QString getLong();
   46.20 +	OptionType getType();
   46.21 +	void setArg(const QString &);
   46.22 +	QString getArg();
   46.23 +	void setActive();
   46.24 +	bool isActive();
   46.25 +private:
   46.26 +	QString name;
   46.27 +	OptionType type;
   46.28 +	QString sName;
   46.29 +	QString lName;
   46.30 +	QString sarg;
   46.31 +	bool active;
   46.32 +};
   46.33 +
   46.34 +
   46.35 +
   46.36 +typedef QValueList <Option> OptionList;
   46.37 +
   46.38 +class Options
   46.39 +{
   46.40 +public:
   46.41 +	Options();
   46.42 +	int parse();
   46.43 +	void add (const QString &,const OptionType &, const QString &, const QString&);
   46.44 +	void setHelpText(const QString&);
   46.45 +	QString getHelpText();
   46.46 +	QString getProgramName();
   46.47 +	QStringList getFileList();
   46.48 +	bool isOn (const QString &);
   46.49 +	QString getArg (const QString &);
   46.50 +
   46.51 +private:
   46.52 +	QString progname;
   46.53 +	QString helptext;
   46.54 +	QStringList filelist;
   46.55 +    OptionList optlist;
   46.56 +};
   46.57 +
   46.58 +#endif
    47.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.2 +++ b/ornamentedobj.cpp	Sun Jan 30 12:58:47 2005 +0000
    47.3 @@ -0,0 +1,211 @@
    47.4 +#include "ornamentedobj.h"
    47.5 +#include "texteditor.h"
    47.6 +#include "mapeditor.h"
    47.7 +#include "linkablemapobj.h"
    47.8 +
    47.9 +extern TextEditor *textEditor;
   47.10 +extern FlagRowObj *systemFlagsDefault;
   47.11 +extern FlagRowObj *standardFlagsDefault;
   47.12 +
   47.13 +
   47.14 +/////////////////////////////////////////////////////////////////
   47.15 +// OrnamentedObj
   47.16 +/////////////////////////////////////////////////////////////////
   47.17 +
   47.18 +OrnamentedObj::OrnamentedObj():LinkableMapObj()
   47.19 +{
   47.20 +  //  cout << "Const OrnamentedObj ()\n";
   47.21 +    init ();
   47.22 +}
   47.23 +
   47.24 +OrnamentedObj::OrnamentedObj(QCanvas* c) :LinkableMapObj(c)
   47.25 +{
   47.26 +//    cout << "Const OrnamentedObj\n";
   47.27 +    init ();
   47.28 +}
   47.29 +
   47.30 +OrnamentedObj::OrnamentedObj (OrnamentedObj* lmo) : LinkableMapObj (lmo->canvas)
   47.31 +{
   47.32 +    copy (lmo);
   47.33 +}
   47.34 +
   47.35 +OrnamentedObj::~OrnamentedObj()
   47.36 +{
   47.37 +    delete (heading);
   47.38 +	delete (systemFlags);
   47.39 +	delete (standardFlags);
   47.40 +
   47.41 +}
   47.42 +
   47.43 +
   47.44 +void OrnamentedObj::init ()
   47.45 +{
   47.46 +	heading = new HeadingObj(canvas);
   47.47 +	heading->move (absPos.x(), absPos.y());
   47.48 +
   47.49 +	note.setNote("");
   47.50 +	note.setFontHint (textEditor->getFontHintDefault() );
   47.51 +
   47.52 +	systemFlags=new FlagRowObj(canvas);
   47.53 +	systemFlags->clone(systemFlagsDefault);
   47.54 +	systemFlags->setName ("systemFlags");
   47.55 +	
   47.56 +	standardFlags=new FlagRowObj(canvas);
   47.57 +	standardFlags->clone(standardFlagsDefault);
   47.58 +	standardFlags->setName ("standardFlags");
   47.59 +
   47.60 +
   47.61 +
   47.62 +}
   47.63 +
   47.64 +void OrnamentedObj::copy (OrnamentedObj* other)
   47.65 +{
   47.66 +    LinkableMapObj::copy(other);
   47.67 +	heading->copy(other->heading);
   47.68 +    setColor   (other->heading->getColor(),false);	
   47.69 +
   47.70 +	note.copy (other->note);
   47.71 +	systemFlags->copy (other->systemFlags);
   47.72 +	standardFlags->copy (other->standardFlags);
   47.73 +
   47.74 +}
   47.75 +
   47.76 +QString OrnamentedObj::getHeading()
   47.77 +{
   47.78 +    return heading->text();
   47.79 +}
   47.80 +
   47.81 +void OrnamentedObj::setLinkColor()
   47.82 +{
   47.83 +	if (mapEditor->getLinkColorHint()==HeadingColor)
   47.84 +		LinkableMapObj::setLinkColor (heading->getColor());
   47.85 +	else	
   47.86 +		LinkableMapObj::setLinkColor (mapEditor->getDefLinkColor());
   47.87 +}
   47.88 +
   47.89 +QColor OrnamentedObj::getColor ()
   47.90 +{
   47.91 +    return heading->getColor();
   47.92 +}
   47.93 +
   47.94 +
   47.95 +void OrnamentedObj::move (double x, double y)
   47.96 +{
   47.97 +	MapObj::move (x,y);
   47.98 +	double dx=frame->getBorder()/2;  // care for border around object
   47.99 +	double dy=frame->getBorder()/2;
  47.100 +	systemFlags-> move (x + dx, y + dy);
  47.101 +
  47.102 +	// vertical align heading to bottom
  47.103 +	int h=max (systemFlags->getBBox().height(), standardFlags->getBBox().height());
  47.104 +	h=max (h,heading->getHeight());
  47.105 +    heading->move (x + dx + systemFlags->getBBox().width(),
  47.106 +					y + dy  + h - heading->getHeight() 
  47.107 +					);
  47.108 +	standardFlags->move (x + heading->getWidth() + systemFlags->getBBox().width(), y + dy );				
  47.109 +
  47.110 +	updateLink();
  47.111 +	requestReposition();
  47.112 +}
  47.113 +
  47.114 +void OrnamentedObj::move (QPoint p)
  47.115 +{
  47.116 +	move (p.x(), p.y());
  47.117 +}	
  47.118 +
  47.119 +void OrnamentedObj::moveBy (double x, double y)
  47.120 +{
  47.121 +
  47.122 +	MapObj::moveBy (x,y);
  47.123 +    frame->moveBy (x,y);
  47.124 +    systemFlags->moveBy (x,y);
  47.125 +    standardFlags->moveBy (x,y);
  47.126 +    heading->moveBy (x,y);
  47.127 +	updateLink();
  47.128 +	requestReposition();
  47.129 +}
  47.130 +
  47.131 +void OrnamentedObj::moveBy (QPoint p)
  47.132 +{
  47.133 +	moveBy (p.x(), p.y());
  47.134 +}	
  47.135 +
  47.136 +void OrnamentedObj::move2RelPos(double x, double y)
  47.137 +{
  47.138 +	if (!parObj) return;
  47.139 +	move (parObj->getChildPos().x()+x, parObj->getChildPos().y()+y);
  47.140 +}
  47.141 +
  47.142 +void OrnamentedObj::move2RelPos(QPoint p)
  47.143 +{
  47.144 +	if (!parObj) return;
  47.145 +	move (parObj->getChildPos().x() + p.x(), parObj->getChildPos().y() + p.y() );
  47.146 +}
  47.147 +
  47.148 +void OrnamentedObj::setNote(QString s)
  47.149 +{
  47.150 +	note.setNote(s);
  47.151 +	if (!note.isEmpty())
  47.152 +		systemFlags->activate("note");
  47.153 +	else		
  47.154 +		systemFlags->deactivate("note");
  47.155 +	calcBBoxSize();
  47.156 +	positionBBox();	
  47.157 +	move (absPos.x(), absPos.y() );
  47.158 +	forceReposition();
  47.159 +}
  47.160 +
  47.161 +void OrnamentedObj::setNote(NoteObj n)
  47.162 +{
  47.163 +	note=n;
  47.164 +	if (!note.isEmpty())
  47.165 +		systemFlags->activate("note");
  47.166 +	else		
  47.167 +		systemFlags->deactivate("note");
  47.168 +	calcBBoxSize();
  47.169 +	positionBBox();	
  47.170 +	move (absPos.x(), absPos.y() );
  47.171 +	forceReposition();
  47.172 +	
  47.173 +}
  47.174 +
  47.175 +QString OrnamentedObj::getNote()
  47.176 +{
  47.177 +    return note.getNote();
  47.178 +}
  47.179 +
  47.180 +void OrnamentedObj::toggleStandardFlag(QString f)
  47.181 +{
  47.182 +	standardFlags->toggle(f);
  47.183 +	calcBBoxSize();
  47.184 +	positionBBox();
  47.185 +	move (absPos.x(), absPos.y() );
  47.186 +	forceReposition();
  47.187 +}
  47.188 +
  47.189 +void OrnamentedObj::activateStandardFlag(QString f)
  47.190 +{
  47.191 +	standardFlags->activate(f);
  47.192 +	calcBBoxSize();
  47.193 +	positionBBox();
  47.194 +	move (absPos.x(), absPos.y() );
  47.195 +	forceReposition();
  47.196 +}
  47.197 +
  47.198 +QString OrnamentedObj::getSystemFlagName(const QPoint &p)
  47.199 +{
  47.200 +	return systemFlags->getFlagName(p);	
  47.201 +}
  47.202 +
  47.203 +void OrnamentedObj::updateNoteFlag()
  47.204 +{
  47.205 +	// text in NoteEditor has changed, notify MapEditor 
  47.206 +	mapEditor->setChanged();
  47.207 +
  47.208 +	// save text
  47.209 +	setNote( textEditor->getText() );
  47.210 +	
  47.211 +	// save font   
  47.212 +	note.setFontHint (textEditor->getFontHint() );
  47.213 +}
  47.214 +
    48.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.2 +++ b/ornamentedobj.h	Sun Jan 30 12:58:47 2005 +0000
    48.3 @@ -0,0 +1,47 @@
    48.4 +#ifndef ORNAMENTEDOBJ_H
    48.5 +#define ORNAMENTEDOBJ_H
    48.6 +
    48.7 +#include "linkablemapobj.h"
    48.8 +
    48.9 +class OrnamentedObj:public LinkableMapObj {
   48.10 +	Q_OBJECT
   48.11 +public:	
   48.12 +    OrnamentedObj ();
   48.13 +    OrnamentedObj (QCanvas*);
   48.14 +    OrnamentedObj (OrnamentedObj*);
   48.15 +    ~OrnamentedObj ();
   48.16 +    virtual void init ();
   48.17 +    virtual void copy (OrnamentedObj*);
   48.18 +
   48.19 +    virtual void setHeading (QString s)=0;  // set the heading, pure virtual 
   48.20 +											// to take care of fontsize
   48.21 +    virtual QString getHeading();			// returns the heading	
   48.22 +	virtual void setLinkColor();			// sets color according to colorhint, overloaded
   48.23 +    virtual void setVisibility(bool,int)=0;	// set visibility
   48.24 +    virtual void setVisibility(bool)=0;	    // set vis. for w
   48.25 +	virtual void setColor(QColor,bool)=0;		// set the color of text and link
   48.26 +	QColor getColor ();						// get color of heading
   48.27 +    virtual void move   (double,double);
   48.28 +    virtual void move   (QPoint);
   48.29 +    virtual void moveBy (double,double);
   48.30 +    virtual void moveBy (QPoint);
   48.31 +    virtual void move2RelPos (QPoint);		// move relativly to parent^
   48.32 +    virtual void move2RelPos (double,double);
   48.33 +    virtual void setNote(QString);			// set note
   48.34 +    virtual void setNote(NoteObj);			// set note
   48.35 +    virtual QString getNote();				// returns note	
   48.36 +	virtual void toggleStandardFlag(QString);
   48.37 +	virtual void activateStandardFlag(QString);
   48.38 +	virtual QString getSystemFlagName (const QPoint &p);
   48.39 +
   48.40 +public slots:
   48.41 +	void updateNoteFlag();
   48.42 +
   48.43 +protected:
   48.44 +    HeadingObj *heading;			// Heading
   48.45 +	NoteObj note;					// Notes
   48.46 +	FlagRowObj *systemFlags;		// System Flags
   48.47 +	FlagRowObj *standardFlags;		// Standard Flags
   48.48 +};
   48.49 +
   48.50 +#endif
    49.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.2 +++ b/process.cpp	Sun Jan 30 12:58:47 2005 +0000
    49.3 @@ -0,0 +1,51 @@
    49.4 +#include "process.h"
    49.5 +
    49.6 +/////////////////////////////////////////////////////////////////
    49.7 +// Process
    49.8 +/////////////////////////////////////////////////////////////////
    49.9 +Process::Process()
   49.10 +{
   49.11 +	connect( this, SIGNAL(readyReadStderr()),
   49.12 +			 this, SLOT(readProcErrout()) );
   49.13 +	connect( this, SIGNAL(readyReadStdout()),
   49.14 +			 this, SLOT(readProcStdout()) );
   49.15 +	clear();		 
   49.16 +}
   49.17 +
   49.18 +Process::~Process()
   49.19 +{
   49.20 +}
   49.21 +
   49.22 +void Process::clear()
   49.23 +{
   49.24 +	errOut="";
   49.25 +	stdOut="";
   49.26 +}
   49.27 +
   49.28 +void Process::waitFinished()
   49.29 +{
   49.30 +	while (isRunning())
   49.31 +	{
   49.32 +	// FIXME use some kind of sleep here...
   49.33 +	}
   49.34 +}
   49.35 +
   49.36 +void Process::readProcErrout()
   49.37 +{
   49.38 +	errOut+=readStderr();
   49.39 +}
   49.40 +
   49.41 +void Process::readProcStdout()
   49.42 +{
   49.43 +	stdOut+=readStdout();
   49.44 +}
   49.45 +
   49.46 +QString Process::getErrout()
   49.47 +{
   49.48 +	return errOut;
   49.49 +}
   49.50 +
   49.51 +QString Process::getStdout()
   49.52 +{
   49.53 +	return stdOut;
   49.54 +}
    50.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.2 +++ b/process.h	Sun Jan 30 12:58:47 2005 +0000
    50.3 @@ -0,0 +1,31 @@
    50.4 +#ifndef PROCESS_H
    50.5 +#define PROCESS_H
    50.6 +
    50.7 +#include <qprocess.h>
    50.8 +#include <qstring.h>
    50.9 +
   50.10 +
   50.11 +using namespace std;
   50.12 +
   50.13 +class Process:public QProcess
   50.14 +{
   50.15 +	Q_OBJECT
   50.16 +public:
   50.17 +    Process ();
   50.18 +	~Process ();
   50.19 +	void clear();
   50.20 +	void waitFinished();
   50.21 +	QString getErrout();
   50.22 +	QString getStdout();
   50.23 +	
   50.24 +
   50.25 +public slots:
   50.26 +	virtual void readProcErrout();
   50.27 +	virtual void readProcStdout();
   50.28 +
   50.29 +private:
   50.30 +	QString errOut;
   50.31 +	QString stdOut;
   50.32 +};
   50.33 +
   50.34 +#endif
    51.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.2 +++ b/selection.cpp	Sun Jan 30 12:58:47 2005 +0000
    51.3 @@ -0,0 +1,47 @@
    51.4 +#include "selection.h"
    51.5 +
    51.6 +
    51.7 +Selection::Selection()
    51.8 +{
    51.9 +}
   51.10 +
   51.11 +Selection::Selection(const Selection &other)
   51.12 +{
   51.13 +}
   51.14 +
   51.15 +Selection::~Selection()
   51.16 +{
   51.17 +}
   51.18 +
   51.19 +void Selection::init()
   51.20 +{
   51.21 +	selectList.setAutoDelete(true);
   51.22 +}
   51.23 +
   51.24 +void Selection::copy(const Selection &other)
   51.25 +{
   51.26 +}
   51.27 +
   51.28 +void Selection::clear()
   51.29 +{
   51.30 +	selectList.clear();
   51.31 +}
   51.32 +
   51.33 +bool Selection::select(LinkableMapObj *lmo)
   51.34 +{
   51.35 +	return false;
   51.36 +}
   51.37 +
   51.38 +void Selection::unselect(LinkableMapObj *lmo)
   51.39 +{
   51.40 +}
   51.41 +
   51.42 +bool Selection::isEmpty()
   51.43 +{
   51.44 +	return selectList.isEmpty();
   51.45 +}
   51.46 +
   51.47 +uint Selection::count()
   51.48 +{
   51.49 +	return selectList.count();
   51.50 +}
    52.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.2 +++ b/selection.h	Sun Jan 30 12:58:47 2005 +0000
    52.3 @@ -0,0 +1,26 @@
    52.4 +#ifndef SELECTIONOBJ_H
    52.5 +#define SELECTIONOBJ_H
    52.6 +
    52.7 +#include "linkablemapobj.h"
    52.8 +#include <qptrlist.h>
    52.9 +
   52.10 +class Selection 
   52.11 +{
   52.12 +public:
   52.13 +	Selection ();
   52.14 +	Selection (const Selection&);
   52.15 +	~Selection();
   52.16 +	void init();
   52.17 +	void copy(const Selection&);
   52.18 +	void clear();
   52.19 +	
   52.20 +	bool select (LinkableMapObj*);
   52.21 +	void unselect (LinkableMapObj*);
   52.22 +	bool isEmpty();
   52.23 +	uint count();
   52.24 +
   52.25 +private:
   52.26 +	QPtrList <LinkableMapObj> selectList;
   52.27 +};
   52.28 +#endif
   52.29 +
    53.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.2 +++ b/settings.cpp	Sun Jan 30 12:58:47 2005 +0000
    53.3 @@ -0,0 +1,132 @@
    53.4 +#include <iostream>
    53.5 +#include "settings.h"
    53.6 +#include "misc.h"
    53.7 +
    53.8 +using namespace std;
    53.9 +/////////////////////////////////////////////////////////////////
   53.10 +// Settings
   53.11 +/////////////////////////////////////////////////////////////////
   53.12 +Settings::Settings()
   53.13 +{
   53.14 +	clear();		 
   53.15 +}
   53.16 +
   53.17 +Settings::~Settings()
   53.18 +{
   53.19 +}
   53.20 +
   53.21 +void Settings::clear()
   53.22 +{
   53.23 +	pathlist.clear();
   53.24 +	keylist.clear();
   53.25 +	valuelist.clear();
   53.26 +}
   53.27 +
   53.28 +void Settings::clearLocal(const QString &s)
   53.29 +{
   53.30 +	QStringList::Iterator itp=pathlist.begin();
   53.31 +	QStringList::Iterator itk=keylist.begin();
   53.32 +	QStringList::Iterator itv=valuelist.begin();
   53.33 +
   53.34 +	while (itp !=pathlist.end() )
   53.35 +	{
   53.36 +		if ((*itk).startsWith (s))
   53.37 +		{
   53.38 +			itp=pathlist.remove (itp);
   53.39 +			itk=keylist.remove (itk);
   53.40 +			itv=valuelist.remove (itv);
   53.41 +		}	else
   53.42 +		{
   53.43 +			itp++;
   53.44 +			itk++;
   53.45 +			itv++;
   53.46 +		}
   53.47 +	}
   53.48 +}
   53.49 +
   53.50 +QString Settings::readLocalEntry ( const QString &fpath, const QString & key, const QString & def = QString::null ) 
   53.51 +{
   53.52 +	QStringList::Iterator itp=pathlist.begin();
   53.53 +	QStringList::Iterator itk=keylist.begin();
   53.54 +	QStringList::Iterator itv=valuelist.begin();
   53.55 +
   53.56 +	// First search for value in settings saved in map
   53.57 +	while (itp !=pathlist.end() )
   53.58 +	{
   53.59 +		if (*itp == fpath && *itk == key)
   53.60 +			return *itv;
   53.61 +		itp++;
   53.62 +		itk++;
   53.63 +		itv++;
   53.64 +	}
   53.65 +
   53.66 +	// Fall back to global vym settings
   53.67 +	bool ok;
   53.68 +	return readEntry (key,def, &ok);
   53.69 +}	
   53.70 +
   53.71 +void Settings::setLocalEntry (const QString &fpath, const QString &key, const QString &value)
   53.72 +{
   53.73 +	QStringList::Iterator itp=pathlist.begin();
   53.74 +	QStringList::Iterator itk=keylist.begin();
   53.75 +	QStringList::Iterator itv=valuelist.begin();
   53.76 +
   53.77 +	if (!fpath.isEmpty() && !key.isEmpty() && !value.isEmpty() )
   53.78 +	{
   53.79 +		// Search for existing entry first
   53.80 +		while (itp !=pathlist.end() )
   53.81 +		{
   53.82 +			if (*itp == fpath && *itk == key)
   53.83 +			{
   53.84 +				*itv=value;
   53.85 +				return;
   53.86 +			}
   53.87 +			itp++;
   53.88 +			itk++;
   53.89 +			itv++;
   53.90 +		}
   53.91 +		
   53.92 +		// If no entry exists, append a new one
   53.93 +		pathlist.append (fpath);
   53.94 +		keylist.append (key);
   53.95 +		valuelist.append (value);
   53.96 +	}
   53.97 +}
   53.98 +
   53.99 +QString Settings::getXMLData (const QString &fpath)
  53.100 +{
  53.101 +	QString s;
  53.102 +	QStringList::Iterator itp=pathlist.begin();
  53.103 +	QStringList::Iterator itk=keylist.begin();
  53.104 +	QStringList::Iterator itv=valuelist.begin();
  53.105 +
  53.106 +	while (itp !=pathlist.end() )
  53.107 +	{
  53.108 +		if (*itp == fpath )
  53.109 +			if (!(*itv).isEmpty())
  53.110 +				s+=singleElement (
  53.111 +					"setting",
  53.112 +					attribut ("key",*itk) 
  53.113 +					+attribut ("value",*itv)
  53.114 +				)+"\n";
  53.115 +		itp++;
  53.116 +		itk++;
  53.117 +		itv++;
  53.118 +	}
  53.119 +	return s;
  53.120 +}
  53.121 +
  53.122 +void Settings::write()
  53.123 +{
  53.124 +	QStringList::Iterator itp=pathlist.begin();
  53.125 +	QStringList::Iterator itk=keylist.begin();
  53.126 +	QStringList::Iterator itv=valuelist.begin();
  53.127 +
  53.128 +	while (itp !=pathlist.end() )
  53.129 +	{
  53.130 +		itp++;
  53.131 +		itk++;
  53.132 +		itv++;
  53.133 +	}
  53.134 +}
  53.135 +
    54.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.2 +++ b/settings.h	Sun Jan 30 12:58:47 2005 +0000
    54.3 @@ -0,0 +1,29 @@
    54.4 +#ifndef SETTINGS_H
    54.5 +#define SETTINGS_H
    54.6 +
    54.7 +#include <qsettings.h>
    54.8 +#include <qstring.h>
    54.9 +#include <qstringlist.h>
   54.10 +
   54.11 +#include "misc.h"
   54.12 +
   54.13 +
   54.14 +class Settings:public QSettings,public xmlObj
   54.15 +{
   54.16 +public:
   54.17 +    Settings ();
   54.18 +	~Settings ();
   54.19 +	void clear();
   54.20 +	void clearLocal (const QString &);
   54.21 +	QString readLocalEntry ( const QString &, const QString &, const QString &);
   54.22 +	void setLocalEntry (const QString &, const QString &, const QString &);
   54.23 +	QString getXMLData (const QString &);
   54.24 +	void write ();
   54.25 +
   54.26 +protected:
   54.27 +	QStringList pathlist;
   54.28 +	QStringList keylist;
   54.29 +	QStringList valuelist;
   54.30 +};
   54.31 +
   54.32 +#endif
    55.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.2 +++ b/showtextdialog.ui	Sun Jan 30 12:58:47 2005 +0000
    55.3 @@ -0,0 +1,135 @@
    55.4 +<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
    55.5 +<class>ShowTextDialog</class>
    55.6 +<author>Uwe Drechsel</author>
    55.7 +<widget class="QDialog">
    55.8 +    <property name="name">
    55.9 +        <cstring>ShowTextDialog</cstring>
   55.10 +    </property>
   55.11 +    <property name="enabled">
   55.12 +        <bool>true</bool>
   55.13 +    </property>
   55.14 +    <property name="geometry">
   55.15 +        <rect>
   55.16 +            <x>0</x>
   55.17 +            <y>0</y>
   55.18 +            <width>560</width>
   55.19 +            <height>383</height>
   55.20 +        </rect>
   55.21 +    </property>
   55.22 +    <property name="sizePolicy">
   55.23 +        <sizepolicy>
   55.24 +            <hsizetype>5</hsizetype>
   55.25 +            <vsizetype>5</vsizetype>
   55.26 +            <horstretch>0</horstretch>
   55.27 +            <verstretch>0</verstretch>
   55.28 +        </sizepolicy>
   55.29 +    </property>
   55.30 +    <property name="backgroundOrigin">
   55.31 +        <enum>WidgetOrigin</enum>
   55.32 +    </property>
   55.33 +    <property name="caption">
   55.34 +        <string>VYM - Info</string>
   55.35 +    </property>
   55.36 +    <property name="sizeGripEnabled">
   55.37 +        <bool>false</bool>
   55.38 +    </property>
   55.39 +    <vbox>
   55.40 +        <property name="name">
   55.41 +            <cstring>unnamed</cstring>
   55.42 +        </property>
   55.43 +        <widget class="QLayoutWidget">
   55.44 +            <property name="name">
   55.45 +                <cstring>layout9</cstring>
   55.46 +            </property>
   55.47 +            <vbox>
   55.48 +                <property name="name">
   55.49 +                    <cstring>unnamed</cstring>
   55.50 +                </property>
   55.51 +                <widget class="QTextEdit">
   55.52 +                    <property name="name">
   55.53 +                        <cstring>textEdit1</cstring>
   55.54 +                    </property>
   55.55 +                    <property name="sizePolicy">
   55.56 +                        <sizepolicy>
   55.57 +                            <hsizetype>7</hsizetype>
   55.58 +                            <vsizetype>7</vsizetype>
   55.59 +                            <horstretch>0</horstretch>
   55.60 +                            <verstretch>0</verstretch>
   55.61 +                        </sizepolicy>
   55.62 +                    </property>
   55.63 +                </widget>
   55.64 +                <widget class="QLayoutWidget">
   55.65 +                    <property name="name">
   55.66 +                        <cstring>layout8</cstring>
   55.67 +                    </property>
   55.68 +                    <hbox>
   55.69 +                        <property name="name">
   55.70 +                            <cstring>unnamed</cstring>
   55.71 +                        </property>
   55.72 +                        <spacer>
   55.73 +                            <property name="name">
   55.74 +                                <cstring>spacer4</cstring>
   55.75 +                            </property>
   55.76 +                            <property name="orientation">
   55.77 +                                <enum>Horizontal</enum>
   55.78 +                            </property>
   55.79 +                            <property name="sizeType">
   55.80 +                                <enum>Expanding</enum>
   55.81 +                            </property>
   55.82 +                            <property name="sizeHint">
   55.83 +                                <size>
   55.84 +                                    <width>141</width>
   55.85 +                                    <height>21</height>
   55.86 +                                </size>
   55.87 +                            </property>
   55.88 +                        </spacer>
   55.89 +                        <widget class="QPushButton">
   55.90 +                            <property name="name">
   55.91 +                                <cstring>pushButton4</cstring>
   55.92 +                            </property>
   55.93 +                            <property name="sizePolicy">
   55.94 +                                <sizepolicy>
   55.95 +                                    <hsizetype>7</hsizetype>
   55.96 +                                    <vsizetype>0</vsizetype>
   55.97 +                                    <horstretch>0</horstretch>
   55.98 +                                    <verstretch>0</verstretch>
   55.99 +                                </sizepolicy>
  55.100 +                            </property>
  55.101 +                            <property name="maximumSize">
  55.102 +                                <size>
  55.103 +                                    <width>150</width>
  55.104 +                                    <height>32767</height>
  55.105 +                                </size>
  55.106 +                            </property>
  55.107 +                            <property name="text">
  55.108 +                                <string>Close</string>
  55.109 +                            </property>
  55.110 +                            <property name="default">
  55.111 +                                <bool>true</bool>
  55.112 +                            </property>
  55.113 +                        </widget>
  55.114 +                    </hbox>
  55.115 +                </widget>
  55.116 +            </vbox>
  55.117 +        </widget>
  55.118 +    </vbox>
  55.119 +</widget>
  55.120 +<connections>
  55.121 +    <connection>
  55.122 +        <sender>pushButton4</sender>
  55.123 +        <signal>clicked()</signal>
  55.124 +        <receiver>ShowTextDialog</receiver>
  55.125 +        <slot>accept()</slot>
  55.126 +    </connection>
  55.127 +</connections>
  55.128 +<includes>
  55.129 +    <include location="local" impldecl="in implementation">showtextdialog.ui.h</include>
  55.130 +</includes>
  55.131 +<slots>
  55.132 +    <slot access="private">init()</slot>
  55.133 +    <slot>setText( const QString &amp; t )</slot>
  55.134 +    <slot>append( const QString &amp; t )</slot>
  55.135 +</slots>
  55.136 +<pixmapinproject/>
  55.137 +<layoutdefaults spacing="6" margin="11"/>
  55.138 +</UI>
    56.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    56.2 +++ b/showtextdialog.ui.h	Sun Jan 30 12:58:47 2005 +0000
    56.3 @@ -0,0 +1,18 @@
    56.4 +void ShowTextDialog::init()
    56.5 +{
    56.6 +	textEdit1->setReadOnly (true);
    56.7 +}
    56.8 +
    56.9 +
   56.10 +void ShowTextDialog::setText(const QString &t)
   56.11 +{
   56.12 +	textEdit1->setText (t);
   56.13 +}
   56.14 +
   56.15 +
   56.16 +
   56.17 +
   56.18 +void ShowTextDialog::append( const QString &t )
   56.19 +{
   56.20 +	textEdit1->append (t);
   56.21 +}
    57.1 Binary file tex/color-buttons.png has changed
    58.1 Binary file tex/default-flags.png has changed
    59.1 Binary file tex/example1.png has changed
    60.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    60.2 +++ b/texteditor.cpp	Sun Jan 30 12:58:47 2005 +0000
    60.3 @@ -0,0 +1,921 @@
    60.4 +#include "texteditor.h"
    60.5 +
    60.6 +#include <qcanvas.h>
    60.7 +#include <qstatusbar.h>
    60.8 +#include <qmessagebox.h>
    60.9 +#include <qaction.h>
   60.10 +#include <qapplication.h>
   60.11 +#include <qpainter.h>
   60.12 +#include <qprinter.h>
   60.13 +#include <qfile.h>
   60.14 +#include <qfiledialog.h>
   60.15 +#include <qtoolbar.h>
   60.16 +#include <qpopupmenu.h>
   60.17 +#include <qmenubar.h>
   60.18 +#include <qtextedit.h>
   60.19 +#include <qaccel.h>
   60.20 +#include <qtextstream.h>
   60.21 +#include <qpaintdevicemetrics.h>
   60.22 +#include <qsettings.h>
   60.23 +#include <qfontdialog.h>
   60.24 +#include <qmessagebox.h>
   60.25 +#include <qcolordialog.h>
   60.26 +#include <qregexp.h>
   60.27 +#include <qlineedit.h>
   60.28 +#include <qsimplerichtext.h>
   60.29 +
   60.30 +#include <iostream>
   60.31 +#include <stdlib.h>
   60.32 +#include <typeinfo>
   60.33 +
   60.34 +#include "icons/fileopen.xpm"
   60.35 +#include "icons/filesave.xpm"
   60.36 +#include "icons/fileprint.xpm"
   60.37 +#include "icons/editundo.xpm"	
   60.38 +#include "icons/editredo.xpm"	
   60.39 +#include "icons/editcopy.xpm"
   60.40 +#include "icons/editcut.xpm"
   60.41 +#include "icons/editpaste.xpm"
   60.42 +#include "icons/edittrash.xpm"
   60.43 +#include "icons/formatfixedfont.xpm"
   60.44 +#include "icons/formattextbold.xpm"
   60.45 +#include "icons/formattextitalic.xpm"
   60.46 +#include "icons/formattextunder.xpm"
   60.47 +#include "icons/formattextleft.xpm"
   60.48 +#include "icons/formattextcenter.xpm"
   60.49 +#include "icons/formattextright.xpm"
   60.50 +#include "icons/formattextjustify.xpm"
   60.51 +
   60.52 +extern QCanvas* actCanvas;
   60.53 +extern int statusbarTime;
   60.54 +extern QSettings settings;
   60.55 +
   60.56 +using namespace std;
   60.57 +
   60.58 +
   60.59 +///////////////////////////////////////////////////////////////////////
   60.60 +///////////////////////////////////////////////////////////////////////
   60.61 +
   60.62 +TextEditor::TextEditor()
   60.63 +{
   60.64 +    printer = new QPrinter( QPrinter::HighResolution );
   60.65 +
   60.66 +	// Editor
   60.67 +    e = new QTextEdit( this, "editor" );
   60.68 +    e->setFocus();
   60.69 +	e->setTextFormat(RichText);		// default
   60.70 +	e->setTabStopWidth (20);		// unit is pixel
   60.71 +	e->setColor (black);
   60.72 +	connect (e, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) );
   60.73 +    setCentralWidget( e );
   60.74 +    statusBar()->message( "Ready", statusbarTime);
   60.75 +	setCaption("VYM - Note Editor");
   60.76 +
   60.77 +	// Toolbars
   60.78 +	setupFileActions();
   60.79 +	setupEditActions();
   60.80 +	setupFormatActions();
   60.81 +	setupSettingsActions();
   60.82 +	
   60.83 +	// Various states
   60.84 +	emptyPaper   = QBrush(gray);
   60.85 +	filledPaper  = QBrush(white);
   60.86 +	inactivePaper= QBrush(black);
   60.87 +	setInactive();
   60.88 +
   60.89 +	// Load Settings
   60.90 +	resize (settings.readNumEntry( "/vym/noteeditor/geometry/width", 450),
   60.91 +	        settings.readNumEntry( "/vym/noteeditor/geometry/height",600));
   60.92 +	move   (settings.readNumEntry( "/vym/noteeditor/geometry/posX", 150),
   60.93 +	        settings.readNumEntry( "/vym/noteeditor/geometry/posY",  50));
   60.94 +	
   60.95 +	if (settings.readEntry( "/vym/noteeditor/showWithMain","yes") =="yes")
   60.96 +		setShowWithMain(true);
   60.97 +	else	
   60.98 +		setShowWithMain(false);
   60.99 +
  60.100 +	varFont.fromString( settings.readEntry 
  60.101 +		("/vym/noteeditor/fonts/varFont",
  60.102 +		"Nimbus Sans l,14,-1,5,48,0,0,0,0,0") 
  60.103 +	);
  60.104 +	fixedFont.fromString (settings.readEntry (
  60.105 +		"/vym/noteeditor/fonts/fixedFont",
  60.106 +		"Courier,14,-1,5,48,0,0,0,1,0") 
  60.107 +	);
  60.108 +	QString s=settings.readEntry ("/vym/noteeditor/fonts/fonthintDefault","variable");
  60.109 +	if (s == "fixed")
  60.110 +	{	
  60.111 +		actionSettingsFonthintDefault->setOn (true);
  60.112 +		e->setCurrentFont (fixedFont);
  60.113 +	} else	
  60.114 +	{
  60.115 +		actionSettingsFonthintDefault->setOn (false);
  60.116 +		e->setCurrentFont (varFont);
  60.117 +	}	
  60.118 +}
  60.119 +
  60.120 +
  60.121 +TextEditor::~TextEditor()
  60.122 +{
  60.123 +    if (printer) delete printer;
  60.124 +	// Save Settings
  60.125 +	settings.writeEntry( "/vym/noteeditor/geometry/width", width() );
  60.126 +	settings.writeEntry( "/vym/noteeditor/geometry/height", height() );
  60.127 +	settings.writeEntry( "/vym/noteeditor/geometry/posX", pos().x() );
  60.128 +	settings.writeEntry( "/vym/noteeditor/geometry/posY", pos().y() );
  60.129 +	
  60.130 +	if (showWithMain())
  60.131 +		settings.writeEntry( "/vym/noteeditor/showWithMain","yes");
  60.132 +	else	
  60.133 +		settings.writeEntry( "/vym/noteeditor/showWithMain","no");
  60.134 +
  60.135 +	QString s;
  60.136 +	if (actionSettingsFonthintDefault->isOn() )
  60.137 +		s="fixed";
  60.138 +	else	
  60.139 +		s="variable";
  60.140 +	settings.writeEntry( "/vym/noteeditor/fonts/fonthintDefault",s );
  60.141 +	settings.writeEntry ("/vym/noteeditor/fonts/varFont",
  60.142 +		varFont.toString() );
  60.143 +	settings.writeEntry ("/vym/noteeditor/fonts/fixedFont",
  60.144 +		fixedFont.toString() );
  60.145 +}
  60.146 +
  60.147 +bool TextEditor::isEmpty()
  60.148 +{
  60.149 +	if (e->text().length())
  60.150 +		return false;
  60.151 +	else
  60.152 +		return true;
  60.153 +}
  60.154 +
  60.155 +void TextEditor::setShowWithMain(bool v)
  60.156 +{
  60.157 +	showwithmain=v;
  60.158 +}
  60.159 +
  60.160 +bool TextEditor::showWithMain()
  60.161 +{
  60.162 +	return showwithmain;
  60.163 +}
  60.164 +
  60.165 +void TextEditor::setFontHint (const QString &fh)
  60.166 +{
  60.167 +	if (fh=="fixed")
  60.168 +		actionFormatUseFixedFont->setOn (true);
  60.169 +	else
  60.170 +		actionFormatUseFixedFont->setOn (false);
  60.171 +}
  60.172 +
  60.173 +
  60.174 +QString TextEditor::getFontHint()
  60.175 +{
  60.176 +	if (actionFormatUseFixedFont->isOn())
  60.177 +		return "fixed";
  60.178 +	else	
  60.179 +		return "var";
  60.180 +}
  60.181 +
  60.182 +QString TextEditor::getFontHintDefault()
  60.183 +{
  60.184 +	if (actionSettingsFonthintDefault->isOn())
  60.185 +		return "fixed";
  60.186 +	else	
  60.187 +		return "var";
  60.188 +}
  60.189 +
  60.190 +void TextEditor::setFilename(const QString &fn)
  60.191 +{
  60.192 +	if (state==filledEditor)
  60.193 +		if (fn.isEmpty() )
  60.194 +		{
  60.195 +			filename="";
  60.196 +			statusBar()->message( "No filename available for this note.", statusbarTime );
  60.197 +		}	
  60.198 +		else
  60.199 +		{
  60.200 +			filename=fn;
  60.201 +			statusBar()->message( QString( "Current filename is %1" ).arg( filename ), statusbarTime );
  60.202 +		}	
  60.203 +}
  60.204 +
  60.205 +QString TextEditor::getFilename()
  60.206 +{
  60.207 +	return filename;
  60.208 +}
  60.209 +
  60.210 +bool TextEditor::findText(const QString &t, const bool &cs)
  60.211 +{
  60.212 +	bool wo=false;	// word matches
  60.213 +	if (e->find (t, cs, wo, true, 0, 0 ))
  60.214 +		return true;
  60.215 +	else	
  60.216 +		return false;
  60.217 +}
  60.218 +
  60.219 +void TextEditor::setupFileActions()
  60.220 +{
  60.221 +    QToolBar *tb = new QToolBar( this );
  60.222 +    tb->setLabel( "File Actions" );
  60.223 +    QPopupMenu *menu = new QPopupMenu( this );
  60.224 +    menuBar()->insertItem( tr( "&File" ), menu );
  60.225 +
  60.226 +    QAction *a;
  60.227 +    a = new QAction( tr( "Import" ), QPixmap( fileopen_xpm), tr( "&Import..." ), CTRL + Key_O, this, "fileImport" );
  60.228 +    connect( a, SIGNAL( activated() ), this, SLOT( textLoad() ) );
  60.229 +	a->setEnabled(false);
  60.230 +    a->addTo( tb );
  60.231 +    a->addTo( menu );
  60.232 +	actionFileLoad=a;
  60.233 +
  60.234 +    menu->insertSeparator();
  60.235 +    a = new QAction( tr( "Export Note (HTML)" ), QPixmap( filesave_xpm ), tr( "&Export..." ), CTRL + Key_S, this, "fileSave" );
  60.236 +    connect( a, SIGNAL( activated() ), this, SLOT( textSave() ) );
  60.237 +    a->addTo( tb );
  60.238 +    a->addTo( menu );
  60.239 +	actionFileSave=a;
  60.240 +	
  60.241 +    a = new QAction( tr( "Export Note As (HTML) " ), QPixmap(), tr( "Export &As... (HTML)" ), 0, this, "exportHTML" );
  60.242 +    connect( a, SIGNAL( activated() ), this, SLOT( textSaveAs() ) );
  60.243 +    a->addTo( menu );
  60.244 +	actionFileSaveAs=a;
  60.245 +
  60.246 +    a = new QAction( tr( "Export Note As (ASCII) " ), QPixmap(), tr( "Export &As...(ASCII)" ), ALT + Key_X, this, "exportASCII" );
  60.247 +    connect( a, SIGNAL( activated() ), this, SLOT( textExportAsASCII() ) );
  60.248 +    a->addTo( menu );
  60.249 +	actionFileSaveAs=a;
  60.250 +
  60.251 +    menu->insertSeparator();
  60.252 +    a = new QAction( tr( "Print Note" ), QPixmap( fileprint_xpm ), tr( "&Print..." ), CTRL + Key_P, this, "filePrint" );
  60.253 +    connect( a, SIGNAL( activated() ), this, SLOT( textPrint() ) );
  60.254 +    a->addTo( tb );
  60.255 +    a->addTo( menu );
  60.256 +	actionFilePrint=a;
  60.257 +}
  60.258 +
  60.259 +void TextEditor::setupEditActions()
  60.260 +{
  60.261 +    QToolBar *tb = new QToolBar( this );
  60.262 +    tb->setLabel( "Edit Actions" );
  60.263 +    QPopupMenu *menu = new QPopupMenu( this );
  60.264 +    menuBar()->insertItem( tr( "&Edit" ), menu );
  60.265 +
  60.266 +    QAction *a;
  60.267 +    a = new QAction( tr( "Undo" ), QPixmap(editundo_xpm), tr( "&Undo" ), CTRL + Key_Z, this, "undoEvent" );
  60.268 +    connect( a, SIGNAL( activated() ), e, SLOT( undo() ) );
  60.269 +    a->addTo( menu );
  60.270 +    a->addTo( tb);
  60.271 +	actionEditUndo=a;
  60.272 +	
  60.273 +    a = new QAction( tr( "Redo" ), QPixmap( editredo_xpm ), tr( "&Redo" ), CTRL + Key_Y, this, "editRedo" ); 
  60.274 +    connect( a, SIGNAL( activated() ), e, SLOT( redo() ) );
  60.275 +    a->addTo( tb );
  60.276 +    a->addTo( menu );
  60.277 +	actionEditRedo=a;
  60.278 +
  60.279 +    menu->insertSeparator();
  60.280 +    a = new QAction( tr( "Select and copy all" ), QPixmap(), tr( "Select and copy &all" ), CTRL + Key_A, this, "editcopyall" ); 
  60.281 +    connect( a, SIGNAL( activated() ), this, SLOT( editCopyAll() ) );
  60.282 +    a->addTo( menu );
  60.283 +
  60.284 +    menu->insertSeparator();
  60.285 +    a = new QAction( tr( "Copy" ), QPixmap( editcopy_xpm ), tr( "&Copy" ), CTRL + Key_C, this, "editCopy" );
  60.286 +    connect( a, SIGNAL( activated() ), e, SLOT( copy() ) );
  60.287 +    a->addTo( tb );
  60.288 +    a->addTo( menu );
  60.289 +	actionEditCopy=a;
  60.290 +	
  60.291 +    a = new QAction( tr( "Cut" ), QPixmap( editcut_xpm ), tr( "Cu&t" ), CTRL + Key_X, this, "editCut" );
  60.292 +    connect( a, SIGNAL( activated() ), e, SLOT( cut() ) );
  60.293 +    a->addTo( tb );
  60.294 +    a->addTo( menu );
  60.295 +	actionEditCut=a;
  60.296 +
  60.297 +    a = new QAction( tr( "Paste" ), QPixmap( editpaste_xpm ), tr( "&Paste" ), CTRL + Key_V, this, "editPaste" );
  60.298 +    connect( a, SIGNAL( activated() ), e, SLOT( paste() ) );
  60.299 +    a->addTo( tb );
  60.300 +    a->addTo( menu );
  60.301 +	actionEditPaste=a;
  60.302 +	
  60.303 +    a = new QAction( tr( "Delete all" ), QPixmap( edittrash_xpm ), tr( "&Delete All" ), 0, this, "editDeleteAll" );
  60.304 +    connect( a, SIGNAL( activated() ), e, SLOT( clear() ) );
  60.305 +    a->addTo( tb );
  60.306 +    a->addTo( menu );
  60.307 +	actionEditDeleteAll=a;
  60.308 +
  60.309 +	a = new QAction( tr( "Convert paragraphs to linebreaks" ), QPixmap(), tr( "&Convert Paragraphs" ), ALT + Key_P, this, "editConvertPar" );
  60.310 +    connect( a, SIGNAL( activated() ), this, SLOT( textConvertPar() ) );
  60.311 +    a->addTo( menu );
  60.312 +	actionEditConvertPar=a;
  60.313 +
  60.314 +	a = new QAction( tr( "Join all lines of a paragraph" ), QPixmap(), tr( "&Join lines" ), ALT + Key_J, this, "editJoinLines" );
  60.315 +    connect( a, SIGNAL( activated() ), this, SLOT( textJoinLines() ) );
  60.316 +    a->addTo( menu );
  60.317 +	actionEditJoinLines=a;
  60.318 +}
  60.319 +
  60.320 +void TextEditor::setupFormatActions()
  60.321 +{
  60.322 +    QToolBar *tb = new QToolBar( this );
  60.323 +    tb->setLabel( "Format Actions" );
  60.324 +    QPopupMenu *menu = new QPopupMenu( this );
  60.325 +    menuBar()->insertItem( tr( "&Format" ), menu );
  60.326 +
  60.327 +    QAction *a;
  60.328 +
  60.329 +    a = new QAction( tr( "Toggle font hint for the whole text" ), QPixmap(formatfixedfont_xpm), tr( "&Font hint" ), ALT + Key_I, this, "fontHint" );
  60.330 +	a->setToggleAction (true);
  60.331 +	a->setOn (settings.readBoolEntry ("/vym/noteeditor/fonts/useFixedByDefault",false) );
  60.332 +    connect( a, SIGNAL( activated() ), this, SLOT( toggleFonthint() ) );
  60.333 +    a->addTo( menu );
  60.334 +    a->addTo( tb );
  60.335 +	actionFormatUseFixedFont=a;
  60.336 +
  60.337 +	menu->insertSeparator();
  60.338 +
  60.339 +    comboFont = new QComboBox( true, tb );
  60.340 +    QFontDatabase db;
  60.341 +    comboFont->insertStringList( db.families() );
  60.342 +    connect( comboFont, SIGNAL( activated( const QString & ) ),
  60.343 +	     this, SLOT( textFamily( const QString & ) ) );
  60.344 +    comboFont->lineEdit()->setText( QApplication::font().family() );
  60.345 +
  60.346 +    comboSize = new QComboBox( true, tb );
  60.347 +    QValueList<int> sizes = db.standardSizes();
  60.348 +    QValueList<int>::Iterator it = sizes.begin();
  60.349 +    for ( ; it != sizes.end(); ++it )
  60.350 +	comboSize->insertItem( QString::number( *it ) );
  60.351 +    connect( comboSize, SIGNAL( activated( const QString & ) ),
  60.352 +	     this, SLOT( textSize( const QString & ) ) );
  60.353 +    comboSize->lineEdit()->setText( QString::number( QApplication::font().pointSize() ) );
  60.354 +
  60.355 +    menu->insertSeparator();
  60.356 +
  60.357 +    QPixmap pix( 16, 16 );
  60.358 +    pix.fill( e->color());
  60.359 +    actionTextColor = new QAction( pix, tr( "&Color..." ), 0, this, "textColor" );
  60.360 +    connect( actionTextColor, SIGNAL( activated() ), this, SLOT( textColor() ) );
  60.361 +    actionTextColor->addTo( tb );
  60.362 +    actionTextColor->addTo( menu );
  60.363 +
  60.364 +    actionTextBold = new QAction( QPixmap (formattextbold_xpm), tr( "&Bold" ), CTRL + Key_B, this, "textBold" );
  60.365 +    connect( actionTextBold, SIGNAL( activated() ), this, SLOT( textBold() ) );
  60.366 +    actionTextBold->addTo( tb );
  60.367 +    actionTextBold->addTo( menu );
  60.368 +    actionTextBold->setToggleAction( true );
  60.369 +    actionTextItalic = new QAction( QPixmap(formattextitalic_xpm ), tr( "&Italic" ), CTRL + Key_I, this, "textItalic" );
  60.370 +    connect( actionTextItalic, SIGNAL( activated() ), this, SLOT( textItalic() ) );
  60.371 +    actionTextItalic->addTo( tb );
  60.372 +    actionTextItalic->addTo( menu );
  60.373 +    actionTextItalic->setToggleAction( true );
  60.374 +    actionTextUnderline = new QAction( QPixmap (formattextunder_xpm ), tr( "&Underline" ), CTRL + Key_U, this, "textUnderline" );
  60.375 +    connect( actionTextUnderline, SIGNAL( activated() ), this, SLOT( textUnderline() ) );
  60.376 +    actionTextUnderline->addTo( tb );
  60.377 +    actionTextUnderline->addTo( menu );
  60.378 +    actionTextUnderline->setToggleAction( true );
  60.379 +    menu->insertSeparator();
  60.380 +
  60.381 +    QActionGroup *grp = new QActionGroup( this );
  60.382 +    connect( grp, SIGNAL( selected( QAction* ) ), this, SLOT( textAlign( QAction* ) ) );
  60.383 +
  60.384 +    actionAlignLeft = new QAction( QPixmap (formattextleft_xpm ), tr( "&Left" ), CTRL + Key_L, grp, "textLeft" );
  60.385 +    actionAlignLeft->setToggleAction( true );
  60.386 +    actionAlignCenter = new QAction( QPixmap (formattextcenter_xpm ), tr( "C&enter" ), CTRL + Key_E, grp, "textCenter" );
  60.387 +    actionAlignCenter->setToggleAction( true );
  60.388 +    actionAlignRight = new QAction( QPixmap (formattextright_xpm ), tr( "&Right" ), CTRL + Key_R, grp, "textRight" );
  60.389 +    actionAlignRight->setToggleAction( true );
  60.390 +    actionAlignJustify = new QAction( QPixmap ( formattextjustify_xpm ), tr( "&Justify" ), CTRL + Key_J, grp, "textjustify" );
  60.391 +    actionAlignJustify->setToggleAction( true );
  60.392 +
  60.393 +    grp->addTo( tb );
  60.394 +    grp->addTo( menu );
  60.395 +
  60.396 +    connect( e, SIGNAL( currentFontChanged( const QFont & ) ),
  60.397 +	     this, SLOT( fontChanged( const QFont & ) ) );
  60.398 +    connect( e, SIGNAL( currentColorChanged( const QColor & ) ),
  60.399 +	     this, SLOT( colorChanged( const QColor & ) ) );
  60.400 +    connect( e, SIGNAL( currentAlignmentChanged( int ) ),
  60.401 +	     this, SLOT( alignmentChanged( int ) ) );
  60.402 +
  60.403 +}
  60.404 +
  60.405 +void TextEditor::setupSettingsActions()
  60.406 +{
  60.407 +    QPopupMenu *menu = new QPopupMenu( this );
  60.408 +    menuBar()->insertItem( tr( "&Settings" ), menu );
  60.409 +
  60.410 +    QAction *a;
  60.411 +    a = new QAction( tr( "Set fixed font" ), QPixmap(), tr( "Set &fixed font" ), 0, this, "setFixedFont" );
  60.412 +    connect( a, SIGNAL( activated() ), this, SLOT( setFixedFont() ) );
  60.413 +    a->addTo( menu );
  60.414 +	actionSettingsFixedFont=a;
  60.415 +
  60.416 +    a = new QAction( tr( "Set variable font" ), QPixmap(), tr( "Set &variable font" ), 0, this, "setvariableFont" );
  60.417 +    connect( a, SIGNAL( activated() ), this, SLOT( setVarFont() ) );
  60.418 +    a->addTo( menu );
  60.419 +	actionSettingsVarFont=a;
  60.420 +
  60.421 +    a = new QAction( tr( "Used fixed font by default" ), QPixmap(), tr( "&fixed font is default" ), 0, this, "fonthintDefault" );
  60.422 +	a->setToggleAction (true);
  60.423 +	// set state later in constructor...
  60.424 +    a->addTo( menu );
  60.425 +	actionSettingsFonthintDefault=a;
  60.426 +}
  60.427 +
  60.428 +void TextEditor::textLoad()
  60.429 +{
  60.430 +	if (state!=inactiveEditor)
  60.431 +	{
  60.432 +		if (e->length()) 
  60.433 +		{
  60.434 +			QMessageBox mb( "VYM - Note Editor",
  60.435 +				"Loading will overwrite the existing note",
  60.436 +				QMessageBox::Warning,
  60.437 +				QMessageBox::Yes | QMessageBox::Default,
  60.438 +				QMessageBox::Cancel,
  60.439 +				0 );
  60.440 +			mb.setButtonText( QMessageBox::Yes, "Load note" );
  60.441 +			switch( mb.exec() ) {
  60.442 +				case QMessageBox::Cancel:
  60.443 +					return;
  60.444 +					break;
  60.445 +			}
  60.446 +		} 
  60.447 +		// Load note
  60.448 +		QFileDialog *fd=new QFileDialog( this);
  60.449 +		fd->addFilter ("ASCII texts (*.txt)");
  60.450 +		fd->addFilter ("VYM notes (*.html)");
  60.451 +		fd->show();
  60.452 +		QString fn;
  60.453 +		if ( fd->exec() == QDialog::Accepted )
  60.454 +			fn = fd->selectedFile();
  60.455 +
  60.456 +		if ( !fn.isEmpty() )
  60.457 +		{
  60.458 +			QFile f( fn );
  60.459 +			if ( !f.open( IO_ReadOnly ) )
  60.460 +			return;
  60.461 +
  60.462 +			QTextStream ts( &f );
  60.463 +			setText( ts.read() );
  60.464 +			editorChanged();
  60.465 +		}
  60.466 +	}
  60.467 +}
  60.468 +
  60.469 +void TextEditor::closeEvent( QCloseEvent* ce )
  60.470 +{
  60.471 +    if ( !e->isModified() ) 
  60.472 +	{
  60.473 +		ce->accept();	// TextEditor can be reopened with show()
  60.474 +		return;
  60.475 +    }
  60.476 +}
  60.477 +
  60.478 +QString TextEditor::getText()
  60.479 +{
  60.480 +	return e->text();
  60.481 +}
  60.482 +
  60.483 +void TextEditor::editorChanged()
  60.484 +{
  60.485 +	// received, when QTextEdit::text() has changed
  60.486 +	EditorState	oldstate=state;
  60.487 +
  60.488 +	if (isEmpty())
  60.489 +		state=emptyEditor;
  60.490 +	else
  60.491 +		state=filledEditor;
  60.492 +
  60.493 +	if (state != oldstate)
  60.494 +	{
  60.495 +		if (state==emptyEditor)
  60.496 +			e->setPaper (emptyPaper);
  60.497 +		else
  60.498 +			e->setPaper (filledPaper);
  60.499 +	}
  60.500 +	// SLOT is LinkableMapObj, which will update systemFlag
  60.501 +	emit (textHasChanged() );
  60.502 +}
  60.503 +
  60.504 +
  60.505 +void TextEditor::setText(QString t)
  60.506 +{
  60.507 +	if ( !QStyleSheet::mightBeRichText( t ) )
  60.508 +		t = QStyleSheet::convertFromPlainText( t, QStyleSheetItem::WhiteSpaceNormal );
  60.509 +	e->setReadOnly(false);
  60.510 +	e->setText(t);
  60.511 +	editorChanged();	//not called automagically
  60.512 +
  60.513 +	enableActions();
  60.514 +}
  60.515 +
  60.516 +void TextEditor::setInactive()
  60.517 +{
  60.518 +	setText("");
  60.519 +	state=inactiveEditor;
  60.520 +	e->setPaper (inactivePaper);
  60.521 +	e->setReadOnly (true);
  60.522 +
  60.523 +	disableActions();
  60.524 +}
  60.525 +
  60.526 +void TextEditor::editCopyAll()
  60.527 +{
  60.528 +	e->selectAll();
  60.529 +	e->copy();
  60.530 +}
  60.531 +
  60.532 +void TextEditor::textSaveAs()
  60.533 +{
  60.534 +    QString fn = QFileDialog::getSaveFileName( QString::null, "VYM Note (HTML) (*.html);;All files (*)",
  60.535 +					       this,"export note dialog",tr("Export Note to single file") );
  60.536 +
  60.537 +    if ( !fn.isEmpty() ) 
  60.538 +	{
  60.539 +		QFile file (fn);
  60.540 +		if (file.exists())
  60.541 +		{
  60.542 +			QMessageBox mb( "VYM",
  60.543 +				tr("The file ") + fn + 
  60.544 +				tr(" exists already. "
  60.545 +				"Do you want to overwrite it?"),
  60.546 +			QMessageBox::Warning,
  60.547 +			QMessageBox::Yes | QMessageBox::Default,
  60.548 +			QMessageBox::Cancel | QMessageBox::Escape,
  60.549 +			QMessageBox::NoButton );
  60.550 +			mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
  60.551 +			mb.setButtonText( QMessageBox::No, tr("Cancel"));
  60.552 +			switch( mb.exec() ) {
  60.553 +				case QMessageBox::Yes:
  60.554 +					// save 
  60.555 +					filename = fn;
  60.556 +					textSave();
  60.557 +					return;
  60.558 +				case QMessageBox::Cancel:
  60.559 +					// do nothing
  60.560 +					break;
  60.561 +			}
  60.562 +		} else
  60.563 +		{
  60.564 +			filename = fn;
  60.565 +			textSave();
  60.566 +			return;
  60.567 +		}			
  60.568 +    }
  60.569 +	statusBar()->message(tr( "Couldn't export note ") + fn, statusbarTime );
  60.570 +}
  60.571 +
  60.572 +
  60.573 +void TextEditor::textSave()
  60.574 +{
  60.575 +    if ( filename.isEmpty() ) 
  60.576 +	{
  60.577 +		textSaveAs();
  60.578 +		return;
  60.579 +    }
  60.580 +
  60.581 +    QString text = e->text();
  60.582 +    QFile f( filename );
  60.583 +    if ( !f.open( IO_WriteOnly ) ) 
  60.584 +	{
  60.585 +		statusBar()->message( QString("Could not write to %1").arg(filename),
  60.586 +					  statusbarTime );
  60.587 +		return;
  60.588 +    }
  60.589 +
  60.590 +    QTextStream t( &f );
  60.591 +    t << text;
  60.592 +    f.close();
  60.593 +
  60.594 +    e->setModified( FALSE );
  60.595 +
  60.596 +    statusBar()->message( QString( "Note exported as %1" ).arg( filename ), statusbarTime );
  60.597 +}
  60.598 +
  60.599 +void TextEditor::textConvertPar()
  60.600 +{
  60.601 +	// In X11 a copy&paste generates paragraphs, 
  60.602 +	// which is not always wanted
  60.603 +	// This function replaces paragraphs by linebreaks.
  60.604 +	int parFrom, parTo, indFrom, indTo;
  60.605 +	e->getSelection (&parFrom,&indFrom,&parTo,&indTo);
  60.606 +	QString t;
  60.607 +	if (parFrom>-1)
  60.608 +		t=e->selectedText();
  60.609 +	else
  60.610 +		t=e->text();
  60.611 +
  60.612 +	QRegExp re("<p.*>");
  60.613 +	re.setMinimal(true);
  60.614 +	t.replace (re,"");
  60.615 +	t.replace ("</p>","<br />");
  60.616 +	if (parFrom>-1)
  60.617 +	{
  60.618 +		e->setCursorPosition (parFrom,indFrom);
  60.619 +		e->cut();
  60.620 +		// Tried to simply insert the changed text with
  60.621 +		// e->insert (t,(uint)(QTextEdit::RemoveSelected));
  60.622 +		// but then the html would be quoted. So I use the ugly
  60.623 +		// way: insert a marker, replace it in whole text of QTextEdit
  60.624 +		QString marker="R3PlAcEMeL4teR!";
  60.625 +		e->insert (marker);
  60.626 +		e->setText (e->text().replace(marker,t));
  60.627 +	} else
  60.628 +		e->setText(t);
  60.629 +}
  60.630 +
  60.631 +void TextEditor::textJoinLines()
  60.632 +{
  60.633 +	int parFrom, parTo, indFrom, indTo;
  60.634 +	e->getSelection (&parFrom,&indFrom,&parTo,&indTo);
  60.635 +	QString t;
  60.636 +	if (parFrom>-1)
  60.637 +		t=e->selectedText();
  60.638 +	else
  60.639 +		t=e->text();
  60.640 +	// In addition to textConvertPar it is sometimes
  60.641 +	// useful to join all lines of a paragraph
  60.642 +	QRegExp re("</p>\n+<p>(?!</p>)");
  60.643 +	re.setMinimal(true);
  60.644 +	t.replace (re," ");
  60.645 +
  60.646 +	// Above we may have introduced new " " at beginning of a
  60.647 +	// paragraph - remove it.
  60.648 +	re.setPattern("<p> ");
  60.649 +	t.replace (re,"<p>");
  60.650 +	if (parFrom>-1)
  60.651 +	{
  60.652 +		e->setCursorPosition (parFrom,indFrom);
  60.653 +		e->cut();
  60.654 +		// Tried to simply insert the changed text with
  60.655 +		// e->insert (t,(uint)(QTextEdit::RemoveSelected));
  60.656 +		// but then the html would be quoted. So I use the ugly
  60.657 +		// way: insert a marker, replace it in whole text of QTextEdit
  60.658 +		QString marker="R3PlAcEMeL4teR!";
  60.659 +		e->insert (marker);
  60.660 +		e->setText (e->text().replace(marker,t));
  60.661 +	} else
  60.662 +		e->setText(t);
  60.663 +}
  60.664 +
  60.665 +QString TextEditor::textConvertToASCII(const QString &t)
  60.666 +{
  60.667 +	QString r=t;
  60.668 +
  60.669 +	// convert all "<br*>" to "\n"
  60.670 +	QRegExp re("<br.*>");
  60.671 +	re.setMinimal(true);
  60.672 +	r.replace (re,"\n");
  60.673 +
  60.674 +	// convert all "</p>" to "\n"
  60.675 +	re.setPattern ("/p");
  60.676 +	r.replace (re,"\n");
  60.677 +	
  60.678 +	// remove all remaining tags 
  60.679 +	re.setPattern ("<.*>");
  60.680 +	r.replace (re,"");
  60.681 +
  60.682 +	// convert "&", "<" and ">"
  60.683 +	re.setPattern ("&gt;");
  60.684 +	r.replace (re,">");
  60.685 +	re.setPattern ("&lt;");
  60.686 +	r.replace (re,"<");
  60.687 +	re.setPattern ("&amp;");
  60.688 +	r.replace (re,"&");
  60.689 +	return r;
  60.690 +}
  60.691 +
  60.692 +void TextEditor::textExportAsASCII()
  60.693 +{
  60.694 +	QString text = textConvertToASCII( e->text());
  60.695 +    QString fn = QFileDialog::getSaveFileName( QString::null, "VYM Note (ASCII) (*.txt);;All files (*)",
  60.696 +					       this,"export note dialog",tr("Export Note to single file (ASCII)") );
  60.697 +	int ret=-1;
  60.698 +
  60.699 +    if ( !fn.isEmpty() ) 
  60.700 +	{
  60.701 +		QFile file (fn);
  60.702 +		if (file.exists())
  60.703 +		{
  60.704 +			QMessageBox mb( "VYM",
  60.705 +				tr("The file ") + fn + 
  60.706 +				tr(" exists already. "
  60.707 +				"Do you want to overwrite it?"),
  60.708 +			QMessageBox::Warning,
  60.709 +			QMessageBox::Yes | QMessageBox::Default,
  60.710 +			QMessageBox::Cancel | QMessageBox::Escape,
  60.711 +			QMessageBox::NoButton );
  60.712 +			mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
  60.713 +			mb.setButtonText( QMessageBox::No, tr("Cancel"));
  60.714 +			ret=mb.exec();
  60.715 +		}	
  60.716 +		if (ret==QMessageBox::Cancel)
  60.717 +			return;
  60.718 +			
  60.719 +		// save 
  60.720 +		if ( !file.open( IO_WriteOnly ) ) 
  60.721 +			statusBar()->message( QString("Could not write to %1").arg(filename),
  60.722 +						  statusbarTime );
  60.723 +		else
  60.724 +		{
  60.725 +			QTextStream t( &file );
  60.726 +			t << text;
  60.727 +			file.close();
  60.728 +
  60.729 +			statusBar()->message( QString( "Note exported as %1" ).arg( fn ), statusbarTime );
  60.730 +		}
  60.731 +    }
  60.732 +}
  60.733 +
  60.734 +
  60.735 +void TextEditor::textPrint()
  60.736 +{
  60.737 +    printer->setFullPage(TRUE);
  60.738 +    if ( printer->setup( this ) ) 
  60.739 +	{
  60.740 +		QPainter p( printer );
  60.741 +		// Check that there is a valid device to print to.
  60.742 +		if ( !p.device() ) return;
  60.743 +		QPaintDeviceMetrics metrics( p.device() );
  60.744 +		int dpiy = metrics.logicalDpiY();
  60.745 +		int margin = (int) ( (2/2.54)*dpiy ); // 2 cm margins
  60.746 +		QRect body( margin, margin, metrics.width() - 2*margin, metrics.height() - 2*margin );
  60.747 +		QFont font( e->currentFont() );
  60.748 +		font.setPointSize( 10 ); // we define 10pt to be a nice base size for printing
  60.749 +
  60.750 +		QSimpleRichText richText( e->text(), font,
  60.751 +					  e->context(),
  60.752 +					  e->styleSheet(),
  60.753 +					  e->mimeSourceFactory(),
  60.754 +					  body.height() );
  60.755 +		richText.setWidth( &p, body.width() );
  60.756 +		QRect view( body );
  60.757 +		int page = 1;
  60.758 +		do 
  60.759 +		{
  60.760 +			richText.draw( &p, body.left(), body.top(), view, colorGroup() );
  60.761 +			view.moveBy( 0, body.height() );
  60.762 +			p.translate( 0 , -body.height() );
  60.763 +			p.setFont( font );
  60.764 +			p.drawText( view.right() - p.fontMetrics().width( QString::number( page ) ),
  60.765 +				view.bottom() + p.fontMetrics().ascent() + 5, QString::number( page ) );
  60.766 +			if ( view.top()  >= richText.height() )
  60.767 +			break;
  60.768 +			printer->newPage();
  60.769 +			page++;
  60.770 +		} while (TRUE);
  60.771 +    }
  60.772 +}
  60.773 +
  60.774 +void TextEditor::textEditUndo()
  60.775 +{
  60.776 +}
  60.777 +
  60.778 +void TextEditor::toggleFonthint()
  60.779 +{
  60.780 +	setUpdatesEnabled (false);
  60.781 +	e->selectAll (true);
  60.782 +	if (!actionFormatUseFixedFont->isOn() ) 
  60.783 +		e->setCurrentFont (varFont);
  60.784 +	else	
  60.785 +		e->setCurrentFont (fixedFont);
  60.786 +	e->selectAll (false);
  60.787 +	setUpdatesEnabled (true);
  60.788 +	repaint();
  60.789 +}
  60.790 +
  60.791 +void TextEditor::setFixedFont()
  60.792 +{
  60.793 +	bool ok;
  60.794 +	QFont font =QFontDialog::getFont(
  60.795 +                    &ok, fixedFont, this );
  60.796 +    if ( ok ) 
  60.797 +        // font is set to the font the user selected
  60.798 +		fixedFont=font;
  60.799 +}
  60.800 +
  60.801 +void TextEditor::setVarFont()
  60.802 +{
  60.803 +	bool ok;
  60.804 +	QFont font =QFontDialog::getFont(
  60.805 +                    &ok, varFont, this );
  60.806 +    if ( ok ) 
  60.807 +        // font is set to the font the user selected
  60.808 +		varFont=font;
  60.809 +}
  60.810 +
  60.811 +void TextEditor::textBold()
  60.812 +{
  60.813 +    e->setBold( actionTextBold->isOn() );
  60.814 +}
  60.815 +
  60.816 +void TextEditor::textUnderline()
  60.817 +{
  60.818 +    e->setUnderline( actionTextUnderline->isOn() );
  60.819 +}
  60.820 +
  60.821 +void TextEditor::textItalic()
  60.822 +{
  60.823 +    e->setItalic( actionTextItalic->isOn() );
  60.824 +}
  60.825 +
  60.826 +void TextEditor::textFamily( const QString &f )
  60.827 +{
  60.828 +    e->setFamily( f );
  60.829 +}
  60.830 +
  60.831 +void TextEditor::textSize( const QString &p )
  60.832 +{
  60.833 +    e->setPointSize( p.toInt() );
  60.834 +}
  60.835 +
  60.836 +
  60.837 +void TextEditor::textColor()
  60.838 +{
  60.839 +    QColor col = QColorDialog::getColor( e->color(), this );
  60.840 +    if ( !col.isValid() )
  60.841 +	return;
  60.842 +    e->setColor( col );
  60.843 +    QPixmap pix( 16, 16 );
  60.844 +    pix.fill( black );
  60.845 +    actionTextColor->setIconSet( pix );
  60.846 +}
  60.847 +
  60.848 +void TextEditor::textAlign( QAction *a )
  60.849 +{
  60.850 +    if ( a == actionAlignLeft )
  60.851 +	e->setAlignment( AlignLeft );
  60.852 +    else if ( a == actionAlignCenter )
  60.853 +	e->setAlignment( AlignHCenter );
  60.854 +    else if ( a == actionAlignRight )
  60.855 +	e->setAlignment( AlignRight );
  60.856 +    else if ( a == actionAlignJustify )
  60.857 +	e->setAlignment( AlignJustify );
  60.858 +}
  60.859 +
  60.860 +void TextEditor::fontChanged( const QFont &f )
  60.861 +{
  60.862 +    comboFont->lineEdit()->setText( f.family() );
  60.863 +    comboSize->lineEdit()->setText( QString::number( f.pointSize() ) );
  60.864 +    actionTextBold->setOn( f.bold() );
  60.865 +    actionTextItalic->setOn( f.italic() );
  60.866 +    actionTextUnderline->setOn( f.underline() );
  60.867 +}
  60.868 +
  60.869 +void TextEditor::colorChanged( const QColor &c )
  60.870 +{
  60.871 +    QPixmap pix( 16, 16 );
  60.872 +    pix.fill( c );
  60.873 +    actionTextColor->setIconSet( pix );
  60.874 +}
  60.875 +
  60.876 +void TextEditor::alignmentChanged( int a )
  60.877 +{
  60.878 +    if ( ( a == AlignAuto ) || ( a & AlignLeft ))
  60.879 +	actionAlignLeft->setOn( true );
  60.880 +    else if ( ( a & AlignHCenter ) )
  60.881 +	actionAlignCenter->setOn( true );
  60.882 +    else if ( ( a & AlignRight ) )
  60.883 +	actionAlignRight->setOn( true );
  60.884 +    else if ( ( a & AlignJustify ) )
  60.885 +	actionAlignJustify->setOn( true );
  60.886 +}
  60.887 +
  60.888 +
  60.889 +
  60.890 +void TextEditor::enableActions()
  60.891 +{
  60.892 +	actionFileLoad->setEnabled(true);
  60.893 +	actionFileSave->setEnabled(true);
  60.894 +	actionFileSaveAs->setEnabled(true);
  60.895 +	actionFilePrint->setEnabled(true);
  60.896 +	actionEditUndo->setEnabled(true);
  60.897 +	actionEditRedo->setEnabled(true);
  60.898 +	actionEditCopy->setEnabled(true);
  60.899 +	actionEditCut->setEnabled(true);
  60.900 +	actionEditPaste->setEnabled(true);
  60.901 +	actionEditDeleteAll->setEnabled(true);
  60.902 +	actionEditConvertPar->setEnabled(true);
  60.903 +	actionEditJoinLines->setEnabled(true);
  60.904 +	actionFormatUseFixedFont->setEnabled(true);
  60.905 +}
  60.906 +
  60.907 +void TextEditor::disableActions()
  60.908 +{
  60.909 +	actionFileLoad->setEnabled(false);
  60.910 +	actionFileSave->setEnabled(false);
  60.911 +	actionFileSaveAs->setEnabled(false);
  60.912 +	actionFilePrint->setEnabled(false);
  60.913 +	actionEditUndo->setEnabled(false);
  60.914 +	actionEditRedo->setEnabled(false);
  60.915 +	actionEditCopy->setEnabled(false);
  60.916 +	actionEditCut->setEnabled(false);
  60.917 +	actionEditPaste->setEnabled(false);
  60.918 +	actionEditDeleteAll->setEnabled(false);
  60.919 +	actionEditConvertPar->setEnabled(false);
  60.920 +	actionEditJoinLines->setEnabled(false);
  60.921 +	actionFormatUseFixedFont->setEnabled(false);
  60.922 +}
  60.923 +
  60.924 +
    61.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    61.2 +++ b/texteditor.h	Sun Jan 30 12:58:47 2005 +0000
    61.3 @@ -0,0 +1,123 @@
    61.4 +#ifndef TEXTEDITOR_H 
    61.5 +#define TEXTEDITOR_H
    61.6 +
    61.7 +#include <qmainwindow.h>
    61.8 +#include <qtextedit.h>
    61.9 +#include <qaction.h>
   61.10 +#include <qfontdatabase.h>
   61.11 +#include <qcombobox.h>
   61.12 +
   61.13 +
   61.14 +enum EditorState {inactiveEditor,emptyEditor,filledEditor};
   61.15 +
   61.16 +class TextEditor : public QMainWindow {
   61.17 +    Q_OBJECT
   61.18 +public:
   61.19 +    TextEditor();
   61.20 +    ~TextEditor();
   61.21 +
   61.22 +	bool isEmpty();
   61.23 +	void setShowWithMain (bool);
   61.24 +	bool showWithMain ();
   61.25 +	void setFontHint(const QString&);
   61.26 +	QString getFontHint();
   61.27 +	QString getFontHintDefault();
   61.28 +	void setFilename (const QString&);
   61.29 +	QString getFilename ();
   61.30 +	bool findText(const QString &, const bool &); // find Text 
   61.31 +
   61.32 +protected:
   61.33 +	void setupFileActions();
   61.34 +	void setupEditActions();
   61.35 +	void setupFormatActions();
   61.36 +	void setupSettingsActions();
   61.37 +    void closeEvent( QCloseEvent* );
   61.38 +	
   61.39 +
   61.40 +public:
   61.41 +	QString getText();
   61.42 +
   61.43 +public slots:
   61.44 +	void editorChanged();	// received when text() changed
   61.45 +	void setText(QString);	// set Text (by MapEditor)
   61.46 +	void setInactive();		// Nothing can be entered
   61.47 +	void editCopyAll();
   61.48 +
   61.49 +signals:
   61.50 +	void textHasChanged();
   61.51 +	void fontFamilyHasChanged();
   61.52 +	void fontSizeHasChanged();
   61.53 +	
   61.54 +private slots:
   61.55 +    void textLoad();
   61.56 +    void textSaveAs();
   61.57 +    void textSave();
   61.58 +	void textConvertPar();
   61.59 +	void textJoinLines();
   61.60 +	QString textConvertToASCII(const QString &);
   61.61 +	void textExportAsASCII();
   61.62 +    void textPrint();
   61.63 +	void textEditUndo();
   61.64 +    void toggleFonthint();
   61.65 +    void setFixedFont();
   61.66 +    void setVarFont();
   61.67 +    void textBold();
   61.68 +    void textUnderline();
   61.69 +    void textItalic();
   61.70 +    void textFamily( const QString &f );
   61.71 +    void textSize( const QString &p );
   61.72 +	void textColor();
   61.73 +	void textAlign(QAction*);
   61.74 +    void fontChanged( const QFont &f );
   61.75 +    void colorChanged( const QColor &c );
   61.76 +    void alignmentChanged( int a );
   61.77 +	void enableActions();
   61.78 +	void disableActions();
   61.79 +
   61.80 +private:
   61.81 +    QPrinter *printer;
   61.82 +    QTextEdit *e;
   61.83 +	QPoint lastPos;			// save last position of window
   61.84 +    QString filename;
   61.85 +
   61.86 +	QBrush emptyPaper;		// setting the background color
   61.87 +	QBrush filledPaper;		// depending on the state
   61.88 +	QBrush inactivePaper;	// depending on the state
   61.89 +	EditorState state;
   61.90 +	bool showwithmain;		// same visibility as mainwindow?
   61.91 +
   61.92 +	QFont varFont;
   61.93 +	QFont fixedFont;
   61.94 +    QComboBox
   61.95 +	*comboFont,
   61.96 +	*comboSize;
   61.97 +	
   61.98 +	QAction *actionFileLoad,
   61.99 +	*actionFileSave,
  61.100 +	*actionFileSaveAs,
  61.101 +	*actionFilePrint,
  61.102 +	*actionEditUndo,
  61.103 +	*actionEditRedo,
  61.104 +	*actionEditCopy,
  61.105 +	*actionEditCut,
  61.106 +	*actionEditPaste,
  61.107 +	*actionEditDeleteAll,
  61.108 +	*actionEditConvertPar,
  61.109 +	*actionEditJoinLines,
  61.110 +	*actionFormatUseFixedFont,
  61.111 +	*actionSettingsVarFont,
  61.112 +	*actionSettingsFixedFont,
  61.113 +	*actionSettingsFonthintDefault,
  61.114 +    *actionTextBold,
  61.115 +	*actionTextUnderline,
  61.116 +	*actionTextItalic,
  61.117 +	*actionTextColor,
  61.118 +	*actionAlignLeft,
  61.119 +	*actionAlignCenter,
  61.120 +	*actionAlignRight,
  61.121 +	*actionAlignJustify;
  61.122 +
  61.123 +
  61.124 +};
  61.125 +
  61.126 +#endif
    62.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    62.2 +++ b/version.h	Sun Jan 30 12:58:47 2005 +0000
    62.3 @@ -0,0 +1,7 @@
    62.4 +#ifndef VERSION_H 
    62.5 +#define VERSION_H
    62.6 +
    62.7 +#define __VYM_VERSION__ "1.6.0"
    62.8 +#define __BUILD_DATE__ "January 4, 2005"
    62.9 +
   62.10 +#endif
    63.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    63.2 +++ b/vym.pro	Sun Jan 30 12:58:47 2005 +0000
    63.3 @@ -0,0 +1,81 @@
    63.4 +TARGET  = vym
    63.5 +TRANSLATIONS += vym_de.ts
    63.6 +
    63.7 +TEMPLATE	= app
    63.8 +LANGUAGE	= C++
    63.9 +
   63.10 +CONFIG	+= qt warn_on release
   63.11 +
   63.12 +DESTROOT = /usr
   63.13 +
   63.14 +target.path = $${DESTROOT}/bin
   63.15 +INSTALLS += target
   63.16 +
   63.17 +support.files = styles/ scripts/ icons/
   63.18 +support.path = $${DESTROOT}/share/vym
   63.19 +INSTALLS += support 
   63.20 +
   63.21 +doc.files = doc/*
   63.22 +doc.path = $${DESTROOT}/share/doc/packages/vym
   63.23 +INSTALLS += doc
   63.24 +
   63.25 +demo.files = demos/
   63.26 +demo.path = $${DESTROOT}/share/vym
   63.27 +INSTALLS += demo
   63.28 +
   63.29 +
   63.30 +HEADERS	+= branchobj.h \
   63.31 +	exports.h \
   63.32 +	findwindow.h \
   63.33 +	flagobj.h \
   63.34 +	flagrowobj.h \
   63.35 +	floatimageobj.h \
   63.36 +	floatobj.h \
   63.37 +	frameobj.h \
   63.38 +	headingobj.h \
   63.39 +	imageobj.h \
   63.40 +	linkablemapobj.h \
   63.41 +	mainwindow.h \
   63.42 +	mapcenterobj.h \
   63.43 +	mapeditor.h \
   63.44 +	mapobj.h \
   63.45 +	misc.h \
   63.46 +	noteobj.h \
   63.47 +	ornamentedobj.h \
   63.48 +	process.h \
   63.49 +	selection.h \
   63.50 +	texteditor.h \
   63.51 +	version.h \
   63.52 +	xml.h \
   63.53 +	settings.h \
   63.54 +	options.h
   63.55 +SOURCES	+= branchobj.cpp \
   63.56 +	exports.cpp \
   63.57 +	findwindow.cpp \
   63.58 +	flagobj.cpp \
   63.59 +	flagrowobj.cpp \
   63.60 +	floatimageobj.cpp \
   63.61 +	floatobj.cpp \
   63.62 +	frameobj.cpp \
   63.63 +	headingobj.cpp \
   63.64 +	imageobj.cpp \
   63.65 +	linkablemapobj.cpp \
   63.66 +	main.cpp \
   63.67 +	mainwindow.cpp \
   63.68 +	mapcenterobj.cpp \
   63.69 +	mapeditor.cpp \
   63.70 +	mapobj.cpp \
   63.71 +	misc.cpp \
   63.72 +	noteobj.cpp \
   63.73 +	ornamentedobj.cpp \
   63.74 +	process.cpp \
   63.75 +	selection.cpp \
   63.76 +	texteditor.cpp \
   63.77 +	xml.cpp \
   63.78 +	settings.cpp \
   63.79 +	options.cpp
   63.80 +FORMS	= exporthtmldialog.ui \
   63.81 +	exportxhtmldialog.ui \
   63.82 +	showtextdialog.ui \
   63.83 +	extrainfodialog.ui
   63.84 +
    64.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    64.2 +++ b/vym_de.ts	Sun Jan 30 12:58:47 2005 +0000
    64.3 @@ -0,0 +1,1574 @@
    64.4 +<!DOCTYPE TS><TS>
    64.5 +<context>
    64.6 +    <name>ExportHTMLDialog</name>
    64.7 +    <message>
    64.8 +        <source>Export HTML</source>
    64.9 +        <translation>Exportiere HTML</translation>
   64.10 +    </message>
   64.11 +    <message>
   64.12 +        <source>Directory:</source>
   64.13 +        <translation>Verzeichnis:</translation>
   64.14 +    </message>
   64.15 +    <message>
   64.16 +        <source>Browse</source>
   64.17 +        <translation>Durchsuchen</translation>
   64.18 +    </message>
   64.19 +    <message>
   64.20 +        <source>Options</source>
   64.21 +        <translation>Optionen</translation>
   64.22 +    </message>
   64.23 +    <message>
   64.24 +        <source>Include image of map</source>
   64.25 +        <translation>Bild der Map erzeugen</translation>
   64.26 +    </message>
   64.27 +    <message>
   64.28 +        <source>use WIKI style</source>
   64.29 +        <translation>WIKI Stil verwenden</translation>
   64.30 +    </message>
   64.31 +    <message>
   64.32 +        <source>show output</source>
   64.33 +        <translation type="obsolete">Ausgabe der Scripte anzeigen</translation>
   64.34 +    </message>
   64.35 +    <message>
   64.36 +        <source>Export</source>
   64.37 +        <translation>Exportieren</translation>
   64.38 +    </message>
   64.39 +    <message>
   64.40 +        <source>Cancel</source>
   64.41 +        <translation>Abbrechen</translation>
   64.42 +    </message>
   64.43 +    <message>
   64.44 +        <source>VYM - Export HTML to directory</source>
   64.45 +        <translation>VYM - Exportiere HTML in Verzeichnis</translation>
   64.46 +    </message>
   64.47 +    <message>
   64.48 +        <source>Critcal export error</source>
   64.49 +        <translation>Kritischer Fehler beim Exportieren</translation>
   64.50 +    </message>
   64.51 +    <message>
   64.52 +        <source>create image only</source>
   64.53 +        <translation>Nur Bild erzeugen</translation>
   64.54 +    </message>
   64.55 +    <message>
   64.56 +        <source>use heading for URLs (instead of link target)</source>
   64.57 +        <translation>Verwende Zweigbeschriftung für URL</translation>
   64.58 +    </message>
   64.59 +    <message>
   64.60 +        <source>use image of earth to mark URLs in text</source>
   64.61 +        <translation>Verwende Globus Symbol für URLs</translation>
   64.62 +    </message>
   64.63 +    <message>
   64.64 +        <source>show output of external scripts</source>
   64.65 +        <translation>Zeige Ausgabe der externen Skripte</translation>
   64.66 +    </message>
   64.67 +    <message>
   64.68 +        <source>use default CSS file</source>
   64.69 +        <translation>Default CSS Datei verwenden</translation>
   64.70 +    </message>
   64.71 +</context>
   64.72 +<context>
   64.73 +    <name>ExportXHTMLDialog</name>
   64.74 +    <message>
   64.75 +        <source>Export XHTML</source>
   64.76 +        <translation>Exportiere XHTML</translation>
   64.77 +    </message>
   64.78 +    <message>
   64.79 +        <source>Directory:</source>
   64.80 +        <translation type="obsolete">Verzeichnis:</translation>
   64.81 +    </message>
   64.82 +    <message>
   64.83 +        <source>Browse</source>
   64.84 +        <translation>Durchsuchen</translation>
   64.85 +    </message>
   64.86 +    <message>
   64.87 +        <source>Options</source>
   64.88 +        <translation>Optionen</translation>
   64.89 +    </message>
   64.90 +    <message>
   64.91 +        <source>Include image</source>
   64.92 +        <translation>Bild erzeugen</translation>
   64.93 +    </message>
   64.94 +    <message>
   64.95 +        <source>Include text</source>
   64.96 +        <translation type="obsolete">Text erzeugen</translation>
   64.97 +    </message>
   64.98 +    <message>
   64.99 +        <source>show output of external scripts</source>
  64.100 +        <translation>Zeige Ausgabe der externen Skripte</translation>
  64.101 +    </message>
  64.102 +    <message>
  64.103 +        <source>Export</source>
  64.104 +        <translation>Exportieren</translation>
  64.105 +    </message>
  64.106 +    <message>
  64.107 +        <source>Cancel</source>
  64.108 +        <translation>Abbrechen</translation>
  64.109 +    </message>
  64.110 +    <message>
  64.111 +        <source>VYM - Export HTML to directory</source>
  64.112 +        <translation>VYM - Exportiere HTML in Verzeichnis</translation>
  64.113 +    </message>
  64.114 +    <message>
  64.115 +        <source>Critical Error</source>
  64.116 +        <translation>Kritischer Fehler</translation>
  64.117 +    </message>
  64.118 +    <message>
  64.119 +        <source>Couldn&apos;t start </source>
  64.120 +        <translation>Konnte nicht starten</translation>
  64.121 +    </message>
  64.122 +    <message>
  64.123 +        <source>didn&apos;t exit normally</source>
  64.124 +        <translation>Exportiere XHTML</translation>
  64.125 +    </message>
  64.126 +    <message>
  64.127 +        <source>Export to directory:</source>
  64.128 +        <translation>Export Verzeichnis:</translation>
  64.129 +    </message>
  64.130 +    <message>
  64.131 +        <source>Colored headings in text</source>
  64.132 +        <translation>Farbige Headings im Text</translation>
  64.133 +    </message>
  64.134 +    <message>
  64.135 +        <source>showWarnings e.g. if directory is not empty</source>
  64.136 +        <translation>Warnung, falls Verzeichnis nicht leer ist</translation>
  64.137 +    </message>
  64.138 +    <message>
  64.139 +        <source>Stylesheets</source>
  64.140 +        <translation>Stylesheets</translation>
  64.141 +    </message>
  64.142 +    <message>
  64.143 +        <source>CSS:</source>
  64.144 +        <translation>CSS:</translation>
  64.145 +    </message>
  64.146 +    <message>
  64.147 +        <source>XSL:</source>
  64.148 +        <translation>XSL:</translation>
  64.149 +    </message>
  64.150 +    <message>
  64.151 +        <source>VYM - Path to CSS file</source>
  64.152 +        <translation>VYM - Pfad zu CSS Datei</translation>
  64.153 +    </message>
  64.154 +    <message>
  64.155 +        <source>VYM - Path to XSL file</source>
  64.156 +        <translation>VYM - Pfad zu XSL Datei</translation>
  64.157 +    </message>
  64.158 +    <message>
  64.159 +        <source>Warning</source>
  64.160 +        <translation>Warnung</translation>
  64.161 +    </message>
  64.162 +    <message>
  64.163 +        <source> could not be opened!</source>
  64.164 +        <translation>konnte nicht geöffnet werden!</translation>
  64.165 +    </message>
  64.166 +    <message>
  64.167 +        <source>Save settings in map</source>
  64.168 +        <translation>Einstellungen in map speichern</translation>
  64.169 +    </message>
  64.170 +    <message>
  64.171 +        <source>Scripts</source>
  64.172 +        <translation>Skripte</translation>
  64.173 +    </message>
  64.174 +    <message>
  64.175 +        <source>Before export:</source>
  64.176 +        <translation>Vor Export:</translation>
  64.177 +    </message>
  64.178 +    <message>
  64.179 +        <source>After Export:</source>
  64.180 +        <translation>Nach Export:</translation>
  64.181 +    </message>
  64.182 +    <message>
  64.183 +        <source>The settings saved in the map would like to run scripts:
  64.184 +
  64.185 +</source>
  64.186 +        <translation>Die in der Map gespeicherten Einstellungen wollen Skripte starten:
  64.187 +
  64.188 +</translation>
  64.189 +    </message>
  64.190 +    <message>
  64.191 +        <source>Please check, if you really
  64.192 +want to allow this in your system!</source>
  64.193 +        <translation>Bitte prüfen Sie, ob Sie das in Ihrem
  64.194 +System wirklich zulassen wollen!</translation>
  64.195 +    </message>
  64.196 +    <message>
  64.197 +        <source>VYM - Path to pre export script</source>
  64.198 +        <translation>VYM - Pfad für Prä-Export Skript</translation>
  64.199 +    </message>
  64.200 +    <message>
  64.201 +        <source>VYM - Path to post export script</source>
  64.202 +        <translation>VYM -Pfad für Post-Export Skript</translation>
  64.203 +    </message>
  64.204 +</context>
  64.205 +<context>
  64.206 +    <name>ExtraInfoDialog</name>
  64.207 +    <message>
  64.208 +        <source>VYM - Info</source>
  64.209 +        <translation>VYM - Info</translation>
  64.210 +    </message>
  64.211 +    <message>
  64.212 +        <source>Map:</source>
  64.213 +        <translation>Map:</translation>
  64.214 +    </message>
  64.215 +    <message>
  64.216 +        <source>Author:</source>
  64.217 +        <translation>Author:</translation>
  64.218 +    </message>
  64.219 +    <message>
  64.220 +        <source>Comment:</source>
  64.221 +        <translation>Kommentar:</translation>
  64.222 +    </message>
  64.223 +    <message>
  64.224 +        <source>Statistics:</source>
  64.225 +        <translation>Statistik:</translation>
  64.226 +    </message>
  64.227 +    <message>
  64.228 +        <source>Cancel</source>
  64.229 +        <translation>Abbrechen</translation>
  64.230 +    </message>
  64.231 +    <message>
  64.232 +        <source>Close</source>
  64.233 +        <translation>Schliessen</translation>
  64.234 +    </message>
  64.235 +</context>
  64.236 +<context>
  64.237 +    <name>FindWindow</name>
  64.238 +    <message>
  64.239 +        <source>Clear</source>
  64.240 +        <translation>Neuer Suchbegriff</translation>
  64.241 +    </message>
  64.242 +    <message>
  64.243 +        <source>Cancel</source>
  64.244 +        <translation>Abbrechen</translation>
  64.245 +    </message>
  64.246 +    <message>
  64.247 +        <source>Find</source>
  64.248 +        <translation>Suchen</translation>
  64.249 +    </message>
  64.250 +</context>
  64.251 +<context>
  64.252 +    <name>Main</name>
  64.253 +    <message>
  64.254 +        <source>&amp;File</source>
  64.255 +        <translation>&amp;Datei</translation>
  64.256 +    </message>
  64.257 +    <message>
  64.258 +        <source>New map</source>
  64.259 +        <translation>Neu</translation>
  64.260 +    </message>
  64.261 +    <message>
  64.262 +        <source>&amp;New...</source>
  64.263 +        <translation>&amp;Neu...</translation>
  64.264 +    </message>
  64.265 +    <message>
  64.266 +        <source>Open</source>
  64.267 +        <translation>Öffnen</translation>
  64.268 +    </message>
  64.269 +    <message>
  64.270 +        <source>&amp;Open...</source>
  64.271 +        <translation>&amp;Öffnen...</translation>
  64.272 +    </message>
  64.273 +    <message>
  64.274 +        <source>Save</source>
  64.275 +        <translation>Speichern</translation>
  64.276 +    </message>
  64.277 +    <message>
  64.278 +        <source>&amp;Save...</source>
  64.279 +        <translation>Speichern &amp;unter...</translation>
  64.280 +    </message>
  64.281 +    <message>
  64.282 +        <source>Save &amp;As...</source>
  64.283 +        <translation>Speichern &amp;unter...</translation>
  64.284 +    </message>
  64.285 +    <message>
  64.286 +        <source>Import directory structure (experimental)</source>
  64.287 +        <translation>Importiere Verzeichnisstruktur (experimentelle Funktion)</translation>
  64.288 +    </message>
  64.289 +    <message>
  64.290 +        <source>Import Dir</source>
  64.291 +        <translation>Importiere Verzeichnis</translation>
  64.292 +    </message>
  64.293 +    <message>
  64.294 +        <source>Export (png)</source>
  64.295 +        <translation type="obsolete">Exportiere als png-Grafik</translation>
  64.296 +    </message>
  64.297 +    <message>
  64.298 +        <source>&amp;Export (png)</source>
  64.299 +        <translation type="obsolete">&amp;Export (png)</translation>
  64.300 +    </message>
  64.301 +    <message>
  64.302 +        <source>Print</source>
  64.303 +        <translation>Drucken</translation>
  64.304 +    </message>
  64.305 +    <message>
  64.306 +        <source>&amp;Print...</source>
  64.307 +        <translation>&amp;Drucken...</translation>
  64.308 +    </message>
  64.309 +    <message>
  64.310 +        <source>Close Map</source>
  64.311 +        <translation>Schließen</translation>
  64.312 +    </message>
  64.313 +    <message>
  64.314 +        <source>&amp;Close Map</source>
  64.315 +        <translation>Schlie&amp;ßen</translation>
  64.316 +    </message>
  64.317 +    <message>
  64.318 +        <source>Exit VYM</source>
  64.319 +        <translation>Beenden</translation>
  64.320 +    </message>
  64.321 +    <message>
  64.322 +        <source>E&amp;xit VYM</source>
  64.323 +        <translation>B&amp;eenden</translation>
  64.324 +    </message>
  64.325 +    <message>
  64.326 +        <source>&amp;Edit</source>
  64.327 +        <translation>&amp;Bearbeiten</translation>
  64.328 +    </message>
  64.329 +    <message>
  64.330 +        <source>Undo</source>
  64.331 +        <translation>Rückgängig</translation>
  64.332 +    </message>
  64.333 +    <message>
  64.334 +        <source>&amp;Undo</source>
  64.335 +        <translation>&amp;Rückgängig</translation>
  64.336 +    </message>
  64.337 +    <message>
  64.338 +        <source>Copy</source>
  64.339 +        <translation>Kopieren</translation>
  64.340 +    </message>
  64.341 +    <message>
  64.342 +        <source>&amp;Copy</source>
  64.343 +        <translation>&amp;Kopieren</translation>
  64.344 +    </message>
  64.345 +    <message>
  64.346 +        <source>Cut</source>
  64.347 +        <translation>Ausschneiden</translation>
  64.348 +    </message>
  64.349 +    <message>
  64.350 +        <source>Cu&amp;t</source>
  64.351 +        <translation>&amp;Ausschneiden</translation>
  64.352 +    </message>
  64.353 +    <message>
  64.354 +        <source>Paste</source>
  64.355 +        <translation>Einfügen</translation>
  64.356 +    </message>
  64.357 +    <message>
  64.358 +        <source>&amp;Paste</source>
  64.359 +        <translation>Ein&amp;fügen</translation>
  64.360 +    </message>
  64.361 +    <message>
  64.362 +        <source>Move branch up</source>
  64.363 +        <translation>Zweig nach oben bewegen</translation>
  64.364 +    </message>
  64.365 +    <message>
  64.366 +        <source>Move up</source>
  64.367 +        <translation>Zweig nach oben</translation>
  64.368 +    </message>
  64.369 +    <message>
  64.370 +        <source>Move branch down</source>
  64.371 +        <translation>Zweig nach unten bewegen</translation>
  64.372 +    </message>
  64.373 +    <message>
  64.374 +        <source>Move down</source>
  64.375 +        <translation>Zweig nach unten</translation>
  64.376 +    </message>
  64.377 +    <message>
  64.378 +        <source>Scroll branch</source>
  64.379 +        <translation>Zweig einrollen</translation>
  64.380 +    </message>
  64.381 +    <message>
  64.382 +        <source>Unscroll all</source>
  64.383 +        <translation>Alles aufrollen</translation>
  64.384 +    </message>
  64.385 +    <message>
  64.386 +        <source>Unscroll all scrolled branches</source>
  64.387 +        <translation>Alle eingerollten Zweige aufrollen</translation>
  64.388 +    </message>
  64.389 +    <message>
  64.390 +        <source>Find</source>
  64.391 +        <translation>Finde</translation>
  64.392 +    </message>
  64.393 +    <message>
  64.394 +        <source>Open URL</source>
  64.395 +        <translation>URL öffnen</translation>
  64.396 +    </message>
  64.397 +    <message>
  64.398 +        <source>Edit URL</source>
  64.399 +        <translation>URL ändern</translation>
  64.400 +    </message>
  64.401 +    <message>
  64.402 +        <source>Use heading of selected branch as URL</source>
  64.403 +        <translation>Beschriftung dieses Zweiges auch als URL verwenden</translation>
  64.404 +    </message>
  64.405 +    <message>
  64.406 +        <source>Use heading for URL</source>
  64.407 +        <translation>Beschriftung als URL übernehmen</translation>
  64.408 +    </message>
  64.409 +    <message>
  64.410 +        <source>Jump to another vym map, if needed load it first</source>
  64.411 +        <translation>Gehe zu einer weiteren Map. (Falls nötig wird die Map vorher geöffnet.)</translation>
  64.412 +    </message>
  64.413 +    <message>
  64.414 +        <source>Jump to map</source>
  64.415 +        <translation>Gehe zu einer weiteren Map.</translation>
  64.416 +    </message>
  64.417 +    <message>
  64.418 +        <source>Edit link to another vym map</source>
  64.419 +        <translation>Bearbeite Verbindung zu einer Map</translation>
  64.420 +    </message>
  64.421 +    <message>
  64.422 +        <source>Edit map link</source>
  64.423 +        <translation type="obsolete">Bearbeite Verbindung zu einer Map</translation>
  64.424 +    </message>
  64.425 +    <message>
  64.426 +        <source>edit Heading</source>
  64.427 +        <translation>Bearbeite Zweig-Überschrift</translation>
  64.428 +    </message>
  64.429 +    <message>
  64.430 +        <source>Edit heading</source>
  64.431 +        <translation>Bearbeite Zweig-Überschrift</translation>
  64.432 +    </message>
  64.433 +    <message>
  64.434 +        <source>Delete Selection</source>
  64.435 +        <translation>Entfernen</translation>
  64.436 +    </message>
  64.437 +    <message>
  64.438 +        <source>Add a branch as child of selection</source>
  64.439 +        <translation>Neuer Zweig </translation>
  64.440 +    </message>
  64.441 +    <message>
  64.442 +        <source>Add branch as child</source>
  64.443 +        <translation>Neuer Zweig </translation>
  64.444 +    </message>
  64.445 +    <message>
  64.446 +        <source>Add a branch above selection</source>
  64.447 +        <translation>Neuer Zweig - oben</translation>
  64.448 +    </message>
  64.449 +    <message>
  64.450 +        <source>Add branch above</source>
  64.451 +        <translation>Neuer Zweig - oben</translation>
  64.452 +    </message>
  64.453 +    <message>
  64.454 +        <source>Add a branch below selection</source>
  64.455 +        <translation>Neuer Zweig - unten</translation>
  64.456 +    </message>
  64.457 +    <message>
  64.458 +        <source>Add branch below</source>
  64.459 +        <translation>Neuer Zweig - unten</translation>
  64.460 +    </message>
  64.461 +    <message>
  64.462 +        <source>Select upper branch</source>
  64.463 +        <translation>Zweig oben</translation>
  64.464 +    </message>
  64.465 +    <message>
  64.466 +        <source>Select lower branch</source>
  64.467 +        <translation>Zweig unten</translation>
  64.468 +    </message>
  64.469 +    <message>
  64.470 +        <source>Select left branch</source>
  64.471 +        <translation>Zweig links</translation>
  64.472 +    </message>
  64.473 +    <message>
  64.474 +        <source>Select right branch</source>
  64.475 +        <translation>Zweig rechts</translation>
  64.476 +    </message>
  64.477 +    <message>
  64.478 +        <source>Select child branch</source>
  64.479 +        <translation>Kind-Zweig</translation>
  64.480 +    </message>
  64.481 +    <message>
  64.482 +        <source>Select first branch</source>
  64.483 +        <translation>Oberster Zweig</translation>
  64.484 +    </message>
  64.485 +    <message>
  64.486 +        <source>Select last branch</source>
  64.487 +        <translation>Unterster Zweig</translation>
  64.488 +    </message>
  64.489 +    <message>
  64.490 +        <source>Add Image</source>
  64.491 +        <translation>Lade Bild</translation>
  64.492 +    </message>
  64.493 +    <message>
  64.494 +        <source>&amp;Format</source>
  64.495 +        <translation>&amp;Format</translation>
  64.496 +    </message>
  64.497 +    <message>
  64.498 +        <source>Set Color</source>
  64.499 +        <translation>Wähle Farbe</translation>
  64.500 +    </message>
  64.501 +    <message>
  64.502 +        <source>Set &amp;Color</source>
  64.503 +        <translation>Wähle &amp;Farbe</translation>
  64.504 +    </message>
  64.505 +    <message>
  64.506 +        <source>Pick color
  64.507 +Hint: You can pick a color from another branch and color using CTRL+Left Button</source>
  64.508 +        <translation>Farb übernehmen
  64.509 +Tipp: Zum Kopieren einer Farbe kann man auch CTRL+linke Maustaste nehmen.</translation>
  64.510 +    </message>
  64.511 +    <message>
  64.512 +        <source>Pic&amp;k color</source>
  64.513 +        <translation>Farbe &amp;übernehmen</translation>
  64.514 +    </message>
  64.515 +    <message>
  64.516 +        <source>Color branch</source>
  64.517 +        <translation>Zweig färben</translation>
  64.518 +    </message>
  64.519 +    <message>
  64.520 +        <source>Color &amp;branch</source>
  64.521 +        <translation>Zweig &amp;färben</translation>
  64.522 +    </message>
  64.523 +    <message>
  64.524 +        <source>Color Subtree</source>
  64.525 +        <translation>Unterbaum färben</translation>
  64.526 +    </message>
  64.527 +    <message>
  64.528 +        <source>Color sub&amp;tree</source>
  64.529 +        <translation>&amp;Unterbaum färben</translation>
  64.530 +    </message>
  64.531 +    <message>
  64.532 +        <source>Line</source>
  64.533 +        <translation>Linie</translation>
  64.534 +    </message>
  64.535 +    <message>
  64.536 +        <source>Linkstyle Line</source>
  64.537 +        <translation>Linie</translation>
  64.538 +    </message>
  64.539 +    <message>
  64.540 +        <source>Linkstyle Parabel</source>
  64.541 +        <translation>Parabel</translation>
  64.542 +    </message>
  64.543 +    <message>
  64.544 +        <source>PolyLine</source>
  64.545 +        <translation>Dicke Linie</translation>
  64.546 +    </message>
  64.547 +    <message>
  64.548 +        <source>Linkstyle Thick Line</source>
  64.549 +        <translation>Dicke Linie</translation>
  64.550 +    </message>
  64.551 +    <message>
  64.552 +        <source>PolyParabel</source>
  64.553 +        <translation>Dicke Parabel</translation>
  64.554 +    </message>
  64.555 +    <message>
  64.556 +        <source>Linkstyle Thick Parabel</source>
  64.557 +        <translation>Dicke Parabel</translation>
  64.558 +    </message>
  64.559 +    <message>
  64.560 +        <source>No Frame</source>
  64.561 +        <translation>Kein Rahmen</translation>
  64.562 +    </message>
  64.563 +    <message>
  64.564 +        <source>Rectangle</source>
  64.565 +        <translation>Rechteck</translation>
  64.566 +    </message>
  64.567 +    <message>
  64.568 +        <source>Use same color for links and headings</source>
  64.569 +        <translation>Verbindungen haben Farbe der Beschriftungen</translation>
  64.570 +    </message>
  64.571 +    <message>
  64.572 +        <source>&amp;Use color of heading for link</source>
  64.573 +        <translation>&amp;Verbindungen haben Farbe der Beschriftungen</translation>
  64.574 +    </message>
  64.575 +    <message>
  64.576 +        <source>Set Link Color</source>
  64.577 +        <translation>Farbe der Verbindungen</translation>
  64.578 +    </message>
  64.579 +    <message>
  64.580 +        <source>Set &amp;Link Color</source>
  64.581 +        <translation>&amp;Farbe der Verbindungen</translation>
  64.582 +    </message>
  64.583 +    <message>
  64.584 +        <source>Set Background Color</source>
  64.585 +        <translation>Hintergrundfarbe</translation>
  64.586 +    </message>
  64.587 +    <message>
  64.588 +        <source>Set &amp;Background Color</source>
  64.589 +        <translation>&amp;Hintergrundfarbe</translation>
  64.590 +    </message>
  64.591 +    <message>
  64.592 +        <source>&amp;View</source>
  64.593 +        <translation>&amp;Ansicht</translation>
  64.594 +    </message>
  64.595 +    <message>
  64.596 +        <source>Zoom reset</source>
  64.597 +        <translation>Keine Vergrösserung</translation>
  64.598 +    </message>
  64.599 +    <message>
  64.600 +        <source>reset Zoom</source>
  64.601 +        <translation>Keine Vergrösserung</translation>
  64.602 +    </message>
  64.603 +    <message>
  64.604 +        <source>Zoom in</source>
  64.605 +        <translation>Vergrössern</translation>
  64.606 +    </message>
  64.607 +    <message>
  64.608 +        <source>Zoom out</source>
  64.609 +        <translation>Verkleinern</translation>
  64.610 +    </message>
  64.611 +    <message>
  64.612 +        <source>Toggle Note Editor</source>
  64.613 +        <translation>Zeige Notiz Editor</translation>
  64.614 +    </message>
  64.615 +    <message>
  64.616 +        <source>&amp;Next Window</source>
  64.617 +        <translation>&amp;Nächstes Fenster</translation>
  64.618 +    </message>
  64.619 +    <message>
  64.620 +        <source>Next Window</source>
  64.621 +        <translation>Nächstes Fenster</translation>
  64.622 +    </message>
  64.623 +    <message>
  64.624 +        <source>&amp;Previous Window</source>
  64.625 +        <translation>&amp;Vorheriges Fenster</translation>
  64.626 +    </message>
  64.627 +    <message>
  64.628 +        <source>Previous Window</source>
  64.629 +        <translation>Vorheriges Fenster</translation>
  64.630 +    </message>
  64.631 +    <message>
  64.632 +        <source>&amp;Settings</source>
  64.633 +        <translation>&amp;Einstellungen</translation>
  64.634 +    </message>
  64.635 +    <message>
  64.636 +        <source>Set application to open pdf files</source>
  64.637 +        <translation>pdf-Dateien öffnen mit...</translation>
  64.638 +    </message>
  64.639 +    <message>
  64.640 +        <source>Set application to open an URL</source>
  64.641 +        <translation>URLs öffnen mit...</translation>
  64.642 +    </message>
  64.643 +    <message>
  64.644 +        <source>Edit branch after adding it</source>
  64.645 +        <translation>Zweig nach dem Einfügen neu beschriften</translation>
  64.646 +    </message>
  64.647 +    <message>
  64.648 +        <source>Select branch after adding it</source>
  64.649 +        <translation>Zweig nach dem Einfügen auswählen</translation>
  64.650 +    </message>
  64.651 +    <message>
  64.652 +        <source>Select heading before editing</source>
  64.653 +        <translation>Beschriftung vor dem editieren auswählen</translation>
  64.654 +    </message>
  64.655 +    <message>
  64.656 +        <source>Select existing heading</source>
  64.657 +        <translation>Beschriftung vor dem editieren auswählen</translation>
  64.658 +    </message>
  64.659 +    <message>
  64.660 +        <source>Enable pasting into new branch</source>
  64.661 +        <translation>Einfügen in neuen Zweig</translation>
  64.662 +    </message>
  64.663 +    <message>
  64.664 +        <source>Enable Delete key for deleting branches</source>
  64.665 +        <translation>Delete Taste zum Löschen von Zweigen verwenden</translation>
  64.666 +    </message>
  64.667 +    <message>
  64.668 +        <source>Enable Delete key</source>
  64.669 +        <translation>Delete Taste zum Löschen von Zweigen verwenden</translation>
  64.670 +    </message>
  64.671 +    <message>
  64.672 +        <source>&amp;Test</source>
  64.673 +        <translation>&amp;Test</translation>
  64.674 +    </message>
  64.675 +    <message>
  64.676 +        <source>Test Flag</source>
  64.677 +        <translation>Test Flag</translation>
  64.678 +    </message>
  64.679 +    <message>
  64.680 +        <source>test flag</source>
  64.681 +        <translation>test Flag</translation>
  64.682 +    </message>
  64.683 +    <message>
  64.684 +        <source>Count Canvas Items</source>
  64.685 +        <translation type="obsolete">Zähle Canvas Items</translation>
  64.686 +    </message>
  64.687 +    <message>
  64.688 +        <source>Count Items</source>
  64.689 +        <translation type="obsolete">Zähle Items</translation>
  64.690 +    </message>
  64.691 +    <message>
  64.692 +        <source>Show Clipboard</source>
  64.693 +        <translation>Zeige Zwischenablage</translation>
  64.694 +    </message>
  64.695 +    <message>
  64.696 +        <source>Show clipboard</source>
  64.697 +        <translation>Zeige Zwischenablage</translation>
  64.698 +    </message>
  64.699 +    <message>
  64.700 +        <source>Export to dir</source>
  64.701 +        <translation type="obsolete">Exportiere in Verzeichnis</translation>
  64.702 +    </message>
  64.703 +    <message>
  64.704 +        <source>Export to directory</source>
  64.705 +        <translation type="obsolete">Exportiere in Verzeichnis</translation>
  64.706 +    </message>
  64.707 +    <message>
  64.708 +        <source>&amp;Help</source>
  64.709 +        <translation>&amp;Hilfe</translation>
  64.710 +    </message>
  64.711 +    <message>
  64.712 +        <source>Open VYM Documentation (pdf)</source>
  64.713 +        <translation>VYM Handbuch (pdf)</translation>
  64.714 +    </message>
  64.715 +    <message>
  64.716 +        <source>Open VYM Documentation (pdf) </source>
  64.717 +        <translation>VYM Handbuch (pdf)</translation>
  64.718 +    </message>
  64.719 +    <message>
  64.720 +        <source>Information about VYM</source>
  64.721 +        <translation>Information über VYM</translation>
  64.722 +    </message>
  64.723 +    <message>
  64.724 +        <source>About VYM</source>
  64.725 +        <translation>Über VYM</translation>
  64.726 +    </message>
  64.727 +    <message>
  64.728 +        <source>Information about QT toolkit</source>
  64.729 +        <translation>Informationen zum QT Toolkit</translation>
  64.730 +    </message>
  64.731 +    <message>
  64.732 +        <source>About QT</source>
  64.733 +        <translation>Über QT</translation>
  64.734 +    </message>
  64.735 +    <message>
  64.736 +        <source>Save image</source>
  64.737 +        <translation>Speichere Bild</translation>
  64.738 +    </message>
  64.739 +    <message>
  64.740 +        <source>The file </source>
  64.741 +        <translation>Die Datei</translation>
  64.742 +    </message>
  64.743 +    <message>
  64.744 +        <source>
  64.745 +exists already. Do you want to</source>
  64.746 +        <translation>gibt es bereits. Wollen Sie sie</translation>
  64.747 +    </message>
  64.748 +    <message>
  64.749 +        <source>Overwrite</source>
  64.750 +        <translation>Überschreiben</translation>
  64.751 +    </message>
  64.752 +    <message>
  64.753 +        <source>Cancel</source>
  64.754 +        <translation>Abbrechen</translation>
  64.755 +    </message>
  64.756 +    <message>
  64.757 +        <source>Couldn&apos;t save</source>
  64.758 +        <translation>Diese Datei konnte nicht gespeichert werden:</translation>
  64.759 +    </message>
  64.760 +    <message>
  64.761 +        <source>Saved </source>
  64.762 +        <translation type="obsolete">Datei gespeichert: </translation>
  64.763 +    </message>
  64.764 +    <message>
  64.765 +        <source>Couldn&apos;t save </source>
  64.766 +        <translation type="obsolete">Diese Datei konnte nicht gespeichert werden: </translation>
  64.767 +    </message>
  64.768 +    <message>
  64.769 +        <source>The map </source>
  64.770 +        <translation>Die Map </translation>
  64.771 +    </message>
  64.772 +    <message>
  64.773 +        <source> has been modified but not saved yet. Do you want to</source>
  64.774 +        <translation>wurde verändert aber noch nicht gespeichert. Wollen Sie</translation>
  64.775 +    </message>
  64.776 +    <message>
  64.777 +        <source>Save modified map before closing it</source>
  64.778 +        <translation>Speichern und Map schliessen</translation>
  64.779 +    </message>
  64.780 +    <message>
  64.781 +        <source>Discard changes</source>
  64.782 +        <translation>Änderungen verwerfen</translation>
  64.783 +    </message>
  64.784 +    <message>
  64.785 +        <source>This map is not saved yet. Do you want to</source>
  64.786 +        <translation>Diese Map wurde noch nicht gespeichert. Wollen Sie </translation>
  64.787 +    </message>
  64.788 +    <message>
  64.789 +        <source>Save map</source>
  64.790 +        <translation>Speichern</translation>
  64.791 +    </message>
  64.792 +    <message>
  64.793 +        <source>Critical Error</source>
  64.794 +        <translation>Kritischer Fehler</translation>
  64.795 +    </message>
  64.796 +    <message>
  64.797 +        <source>Enter path for pdf reader:</source>
  64.798 +        <translation>Pfad für pdf-Anwendung:</translation>
  64.799 +    </message>
  64.800 +    <message>
  64.801 +        <source>Enter path for application to open an URL:</source>
  64.802 +        <translation>Pfad zum Öffnen von URLs:</translation>
  64.803 +    </message>
  64.804 +    <message>
  64.805 +        <source>Save &amp;As</source>
  64.806 +        <translation>Speichern &amp;unter...</translation>
  64.807 +    </message>
  64.808 +    <message>
  64.809 +        <source>Open Recent</source>
  64.810 +        <translation>Zuletzt geöffnete Dateien</translation>
  64.811 +    </message>
  64.812 +    <message>
  64.813 +        <source>Export</source>
  64.814 +        <translation>Exportieren</translation>
  64.815 +    </message>
  64.816 +    <message>
  64.817 +        <source>Export map as image</source>
  64.818 +        <translation>als Bild</translation>
  64.819 +    </message>
  64.820 +    <message>
  64.821 +        <source>Export as ASCII (still experimental)</source>
  64.822 +        <translation>als ASCII Text (noch experimentell)</translation>
  64.823 +    </message>
  64.824 +    <message>
  64.825 +        <source>Export (ASCII)</source>
  64.826 +        <translation>als ASCII</translation>
  64.827 +    </message>
  64.828 +    <message>
  64.829 +        <source>Edit Map Info</source>
  64.830 +        <translation>Bearbeite Map Info</translation>
  64.831 +    </message>
  64.832 +    <message>
  64.833 +        <source>Export XML</source>
  64.834 +        <translation>Exportiere als XML</translation>
  64.835 +    </message>
  64.836 +    <message>
  64.837 +        <source>Export HTML</source>
  64.838 +        <translation>Exportiere als HTML</translation>
  64.839 +    </message>
  64.840 +    <message>
  64.841 +        <source>The directory </source>
  64.842 +        <translation>Das Verzeichnis</translation>
  64.843 +    </message>
  64.844 +    <message>
  64.845 +        <source> is not empty. Do you risk to overwrite its contents?</source>
  64.846 +        <translation>ist nicht leer.Riskieren sie es, das Verzeichnis zu überschreiben?</translation>
  64.847 +    </message>
  64.848 +    <message>
  64.849 +        <source>
  64.850 + is already opened.Opening the same map in multiple editors may lead 
  64.851 +to confusion when finishing working with vym.Do you want to</source>
  64.852 +        <translation>
  64.853 +ist bereits geöffnet. Die gleiche Map mehrfach in verschiedenen Ansichten zu öffnen 
  64.854 +kann beim Beenden von vym zu Problemen führen. Wollen Sie</translation>
  64.855 +    </message>
  64.856 +    <message>
  64.857 +        <source>Open anyway</source>
  64.858 +        <translation>Trotzdem öffnen</translation>
  64.859 +    </message>
  64.860 +    <message>
  64.861 +        <source>Export XML to directory</source>
  64.862 +        <translation>Exportiere XML in Verzeichnis</translation>
  64.863 +    </message>
  64.864 +    <message>
  64.865 +        <source>Critcal error</source>
  64.866 +        <translation>Kritischer Fehler</translation>
  64.867 +    </message>
  64.868 +    <message>
  64.869 +        <source>Couldn&apos;t find the documentation
  64.870 +vym.pdf in various places.</source>
  64.871 +        <translation>Konnte die Dokumentation vym.pdf
  64.872 +nirgends finden.</translation>
  64.873 +    </message>
  64.874 +    <message>
  64.875 +        <source>Couldn&apos;t find a viewer to read vym.pdf.
  64.876 +Please use Settings-&gt;</source>
  64.877 +        <translation>Konnte kein Programm zum Anzeigen von vym.pdf
  64.878 +finden. Bitte benutzen Sie Einstellungen-&gt;</translation>
  64.879 +    </message>
  64.880 +    <message>
  64.881 +        <source>The map</source>
  64.882 +        <translation>Die Map</translation>
  64.883 +    </message>
  64.884 +    <message>
  64.885 +        <source> does not exist.
  64.886 + Do you want to create a new one?</source>
  64.887 +        <translation>gibt es nicht
  64.888 +Wollen Sie eine neue anlegen?</translation>
  64.889 +    </message>
  64.890 +    <message>
  64.891 +        <source>Create</source>
  64.892 +        <translation>Anlegen</translation>
  64.893 +    </message>
  64.894 +    <message>
  64.895 +        <source>Create URL to Bugzilla</source>
  64.896 +        <translation>URL für Bugzilla anlegen</translation>
  64.897 +    </message>
  64.898 +    <message>
  64.899 +        <source>Edit vym link</source>
  64.900 +        <translation>vym Verknüpfung ändern</translation>
  64.901 +    </message>
  64.902 +    <message>
  64.903 +        <source>Delete link to another vym map</source>
  64.904 +        <translation>vym Verknüfung löschen</translation>
  64.905 +    </message>
  64.906 +    <message>
  64.907 +        <source>Delete vym link</source>
  64.908 +        <translation>vym Verknüpfung löschen</translation>
  64.909 +    </message>
  64.910 +    <message>
  64.911 +        <source>Critical Load Error</source>
  64.912 +        <translation>Kritischer Fehler beim Laden</translation>
  64.913 +    </message>
  64.914 +    <message>
  64.915 +        <source>Couldn&apos;t start unzip to decompress data.</source>
  64.916 +        <translation>Konnte unzip nicht starten, um Daten zu dekomprimieren.</translation>
  64.917 +    </message>
  64.918 +    <message>
  64.919 +        <source>unzip didn&apos;t exit normally</source>
  64.920 +        <translation>unzip wurde nicht richtig beendet</translation>
  64.921 +    </message>
  64.922 +    <message>
  64.923 +        <source>Couldn&apos;t find a map (*.xml) in .vym archive.
  64.924 +</source>
  64.925 +        <translation>Konnte keine map (*.xml) in .vym Datei finden.
  64.926 +</translation>
  64.927 +    </message>
  64.928 +    <message>
  64.929 +        <source>Critical Save Error</source>
  64.930 +        <translation>Kritischer Fehler beim Speichern</translation>
  64.931 +    </message>
  64.932 +    <message>
  64.933 +        <source>Couldn&apos;t start zip to compress data.</source>
  64.934 +        <translation>Konnte zip nicht starten, um Daten zu komprimieren.</translation>
  64.935 +    </message>
  64.936 +    <message>
  64.937 +        <source>zip didn&apos;t exit normally</source>
  64.938 +        <translation>zip wurde nicht richtig beendet</translation>
  64.939 +    </message>
  64.940 +    <message>
  64.941 +        <source>Saving the map as </source>
  64.942 +        <translation type="obsolete">Das Speichern der map als</translation>
  64.943 +    </message>
  64.944 +    <message>
  64.945 +        <source>
  64.946 +will write it uncompressed.
  64.947 +This will also write the directories for images
  64.948 +and flags and thus may overwrite files in the given directory
  64.949 +Do you want to</source>
  64.950 +        <translation type="obsolete">
  64.951 +wird die map unkomprimiert schreiben.
  64.952 +Dabei werden Verzeichnisse für die Bilder und Flags erzeugt
  64.953 +und dabei evtl. andere Daten im Verzeichnis überschrieben</translation>
  64.954 +    </message>
  64.955 +    <message>
  64.956 +        <source>Proceed</source>
  64.957 +        <translation type="obsolete">Weiter</translation>
  64.958 +    </message>
  64.959 +    <message>
  64.960 +        <source>Saved</source>
  64.961 +        <translation>Gespeichert: </translation>
  64.962 +    </message>
  64.963 +    <message>
  64.964 +        <source>VYM -Information:</source>
  64.965 +        <translation>vym-Information:</translation>
  64.966 +    </message>
  64.967 +    <message>
  64.968 +        <source>No matches found for </source>
  64.969 +        <translation>Keine Treffer gefunden für</translation>
  64.970 +    </message>
  64.971 +    <message>
  64.972 +        <source>Export XHTML</source>
  64.973 +        <translation>Exportiere XHTML</translation>
  64.974 +    </message>
  64.975 +    <message>
  64.976 +        <source>
  64.977 +did not use the compressed vym file format.
  64.978 +Writing it uncompressed will also write images 
  64.979 +and flags and thus may overwrite files in the given directory
  64.980 +
  64.981 +Do you want to write the map</source>
  64.982 +        <translation>
  64.983 +verwendet nicht das komprimierte vym Dateiformat.
  64.984 +Wenn die Map unkomprimiert geschrieben werden soll,
  64.985 +dann werden auch die Flags und Bilder im angegebenen 
  64.986 +Verzeichnis geschrieben, was evtl. bestehende Daten
  64.987 +überschreiben kann
  64.988 +
  64.989 +Wollen Sie die Map beim Schreiben</translation>
  64.990 +    </message>
  64.991 +    <message>
  64.992 +        <source>compressed (vym default)</source>
  64.993 +        <translation>komprimieren (vym default)</translation>
  64.994 +    </message>
  64.995 +    <message>
  64.996 +        <source>uncompressed</source>
  64.997 +        <translation>unkomprimiert lassen</translation>
  64.998 +    </message>
  64.999 +    <message>
 64.1000 +        <source>Use for Export</source>
 64.1001 +        <translation>Benutze für Export</translation>
 64.1002 +    </message>
 64.1003 +    <message>
 64.1004 +        <source>Add map at selection</source>
 64.1005 +        <translation>Map an Auswahl anhängen</translation>
 64.1006 +    </message>
 64.1007 +    <message>
 64.1008 +        <source>Import (add)</source>
 64.1009 +        <translation>Import (hinzufügen)</translation>
 64.1010 +    </message>
 64.1011 +    <message>
 64.1012 +        <source>Replace selection with map</source>
 64.1013 +        <translation>Auswahl mit Map ersetzen</translation>
 64.1014 +    </message>
 64.1015 +    <message>
 64.1016 +        <source>Import (replace)</source>
 64.1017 +        <translation>Import (ersetzen)</translation>
 64.1018 +    </message>
 64.1019 +    <message>
 64.1020 +        <source>Save selction</source>
 64.1021 +        <translation>Auswahl speichern</translation>
 64.1022 +    </message>
 64.1023 +    <message>
 64.1024 +        <source>Save selection</source>
 64.1025 +        <translation>Auswahl speichern</translation>
 64.1026 +    </message>
 64.1027 +    <message>
 64.1028 +        <source>Load vym map</source>
 64.1029 +        <translation>Lade vym Map</translation>
 64.1030 +    </message>
 64.1031 +    <message>
 64.1032 +        <source>Import: Add vym map to selection</source>
 64.1033 +        <translation>Import: Füge Map zu Auswahl hinzu</translation>
 64.1034 +    </message>
 64.1035 +    <message>
 64.1036 +        <source>Import: Replace selection with vym map</source>
 64.1037 +        <translation>Import: Ersetze Auswahl mit Map</translation>
 64.1038 +    </message>
 64.1039 +    <message>
 64.1040 +        <source>Save Error</source>
 64.1041 +        <translation>Fehler beim Speichern</translation>
 64.1042 +    </message>
 64.1043 +    <message>
 64.1044 +        <source>
 64.1045 +could not be removed before saving</source>
 64.1046 +        <translation>
 64.1047 +konnte vor dem Speichern nicht gelöscht werden</translation>
 64.1048 +    </message>
 64.1049 +</context>
 64.1050 +<context>
 64.1051 +    <name>MapEditor</name>
 64.1052 +    <message>
 64.1053 +        <source>Note</source>
 64.1054 +        <translation>Notiz</translation>
 64.1055 +    </message>
 64.1056 +    <message>
 64.1057 +        <source>WWW Document (external)</source>
 64.1058 +        <translation>WWW Dokument (extern)</translation>
 64.1059 +    </message>
 64.1060 +    <message>
 64.1061 +        <source>Link to another vym map</source>
 64.1062 +        <translation>Verbindung zu einer anderen Map</translation>
 64.1063 +    </message>
 64.1064 +    <message>
 64.1065 +        <source>subtree is scrolled</source>
 64.1066 +        <translation>Teilbaum ist eingerollt</translation>
 64.1067 +    </message>
 64.1068 +    <message>
 64.1069 +        <source>subtree is temporary scrolled</source>
 64.1070 +        <translation>Teilbaum ist momentan ausgerollt</translation>
 64.1071 +    </message>
 64.1072 +    <message>
 64.1073 +        <source>Take care!</source>
 64.1074 +        <translation>Vorsicht!</translation>
 64.1075 +    </message>
 64.1076 +    <message>
 64.1077 +        <source>Really?</source>
 64.1078 +        <translation>Wirklich?</translation>
 64.1079 +    </message>
 64.1080 +    <message>
 64.1081 +        <source>ok!</source>
 64.1082 +        <translation>ok!</translation>
 64.1083 +    </message>
 64.1084 +    <message>
 64.1085 +        <source>Not ok!</source>
 64.1086 +        <translation>Nicht ok!</translation>
 64.1087 +    </message>
 64.1088 +    <message>
 64.1089 +        <source>This won&apos;t work!</source>
 64.1090 +        <translation>Das geht nicht!</translation>
 64.1091 +    </message>
 64.1092 +    <message>
 64.1093 +        <source>Good</source>
 64.1094 +        <translation>Gut</translation>
 64.1095 +    </message>
 64.1096 +    <message>
 64.1097 +        <source>Bad</source>
 64.1098 +        <translation>Schlecht</translation>
 64.1099 +    </message>
 64.1100 +    <message>
 64.1101 +        <source>Time critical</source>
 64.1102 +        <translation>Zeitkritisch</translation>
 64.1103 +    </message>
 64.1104 +    <message>
 64.1105 +        <source>Idea!</source>
 64.1106 +        <translation>Idee!</translation>
 64.1107 +    </message>
 64.1108 +    <message>
 64.1109 +        <source>Important</source>
 64.1110 +        <translation>Wichtig</translation>
 64.1111 +    </message>
 64.1112 +    <message>
 64.1113 +        <source>Unimportant</source>
 64.1114 +        <translation>Unwichtig</translation>
 64.1115 +    </message>
 64.1116 +    <message>
 64.1117 +        <source>I like this</source>
 64.1118 +        <translation>Finde ich gut</translation>
 64.1119 +    </message>
 64.1120 +    <message>
 64.1121 +        <source>I do not like this</source>
 64.1122 +        <translation>Finde ich schlecht</translation>
 64.1123 +    </message>
 64.1124 +    <message>
 64.1125 +        <source>I just love... </source>
 64.1126 +        <translation>Das liebe ich!</translation>
 64.1127 +    </message>
 64.1128 +    <message>
 64.1129 +        <source>Critical error while loading map</source>
 64.1130 +        <translation type="obsolete">Kritischer Fehler beim Laden der Map</translation>
 64.1131 +    </message>
 64.1132 +    <message>
 64.1133 +        <source>Critical Parse Error</source>
 64.1134 +        <translation>Kritischer Fehler beim Verarbeiten</translation>
 64.1135 +    </message>
 64.1136 +    <message>
 64.1137 +        <source>Warning: Old file format</source>
 64.1138 +        <translation type="obsolete">Warnung: Altes Dateiformat</translation>
 64.1139 +    </message>
 64.1140 +    <message>
 64.1141 +        <source>&lt;h3&gt;Old file format detected&lt;/h3&gt;&lt;p&gt;The map you are just loading still uses an old uncompressed file format. Saving it later will overwrite the old format by converting it to version </source>
 64.1142 +        <translation type="obsolete">&lt;h3&gt;Altes Dateiformat gefunden&lt;/h3&gt;Die gerade geladene Map verwendet ein unkomprimmiertes Format. Wird sie später gespeichert, so wird sie umgewandelt in das Format von Version</translation>
 64.1143 +    </message>
 64.1144 +    <message>
 64.1145 +        <source>Critical Load Error</source>
 64.1146 +        <translation type="obsolete">Kritischer Fehler beim Laden</translation>
 64.1147 +    </message>
 64.1148 +    <message>
 64.1149 +        <source>Couldn&apos;t open map after uncompressing, I tried:
 64.1150 +</source>
 64.1151 +        <translation type="obsolete">Konnte Map nach dem Entpacken nicht öffnen:
 64.1152 +</translation>
 64.1153 +    </message>
 64.1154 +    <message>
 64.1155 +        <source>Critical Save Error</source>
 64.1156 +        <translation>Kritischer Fehler beim Speichern</translation>
 64.1157 +    </message>
 64.1158 +    <message>
 64.1159 +        <source>Couldn&apos;t write to </source>
 64.1160 +        <translation>Konnte nicht speichern:</translation>
 64.1161 +    </message>
 64.1162 +    <message>
 64.1163 +        <source>Critcal save error</source>
 64.1164 +        <translation>Kritischer Fehler beim Speichern</translation>
 64.1165 +    </message>
 64.1166 +    <message>
 64.1167 +        <source> doesn&apos;t exist</source>
 64.1168 +        <translation type="obsolete">gibt es nicht</translation>
 64.1169 +    </message>
 64.1170 +    <message>
 64.1171 +        <source>VYM - Export (ASCII)</source>
 64.1172 +        <translation>VYM - Export (ASCII)</translation>
 64.1173 +    </message>
 64.1174 +    <message>
 64.1175 +        <source>The file </source>
 64.1176 +        <translation>Die Datei</translation>
 64.1177 +    </message>
 64.1178 +    <message>
 64.1179 +        <source> exists already. Do you want to overwrite it?</source>
 64.1180 +        <translation>gibt es bereits. Wollen Sie sie</translation>
 64.1181 +    </message>
 64.1182 +    <message>
 64.1183 +        <source>Overwrite</source>
 64.1184 +        <translation>Überschreiben</translation>
 64.1185 +    </message>
 64.1186 +    <message>
 64.1187 +        <source>Cancel</source>
 64.1188 +        <translation>Abbrechen</translation>
 64.1189 +    </message>
 64.1190 +    <message>
 64.1191 +        <source>Critical Export Error </source>
 64.1192 +        <translation>Kritischer Fehler beim Exportieren</translation>
 64.1193 +    </message>
 64.1194 +    <message>
 64.1195 +        <source>Couldn&apos;t create directory </source>
 64.1196 +        <translation>Konnte Verzeichnis nicht anlegen</translation>
 64.1197 +    </message>
 64.1198 +    <message>
 64.1199 +        <source>VYM - Export to directory</source>
 64.1200 +        <translation type="obsolete">VYM - Export in Verzeichnis</translation>
 64.1201 +    </message>
 64.1202 +    <message>
 64.1203 +        <source>VYM - Export to directory (still experimental)</source>
 64.1204 +        <translation type="obsolete">VYM - Export in Verzeichnis</translation>
 64.1205 +    </message>
 64.1206 +    <message>
 64.1207 +        <source>The directory </source>
 64.1208 +        <translation type="obsolete">Das Verzeichnis</translation>
 64.1209 +    </message>
 64.1210 +    <message>
 64.1211 +        <source> is not empty. Do you risk to overwrite its contents?</source>
 64.1212 +        <translation type="obsolete">ist nicht leer.Riskieren sie es, das Verzeichnis zu überschreiben?</translation>
 64.1213 +    </message>
 64.1214 +    <message>
 64.1215 +        <source>Critical Export Error</source>
 64.1216 +        <translation>Kritischer Fehler beim Exportieren</translation>
 64.1217 +    </message>
 64.1218 +    <message>
 64.1219 +        <source>Critical Error</source>
 64.1220 +        <translation>Kritischer Fehler</translation>
 64.1221 +    </message>
 64.1222 +    <message>
 64.1223 +        <source> used for undo is gone. 
 64.1224 +I will create a new one, but at the moment no undo is available.
 64.1225 +Maybe you want to reload your original data.
 64.1226 +
 64.1227 +Sorry for any inconveniences.</source>
 64.1228 +        <translation>Vielleicht wollen sie die Orginaldaten erneut laden
 64.1229 +Sorry für die Unannehmlichkeiten.</translation>
 64.1230 +    </message>
 64.1231 +    <message>
 64.1232 +        <source>Enter URL:</source>
 64.1233 +        <translation>Neue URL:</translation>
 64.1234 +    </message>
 64.1235 +    <message>
 64.1236 +        <source>VYM - Link to another map</source>
 64.1237 +        <translation>VYM - Verbindung zu einer anderen Map</translation>
 64.1238 +    </message>
 64.1239 +    <message>
 64.1240 +        <source>vym map</source>
 64.1241 +        <translation>vym Map</translation>
 64.1242 +    </message>
 64.1243 +    <message>
 64.1244 +        <source>vym - load image</source>
 64.1245 +        <translation>VYM - Lade Bild</translation>
 64.1246 +    </message>
 64.1247 +    <message>
 64.1248 +        <source>Images</source>
 64.1249 +        <translation>Bilder</translation>
 64.1250 +    </message>
 64.1251 +    <message>
 64.1252 +        <source>vym - Load image</source>
 64.1253 +        <translation>vym - Lade Bild</translation>
 64.1254 +    </message>
 64.1255 +    <message>
 64.1256 +        <source>vym - save image as</source>
 64.1257 +        <translation>vym - Speichere Bild als</translation>
 64.1258 +    </message>
 64.1259 +    <message>
 64.1260 +        <source>vym - Save image as </source>
 64.1261 +        <translation>vym - Speichere Bild als</translation>
 64.1262 +    </message>
 64.1263 +    <message>
 64.1264 +        <source>Critical Import Error</source>
 64.1265 +        <translation>Kritischer Fehler beim Importieren</translation>
 64.1266 +    </message>
 64.1267 +    <message>
 64.1268 +        <source>Cannot find the directory</source>
 64.1269 +        <translation>Kann das Verzeichnis nicht finden</translation>
 64.1270 +    </message>
 64.1271 +    <message>
 64.1272 +        <source>VYM - Choose directory structur to import</source>
 64.1273 +        <translation>vym - Wähle Verzeichnisstruktur für Import</translation>
 64.1274 +    </message>
 64.1275 +    <message>
 64.1276 +        <source>Dangerous</source>
 64.1277 +        <translation>Gefährlich</translation>
 64.1278 +    </message>
 64.1279 +    <message>
 64.1280 +        <source>This will help</source>
 64.1281 +        <translation>Das könnte helfen</translation>
 64.1282 +    </message>
 64.1283 +    <message>
 64.1284 +        <source>New Map</source>
 64.1285 +        <translation>Neue Map</translation>
 64.1286 +    </message>
 64.1287 +    <message>
 64.1288 +        <source>Critical Parse Error by reading backupFile</source>
 64.1289 +        <translation>Kritischer Fehler beim Parsen
 64.1290 +der Sicherungskopie</translation>
 64.1291 +    </message>
 64.1292 +    <message>
 64.1293 +        <source>MapEditor::exportXML couldn&apos;t open </source>
 64.1294 +        <translation>MapEditor::exportXML konnte nicht öffnen:</translation>
 64.1295 +    </message>
 64.1296 +</context>
 64.1297 +<context>
 64.1298 +    <name>QMessageBox</name>
 64.1299 +    <message>
 64.1300 +        <source>Critical Error</source>
 64.1301 +        <translation type="obsolete">Kritischer Fehler</translation>
 64.1302 +    </message>
 64.1303 +</context>
 64.1304 +<context>
 64.1305 +    <name>QObject</name>
 64.1306 +    <message>
 64.1307 +        <source>new branch</source>
 64.1308 +        <translation type="obsolete">Neuer Zweig</translation>
 64.1309 +    </message>
 64.1310 +    <message>
 64.1311 +        <source>New Map</source>
 64.1312 +        <translation type="obsolete">Neue Map</translation>
 64.1313 +    </message>
 64.1314 +    <message>
 64.1315 +        <source>This is not an image.</source>
 64.1316 +        <translation>Das ist kein Bild.</translation>
 64.1317 +    </message>
 64.1318 +</context>
 64.1319 +<context>
 64.1320 +    <name>ShowTextDialog</name>
 64.1321 +    <message>
 64.1322 +        <source>VYM - Info</source>
 64.1323 +        <translation>VYM - Info</translation>
 64.1324 +    </message>
 64.1325 +    <message>
 64.1326 +        <source>Close</source>
 64.1327 +        <translation>Schliessen</translation>
 64.1328 +    </message>
 64.1329 +</context>
 64.1330 +<context>
 64.1331 +    <name>TextEditor</name>
 64.1332 +    <message>
 64.1333 +        <source>&amp;File</source>
 64.1334 +        <translation>&amp;Datei</translation>
 64.1335 +    </message>
 64.1336 +    <message>
 64.1337 +        <source>Import</source>
 64.1338 +        <translation>Importiere</translation>
 64.1339 +    </message>
 64.1340 +    <message>
 64.1341 +        <source>&amp;Import...</source>
 64.1342 +        <translation>&amp;Importiere</translation>
 64.1343 +    </message>
 64.1344 +    <message>
 64.1345 +        <source>Export Note</source>
 64.1346 +        <translation type="obsolete">Exportiere Notiz</translation>
 64.1347 +    </message>
 64.1348 +    <message>
 64.1349 +        <source>&amp;Export...</source>
 64.1350 +        <translation>&amp;Export</translation>
 64.1351 +    </message>
 64.1352 +    <message>
 64.1353 +        <source>Export Note As</source>
 64.1354 +        <translation type="obsolete">Exportiere Notiz unter...</translation>
 64.1355 +    </message>
 64.1356 +    <message>
 64.1357 +        <source>Export &amp;As...</source>
 64.1358 +        <translation type="obsolete">Exportiere &amp;unter...</translation>
 64.1359 +    </message>
 64.1360 +    <message>
 64.1361 +        <source>Print Note</source>
 64.1362 +        <translation>Drucke Notiz</translation>
 64.1363 +    </message>
 64.1364 +    <message>
 64.1365 +        <source>&amp;Print...</source>
 64.1366 +        <translation>&amp;Drucken</translation>
 64.1367 +    </message>
 64.1368 +    <message>
 64.1369 +        <source>&amp;Edit</source>
 64.1370 +        <translation>&amp;Bearbeiten</translation>
 64.1371 +    </message>
 64.1372 +    <message>
 64.1373 +        <source>Undo</source>
 64.1374 +        <translation>Rückgängig</translation>
 64.1375 +    </message>
 64.1376 +    <message>
 64.1377 +        <source>&amp;Undo</source>
 64.1378 +        <translation>R&amp;ückgängig</translation>
 64.1379 +    </message>
 64.1380 +    <message>
 64.1381 +        <source>Redo</source>
 64.1382 +        <translation>Wiederherstellen</translation>
 64.1383 +    </message>
 64.1384 +    <message>
 64.1385 +        <source>&amp;Redo</source>
 64.1386 +        <translation>Wieder&amp;herstellen</translation>
 64.1387 +    </message>
 64.1388 +    <message>
 64.1389 +        <source>Select and copy all</source>
 64.1390 +        <translation>Alles auswählen und kopieren</translation>
 64.1391 +    </message>
 64.1392 +    <message>
 64.1393 +        <source>Select and copy &amp;all</source>
 64.1394 +        <translation>&amp;Alles auswählen und kopieren</translation>
 64.1395 +    </message>
 64.1396 +    <message>
 64.1397 +        <source>Copy</source>
 64.1398 +        <translation>Kopieren</translation>
 64.1399 +    </message>
 64.1400 +    <message>
 64.1401 +        <source>&amp;Copy</source>
 64.1402 +        <translation>&amp;Kopieren</translation>
 64.1403 +    </message>
 64.1404 +    <message>
 64.1405 +        <source>Cut</source>
 64.1406 +        <translation>Ausschneiden</translation>
 64.1407 +    </message>
 64.1408 +    <message>
 64.1409 +        <source>Cu&amp;t</source>
 64.1410 +        <translation>&amp;Ausschneiden</translation>
 64.1411 +    </message>
 64.1412 +    <message>
 64.1413 +        <source>Paste</source>
 64.1414 +        <translation>Einfügen</translation>
 64.1415 +    </message>
 64.1416 +    <message>
 64.1417 +        <source>&amp;Paste</source>
 64.1418 +        <translation>Ein&amp;fügen</translation>
 64.1419 +    </message>
 64.1420 +    <message>
 64.1421 +        <source>Delete all</source>
 64.1422 +        <translation>Alles löschen</translation>
 64.1423 +    </message>
 64.1424 +    <message>
 64.1425 +        <source>&amp;Delete All</source>
 64.1426 +        <translation>Alles &amp;löschen</translation>
 64.1427 +    </message>
 64.1428 +    <message>
 64.1429 +        <source>&amp;Format</source>
 64.1430 +        <translation>&amp;Format</translation>
 64.1431 +    </message>
 64.1432 +    <message>
 64.1433 +        <source>Use fixed font</source>
 64.1434 +        <translation type="obsolete">Benutze fixe Zeichenbreite</translation>
 64.1435 +    </message>
 64.1436 +    <message>
 64.1437 +        <source>&amp;Fixed font</source>
 64.1438 +        <translation type="obsolete">&amp;fixe Zeichenbreite</translation>
 64.1439 +    </message>
 64.1440 +    <message>
 64.1441 +        <source>&amp;Settings</source>
 64.1442 +        <translation>&amp;Einstellungen</translation>
 64.1443 +    </message>
 64.1444 +    <message>
 64.1445 +        <source>Set fixed font</source>
 64.1446 +        <translation>Wähle Zeichensatz mit fixer Breite</translation>
 64.1447 +    </message>
 64.1448 +    <message>
 64.1449 +        <source>Set &amp;fixed font</source>
 64.1450 +        <translation>Wähle Zeichensatz mit f&amp;ixer Breite</translation>
 64.1451 +    </message>
 64.1452 +    <message>
 64.1453 +        <source>Set variable font</source>
 64.1454 +        <translation>Wähle Zeichensatz mit variabler Breite</translation>
 64.1455 +    </message>
 64.1456 +    <message>
 64.1457 +        <source>Set &amp;variable font</source>
 64.1458 +        <translation>Wähle Zeichensatz mit v&amp;ariabler Breite</translation>
 64.1459 +    </message>
 64.1460 +    <message>
 64.1461 +        <source>Used fixed font by default</source>
 64.1462 +        <translation>Verwende fixen Zeichensatz per default</translation>
 64.1463 +    </message>
 64.1464 +    <message>
 64.1465 +        <source>&amp;fixed font is default</source>
 64.1466 +        <translation>Verwende fixen Zeichensatz p&amp;er default</translation>
 64.1467 +    </message>
 64.1468 +    <message>
 64.1469 +        <source>Export Note (HTML)</source>
 64.1470 +        <translation>Exportiere Notiz (HTML)</translation>
 64.1471 +    </message>
 64.1472 +    <message>
 64.1473 +        <source>Export Note As (HTML) </source>
 64.1474 +        <translation>Exportiere Notiz als (HTML)</translation>
 64.1475 +    </message>
 64.1476 +    <message>
 64.1477 +        <source>Export &amp;As... (HTML)</source>
 64.1478 +        <translation>Exportiere Notiz &amp;als... (HTML)</translation>
 64.1479 +    </message>
 64.1480 +    <message>
 64.1481 +        <source>Export Note As (ASCII) </source>
 64.1482 +        <translation>Exportiere Notiz als (ASCII)</translation>
 64.1483 +    </message>
 64.1484 +    <message>
 64.1485 +        <source>Export &amp;As...(ASCII)</source>
 64.1486 +        <translation>Exportiere a&amp;ls (ASCII)</translation>
 64.1487 +    </message>
 64.1488 +    <message>
 64.1489 +        <source>Use fixed width font for the whole text</source>
 64.1490 +        <translation type="obsolete">Feste Zeichenbreite für den Text verwenden</translation>
 64.1491 +    </message>
 64.1492 +    <message>
 64.1493 +        <source>&amp;Color...</source>
 64.1494 +        <translation>&amp;Farbe...</translation>
 64.1495 +    </message>
 64.1496 +    <message>
 64.1497 +        <source>&amp;Bold</source>
 64.1498 +        <translation>F&amp;ett</translation>
 64.1499 +    </message>
 64.1500 +    <message>
 64.1501 +        <source>&amp;Italic</source>
 64.1502 +        <translation>K&amp;ursiv</translation>
 64.1503 +    </message>
 64.1504 +    <message>
 64.1505 +        <source>&amp;Underline</source>
 64.1506 +        <translation>&amp;Unterstrichen</translation>
 64.1507 +    </message>
 64.1508 +    <message>
 64.1509 +        <source>&amp;Left</source>
 64.1510 +        <translation>&amp;Linksbündig</translation>
 64.1511 +    </message>
 64.1512 +    <message>
 64.1513 +        <source>C&amp;enter</source>
 64.1514 +        <translation>&amp;Zentriert</translation>
 64.1515 +    </message>
 64.1516 +    <message>
 64.1517 +        <source>&amp;Right</source>
 64.1518 +        <translation>&amp;Rechtsbündig</translation>
 64.1519 +    </message>
 64.1520 +    <message>
 64.1521 +        <source>&amp;Justify</source>
 64.1522 +        <translation>&amp;Blocksatz</translation>
 64.1523 +    </message>
 64.1524 +    <message>
 64.1525 +        <source>Export Note to single file</source>
 64.1526 +        <translation>Notiz in eine einzelne Datei exportieren</translation>
 64.1527 +    </message>
 64.1528 +    <message>
 64.1529 +        <source>The file </source>
 64.1530 +        <translation>Die Datei</translation>
 64.1531 +    </message>
 64.1532 +    <message>
 64.1533 +        <source> exists already. Do you want to overwrite it?</source>
 64.1534 +        <translation>gibt es bereits. Wollen Sie sie</translation>
 64.1535 +    </message>
 64.1536 +    <message>
 64.1537 +        <source>Overwrite</source>
 64.1538 +        <translation>Überschreiben</translation>
 64.1539 +    </message>
 64.1540 +    <message>
 64.1541 +        <source>Cancel</source>
 64.1542 +        <translation>Abbrechen</translation>
 64.1543 +    </message>
 64.1544 +    <message>
 64.1545 +        <source>Couldn&apos;t export note </source>
 64.1546 +        <translation>Konnte Notiz nicht exportieren</translation>
 64.1547 +    </message>
 64.1548 +    <message>
 64.1549 +        <source>Export Note to single file (ASCII)</source>
 64.1550 +        <translation>Notiz als ASCII in eine einzelne Datei ausgeben</translation>
 64.1551 +    </message>
 64.1552 +    <message>
 64.1553 +        <source>Convert paragraphs to linebreaks</source>
 64.1554 +        <translation>Absätze in Zeilenbrüche umwandeln</translation>
 64.1555 +    </message>
 64.1556 +    <message>
 64.1557 +        <source>&amp;Convert Paragraphs</source>
 64.1558 +        <translation>&amp;Absätze umwandeln</translation>
 64.1559 +    </message>
 64.1560 +    <message>
 64.1561 +        <source>Join all lines of a paragraph</source>
 64.1562 +        <translation>Alle Zeilenumbrüche eines Absatzes zu vereinen</translation>
 64.1563 +    </message>
 64.1564 +    <message>
 64.1565 +        <source>&amp;Join lines</source>
 64.1566 +        <translation>&amp;Zeilen vereinen</translation>
 64.1567 +    </message>
 64.1568 +    <message>
 64.1569 +        <source>Toggle font hint for the whole text</source>
 64.1570 +        <translation>Zeichensatz für gesamten Text umschalten</translation>
 64.1571 +    </message>
 64.1572 +    <message>
 64.1573 +        <source>&amp;Font hint</source>
 64.1574 +        <translation>Zeichensatz &amp;umschalten</translation>
 64.1575 +    </message>
 64.1576 +</context>
 64.1577 +</TS>
    65.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    65.2 +++ b/xml.cpp	Sun Jan 30 12:58:47 2005 +0000
    65.3 @@ -0,0 +1,519 @@
    65.4 +#include "xml.h"
    65.5 +
    65.6 +#include <qmessagebox.h>
    65.7 +#include <qcolor.h>
    65.8 +#include <qstylesheet.h>
    65.9 +#include <iostream>
   65.10 +
   65.11 +#include "misc.h"
   65.12 +#include "settings.h"
   65.13 +
   65.14 +#include "version.h"
   65.15 +
   65.16 +static BranchObj *lastBranch;
   65.17 +static FloatObj *lastFloat;
   65.18 +
   65.19 +extern Settings settings;
   65.20 +
   65.21 +mapBuilderHandler::mapBuilderHandler() {}
   65.22 +
   65.23 +mapBuilderHandler::~mapBuilderHandler() {}
   65.24 +
   65.25 +QString mapBuilderHandler::errorProtocol() { return errorProt; }
   65.26 +
   65.27 +bool mapBuilderHandler::startDocument()
   65.28 +{
   65.29 +    errorProt = "";
   65.30 +    state = StateInit;
   65.31 +    laststate = StateInit;
   65.32 +    branchDepth=0;
   65.33 +	htmldata="";
   65.34 +	isVymPart=false;
   65.35 +    return true;
   65.36 +}
   65.37 +
   65.38 +
   65.39 +QString mapBuilderHandler::parseHREF(QString href)
   65.40 +{
   65.41 +	QString type=href.section(":",0,0);
   65.42 +	QString path=href.section(":",1,1);
   65.43 +	if (!tmpDir.endsWith("/"))
   65.44 +		return tmpDir + "/" + path;
   65.45 +	else	
   65.46 +		return tmpDir + path;
   65.47 +}
   65.48 +
   65.49 +bool mapBuilderHandler::startElement  ( const QString&, const QString&,
   65.50 +                    const QString& eName, const QXmlAttributes& atts ) 
   65.51 +{
   65.52 +    QColor col;
   65.53 +//	cout << "startElement <"<<eName<<">  state="<<state <<"  laststate="<<laststate<<endl;
   65.54 +    if ( state == StateInit && (eName == "vymmap")  ) 
   65.55 +	{
   65.56 +        state = StateMap;
   65.57 +		if (!atts.value( "version").isEmpty() ) 
   65.58 +		{
   65.59 +			mc->setVersion(atts.value( "version" ));
   65.60 +			if (!mc->checkVersion())
   65.61 +				QMessageBox::warning( 0, "Warning: Version Problem" ,
   65.62 +				   "<h3>Map is newer than VYM</h3>"
   65.63 +				   "<p>The map you are just trying to load was "
   65.64 +				   "saved using vym " +atts.value("version")+". "
   65.65 +				   "The version of this vym is " __VYM_VERSION__
   65.66 +				   ". If you run into problems after pressing "
   65.67 +				   "the ok-button below, updating vym should help.");
   65.68 +
   65.69 +		}
   65.70 +		if (loadMode==NewMap)
   65.71 +		{
   65.72 +			if (!atts.value( "author").isEmpty() )
   65.73 +			{
   65.74 +				mc->setAuthor(atts.value( "author" ) );
   65.75 +			}
   65.76 +			if (!atts.value( "comment").isEmpty() )
   65.77 +			{
   65.78 +				mc->setComment (atts.value( "comment" ) );
   65.79 +			}
   65.80 +			if (!atts.value( "backgroundColor").isEmpty() )
   65.81 +			{
   65.82 +				col.setNamedColor(atts.value("backgroundColor"));
   65.83 +				mc->getCanvas()->setBackgroundColor(col);
   65.84 +			}	    
   65.85 +			if (!atts.value( "linkColorHint").isEmpty() ) 
   65.86 +			{
   65.87 +				if (atts.value("linkColorHint")=="HeadingColor")
   65.88 +					me->setLinkColorHint(HeadingColor);
   65.89 +				else
   65.90 +					me->setLinkColorHint(DefaultColor);
   65.91 +			}
   65.92 +			if (!atts.value( "linkStyle").isEmpty() ) 
   65.93 +			{
   65.94 +				QString s=atts.value("linkStyle");
   65.95 +				if (s=="StyleLine")
   65.96 +					me->setLinkStyle(StyleLine);
   65.97 +				else	
   65.98 +					if (s=="StyleParabel")
   65.99 +						me->setLinkStyle(StyleParabel);
  65.100 +					else	
  65.101 +						if (s=="StylePolyLine")
  65.102 +							me->setLinkStyle(StylePolyLine);
  65.103 +						else	
  65.104 +							me->setLinkStyle(StylePolyParabel);
  65.105 +			}	
  65.106 +			if (!atts.value( "linkColor").isEmpty() ) 
  65.107 +			{
  65.108 +				col.setNamedColor(atts.value("linkColor"));
  65.109 +				me->setLinkColor(col);
  65.110 +			}	
  65.111 +		}	
  65.112 +	} else if ( eName == "select" && state == StateMap ) 
  65.113 +	{
  65.114 +		state=StateMapSelect;
  65.115 +	} else if ( eName == "setting" && state == StateMap ) 
  65.116 +	{
  65.117 +		state=StateMapSetting;
  65.118 +		if (loadMode==NewMap)
  65.119 +			readSettingAttr (atts);
  65.120 +	} else if ( eName == "mapcenter" && state == StateMap ) 
  65.121 +	{
  65.122 +		state=StateMapCenter;
  65.123 +		if (loadMode==NewMap)
  65.124 +		{	
  65.125 +			// Really use the found mapcenter as MCO in a new map
  65.126 +			lastBranch=mc;	// avoid empty pointer
  65.127 +		} else
  65.128 +		{
  65.129 +			// Treat the found mapcenter as a branch 
  65.130 +			// in an existing map
  65.131 +			LinkableMapObj* lmo=me->getSelection();
  65.132 +			if (lmo && (typeid(*lmo) == typeid(BranchObj) ) 
  65.133 +			        || (typeid(*lmo) == typeid(MapCenterObj) ) )
  65.134 +			{
  65.135 +				lastBranch=(BranchObj*)(lmo);
  65.136 +				if (loadMode==ImportAdd)
  65.137 +				{
  65.138 +					lastBranch->addBranch();
  65.139 +					lastBranch=lastBranch->getLastBranch();
  65.140 +				} else
  65.141 +					lastBranch->clear();
  65.142 +			} else
  65.143 +				return false;
  65.144 +		}
  65.145 +		readBranchAttr (atts);
  65.146 +	} else if ( (eName == "standardflag" ||eName == "standardFlag") && state == StateMapCenter) 
  65.147 +	{
  65.148 +		state=StateMapCenterStandardFlag;
  65.149 +	} else if ( eName == "heading" && state == StateMapCenter) 
  65.150 +	{
  65.151 +		state=StateMapCenterHeading;
  65.152 +		if (!atts.value( "textColor").isEmpty() ) 
  65.153 +		{
  65.154 +			col.setNamedColor(atts.value("textColor"));
  65.155 +			lastBranch->setColor(col ,false );
  65.156 +		}	    
  65.157 +	} else if ( eName == "note" && state == StateMapCenter) 
  65.158 +	{	// only for backward compatibility (<1.4.6). Use htmlnote now.
  65.159 +		state=StateMapCenterNote;
  65.160 +		if (!readNoteAttr (atts) ) return false;
  65.161 +	} else if ( eName == "htmlnote" && state == StateMapCenter) 
  65.162 +	{
  65.163 +		laststate=state;
  65.164 +		state=StateHtmlNote;
  65.165 +    } else if ( eName == "floatimage" && state == StateMapCenter ) 
  65.166 +	{
  65.167 +		state=StateMapCenterFloatImage;
  65.168 +        lastBranch->addFloatImage();
  65.169 +		lastFloat=lastBranch->getLastFloatImage();
  65.170 +		if (!readFloatImageAttr(atts)) return false;
  65.171 +	} else if ( eName == "branch" && state == StateMap) 
  65.172 +	{
  65.173 +		// This is used in vymparts, which have no mapcenter!
  65.174 +		isVymPart=true;
  65.175 +		state=StateBranch;
  65.176 +		LinkableMapObj* lmo=me->getSelection();
  65.177 +		if (lmo && (typeid(*lmo) == typeid(BranchObj) ) 
  65.178 +				|| (typeid(*lmo) == typeid(MapCenterObj) ) )
  65.179 +		{
  65.180 +			lastBranch=(BranchObj*)(lmo);
  65.181 +			if (loadMode==ImportAdd)
  65.182 +			{
  65.183 +				lastBranch->addBranch();
  65.184 +				lastBranch=lastBranch->getLastBranch();
  65.185 +			} else
  65.186 +				lastBranch->clear();
  65.187 +		} else
  65.188 +			return false;
  65.189 +		branchDepth=1;
  65.190 +		readBranchAttr (atts);
  65.191 +	} else if ( eName == "branch" && state == StateMapCenter) 
  65.192 +	{
  65.193 +		state=StateBranch;
  65.194 +		branchDepth=1;
  65.195 +		lastBranch->addBranch();
  65.196 +		lastBranch=lastBranch->getLastBranch();
  65.197 +		readBranchAttr (atts);
  65.198 +	} else if ( (eName=="standardflag" ||eName == "standardFlag") && state == StateBranch) 
  65.199 +	{
  65.200 +		state=StateBranchStandardFlag;
  65.201 +	} else if ( eName == "heading" && state == StateBranch) 
  65.202 +	{
  65.203 +		state=StateBranchHeading;
  65.204 +		if (!atts.value( "textColor").isEmpty() ) 
  65.205 +		{
  65.206 +			col.setNamedColor(atts.value("textColor"));
  65.207 +			lastBranch->setColor(col ,false );
  65.208 +		}	    
  65.209 +    } else if ( eName == "note" && state == StateBranch) 
  65.210 +	{
  65.211 +        state=StateBranchNote;
  65.212 +		if (!readNoteAttr (atts) ) return false;
  65.213 +	} else if ( eName == "htmlnote" && state == StateBranch) 
  65.214 +	{
  65.215 +		laststate=state;
  65.216 +		state=StateHtmlNote;
  65.217 +		no.clear();
  65.218 +		if (!atts.value( "fonthint").isEmpty() ) 
  65.219 +			no.setFontHint(atts.value ("fonthint") );
  65.220 +    } else if ( eName == "floatimage" && state == StateBranch ) 
  65.221 +	{
  65.222 +		state=StateBranchFloatImage;
  65.223 +        lastBranch->addFloatImage();
  65.224 +		lastFloat=lastBranch->getLastFloatImage();
  65.225 +		if (!readFloatImageAttr(atts)) return false;
  65.226 +    } else if ( eName == "branch" && state == StateBranch ) 
  65.227 +	{
  65.228 +        lastBranch->addBranch();
  65.229 +		lastBranch=lastBranch->getLastBranch();		
  65.230 +        branchDepth++;
  65.231 +		readBranchAttr (atts);
  65.232 +    } else if ( eName == "html" && state == StateHtmlNote ) 
  65.233 +	{
  65.234 +		state=StateHtml;
  65.235 +		htmldata="<"+eName;
  65.236 +		readHtmlAttr(atts);
  65.237 +		htmldata+=">";
  65.238 +    } else if ( state == StateHtml ) 
  65.239 +	{
  65.240 +		// accept all while in html mode,
  65.241 +		htmldata+="<"+eName;
  65.242 +		readHtmlAttr(atts);
  65.243 +		htmldata+=">";
  65.244 +    } else
  65.245 +        return false;   // Error
  65.246 +    return true;
  65.247 +}
  65.248 +
  65.249 +bool mapBuilderHandler::endElement  ( const QString&, const QString&, const QString &eName)
  65.250 +{
  65.251 +//	cout << "endElement </"<<eName<<">  state="<<state <<"  laststate="<<laststate<<endl;
  65.252 +    switch ( state ) 
  65.253 +	{
  65.254 +        case StateMapSelect: state=StateMap;  return true;
  65.255 +        case StateMapSetting: state=StateMap;  return true;
  65.256 +        case StateMapCenter: state=StateMap;  return true;
  65.257 +        case StateMapCenterStandardFlag: state=StateMapCenter;  return true;
  65.258 +        case StateMapCenterHeading: state=StateMapCenter;  return true;
  65.259 +        case StateMapCenterNote: state=StateMapCenter;  return true;
  65.260 +        case StateMapCenterFloatImage: state=StateMapCenter;  return true;
  65.261 +        case StateBranch: 
  65.262 +            if (branchDepth>1) 
  65.263 +			{
  65.264 +                branchDepth--;
  65.265 +                state=StateBranch;
  65.266 +            } else  
  65.267 +			{
  65.268 +                branchDepth=0;
  65.269 +				if (isVymPart)
  65.270 +					state=StateMap;
  65.271 +				else
  65.272 +					state=StateMapCenter;
  65.273 +            }   
  65.274 +			lastBranch=(BranchObj*)(lastBranch->getParObj());
  65.275 +             return true;
  65.276 +        case StateBranchStandardFlag: state=StateBranch;  return true;
  65.277 +        case StateBranchHeading: state=StateBranch;  return true;
  65.278 +        case StateBranchNote: state=StateBranch; return true;
  65.279 +        case StateBranchFloatImage: state=StateBranch;  return true;
  65.280 +        case StateHtmlNote: state=laststate; return true;
  65.281 +        case StateHtml: 
  65.282 +			htmldata+="</"+eName+">";
  65.283 +			if (eName=="html")
  65.284 +			{
  65.285 +				state=StateHtmlNote;  
  65.286 +				htmldata.replace ("<br></br>","<br />");
  65.287 +				no.setNote (htmldata);
  65.288 +				lastBranch->setNote (no);
  65.289 +				return true;
  65.290 +			}	else
  65.291 +			{
  65.292 +				return true;
  65.293 +			}	
  65.294 +        case StateMap: state=StateInit;  return true;
  65.295 +        default : 
  65.296 +			// even for HTML includes, this should never be reached
  65.297 +			return false;
  65.298 +    }   
  65.299 +}
  65.300 +
  65.301 +bool mapBuilderHandler::characters   ( const QString& ch)
  65.302 +{
  65.303 +	//cout << "characters \""<<ch<<"\"  state="<<state <<"  laststate="<<laststate<<endl;
  65.304 +
  65.305 +	QString ch_org=quotemeta (ch);
  65.306 +    QString ch_simplified=ch.simplifyWhiteSpace();
  65.307 +    if ( ch_simplified.isEmpty() ) return true;
  65.308 +
  65.309 +    switch ( state ) 
  65.310 +    {
  65.311 +        case StateInit: break;
  65.312 +        case StateMap: break; 
  65.313 +		case StateMapSelect:
  65.314 +			me->select(ch_simplified);
  65.315 +			break;
  65.316 +		case StateMapSetting:break;
  65.317 +        case StateMapCenter: break;
  65.318 +        case StateMapCenterStandardFlag: 
  65.319 +            lastBranch->activateStandardFlag(ch_simplified); 
  65.320 +            break;
  65.321 +        case StateMapCenterHeading: 
  65.322 +            lastBranch->setHeading(ch_simplified); 
  65.323 +            break;
  65.324 +        case StateMapCenterNote:
  65.325 +			lastBranch->setNote(ch_simplified);
  65.326 +			break;
  65.327 +        case StateBranch: break;
  65.328 +        case StateBranchStandardFlag: 
  65.329 +            lastBranch->activateStandardFlag(ch_simplified); 
  65.330 +            break;
  65.331 +        case StateBranchHeading: 
  65.332 +            lastBranch->setHeading(ch_simplified);
  65.333 +            break;
  65.334 +        case StateBranchNote: 
  65.335 +			lastBranch->setNote(ch_simplified);
  65.336 +			break;
  65.337 +        case StateBranchFloatImage: break;
  65.338 +        case StateHtmlNote: break;
  65.339 +        case StateHtml:
  65.340 +			htmldata+=ch_org;
  65.341 +			break;
  65.342 +        default: 
  65.343 +			return false;
  65.344 +    }
  65.345 +    return true;
  65.346 +}
  65.347 +
  65.348 +QString mapBuilderHandler::errorString() 
  65.349 +{
  65.350 +    return "the document is not in the VYM file format";
  65.351 +}
  65.352 +
  65.353 +bool mapBuilderHandler::fatalError( const QXmlParseException& exception ) 
  65.354 +{
  65.355 +    errorProt += QString( "fatal parsing error: %1 in line %2, column %3\n")
  65.356 +    .arg( exception.message() )
  65.357 +    .arg( exception.lineNumber() )
  65.358 +    .arg( exception.columnNumber() );
  65.359 +
  65.360 +    return QXmlDefaultHandler::fatalError( exception );
  65.361 +}
  65.362 +
  65.363 +void mapBuilderHandler::setMapEditor (MapEditor* e)
  65.364 +{
  65.365 +    me=e;
  65.366 +	mc=me->getMapCenter();
  65.367 +}
  65.368 +
  65.369 +void mapBuilderHandler::setTmpDir (QString tp)
  65.370 +{
  65.371 +	tmpDir=tp;
  65.372 +}
  65.373 +
  65.374 +void mapBuilderHandler::setLoadMode (const LoadMode &lm)
  65.375 +{
  65.376 +	loadMode=lm;
  65.377 +}
  65.378 +
  65.379 +bool mapBuilderHandler::readBranchAttr (const QXmlAttributes& a)
  65.380 +{
  65.381 +	bool okx,oky;
  65.382 +	int x,y;
  65.383 +	if (!a.value( "absPosX").isEmpty() && loadMode==NewMap && branchDepth<2) 
  65.384 +	{
  65.385 +		if (!a.value( "absPosY").isEmpty() ) 
  65.386 +		{
  65.387 +			x=a.value("absPosX").toInt (&okx, 10);
  65.388 +			y=a.value("absPosY").toInt (&oky, 10);
  65.389 +			if (okx && oky) 
  65.390 +				lastBranch->move(x,y);
  65.391 +			else
  65.392 +				return false;   // Couldn't read absPos
  65.393 +		}           
  65.394 +	}           
  65.395 +	if (!a.value( "scrolled").isEmpty() )
  65.396 +		lastBranch->toggleScroll();
  65.397 +	if (!a.value( "url").isEmpty() ) 
  65.398 +		lastBranch->setURL (a.value ("url"));
  65.399 +	if (!a.value( "vymLink").isEmpty() ) 
  65.400 +		lastBranch->setVymLink (a.value ("vymLink"));
  65.401 +	if (!a.value( "frameType").isEmpty() ) 
  65.402 +		lastBranch->setFrameType (a.value("frameType"));
  65.403 +	return true;	
  65.404 +}
  65.405 +
  65.406 +bool mapBuilderHandler::readNoteAttr (const QXmlAttributes& a)
  65.407 +{	// only for backward compatibility (<1.4.6). Use htmlnote now.
  65.408 +	no.clear();
  65.409 +	QString fn;
  65.410 +	if (!a.value( "href").isEmpty() ) 
  65.411 +	{
  65.412 +		// Load note
  65.413 +		fn=parseHREF(a.value ("href") );
  65.414 +		QFile file (fn);
  65.415 +		QString s;						// Reading a note
  65.416 +
  65.417 +		if ( !file.open( IO_ReadOnly) )
  65.418 +		{
  65.419 +			qWarning ("mapBuilderHandler::readNoteAttr:  Couldn't load "+fn);
  65.420 +			return false;
  65.421 +		}	
  65.422 +		QTextStream stream( &file );
  65.423 +		QString lines;
  65.424 +		while ( !stream.eof() ) {
  65.425 +			lines += stream.readLine()+"\n"; 
  65.426 +		}
  65.427 +		file.close();
  65.428 +		// Convert to richtext
  65.429 +		if ( !QStyleSheet::mightBeRichText( lines ) )
  65.430 +		{
  65.431 +			// Here we are workarounding the QT conversion method:
  65.432 +			// convertFromPlainText does not generate valid xml, needed
  65.433 +			// for the parser, but just <p> and <br> without closing tags.
  65.434 +			// So we have to add those by ourselves
  65.435 +			//lines=quotemeta (lines);
  65.436 +			lines = QStyleSheet::convertFromPlainText( lines, QStyleSheetItem::WhiteSpaceNormal );
  65.437 +			lines.replace ("<br>","<br />");
  65.438 +		}	
  65.439 +
  65.440 +		lines ="<html><head><meta name=\"qrichtext\" content=\"1\" /></head><body>"+lines + "</p></body></html>";
  65.441 +		no.setNote (lines);
  65.442 +	}		
  65.443 +	if (!a.value( "fonthint").isEmpty() ) 
  65.444 +		no.setFontHint(a.value ("fonthint") );
  65.445 +	if (state == StateMapCenterNote) 	
  65.446 +		mc->setNote(no);
  65.447 +	else
  65.448 +		lastBranch->setNote(no);
  65.449 +	return true;
  65.450 +}
  65.451 +
  65.452 +bool mapBuilderHandler::readFloatImageAttr (const QXmlAttributes& a)
  65.453 +{
  65.454 +	if (!a.value( "useOrientation").isEmpty() ) 
  65.455 +	{
  65.456 +		if (a.value ("useOrientation") =="true")
  65.457 +			lastFloat->setUseOrientation (true);
  65.458 +		else	
  65.459 +			lastFloat->setUseOrientation (false);
  65.460 +	}	
  65.461 +	if (!a.value( "href").isEmpty() )
  65.462 +	{
  65.463 +		// Load FloatImage
  65.464 +		if (!lastFloat->load (parseHREF(a.value ("href") ) ))
  65.465 +		{
  65.466 +			QMessageBox::warning( 0, "Warning: " ,
  65.467 +				"Couldn't load float image\n"+parseHREF(a.value ("href") ));
  65.468 +			lastBranch->removeFloatImage(((FloatImageObj*)(lastFloat)));
  65.469 +			lastFloat=NULL;
  65.470 +			return true;
  65.471 +		}
  65.472 +		
  65.473 +	}	
  65.474 +	if (!a.value( "floatExport").isEmpty() ) 
  65.475 +	{
  65.476 +		if (a.value ("floatExpofrt") =="true")
  65.477 +			lastFloat->setFloatExport (true);
  65.478 +		else	
  65.479 +			lastFloat->setFloatExport (false);
  65.480 +	}	
  65.481 +	if (!a.value( "zPlane").isEmpty() ) 
  65.482 +		lastFloat->setZ (a.value("zPlane").toInt ());
  65.483 +    int x,y;
  65.484 +    bool okx,oky;
  65.485 +	if (!a.value( "relPosX").isEmpty() ) 
  65.486 +	{
  65.487 +		if (!a.value( "relPosY").isEmpty() ) 
  65.488 +		{
  65.489 +			// read relPos
  65.490 +			x=a.value("relPosX").toInt (&okx, 10);
  65.491 +			y=a.value("relPosY").toInt (&oky, 10);
  65.492 +			if (okx && oky) 
  65.493 +				lastFloat->setRelPos (QPoint (x,y) );
  65.494 +			else
  65.495 +				// Couldn't read relPos
  65.496 +				return false;  
  65.497 +		}           
  65.498 +	}	
  65.499 +	return true;
  65.500 +}
  65.501 +
  65.502 +bool mapBuilderHandler::readHtmlAttr (const QXmlAttributes& a)
  65.503 +{
  65.504 +	for (int i=1; i<=a.count(); i++)
  65.505 +		htmldata+=" "+a.localName(i-1)+"=\""+a.value(i-1)+"\"";
  65.506 +	return true;
  65.507 +}
  65.508 +
  65.509 +bool mapBuilderHandler::readSettingAttr (const QXmlAttributes& a)
  65.510 +{
  65.511 +	if (!a.value( "key").isEmpty() ) 
  65.512 +	{
  65.513 +		if (!a.value( "value").isEmpty() ) 
  65.514 +			settings.setLocalEntry (me->getDestPath(), a.value ("key"), a.value ("value"));
  65.515 +		else
  65.516 +			return false;
  65.517 +		
  65.518 +	} else
  65.519 +		return false;
  65.520 +	
  65.521 +	return true;
  65.522 +}
    66.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    66.2 +++ b/xml.h	Sun Jan 30 12:58:47 2005 +0000
    66.3 @@ -0,0 +1,62 @@
    66.4 +#ifndef XLM_H
    66.5 +#define XLM_H
    66.6 +
    66.7 +
    66.8 +#include <qstring.h>
    66.9 +#include <qxml.h>
   66.10 +
   66.11 +#include "mapcenterobj.h"
   66.12 +#include "mapeditor.h"
   66.13 +
   66.14 +
   66.15 +class mapBuilderHandler  : public QXmlDefaultHandler
   66.16 +{
   66.17 +public:
   66.18 +	mapBuilderHandler();
   66.19 +	~mapBuilderHandler();
   66.20 +	QString errorProtocol();
   66.21 +	bool startDocument();
   66.22 +	QString mapBuilderHandler::parseHREF(QString);
   66.23 +	bool startElement ( const QString&, const QString&,
   66.24 +                        const QString& eName, const QXmlAttributes& atts ); 
   66.25 +	bool   endElement ( const QString&, const QString&, const QString& ); 
   66.26 +	bool characters   ( const QString&);
   66.27 +	QString errorString();
   66.28 +	bool fatalError( const QXmlParseException&);
   66.29 +	void setMapEditor (MapEditor*);
   66.30 +	void setTmpDir (QString);
   66.31 +	void setLoadMode (const LoadMode &);
   66.32 +	bool readBranchAttr (const QXmlAttributes&);
   66.33 +	bool readNoteAttr (const QXmlAttributes&);
   66.34 +	bool readFloatImageAttr (const QXmlAttributes&);
   66.35 +	bool readHtmlAttr (const QXmlAttributes&);
   66.36 +	bool readSettingAttr (const QXmlAttributes&);
   66.37 +
   66.38 +private:
   66.39 +	QString     errorProt;
   66.40 +	enum State 
   66.41 +	{ 
   66.42 +		StateInit, StateMap, StateMapSelect, 
   66.43 +		StateMapSetting,
   66.44 +		StateMapCenter, StateMapCenterStandardFlag,
   66.45 +		StateMapCenterHeading, StateMapCenterNote, 
   66.46 +		StateMapCenterFloatImage,
   66.47 +		
   66.48 +		StateBranch, StateBranchStandardFlag,
   66.49 +		StateBranchHeading, StateBranchNote, 
   66.50 +		StateBranchFloatImage, 
   66.51 +		StateHtmlNote, StateHtml 
   66.52 +	 };
   66.53 +				 
   66.54 +
   66.55 +	LoadMode loadMode;
   66.56 +	bool isVymPart;
   66.57 +	State state;			 
   66.58 +	State laststate;
   66.59 +	QString htmldata;
   66.60 +	int branchDepth; 
   66.61 +	NoteObj no;
   66.62 +	MapCenterObj* mc;
   66.63 +	MapEditor* me; QString tmpDir; 
   66.64 +}; 
   66.65 +#endif