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;