SVN revision 3500 made compilable with Lemon 1.0.
authorPeter Hegyi <hegyi@tmit.bme.hu>
Mon, 07 Jul 2008 08:10:39 -0500
changeset 167188bd752db
parent 0 0e4f009eab8b
child 2 fdb8a163000f
SVN revision 3500 made compilable with Lemon 1.0.
.hgignore
AUTHORS
COPYING
Doxyfile
LICENSE
Makefile.am
NEWS
README
algobox.cc
algobox.h
algowin.cc
algowin.h
all_include.h
autopackage/default.apspec.in
background_chooser_dialog.cc
background_chooser_dialog.h
bootstrap
color.lgf
configure.ac
design_win.cc
design_win.h
dijkstrabox.cc
dijkstrabox.h
eps_win.cc
eps_win.h
file_import_dialog.cc
file_import_dialog.h
gdc-broken_edge.cc
gettext.h
glemon.spec.in
graph-displayer.cc
graph_displayer_canvas-edge.cc
graph_displayer_canvas-event.cc
graph_displayer_canvas-node.cc
graph_displayer_canvas-zoom.cc
graph_displayer_canvas.cc
graph_displayer_canvas.h
graphocska.lgf
gui_reader.cc
gui_reader.h
gui_writer.cc
gui_writer.h
i18n.h
icons/addlink.png
icons/addnode.png
icons/delete.png
icons/editlink.png
icons/editnode.png
icons/eps.png
icons/move.png
icons/newmap.png
io_helper.cc
io_helper.h
kruskalbox.cc
kruskalbox.h
m4/Makefile.am
main_win.cc
main_win.h
map_value.cc
map_value.h
map_value_map.cc
map_value_map.h
map_win.cc
map_win.h
mapselector.cc
mapselector.h
mapstorage.cc
mapstorage.h
nbtab.cc
nbtab.h
new_map_win.cc
new_map_win.h
po/LINGUAS
po/Makevars
po/POTFILES.in
po/glemon.pot
po/hu.po
save_details_dialog.cc
save_details_dialog.h
save_details_widget.cc
save_details_widget.h
xml.h
xymap.h
     1.1 --- a/.hgignore	Mon Jun 23 11:48:43 2008 +0100
     1.2 +++ b/.hgignore	Mon Jul 07 08:10:39 2008 -0500
     1.3 @@ -26,6 +26,24 @@
     1.4  .libs/*
     1.5  .deps/*
     1.6  demo/*.eps
     1.7 +m4/*.m4
     1.8 +ABOUT-NLS
     1.9 +autopackage/default.apspec
    1.10 +glemon
    1.11 +glemon.spec
    1.12 +guipixbufs.h
    1.13 +po/boldquot.sed
    1.14 +po/en@boldquot.header
    1.15 +po/en@quot.header
    1.16 +po/hu.gmo
    1.17 +po/insert-header.sin
    1.18 +po/Makefile.in.in
    1.19 +po/Makevars.template
    1.20 +po/POTFILES
    1.21 +po/quot.sed
    1.22 +po/remove-potcdate.sin
    1.23 +po/Rules-quot
    1.24 +po/stamp-po
    1.25  
    1.26  syntax: regexp
    1.27  (.*/)?\#[^/]*\#$
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/AUTHORS	Mon Jul 07 08:10:39 2008 -0500
     2.3 @@ -0,0 +1,1 @@
     2.4 +To be filled
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/COPYING	Mon Jul 07 08:10:39 2008 -0500
     3.3 @@ -0,0 +1,1 @@
     3.4 +To be filled
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/Doxyfile	Mon Jul 07 08:10:39 2008 -0500
     4.3 @@ -0,0 +1,273 @@
     4.4 +# Doxyfile 1.4.5
     4.5 +
     4.6 +#---------------------------------------------------------------------------
     4.7 +# Project related configuration options
     4.8 +#---------------------------------------------------------------------------
     4.9 +PROJECT_NAME           = glemon
    4.10 +PROJECT_NUMBER         = 0.1
    4.11 +OUTPUT_DIRECTORY       = 
    4.12 +CREATE_SUBDIRS         = NO
    4.13 +OUTPUT_LANGUAGE        = English
    4.14 +USE_WINDOWS_ENCODING   = NO
    4.15 +BRIEF_MEMBER_DESC      = YES
    4.16 +REPEAT_BRIEF           = YES
    4.17 +ABBREVIATE_BRIEF       = "The $name class" \
    4.18 +                         "The $name widget" \
    4.19 +                         "The $name file" \
    4.20 +                         is \
    4.21 +                         provides \
    4.22 +                         specifies \
    4.23 +                         contains \
    4.24 +                         represents \
    4.25 +                         a \
    4.26 +                         an \
    4.27 +                         the
    4.28 +ALWAYS_DETAILED_SEC    = NO
    4.29 +INLINE_INHERITED_MEMB  = NO
    4.30 +FULL_PATH_NAMES        = YES
    4.31 +STRIP_FROM_PATH        = .
    4.32 +STRIP_FROM_INC_PATH    = 
    4.33 +SHORT_NAMES            = NO
    4.34 +JAVADOC_AUTOBRIEF      = NO
    4.35 +MULTILINE_CPP_IS_BRIEF = NO
    4.36 +DETAILS_AT_TOP         = NO
    4.37 +INHERIT_DOCS           = YES
    4.38 +SEPARATE_MEMBER_PAGES  = NO
    4.39 +TAB_SIZE               = 8
    4.40 +ALIASES                = 
    4.41 +OPTIMIZE_OUTPUT_FOR_C  = NO
    4.42 +OPTIMIZE_OUTPUT_JAVA   = NO
    4.43 +BUILTIN_STL_SUPPORT    = NO
    4.44 +DISTRIBUTE_GROUP_DOC   = NO
    4.45 +SUBGROUPING            = YES
    4.46 +#---------------------------------------------------------------------------
    4.47 +# Build related configuration options
    4.48 +#---------------------------------------------------------------------------
    4.49 +EXTRACT_ALL            = YES
    4.50 +EXTRACT_PRIVATE        = YES
    4.51 +EXTRACT_STATIC         = YES
    4.52 +EXTRACT_LOCAL_CLASSES  = YES
    4.53 +EXTRACT_LOCAL_METHODS  = NO
    4.54 +HIDE_UNDOC_MEMBERS     = NO
    4.55 +HIDE_UNDOC_CLASSES     = NO
    4.56 +HIDE_FRIEND_COMPOUNDS  = NO
    4.57 +HIDE_IN_BODY_DOCS      = NO
    4.58 +INTERNAL_DOCS          = NO
    4.59 +CASE_SENSE_NAMES       = YES
    4.60 +HIDE_SCOPE_NAMES       = NO
    4.61 +SHOW_INCLUDE_FILES     = YES
    4.62 +INLINE_INFO            = YES
    4.63 +SORT_MEMBER_DOCS       = YES
    4.64 +SORT_BRIEF_DOCS        = NO
    4.65 +SORT_BY_SCOPE_NAME     = NO
    4.66 +GENERATE_TODOLIST      = YES
    4.67 +GENERATE_TESTLIST      = YES
    4.68 +GENERATE_BUGLIST       = YES
    4.69 +GENERATE_DEPRECATEDLIST= YES
    4.70 +ENABLED_SECTIONS       = 
    4.71 +MAX_INITIALIZER_LINES  = 30
    4.72 +SHOW_USED_FILES        = YES
    4.73 +SHOW_DIRECTORIES       = YES
    4.74 +FILE_VERSION_FILTER    = 
    4.75 +#---------------------------------------------------------------------------
    4.76 +# configuration options related to warning and progress messages
    4.77 +#---------------------------------------------------------------------------
    4.78 +QUIET                  = NO
    4.79 +WARNINGS               = YES
    4.80 +WARN_IF_UNDOCUMENTED   = YES
    4.81 +WARN_IF_DOC_ERROR      = YES
    4.82 +WARN_NO_PARAMDOC       = NO
    4.83 +WARN_FORMAT            = "$file:$line: $text"
    4.84 +WARN_LOGFILE           = 
    4.85 +#---------------------------------------------------------------------------
    4.86 +# configuration options related to the input files
    4.87 +#---------------------------------------------------------------------------
    4.88 +INPUT                  = .
    4.89 +FILE_PATTERNS          = *.c \
    4.90 +                         *.cc \
    4.91 +                         *.cxx \
    4.92 +                         *.cpp \
    4.93 +                         *.c++ \
    4.94 +                         *.d \
    4.95 +                         *.java \
    4.96 +                         *.ii \
    4.97 +                         *.ixx \
    4.98 +                         *.ipp \
    4.99 +                         *.i++ \
   4.100 +                         *.inl \
   4.101 +                         *.h \
   4.102 +                         *.hh \
   4.103 +                         *.hxx \
   4.104 +                         *.hpp \
   4.105 +                         *.h++ \
   4.106 +                         *.idl \
   4.107 +                         *.odl \
   4.108 +                         *.cs \
   4.109 +                         *.php \
   4.110 +                         *.php3 \
   4.111 +                         *.inc \
   4.112 +                         *.m \
   4.113 +                         *.mm \
   4.114 +                         *.dox \
   4.115 +                         *.py \
   4.116 +                         *.C \
   4.117 +                         *.CC \
   4.118 +                         *.C++ \
   4.119 +                         *.II \
   4.120 +                         *.I++ \
   4.121 +                         *.H \
   4.122 +                         *.HH \
   4.123 +                         *.H++ \
   4.124 +                         *.CS \
   4.125 +                         *.PHP \
   4.126 +                         *.PHP3 \
   4.127 +                         *.M \
   4.128 +                         *.MM \
   4.129 +                         *.PY
   4.130 +RECURSIVE              = NO
   4.131 +EXCLUDE                = 
   4.132 +EXCLUDE_SYMLINKS       = NO
   4.133 +EXCLUDE_PATTERNS       = 
   4.134 +EXAMPLE_PATH           = 
   4.135 +EXAMPLE_PATTERNS       = *
   4.136 +EXAMPLE_RECURSIVE      = NO
   4.137 +IMAGE_PATH             = 
   4.138 +INPUT_FILTER           = 
   4.139 +FILTER_PATTERNS        = 
   4.140 +FILTER_SOURCE_FILES    = NO
   4.141 +#---------------------------------------------------------------------------
   4.142 +# configuration options related to source browsing
   4.143 +#---------------------------------------------------------------------------
   4.144 +SOURCE_BROWSER         = YES
   4.145 +INLINE_SOURCES         = NO
   4.146 +STRIP_CODE_COMMENTS    = YES
   4.147 +REFERENCED_BY_RELATION = YES
   4.148 +REFERENCES_RELATION    = YES
   4.149 +USE_HTAGS              = NO
   4.150 +VERBATIM_HEADERS       = YES
   4.151 +#---------------------------------------------------------------------------
   4.152 +# configuration options related to the alphabetical class index
   4.153 +#---------------------------------------------------------------------------
   4.154 +ALPHABETICAL_INDEX     = NO
   4.155 +COLS_IN_ALPHA_INDEX    = 5
   4.156 +IGNORE_PREFIX          = 
   4.157 +#---------------------------------------------------------------------------
   4.158 +# configuration options related to the HTML output
   4.159 +#---------------------------------------------------------------------------
   4.160 +GENERATE_HTML          = YES
   4.161 +HTML_OUTPUT            = html
   4.162 +HTML_FILE_EXTENSION    = .html
   4.163 +HTML_HEADER            = 
   4.164 +HTML_FOOTER            = 
   4.165 +HTML_STYLESHEET        = 
   4.166 +HTML_ALIGN_MEMBERS     = YES
   4.167 +GENERATE_HTMLHELP      = NO
   4.168 +CHM_FILE               = 
   4.169 +HHC_LOCATION           = 
   4.170 +GENERATE_CHI           = NO
   4.171 +BINARY_TOC             = NO
   4.172 +TOC_EXPAND             = NO
   4.173 +DISABLE_INDEX          = NO
   4.174 +ENUM_VALUES_PER_LINE   = 4
   4.175 +GENERATE_TREEVIEW      = NO
   4.176 +TREEVIEW_WIDTH         = 250
   4.177 +#---------------------------------------------------------------------------
   4.178 +# configuration options related to the LaTeX output
   4.179 +#---------------------------------------------------------------------------
   4.180 +GENERATE_LATEX         = NO
   4.181 +LATEX_OUTPUT           = latex
   4.182 +LATEX_CMD_NAME         = latex
   4.183 +MAKEINDEX_CMD_NAME     = makeindex
   4.184 +COMPACT_LATEX          = NO
   4.185 +PAPER_TYPE             = a4wide
   4.186 +EXTRA_PACKAGES         = 
   4.187 +LATEX_HEADER           = 
   4.188 +PDF_HYPERLINKS         = NO
   4.189 +USE_PDFLATEX           = NO
   4.190 +LATEX_BATCHMODE        = NO
   4.191 +LATEX_HIDE_INDICES     = NO
   4.192 +#---------------------------------------------------------------------------
   4.193 +# configuration options related to the RTF output
   4.194 +#---------------------------------------------------------------------------
   4.195 +GENERATE_RTF           = NO
   4.196 +RTF_OUTPUT             = rtf
   4.197 +COMPACT_RTF            = NO
   4.198 +RTF_HYPERLINKS         = NO
   4.199 +RTF_STYLESHEET_FILE    = 
   4.200 +RTF_EXTENSIONS_FILE    = 
   4.201 +#---------------------------------------------------------------------------
   4.202 +# configuration options related to the man page output
   4.203 +#---------------------------------------------------------------------------
   4.204 +GENERATE_MAN           = NO
   4.205 +MAN_OUTPUT             = man
   4.206 +MAN_EXTENSION          = .3
   4.207 +MAN_LINKS              = NO
   4.208 +#---------------------------------------------------------------------------
   4.209 +# configuration options related to the XML output
   4.210 +#---------------------------------------------------------------------------
   4.211 +GENERATE_XML           = NO
   4.212 +XML_OUTPUT             = xml
   4.213 +XML_SCHEMA             = 
   4.214 +XML_DTD                = 
   4.215 +XML_PROGRAMLISTING     = YES
   4.216 +#---------------------------------------------------------------------------
   4.217 +# configuration options for the AutoGen Definitions output
   4.218 +#---------------------------------------------------------------------------
   4.219 +GENERATE_AUTOGEN_DEF   = NO
   4.220 +#---------------------------------------------------------------------------
   4.221 +# configuration options related to the Perl module output
   4.222 +#---------------------------------------------------------------------------
   4.223 +GENERATE_PERLMOD       = NO
   4.224 +PERLMOD_LATEX          = NO
   4.225 +PERLMOD_PRETTY         = YES
   4.226 +PERLMOD_MAKEVAR_PREFIX = 
   4.227 +#---------------------------------------------------------------------------
   4.228 +# Configuration options related to the preprocessor   
   4.229 +#---------------------------------------------------------------------------
   4.230 +ENABLE_PREPROCESSING   = YES
   4.231 +MACRO_EXPANSION        = NO
   4.232 +EXPAND_ONLY_PREDEF     = NO
   4.233 +SEARCH_INCLUDES        = YES
   4.234 +INCLUDE_PATH           = 
   4.235 +INCLUDE_FILE_PATTERNS  = 
   4.236 +PREDEFINED             = 
   4.237 +EXPAND_AS_DEFINED      = 
   4.238 +SKIP_FUNCTION_MACROS   = YES
   4.239 +#---------------------------------------------------------------------------
   4.240 +# Configuration::additions related to external references   
   4.241 +#---------------------------------------------------------------------------
   4.242 +TAGFILES               = 
   4.243 +GENERATE_TAGFILE       = 
   4.244 +ALLEXTERNALS           = NO
   4.245 +EXTERNAL_GROUPS        = YES
   4.246 +PERL_PATH              = /usr/bin/perl
   4.247 +#---------------------------------------------------------------------------
   4.248 +# Configuration options related to the dot tool   
   4.249 +#---------------------------------------------------------------------------
   4.250 +CLASS_DIAGRAMS         = NO
   4.251 +HIDE_UNDOC_RELATIONS   = YES
   4.252 +HAVE_DOT               = YES
   4.253 +CLASS_GRAPH            = YES
   4.254 +COLLABORATION_GRAPH    = YES
   4.255 +GROUP_GRAPHS           = YES
   4.256 +UML_LOOK               = NO
   4.257 +TEMPLATE_RELATIONS     = NO
   4.258 +INCLUDE_GRAPH          = YES
   4.259 +INCLUDED_BY_GRAPH      = YES
   4.260 +CALL_GRAPH             = YES
   4.261 +GRAPHICAL_HIERARCHY    = YES
   4.262 +DIRECTORY_GRAPH        = YES
   4.263 +DOT_IMAGE_FORMAT       = png
   4.264 +DOT_PATH               = 
   4.265 +DOTFILE_DIRS           = 
   4.266 +MAX_DOT_GRAPH_WIDTH    = 1024
   4.267 +MAX_DOT_GRAPH_HEIGHT   = 1024
   4.268 +MAX_DOT_GRAPH_DEPTH    = 1000
   4.269 +DOT_TRANSPARENT        = NO
   4.270 +DOT_MULTI_TARGETS      = NO
   4.271 +GENERATE_LEGEND        = YES
   4.272 +DOT_CLEANUP            = YES
   4.273 +#---------------------------------------------------------------------------
   4.274 +# Configuration::additions related to the search engine   
   4.275 +#---------------------------------------------------------------------------
   4.276 +SEARCHENGINE           = NO
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/LICENSE	Mon Jul 07 08:10:39 2008 -0500
     5.3 @@ -0,0 +1,33 @@
     5.4 +gLEMON code without an explicit copyright is covered by the following
     5.5 +copyright/license:
     5.6 +
     5.7 +Copyright (C) 2003-2006 Egervary Jeno Kombinatorikus Optimalizalasi
     5.8 +Kutatocsoport (Egervary Combinatorial Optimization Research Group,
     5.9 +EGRES).
    5.10 +
    5.11 +Permission is hereby granted, free of charge, to any person or organization
    5.12 +obtaining a copy of the software and accompanying documentation covered by
    5.13 +this license (the "Software") to use, reproduce, display, distribute,
    5.14 +execute, and transmit the Software, and to prepare derivative works of the
    5.15 +Software, and to permit third-parties to whom the Software is furnished to
    5.16 +do so, all subject to the following:
    5.17 +
    5.18 +The copyright notices in the Software and this entire statement, including
    5.19 +the above license grant, this restriction and the following disclaimer,
    5.20 +must be included in all copies of the Software, in whole or in part, and
    5.21 +all derivative works of the Software, unless such copies or derivative
    5.22 +works are solely in the form of machine-executable object code generated by
    5.23 +a source language processor.
    5.24 +
    5.25 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    5.26 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    5.27 +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
    5.28 +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
    5.29 +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
    5.30 +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    5.31 +DEALINGS IN THE SOFTWARE.
    5.32 +
    5.33 +===========================================================================
    5.34 +This license is a verbatim copy of the Boost Software License, Version 1.0.
    5.35 +
    5.36 +
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/Makefile.am	Mon Jul 07 08:10:39 2008 -0500
     6.3 @@ -0,0 +1,167 @@
     6.4 +AM_CPPFLAGS = -I$(top_srcdir) -DLOCALEDIR=\""$(datadir)/locale"\"
     6.5 +
     6.6 +SUBDIRS = po m4
     6.7 +
     6.8 +bin_PROGRAMS = glemon
     6.9 +BUILT_SOURCES = guipixbufs.h
    6.10 +CLEANFILES = guipixbufs.h
    6.11 +
    6.12 +glemon_SOURCES = \
    6.13 +	all_include.h \
    6.14 +	algobox.cc \
    6.15 +	algobox.h \
    6.16 +	algowin.cc \
    6.17 +	algowin.h \
    6.18 +	gdc-broken_edge.cc \
    6.19 +	graph_displayer_canvas.cc \
    6.20 +	graph_displayer_canvas.h \
    6.21 +	graph_displayer_canvas-edge.cc \
    6.22 +	graph_displayer_canvas-event.cc \
    6.23 +	graph_displayer_canvas-node.cc \
    6.24 +	graph_displayer_canvas-zoom.cc \
    6.25 +	graph-displayer.cc \
    6.26 +	kruskalbox.cc \
    6.27 +	kruskalbox.h \
    6.28 +	main_win.cc \
    6.29 +	main_win.h \
    6.30 +	mapstorage.cc \
    6.31 +	mapstorage.h \
    6.32 +	map_win.cc \
    6.33 +	map_win.h \
    6.34 +	mapselector.cc \
    6.35 +	mapselector.h \
    6.36 +	nbtab.h \
    6.37 +	nbtab.cc \
    6.38 +	new_map_win.cc \
    6.39 +	new_map_win.h \
    6.40 +	xymap.h \
    6.41 +	gui_reader.h \
    6.42 +	gui_reader.cc \
    6.43 +	gui_writer.h \
    6.44 +	gui_writer.cc \
    6.45 +	xml.h \
    6.46 +	guipixbufs.h \
    6.47 +	i18n.h \
    6.48 +	gettext.h \
    6.49 +	design_win.h \
    6.50 +	design_win.cc \
    6.51 +	dijkstrabox.h \
    6.52 +	dijkstrabox.cc \
    6.53 +	file_import_dialog.h \
    6.54 +	file_import_dialog.cc \
    6.55 +	map_value.h \
    6.56 +	map_value.cc \
    6.57 +	map_value_map.h \
    6.58 +	map_value_map.cc \
    6.59 +	save_details_widget.h \
    6.60 +	save_details_widget.cc \
    6.61 +	save_details_dialog.h \
    6.62 +	save_details_dialog.cc \
    6.63 +	io_helper.h \
    6.64 +	io_helper.cc \
    6.65 +	background_chooser_dialog.h \
    6.66 +	background_chooser_dialog.cc \
    6.67 +	eps_win.h \
    6.68 +	eps_win.cc
    6.69 +
    6.70 +glemon_CXXFLAGS = $(GTK_CFLAGS) $(LEMON_CFLAGS)
    6.71 +# glemon_LDFLAGS = $(GTK_LIBS) $(LEMON_LIBS)
    6.72 +glemon_LDADD = $(GTK_LIBS) $(LEMON_LIBS) $(LIBINTL)
    6.73 +
    6.74 +IMAGES = \
    6.75 +	icons/addlink.png \
    6.76 +	icons/addnode.png \
    6.77 +	icons/delete.png \
    6.78 +	icons/editlink.png \
    6.79 +	icons/editnode.png \
    6.80 +	icons/move.png \
    6.81 +	icons/newmap.png \
    6.82 +	icons/eps.png
    6.83 +
    6.84 +VARIABLES = \
    6.85 +	gui_icons_addlink $(srcdir)/icons/addlink.png \
    6.86 +	gui_icons_addnode $(srcdir)/icons/addnode.png \
    6.87 +	gui_icons_delete $(srcdir)/icons/delete.png \
    6.88 +	gui_icons_editlink $(srcdir)/icons/editlink.png \
    6.89 +	gui_icons_editnode $(srcdir)/icons/editnode.png \
    6.90 +	gui_icons_move $(srcdir)/icons/move.png \
    6.91 +	gui_icons_newmap $(srcdir)/icons/newmap.png \
    6.92 +	gui_icons_eps $(srcdir)/icons/eps.png
    6.93 +	
    6.94 +guipixbufs.h: $(IMAGES)
    6.95 +	gdk-pixbuf-csource \
    6.96 +	--raw --build-list $(VARIABLES) > guipixbufs.h ||  \
    6.97 +	( rm -f guipixbufs.h && false )
    6.98 +
    6.99 +EXTRA_DIST = \
   6.100 +	$(IMAGES) \
   6.101 +	guipixbufs.h \
   6.102 +	glemon.spec \
   6.103 +	AUTHORS \
   6.104 +	COPYING \
   6.105 +	LICENSE \
   6.106 +	NEWS \
   6.107 +	README \
   6.108 +	ABOUT-NLS
   6.109 +
   6.110 +MRPROPERFILES = \
   6.111 +	Makefile.in \
   6.112 +	configure \
   6.113 +	config.h.in \
   6.114 +	aclocal.m4 \
   6.115 +	ABOUT-NLS \
   6.116 +	m4/Makefile.in \
   6.117 +	m4/lib-link.m4 \
   6.118 +	m4/printf-posix.m4 \
   6.119 +	m4/uintmax_t.m4 \
   6.120 +	m4/signed.m4 \
   6.121 +	m4/iconv.m4 \
   6.122 +	m4/inttypes.m4 \
   6.123 +	m4/longlong.m4 \
   6.124 +	m4/glibc21.m4 \
   6.125 +	m4/inttypes_h.m4 \
   6.126 +	m4/codeset.m4 \
   6.127 +	m4/longdouble.m4 \
   6.128 +	m4/nls.m4 \
   6.129 +	m4/intmax.m4 \
   6.130 +	m4/lib-prefix.m4 \
   6.131 +	m4/glibc2.m4 \
   6.132 +	m4/xsize.m4 \
   6.133 +	m4/lcmessage.m4 \
   6.134 +	m4/lib-ld.m4 \
   6.135 +	m4/ulonglong.m4 \
   6.136 +	m4/wint_t.m4 \
   6.137 +	m4/progtest.m4 \
   6.138 +	m4/inttypes-pri.m4 \
   6.139 +	m4/stdint_h.m4 \
   6.140 +	m4/intdiv0.m4 \
   6.141 +	m4/isc-posix.m4 \
   6.142 +	m4/po.m4 \
   6.143 +	m4/size_max.m4 \
   6.144 +	m4/gettext.m4 \
   6.145 +	m4/wchar_t.m4 \
   6.146 +	po/Rules-quot \
   6.147 +	po/en@quot.header \
   6.148 +	po/insert-header.sin \
   6.149 +	po/quot.sed \
   6.150 +	po/en@boldquot.header \
   6.151 +	po/boldquot.sed \
   6.152 +	po/Makevars.template \
   6.153 +	po/remove-potcdate.sin \
   6.154 +	po/Makefile.in.in \
   6.155 +	build-aux/mkinstalldirs \
   6.156 +	build-aux/config.rpath \
   6.157 +	build-aux/depcomp \
   6.158 +	build-aux/missing \
   6.159 +	build-aux/config.guess \
   6.160 +	build-aux/config.sub \
   6.161 +	build-aux/install-sh
   6.162 +
   6.163 +mrproper:
   6.164 +	$(MAKE) $(AM_MAKEFLAGS) maintainer-clean
   6.165 +	-rm -f $(MRPROPERFILES)
   6.166 +
   6.167 +rpm: dist
   6.168 +	rpmbuild -ta $(PACKAGE)-$(VERSION).tar.gz
   6.169 +
   6.170 +.PHONY: mrproper
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/NEWS	Mon Jul 07 08:10:39 2008 -0500
     7.3 @@ -0,0 +1,1 @@
     7.4 +To be filled
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/README	Mon Jul 07 08:10:39 2008 -0500
     8.3 @@ -0,0 +1,1 @@
     8.4 +To be filled
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/algobox.cc	Mon Jul 07 08:10:39 2008 -0500
     9.3 @@ -0,0 +1,211 @@
     9.4 +/* -*- C++ -*-
     9.5 + *
     9.6 + * This file is a part of LEMON, a generic C++ optimization library
     9.7 + *
     9.8 + * Copyright (C) 2003-2006
     9.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    9.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
    9.11 + *
    9.12 + * Permission to use, modify and distribute this software is granted
    9.13 + * provided that this copyright notice appears in all copies. For
    9.14 + * precise terms see the accompanying LICENSE file.
    9.15 + *
    9.16 + * This software is provided "AS IS" with no warranty of any kind,
    9.17 + * express or implied, and with no claim as to its suitability for any
    9.18 + * purpose.
    9.19 + *
    9.20 + */
    9.21 +
    9.22 +#include <algobox.h>
    9.23 +#include <mapstorage.h>
    9.24 +#include <mapselector.h>
    9.25 +
    9.26 +enum {N_DEMO1, N_DEMO2, NODE_INPUT_NUM}; // input IDs for nodes;
    9.27 +enum {E_DEMO1, EDGE_INPUT_NUM}; // input IDs for arcs;
    9.28 +
    9.29 +AlgoBox::AlgoBox(std::vector<std::string> tabnames)
    9.30 +{
    9.31 +  init(tabnames);
    9.32 +}
    9.33 +
    9.34 +void AlgoBox::init(std::vector<std::string> tabnames)
    9.35 +{
    9.36 +  set_spacing(5);
    9.37 +
    9.38 +  update_tablist(tabnames);
    9.39 +
    9.40 +  //if active tab is changed, the map names in cbt/s have to be updated
    9.41 +  tabcbt.signal_changed().connect(sigc::mem_fun(*this, &AlgoBox::emit_tab_change));
    9.42 +
    9.43 +  pack_start(tabcbt);
    9.44 +  build_box();
    9.45 +
    9.46 +  show_all_children();
    9.47 +};
    9.48 +
    9.49 +void AlgoBox::update_cbt(std::vector< std::string > stringlist, Gtk::ComboBoxText & cbt)
    9.50 +{
    9.51 +  std::string actname=cbt.get_active_text();
    9.52 +  int prev_act=-1;
    9.53 +
    9.54 +  cbt.clear();
    9.55 +  int actptr=0;
    9.56 +
    9.57 +  std::vector< std::string >::iterator emsi=stringlist.begin();
    9.58 +  for(;emsi!=stringlist.end();emsi++)
    9.59 +    {
    9.60 +      if(actname==*emsi)
    9.61 +	{
    9.62 +	  prev_act=actptr;
    9.63 +	}
    9.64 +
    9.65 +      cbt.append_text(*emsi);
    9.66 +      actptr++;
    9.67 +    }
    9.68 +
    9.69 +  if(prev_act!=-1)
    9.70 +    {
    9.71 +      cbt.set_active(prev_act);
    9.72 +    }
    9.73 +  else if(actptr>0) //so there is item in the list
    9.74 +    {
    9.75 +      //cbt.set_active(0);
    9.76 +    }
    9.77 +}
    9.78 +
    9.79 +void AlgoBox::update_tablist( std::vector< std::string > tl )
    9.80 +{
    9.81 +  update_cbt(tl, tabcbt);
    9.82 +  emit_tab_change();
    9.83 +}
    9.84 +
    9.85 +void AlgoBox::update_maplist(MapStorage * ms)
    9.86 +{
    9.87 +  mapstorage=ms;
    9.88 +  std::vector<std::string> n_nml;
    9.89 +  std::vector<std::string> s_nml;
    9.90 +  std::vector<std::string> n_eml;
    9.91 +  std::vector<std::string> s_eml;
    9.92 +  if(mapstorage!=NULL)
    9.93 +    {
    9.94 +      mapstorage->signal_node_map_ch().connect(sigc::mem_fun(*this, &AlgoBox::nodemaplist_changed));
    9.95 +      mapstorage->signal_arc_map_ch().connect(sigc::mem_fun(*this, &AlgoBox::arcmaplist_changed));
    9.96 +      n_nml=mapstorage->getNodeMapList(NUM);
    9.97 +      s_nml=mapstorage->getNodeMapList(STR);
    9.98 +      n_eml=mapstorage->getArcMapList(NUM);
    9.99 +      s_eml=mapstorage->getArcMapList(STR);
   9.100 +    }
   9.101 +  for(int i=0;i<(int)nodemapcbts.size();i++)
   9.102 +    {
   9.103 +      (nodemapcbts[i])->update_list(n_nml, s_nml);
   9.104 +      //update_cbt(nml, *(nodemapcbts[i]));
   9.105 +    }
   9.106 +  for(int i=0;i<(int)arcmapcbts.size();i++)
   9.107 +    {
   9.108 +      (arcmapcbts[i])->update_list(n_eml, s_eml);
   9.109 +      //update_cbt(eml, *(arcmapcbts[i]));
   9.110 +    }
   9.111 +  signal_maplist_updated.emit();
   9.112 +}
   9.113 +
   9.114 +void AlgoBox::nodemaplist_changed(std::string newmap, MapValue::Type type)
   9.115 +{
   9.116 +  for(int i=0;i<(int)nodemapcbts.size();i++)
   9.117 +    {
   9.118 +      (nodemapcbts[i])->append_text(newmap, type);
   9.119 +    }
   9.120 +}
   9.121 +
   9.122 +void AlgoBox::arcmaplist_changed(std::string newmap, MapValue::Type type)
   9.123 +{
   9.124 +  for(int i=0;i<(int)arcmapcbts.size();i++)
   9.125 +    {
   9.126 +      (arcmapcbts[i])->append_text(newmap, type);
   9.127 +    }
   9.128 +}
   9.129 +
   9.130 +void AlgoBox::run()
   9.131 +{
   9.132 +  std::cout << "Start algorithm." << std::endl;
   9.133 +}
   9.134 +
   9.135 +void AlgoBox::build_box()
   9.136 +{
   9.137 +  pack_start(*(new Gtk::HSeparator()));
   9.138 +
   9.139 +  Gtk::Label * label=new Gtk::Label("Specific part for each algorithm.");
   9.140 +      
   9.141 +  pack_start(*label);
   9.142 +  pack_start(*(new Gtk::HSeparator()));
   9.143 +
   9.144 +  label=new Gtk::Label("Maps in chosen tab:");
   9.145 +      
   9.146 +  pack_start(*label);
   9.147 +
   9.148 +  for(int i=0;i<NODE_INPUT_NUM;i++)
   9.149 +    {
   9.150 +      std::ostringstream o;
   9.151 +      o << "NodeInput " << i+1 << ":";
   9.152 +
   9.153 +      addMapSelector(o.str(), false);
   9.154 +    }
   9.155 +
   9.156 +  pack_start(*(new Gtk::HSeparator()));
   9.157 +
   9.158 +  for(int i=0;i<EDGE_INPUT_NUM;i++)
   9.159 +    {
   9.160 +
   9.161 +      std::ostringstream o;
   9.162 +      o << "ArcInput " << i+1 << ":";
   9.163 +
   9.164 +      addMapSelector(o.str(), true);
   9.165 +    }
   9.166 +
   9.167 +  pack_start(*(new Gtk::HSeparator()));
   9.168 +}
   9.169 +
   9.170 +void AlgoBox::addMapSelector(std::string inputname, bool itisarc, MapType type)
   9.171 +{
   9.172 +  std::vector<std::string> empty_vector;
   9.173 +
   9.174 +  MapSelector * msp=new MapSelector(empty_vector,empty_vector,"",inputname,itisarc, false, type);
   9.175 +
   9.176 +  if(itisarc)
   9.177 +    {
   9.178 +      arcmapcbts.resize(arcmapcbts.size()+1);
   9.179 +      arcmapcbts[arcmapcbts.size()-1]=msp;
   9.180 +    }
   9.181 +  else
   9.182 +    {
   9.183 +      nodemapcbts.resize(nodemapcbts.size()+1);
   9.184 +      nodemapcbts[nodemapcbts.size()-1]=msp;
   9.185 +    }
   9.186 +
   9.187 +  msp->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &AlgoBox::emit_new_map_signal));
   9.188 +
   9.189 +  pack_start(*msp);
   9.190 +}
   9.191 +
   9.192 +sigc::signal<void, std::string> AlgoBox::signal_maplist_needed()
   9.193 +{
   9.194 +  return signal_maplist_need;
   9.195 +}
   9.196 +
   9.197 +void AlgoBox::emit_tab_change()
   9.198 +{
   9.199 +  std::string active_tab=tabcbt.get_active_text();
   9.200 +  if(active_tab!="")
   9.201 +    {
   9.202 +      signal_maplist_need.emit(active_tab);
   9.203 +    }
   9.204 +  else
   9.205 +    {
   9.206 +      std::vector<std::string> empty_vector;
   9.207 +      update_maplist(NULL);
   9.208 +    }
   9.209 +}
   9.210 +
   9.211 +void AlgoBox::emit_new_map_signal(bool itisarc)
   9.212 +{
   9.213 +  signal_newmapwin_need.emit(tabcbt.get_active_text(), itisarc);
   9.214 +}
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/algobox.h	Mon Jul 07 08:10:39 2008 -0500
    10.3 @@ -0,0 +1,189 @@
    10.4 +/* -*- C++ -*-
    10.5 + *
    10.6 + * This file is a part of LEMON, a generic C++ optimization library
    10.7 + *
    10.8 + * Copyright (C) 2003-2006
    10.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
   10.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
   10.11 + *
   10.12 + * Permission to use, modify and distribute this software is granted
   10.13 + * provided that this copyright notice appears in all copies. For
   10.14 + * precise terms see the accompanying LICENSE file.
   10.15 + *
   10.16 + * This software is provided "AS IS" with no warranty of any kind,
   10.17 + * express or implied, and with no claim as to its suitability for any
   10.18 + * purpose.
   10.19 + *
   10.20 + */
   10.21 +
   10.22 +#ifndef ALGOBOX_H
   10.23 +#define ALGOBOX_H
   10.24 +
   10.25 +class MapStorage;
   10.26 +class MapSelector;
   10.27 +
   10.28 +#include <all_include.h>
   10.29 +#include <libgnomecanvasmm.h>
   10.30 +#include <libgnomecanvasmm/polygon.h>
   10.31 +#include "map_value.h"
   10.32 +
   10.33 +///Ancestor class of algorithm digraphical interface classes.
   10.34 +
   10.35 +///It also demonstrates, how should an algorithm digraphical interface
   10.36 +///work. Children of this class have the same functions and attributes,
   10.37 +///therefore with all of them can the holder \ref AlgoWin communicate
   10.38 +///in the same way.
   10.39 +///
   10.40 +///IMPORTANT! In a child class only the following tasks are to do:
   10.41 +///
   10.42 +///-call \ref init function with correct parameters from correctly parametrized constructor
   10.43 +///
   10.44 +///-implement \ref build_box function
   10.45 +///
   10.46 +///-implement \ref run function
   10.47 +///
   10.48 +///because all other thing is automatically done in \ref init function!
   10.49 +
   10.50 +class AlgoBox : public Gtk::VBox
   10.51 +{
   10.52 +  ///Signal emitted in case of need for list of maps.
   10.53 +
   10.54 +  ///If the user has selected different tab to work on
   10.55 +  ///new maps are selected as well. These new maps should be
   10.56 +  ///provided for \ref AlgoBox. To get these maps, \ref AlgoBox
   10.57 +  ///emits this signal.
   10.58 +  sigc::signal<void, std::string> signal_maplist_need;
   10.59 +
   10.60 +  ///Signal emitted in case of need for \ref NewMapWin.
   10.61 +
   10.62 +  ///If user wants to create a new for an input, or output
   10.63 +  ///it can let \ref NewMapWin popped up from here as well.
   10.64 +  ///In that case will be this signal emitted.
   10.65 +  sigc::signal<void, std::string, bool> signal_newmapwin_need;
   10.66 +
   10.67 +  ///Signal emitted when maplists are updated after tab change
   10.68 +  sigc::signal<void> signal_maplist_updated;
   10.69 +
   10.70 +
   10.71 +protected:
   10.72 +  ///Holder of tabnames.
   10.73 +  Gtk::ComboBoxText tabcbt;
   10.74 +
   10.75 +  ///Holder of widgets, in which nodemaps can be selected to work on.
   10.76 +  std::vector<MapSelector *> nodemapcbts;
   10.77 +
   10.78 +  ///Holder of widgets, in which arcmaps can be selected to work on.
   10.79 +  std::vector<MapSelector *> arcmapcbts;
   10.80 +
   10.81 +  ///Maps of selected tabs.
   10.82 +  MapStorage * mapstorage;
   10.83 +
   10.84 +public:
   10.85 +  ///Empty constructor called by children.
   10.86 +  AlgoBox(){};
   10.87 +
   10.88 +  ///Constructor
   10.89 +
   10.90 +  ///Calls \ref init function
   10.91 +  ///with the provided parameters. \ref init function
   10.92 +  ///is needed, because it is virtual, therefore the
   10.93 +  ///functions of the proper class will be called when
   10.94 +  ///running.
   10.95 +  ///\param tablist list of tabs in \ref MainWin
   10.96 +  AlgoBox(std::vector<std::string> tablist);
   10.97 +
   10.98 +  ///Initiates \ref AlgoBox.
   10.99 +
  10.100 +  ///Creates the digraphical interface for the realized algorithm, initiates variables, connects signals.
  10.101 +  ///
  10.102 +  ///List of tabs in \ref MainWin is required, but no one
  10.103 +  ///will be selected automatically. Every other
  10.104 +  ///entry field remains empty (unselected), until a \ref NoteBookTab
  10.105 +  ///is selected.
  10.106 +  ///
  10.107 +  ///It also have to bind all the signals to the correct place.
  10.108 +  ///This function is virtual, in all type of children of
  10.109 +  ///\ref AlgoBox the correct function willbe called.
  10.110 +  ///
  10.111 +  ///Therefore it is IMPORTANT that only \ref run and \ref build_box
  10.112 +  ///has to be implemented in children of \ref AlgoBox, every other
  10.113 +  ///thing will automatically work properly by the help of this
  10.114 +  ///function that must be called in constructor of child!!!
  10.115 +  virtual void init(std::vector<std::string>);
  10.116 +
  10.117 +  ///Signal emitted, when selected tab changes, and new list of maps required.
  10.118 +  sigc::signal<void, std::string> signal_maplist_needed();
  10.119 +
  10.120 +  ///Emitted if user wants to create a new map for inpuit or output.
  10.121 +  sigc::signal<void, std::string, bool> signal_newmapwin_needed(){return signal_newmapwin_need;};
  10.122 +
  10.123 +  sigc::signal<void> signal_upon_maplist_updated(){return signal_maplist_updated;};
  10.124 +
  10.125 +  ///Emits signal that requires list of maps for the recently selected \ref NoteBookTab.
  10.126 +  void emit_tab_change();
  10.127 +
  10.128 +  ///Interface, through which \ref AlgoBox can be notified about tab addition, deletion in \ref MainWin
  10.129 +
  10.130 +  ///\param tl list
  10.131 +  ///of new tab state.
  10.132 +  void update_tablist( std::vector< std::string > tl );
  10.133 +
  10.134 +  ///Interface, through which \ref AlgoBox can get the maps of the recently selected \ref NoteBookTab
  10.135 +
  10.136 +  ///\param ms the maps
  10.137 +  ///of the recently selected \ref NoteBookTab
  10.138 +  void update_maplist( MapStorage * ms);
  10.139 +
  10.140 +  ///Interface, through which \ref AlgoBox can be notified about nodemap addition.
  10.141 +
  10.142 +  ///If new map was added to \ref MapStorage of currently selected \ref NoteBookTab
  10.143 +  ///a signal is emitted by it. This signal is connected to this function, so \ref MapSelector s
  10.144 +  ///in \ref nodemapcbts can be notified, and those can registrate the new map. (\ref MapSelector::append_text)
  10.145 +  void nodemaplist_changed(std::string, MapValue::Type);
  10.146 +
  10.147 +  ///Interface, through which \ref AlgoBox can be notified about arcmap addition.
  10.148 +
  10.149 +  ///If new map was added to \ref MapStorage of currently selected \ref NoteBookTab
  10.150 +  ///a signal is emitted by it. This signal is connected to this function, so \ref MapSelector s
  10.151 +  ///in \ref arcmapcbts can be notified, and those can registrate the new map. (\ref MapSelector::append_text)
  10.152 +  void arcmaplist_changed(std::string, MapValue::Type);
  10.153 +
  10.154 +  ///Aid function to provide data for a given entry.
  10.155 +
  10.156 +  ///At the moment it is only used for updating info
  10.157 +  ///in \ref tabcbt. It clears it first, after that
  10.158 +  ///inserts the data got from caller, and if there
  10.159 +  ///was previously selected item it switches entry
  10.160 +  ///to that.
  10.161 +  ///\param tl list of entries (at the moment tabs in \ref MainWin)
  10.162 +  ///\param cbt the entry to update (at the moment only \ref tabcbt)
  10.163 +  void update_cbt( std::vector< std::string > tl, Gtk::ComboBoxText & cbt);
  10.164 +
  10.165 +  ///Runs the ralized algorithm.
  10.166 +
  10.167 +  ///Prepare the data for it
  10.168 +  ///and after that postprocess it if necessary.
  10.169 +  ///This is only a demo here, but in children it
  10.170 +  ///runs the algorithm really.
  10.171 +  virtual void run();
  10.172 +
  10.173 +  ///Creates the layout of the \ref AlgoBox
  10.174 +
  10.175 +  ///Place all the entries
  10.176 +  ///required. Run and close button is not
  10.177 +  ///its responsibility!
  10.178 +  virtual void build_box();
  10.179 +
  10.180 +  ///Emits \ref signal_newmapwin_need if user wants to create new input or output map.
  10.181 +
  10.182 +  ///Called in case of pressing \ref MapSelector::newbut.
  10.183 +  ///\param itisarc arc or nodemap is required.
  10.184 +  virtual void emit_new_map_signal(bool itisarc);
  10.185 +
  10.186 +  ///Aid function to make addition of \ref MapSelector easy in \ref build_box.
  10.187 +
  10.188 +  ///\param label label to show in \ref MapSelector
  10.189 +  ///\param itisarc whether arc or nodemaps stored in \ref MapSelector
  10.190 +  void addMapSelector(std::string label, bool itisarc, MapType type = ALL);
  10.191 +};
  10.192 +#endif //ALGOBOX_H
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/algowin.cc	Mon Jul 07 08:10:39 2008 -0500
    11.3 @@ -0,0 +1,117 @@
    11.4 +/* -*- C++ -*-
    11.5 + *
    11.6 + * This file is a part of LEMON, a generic C++ optimization library
    11.7 + *
    11.8 + * Copyright (C) 2003-2006
    11.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
   11.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
   11.11 + *
   11.12 + * Permission to use, modify and distribute this software is granted
   11.13 + * provided that this copyright notice appears in all copies. For
   11.14 + * precise terms see the accompanying LICENSE file.
   11.15 + *
   11.16 + * This software is provided "AS IS" with no warranty of any kind,
   11.17 + * express or implied, and with no claim as to its suitability for any
   11.18 + * purpose.
   11.19 + *
   11.20 + */
   11.21 +
   11.22 +#include <algowin.h>
   11.23 +#include <algobox.h>
   11.24 +#include <kruskalbox.h>
   11.25 +#include <dijkstrabox.h>
   11.26 +
   11.27 +sigc::signal<void, AlgoWin *> AlgoWin::signal_closing()
   11.28 +{
   11.29 +  return signal_closed;
   11.30 +}
   11.31 +
   11.32 +sigc::signal<void, AlgoWin *, std::string> AlgoWin::signal_maplist_needed()
   11.33 +{
   11.34 +  return signal_maplist_need;
   11.35 +}
   11.36 +
   11.37 +bool AlgoWin::closeIfEscapeIsPressed(GdkEventKey* e)
   11.38 +{
   11.39 +  if(e->keyval==GDK_Escape)
   11.40 +  {
   11.41 +    on_hide();
   11.42 +  }
   11.43 +  return true;
   11.44 +}
   11.45 +
   11.46 +AlgoWin::AlgoWin(int algoid, std::vector<std::string> tabnames)
   11.47 +{
   11.48 +  signal_key_press_event().connect(sigc::mem_fun(*this, &AlgoWin::closeIfEscapeIsPressed));
   11.49 +
   11.50 +  Gtk::VBox * vbox=new Gtk::VBox();
   11.51 +  vbox->set_spacing(5);
   11.52 +
   11.53 +  Gtk::Label * label=new Gtk::Label("Select digraph:");
   11.54 +
   11.55 +  switch(algoid)
   11.56 +    {
   11.57 +    case 0:
   11.58 +      ab=new AlgoBox(tabnames);
   11.59 +      set_title("Algo Win Demo");
   11.60 +      break;
   11.61 +    case 1:
   11.62 +      ab=new KruskalBox(tabnames);
   11.63 +      set_title("Kruskal Algorithm");
   11.64 +      break;
   11.65 +    case 2:
   11.66 +      ab=new DijkstraBox(tabnames);
   11.67 +      set_title("Dijkstra Algorithm");
   11.68 +      break;
   11.69 +    case 3:
   11.70 +      ab=new SuurballeBox(tabnames);
   11.71 +      set_title("Suurballe Algorithm");
   11.72 +      break;
   11.73 +    default:
   11.74 +      break;
   11.75 +    }
   11.76 +  ab->signal_maplist_needed().connect(sigc::mem_fun(*this, &AlgoWin::emit_tab_change));
   11.77 +  ab->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &AlgoWin::emit_new_map_signal));
   11.78 +
   11.79 +  runbutton=new Gtk::Button("Run");
   11.80 +  runbutton->signal_released().connect(sigc::mem_fun(*ab,&AlgoBox::run));
   11.81 +  runbutton->signal_activate().connect(sigc::mem_fun(*ab,&AlgoBox::run));
   11.82 +
   11.83 +  closebutton=new Gtk::Button("Close");
   11.84 +  closebutton->signal_released().connect(sigc::mem_fun(*this,&AlgoWin::on_hide));
   11.85 +  closebutton->signal_activate().connect(sigc::mem_fun(*this,&AlgoWin::on_hide));
   11.86 +      
   11.87 +  Gtk::HBox * hbox=new Gtk::HBox();
   11.88 +
   11.89 +  hbox->pack_start(*runbutton);
   11.90 +  hbox->pack_start(*closebutton);
   11.91 +
   11.92 +  vbox->pack_start(*label);
   11.93 +  vbox->pack_start(*ab);
   11.94 +  vbox->pack_start(*hbox);
   11.95 +      
   11.96 +  add(*vbox);
   11.97 +
   11.98 +  show_all_children();
   11.99 +};
  11.100 +
  11.101 +void AlgoWin::update_tablist(std::vector<std::string> tabnames)
  11.102 +{
  11.103 +  ab->update_tablist(tabnames);
  11.104 +}
  11.105 +
  11.106 +void AlgoWin::update_maplist(MapStorage * mapstorage)
  11.107 +{
  11.108 +  ab->update_maplist(mapstorage);
  11.109 +}
  11.110 +
  11.111 +void AlgoWin::on_hide()
  11.112 +{
  11.113 +  signal_closed.emit(this);
  11.114 +  Gtk::Window::on_hide();
  11.115 +}
  11.116 +
  11.117 +void AlgoWin::emit_tab_change(std::string newtab)
  11.118 +{
  11.119 +  signal_maplist_need.emit(this, newtab);
  11.120 +}
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/algowin.h	Mon Jul 07 08:10:39 2008 -0500
    12.3 @@ -0,0 +1,147 @@
    12.4 +/* -*- C++ -*-
    12.5 + *
    12.6 + * This file is a part of LEMON, a generic C++ optimization library
    12.7 + *
    12.8 + * Copyright (C) 2003-2006
    12.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
   12.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
   12.11 + *
   12.12 + * Permission to use, modify and distribute this software is granted
   12.13 + * provided that this copyright notice appears in all copies. For
   12.14 + * precise terms see the accompanying LICENSE file.
   12.15 + *
   12.16 + * This software is provided "AS IS" with no warranty of any kind,
   12.17 + * express or implied, and with no claim as to its suitability for any
   12.18 + * purpose.
   12.19 + *
   12.20 + */
   12.21 +
   12.22 +#ifndef ALGOWIN_H
   12.23 +#define ALGOWIN_H
   12.24 +
   12.25 +#include <all_include.h>
   12.26 +#include <libgnomecanvasmm.h>
   12.27 +#include <libgnomecanvasmm/polygon.h>
   12.28 +
   12.29 +class AlgoBox;
   12.30 +class MapStorage;
   12.31 +
   12.32 +///Algorithm identifiers.
   12.33 +enum {GENERAL, KRUSKAL, ALGO_NUM}; // algorithm IDs;
   12.34 +
   12.35 +///Window displaying digraphical interface for different algorithms.
   12.36 +
   12.37 +///This class displays a digraphical interface to set up
   12.38 +///and run different algorithms. Different algorithms need
   12.39 +///different inputs, running methods, etc. Therefore
   12.40 +///class \ref AlgoWin is only a holder of a base class, the so
   12.41 +///called AlgoBox. \ref AlgoBox is the ancestor of other
   12.42 +///classes. These child classes realize interfaces of different
   12.43 +///algorithms, but as their common ancestor is \ref AlgoBox
   12.44 +///the interface of them is the same. \ref AlgoWin communicates
   12.45 +///with these classes through this common interface. But it the
   12.46 +///real object to be placed in \ref AlgoWin depends on the algorithm
   12.47 +///which the \ref AlgoWin actually has to display. It gets the
   12.48 +///id of algorithm to display at initialization, and therefore it is
   12.49 +///able to place in itself the requested child of \ref AlgoBox
   12.50 +/// visualizing the appropriate algorithm.
   12.51 +class AlgoWin : public Gtk::Window
   12.52 +{
   12.53 +private:
   12.54 +  ///Algorithm specific part of \ref AlgoWin
   12.55 +  AlgoBox * ab;
   12.56 +
   12.57 +  ///Run button.
   12.58 +
   12.59 +  ///If pressed, algorithm should run.
   12.60 +  ///That is why common ancestor of different
   12.61 +  ///algorithm realizer classes have to be. In case of
   12.62 +  ///pressing run button a common method can be called.
   12.63 +  Gtk::Button * runbutton;
   12.64 +
   12.65 +  ///Close button. If pressed, \ref AlgoWin should close.
   12.66 +  Gtk::Button * closebutton;
   12.67 +
   12.68 +protected:
   12.69 +  ///Signal emitted upon close of window
   12.70 +
   12.71 +  ///It is necessary, because \ref MainWin have to
   12.72 +  ///score the opened \ref AlgoWin s, to be able to communicate
   12.73 +  ///with them: let them know about changement in tabs, maps, etc.
   12.74 +  ///If \ref AlgoWin is closed, \ref MainWin has to deregistrate it.
   12.75 +  ///Therefore signal contains address of emitter \ref AlgoWin.
   12.76 +  sigc::signal<void, AlgoWin *> signal_closed;
   12.77 +
   12.78 +  ///Signal indicating that informatino on certain maplist is required.
   12.79 +
   12.80 +  ///It is just a forwarded signal from \ref AlgoBox, benefit of common ancestor
   12.81 +  ///algorithm class. User can select the digraph (the holder \ref NoteBookTab) on
   12.82 +  ///which the algorithm should run. But different digraphs (\ref NoteBookTab) have
   12.83 +  ///different maps. If selected tab changes this signal is emitted by \ref AlgoBox,
   12.84 +  ///caught and reemitted by \ref AlgoWin.
   12.85 +  ///
   12.86 +  ///Signal contains the address of \ref AlgoWin to let \ref MainWin know
   12.87 +  ///where should the information needed forwarded, and the name of
   12.88 +  ///\ref NoteBookTab, of which maps are inquired.
   12.89 +  sigc::signal<void, AlgoWin *, std::string> signal_maplist_need;
   12.90 +
   12.91 +  ///Signal that indicates that a \ref NewMapWin should be popped up.
   12.92 +
   12.93 +  ///This is a forwarded signal. If \ref AlgoBox emits a signal
   12.94 +  ///to let a \ref NewMapWin pop up, |ref AlgoWin catch and reemit it.
   12.95 +  ///
   12.96 +  ///Signal contains the name of \ref NoteBookTab, in which the new map
   12.97 +  ///should be created and a boolean that indicates whether an arc or a
   12.98 +  ///nodemap should be created.
   12.99 +  sigc::signal<void, std::string, bool> signal_newmapwin_need;
  12.100 +
  12.101 +public:
  12.102 +  ///Close window if escape key is pressed.
  12.103 +  bool closeIfEscapeIsPressed(GdkEventKey* e);
  12.104 +
  12.105 +  ///Returns \ref signal_closed to be bindable somewhere.
  12.106 +  sigc::signal<void, AlgoWin *> signal_closing();
  12.107 +
  12.108 +  ///Returns \ref signal_maplist_need to be bindable somewhere.
  12.109 +  sigc::signal<void, AlgoWin *, std::string> signal_maplist_needed();
  12.110 +
  12.111 +  ///Returns \ref signal_newmapwin_need to be bindable somewhere.
  12.112 +  sigc::signal<void, std::string, bool> signal_newmapwin_needed(){return signal_newmapwin_need;};
  12.113 +
  12.114 +  ///Forwards signal emitted by \ref AlgoBox, in which it indicates changement in selection of tabs.
  12.115 +  void emit_tab_change(std::string);
  12.116 +
  12.117 +  ///Forwards signal emitted by \ref AlgoBox, in which it indicates need for \ref NewMapWin.
  12.118 +  void emit_new_map_signal(std::string tabname, bool itisarc){signal_newmapwin_need.emit(tabname, itisarc);};
  12.119 +
  12.120 +  ///Constructor
  12.121 +
  12.122 +  ///It builds the window according to the information provided
  12.123 +  ///by the creator. It needs the identifier of the algorithm
  12.124 +  ///to visualize, and a list of name of \ref NoteBookTab s that can
  12.125 +  ///be found in \ref MainWin.
  12.126 +  ///\param algoid identifier of algorithm to show
  12.127 +  ///\param tablist list of tabs in \ref MainWin
  12.128 +  AlgoWin(int algoid, std::vector<std::string> tablist);
  12.129 +
  12.130 +  ///Forwards list of \ref NoteBookTabs toward \ref AlgoBox
  12.131 +
  12.132 +  ///In case of changement in tabs in \ref MainWin
  12.133 +  ///\ref MainWin automatically updates tablist in
  12.134 +  ///\ref AlgoWin s.
  12.135 +  void update_tablist(std::vector<std::string> tabnames);
  12.136 +
  12.137 +  ///Forwards list of requested maps toward \ref AlgoBox
  12.138 +
  12.139 +  ///Upon catching the signal in which \ref AlgoBox requests
  12.140 +  ///list of maps \ref MainWin responds
  12.141 +  ///through this function.
  12.142 +  void update_maplist(MapStorage *);
  12.143 +
  12.144 +  ///Called when window is closing.
  12.145 +
  12.146 +  ///\ref AlgoWin has to be deregistrated in \ref MainWin
  12.147 +  ///thereforeit emits signal \ref signal_closed.
  12.148 +  void on_hide();
  12.149 +};
  12.150 +#endif //ALGOWIN_H
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/all_include.h	Mon Jul 07 08:10:39 2008 -0500
    13.3 @@ -0,0 +1,73 @@
    13.4 +/* -*- C++ -*-
    13.5 + *
    13.6 + * This file is a part of LEMON, a generic C++ optimization library
    13.7 + *
    13.8 + * Copyright (C) 2003-2006
    13.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
   13.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
   13.11 + *
   13.12 + * Permission to use, modify and distribute this software is granted
   13.13 + * provided that this copyright notice appears in all copies. For
   13.14 + * precise terms see the accompanying LICENSE file.
   13.15 + *
   13.16 + * This software is provided "AS IS" with no warranty of any kind,
   13.17 + * express or implied, and with no claim as to its suitability for any
   13.18 + * purpose.
   13.19 + *
   13.20 + */
   13.21 +
   13.22 +#ifndef ALL_INCLUDE_H
   13.23 +#define ALL_INCLUDE_H
   13.24 +
   13.25 +#include <fstream>
   13.26 +#include <iostream>
   13.27 +
   13.28 +#include <vector>
   13.29 +
   13.30 +#include <lemon/list_graph.h>
   13.31 +#include <lemon/graph_utils.h>
   13.32 +#include <lemon/maps.h>
   13.33 +#include <lemon/error.h>
   13.34 +#include <lemon/dim2.h>
   13.35 +
   13.36 +enum {E_WIDTH, E_COLOR, E_TEXT, EDGE_PROPERTY_NUM}; // arc properties;
   13.37 +enum {N_RADIUS, N_COLOR, N_TEXT, NODE_PROPERTY_NUM}; // node properties;
   13.38 +enum {N_MAPS, E_MAPS, ARROWS, PAR, EPS_PROPERTY_NUM}; // eps properties;
   13.39 +enum {MOVE, CREATE_NODE, CREATE_EDGE, ERASER, MAP_EDIT, TOOL_NUM}; // tools;
   13.40 +#define RANGE 3
   13.41 +#define WIN_WIDTH 900
   13.42 +#define WIN_HEIGHT 600
   13.43 +#define MIN_EDGE_WIDTH 2
   13.44 +#define MAX_EDGE_WIDTH 40
   13.45 +#define MIN_NODE_RADIUS 2
   13.46 +#define MAX_NODE_RADIUS 80
   13.47 +
   13.48 +#ifndef MAIN_PART
   13.49 +extern std::vector <std::string> arc_property_strings;
   13.50 +extern std::vector <double> arc_property_defaults;
   13.51 +extern std::vector <std::string> node_property_strings;
   13.52 +extern std::vector <double> node_property_defaults;
   13.53 +extern int longest_property_string_length;
   13.54 +#endif //MAIN_PART
   13.55 +
   13.56 +using namespace lemon;
   13.57 +
   13.58 +typedef lemon::dim2::Point<double> XY;
   13.59 +typedef ListDigraph Digraph;
   13.60 +typedef Digraph::Node Node;
   13.61 +typedef Digraph::Arc Arc;
   13.62 +typedef Digraph::ArcIt ArcIt;
   13.63 +typedef Digraph::InArcIt InArcIt;
   13.64 +typedef Digraph::OutArcIt OutArcIt;
   13.65 +typedef Digraph::NodeIt NodeIt;
   13.66 +
   13.67 +const std::string prog_name = "LEMON Digraph Editor";
   13.68 +
   13.69 +enum MapType
   13.70 +{
   13.71 +  NUM  = 1 << 0,
   13.72 +  STR  = 1 << 1,
   13.73 +  ALL  = (1 << 0) | (1 << 1)
   13.74 +};
   13.75 +
   13.76 +#endif // ALL_INCLUDE_H
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/autopackage/default.apspec.in	Mon Jul 07 08:10:39 2008 -0500
    14.3 @@ -0,0 +1,44 @@
    14.4 +# -*-shell-script-*-
    14.5 +
    14.6 +[Meta]
    14.7 +RootName: @lemon.cs.elte.hu/glemon:$SOFTWAREVERSION
    14.8 +DisplayName: glemon
    14.9 +ShortName: glemon
   14.10 +Maintainer: The LEMON Developers - http://lemon.cs.elte.hu/
   14.11 +Packager: Alpar Juttner <alpar@cs.elte.hu>
   14.12 +Summary: Graphical graph and network editor for the LEMON Graph Format
   14.13 +SoftwareVersion: @VERSION@
   14.14 +AutopackageTarget: 0.7
   14.15 +
   14.16 +# Only uncomment InterfaceVersion if your package exposes interfaces to other software,
   14.17 +# for instance if it includes DSOs or python/perl modules. See the developer guide for more info,
   14.18 +# or ask on autopackage-dev if you don't understand interface versioning in autopackage.
   14.19 +#
   14.20 +# InterfaceVersion: 0.0
   14.21 +
   14.22 +PackageVersion: 1
   14.23 +
   14.24 +[Description]
   14.25 +Graphical graph and network editor for the LEMON Graph Format
   14.26 +
   14.27 +[BuildPrepare]
   14.28 +prepareBuild
   14.29 +
   14.30 +[BuildUnprepare]
   14.31 +unprepareBuild
   14.32 +
   14.33 +[Imports]
   14.34 +echo '*' | import
   14.35 +
   14.36 +[Prepare]
   14.37 +# Dependency checking
   14.38 +#require @whatever.you/need 1.0
   14.39 +
   14.40 +[Install]
   14.41 +# Put your installation script here
   14.42 +#installExe bin/*
   14.43 +copyFiles * $PREFIX
   14.44 +
   14.45 +[Uninstall]
   14.46 +# Usually just the following line is enough to uninstall everything
   14.47 +uninstallFromLog
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/background_chooser_dialog.cc	Mon Jul 07 08:10:39 2008 -0500
    15.3 @@ -0,0 +1,52 @@
    15.4 +#include <background_chooser_dialog.h>
    15.5 +#include <gtkmm/stock.h>
    15.6 +#include <mapstorage.h>
    15.7 +
    15.8 +BackgroundChooserDialog::BackgroundChooserDialog(MapStorage* ms) :
    15.9 +  mapstorage(ms),
   15.10 +  btnClear(Gtk::Stock::CLEAR)
   15.11 +{
   15.12 +  set_has_separator(false);
   15.13 +
   15.14 +  Gtk::VBox* pVBox = get_vbox();
   15.15 +
   15.16 +  lblBackground.set_text("<b>Background image file</b>");
   15.17 +  lblBackground.set_use_markup();
   15.18 +  lblBackground.set_alignment(Gtk::ALIGN_LEFT);
   15.19 +  lblScaling.set_text("<b>Scaling factor</b>");
   15.20 +  lblScaling.set_use_markup();
   15.21 +  lblScaling.set_alignment(Gtk::ALIGN_LEFT);
   15.22 +  fcbBackground.set_width_chars(30);
   15.23 +  fcbBackground.set_action(Gtk::FILE_CHOOSER_ACTION_OPEN);
   15.24 +  if (mapstorage->isBackgroundSet())
   15.25 +  {
   15.26 +    fcbBackground.set_filename(mapstorage->getBackgroundFilename());
   15.27 +  }
   15.28 +
   15.29 +  fcbBackground.signal_selection_changed().connect(
   15.30 +    sigc::mem_fun(*this, &BackgroundChooserDialog::setBackground));
   15.31 +
   15.32 +  btnClear.signal_clicked().connect(
   15.33 +    sigc::mem_fun(*this, &BackgroundChooserDialog::clearBackground));
   15.34 +
   15.35 +  pVBox->pack_start(lblBackground, Gtk::PACK_SHRINK);
   15.36 +  pVBox->pack_start(box, Gtk::PACK_SHRINK);
   15.37 +  box.pack_start(fcbBackground, Gtk::PACK_EXPAND_WIDGET);
   15.38 +  box.pack_start(btnClear, Gtk::PACK_SHRINK);
   15.39 +  pVBox->pack_start(lblScaling, Gtk::PACK_SHRINK);
   15.40 +  pVBox->pack_start(sbScaling, Gtk::PACK_SHRINK);
   15.41 +
   15.42 +  add_button(Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE);
   15.43 +
   15.44 +  show_all_children();
   15.45 +}
   15.46 +
   15.47 +void BackgroundChooserDialog::clearBackground()
   15.48 +{
   15.49 +  fcbBackground.unselect_all();
   15.50 +}
   15.51 +
   15.52 +void BackgroundChooserDialog::setBackground()
   15.53 +{
   15.54 +  mapstorage->setBackground(fcbBackground.get_filename());
   15.55 +}
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/background_chooser_dialog.h	Mon Jul 07 08:10:39 2008 -0500
    16.3 @@ -0,0 +1,27 @@
    16.4 +#ifndef BACKGROUND_CHOOSER_DIALOG
    16.5 +#define BACKGROUND_CHOOSER_DIALOG
    16.6 +
    16.7 +#include <gtkmm/dialog.h>
    16.8 +#include <gtkmm/label.h>
    16.9 +#include <gtkmm/filechooserbutton.h>
   16.10 +#include <gtkmm/spinbutton.h>
   16.11 +
   16.12 +class MapStorage;
   16.13 +
   16.14 +class BackgroundChooserDialog : public Gtk::Dialog
   16.15 +{
   16.16 +  private:
   16.17 +    MapStorage* mapstorage;
   16.18 +    Gtk::Label lblBackground;
   16.19 +    Gtk::Label lblScaling;
   16.20 +    Gtk::FileChooserButton fcbBackground;
   16.21 +    Gtk::SpinButton sbScaling;
   16.22 +    Gtk::HBox box;
   16.23 +    Gtk::Button btnClear;
   16.24 +    void clearBackground();
   16.25 +    void setBackground();
   16.26 +  public:
   16.27 +    BackgroundChooserDialog(MapStorage* ms);
   16.28 +};
   16.29 +
   16.30 +#endif
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/bootstrap	Mon Jul 07 08:10:39 2008 -0500
    17.3 @@ -0,0 +1,85 @@
    17.4 +#!/bin/bash
    17.5 +
    17.6 +quiet=0
    17.7 +function quiet { [[ $quiet == 1 ]]; }
    17.8 +
    17.9 +if [[ "$1" == "-q" ]]; then
   17.10 +  quiet=1
   17.11 +  shift
   17.12 +fi
   17.13 +
   17.14 +prev=
   17.15 +for option
   17.16 +do
   17.17 +  if test -n "$prev"
   17.18 +  then
   17.19 +    eval "$prev=\$option"
   17.20 +    prev=
   17.21 +    continue
   17.22 +  fi
   17.23 +
   17.24 +  optarg=`expr "x$option" : 'x[^=]*=\(.*\)'`
   17.25 +
   17.26 +  case $option in
   17.27 +
   17.28 +  -amver | --amver)
   17.29 +    prev=amver ;;
   17.30 +  -amver=* | --amver=*)
   17.31 +    amver=$optarg ;;
   17.32 +
   17.33 +  -acver | --acver)
   17.34 +    prev=acver ;;
   17.35 +  -acver=* | --acver=*)
   17.36 +    acver=$optarg ;;
   17.37 +
   17.38 +  --help | -h)
   17.39 +    cat << EOF
   17.40 +Usage: $0 [OPTION]
   17.41 +
   17.42 +Options:
   17.43 +  -h, --help            display this help and exit
   17.44 +      --amver=VERSION   use VERSION version of automake
   17.45 +      --acver=VERSION   use VERSION version of autoconf
   17.46 +
   17.47 +Expamle:
   17.48 +  $0 --amver=1.8 --acver=2.59
   17.49 +EOF
   17.50 +    exit 0
   17.51 +    ;;
   17.52 +
   17.53 +  *)
   17.54 +    cat << EOF >&2
   17.55 +$0: unrecognized option: $option
   17.56 +Try \`$0 --help' for more information.
   17.57 +EOF
   17.58 +    exit 1
   17.59 +    ;;
   17.60 +
   17.61 +  esac
   17.62 +done
   17.63 +
   17.64 +automake=automake
   17.65 +aclocal=aclocal
   17.66 +autoconf=autoconf
   17.67 +autoheader=autoheader
   17.68 +
   17.69 +if test -n "$amver"
   17.70 +then
   17.71 +  automake=automake-$amver
   17.72 +  aclocal=aclocal-$amver
   17.73 +fi
   17.74 +
   17.75 +if test -n "$acver"
   17.76 +then
   17.77 +  autoconf=autoconf-$acver
   17.78 +  autoheader=autoheader-$acver
   17.79 +fi
   17.80 +
   17.81 +set -e
   17.82 +quiet || set -x
   17.83 +
   17.84 +autopoint
   17.85 +$aclocal -I m4
   17.86 +$autoconf
   17.87 +$autoheader
   17.88 +$automake --add-missing --copy --gnu
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/color.lgf	Mon Jul 07 08:10:39 2008 -0500
    18.3 @@ -0,0 +1,370 @@
    18.4 +@nodes 
    18.5 +coordinates_x	coordinates_y	label	
    18.6 +-357	-128	1	
    18.7 +-298	-135	2	
    18.8 +-229	-140	3	
    18.9 +-160	-146	4	
   18.10 +-84	-149	5	
   18.11 +-3	-155	6	
   18.12 +76	-155	7	
   18.13 +155	-151	8	
   18.14 +229	-138	9	
   18.15 +298	-113	10	
   18.16 +362	-88	11	
   18.17 +433	-53	12	
   18.18 +447	3	13	
   18.19 +416	59	14	
   18.20 +338	69	15	
   18.21 +281	31	16	
   18.22 +217	6	17	
   18.23 +143	-1	18	
   18.24 +69	-1	19	
   18.25 +-7	3	20	
   18.26 +-73	3	21	
   18.27 +-137	-3	22	
   18.28 +-193	-26	23	
   18.29 +-255	-30	24	
   18.30 +-303	-2	25	
   18.31 +-348	37	26	
   18.32 +-355	92	27	
   18.33 +-335	145	28	
   18.34 +-299	181	29	
   18.35 +-229	186	30	
   18.36 +-164	154	31	
   18.37 +-104	126	32	
   18.38 +-46	134	33	
   18.39 +0	169	34	
   18.40 +47	197	35	
   18.41 +100	195	36	
   18.42 +141	161	37	
   18.43 +195	134	38	
   18.44 +256	146	39	
   18.45 +314	182	40	
   18.46 +370	207	41	
   18.47 +431	244	42	
   18.48 +
   18.49 +@arcs
   18.50 +		label	
   18.51 +42	41	1	
   18.52 +41	40	2	
   18.53 +40	39	3	
   18.54 +39	38	4	
   18.55 +38	37	5	
   18.56 +37	36	6	
   18.57 +36	35	7	
   18.58 +35	34	8	
   18.59 +34	33	9	
   18.60 +33	32	10	
   18.61 +32	31	11	
   18.62 +31	30	12	
   18.63 +30	29	13	
   18.64 +29	28	14	
   18.65 +28	27	15	
   18.66 +27	26	16	
   18.67 +26	25	17	
   18.68 +25	24	18	
   18.69 +24	23	19	
   18.70 +23	22	20	
   18.71 +22	21	21	
   18.72 +21	20	22	
   18.73 +20	19	23	
   18.74 +19	18	24	
   18.75 +18	17	25	
   18.76 +17	16	26	
   18.77 +16	15	27	
   18.78 +15	14	28	
   18.79 +14	13	29	
   18.80 +13	12	30	
   18.81 +12	11	31	
   18.82 +11	10	32	
   18.83 +10	9	33	
   18.84 +9	8	34	
   18.85 +8	7	35	
   18.86 +7	6	36	
   18.87 +6	5	37	
   18.88 +5	4	38	
   18.89 +4	3	39	
   18.90 +3	2	40	
   18.91 +2	1	41	
   18.92 +
   18.93 +@gui
   18.94 +<arrow_pos>
   18.95 + <item>
   18.96 +  <first>1</first>
   18.97 +  <second>
   18.98 +   <x>400.5</x><y>225.5</y>
   18.99 +  </second>
  18.100 + </item>
  18.101 + <item>
  18.102 +  <first>2</first>
  18.103 +  <second>
  18.104 +   <x>342</x><y>194.5</y>
  18.105 +  </second>
  18.106 + </item>
  18.107 + <item>
  18.108 +  <first>3</first>
  18.109 +  <second>
  18.110 +   <x>285</x><y>164</y>
  18.111 +  </second>
  18.112 + </item>
  18.113 + <item>
  18.114 +  <first>4</first>
  18.115 +  <second>
  18.116 +   <x>225.5</x><y>140</y>
  18.117 +  </second>
  18.118 + </item>
  18.119 + <item>
  18.120 +  <first>5</first>
  18.121 +  <second>
  18.122 +   <x>168</x><y>147.5</y>
  18.123 +  </second>
  18.124 + </item>
  18.125 + <item>
  18.126 +  <first>6</first>
  18.127 +  <second>
  18.128 +   <x>120.5</x><y>178</y>
  18.129 +  </second>
  18.130 + </item>
  18.131 + <item>
  18.132 +  <first>7</first>
  18.133 +  <second>
  18.134 +   <x>73.5</x><y>196</y>
  18.135 +  </second>
  18.136 + </item>
  18.137 + <item>
  18.138 +  <first>8</first>
  18.139 +  <second>
  18.140 +   <x>23.5</x><y>183</y>
  18.141 +  </second>
  18.142 + </item>
  18.143 + <item>
  18.144 +  <first>9</first>
  18.145 +  <second>
  18.146 +   <x>-23</x><y>151.5</y>
  18.147 +  </second>
  18.148 + </item>
  18.149 + <item>
  18.150 +  <first>10</first>
  18.151 +  <second>
  18.152 +   <x>-75</x><y>130</y>
  18.153 +  </second>
  18.154 + </item>
  18.155 + <item>
  18.156 +  <first>11</first>
  18.157 +  <second>
  18.158 +   <x>-134</x><y>140</y>
  18.159 +  </second>
  18.160 + </item>
  18.161 + <item>
  18.162 +  <first>12</first>
  18.163 +  <second>
  18.164 +   <x>-196.5</x><y>170</y>
  18.165 +  </second>
  18.166 + </item>
  18.167 + <item>
  18.168 +  <first>13</first>
  18.169 +  <second>
  18.170 +   <x>-264</x><y>183.5</y>
  18.171 +  </second>
  18.172 + </item>
  18.173 + <item>
  18.174 +  <first>14</first>
  18.175 +  <second>
  18.176 +   <x>-317</x><y>163</y>
  18.177 +  </second>
  18.178 + </item>
  18.179 + <item>
  18.180 +  <first>15</first>
  18.181 +  <second>
  18.182 +   <x>-345</x><y>118.5</y>
  18.183 +  </second>
  18.184 + </item>
  18.185 + <item>
  18.186 +  <first>16</first>
  18.187 +  <second>
  18.188 +   <x>-351.5</x><y>64.5</y>
  18.189 +  </second>
  18.190 + </item>
  18.191 + <item>
  18.192 +  <first>17</first>
  18.193 +  <second>
  18.194 +   <x>-325.5</x><y>17.5</y>
  18.195 +  </second>
  18.196 + </item>
  18.197 + <item>
  18.198 +  <first>18</first>
  18.199 +  <second>
  18.200 +   <x>-279</x><y>-16</y>
  18.201 +  </second>
  18.202 + </item>
  18.203 + <item>
  18.204 +  <first>19</first>
  18.205 +  <second>
  18.206 +   <x>-224</x><y>-28</y>
  18.207 +  </second>
  18.208 + </item>
  18.209 + <item>
  18.210 +  <first>20</first>
  18.211 +  <second>
  18.212 +   <x>-165</x><y>-14.5</y>
  18.213 +  </second>
  18.214 + </item>
  18.215 + <item>
  18.216 +  <first>21</first>
  18.217 +  <second>
  18.218 +   <x>-105</x><y>0</y>
  18.219 +  </second>
  18.220 + </item>
  18.221 + <item>
  18.222 +  <first>22</first>
  18.223 +  <second>
  18.224 +   <x>-40</x><y>3</y>
  18.225 +  </second>
  18.226 + </item>
  18.227 + <item>
  18.228 +  <first>23</first>
  18.229 +  <second>
  18.230 +   <x>31</x><y>1</y>
  18.231 +  </second>
  18.232 + </item>
  18.233 + <item>
  18.234 +  <first>24</first>
  18.235 +  <second>
  18.236 +   <x>106</x><y>-1</y>
  18.237 +  </second>
  18.238 + </item>
  18.239 + <item>
  18.240 +  <first>25</first>
  18.241 +  <second>
  18.242 +   <x>180</x><y>2.5</y>
  18.243 +  </second>
  18.244 + </item>
  18.245 + <item>
  18.246 +  <first>26</first>
  18.247 +  <second>
  18.248 +   <x>249</x><y>18.5</y>
  18.249 +  </second>
  18.250 + </item>
  18.251 + <item>
  18.252 +  <first>27</first>
  18.253 +  <second>
  18.254 +   <x>309.5</x><y>50</y>
  18.255 +  </second>
  18.256 + </item>
  18.257 + <item>
  18.258 +  <first>28</first>
  18.259 +  <second>
  18.260 +   <x>377</x><y>64</y>
  18.261 +  </second>
  18.262 + </item>
  18.263 + <item>
  18.264 +  <first>29</first>
  18.265 +  <second>
  18.266 +   <x>431.5</x><y>31</y>
  18.267 +  </second>
  18.268 + </item>
  18.269 + <item>
  18.270 +  <first>30</first>
  18.271 +  <second>
  18.272 +   <x>440</x><y>-25</y>
  18.273 +  </second>
  18.274 + </item>
  18.275 + <item>
  18.276 +  <first>31</first>
  18.277 +  <second>
  18.278 +   <x>397.5</x><y>-70.5</y>
  18.279 +  </second>
  18.280 + </item>
  18.281 + <item>
  18.282 +  <first>32</first>
  18.283 +  <second>
  18.284 +   <x>330</x><y>-100.5</y>
  18.285 +  </second>
  18.286 + </item>
  18.287 + <item>
  18.288 +  <first>33</first>
  18.289 +  <second>
  18.290 +   <x>263.5</x><y>-125.5</y>
  18.291 +  </second>
  18.292 + </item>
  18.293 + <item>
  18.294 +  <first>34</first>
  18.295 +  <second>
  18.296 +   <x>192</x><y>-144.5</y>
  18.297 +  </second>
  18.298 + </item>
  18.299 + <item>
  18.300 +  <first>35</first>
  18.301 +  <second>
  18.302 +   <x>115.5</x><y>-153</y>
  18.303 +  </second>
  18.304 + </item>
  18.305 + <item>
  18.306 +  <first>36</first>
  18.307 +  <second>
  18.308 +   <x>36.5</x><y>-155</y>
  18.309 +  </second>
  18.310 + </item>
  18.311 + <item>
  18.312 +  <first>37</first>
  18.313 +  <second>
  18.314 +   <x>-43.5</x><y>-152</y>
  18.315 +  </second>
  18.316 + </item>
  18.317 + <item>
  18.318 +  <first>38</first>
  18.319 +  <second>
  18.320 +   <x>-122</x><y>-147.5</y>
  18.321 +  </second>
  18.322 + </item>
  18.323 + <item>
  18.324 +  <first>39</first>
  18.325 +  <second>
  18.326 +   <x>-194.5</x><y>-143</y>
  18.327 +  </second>
  18.328 + </item>
  18.329 + <item>
  18.330 +  <first>40</first>
  18.331 +  <second>
  18.332 +   <x>-263.5</x><y>-137.5</y>
  18.333 +  </second>
  18.334 + </item>
  18.335 + <item>
  18.336 +  <first>41</first>
  18.337 +  <second>
  18.338 +   <x>-327.5</x><y>-131.5</y>
  18.339 +  </second>
  18.340 + </item>
  18.341 +</arrow_pos>
  18.342 +<active_nodemaps>
  18.343 + <item>
  18.344 +  <first>0</first>
  18.345 +  <second></second>
  18.346 + </item>
  18.347 + <item>
  18.348 +  <first>1</first>
  18.349 +  <second>label</second>
  18.350 + </item>
  18.351 + <item>
  18.352 +  <first>2</first>
  18.353 +  <second></second>
  18.354 + </item>
  18.355 +</active_nodemaps>
  18.356 +<active_edgemaps>
  18.357 + <item>
  18.358 +  <first>0</first>
  18.359 +  <second></second>
  18.360 + </item>
  18.361 + <item>
  18.362 +  <first>1</first>
  18.363 +  <second>label</second>
  18.364 + </item>
  18.365 + <item>
  18.366 +  <first>2</first>
  18.367 +  <second></second>
  18.368 + </item>
  18.369 +</active_edgemaps>
  18.370 +<redesign-attraction>0.05</redesign-attraction>
  18.371 +<redesign-propulsation>40000</redesign-propulsation>
  18.372 +<redesign-iteration>20</redesign-iteration>
  18.373 +@end
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/configure.ac	Mon Jul 07 08:10:39 2008 -0500
    19.3 @@ -0,0 +1,76 @@
    19.4 +dnl Process this file with autoconf to produce a configure script.
    19.5 +
    19.6 +dnl Version information.
    19.7 +m4_define([glemon_version_major], [0])
    19.8 +m4_define([glemon_version_minor], [5])
    19.9 +m4_define([glemon_version_micro], [90])
   19.10 +m4_define([glemon_version_nano], [])
   19.11 +m4_define([glemon_version_tag], [svn])
   19.12 +m4_define([glemon_svn_revision], [m4_normalize(esyscmd([svn info |grep ^Revision |cut -d ' ' -f 2]))])
   19.13 +m4_define([glemon_version], [glemon_version_major().glemon_version_minor()ifelse(glemon_version_micro(), [], [], [.glemon_version_micro()])ifelse(glemon_version_nano(), [], [], [.glemon_version_nano()])ifelse(glemon_version_tag(), [], [], glemon_version_tag(), [svn], [[_]glemon_version_tag()[]glemon_svn_revision()], [[_]glemon_version_tag()])])
   19.14 +
   19.15 +AC_PREREQ([2.59])
   19.16 +AC_INIT([gLEMON], [glemon_version()], [etik-ol@cs.elte.hu], [glemon])
   19.17 +AC_CONFIG_AUX_DIR([build-aux])
   19.18 +AC_CONFIG_MACRO_DIR([m4])
   19.19 +AM_INIT_AUTOMAKE([-Wall -Werror foreign])
   19.20 +AC_CONFIG_SRCDIR([main_win.h])
   19.21 +AC_CONFIG_HEADERS([config.h])
   19.22 +
   19.23 +dnl Checks for programs.
   19.24 +AC_PROG_CXX
   19.25 +AC_PROG_CC
   19.26 +AM_GNU_GETTEXT_VERSION([0.14.2])
   19.27 +AM_GNU_GETTEXT([external])
   19.28 +
   19.29 +dnl Checks for libraries.
   19.30 +PKG_CHECK_MODULES([GTK], [libgnomecanvasmm-2.6 >= 2.6.0 gtkmm-2.4 >= 2.6])
   19.31 +
   19.32 +AC_ARG_WITH([lemon],
   19.33 +AS_HELP_STRING([--with-lemon@<:@=PREFIX@:>@], [search for LEMON under PREFIX]), [], [with_lemon=no])
   19.34 +if test x"$with_lemon" != x"no"; then
   19.35 +  export PKG_CONFIG_PATH="$with_lemon/lib/pkgconfig/:$PKG_CONFIG_PATH"
   19.36 +fi
   19.37 +
   19.38 +PKG_CHECK_MODULES([LEMON], [lemon >= 0.6.90])
   19.39 +
   19.40 +dnl Checks for header files.
   19.41 +AC_CHECK_HEADERS([libintl.h locale.h])
   19.42 +
   19.43 +dnl Checks for typedefs, structures, and compiler characteristics.
   19.44 +AC_HEADER_STDBOOL
   19.45 +AC_C_CONST
   19.46 +
   19.47 +dnl Checks for library functions.
   19.48 +AC_CHECK_FUNCS([setlocale sqrt])
   19.49 +
   19.50 +AC_CONFIG_FILES([
   19.51 +Makefile
   19.52 +glemon.spec
   19.53 +autopackage/default.apspec
   19.54 +po/Makefile.in
   19.55 +m4/Makefile
   19.56 +])
   19.57 +
   19.58 +AC_OUTPUT
   19.59 +
   19.60 +echo
   19.61 +echo '****************************** SUMMARY ******************************'
   19.62 +echo
   19.63 +echo Package version............... : $PACKAGE-$VERSION
   19.64 +echo
   19.65 +echo C++ compiler.................. : $CXX
   19.66 +echo C++ compiles flags............ : $CXXFLAGS
   19.67 +echo
   19.68 +echo LEMON CFLAGS.................. : $LEMON_CFLAGS
   19.69 +echo LEMON LIBS.................... : $LEMON_LIBS
   19.70 +echo
   19.71 +echo The packace will be installed in
   19.72 +echo -n '  '
   19.73 +echo $prefix.
   19.74 +echo
   19.75 +echo '*********************************************************************'
   19.76 +
   19.77 +echo
   19.78 +echo configure complete, now type \'make\' and then \'make install\'.
   19.79 +echo
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/design_win.cc	Mon Jul 07 08:10:39 2008 -0500
    20.3 @@ -0,0 +1,98 @@
    20.4 +/* -*- C++ -*-
    20.5 + *
    20.6 + * This file is a part of LEMON, a generic C++ optimization library
    20.7 + *
    20.8 + * Copyright (C) 2003-2006
    20.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
   20.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
   20.11 + *
   20.12 + * Permission to use, modify and distribute this software is granted
   20.13 + * provided that this copyright notice appears in all copies. For
   20.14 + * precise terms see the accompanying LICENSE file.
   20.15 + *
   20.16 + * This software is provided "AS IS" with no warranty of any kind,
   20.17 + * express or implied, and with no claim as to its suitability for any
   20.18 + * purpose.
   20.19 + *
   20.20 + */
   20.21 +
   20.22 +#include <design_win.h>
   20.23 +
   20.24 +bool DesignWin::closeIfEscapeIsPressed(GdkEventKey* e)
   20.25 +{
   20.26 +  if(e->keyval==GDK_Escape)
   20.27 +  {
   20.28 +    on_hide();
   20.29 +  }
   20.30 +  return true;
   20.31 +}
   20.32 +
   20.33 +DesignWin::DesignWin(const std::string& title, double attraction_v, double propulsation_v, int iterations_v)
   20.34 +{
   20.35 +  set_title(title);
   20.36 +
   20.37 +  //mytab.signal_title_ch().connect(sigc::mem_fun(*this, &DesignWin::set_title));
   20.38 +
   20.39 +  signal_key_press_event().connect(sigc::mem_fun(*this, &DesignWin::closeIfEscapeIsPressed));
   20.40 +
   20.41 +  Gtk::VBox * vbox=new Gtk::VBox();
   20.42 +  vbox->set_spacing(5);
   20.43 +
   20.44 +  Gtk::Label * attraction_label=new Gtk::Label("Arc elasticity: ");
   20.45 +  Gtk::Label * propulsation_label=new Gtk::Label("Node propulsation: ");
   20.46 +  Gtk::Label * iteration_label=new Gtk::Label("Iteration number: ");
   20.47 +
   20.48 +  Gtk::Adjustment * attraction_adjustment=new Gtk::Adjustment(attraction_v, 0,1,0.01,0.1);
   20.49 +  Gtk::Adjustment * propulsation_adjustment=new Gtk::Adjustment(propulsation_v,0,1000000,1000,10000);
   20.50 +  Gtk::Adjustment * iteration_adjustment=new Gtk::Adjustment(iterations_v,1,20000,5,10);
   20.51 +
   20.52 +  attraction = new Gtk::SpinButton(*attraction_adjustment,5,3);
   20.53 +  propulsation = new Gtk::SpinButton(*propulsation_adjustment,5,0);
   20.54 +  iteration = new Gtk::SpinButton(*iteration_adjustment,5,0);
   20.55 +
   20.56 +  close_button=new Gtk::Button("Redesign");
   20.57 +
   20.58 +  attraction->signal_value_changed().connect(sigc::mem_fun(*this, &DesignWin::emit_attraction));
   20.59 +  propulsation->signal_value_changed().connect(sigc::mem_fun(*this, &DesignWin::emit_propulsation));
   20.60 +  iteration->signal_value_changed().connect(sigc::mem_fun(*this, &DesignWin::emit_iteration));
   20.61 +  close_button->signal_pressed().connect(sigc::mem_fun(*this, &DesignWin::emit_closerun));
   20.62 +
   20.63 +  table.attach(*attraction_label,0,1,0,1);
   20.64 +  table.attach(*propulsation_label,0,1,1,2);
   20.65 +  table.attach(*iteration_label,0,1,2,3);
   20.66 +  table.attach(*attraction,1,2,0,1);
   20.67 +  table.attach(*propulsation,1,2,1,2);
   20.68 +  table.attach(*iteration,1,2,2,3);
   20.69 +  table.attach(*close_button,0,2,3,4);
   20.70 +
   20.71 +  add(table);
   20.72 +
   20.73 +  show_all_children();
   20.74 +};
   20.75 +
   20.76 +void DesignWin::emit_attraction()
   20.77 +{
   20.78 +  signal_attraction_ch.emit(attraction->get_value());
   20.79 +}
   20.80 +
   20.81 +void DesignWin::emit_propulsation()
   20.82 +{
   20.83 +  signal_propulsation_ch.emit(propulsation->get_value());
   20.84 +}
   20.85 +
   20.86 +void DesignWin::emit_iteration()
   20.87 +{
   20.88 +  signal_iteration_ch.emit((int)iteration->get_value());
   20.89 +}
   20.90 +
   20.91 +void DesignWin::set_title(std::string tabname)
   20.92 +{
   20.93 +  Gtk::Window::set_title("Design Setup - "+tabname);
   20.94 +}
   20.95 +
   20.96 +void DesignWin::set_data(double attr, double propuls, int it)
   20.97 +{
   20.98 +  attraction->set_value(attr);
   20.99 +  propulsation->set_value(propuls);
  20.100 +  iteration->set_value(it);
  20.101 +}
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/design_win.h	Mon Jul 07 08:10:39 2008 -0500
    21.3 @@ -0,0 +1,63 @@
    21.4 +/* -*- C++ -*-
    21.5 + *
    21.6 + * This file is a part of LEMON, a generic C++ optimization library
    21.7 + *
    21.8 + * Copyright (C) 2003-2006
    21.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
   21.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
   21.11 + *
   21.12 + * Permission to use, modify and distribute this software is granted
   21.13 + * provided that this copyright notice appears in all copies. For
   21.14 + * precise terms see the accompanying LICENSE file.
   21.15 + *
   21.16 + * This software is provided "AS IS" with no warranty of any kind,
   21.17 + * express or implied, and with no claim as to its suitability for any
   21.18 + * purpose.
   21.19 + *
   21.20 + */
   21.21 +
   21.22 +#ifndef DESWIN_H
   21.23 +#define DESWIN_H
   21.24 +
   21.25 +#include <all_include.h>
   21.26 +#include <libgnomecanvasmm.h>
   21.27 +#include <libgnomecanvasmm/polygon.h>
   21.28 +
   21.29 +class DesignWin : public Gtk::Window
   21.30 +{
   21.31 +private:
   21.32 +  Gtk::SpinButton * attraction;
   21.33 +  Gtk::SpinButton * propulsation;
   21.34 +  Gtk::SpinButton * iteration;
   21.35 +  Gtk::Table table;
   21.36 +  Gtk::Button * close_button;
   21.37 +
   21.38 +  sigc::signal<void, double> signal_attraction_ch;
   21.39 +  sigc::signal<void, double> signal_propulsation_ch;
   21.40 +  sigc::signal<void, int> signal_iteration_ch;
   21.41 +  sigc::signal<void> close_run_pr;
   21.42 +
   21.43 +  void emit_attraction();
   21.44 +  void emit_propulsation();
   21.45 +  void emit_iteration();
   21.46 +  void emit_closerun(){close_run_pr.emit();};
   21.47 +
   21.48 +public:
   21.49 +  ///Close window if escape key is pressed.
   21.50 +  bool closeIfEscapeIsPressed(GdkEventKey* e);
   21.51 +
   21.52 +  ///Constructor
   21.53 +
   21.54 +  ///It builds the window.
   21.55 +  DesignWin(const std::string&, double, double, int);
   21.56 +
   21.57 +  sigc::signal<void, double> signal_attraction(){return signal_attraction_ch;};
   21.58 +  sigc::signal<void, double> signal_propulsation(){return signal_propulsation_ch;};
   21.59 +  sigc::signal<void, int> signal_iteration(){return signal_iteration_ch;};
   21.60 +  sigc::signal<void> close_run(){return close_run_pr;};
   21.61 +
   21.62 +  void set_title(std::string);
   21.63 +
   21.64 +  void set_data(double, double, int);
   21.65 +};
   21.66 +#endif //DESWIN_H
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/dijkstrabox.cc	Mon Jul 07 08:10:39 2008 -0500
    22.3 @@ -0,0 +1,247 @@
    22.4 +/* -*- C++ -*-
    22.5 + *
    22.6 + * This file is a part of LEMON, a generic C++ optimization library
    22.7 + *
    22.8 + * Copyright (C) 2003-2006
    22.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
   22.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
   22.11 + *
   22.12 + * Permission to use, modify and distribute this software is granted
   22.13 + * provided that this copyright notice appears in all copies. For
   22.14 + * precise terms see the accompanying LICENSE file.
   22.15 + *
   22.16 + * This software is provided "AS IS" with no warranty of any kind,
   22.17 + * express or implied, and with no claim as to its suitability for any
   22.18 + * purpose.
   22.19 + *
   22.20 + */
   22.21 +
   22.22 +#include <mapstorage.h>
   22.23 +#include <mapselector.h>
   22.24 +#include <algobox.h>
   22.25 +#include <dijkstrabox.h>
   22.26 +
   22.27 +#include <lemon/dijkstra.h>
   22.28 +
   22.29 +//No Suurballe in Lemon 1.0
   22.30 +//#include <lemon/suurballe.h>
   22.31 +#include <lemon/path.h>
   22.32 +
   22.33 +enum {INPUT, OUTPUT, MAP_NUM};
   22.34 +
   22.35 +DijkstraBox::DijkstraBox(std::vector<std::string> t):AlgoBox()
   22.36 +{
   22.37 +  init(t);
   22.38 +}
   22.39 +    
   22.40 +SuurballeBox::SuurballeBox(std::vector<std::string> t):DijkstraBox(t)
   22.41 +{
   22.42 +  Gtk::Adjustment * adjustment=new Gtk::Adjustment(2, 1, 20, 1, 5);
   22.43 +  num_set = new Gtk::SpinButton(*adjustment, 5,0);
   22.44 +
   22.45 +  Gtk::Label * label=new Gtk::Label("No. of paths to find: ");
   22.46 +//   hbox.pack_start(*label);
   22.47 +//   hbox.pack_start(*num_set);
   22.48 +//   hbox.show_all_children();
   22.49 +
   22.50 +  table.attach(*label, 0,1,2,3);
   22.51 +  table.attach(*num_set, 1,2,2,3);
   22.52 +
   22.53 +
   22.54 +//   pack_start(hbox);
   22.55 +}
   22.56 +    
   22.57 +void DijkstraBox::run()
   22.58 +{
   22.59 +  if(
   22.60 +      tabcbt.get_active_text()!="" &&
   22.61 +      (arcmapcbts[INPUT])->get_active_text()!="" &&
   22.62 +      (arcmapcbts[OUTPUT])->get_active_text()!="" &&
   22.63 +      source.get_active_text()!="" &&
   22.64 +      target.get_active_text()!=""
   22.65 +    )
   22.66 +  {
   22.67 +    const Digraph &g=mapstorage->digraph;
   22.68 +    Node from, to;
   22.69 +
   22.70 +    get_from_to(from, to, (Digraph&)g);
   22.71 +
   22.72 +    std::ostringstream o;
   22.73 +
   22.74 +    if(!(from==to))
   22.75 +    {
   22.76 +      std::string inputmapName = arcmapcbts[INPUT]->get_active_text();
   22.77 +      std::string outputmapName = arcmapcbts[OUTPUT]->get_active_text();
   22.78 +
   22.79 +      MapStorage::NumericArcMap& inputmap = mapstorage->getNumericArcMap(inputmapName);
   22.80 +      MapStorage::NumericArcMap& outputmap = mapstorage->getNumericArcMap(outputmapName);
   22.81 +
   22.82 +      //zero out output map
   22.83 +      for (ArcIt i(g); i!=INVALID; ++i)
   22.84 +      {
   22.85 +        outputmap[i]=0;
   22.86 +      }
   22.87 +
   22.88 +      Dijkstra<Digraph, MapStorage::NumericArcMap > dijkstra(g, inputmap);
   22.89 +      dijkstra.run(from, to);
   22.90 +
   22.91 +      if(dijkstra.reached(to))
   22.92 +      {
   22.93 +        Node n=to;
   22.94 +        int length=0;
   22.95 +        while (n!=INVALID && n!=from)
   22.96 +        {
   22.97 +          Arc e=dijkstra.predArc(n);
   22.98 +          outputmap[e]=1;
   22.99 +          n=dijkstra.predNode(n);
  22.100 +          length++;
  22.101 +        }
  22.102 +        o << "Result: " << length << " long path, with cost " << dijkstra.dist(to);
  22.103 +      }
  22.104 +      else
  22.105 +      {
  22.106 +        o << "Result: failed to find shortest path between ";
  22.107 +        o << source.get_active_text() << " and " << target.get_active_text();
  22.108 +      }
  22.109 +      resultlabel.set_text(o.str());
  22.110 +
  22.111 +      mapstorage->mapChanged(true, (arcmapcbts[OUTPUT])->get_active_text());
  22.112 +      //   mapstorage->changeActiveMap(true, E_COLOR,
  22.113 +      // 			      (arcmapcbts[OUTPUT])->get_active_text());
  22.114 +      //   mapstorage->changeActiveMap(true, E_TEXT,
  22.115 +      // 			      (arcmapcbts[INPUT])->get_active_text());
  22.116 +    }
  22.117 +  }
  22.118 +}
  22.119 +
  22.120 +void SuurballeBox::run()
  22.121 +{
  22.122 +  if(
  22.123 +     tabcbt.get_active_text()!="" &&
  22.124 +     (arcmapcbts[INPUT])->get_active_text()!="" &&
  22.125 +     (arcmapcbts[OUTPUT])->get_active_text()!="" &&
  22.126 +     source.get_active_text()!="" &&
  22.127 +     target.get_active_text()!=""
  22.128 +     )
  22.129 +    {
  22.130 +      const Digraph &g=mapstorage->digraph;
  22.131 +      Node from, to;
  22.132 +
  22.133 +      get_from_to(from, to, (Digraph&)g);
  22.134 +
  22.135 +      std::ostringstream o;
  22.136 +
  22.137 +      if(!(from==to))
  22.138 +	{
  22.139 +          MapStorage::NumericArcMap& inputmap=
  22.140 +	    mapstorage->getNumericArcMap(arcmapcbts[INPUT]->get_active_text());
  22.141 +          MapStorage::NumericArcMap& outputmap=
  22.142 +	    mapstorage->getNumericArcMap(arcmapcbts[OUTPUT]->get_active_text());
  22.143 +
  22.144 +	  //zero out output map
  22.145 +	  for (ArcIt i(g); i!=INVALID; ++i)
  22.146 +	    {
  22.147 +	      outputmap[i]=0;
  22.148 +	    }
  22.149 +	  
  22.150 +	  //No Suurballe in Lemon 1.0
  22.151 +	  //Suurballe<Digraph, MapStorage::NumericArcMap > sb((Digraph&)g, inputmap, from, to);
  22.152 +	  
  22.153 +	  int found=0;
  22.154 +	  //No Suurballe in Lemon 1.0
  22.155 +	  //found=sb.run(num_set->get_value_as_int());
  22.156 +	  if(found)
  22.157 +	    {
  22.158 +	      for(int j=0;j<found;j++)
  22.159 +		{
  22.160 +		  Path<Digraph> path;
  22.161 +		  //No Suurballe in Lemon 1.0
  22.162 +		  //path=sb.path(j);
  22.163 +		  for(int k=0;k<path.length();k++)
  22.164 +		    {
  22.165 +		      outputmap[path.nth(k)]=j+1;
  22.166 +		    }
  22.167 +		}
  22.168 +	      o << "Result: found " << found << " paths between ";
  22.169 +	      o << source.get_active_text() << " and " << target.get_active_text();
  22.170 +	    }
  22.171 +	  else
  22.172 +	    {
  22.173 +	      o << "Result: failed to find shortest path between ";
  22.174 +	      o << source.get_active_text() << " and " << target.get_active_text();
  22.175 +	    }
  22.176 +	  resultlabel.set_text(o.str());
  22.177 +	  
  22.178 +	  mapstorage->mapChanged(true, (arcmapcbts[OUTPUT])->get_active_text());
  22.179 +	  //   mapstorage->changeActiveMap(true, E_COLOR,
  22.180 +	  // 			      (arcmapcbts[OUTPUT])->get_active_text());
  22.181 +	  //   mapstorage->changeActiveMap(true, E_TEXT,
  22.182 +	  // 			      (arcmapcbts[INPUT])->get_active_text());
  22.183 +	}
  22.184 +    }
  22.185 +}
  22.186 +    
  22.187 +void DijkstraBox::build_box()
  22.188 +{
  22.189 +  //if active tab is changed, labels of digraph nodes had to be loaded into comboboxes
  22.190 +  //this can be done after the maps are loaded into ComboBoxes
  22.191 +  signal_upon_maplist_updated().connect(sigc::mem_fun(*this, &DijkstraBox::maplists_updated));
  22.192 +
  22.193 +  addMapSelector("Cost map: ", true, NUM);
  22.194 +  addMapSelector("Arcs of path here: ", true, NUM);
  22.195 +
  22.196 +  Gtk::Label * source_label=new Gtk::Label("Source: ");
  22.197 +  Gtk::Label * target_label=new Gtk::Label("Target: ");
  22.198 +
  22.199 +  table.attach(*source_label, 0,1,0,1);
  22.200 +  table.attach(*target_label, 0,1,1,2);
  22.201 +  table.attach(source, 1,2,0,1);
  22.202 +  table.attach(target, 1,2,1,2);
  22.203 +
  22.204 +
  22.205 +  pack_start(table);
  22.206 +
  22.207 +  resultlabel.set_text("Result: algorithm is not run yet.");
  22.208 +  pack_start(resultlabel);
  22.209 +}
  22.210 +
  22.211 +void SuurballeBox::build_box()
  22.212 +{
  22.213 +}
  22.214 +
  22.215 +void DijkstraBox::maplists_updated()
  22.216 +{
  22.217 +  if(tabcbt.get_active_text()!="")
  22.218 +    {
  22.219 +      source.clear();
  22.220 +      target.clear();
  22.221 +      const Digraph &g=mapstorage->digraph;
  22.222 +      for (NodeIt i(g); i!=INVALID; ++i)
  22.223 +	{
  22.224 +	  std::ostringstream text;
  22.225 +	  text << mapstorage->getLabel(i);
  22.226 +	  source.prepend_text(text.str());
  22.227 +	  target.prepend_text(text.str());
  22.228 +	}
  22.229 +    }
  22.230 +}
  22.231 +
  22.232 +void DijkstraBox::get_from_to(Node & from, Node & to, Digraph & g)
  22.233 +{
  22.234 +  int assigned=0;
  22.235 +  for (NodeIt i(g); (i!=INVALID) && (assigned<2); ++i)
  22.236 +    {
  22.237 +      std::ostringstream text;
  22.238 +      text << mapstorage->getLabel(i);
  22.239 +      if(!(text.str().compare(source.get_active_text())))
  22.240 +	{
  22.241 +	  from=i;
  22.242 +	  assigned++;
  22.243 +	}
  22.244 +      if(!(text.str().compare(target.get_active_text())))
  22.245 +	{
  22.246 +	  to=i;
  22.247 +	  assigned++;
  22.248 +	}
  22.249 +    }
  22.250 +}
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/dijkstrabox.h	Mon Jul 07 08:10:39 2008 -0500
    23.3 @@ -0,0 +1,91 @@
    23.4 +/* -*- C++ -*-
    23.5 + *
    23.6 + * This file is a part of LEMON, a generic C++ optimization library
    23.7 + *
    23.8 + * Copyright (C) 2003-2006
    23.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
   23.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
   23.11 + *
   23.12 + * Permission to use, modify and distribute this software is granted
   23.13 + * provided that this copyright notice appears in all copies. For
   23.14 + * precise terms see the accompanying LICENSE file.
   23.15 + *
   23.16 + * This software is provided "AS IS" with no warranty of any kind,
   23.17 + * express or implied, and with no claim as to its suitability for any
   23.18 + * purpose.
   23.19 + *
   23.20 + */
   23.21 +
   23.22 +#ifndef DIJKSTRABOX_H
   23.23 +#define DIJKSTRABOX_H
   23.24 +
   23.25 +class AlgoBox;
   23.26 +
   23.27 +#include <all_include.h>
   23.28 +#include <libgnomecanvasmm.h>
   23.29 +#include <libgnomecanvasmm/polygon.h>
   23.30 +
   23.31 +///Digraphical interface to run Dijkstra algorithm.
   23.32 +
   23.33 +///Child of \ref AlgoBox,
   23.34 +///therefore the only task to do at implementation was to
   23.35 +///
   23.36 +///-call init function with correct parameters from correctly parametrized constructor
   23.37 +///
   23.38 +///-implement \ref build_box function
   23.39 +///
   23.40 +///-implement \ref run function
   23.41 +class DijkstraBox : public AlgoBox
   23.42 +{
   23.43 +protected:
   23.44 +  ///Shows result of Dijkstra algorithm
   23.45 +  Gtk::Label resultlabel;
   23.46 +
   23.47 +
   23.48 +  ///Table for nodeselector widgets
   23.49 +  Gtk::Table table;
   23.50 +
   23.51 +  ///Combobox for select source node
   23.52 +  Gtk::ComboBoxText source;
   23.53 +
   23.54 +  ///Combobox for select target node
   23.55 +  Gtk::ComboBoxText target;
   23.56 +
   23.57 +  ///Gets to and from node from combobox
   23.58 +  void get_from_to(Node &, Node &, Digraph &);
   23.59 +
   23.60 +public:
   23.61 +  ///Calls \ref AlgoBox::init function to initialize class properly, automatically.
   23.62 +  DijkstraBox(std::vector<std::string> t);
   23.63 +
   23.64 +  ///Prepare, run and postprocess Dijkstra algorithm.
   23.65 +
   23.66 +  ///\ref glemon works only with maps filled with double values
   23.67 +  ///at the moment. While Dijkstra nedds a bool map as output.
   23.68 +  ///As postprocess this bool map should be transformed to
   23.69 +  ///double map.
   23.70 +  virtual void run();
   23.71 +
   23.72 +  ///Builds the digraphical design of the interface.
   23.73 +  virtual void build_box();
   23.74 +
   23.75 +  void maplists_updated();
   23.76 +};
   23.77 +
   23.78 +class SuurballeBox : public DijkstraBox
   23.79 +{
   23.80 +  ///number of paths to find
   23.81 +  int num;
   23.82 +  
   23.83 +  ///Widget to set numbewr of paths to find
   23.84 +  Gtk::SpinButton * num_set;
   23.85 +
   23.86 +  ///Holder widget
   23.87 +  Gtk::HBox hbox;
   23.88 +
   23.89 +public:
   23.90 +  SuurballeBox(std::vector<std::string> t);
   23.91 +  void run();
   23.92 +  void build_box();
   23.93 +};
   23.94 +#endif //DIJKSTRABOX_H
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/eps_win.cc	Mon Jul 07 08:10:39 2008 -0500
    24.3 @@ -0,0 +1,110 @@
    24.4 +/* -*- C++ -*-
    24.5 + *
    24.6 + * This file is a part of LEMON, a generic C++ optimization library
    24.7 + *
    24.8 + * Copyright (C) 2003-2006
    24.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
   24.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
   24.11 + *
   24.12 + * Permission to use, modify and distribute this software is granted
   24.13 + * provided that this copyright notice appears in all copies. For
   24.14 + * precise terms see the accompanying LICENSE file.
   24.15 + *
   24.16 + * This software is provided "AS IS" with no warranty of any kind,
   24.17 + * express or implied, and with no claim as to its suitability for any
   24.18 + * purpose.
   24.19 + *
   24.20 + */
   24.21 +
   24.22 +#include <eps_win.h>
   24.23 +
   24.24 +#include <mapselector.h>
   24.25 +
   24.26 +#include <set>
   24.27 +
   24.28 +bool EpsWin::closeIfEscapeIsPressed(GdkEventKey* e)
   24.29 +{
   24.30 +  if(e->keyval==GDK_Escape)
   24.31 +  {
   24.32 +    hide();
   24.33 +  }
   24.34 +  return true;
   24.35 +}
   24.36 +
   24.37 +EpsWin::EpsWin(const std::string& title, std::vector<std::string> n_nml, std::vector<std::string> s_nml):Gtk::Dialog(title, true, true)
   24.38 +{
   24.39 +  set_default_size(200, 50);
   24.40 +
   24.41 +  set_resizable(false);
   24.42 +
   24.43 +  signal_key_press_event().connect(sigc::mem_fun(*this, &EpsWin::closeIfEscapeIsPressed));
   24.44 +
   24.45 +  table=new Gtk::Table(EPS_PROPERTY_NUM, 1, false);
   24.46 +
   24.47 +  std::vector<std::string> labels;
   24.48 +  labels.resize(EPS_PROPERTY_NUM);
   24.49 +
   24.50 +  labels[N_MAPS]="Dump visualized nodemaps";
   24.51 +  labels[E_MAPS]="Dump visualizes arcmaps";
   24.52 +  labels[ARROWS]="Show arrows in directed digraphs";
   24.53 +  labels[PAR]="Indicate parallel arcs";
   24.54 +
   24.55 +  options.resize(EPS_PROPERTY_NUM);
   24.56 +
   24.57 +  for(int i=0;i<EPS_PROPERTY_NUM;i++)
   24.58 +    {
   24.59 +      options[i]=new Gtk::CheckButton(labels[i]);
   24.60 +      (*table).attach(*(options[i]),0,1,i,i+1,Gtk::FILL,Gtk::SHRINK,10,3);
   24.61 +    }
   24.62 +
   24.63 +  mapselector=new MapSelector(n_nml, s_nml, "", "Nodeshapes", false, true, NUM);
   24.64 +  mapselector->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &EpsWin::newMapWinNeeded));
   24.65 +
   24.66 +  hbox.pack_start(*(new Gtk::Label("Filename")));
   24.67 +  hbox.pack_start(name);
   24.68 +
   24.69 +  Gtk::VBox * vbox=get_vbox();
   24.70 +
   24.71 +  vbox->pack_start(*table);
   24.72 +  vbox->pack_start(*mapselector);
   24.73 +  vbox->pack_start(hbox);
   24.74 +
   24.75 +  //OK button
   24.76 +  add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
   24.77 +  add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
   24.78 +
   24.79 +  show_all_children();
   24.80 +
   24.81 +}
   24.82 +
   24.83 +bool EpsWin::on_delete_event(GdkEventAny * event)
   24.84 +{
   24.85 +  event=event;
   24.86 +  signal_eps_close.emit();
   24.87 +  return true;
   24.88 +}
   24.89 +
   24.90 +void EpsWin::on_response(int response_id)
   24.91 +{
   24.92 +  if(response_id==Gtk::RESPONSE_OK)
   24.93 +    {
   24.94 +      std::vector <bool> values;
   24.95 +      values.resize(EPS_PROPERTY_NUM);
   24.96 +      for(int i=0;i<EPS_PROPERTY_NUM;i++)
   24.97 +	{
   24.98 +	  values[i]=options[i]->get_active();
   24.99 +	}
  24.100 +      signal_eps_details.emit(values, name.get_text(), mapselector->get_active_text());
  24.101 +    }
  24.102 +  on_delete_event(NULL);
  24.103 +}
  24.104 +
  24.105 +void EpsWin::newMapWinNeeded(bool isitarc)
  24.106 +{
  24.107 +  signal_new_map.emit(false);
  24.108 +}
  24.109 +
  24.110 +void EpsWin::registerNewNodeMap(std::string newmapname, MapValue::Type type)
  24.111 +{
  24.112 +    mapselector->append_text((Glib::ustring)newmapname, type);
  24.113 +}
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/eps_win.h	Mon Jul 07 08:10:39 2008 -0500
    25.3 @@ -0,0 +1,109 @@
    25.4 +/* -*- C++ -*-
    25.5 + *
    25.6 + * This file is a part of LEMON, a generic C++ optimization library
    25.7 + *
    25.8 + * Copyright (C) 2003-2006
    25.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
   25.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
   25.11 + *
   25.12 + * Permission to use, modify and distribute this software is granted
   25.13 + * provided that this copyright notice appears in all copies. For
   25.14 + * precise terms see the accompanying LICENSE file.
   25.15 + *
   25.16 + * This software is provided "AS IS" with no warranty of any kind,
   25.17 + * express or implied, and with no claim as to its suitability for any
   25.18 + * purpose.
   25.19 + *
   25.20 + */
   25.21 +
   25.22 +#ifndef EPS_WIN_H
   25.23 +#define EPS_WIN_H
   25.24 +
   25.25 +class MapSelector;
   25.26 +
   25.27 +#include <all_include.h>
   25.28 +#include <libgnomecanvasmm.h>
   25.29 +#include <libgnomecanvasmm/polygon.h>
   25.30 +#include "map_value.h"
   25.31 +
   25.32 +///Digraph visualization setup window.
   25.33 +
   25.34 +///This class is responsible for creating a window,
   25.35 +///on which the visualization attributes can be
   25.36 +///assigned to maps.
   25.37 +class EpsWin : public Gtk::Dialog
   25.38 +{
   25.39 +protected:
   25.40 +  ///Designing element
   25.41 +  Gtk::Table * table;
   25.42 +  
   25.43 +  ///Information holder
   25.44 +  Gtk::Label * label;
   25.45 +
   25.46 +  ///configuration
   25.47 +  std::vector<Gtk::CheckButton *> options;
   25.48 +
   25.49 +  ///OK, Cancel
   25.50 +  Gtk::Button * ok, * cancel;
   25.51 +
   25.52 +  ///Container in which filename entry are organized.
   25.53 +  Gtk::HBox hbox;
   25.54 +
   25.55 +  ///Filename
   25.56 +  Gtk::Entry name;
   25.57 +
   25.58 +  MapSelector * mapselector;
   25.59 +public:
   25.60 +  ///Constructor
   25.61 +
   25.62 +  ///It creates the widgets shown in \ref EpsWin and
   25.63 +  ///binds the needed signal to the correct place.
   25.64 +  ///\param title title of window
   25.65 +  ///\param eml arcmap list
   25.66 +  ///\param nml nodemap list
   25.67 +  ///\param mw the owner \ref NoteBookTab (\ref mytab)
   25.68 +  EpsWin(const std::string& title, std::vector<std::string>, std::vector<std::string>);
   25.69 +
   25.70 +  ///Deregistrates \ref EpsWin in its \ref NoteBookTab (\ref mytab)
   25.71 +  virtual bool on_delete_event(GdkEventAny *);
   25.72 +
   25.73 +  ///Close window if Esc key pressed.
   25.74 +  virtual bool closeIfEscapeIsPressed(GdkEventKey*);
   25.75 +
   25.76 +  ///Callback function for OK button. It creates the map.
   25.77 +  
   25.78 +  ///If OK is pressed this function
   25.79 +  ///transmits the collected data to
   25.80 +  ///appropriate functions to be able
   25.81 +  ///to create EPS
   25.82 +  virtual void on_response(int response_id);
   25.83 +
   25.84 +  ///indicates that user is ready to export EPS file
   25.85 +  sigc::signal<void, std::vector<bool>, std::string, std::string > signal_eps_details;
   25.86 +
   25.87 +  ///returns \ref signal_eps_details
   25.88 +  sigc::signal<void, std::vector<bool>, std::string, std::string > signal_eps_details_ch(){return signal_eps_details;};
   25.89 +
   25.90 +  ///indicates that the windows can be closed
   25.91 +  sigc::signal<void> signal_eps_close;
   25.92 +
   25.93 +  ///returns \ref signal_eps_close
   25.94 +  sigc::signal<void> signal_eps_close_ch(){return signal_eps_close;};
   25.95 +  
   25.96 +  ///indicates that the windows can be closed
   25.97 +  sigc::signal<void, bool> signal_new_map;
   25.98 +
   25.99 +  ///returns \ref signal_eps_close
  25.100 +  sigc::signal<void, bool> signal_new_map_ch(){return signal_new_map;};
  25.101 +
  25.102 +  ///Function is called when new map is required.
  25.103 +  void newMapWinNeeded(bool);
  25.104 +
  25.105 +  ///This function inserts name of the new nodemap in the name list in \ref MapSelector s
  25.106 +
  25.107 +  ///\param new_name
  25.108 +  ///name of new map
  25.109 +  void registerNewNodeMap(std::string new_name, MapValue::Type type);
  25.110 +};
  25.111 +
  25.112 +#endif //EPS_WIN_H
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/file_import_dialog.cc	Mon Jul 07 08:10:39 2008 -0500
    26.3 @@ -0,0 +1,928 @@
    26.4 +#include "file_import_dialog.h"
    26.5 +#include <gtkmm/dialog.h>
    26.6 +#include <gtkmm/stock.h>
    26.7 +#include <gtkmm/notebook.h>
    26.8 +#include <gtkmm/messagedialog.h>
    26.9 +#include <gtkmm/frame.h>
   26.10 +#include <iostream>
   26.11 +
   26.12 +FileImportDialog::FileImportDialog(ImportData* d) :
   26.13 +  p_data(d)
   26.14 +{
   26.15 +  add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
   26.16 +  add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
   26.17 +
   26.18 +  Gtk::VBox* pVBox = get_vbox();
   26.19 +
   26.20 +  Gtk::Notebook* nb = Gtk::manage(new Gtk::Notebook);
   26.21 +  pVBox->pack_start(*nb, Gtk::PACK_EXPAND_WIDGET);
   26.22 +
   26.23 +  Gtk::VBox* vblueMaps = Gtk::manage(new Gtk::VBox(false, 18));
   26.24 +  vblueMaps->set_border_width(12);
   26.25 +
   26.26 +  Gtk::VBox* vbArcMaps = Gtk::manage(new Gtk::VBox(false, 18));
   26.27 +  vbArcMaps->set_border_width(12);
   26.28 +
   26.29 +  Gtk::VBox* vbSpecMaps = Gtk::manage(new Gtk::VBox(false, 18));
   26.30 +  vbSpecMaps->set_border_width(12);
   26.31 +
   26.32 +  nb->append_page(*vbSpecMaps, "Special Maps");
   26.33 +  nb->append_page(*vblueMaps, "Node Maps");
   26.34 +  nb->append_page(*vbArcMaps, "Arc Maps");
   26.35 +
   26.36 +  // child widgets of vbSpecMaps
   26.37 +  {
   26.38 +    Gtk::VBox* box1 = Gtk::manage(new Gtk::VBox(false, 6));
   26.39 +    vbSpecMaps->pack_start(*box1, Gtk::PACK_SHRINK);
   26.40 +
   26.41 +    {
   26.42 +      Gtk::Label* label1 =
   26.43 +        Gtk::manage(new Gtk::Label("<b>Node Coordinates</b>"));
   26.44 +      label1->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER);
   26.45 +      label1->set_use_markup();
   26.46 +      box1->pack_start(*label1);
   26.47 +
   26.48 +      Gtk::HBox* box2 = Gtk::manage(new Gtk::HBox);
   26.49 +      box1->pack_start(*box2);
   26.50 +
   26.51 +      Gtk::Label* fill1 = Gtk::manage(new Gtk::Label("    "));
   26.52 +      box2->pack_start(*fill1, Gtk::PACK_SHRINK);
   26.53 +
   26.54 +      Gtk::VBox* box3 = Gtk::manage(new Gtk::VBox);
   26.55 +      box2->pack_start(*box3);
   26.56 +
   26.57 +      Gtk::VBox* box13 = Gtk::manage(new Gtk::VBox);
   26.58 +      box3->pack_start(*box13);
   26.59 +
   26.60 +      rblueCoordNone.set_label("None");
   26.61 +      Gtk::RadioButtonGroup group = rblueCoordNone.get_group();
   26.62 +      box13->pack_start(rblueCoordNone);
   26.63 +
   26.64 +      Gtk::VBox* box4 = Gtk::manage(new Gtk::VBox);
   26.65 +      box3->pack_start(*box4);
   26.66 +
   26.67 +      rblueCoordOneMap.set_label("One Map");
   26.68 +      rblueCoordOneMap.set_group(group);
   26.69 +      box4->pack_start(rblueCoordOneMap);
   26.70 +
   26.71 +      Gtk::HBox* box5 = Gtk::manage(new Gtk::HBox);
   26.72 +      box4->pack_start(*box5);
   26.73 +
   26.74 +      Gtk::Label* fill2 = Gtk::manage(new Gtk::Label("    "));
   26.75 +      box5->pack_start(*fill2, Gtk::PACK_SHRINK);
   26.76 +
   26.77 +      Gtk::VBox* box6 = Gtk::manage(new Gtk::VBox);
   26.78 +      box5->pack_start(*box6);
   26.79 +
   26.80 +      Gtk::HBox* box7 = Gtk::manage(new Gtk::HBox);
   26.81 +      box6->pack_start(*box7);
   26.82 +
   26.83 +      Gtk::Label* label2 = Gtk::manage(new Gtk::Label("(X, Y)"));
   26.84 +      box7->pack_start(*label2, Gtk::PACK_SHRINK, 4);
   26.85 +
   26.86 +      box7->pack_start(cblueCoordOneMap, Gtk::PACK_EXPAND_WIDGET);
   26.87 +
   26.88 +
   26.89 +      Gtk::VBox* box8 = Gtk::manage(new Gtk::VBox);
   26.90 +      box3->pack_start(*box8);
   26.91 +
   26.92 +      rblueCoordTwoMaps.set_label("Two Maps");
   26.93 +      rblueCoordTwoMaps.set_group(group);
   26.94 +      box8->pack_start(rblueCoordTwoMaps);
   26.95 +
   26.96 +      Gtk::HBox* box9 = Gtk::manage(new Gtk::HBox);
   26.97 +      box8->pack_start(*box9);
   26.98 +
   26.99 +      Gtk::Label* fill3 = Gtk::manage(new Gtk::Label("    "));
  26.100 +      box9->pack_start(*fill3, Gtk::PACK_SHRINK);
  26.101 +
  26.102 +      Gtk::VBox* box10 = Gtk::manage(new Gtk::VBox);
  26.103 +      box9->pack_start(*box10);
  26.104 +
  26.105 +      Gtk::HBox* box11 = Gtk::manage(new Gtk::HBox);
  26.106 +      box10->pack_start(*box11);
  26.107 +
  26.108 +      Gtk::Label* label3 = Gtk::manage(new Gtk::Label("X"));
  26.109 +      box11->pack_start(*label3, Gtk::PACK_SHRINK, 4);
  26.110 +
  26.111 +      box11->pack_start(cblueCoordTwoMaps1, Gtk::PACK_EXPAND_WIDGET);
  26.112 +
  26.113 +      Gtk::HBox* box12 = Gtk::manage(new Gtk::HBox);
  26.114 +      box10->pack_start(*box12);
  26.115 +
  26.116 +      Gtk::Label* label4 = Gtk::manage(new Gtk::Label("Y"));
  26.117 +      box12->pack_start(*label4, Gtk::PACK_SHRINK, 4);
  26.118 +
  26.119 +      box12->pack_start(cblueCoordTwoMaps2, Gtk::PACK_EXPAND_WIDGET);
  26.120 +
  26.121 +      cblueCoordOneMap.signal_changed().connect(
  26.122 +          sigc::mem_fun(*this, &FileImportDialog::onNodeCoordOneMapChanged));
  26.123 +      cblueCoordTwoMaps1.signal_changed().connect(
  26.124 +          sigc::mem_fun(*this, &FileImportDialog::onNodeCoordTwoMaps1Changed));
  26.125 +      cblueCoordTwoMaps2.signal_changed().connect(
  26.126 +          sigc::mem_fun(*this, &FileImportDialog::onNodeCoordTwoMaps2Changed));
  26.127 +    }
  26.128 +
  26.129 +    {
  26.130 +      Gtk::Label* label1 =
  26.131 +        Gtk::manage(new Gtk::Label("<b>Arrow Coordinates</b>"));
  26.132 +      label1->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER);
  26.133 +      label1->set_use_markup();
  26.134 +      box1->pack_start(*label1);
  26.135 +
  26.136 +      Gtk::HBox* box2 = Gtk::manage(new Gtk::HBox);
  26.137 +      box1->pack_start(*box2);
  26.138 +
  26.139 +      Gtk::Label* fill1 = Gtk::manage(new Gtk::Label("    "));
  26.140 +      box2->pack_start(*fill1, Gtk::PACK_SHRINK);
  26.141 +
  26.142 +      Gtk::VBox* box3 = Gtk::manage(new Gtk::VBox);
  26.143 +      box2->pack_start(*box3);
  26.144 +
  26.145 +      Gtk::VBox* box13 = Gtk::manage(new Gtk::VBox);
  26.146 +      box3->pack_start(*box13);
  26.147 +
  26.148 +      rbArrowCoordNone.set_label("None");
  26.149 +      Gtk::RadioButtonGroup group = rbArrowCoordNone.get_group();
  26.150 +      box13->pack_start(rbArrowCoordNone);
  26.151 +
  26.152 +      Gtk::VBox* box4 = Gtk::manage(new Gtk::VBox);
  26.153 +      box3->pack_start(*box4);
  26.154 +
  26.155 +      rbArrowCoordOneMap.set_label("One Map");
  26.156 +      rbArrowCoordOneMap.set_group(group);
  26.157 +      box4->pack_start(rbArrowCoordOneMap);
  26.158 +
  26.159 +      Gtk::HBox* box5 = Gtk::manage(new Gtk::HBox);
  26.160 +      box4->pack_start(*box5);
  26.161 +
  26.162 +      Gtk::Label* fill2 = Gtk::manage(new Gtk::Label("    "));
  26.163 +      box5->pack_start(*fill2, Gtk::PACK_SHRINK);
  26.164 +
  26.165 +      Gtk::VBox* box6 = Gtk::manage(new Gtk::VBox);
  26.166 +      box5->pack_start(*box6);
  26.167 +
  26.168 +      Gtk::HBox* box7 = Gtk::manage(new Gtk::HBox);
  26.169 +      box6->pack_start(*box7);
  26.170 +
  26.171 +      Gtk::Label* label2 = Gtk::manage(new Gtk::Label("(X, Y)"));
  26.172 +      box7->pack_start(*label2, Gtk::PACK_SHRINK, 4);
  26.173 +
  26.174 +      box7->pack_start(cbArrowCoordOneMap, Gtk::PACK_EXPAND_WIDGET);
  26.175 +
  26.176 +
  26.177 +      Gtk::VBox* box8 = Gtk::manage(new Gtk::VBox);
  26.178 +      box3->pack_start(*box8);
  26.179 +
  26.180 +      rbArrowCoordTwoMaps.set_label("Two Maps");
  26.181 +      rbArrowCoordTwoMaps.set_group(group);
  26.182 +      box8->pack_start(rbArrowCoordTwoMaps);
  26.183 +
  26.184 +      Gtk::HBox* box9 = Gtk::manage(new Gtk::HBox);
  26.185 +      box8->pack_start(*box9);
  26.186 +
  26.187 +      Gtk::Label* fill3 = Gtk::manage(new Gtk::Label("    "));
  26.188 +      box9->pack_start(*fill3, Gtk::PACK_SHRINK);
  26.189 +
  26.190 +      Gtk::VBox* box10 = Gtk::manage(new Gtk::VBox);
  26.191 +      box9->pack_start(*box10);
  26.192 +
  26.193 +      Gtk::HBox* box11 = Gtk::manage(new Gtk::HBox);
  26.194 +      box10->pack_start(*box11);
  26.195 +
  26.196 +      Gtk::Label* label3 = Gtk::manage(new Gtk::Label("X"));
  26.197 +      box11->pack_start(*label3, Gtk::PACK_SHRINK, 4);
  26.198 +
  26.199 +      box11->pack_start(cbArrowCoordTwoMaps1, Gtk::PACK_EXPAND_WIDGET);
  26.200 +
  26.201 +      Gtk::HBox* box12 = Gtk::manage(new Gtk::HBox);
  26.202 +      box10->pack_start(*box12);
  26.203 +
  26.204 +      Gtk::Label* label4 = Gtk::manage(new Gtk::Label("Y"));
  26.205 +      box12->pack_start(*label4, Gtk::PACK_SHRINK, 4);
  26.206 +
  26.207 +      box12->pack_start(cbArrowCoordTwoMaps2, Gtk::PACK_EXPAND_WIDGET);
  26.208 +
  26.209 +      cbArrowCoordOneMap.signal_changed().connect(
  26.210 +          sigc::mem_fun(*this, &FileImportDialog::onArrowCoordOneMapChanged));
  26.211 +      cbArrowCoordTwoMaps1.signal_changed().connect(
  26.212 +          sigc::mem_fun(*this, &FileImportDialog::onArrowCoordTwoMaps1Changed));
  26.213 +      cbArrowCoordTwoMaps2.signal_changed().connect(
  26.214 +          sigc::mem_fun(*this, &FileImportDialog::onArrowCoordTwoMaps2Changed));
  26.215 +    }
  26.216 +  }
  26.217 +
  26.218 +  // child widgets of vblueMaps
  26.219 +  {
  26.220 +    Gtk::VBox* box1 = Gtk::manage(new Gtk::VBox(false, 6));
  26.221 +    vblueMaps->pack_start(*box1, Gtk::PACK_SHRINK);
  26.222 +
  26.223 +    Gtk::Label* label1 =
  26.224 +      Gtk::manage(new Gtk::Label("<b>Element type</b>"));
  26.225 +    label1->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER);
  26.226 +    label1->set_use_markup();
  26.227 +    box1->pack_start(*label1, Gtk::PACK_SHRINK);
  26.228 +
  26.229 +    Gtk::HBox* box2 = Gtk::manage(new Gtk::HBox);
  26.230 +    box1->pack_start(*box2, Gtk::PACK_SHRINK);
  26.231 +
  26.232 +    Gtk::Label* fill1 = Gtk::manage(new Gtk::Label("    "));
  26.233 +    box2->pack_start(*fill1, Gtk::PACK_SHRINK);
  26.234 +
  26.235 +    Gtk::Frame* frame = Gtk::manage(new Gtk::Frame);
  26.236 +    box2->pack_start(*frame, Gtk::PACK_EXPAND_WIDGET);
  26.237 +
  26.238 +    Gtk::ScrolledWindow* swNodeMaps = Gtk::manage(new Gtk::ScrolledWindow);
  26.239 +    frame->add(*swNodeMaps);
  26.240 +
  26.241 +    swNodeMaps->add(twNodeMaps);
  26.242 +
  26.243 +    refNodeMapStore = Gtk::ListStore::create(NodeMapColumns);
  26.244 +
  26.245 +    for (std::vector<std::string>::const_iterator it =
  26.246 +        p_data->node_map_names.begin(); it != p_data->node_map_names.end();
  26.247 +        ++it)
  26.248 +    {
  26.249 +      node_tree_view_records.push_back(
  26.250 +          tree_view_record(*it, false, false, true));
  26.251 +    }
  26.252 +
  26.253 +    twNodeMaps.set_model(refNodeMapStore);
  26.254 +    twNodeMaps.append_column("Name", NodeMapColumns.colName);
  26.255 +    {
  26.256 +      int col = twNodeMaps.append_column_editable("Numeric",
  26.257 +          NodeMapColumns.colReadAsNumeric);
  26.258 +      Gtk::CellRendererToggle* pRenderer =
  26.259 +        static_cast<Gtk::CellRendererToggle*>(
  26.260 +            twNodeMaps.get_column_cell_renderer(col-1));
  26.261 +      pRenderer->signal_toggled().connect(
  26.262 +          sigc::mem_fun(*this, &FileImportDialog::onNodeMapNumericToggled));
  26.263 +    }
  26.264 +    {
  26.265 +      int col = twNodeMaps.append_column_editable("String",
  26.266 +          NodeMapColumns.colReadAsString);
  26.267 +      Gtk::CellRendererToggle* pRenderer =
  26.268 +        static_cast<Gtk::CellRendererToggle*>(
  26.269 +            twNodeMaps.get_column_cell_renderer(col-1));
  26.270 +      pRenderer->signal_toggled().connect(
  26.271 +          sigc::mem_fun(*this, &FileImportDialog::onNodeMapStringToggled));
  26.272 +    }
  26.273 +
  26.274 +    swNodeMaps->set_size_request(-1, 200);
  26.275 +    swNodeMaps->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
  26.276 +  }
  26.277 +
  26.278 +  // child widgets of vbArcMaps
  26.279 +  {
  26.280 +    Gtk::VBox* box1 = Gtk::manage(new Gtk::VBox(false, 6));
  26.281 +    vbArcMaps->pack_start(*box1, Gtk::PACK_SHRINK);
  26.282 +
  26.283 +    Gtk::Label* label1 =
  26.284 +      Gtk::manage(new Gtk::Label("<b>Element type</b>"));
  26.285 +    label1->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER);
  26.286 +    label1->set_use_markup();
  26.287 +    box1->pack_start(*label1, Gtk::PACK_SHRINK);
  26.288 +
  26.289 +    Gtk::HBox* box2 = Gtk::manage(new Gtk::HBox);
  26.290 +    box1->pack_start(*box2, Gtk::PACK_SHRINK);
  26.291 +
  26.292 +    Gtk::Label* fill1 = Gtk::manage(new Gtk::Label("    "));
  26.293 +    box2->pack_start(*fill1, Gtk::PACK_SHRINK);
  26.294 +
  26.295 +    Gtk::Frame* frame = Gtk::manage(new Gtk::Frame);
  26.296 +    box2->pack_start(*frame, Gtk::PACK_EXPAND_WIDGET);
  26.297 +
  26.298 +    Gtk::ScrolledWindow* swArcMaps = Gtk::manage(new Gtk::ScrolledWindow);
  26.299 +    frame->add(*swArcMaps);
  26.300 +
  26.301 +    swArcMaps->add(twArcMaps);
  26.302 +
  26.303 +    refArcMapStore = Gtk::ListStore::create(ArcMapColumns);
  26.304 +
  26.305 +    for (std::vector<std::string>::const_iterator it =
  26.306 +        p_data->arc_map_names.begin(); it != p_data->arc_map_names.end();
  26.307 +        ++it)
  26.308 +    {
  26.309 +      arc_tree_view_records.push_back(
  26.310 +          tree_view_record(*it, false, false, true));
  26.311 +    }
  26.312 +
  26.313 +    twArcMaps.set_model(refArcMapStore);
  26.314 +    twArcMaps.append_column("Name", ArcMapColumns.colName);
  26.315 +    {
  26.316 +      int col = twArcMaps.append_column_editable("Numeric",
  26.317 +          ArcMapColumns.colReadAsNumeric);
  26.318 +      Gtk::CellRendererToggle* pRenderer =
  26.319 +        static_cast<Gtk::CellRendererToggle*>(
  26.320 +            twArcMaps.get_column_cell_renderer(col-1));
  26.321 +      pRenderer->signal_toggled().connect(
  26.322 +          sigc::mem_fun(*this, &FileImportDialog::onArcMapNumericToggled));
  26.323 +    }
  26.324 +    {
  26.325 +      int col = twArcMaps.append_column_editable("String",
  26.326 +          ArcMapColumns.colReadAsString);
  26.327 +      Gtk::CellRendererToggle* pRenderer =
  26.328 +        static_cast<Gtk::CellRendererToggle*>(
  26.329 +            twArcMaps.get_column_cell_renderer(col-1));
  26.330 +      pRenderer->signal_toggled().connect(
  26.331 +          sigc::mem_fun(*this, &FileImportDialog::onArcMapStringToggled));
  26.332 +    }
  26.333 +
  26.334 +    swArcMaps->set_size_request(-1, 200);
  26.335 +    swArcMaps->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
  26.336 +  }
  26.337 +
  26.338 +  // fill in the ComboBoxes
  26.339 +  typedef std::vector<std::string> StrVec;
  26.340 +  for (StrVec::const_iterator it = p_data->node_map_names.begin();
  26.341 +      it != p_data->node_map_names.end(); ++it)
  26.342 +  {
  26.343 +    cblueCoordTwoMaps1.append_text(*it);
  26.344 +    cblueCoordTwoMaps2.append_text(*it);
  26.345 +  }
  26.346 +  for (StrVec::const_iterator it = p_data->arc_map_names.begin();
  26.347 +      it != p_data->arc_map_names.end(); ++it)
  26.348 +  {
  26.349 +    cbArrowCoordTwoMaps1.append_text(*it);
  26.350 +    cbArrowCoordTwoMaps2.append_text(*it);
  26.351 +  }
  26.352 +  for (StrVec::const_iterator it = p_data->xy_node_map_names.begin();
  26.353 +      it != p_data->xy_node_map_names.end(); ++it)
  26.354 +  {
  26.355 +    cblueCoordOneMap.append_text(*it);
  26.356 +  }
  26.357 +  for (StrVec::const_iterator it = p_data->xy_arc_map_names.begin();
  26.358 +      it != p_data->xy_arc_map_names.end(); ++it)
  26.359 +  {
  26.360 +    cbArrowCoordOneMap.append_text(*it);
  26.361 +  }
  26.362 +
  26.363 +  if (p_data->isXYNodeMap("coord"))
  26.364 +  {
  26.365 +    cblueCoordOneMap.set_active_text("coord");
  26.366 +  }
  26.367 +  else if (p_data->isXYNodeMap("coords"))
  26.368 +  {
  26.369 +    cblueCoordOneMap.set_active_text("coords");
  26.370 +  }
  26.371 +  else if (p_data->isNodeMap("coord_x") &&
  26.372 +           p_data->isNodeMap("coord_y"))
  26.373 +  {
  26.374 +    cblueCoordTwoMaps1.set_active_text("coord_x");
  26.375 +    cblueCoordTwoMaps2.set_active_text("coord_y");
  26.376 +  }
  26.377 +  else if (p_data->isNodeMap("coords_x") &&
  26.378 +           p_data->isNodeMap("coords_y"))
  26.379 +  {
  26.380 +    cblueCoordTwoMaps1.set_active_text("coords_x");
  26.381 +    cblueCoordTwoMaps2.set_active_text("coords_y");
  26.382 +  }
  26.383 +  else if (p_data->isNodeMap("x") &&
  26.384 +           p_data->isNodeMap("y"))
  26.385 +  {
  26.386 +    cblueCoordTwoMaps1.set_active_text("x");
  26.387 +    cblueCoordTwoMaps2.set_active_text("y");
  26.388 +  }
  26.389 +
  26.390 +  if (p_data->isXYArcMap("arrow"))
  26.391 +  {
  26.392 +    cbArrowCoordOneMap.set_active_text("arrow");
  26.393 +  }
  26.394 +  else if (p_data->isXYArcMap("arrows"))
  26.395 +  {
  26.396 +    cbArrowCoordOneMap.set_active_text("arrows");
  26.397 +  }
  26.398 +  else if (p_data->isXYArcMap("midpoint"))
  26.399 +  {
  26.400 +    cbArrowCoordOneMap.set_active_text("midpoint");
  26.401 +  }
  26.402 +  else if (p_data->isXYArcMap("midpoints"))
  26.403 +  {
  26.404 +    cbArrowCoordOneMap.set_active_text("midpoints");
  26.405 +  }
  26.406 +  else if (p_data->isXYArcMap("mid"))
  26.407 +  {
  26.408 +    cbArrowCoordOneMap.set_active_text("mid");
  26.409 +  }
  26.410 +  else if (p_data->isXYArcMap("mids"))
  26.411 +  {
  26.412 +    cbArrowCoordOneMap.set_active_text("mids");
  26.413 +  }
  26.414 +  else if (p_data->isArcMap("arrow_x") &&
  26.415 +           p_data->isArcMap("arrow_y"))
  26.416 +  {
  26.417 +    cbArrowCoordTwoMaps1.set_active_text("arrow_x");
  26.418 +    cbArrowCoordTwoMaps2.set_active_text("arrow_y");
  26.419 +  }
  26.420 +  else if (p_data->isArcMap("arrows_x") &&
  26.421 +           p_data->isArcMap("arrows_y"))
  26.422 +  {
  26.423 +    cbArrowCoordTwoMaps1.set_active_text("arrows_x");
  26.424 +    cbArrowCoordTwoMaps2.set_active_text("arrows_y");
  26.425 +  }
  26.426 +  else if (p_data->isArcMap("midpoint_x") &&
  26.427 +           p_data->isArcMap("midpoint_y"))
  26.428 +  {
  26.429 +    cbArrowCoordTwoMaps1.set_active_text("midpoint_x");
  26.430 +    cbArrowCoordTwoMaps2.set_active_text("midpoint_y");
  26.431 +  }
  26.432 +  else if (p_data->isArcMap("midpoints_x") &&
  26.433 +           p_data->isArcMap("midpoints_y"))
  26.434 +  {
  26.435 +    cbArrowCoordTwoMaps1.set_active_text("midpoints_x");
  26.436 +    cbArrowCoordTwoMaps2.set_active_text("midpoints_y");
  26.437 +  }
  26.438 +  else if (p_data->isArcMap("mid_x") &&
  26.439 +           p_data->isArcMap("mid_y"))
  26.440 +  {
  26.441 +    cbArrowCoordTwoMaps1.set_active_text("mid_x");
  26.442 +    cbArrowCoordTwoMaps2.set_active_text("mid_y");
  26.443 +  }
  26.444 +  else if (p_data->isArcMap("mids_x") &&
  26.445 +           p_data->isArcMap("mids_y"))
  26.446 +  {
  26.447 +    cbArrowCoordTwoMaps1.set_active_text("mids_x");
  26.448 +    cbArrowCoordTwoMaps2.set_active_text("mids_y");
  26.449 +  }
  26.450 +
  26.451 +  {
  26.452 +    if (cblueCoordOneMap.get_active_text() != "")
  26.453 +      rblueCoordOneMap.set_active();
  26.454 +    else if (cblueCoordTwoMaps1.get_active_text() != "")
  26.455 +      rblueCoordTwoMaps.set_active();
  26.456 +    else
  26.457 +      rblueCoordNone.set_active();
  26.458 +
  26.459 +    if (cbArrowCoordOneMap.get_active_text() != "")
  26.460 +      rbArrowCoordOneMap.set_active();
  26.461 +    else if (cbArrowCoordTwoMaps1.get_active_text() != "")
  26.462 +      rbArrowCoordTwoMaps.set_active();
  26.463 +    else
  26.464 +      rbArrowCoordNone.set_active();
  26.465 +
  26.466 +    onNodeCoordMapNumToggled();
  26.467 +    onArrowCoordMapNumToggled();
  26.468 +
  26.469 +    rblueCoordOneMap.signal_toggled().connect(
  26.470 +        sigc::mem_fun(*this, &FileImportDialog::onNodeCoordMapNumToggled));
  26.471 +    rblueCoordTwoMaps.signal_toggled().connect(
  26.472 +        sigc::mem_fun(*this, &FileImportDialog::onNodeCoordMapNumToggled));
  26.473 +    rbArrowCoordOneMap.signal_toggled().connect(
  26.474 +        sigc::mem_fun(*this, &FileImportDialog::onArrowCoordMapNumToggled));
  26.475 +    rbArrowCoordTwoMaps.signal_toggled().connect(
  26.476 +        sigc::mem_fun(*this, &FileImportDialog::onArrowCoordMapNumToggled));
  26.477 +  }
  26.478 +
  26.479 +  signal_response().connect(
  26.480 +      sigc::mem_fun(*this, &FileImportDialog::onResponse));
  26.481 +
  26.482 +  update_node_tree_view();
  26.483 +  update_arc_tree_view();
  26.484 +
  26.485 +  show_all_children();
  26.486 +}
  26.487 +
  26.488 +void FileImportDialog::onNodeCoordMapNumToggled()
  26.489 +{
  26.490 +  if (rblueCoordOneMap.get_active())
  26.491 +  {
  26.492 +    cblueCoordOneMap.get_parent()->set_sensitive(true);
  26.493 +    cblueCoordTwoMaps1.get_parent()->set_sensitive(false);
  26.494 +    cblueCoordTwoMaps2.get_parent()->set_sensitive(false);
  26.495 +
  26.496 +    p_data->node_coord_load_from = ImportData::ONE_MAP;
  26.497 +  }
  26.498 +  else if (rblueCoordTwoMaps.get_active())
  26.499 +  {
  26.500 +    cblueCoordOneMap.get_parent()->set_sensitive(false);
  26.501 +    cblueCoordTwoMaps1.get_parent()->set_sensitive(true);
  26.502 +    cblueCoordTwoMaps2.get_parent()->set_sensitive(true);
  26.503 +
  26.504 +    p_data->node_coord_load_from = ImportData::TWO_MAPS;
  26.505 +  }
  26.506 +  else if (rblueCoordNone.get_active())
  26.507 +  {
  26.508 +    cblueCoordOneMap.get_parent()->set_sensitive(false);
  26.509 +    cblueCoordTwoMaps1.get_parent()->set_sensitive(false);
  26.510 +    cblueCoordTwoMaps2.get_parent()->set_sensitive(false);
  26.511 +
  26.512 +    p_data->node_coord_load_from = ImportData::DONT_READ;
  26.513 +  }
  26.514 +  update_node_tree_view();
  26.515 +}
  26.516 +
  26.517 +void FileImportDialog::onArrowCoordMapNumToggled()
  26.518 +{
  26.519 +  if (rbArrowCoordOneMap.get_active())
  26.520 +  {
  26.521 +    cbArrowCoordOneMap.get_parent()->set_sensitive(true);
  26.522 +    cbArrowCoordTwoMaps1.get_parent()->set_sensitive(false);
  26.523 +    cbArrowCoordTwoMaps2.get_parent()->set_sensitive(false);
  26.524 +
  26.525 +    p_data->arrow_coord_load_from = ImportData::ONE_MAP;
  26.526 +  }
  26.527 +  else if (rbArrowCoordTwoMaps.get_active())
  26.528 +  {
  26.529 +    cbArrowCoordOneMap.get_parent()->set_sensitive(false);
  26.530 +    cbArrowCoordTwoMaps1.get_parent()->set_sensitive(true);
  26.531 +    cbArrowCoordTwoMaps2.get_parent()->set_sensitive(true);
  26.532 +
  26.533 +    p_data->arrow_coord_load_from = ImportData::TWO_MAPS;
  26.534 +  }
  26.535 +  else if (rbArrowCoordNone.get_active())
  26.536 +  {
  26.537 +    cbArrowCoordOneMap.get_parent()->set_sensitive(false);
  26.538 +    cbArrowCoordTwoMaps1.get_parent()->set_sensitive(false);
  26.539 +    cbArrowCoordTwoMaps2.get_parent()->set_sensitive(false);
  26.540 +
  26.541 +    p_data->arrow_coord_load_from = ImportData::DONT_READ;
  26.542 +  }
  26.543 +  update_arc_tree_view();
  26.544 +}
  26.545 +
  26.546 +FileImportDialog::~FileImportDialog()
  26.547 +{
  26.548 +}
  26.549 +
  26.550 +void FileImportDialog::onResponse(int id)
  26.551 +{
  26.552 +  if (id == Gtk::RESPONSE_OK)
  26.553 +  {
  26.554 +    if ((rblueCoordOneMap.get_active() &&
  26.555 +          cblueCoordOneMap.get_active_text() == "") ||
  26.556 +        (rblueCoordTwoMaps.get_active() &&
  26.557 +         (cblueCoordTwoMaps1.get_active_text() == "" ||
  26.558 +          cblueCoordTwoMaps2.get_active_text() == "")))
  26.559 +    {
  26.560 +      Gtk::MessageDialog mdialog("No node map selected.",
  26.561 +          false, Gtk::MESSAGE_ERROR);
  26.562 +      mdialog.run();
  26.563 +      return;
  26.564 +    }
  26.565 +    else if (rblueCoordTwoMaps.get_active() &&
  26.566 +             cblueCoordTwoMaps1.get_active_text() == 
  26.567 +             cblueCoordTwoMaps2.get_active_text())
  26.568 +    {
  26.569 +      Gtk::MessageDialog mdialog(
  26.570 +          "Same node map selected for both coordinates.",
  26.571 +          false, Gtk::MESSAGE_ERROR);
  26.572 +      mdialog.run();
  26.573 +      return;
  26.574 +    }
  26.575 +    if ((rbArrowCoordOneMap.get_active() &&
  26.576 +          cbArrowCoordOneMap.get_active_text() == "") ||
  26.577 +        (rbArrowCoordTwoMaps.get_active() &&
  26.578 +         (cbArrowCoordTwoMaps1.get_active_text() == "" ||
  26.579 +          cbArrowCoordTwoMaps2.get_active_text() == "")))
  26.580 +    {
  26.581 +      Gtk::MessageDialog mdialog("No arc map selected.",
  26.582 +          false, Gtk::MESSAGE_ERROR);
  26.583 +      mdialog.run();
  26.584 +      return;
  26.585 +    }
  26.586 +    else if (rbArrowCoordTwoMaps.get_active() &&
  26.587 +             cbArrowCoordTwoMaps1.get_active_text() == 
  26.588 +             cbArrowCoordTwoMaps2.get_active_text())
  26.589 +    {
  26.590 +      Gtk::MessageDialog mdialog(
  26.591 +          "Same arc map selected for both coordinates.",
  26.592 +          false, Gtk::MESSAGE_ERROR);
  26.593 +      mdialog.run();
  26.594 +      return;
  26.595 +    }
  26.596 +
  26.597 +    for (std::vector<tree_view_record>::const_iterator it =
  26.598 +        node_tree_view_records.begin(); it != node_tree_view_records.end();
  26.599 +        ++it)
  26.600 +    {
  26.601 +      if (it->visible)
  26.602 +      {
  26.603 +        if (it->numeric)
  26.604 +          p_data->numeric_node_map_names.push_back(it->name);
  26.605 +        if (it->string)
  26.606 +          p_data->string_node_map_names.push_back(it->name);
  26.607 +      }
  26.608 +    }
  26.609 +
  26.610 +    for (std::vector<tree_view_record>::const_iterator it =
  26.611 +        arc_tree_view_records.begin(); it != arc_tree_view_records.end();
  26.612 +        ++it)
  26.613 +    {
  26.614 +      if (it->visible)
  26.615 +      {
  26.616 +        if (it->numeric)
  26.617 +          p_data->numeric_arc_map_names.push_back(it->name);
  26.618 +        if (it->string)
  26.619 +          p_data->string_arc_map_names.push_back(it->name);
  26.620 +      }
  26.621 +    }
  26.622 +  }
  26.623 +}
  26.624 +
  26.625 +FileImportDialog::ImportData::ImportData(
  26.626 +    const std::vector<std::string>& _node_map_names,
  26.627 +    const std::vector<std::string>& _arc_map_names) :
  26.628 +  node_map_names(_node_map_names),
  26.629 +  arc_map_names(_arc_map_names)
  26.630 +{
  26.631 +  typedef std::vector<std::string> StrVec;
  26.632 +  {
  26.633 +    StrVec xMaps;
  26.634 +    StrVec yMaps;
  26.635 +    // collect map names ending with ":x" and ":y"
  26.636 +    for (StrVec::const_iterator it = node_map_names.begin();
  26.637 +        it != node_map_names.end(); ++it)
  26.638 +    {
  26.639 +      if ((it->length() >= 3) &&
  26.640 +          (it->substr(it->length()-2, it->length())  == ":x"))
  26.641 +      {
  26.642 +        xMaps.push_back(it->substr(0, it->length()-2));
  26.643 +      }
  26.644 +      if ((it->length() >= 3) &&
  26.645 +          (it->substr(it->length()-2, it->length())  == ":y"))
  26.646 +      {
  26.647 +        yMaps.push_back(it->substr(0, it->length()-2));
  26.648 +      }
  26.649 +    }
  26.650 +
  26.651 +    for (StrVec::const_iterator it1 = xMaps.begin();
  26.652 +        it1 != xMaps.end(); ++it1)
  26.653 +    {
  26.654 +      for (StrVec::const_iterator it2 = yMaps.begin();
  26.655 +          it2 != yMaps.end(); ++it2)
  26.656 +      {
  26.657 +        if (*it1 == *it2) xy_node_map_names.push_back(*it1);
  26.658 +      }
  26.659 +    }
  26.660 +  }
  26.661 +  {
  26.662 +    StrVec xMaps;
  26.663 +    StrVec yMaps;
  26.664 +    // collect map names ending with ":x" and ":y"
  26.665 +    for (StrVec::const_iterator it = arc_map_names.begin();
  26.666 +        it != arc_map_names.end(); ++it)
  26.667 +    {
  26.668 +      if ((it->length() >= 3) &&
  26.669 +          (it->substr(it->length()-2, it->length())  == ":x"))
  26.670 +      {
  26.671 +        xMaps.push_back(it->substr(0, it->length()-2));
  26.672 +      }
  26.673 +      if ((it->length() >= 3) &&
  26.674 +          (it->substr(it->length()-2, it->length())  == ":y"))
  26.675 +      {
  26.676 +        yMaps.push_back(it->substr(0, it->length()-2));
  26.677 +      }
  26.678 +    }
  26.679 +
  26.680 +    for (StrVec::const_iterator it1 = xMaps.begin();
  26.681 +        it1 != xMaps.end(); ++it1)
  26.682 +    {
  26.683 +      for (StrVec::const_iterator it2 = yMaps.begin();
  26.684 +          it2 != yMaps.end(); ++it2)
  26.685 +      {
  26.686 +        if (*it1 == *it2) xy_arc_map_names.push_back(*it1);
  26.687 +      }
  26.688 +    }
  26.689 +  }
  26.690 +}
  26.691 +
  26.692 +FileImportDialog::ImportData::~ImportData()
  26.693 +{
  26.694 +}
  26.695 +
  26.696 +bool FileImportDialog::ImportData::isXYNodeMap(const std::string& name)
  26.697 +{
  26.698 +  if (isNodeMap(name + ":x") && isNodeMap(name + ":y")) return true;
  26.699 +  return false;
  26.700 +}
  26.701 +
  26.702 +bool FileImportDialog::ImportData::isXYArcMap(const std::string& name)
  26.703 +{
  26.704 +  if (isArcMap(name + ":x") && isArcMap(name + ":y")) return true;
  26.705 +  return false;
  26.706 +}
  26.707 +
  26.708 +bool FileImportDialog::ImportData::isNodeMap(const std::string& name)
  26.709 +{
  26.710 +  if (contains(node_map_names, name)) return true;
  26.711 +  return false;
  26.712 +}
  26.713 +
  26.714 +bool FileImportDialog::ImportData::isArcMap(const std::string& name)
  26.715 +{
  26.716 +  if (contains(arc_map_names, name)) return true;
  26.717 +  return false;
  26.718 +}
  26.719 +
  26.720 +bool FileImportDialog::ImportData::contains(const std::vector<std::string>& vec,
  26.721 +    const std::string& str)
  26.722 +{
  26.723 +  for (std::vector<std::string>::const_iterator it = vec.begin();
  26.724 +      it != vec.end(); ++it)
  26.725 +  {
  26.726 +    if (*it == str) return true;
  26.727 +  }
  26.728 +  return false;
  26.729 +}
  26.730 +
  26.731 +void FileImportDialog::onNodeCoordOneMapChanged()
  26.732 +{
  26.733 +  p_data->node_coord_one_map_name = cblueCoordOneMap.get_active_text();
  26.734 +  update_node_tree_view();
  26.735 +}
  26.736 +
  26.737 +void FileImportDialog::onNodeCoordTwoMaps1Changed()
  26.738 +{
  26.739 +  p_data->node_coord_two_maps_1_name = cblueCoordTwoMaps1.get_active_text();
  26.740 +  update_node_tree_view();
  26.741 +}
  26.742 +
  26.743 +void FileImportDialog::onNodeCoordTwoMaps2Changed()
  26.744 +{
  26.745 +  p_data->node_coord_two_maps_2_name = cblueCoordTwoMaps2.get_active_text();
  26.746 +  update_node_tree_view();
  26.747 +}
  26.748 +
  26.749 +void FileImportDialog::onArrowCoordOneMapChanged()
  26.750 +{
  26.751 +  p_data->arrow_coord_one_map_name = cbArrowCoordOneMap.get_active_text();
  26.752 +  update_arc_tree_view();
  26.753 +}
  26.754 +
  26.755 +void FileImportDialog::onArrowCoordTwoMaps1Changed()
  26.756 +{
  26.757 +  p_data->arrow_coord_two_maps_1_name = cbArrowCoordTwoMaps1.get_active_text();
  26.758 +  update_arc_tree_view();
  26.759 +}
  26.760 +
  26.761 +void FileImportDialog::onArrowCoordTwoMaps2Changed()
  26.762 +{
  26.763 +  p_data->arrow_coord_two_maps_2_name = cbArrowCoordTwoMaps2.get_active_text();
  26.764 +  update_arc_tree_view();
  26.765 +}
  26.766 +
  26.767 +void FileImportDialog::onNodeMapNumericToggled(const Glib::ustring& path)
  26.768 +{
  26.769 +  Gtk::TreeModel::iterator iter = refNodeMapStore->get_iter(
  26.770 +      Gtk::TreeModel::Path(path));
  26.771 +  Gtk::TreeModel::Row row = *iter;
  26.772 +  std::vector<tree_view_record>::iterator it;
  26.773 +  for (it = node_tree_view_records.begin();
  26.774 +      it != node_tree_view_records.end(); ++it)
  26.775 +  {
  26.776 +    if (it->name == row[NodeMapColumns.colName]) break;
  26.777 +  }
  26.778 +  if (row[NodeMapColumns.colReadAsNumeric])
  26.779 +  {
  26.780 +    row[NodeMapColumns.colReadAsString] = false;
  26.781 +    it->string = false;
  26.782 +    it->numeric = true;
  26.783 +  }
  26.784 +}
  26.785 +
  26.786 +void FileImportDialog::onNodeMapStringToggled(const Glib::ustring& path)
  26.787 +{
  26.788 +  Gtk::TreeModel::iterator iter = refNodeMapStore->get_iter(
  26.789 +      Gtk::TreeModel::Path(path));
  26.790 +  Gtk::TreeModel::Row row = *iter;
  26.791 +  std::vector<tree_view_record>::iterator it;
  26.792 +  for (it = node_tree_view_records.begin();
  26.793 +      it != node_tree_view_records.end(); ++it)
  26.794 +  {
  26.795 +    if (it->name == row[NodeMapColumns.colName]) break;
  26.796 +  }
  26.797 +  if (row[NodeMapColumns.colReadAsString])
  26.798 +  {
  26.799 +    row[NodeMapColumns.colReadAsNumeric] = false;
  26.800 +    it->string = true;
  26.801 +    it->numeric = false;
  26.802 +  }
  26.803 +}
  26.804 +
  26.805 +void FileImportDialog::update_node_tree_view()
  26.806 +{
  26.807 +  for (std::vector<tree_view_record>::iterator it =
  26.808 +      node_tree_view_records.begin(); it != node_tree_view_records.end(); ++it)
  26.809 +  {
  26.810 +    it->visible = true;
  26.811 +  }
  26.812 +  switch (p_data->node_coord_load_from)
  26.813 +  {
  26.814 +    case ImportData::ONE_MAP:
  26.815 +      for (std::vector<tree_view_record>::iterator it =
  26.816 +          node_tree_view_records.begin(); it !=
  26.817 +          node_tree_view_records.end(); ++it)
  26.818 +      {
  26.819 +        if (it->name == p_data->node_coord_one_map_name)
  26.820 +          it->visible = false;
  26.821 +      }
  26.822 +      break;
  26.823 +    case ImportData::TWO_MAPS:
  26.824 +      for (std::vector<tree_view_record>::iterator it =
  26.825 +          node_tree_view_records.begin(); it !=
  26.826 +          node_tree_view_records.end(); ++it)
  26.827 +      {
  26.828 +        if ((it->name == p_data->node_coord_two_maps_1_name) ||
  26.829 +            (it->name == p_data->node_coord_two_maps_2_name))
  26.830 +          it->visible = false;
  26.831 +      }
  26.832 +      break;
  26.833 +    case ImportData::DONT_READ:
  26.834 +      break;
  26.835 +  }
  26.836 +  refNodeMapStore->clear();
  26.837 +  for (std::vector<tree_view_record>::iterator it =
  26.838 +      node_tree_view_records.begin(); it != node_tree_view_records.end(); ++it)
  26.839 +  {
  26.840 +    if (it->visible)
  26.841 +    {
  26.842 +      Gtk::TreeModel::Row row = *(refNodeMapStore->append());
  26.843 +      row[NodeMapColumns.colName] = it->name;
  26.844 +      row[NodeMapColumns.colReadAsNumeric] = it->numeric;
  26.845 +      row[NodeMapColumns.colReadAsString] = it->string;
  26.846 +    }
  26.847 +  }
  26.848 +}
  26.849 +
  26.850 +void FileImportDialog::onArcMapNumericToggled(const Glib::ustring& path)
  26.851 +{
  26.852 +  Gtk::TreeModel::iterator iter = refArcMapStore->get_iter(
  26.853 +      Gtk::TreeModel::Path(path));
  26.854 +  Gtk::TreeModel::Row row = *iter;
  26.855 +  std::vector<tree_view_record>::iterator it;
  26.856 +  for (it = arc_tree_view_records.begin();
  26.857 +      it != arc_tree_view_records.end(); ++it)
  26.858 +  {
  26.859 +    if (it->name == row[ArcMapColumns.colName]) break;
  26.860 +  }
  26.861 +  if (row[ArcMapColumns.colReadAsNumeric])
  26.862 +  {
  26.863 +    row[ArcMapColumns.colReadAsString] = false;
  26.864 +    it->string = false;
  26.865 +    it->numeric = true;
  26.866 +  }
  26.867 +}
  26.868 +
  26.869 +void FileImportDialog::onArcMapStringToggled(const Glib::ustring& path)
  26.870 +{
  26.871 +  Gtk::TreeModel::iterator iter = refArcMapStore->get_iter(
  26.872 +      Gtk::TreeModel::Path(path));
  26.873 +  Gtk::TreeModel::Row row = *iter;
  26.874 +  std::vector<tree_view_record>::iterator it;
  26.875 +  for (it = arc_tree_view_records.begin();
  26.876 +      it != arc_tree_view_records.end(); ++it)
  26.877 +  {
  26.878 +    if (it->name == row[ArcMapColumns.colName]) break;
  26.879 +  }
  26.880 +  if (row[ArcMapColumns.colReadAsString])
  26.881 +  {
  26.882 +    row[ArcMapColumns.colReadAsNumeric] = false;
  26.883 +    it->string = true;
  26.884 +    it->numeric = false;
  26.885 +  }
  26.886 +}
  26.887 +
  26.888 +void FileImportDialog::update_arc_tree_view()
  26.889 +{
  26.890 +  for (std::vector<tree_view_record>::iterator it =
  26.891 +      arc_tree_view_records.begin(); it != arc_tree_view_records.end(); ++it)
  26.892 +  {
  26.893 +    it->visible = true;
  26.894 +  }
  26.895 +  switch (p_data->arrow_coord_load_from)
  26.896 +  {
  26.897 +    case ImportData::ONE_MAP:
  26.898 +      for (std::vector<tree_view_record>::iterator it =
  26.899 +          arc_tree_view_records.begin(); it !=
  26.900 +          arc_tree_view_records.end(); ++it)
  26.901 +      {
  26.902 +        if (it->name == p_data->arrow_coord_one_map_name)
  26.903 +          it->visible = false;
  26.904 +      }
  26.905 +      break;
  26.906 +    case ImportData::TWO_MAPS:
  26.907 +      for (std::vector<tree_view_record>::iterator it =
  26.908 +          arc_tree_view_records.begin(); it !=
  26.909 +          arc_tree_view_records.end(); ++it)
  26.910 +      {
  26.911 +        if ((it->name == p_data->arrow_coord_two_maps_1_name) ||
  26.912 +            (it->name == p_data->arrow_coord_two_maps_2_name))
  26.913 +          it->visible = false;
  26.914 +      }
  26.915 +      break;
  26.916 +    case ImportData::DONT_READ:
  26.917 +      break;
  26.918 +  }
  26.919 +  refArcMapStore->clear();
  26.920 +  for (std::vector<tree_view_record>::iterator it =
  26.921 +      arc_tree_view_records.begin(); it != arc_tree_view_records.end(); ++it)
  26.922 +  {
  26.923 +    if (it->visible)
  26.924 +    {
  26.925 +      Gtk::TreeModel::Row row = *(refArcMapStore->append());
  26.926 +      row[ArcMapColumns.colName] = it->name;
  26.927 +      row[ArcMapColumns.colReadAsNumeric] = it->numeric;
  26.928 +      row[ArcMapColumns.colReadAsString] = it->string;
  26.929 +    }
  26.930 +  }
  26.931 +}
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/file_import_dialog.h	Mon Jul 07 08:10:39 2008 -0500
    27.3 @@ -0,0 +1,137 @@
    27.4 +#ifndef FILE_IMPORT_DIALOG
    27.5 +#define FILE_IMPORT_DIALOG
    27.6 +
    27.7 +#include <gtkmm/dialog.h>
    27.8 +#include <gtkmm/radiobutton.h>
    27.9 +#include <gtkmm/comboboxtext.h>
   27.10 +#include <gtkmm/sizegroup.h>
   27.11 +#include <gtkmm/treemodel.h>
   27.12 +#include <gtkmm/liststore.h>
   27.13 +#include <gtkmm/treeview.h>
   27.14 +#include <gtkmm/scrolledwindow.h>
   27.15 +
   27.16 +class FileImportDialog : public Gtk::Dialog
   27.17 +{
   27.18 +  public:
   27.19 +    struct ImportData
   27.20 +    {
   27.21 +        ImportData(
   27.22 +            const std::vector<std::string>& _node_map_names,
   27.23 +            const std::vector<std::string>& _arc_map_names);
   27.24 +
   27.25 +        ~ImportData();
   27.26 +
   27.27 +        std::vector<std::string> node_map_names;
   27.28 +        std::vector<std::string> arc_map_names;
   27.29 +
   27.30 +        std::vector<std::string> xy_node_map_names;
   27.31 +        std::vector<std::string> xy_arc_map_names;
   27.32 +
   27.33 +        bool contains(
   27.34 +            const std::vector<std::string>& vec,
   27.35 +            const std::string& str);
   27.36 +
   27.37 +        std::string node_coord_one_map_name;
   27.38 +        std::string node_coord_two_maps_1_name;
   27.39 +        std::string node_coord_two_maps_2_name;
   27.40 +        std::string arrow_coord_one_map_name;
   27.41 +        std::string arrow_coord_two_maps_1_name;
   27.42 +        std::string arrow_coord_two_maps_2_name;
   27.43 +
   27.44 +        enum ReadOpts { ONE_MAP, TWO_MAPS, DONT_READ };
   27.45 +        ReadOpts node_coord_load_from;
   27.46 +        ReadOpts arrow_coord_load_from;
   27.47 +
   27.48 +        bool isXYNodeMap(const std::string& name);
   27.49 +        bool isXYArcMap(const std::string& name);
   27.50 +        bool isNodeMap(const std::string& name);
   27.51 +        bool isArcMap(const std::string& name);
   27.52 +
   27.53 +        std::vector<std::string> numeric_node_map_names;
   27.54 +        std::vector<std::string> string_node_map_names;
   27.55 +        std::vector<std::string> numeric_arc_map_names;
   27.56 +        std::vector<std::string> string_arc_map_names;
   27.57 +    };
   27.58 +
   27.59 +    ImportData* p_data;
   27.60 +
   27.61 +    Gtk::RadioButton rblueCoordNone;
   27.62 +    Gtk::RadioButton rblueCoordOneMap;
   27.63 +    Gtk::RadioButton rblueCoordTwoMaps;
   27.64 +
   27.65 +    Gtk::RadioButton rbArrowCoordNone;
   27.66 +    Gtk::RadioButton rbArrowCoordOneMap;
   27.67 +    Gtk::RadioButton rbArrowCoordTwoMaps;
   27.68 +
   27.69 +    Gtk::ComboBoxText cblueCoordOneMap;
   27.70 +    Gtk::ComboBoxText cblueCoordTwoMaps1;
   27.71 +    Gtk::ComboBoxText cblueCoordTwoMaps2;
   27.72 +
   27.73 +    Gtk::ComboBoxText cbArrowCoordOneMap;
   27.74 +    Gtk::ComboBoxText cbArrowCoordTwoMaps1;
   27.75 +    Gtk::ComboBoxText cbArrowCoordTwoMaps2;
   27.76 +
   27.77 +    void onNodeCoordMapNumToggled();
   27.78 +    void onArrowCoordMapNumToggled();
   27.79 +
   27.80 +    void onResponse(int id);
   27.81 +
   27.82 +    void onNodeCoordOneMapChanged();
   27.83 +    void onNodeCoordTwoMaps1Changed();
   27.84 +    void onNodeCoordTwoMaps2Changed();
   27.85 +
   27.86 +    void onArrowCoordOneMapChanged();
   27.87 +    void onArrowCoordTwoMaps1Changed();
   27.88 +    void onArrowCoordTwoMaps2Changed();
   27.89 +
   27.90 +    struct MapModelColumns : public Gtk::TreeModel::ColumnRecord
   27.91 +    {
   27.92 +      MapModelColumns()
   27.93 +      {
   27.94 +        add(colName);
   27.95 +        add(colReadAsNumeric);
   27.96 +        add(colReadAsString);
   27.97 +      }
   27.98 +      Gtk::TreeModelColumn<Glib::ustring> colName;
   27.99 +      Gtk::TreeModelColumn<bool> colReadAsNumeric;
  27.100 +      Gtk::TreeModelColumn<bool> colReadAsString;
  27.101 +    };
  27.102 +
  27.103 +    Gtk::TreeView twNodeMaps;
  27.104 +    MapModelColumns NodeMapColumns;
  27.105 +    Glib::RefPtr<Gtk::ListStore> refNodeMapStore;
  27.106 +    void onNodeMapNumericToggled(const Glib::ustring& path);
  27.107 +    void onNodeMapStringToggled(const Glib::ustring& path);
  27.108 +
  27.109 +    Gtk::TreeView twArcMaps;
  27.110 +    MapModelColumns ArcMapColumns;
  27.111 +    Glib::RefPtr<Gtk::ListStore> refArcMapStore;
  27.112 +    void onArcMapNumericToggled(const Glib::ustring& path);
  27.113 +    void onArcMapStringToggled(const Glib::ustring& path);
  27.114 +
  27.115 +    struct tree_view_record
  27.116 +    {
  27.117 +      tree_view_record(const std::string& _name, bool _numeric, bool _string,
  27.118 +          bool _visible) :
  27.119 +        name(_name),
  27.120 +        numeric(_numeric),
  27.121 +        string(_string),
  27.122 +        visible(_visible) {}
  27.123 +      std::string name;
  27.124 +      bool numeric;
  27.125 +      bool string;
  27.126 +      bool visible;
  27.127 +    };
  27.128 +
  27.129 +    std::vector<tree_view_record> node_tree_view_records;
  27.130 +    void update_node_tree_view();
  27.131 +
  27.132 +    std::vector<tree_view_record> arc_tree_view_records;
  27.133 +    void update_arc_tree_view();
  27.134 +
  27.135 +  public:
  27.136 +    FileImportDialog(ImportData* d);
  27.137 +    ~FileImportDialog();
  27.138 +};
  27.139 +
  27.140 +#endif
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/gdc-broken_edge.cc	Mon Jul 07 08:10:39 2008 -0500
    28.3 @@ -0,0 +1,260 @@
    28.4 +/* -*- C++ -*-
    28.5 + *
    28.6 + * This file is a part of LEMON, a generic C++ optimization library
    28.7 + *
    28.8 + * Copyright (C) 2003-2006
    28.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
   28.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
   28.11 + *
   28.12 + * Permission to use, modify and distribute this software is granted
   28.13 + * provided that this copyright notice appears in all copies. For
   28.14 + * precise terms see the accompanying LICENSE file.
   28.15 + *
   28.16 + * This software is provided "AS IS" with no warranty of any kind,
   28.17 + * express or implied, and with no claim as to its suitability for any
   28.18 + * purpose.
   28.19 + *
   28.20 + */
   28.21 +
   28.22 +#include <graph_displayer_canvas.h>
   28.23 +#include <mapstorage.h>
   28.24 +#include <nbtab.h>
   28.25 +#include <cmath>
   28.26 +
   28.27 +DigraphDisplayerCanvas::ArcBase::ArcBase(Gnome::Canvas::Group& _group, Arc _arc, DigraphDisplayerCanvas& _canvas) : 
   28.28 +  Gnome::Canvas::Group(_group), arc(_arc), canvas(_canvas), arrow(*this)
   28.29 +{
   28.30 +  arrow.property_fill_color().set_value("red");
   28.31 +  arrow.lower_to_bottom();
   28.32 +  lower_to_bottom();
   28.33 +}
   28.34 +
   28.35 +DigraphDisplayerCanvas::ArcBase::~ArcBase()
   28.36 +{
   28.37 +}
   28.38 +
   28.39 +void DigraphDisplayerCanvas::ArcBase::drawArrow(XY unit_vector_in_dir)
   28.40 +{
   28.41 +  MapStorage& ms = *canvas.mytab.mapstorage;
   28.42 +  XY center(ms.getArrowCoords(arc));
   28.43 +  XY unit_norm_vector(0-unit_vector_in_dir.y, unit_vector_in_dir.x);
   28.44 +
   28.45 +  //       /\       // top
   28.46 +  //      /  \      //
   28.47 +  //      -  -      // c(enter)l(eft), ccl, ccr, cr
   28.48 +  //       ||       //
   28.49 +  //       ||       // b(ottom)l, br
   28.50 +
   28.51 +  double size=3;
   28.52 +
   28.53 +  XY bl (center - unit_vector_in_dir * 3 * size + unit_norm_vector * size );
   28.54 +  XY br (center - unit_vector_in_dir * 3 * size - unit_norm_vector * size );
   28.55 +  XY ccl(center + unit_vector_in_dir *  size + unit_norm_vector * size );
   28.56 +  XY ccr(center + unit_vector_in_dir *  size - unit_norm_vector * size );
   28.57 +  XY cl (center + unit_vector_in_dir *  size + unit_norm_vector * 2 * size );
   28.58 +  XY cr (center + unit_vector_in_dir *  size - unit_norm_vector * 2 * size );
   28.59 +  XY top(center + unit_vector_in_dir * 3 * size);
   28.60 +
   28.61 +  Gnome::Canvas::Points arrow_points;
   28.62 +  arrow_points.push_back(Gnome::Art::Point( bl.x , bl.y  ) );
   28.63 +  arrow_points.push_back(Gnome::Art::Point( br.x , br.y  ) );
   28.64 +  arrow_points.push_back(Gnome::Art::Point( ccr.x, ccr.y ) );
   28.65 +  arrow_points.push_back(Gnome::Art::Point( cr.x , cr.y  ) );
   28.66 +  arrow_points.push_back(Gnome::Art::Point( top.x, top.y ) );
   28.67 +  arrow_points.push_back(Gnome::Art::Point( cl.x , cl.y  ) );
   28.68 +  arrow_points.push_back(Gnome::Art::Point( ccl.x, ccl.y ) );
   28.69 +
   28.70 +  arrow.property_points().set_value(arrow_points);
   28.71 +}
   28.72 +
   28.73 +DigraphDisplayerCanvas::BrokenArc::BrokenArc(Gnome::Canvas::Group & g,
   28.74 +    Arc _arc, DigraphDisplayerCanvas & gc) : ArcBase(g, _arc, gc),
   28.75 +  isbutton(false), line(*this)
   28.76 +{
   28.77 +  arrow.signal_event().connect(sigc::mem_fun(*this, &DigraphDisplayerCanvas::BrokenArc::arcFormerEventHandler));
   28.78 +
   28.79 +  line.property_fill_color().set_value("green");
   28.80 +  line.property_width_units().set_value(10);    
   28.81 +  line.lower_to_bottom();
   28.82 +
   28.83 +  draw();
   28.84 +}
   28.85 +
   28.86 +DigraphDisplayerCanvas::BrokenArc::~BrokenArc()
   28.87 +{
   28.88 +}
   28.89 +
   28.90 +void DigraphDisplayerCanvas::BrokenArc::draw()
   28.91 +{
   28.92 +  MapStorage& ms = *canvas.mytab.mapstorage;
   28.93 +
   28.94 +  //calculating coordinates of the direction indicator arrow
   28.95 +  XY head(ms.getNodeCoords(ms.digraph.target(arc)));
   28.96 +  XY center(ms.getArrowCoords(arc));
   28.97 +
   28.98 +  XY unit_vector_in_dir(head-center);
   28.99 +  double length=sqrt( unit_vector_in_dir.normSquare() );
  28.100 +
  28.101 +  if(length!=0)
  28.102 +    {
  28.103 +      unit_vector_in_dir/=length;
  28.104 +    }
  28.105 +
  28.106 +  // update the arrow
  28.107 +  drawArrow(unit_vector_in_dir);
  28.108 +
  28.109 +  // update the arc
  28.110 +  Gnome::Canvas::Points points;
  28.111 +  Node source = ms.digraph.source(arc);
  28.112 +  Node target = ms.digraph.target(arc);
  28.113 +  points.push_back(Gnome::Art::Point(ms.getNodeCoords(source).x,
  28.114 +        ms.getNodeCoords(source).y));
  28.115 +  points.push_back(Gnome::Art::Point(ms.getArrowCoords(arc).x,
  28.116 +        ms.getArrowCoords(arc).y));
  28.117 +  points.push_back(Gnome::Art::Point(ms.getNodeCoords(target).x,
  28.118 +        ms.getNodeCoords(target).y));
  28.119 +  line.property_points().set_value(points);
  28.120 +}
  28.121 +
  28.122 +bool DigraphDisplayerCanvas::BrokenArc::arcFormerEventHandler(GdkEvent* e)
  28.123 +{
  28.124 +  switch(e->type)
  28.125 +  {
  28.126 +    case GDK_BUTTON_PRESS:
  28.127 +      //we mark the location of the event to be able to calculate parameters
  28.128 +      //of dragging
  28.129 +      if(canvas.getActualTool()!=CREATE_NODE)
  28.130 +      {
  28.131 +        canvas.toggleArcActivity(this, true);
  28.132 +        clicked_x=e->button.x;
  28.133 +        clicked_y=e->button.y;
  28.134 +        isbutton=true;
  28.135 +      }
  28.136 +      break;
  28.137 +    case GDK_BUTTON_RELEASE:
  28.138 +      if(canvas.getActualTool()!=CREATE_NODE)
  28.139 +      {
  28.140 +        canvas.toggleArcActivity(this, false);
  28.141 +        isbutton=false;
  28.142 +      }
  28.143 +      break;
  28.144 +    case GDK_MOTION_NOTIFY:
  28.145 +      //we only have to do sg. if the mouse button is pressed
  28.146 +      if(isbutton)
  28.147 +      {
  28.148 +        //new coordinates will be the old values,
  28.149 +        //because the item will be moved to the
  28.150 +        //new coordinate therefore the new movement
  28.151 +        //has to be calculated from here
  28.152 +
  28.153 +        double dx=e->motion.x-clicked_x;
  28.154 +        double dy=e->motion.y-clicked_y;
  28.155 +
  28.156 +        Gnome::Canvas::Points points_new;
  28.157 +
  28.158 +        canvas.mytab.mapstorage->setArrowCoords(arc, canvas.mytab.mapstorage->getArrowCoords(arc) + XY(dx, dy));
  28.159 +
  28.160 +        draw();
  28.161 +        canvas.textReposition(canvas.mytab.mapstorage->getArrowCoords(arc));
  28.162 +
  28.163 +        clicked_x=e->motion.x;
  28.164 +        clicked_y=e->motion.y;
  28.165 +
  28.166 +      }
  28.167 +    default: break;
  28.168 +  }
  28.169 +
  28.170 +  return true;
  28.171 +}
  28.172 +
  28.173 +void DigraphDisplayerCanvas::BrokenArc::setLineWidth(int w)
  28.174 +{
  28.175 +  line.property_width_units().set_value(w);
  28.176 +}
  28.177 +
  28.178 +void DigraphDisplayerCanvas::BrokenArc::setFillColor(Gdk::Color c)
  28.179 +{
  28.180 +  line.property_fill_color_gdk().set_value(c);
  28.181 +}
  28.182 +
  28.183 +DigraphDisplayerCanvas::LoopArc::LoopArc(Gnome::Canvas::Group& _group,
  28.184 +    Arc _arc, DigraphDisplayerCanvas& _canvas) :
  28.185 +  ArcBase(_group, _arc, _canvas), line(*this), isbutton(false)
  28.186 +{
  28.187 +  arrow.signal_event().connect(sigc::mem_fun(*this, &DigraphDisplayerCanvas::LoopArc::arcFormerEventHandler));
  28.188 +
  28.189 +  line.property_outline_color().set_value("green");
  28.190 +  line.property_width_units().set_value(10);
  28.191 +  line.lower_to_bottom();
  28.192 +
  28.193 +  draw();
  28.194 +}
  28.195 +
  28.196 +DigraphDisplayerCanvas::LoopArc::~LoopArc()
  28.197 +{
  28.198 +}
  28.199 +
  28.200 +void DigraphDisplayerCanvas::LoopArc::draw()
  28.201 +{
  28.202 +  MapStorage& ms = *canvas.mytab.mapstorage;
  28.203 +
  28.204 +  Node node = ms.digraph.source(arc);
  28.205 +  XY center = (ms.getNodeCoords(node) + ms.getArrowCoords(arc)) / 2.0;
  28.206 +
  28.207 +  XY unit_vector_in_dir(rot90(center - ms.getArrowCoords(arc)));
  28.208 +  double length = sqrt(unit_vector_in_dir.normSquare());
  28.209 +  unit_vector_in_dir /= length;
  28.210 +
  28.211 +  drawArrow(unit_vector_in_dir);
  28.212 +
  28.213 +  double radius =
  28.214 +    sqrt((ms.getArrowCoords(arc) - ms.getNodeCoords(node)).normSquare()) / 2.0;
  28.215 +
  28.216 +  XY p1 = center + XY(-radius,  radius);
  28.217 +  XY p2 = center + XY( radius, -radius);
  28.218 +  line.property_x1().set_value(p1.x);
  28.219 +  line.property_y1().set_value(p1.y);
  28.220 +  line.property_x2().set_value(p2.x);
  28.221 +  line.property_y2().set_value(p2.y);
  28.222 +}
  28.223 +
  28.224 +void DigraphDisplayerCanvas::LoopArc::setLineWidth(int w)
  28.225 +{
  28.226 +  line.property_width_units().set_value(w);
  28.227 +}
  28.228 +
  28.229 +void DigraphDisplayerCanvas::LoopArc::setFillColor(Gdk::Color c)
  28.230 +{
  28.231 +  line.property_outline_color_gdk().set_value(c);
  28.232 +}
  28.233 +
  28.234 +bool DigraphDisplayerCanvas::LoopArc::arcFormerEventHandler(GdkEvent* e)
  28.235 +{
  28.236 +  switch(e->type)
  28.237 +  {
  28.238 +    case GDK_BUTTON_PRESS:
  28.239 +      if(canvas.getActualTool()!=CREATE_NODE)
  28.240 +      {
  28.241 +        canvas.toggleArcActivity(this, true);
  28.242 +        isbutton=true;
  28.243 +      }
  28.244 +      break;
  28.245 +    case GDK_BUTTON_RELEASE:
  28.246 +      if(canvas.getActualTool()!=CREATE_NODE)
  28.247 +      {
  28.248 +        canvas.toggleArcActivity(this, false);
  28.249 +        isbutton=false;
  28.250 +      }
  28.251 +      break;
  28.252 +    case GDK_MOTION_NOTIFY:
  28.253 +      if(isbutton)
  28.254 +      {
  28.255 +        canvas.mytab.mapstorage->setArrowCoords(arc, XY(e->motion.x, e->motion.y));
  28.256 +
  28.257 +        draw();
  28.258 +        canvas.textReposition(canvas.mytab.mapstorage->getArrowCoords(arc));
  28.259 +      }
  28.260 +    default: break;
  28.261 +  }
  28.262 +  return true;
  28.263 +}
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/gettext.h	Mon Jul 07 08:10:39 2008 -0500
    29.3 @@ -0,0 +1,79 @@
    29.4 +/* Convenience header for conditional use of GNU <libintl.h>.
    29.5 +   Copyright (C) 1995-1998, 2000-2002, 2004 Free Software Foundation, Inc.
    29.6 +
    29.7 +   This program is free software; you can redistribute it and/or modify it
    29.8 +   under the terms of the GNU Library General Public License as published
    29.9 +   by the Free Software Foundation; either version 2, or (at your option)
   29.10 +   any later version.
   29.11 +
   29.12 +   This program is distributed in the hope that it will be useful,
   29.13 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
   29.14 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   29.15 +   Library General Public License for more details.
   29.16 +
   29.17 +   You should have received a copy of the GNU Library General Public
   29.18 +   License along with this program; if not, write to the Free Software
   29.19 +   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
   29.20 +   USA.  */
   29.21 +
   29.22 +#ifndef _LIBGETTEXT_H
   29.23 +#define _LIBGETTEXT_H 1
   29.24 +
   29.25 +/* NLS can be disabled through the configure --disable-nls option.  */
   29.26 +#if ENABLE_NLS
   29.27 +
   29.28 +/* Get declarations of GNU message catalog functions.  */
   29.29 +# include <libintl.h>
   29.30 +
   29.31 +#else
   29.32 +
   29.33 +/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which
   29.34 +   chokes if dcgettext is defined as a macro.  So include it now, to make
   29.35 +   later inclusions of <locale.h> a NOP.  We don't include <libintl.h>
   29.36 +   as well because people using "gettext.h" will not include <libintl.h>,
   29.37 +   and also including <libintl.h> would fail on SunOS 4, whereas <locale.h>
   29.38 +   is OK.  */
   29.39 +#if defined(__sun)
   29.40 +# include <locale.h>
   29.41 +#endif
   29.42 +
   29.43 +/* Many header files from the libstdc++ coming with g++ 3.3 or newer include
   29.44 +   <libintl.h>, which chokes if dcgettext is defined as a macro.  So include
   29.45 +   it now, to make later inclusions of <libintl.h> a NOP.  */
   29.46 +#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3)
   29.47 +# include <cstdlib>
   29.48 +# if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H
   29.49 +#  include <libintl.h>
   29.50 +# endif
   29.51 +#endif
   29.52 +
   29.53 +/* Disabled NLS.
   29.54 +   The casts to 'const char *' serve the purpose of producing warnings
   29.55 +   for invalid uses of the value returned from these functions.
   29.56 +   On pre-ANSI systems without 'const', the config.h file is supposed to
   29.57 +   contain "#define const".  */
   29.58 +# define gettext(Msgid) ((const char *) (Msgid))
   29.59 +# define dgettext(Domainname, Msgid) ((const char *) (Msgid))
   29.60 +# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid))
   29.61 +# define ngettext(Msgid1, Msgid2, N) \
   29.62 +    ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
   29.63 +# define dngettext(Domainname, Msgid1, Msgid2, N) \
   29.64 +    ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
   29.65 +# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
   29.66 +    ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
   29.67 +# define textdomain(Domainname) ((const char *) (Domainname))
   29.68 +# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname))
   29.69 +# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset))
   29.70 +
   29.71 +#endif
   29.72 +
   29.73 +/* A pseudo function call that serves as a marker for the automated
   29.74 +   extraction of messages, but does not call gettext().  The run-time
   29.75 +   translation is done at a different place in the code.
   29.76 +   The argument, String, should be a literal string.  Concatenated strings
   29.77 +   and other string expressions won't work.
   29.78 +   The macro's expansion is not parenthesized, so that it is suitable as
   29.79 +   initializer for static 'char[]' or 'const char[]' variables.  */
   29.80 +#define gettext_noop(String) String
   29.81 +
   29.82 +#endif /* _LIBGETTEXT_H */
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/glemon.spec.in	Mon Jul 07 08:10:39 2008 -0500
    30.3 @@ -0,0 +1,42 @@
    30.4 +Summary: A graph editor for the LEMON Graph Format
    30.5 +Name: @PACKAGE_TARNAME@
    30.6 +Version: @PACKAGE_VERSION@
    30.7 +Release: 1
    30.8 +License: Boost
    30.9 +URL: http://lemon.cs.elte.hu
   30.10 +Source0: %{name}-%{version}.tar.gz
   30.11 +Group: Development/Libraries
   30.12 +BuildRoot: %{_tmppath}/%{name}-root
   30.13 +Requires: lemon
   30.14 +Requires: gtkmm24 >= 2.6
   30.15 +Requires: libgnomecanvasmm >= 2.6.0
   30.16 +BuildRequires: lemon-devel
   30.17 +BuildRequires: gtkmm24-devel >= 2.6
   30.18 +BuildRequires: libgnomecanvasmm-devel >= 2.6.0
   30.19 +
   30.20 +%description
   30.21 +glemon is a graphical editor for the LEMON Graph Format (.lgf)
   30.22 +
   30.23 +%prep
   30.24 +%setup -q
   30.25 +
   30.26 +%build
   30.27 +%configure
   30.28 +make
   30.29 +
   30.30 +%install
   30.31 +rm -rf $RPM_BUILD_ROOT
   30.32 +make DESTDIR=$RPM_BUILD_ROOT install
   30.33 +
   30.34 +%clean
   30.35 +rm -rf $RPM_BUILD_ROOT
   30.36 +
   30.37 +%post -p /sbin/ldconfig
   30.38 +
   30.39 +%postun -p /sbin/ldconfig
   30.40 +
   30.41 +%files
   30.42 +%defattr(-,root,root)
   30.43 +%{_bindir}/glemon
   30.44 +%{_datadir}/locale
   30.45 +%doc AUTHORS COPYING LICENSE NEWS README
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/graph-displayer.cc	Mon Jul 07 08:10:39 2008 -0500
    31.3 @@ -0,0 +1,115 @@
    31.4 +/* -*- C++ -*-
    31.5 + *
    31.6 + * This file is a part of LEMON, a generic C++ optimization library
    31.7 + *
    31.8 + * Copyright (C) 2003-2006
    31.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
   31.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
   31.11 + *
   31.12 + * Permission to use, modify and distribute this software is granted
   31.13 + * provided that this copyright notice appears in all copies. For
   31.14 + * precise terms see the accompanying LICENSE file.
   31.15 + *
   31.16 + * This software is provided "AS IS" with no warranty of any kind,
   31.17 + * express or implied, and with no claim as to its suitability for any
   31.18 + * purpose.
   31.19 + *
   31.20 + */
   31.21 +
   31.22 +#ifdef HAVE_CONFIG_H
   31.23 +#include <config.h>
   31.24 +#endif
   31.25 +
   31.26 +#include "all_include.h"
   31.27 +#include "main_win.h"
   31.28 +#include <libgnomecanvasmm.h>
   31.29 +#include <libgnomecanvasmm/polygon.h>
   31.30 +
   31.31 +#include <locale.h>
   31.32 +
   31.33 +#define MAIN_PART
   31.34 +
   31.35 +std::vector <std::string> arc_property_strings;
   31.36 +std::vector <double> arc_property_defaults;
   31.37 +std::vector <std::string> node_property_strings;
   31.38 +std::vector <double> node_property_defaults;
   31.39 +int longest_property_string_length;
   31.40 +
   31.41 +int main(int argc, char *argv[])
   31.42 +{
   31.43 +  setlocale(LC_ALL, "");
   31.44 +  bindtextdomain(PACKAGE, LOCALEDIR);
   31.45 +  bind_textdomain_codeset(PACKAGE, "UTF-8");
   31.46 +  textdomain(PACKAGE);
   31.47 +
   31.48 +  //initializing
   31.49 +
   31.50 +  arc_property_strings.resize(EDGE_PROPERTY_NUM);
   31.51 +  arc_property_strings[E_WIDTH]="Arc Width";
   31.52 +  arc_property_strings[E_COLOR]="Arc Color";
   31.53 +  arc_property_strings[E_TEXT]="Arc Text";
   31.54 +
   31.55 +  arc_property_defaults.resize(EDGE_PROPERTY_NUM);
   31.56 +  arc_property_defaults[E_WIDTH]=10.0;
   31.57 +  arc_property_defaults[E_COLOR]=100;
   31.58 +  arc_property_defaults[E_TEXT]=0;
   31.59 +
   31.60 +  node_property_strings.resize(NODE_PROPERTY_NUM);
   31.61 +  node_property_strings[N_RADIUS]="Node Radius";
   31.62 +  node_property_strings[N_COLOR]="Node Color";
   31.63 +  node_property_strings[N_TEXT]="Node Text";
   31.64 +
   31.65 +  node_property_defaults.resize(NODE_PROPERTY_NUM);
   31.66 +  node_property_defaults[N_RADIUS]=20.0;
   31.67 +  node_property_defaults[N_COLOR]=100;
   31.68 +  node_property_defaults[N_TEXT]=0;
   31.69 +
   31.70 +  longest_property_string_length=0;
   31.71 +  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
   31.72 +    {
   31.73 +      int j=arc_property_strings[i].size();
   31.74 +      if(j>longest_property_string_length)
   31.75 +	{
   31.76 +	  longest_property_string_length=j;
   31.77 +	}
   31.78 +    }
   31.79 +  for(int i=0;i<NODE_PROPERTY_NUM;i++)
   31.80 +    {
   31.81 +      int j=node_property_strings[i].size();
   31.82 +      if(j>longest_property_string_length)
   31.83 +	{
   31.84 +	  longest_property_string_length=j;
   31.85 +	}
   31.86 +    }
   31.87 +
   31.88 +
   31.89 +  //initializing GUI
   31.90 +
   31.91 +  Gnome::Canvas::init();
   31.92 +  Gtk::Main app(argc, argv);
   31.93 +
   31.94 +  MainWin mytab;
   31.95 +
   31.96 +//   if ((argc == 2) && (Glib::file_test(argv[1], Glib::FILE_TEST_IS_REGULAR)))
   31.97 +//     {
   31.98 +//       mytab.readFile(argv[1]);
   31.99 +//     }
  31.100 +  if(argc>=2)
  31.101 +  {
  31.102 +    for(int i=1;i<argc;i++)
  31.103 +    {
  31.104 +      if(Glib::file_test(argv[i], Glib::FILE_TEST_IS_REGULAR))
  31.105 +      {
  31.106 +        mytab.readFile(argv[i]);
  31.107 +      }
  31.108 +    }
  31.109 +  }
  31.110 +  else
  31.111 +    {
  31.112 +      mytab.newTab();
  31.113 +    }
  31.114 +  
  31.115 +  app.run(mytab);
  31.116 +
  31.117 +  return 0;
  31.118 +}
    32.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.2 +++ b/graph_displayer_canvas-edge.cc	Mon Jul 07 08:10:39 2008 -0500
    32.3 @@ -0,0 +1,302 @@
    32.4 +/* -*- C++ -*-
    32.5 + *
    32.6 + * This file is a part of LEMON, a generic C++ optimization library
    32.7 + *
    32.8 + * Copyright (C) 2003-2006
    32.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
   32.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
   32.11 + *
   32.12 + * Permission to use, modify and distribute this software is granted
   32.13 + * provided that this copyright notice appears in all copies. For
   32.14 + * precise terms see the accompanying LICENSE file.
   32.15 + *
   32.16 + * This software is provided "AS IS" with no warranty of any kind,
   32.17 + * express or implied, and with no claim as to its suitability for any
   32.18 + * purpose.
   32.19 + *
   32.20 + */
   32.21 +
   32.22 +#include <graph_displayer_canvas.h>
   32.23 +#include <mapstorage.h>
   32.24 +#include <nbtab.h>
   32.25 +#include <cmath>
   32.26 +
   32.27 +const int minimum_arc_width=0;
   32.28 +
   32.29 +int DigraphDisplayerCanvas::resetArcWidth (Arc arc)
   32.30 +{
   32.31 +  MapStorage& ms = *mytab.mapstorage;
   32.32 +  double min, max;
   32.33 +
   32.34 +  min=arc_property_defaults[E_WIDTH];
   32.35 +  max=arc_property_defaults[E_WIDTH];
   32.36 +  Digraph::ArcMap<double> actual_map(ms.digraph,arc_property_defaults[E_WIDTH]);
   32.37 +
   32.38 +  if(arc==INVALID)
   32.39 +  {
   32.40 +    for (ArcIt i(ms.digraph); i!=INVALID; ++i)
   32.41 +    {
   32.42 +      double v=fabs(actual_map[i]);
   32.43 +      int w;
   32.44 +      if(min==max)
   32.45 +      {
   32.46 +        w=(int)(arc_property_defaults[E_WIDTH]);
   32.47 +      }
   32.48 +      else
   32.49 +      {
   32.50 +        w=(int)(MIN_EDGE_WIDTH+(v-min)/(max-min)*(MAX_EDGE_WIDTH-MIN_EDGE_WIDTH));
   32.51 +      }
   32.52 +      if(zoomtrack)
   32.53 +      {
   32.54 +        double actual_ppu=get_pixels_per_unit();
   32.55 +        w=(int)(w/actual_ppu*fixed_zoom_factor);
   32.56 +      }
   32.57 +      arcsmap[i]->setLineWidth(w);
   32.58 +    }
   32.59 +  }
   32.60 +  else
   32.61 +  {
   32.62 +    int w=(int)actual_map[arc];
   32.63 +    if(w>=0)
   32.64 +    {
   32.65 +      arcsmap[arc]->setLineWidth(w);
   32.66 +    }
   32.67 +  }
   32.68 +  return 0;
   32.69 +}
   32.70 +
   32.71 +
   32.72 +int DigraphDisplayerCanvas::changeArcWidth (std::string mapname, Arc arc)
   32.73 +{
   32.74 +  MapStorage& ms = *mytab.mapstorage;
   32.75 +  double min, max;
   32.76 +
   32.77 +  {
   32.78 +    ArcIt e(ms.digraph);
   32.79 +    min = max = ms.get(mapname, e);
   32.80 +    for (; e != INVALID; ++e)
   32.81 +    {
   32.82 +      if (static_cast<double>(ms.get(mapname, e)) > max)
   32.83 +        max = ms.get(mapname, e);
   32.84 +      if (static_cast<double>(ms.get(mapname, e)) < min)
   32.85 +        min = ms.get(mapname, e);
   32.86 +    }
   32.87 +  }
   32.88 +
   32.89 +  if(arc==INVALID)
   32.90 +  {
   32.91 +    for (ArcIt i(ms.digraph); i!=INVALID; ++i)
   32.92 +    {
   32.93 +      double v=ms.get(mapname, i);
   32.94 +      int w;
   32.95 +      if(autoscale)
   32.96 +      {
   32.97 +        if(min==max)
   32.98 +        {
   32.99 +          w=(int)(arc_property_defaults[E_WIDTH]);
  32.100 +        }
  32.101 +        else
  32.102 +        {
  32.103 +          w=(int)(minimum_arc_width+(v-min)/(max-min)*(arc_width-minimum_arc_width));
  32.104 +        }
  32.105 +      }
  32.106 +      else
  32.107 +      {
  32.108 +        w=(int)(v*arc_width);
  32.109 +      }
  32.110 +      if(w<0)
  32.111 +      {
  32.112 +        arcsmap[i]->hide();
  32.113 +      }
  32.114 +      else
  32.115 +      {
  32.116 +        arcsmap[i]->show();
  32.117 +        if(w<minimum_arc_width)
  32.118 +        {
  32.119 +          w=minimum_arc_width;
  32.120 +        }
  32.121 +        if(zoomtrack)
  32.122 +        {
  32.123 +          double actual_ppu=get_pixels_per_unit();
  32.124 +          w=(int)(w/actual_ppu*fixed_zoom_factor);
  32.125 +        }
  32.126 +        arcsmap[i]->setLineWidth(w);
  32.127 +      }
  32.128 +    }
  32.129 +  }
  32.130 +  else
  32.131 +  {
  32.132 +    int w=(int)ms.get(mapname, arc);
  32.133 +    if(w>=0)
  32.134 +    {
  32.135 +      arcsmap[arc]->setLineWidth(w);
  32.136 +    }
  32.137 +  }
  32.138 +  return 0;
  32.139 +};
  32.140 +
  32.141 +int DigraphDisplayerCanvas::changeArcColor (std::string mapname, Arc arc)
  32.142 +{  
  32.143 +  MapStorage& ms = *mytab.mapstorage;
  32.144 +
  32.145 +  //function maps the range of the maximum and
  32.146 +  //the minimum of the nodemap to the range of
  32.147 +  //green in RGB
  32.148 +
  32.149 +  double max, min;
  32.150 +
  32.151 +  {
  32.152 +    ArcIt e(ms.digraph);
  32.153 +    min = max = ms.get(mapname, e);
  32.154 +    for (; e != INVALID; ++e)
  32.155 +    {
  32.156 +      if (static_cast<double>(ms.get(mapname, e)) > max)
  32.157 +        max = ms.get(mapname, e);
  32.158 +      if (static_cast<double>(ms.get(mapname, e)) < min)
  32.159 +        min = ms.get(mapname, e);
  32.160 +    }
  32.161 +  }
  32.162 +
  32.163 +  if(arc==INVALID)
  32.164 +    {
  32.165 +      for (ArcIt i(ms.digraph); i!=INVALID; ++i)
  32.166 +	{
  32.167 +	  double w=ms.get(mapname, i);
  32.168 +
  32.169 +	  Gdk::Color color;
  32.170 +	  if(max!=min)
  32.171 +	    {
  32.172 +	      color=rainbowColorCounter(min, max, w);
  32.173 +	    }
  32.174 +	  else
  32.175 +	    {
  32.176 +	      color.set_rgb_p (0, 1, 0);
  32.177 +	    }
  32.178 +	  arcsmap[i]->setFillColor(color);
  32.179 +	}
  32.180 +    }
  32.181 +  else
  32.182 +    {
  32.183 +      Gdk::Color color;
  32.184 +
  32.185 +      double w=ms.get(mapname, arc);
  32.186 +
  32.187 +      if(max!=min)
  32.188 +	{
  32.189 +	  color=rainbowColorCounter(min, max, w);
  32.190 +	}
  32.191 +      else
  32.192 +	{
  32.193 +	  color.set_rgb_p (0, 1, 0);
  32.194 +	}
  32.195 +
  32.196 +      arcsmap[arc]->setFillColor(color);
  32.197 +    }
  32.198 +  return 0;
  32.199 +};
  32.200 +
  32.201 +int DigraphDisplayerCanvas::resetArcColor (Arc arc)
  32.202 +{  
  32.203 +  MapStorage& ms = *mytab.mapstorage;
  32.204 +
  32.205 +  //function maps the range of the maximum and
  32.206 +  //the minimum of the nodemap to the range of
  32.207 +  //green in RGB
  32.208 +  Digraph::ArcMap<double> actual_map(ms.digraph,arc_property_defaults[E_COLOR]);
  32.209 +
  32.210 +  double max, min;
  32.211 +
  32.212 +  max=arc_property_defaults[E_COLOR];
  32.213 +  min=arc_property_defaults[E_COLOR];
  32.214 +
  32.215 +  if(arc==INVALID)
  32.216 +  {
  32.217 +    for (ArcIt i(ms.digraph); i!=INVALID; ++i)
  32.218 +    {
  32.219 +      double w=actual_map[i];
  32.220 +
  32.221 +      Gdk::Color color;
  32.222 +      if(max!=min)
  32.223 +      {
  32.224 +        color.set_rgb_p (0, 100*(w-min)/(max-min), 0);
  32.225 +      }
  32.226 +      else
  32.227 +      {
  32.228 +        color.set_rgb_p (0, 100, 0);
  32.229 +      }
  32.230 +      arcsmap[i]->setFillColor(color);
  32.231 +    }
  32.232 +  }
  32.233 +  else
  32.234 +  {
  32.235 +    Gdk::Color color;
  32.236 +
  32.237 +    double w=actual_map[arc];
  32.238 +
  32.239 +    if(max!=min)
  32.240 +    {
  32.241 +      color.set_rgb_p (0, 100*(w-min)/(max-min), 0);
  32.242 +    }
  32.243 +    else
  32.244 +    {
  32.245 +      color.set_rgb_p (0, 100, 0);
  32.246 +    }
  32.247 +
  32.248 +    arcsmap[arc]->setFillColor(color);
  32.249 +  }
  32.250 +  return 0;
  32.251 +};
  32.252 +
  32.253 +int DigraphDisplayerCanvas::changeArcText (std::string mapname, Arc arc)
  32.254 +{
  32.255 +  MapStorage& ms = *mytab.mapstorage;
  32.256 +
  32.257 +  //the number in the map will be written on the arc
  32.258 +  //EXCEPT when the name of the map is Default, because
  32.259 +  //in that case empty string will be written, because
  32.260 +  //that is the deleter map
  32.261 +
  32.262 +  if(arc==INVALID)
  32.263 +  {
  32.264 +    for (ArcIt i(ms.digraph); i!=INVALID; ++i)
  32.265 +    {
  32.266 +      arcmap_to_edit=mapname;
  32.267 +
  32.268 +      arctextmap[i]->property_text().set_value(
  32.269 +          static_cast<std::string>(ms.get(mapname, i)));
  32.270 +    }
  32.271 +
  32.272 +  }
  32.273 +  else
  32.274 +  {
  32.275 +    arctextmap[arc]->property_text().set_value(
  32.276 +        static_cast<std::string>(ms.get(mapname, arc)));
  32.277 +  }
  32.278 +
  32.279 +  return 0;
  32.280 +};
  32.281 +
  32.282 +int DigraphDisplayerCanvas::resetArcText (Arc arc)
  32.283 +{
  32.284 +  MapStorage& ms = *mytab.mapstorage;
  32.285 +
  32.286 +  //the number in the map will be written on the arc
  32.287 +  //EXCEPT when the name of the map is Default, because
  32.288 +  //in that case empty string will be written, because
  32.289 +  //that is the deleter map
  32.290 +
  32.291 +  if(arc==INVALID)
  32.292 +  {
  32.293 +    for (ArcIt i(ms.digraph); i!=INVALID; ++i)
  32.294 +    {
  32.295 +      arcmap_to_edit="";
  32.296 +      arctextmap[i]->property_text().set_value("");
  32.297 +    }
  32.298 +  }
  32.299 +  else
  32.300 +  {
  32.301 +    arctextmap[arc]->property_text().set_value("");
  32.302 +  }
  32.303 +
  32.304 +  return 0;
  32.305 +};
    33.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.2 +++ b/graph_displayer_canvas-event.cc	Mon Jul 07 08:10:39 2008 -0500
    33.3 @@ -0,0 +1,967 @@
    33.4 +/* -*- C++ -*-
    33.5 + *
    33.6 + * This file is a part of LEMON, a generic C++ optimization library
    33.7 + *
    33.8 + * Copyright (C) 2003-2006
    33.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
   33.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
   33.11 + *
   33.12 + * Permission to use, modify and distribute this software is granted
   33.13 + * provided that this copyright notice appears in all copies. For
   33.14 + * precise terms see the accompanying LICENSE file.
   33.15 + *
   33.16 + * This software is provided "AS IS" with no warranty of any kind,
   33.17 + * express or implied, and with no claim as to its suitability for any
   33.18 + * purpose.
   33.19 + *
   33.20 + */
   33.21 +
   33.22 +#include <graph_displayer_canvas.h>
   33.23 +#include <mapstorage.h>
   33.24 +#include <nbtab.h>
   33.25 +#include <cmath>
   33.26 +#include <set>
   33.27 +
   33.28 +bool DigraphDisplayerCanvas::on_expose_event(GdkEventExpose *event)
   33.29 +{
   33.30 +  Gnome::Canvas::CanvasAA::on_expose_event(event);
   33.31 +  //usleep(10000);
   33.32 +  //rezoom();
   33.33 +  return true;
   33.34 +}
   33.35 +
   33.36 +void DigraphDisplayerCanvas::changeEditorialTool(int newtool)
   33.37 +{
   33.38 +  if(actual_tool!=newtool)
   33.39 +  {
   33.40 +
   33.41 +    actual_handler.disconnect();
   33.42 +
   33.43 +    switch(actual_tool)
   33.44 +    {
   33.45 +      case CREATE_EDGE:
   33.46 +        {
   33.47 +          GdkEvent * generated=new GdkEvent();
   33.48 +          generated->type=GDK_BUTTON_RELEASE;
   33.49 +          generated->button.button=3;
   33.50 +          createArcEventHandler(generated);      
   33.51 +          break;
   33.52 +        }
   33.53 +      case MAP_EDIT:
   33.54 +        {
   33.55 +          break;
   33.56 +        }
   33.57 +      default:
   33.58 +        break;
   33.59 +    }
   33.60 +
   33.61 +    active_item=NULL; 
   33.62 +    target_item=NULL; 
   33.63 +    active_arc=INVALID;	
   33.64 +    active_node=INVALID;	
   33.65 +
   33.66 +
   33.67 +    actual_tool=newtool;
   33.68 +
   33.69 +    switch(newtool)
   33.70 +    {
   33.71 +      case MOVE:
   33.72 +        actual_handler=signal_event().connect(sigc::mem_fun(*this, &DigraphDisplayerCanvas::moveEventHandler), false);
   33.73 +        break;
   33.74 +
   33.75 +      case CREATE_NODE:
   33.76 +        actual_handler=signal_event().connect(sigc::mem_fun(*this, &DigraphDisplayerCanvas::createNodeEventHandler), false);
   33.77 +        break;
   33.78 +
   33.79 +      case CREATE_EDGE:
   33.80 +        actual_handler=signal_event().connect(sigc::mem_fun(*this, &DigraphDisplayerCanvas::createArcEventHandler), false);
   33.81 +        break;
   33.82 +
   33.83 +      case ERASER:
   33.84 +        actual_handler=signal_event().connect(sigc::mem_fun(*this, &DigraphDisplayerCanvas::eraserEventHandler), false);
   33.85 +        break;
   33.86 +
   33.87 +      case MAP_EDIT:
   33.88 +        grab_focus();
   33.89 +        actual_handler=signal_event().connect(sigc::mem_fun(*this, &DigraphDisplayerCanvas::mapEditEventHandler), false);
   33.90 +        break;
   33.91 +
   33.92 +      default:
   33.93 +        break;
   33.94 +    }
   33.95 +  }
   33.96 +}
   33.97 +
   33.98 +int DigraphDisplayerCanvas::getActualTool()
   33.99 +{
  33.100 +  return actual_tool;
  33.101 +}
  33.102 +
  33.103 +bool DigraphDisplayerCanvas::scrollEventHandler(GdkEvent* e)
  33.104 +{
  33.105 +  bool handled=false;
  33.106 +  if(e->type==GDK_SCROLL)
  33.107 +    {
  33.108 +
  33.109 +      //pointer shows this win point before zoom
  33.110 +      XY win_coord(((GdkEventScroll*)e)->x, ((GdkEventScroll*)e)->y);
  33.111 +
  33.112 +      //the original scroll settings
  33.113 +      int scroll_offset_x, scroll_offset_y;
  33.114 +      get_scroll_offsets(scroll_offset_x, scroll_offset_y);
  33.115 +
  33.116 +      //pointer shows this canvas point before zoom
  33.117 +      XY canvas_coord;
  33.118 +      window_to_world(win_coord.x, win_coord.y, canvas_coord.x, canvas_coord.y);
  33.119 +
  33.120 +      if(((GdkEventScroll*)e)->direction) //IN
  33.121 +	{
  33.122 +	  zoomIn();
  33.123 +	}
  33.124 +      else
  33.125 +	{
  33.126 +	  zoomOut();
  33.127 +	}
  33.128 +
  33.129 +      //pointer shows this window point after zoom
  33.130 +      XY post_win_coord;
  33.131 +      world_to_window(canvas_coord.x, canvas_coord.y, post_win_coord.x, post_win_coord.y);
  33.132 +
  33.133 +      //we have to add the difference between new and old window point to original scroll offset
  33.134 +      scroll_to(scroll_offset_x+(int)(post_win_coord.x-win_coord.x),scroll_offset_y+(int)(post_win_coord.y-win_coord.y));
  33.135 +      
  33.136 +      //no other eventhandler is needed
  33.137 +      handled=true;
  33.138 +    }
  33.139 +  return handled;
  33.140 +}
  33.141 +
  33.142 +bool DigraphDisplayerCanvas::moveEventHandler(GdkEvent* e)
  33.143 +{
  33.144 +  MapStorage& ms = *mytab.mapstorage;
  33.145 +
  33.146 +  static Gnome::Canvas::Text *coord_text = 0;
  33.147 +  switch(e->type)
  33.148 +  {
  33.149 +    case GDK_BUTTON_PRESS:
  33.150 +      //we mark the location of the event to be able to calculate parameters of dragging
  33.151 +      window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
  33.152 +
  33.153 +      active_item=(get_item_at(clicked_x, clicked_y));
  33.154 +      active_node=INVALID;
  33.155 +      for (NodeIt i(ms.digraph); i!=INVALID; ++i)
  33.156 +      {
  33.157 +        if(nodesmap[i]==active_item)
  33.158 +        {
  33.159 +          active_node=i;
  33.160 +        }
  33.161 +      }
  33.162 +      isbutton=e->button.button;
  33.163 +      break;
  33.164 +    case GDK_BUTTON_RELEASE:
  33.165 +      if (coord_text)
  33.166 +      {
  33.167 +        delete coord_text;
  33.168 +        coord_text = 0;
  33.169 +      }
  33.170 +      isbutton=0;
  33.171 +      active_item=NULL;
  33.172 +      active_node=INVALID;
  33.173 +      break;
  33.174 +    case GDK_MOTION_NOTIFY:
  33.175 +      //we only have to do sg. if the mouse button is pressed AND the click was on a node that was found in the set of nodes
  33.176 +      if(active_node!=INVALID)
  33.177 +      {
  33.178 +        ms.setModified();
  33.179 +
  33.180 +        //new coordinates will be the old values,
  33.181 +        //because the item will be moved to the
  33.182 +        //new coordinate therefore the new movement
  33.183 +        //has to be calculated from here
  33.184 +
  33.185 +        double new_x, new_y;
  33.186 +
  33.187 +        window_to_world (e->motion.x, e->motion.y, new_x, new_y);
  33.188 +
  33.189 +        double dx=new_x-clicked_x;
  33.190 +        double dy=new_y-clicked_y;
  33.191 +
  33.192 +        moveNode(dx, dy);
  33.193 +
  33.194 +        clicked_x=new_x;
  33.195 +        clicked_y=new_y;
  33.196 +
  33.197 +        // reposition the coordinates text
  33.198 +        std::ostringstream ostr;
  33.199 +        ostr << "(" <<
  33.200 +          ms.getNodeCoords(active_node).x << ", " <<
  33.201 +          ms.getNodeCoords(active_node).y << ")";
  33.202 +        double radius =
  33.203 +          (nodesmap[active_node]->property_x2().get_value() -
  33.204 +           nodesmap[active_node]->property_x1().get_value()) / 2.0;
  33.205 +        if (coord_text)
  33.206 +        {
  33.207 +          coord_text->property_text().set_value(ostr.str());
  33.208 +          coord_text->property_x().set_value(
  33.209 +              ms.getNodeCoords(active_node).x + radius);
  33.210 +          coord_text->property_y().set_value(
  33.211 +              ms.getNodeCoords(active_node).y - radius);
  33.212 +        }
  33.213 +        else
  33.214 +        {
  33.215 +          coord_text = new Gnome::Canvas::Text(
  33.216 +              displayed_graph,
  33.217 +              ms.getNodeCoords(active_node).x + radius,
  33.218 +              ms.getNodeCoords(active_node).y - radius,
  33.219 +              ostr.str());
  33.220 +          coord_text->property_fill_color().set_value("black");
  33.221 +          coord_text->property_anchor().set_value(Gtk::ANCHOR_SOUTH_WEST);
  33.222 +        }
  33.223 +
  33.224 +
  33.225 +      }
  33.226 +    default: break;
  33.227 +  }
  33.228 +
  33.229 +  return false;
  33.230 +}
  33.231 +
  33.232 +XY DigraphDisplayerCanvas::calcArrowPos(XY moved_node_1, XY moved_node_2, XY fix_node, XY old_arrow_pos, int move_code)
  33.233 +{
  33.234 +  switch(move_code)
  33.235 +  {
  33.236 +    case 1:
  33.237 +      return XY((moved_node_2.x + fix_node.x) / 2.0, (moved_node_2.y + fix_node.y) / 2.0);
  33.238 +      break;
  33.239 +    case 2:
  33.240 +      return old_arrow_pos;
  33.241 +      break;
  33.242 +    case 3:
  33.243 +      {
  33.244 +        //////////////////////////////////////////////////////////////////////////////////////////////////////
  33.245 +        /////////// keeps shape-with scalar multiplication - version 2.
  33.246 +        //////////////////////////////////////////////////////////////////////////////////////////////////////
  33.247 +
  33.248 +        //old vector from one to the other node - a
  33.249 +        XY a_v(moved_node_1.x-fix_node.x,moved_node_1.y-fix_node.y);
  33.250 +        //new vector from one to the other node - b
  33.251 +        XY b_v(moved_node_2.x-fix_node.x,moved_node_2.y-fix_node.y);
  33.252 +
  33.253 +        double absa=sqrt(a_v.normSquare());
  33.254 +        double absb=sqrt(b_v.normSquare());
  33.255 +
  33.256 +        if ((absa == 0.0) || (absb == 0.0))
  33.257 +        {
  33.258 +          return old_arrow_pos;
  33.259 +        }
  33.260 +        else
  33.261 +        {
  33.262 +          //old vector from one node to the breakpoint - c
  33.263 +          XY c_v(old_arrow_pos.x-fix_node.x,old_arrow_pos.y-fix_node.y);
  33.264 +
  33.265 +          //unit vector with the same direction to a_v
  33.266 +          XY a_v_u(a_v.x/absa,a_v.y/absa);
  33.267 +
  33.268 +          //normal vector of unit vector with the same direction to a_v
  33.269 +          XY a_v_u_n(((-1)*a_v_u.y),a_v_u.x);
  33.270 +
  33.271 +          //unit vector with the same direction to b_v
  33.272 +          XY b_v_u(b_v.x/absb,b_v.y/absb);
  33.273 +
  33.274 +          //normal vector of unit vector with the same direction to b_v
  33.275 +          XY b_v_u_n(((-1)*b_v_u.y),b_v_u.x);
  33.276 +
  33.277 +          //vector c in a_v_u and a_v_u_n co-ordinate system
  33.278 +          XY c_a(c_v*a_v_u,c_v*a_v_u_n);
  33.279 +
  33.280 +          //new vector from one node to the breakpoint - d - we have to calculate this one
  33.281 +          XY d_v=absb/absa*(c_a.x*b_v_u+c_a.y*b_v_u_n);
  33.282 +
  33.283 +          return XY(d_v.x+fix_node.x,d_v.y+fix_node.y);
  33.284 +        }
  33.285 +        break;
  33.286 +      }
  33.287 +    default:
  33.288 +      break;
  33.289 +  }
  33.290 +}
  33.291 +
  33.292 +
  33.293 +bool DigraphDisplayerCanvas::createNodeEventHandler(GdkEvent* e)
  33.294 +{
  33.295 +  MapStorage& ms = *mytab.mapstorage;
  33.296 +
  33.297 +  switch(e->type)
  33.298 +  {
  33.299 +    //move the new node
  33.300 +    case GDK_MOTION_NOTIFY:
  33.301 +      {
  33.302 +        GdkEvent * generated=new GdkEvent();
  33.303 +        generated->motion.x=e->motion.x;
  33.304 +        generated->motion.y=e->motion.y;
  33.305 +        generated->type=GDK_MOTION_NOTIFY;
  33.306 +        moveEventHandler(generated);      
  33.307 +        break;
  33.308 +      }
  33.309 +
  33.310 +    case GDK_BUTTON_RELEASE:
  33.311 +      ms.setModified();
  33.312 +
  33.313 +      is_drawn=true;
  33.314 +
  33.315 +      isbutton=1;
  33.316 +
  33.317 +      window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
  33.318 +
  33.319 +      active_node = ms.addNode(XY(clicked_x, clicked_y));
  33.320 +
  33.321 +      nodesmap[active_node]=new Gnome::Canvas::Ellipse(displayed_graph,
  33.322 +          clicked_x-20, clicked_y-20, clicked_x+20, clicked_y+20);
  33.323 +      active_item=(Gnome::Canvas::Item *)(nodesmap[active_node]);
  33.324 +      *(nodesmap[active_node]) <<
  33.325 +        Gnome::Canvas::Properties::fill_color("blue");
  33.326 +      *(nodesmap[active_node]) <<
  33.327 +        Gnome::Canvas::Properties::outline_color("black");
  33.328 +      active_item->raise_to_top();
  33.329 +
  33.330 +      (nodesmap[active_node])->show();
  33.331 +
  33.332 +      nodetextmap[active_node]=new Gnome::Canvas::Text(displayed_graph,
  33.333 +          clicked_x+node_property_defaults[N_RADIUS]+5,
  33.334 +          clicked_y+node_property_defaults[N_RADIUS]+5, "");
  33.335 +      nodetextmap[active_node]->property_fill_color().set_value("darkblue");
  33.336 +      nodetextmap[active_node]->raise_to_top();
  33.337 +
  33.338 +      //       mapwin.updateNode(active_node);
  33.339 +      propertyUpdate(active_node);
  33.340 +
  33.341 +      isbutton=0;
  33.342 +      target_item=NULL;
  33.343 +      active_item=NULL;
  33.344 +      active_node=INVALID;
  33.345 +      break;
  33.346 +    default:
  33.347 +      break;
  33.348 +  }
  33.349 +  return false;
  33.350 +}
  33.351 +
  33.352 +bool DigraphDisplayerCanvas::createArcEventHandler(GdkEvent* e)
  33.353 +{
  33.354 +  MapStorage& ms = *mytab.mapstorage;
  33.355 +
  33.356 +  switch(e->type)
  33.357 +  {
  33.358 +    case GDK_BUTTON_PRESS:
  33.359 +      //in arc creation right button has special meaning
  33.360 +      if(e->button.button!=3)
  33.361 +      {
  33.362 +        //there is not yet selected node
  33.363 +        if(active_node==INVALID)
  33.364 +        {
  33.365 +          //we mark the location of the event to be able to calculate parameters of dragging
  33.366 +
  33.367 +          window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
  33.368 +
  33.369 +          active_item=(get_item_at(clicked_x, clicked_y));
  33.370 +          active_node=INVALID;
  33.371 +          for (NodeIt i(ms.digraph); i!=INVALID; ++i)
  33.372 +          {
  33.373 +            if(nodesmap[i]==active_item)
  33.374 +            {
  33.375 +              active_node=i;
  33.376 +            }
  33.377 +          }
  33.378 +          //the clicked item is really a node
  33.379 +          if(active_node!=INVALID)
  33.380 +          {
  33.381 +            *(nodesmap[active_node]) << Gnome::Canvas::Properties::fill_color("red");
  33.382 +            isbutton=1;
  33.383 +          }
  33.384 +          //clicked item was not a node. It could be e.g. arc.
  33.385 +          else
  33.386 +          {
  33.387 +            active_item=NULL;
  33.388 +          }
  33.389 +        }
  33.390 +        //we only have to do sg. if the mouse button
  33.391 +        // is pressed already once AND the click was
  33.392 +        // on a node that was found in the set of 
  33.393 +        //nodes, and now we only search for the second 
  33.394 +        //node
  33.395 +        else
  33.396 +        {
  33.397 +          window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
  33.398 +          target_item=(get_item_at(clicked_x, clicked_y));
  33.399 +          Node target_node=INVALID;
  33.400 +          for (NodeIt i(ms.digraph); i!=INVALID; ++i)
  33.401 +          {
  33.402 +            if(nodesmap[i]==target_item)
  33.403 +            {
  33.404 +              target_node=i;
  33.405 +            }
  33.406 +          }
  33.407 +          //the clicked item is a node, the arc can be drawn
  33.408 +          if(target_node!=INVALID)
  33.409 +          {
  33.410 +            ms.setModified();
  33.411 +
  33.412 +            *(nodesmap[target_node]) <<
  33.413 +              Gnome::Canvas::Properties::fill_color("red");
  33.414 +
  33.415 +            active_arc = ms.addArc(active_node, target_node);
  33.416 +
  33.417 +            if(target_node!=active_node)		
  33.418 +            {
  33.419 +              arcsmap[active_arc]=new BrokenArc(displayed_graph, active_arc, *this);
  33.420 +            }
  33.421 +            else
  33.422 +            {
  33.423 +              arcsmap[active_arc]=new LoopArc(displayed_graph, active_arc, *this);
  33.424 +            }
  33.425 +
  33.426 +            //initializing arc-text as well, to empty string
  33.427 +            XY text_pos=ms.getArrowCoords(active_arc);
  33.428 +            text_pos+=(XY(10,10));
  33.429 +
  33.430 +            arctextmap[active_arc]=new Gnome::Canvas::Text(displayed_graph,
  33.431 +                text_pos.x, text_pos.y, "");
  33.432 +            arctextmap[active_arc]->property_fill_color().set_value(
  33.433 +                "darkgreen");
  33.434 +            arctextmap[active_arc]->raise_to_top();
  33.435 +
  33.436 +            propertyUpdate(active_arc);
  33.437 +          }
  33.438 +          //clicked item was not a node. it could be an e.g. arc. we do not
  33.439 +          //deal with it furthermore.
  33.440 +          else
  33.441 +          {
  33.442 +            target_item=NULL;
  33.443 +          }
  33.444 +        }
  33.445 +      }
  33.446 +      break;
  33.447 +    case GDK_BUTTON_RELEASE:
  33.448 +      isbutton=0;
  33.449 +      //we clear settings in two cases
  33.450 +      //1: the arc is ready (target_item has valid value)
  33.451 +      //2: the arc creation is cancelled with right button
  33.452 +      if((target_item)||(e->button.button==3))
  33.453 +      {
  33.454 +        if(active_item)
  33.455 +        {
  33.456 +          propertyUpdate(active_node,N_COLOR);
  33.457 +          active_item=NULL;
  33.458 +        }
  33.459 +        if(target_item)
  33.460 +        {
  33.461 +          propertyUpdate(ms.digraph.target(active_arc),N_COLOR);
  33.462 +          target_item=NULL;
  33.463 +        }
  33.464 +        active_node=INVALID;
  33.465 +        active_arc=INVALID;
  33.466 +      }
  33.467 +      break;
  33.468 +    default:
  33.469 +      break;
  33.470 +  }
  33.471 +  return false;
  33.472 +}
  33.473 +
  33.474 +bool DigraphDisplayerCanvas::eraserEventHandler(GdkEvent* e)
  33.475 +{
  33.476 +  MapStorage& ms = *mytab.mapstorage;
  33.477 +
  33.478 +  switch(e->type)
  33.479 +  {
  33.480 +    case GDK_BUTTON_PRESS:
  33.481 +      //finding the clicked items
  33.482 +      window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
  33.483 +      active_item=(get_item_at(clicked_x, clicked_y));
  33.484 +      active_node=INVALID;
  33.485 +      active_arc=INVALID;
  33.486 +      //was it a node?
  33.487 +      for (NodeIt i(ms.digraph); i!=INVALID; ++i)
  33.488 +      {
  33.489 +        if(nodesmap[i]==active_item)
  33.490 +        {
  33.491 +          active_node=i;
  33.492 +        }
  33.493 +      }
  33.494 +      //or was it an arc?
  33.495 +      if(active_node==INVALID)
  33.496 +      {
  33.497 +        for (ArcIt i(ms.digraph); i!=INVALID; ++i)
  33.498 +        {
  33.499 +          if(arcsmap[i]->getLine()==active_item)
  33.500 +          {
  33.501 +            active_arc=i;
  33.502 +          }
  33.503 +        }
  33.504 +      }
  33.505 +
  33.506 +      // return if the clicked object is neither an arc nor a node
  33.507 +      if (active_arc == INVALID) return false;
  33.508 +
  33.509 +      //recolor activated item
  33.510 +      if(active_item)
  33.511 +      {
  33.512 +        *active_item << Gnome::Canvas::Properties::fill_color("red");
  33.513 +      }
  33.514 +      break;
  33.515 +
  33.516 +    case GDK_BUTTON_RELEASE:
  33.517 +      window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
  33.518 +      if(active_item)
  33.519 +      {
  33.520 +        //the cursor was not moved since pressing it
  33.521 +        if( active_item == ( get_item_at (clicked_x, clicked_y) ) )
  33.522 +        {
  33.523 +          //a node was found
  33.524 +          if(active_node!=INVALID)
  33.525 +          {
  33.526 +            ms.setModified();
  33.527 +
  33.528 +            std::set<Digraph::Arc> arcs_to_delete;
  33.529 +
  33.530 +            for(OutArcIt e(ms.digraph,active_node);e!=INVALID;++e)
  33.531 +            {
  33.532 +              arcs_to_delete.insert(e);
  33.533 +            }
  33.534 +
  33.535 +            for(InArcIt e(ms.digraph,active_node);e!=INVALID;++e)
  33.536 +            {
  33.537 +              arcs_to_delete.insert(e);
  33.538 +            }
  33.539 +
  33.540 +            //deleting collected arcs
  33.541 +            for(std::set<Digraph::Arc>::iterator
  33.542 +                arc_set_it=arcs_to_delete.begin();
  33.543 +                arc_set_it!=arcs_to_delete.end();
  33.544 +                ++arc_set_it)
  33.545 +            {
  33.546 +              deleteItem(*arc_set_it);
  33.547 +            }
  33.548 +            deleteItem(active_node);
  33.549 +          }
  33.550 +          //a simple arc was chosen
  33.551 +          else if (active_arc != INVALID)
  33.552 +          {
  33.553 +            deleteItem(active_arc);
  33.554 +          }
  33.555 +        }
  33.556 +        //pointer was moved, deletion is cancelled
  33.557 +        else
  33.558 +        {
  33.559 +          if(active_node!=INVALID)
  33.560 +          {
  33.561 +            *active_item << Gnome::Canvas::Properties::fill_color("blue");
  33.562 +          }
  33.563 +          else if (active_arc != INVALID)
  33.564 +          {
  33.565 +            *active_item << Gnome::Canvas::Properties::fill_color("green");
  33.566 +          }
  33.567 +        }
  33.568 +      }
  33.569 +      //reseting datas
  33.570 +      active_item=NULL;
  33.571 +      active_arc=INVALID;
  33.572 +      active_node=INVALID;
  33.573 +      break;
  33.574 +
  33.575 +    case GDK_MOTION_NOTIFY:
  33.576 +      break;
  33.577 +
  33.578 +    default:
  33.579 +      break;
  33.580 +  }
  33.581 +  return false;
  33.582 +}
  33.583 +
  33.584 +bool DigraphDisplayerCanvas::mapEditEventHandler(GdkEvent* e)
  33.585 +{
  33.586 +  MapStorage& ms = *mytab.mapstorage;
  33.587 +
  33.588 +  if(actual_tool==MAP_EDIT)
  33.589 +  {
  33.590 +    switch(e->type)
  33.591 +    {
  33.592 +      case GDK_BUTTON_PRESS:
  33.593 +        {
  33.594 +          //for determine, whether it was an arc
  33.595 +          Arc clicked_arc=INVALID;
  33.596 +          //for determine, whether it was a node
  33.597 +          Node clicked_node=INVALID;
  33.598 +
  33.599 +          window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
  33.600 +          active_item=(get_item_at(clicked_x, clicked_y));
  33.601 +
  33.602 +          //find the activated item between text of nodes
  33.603 +          for (NodeIt i(ms.digraph); i!=INVALID; ++i)
  33.604 +          {
  33.605 +            //at the same time only one can be active
  33.606 +            if(nodetextmap[i]==active_item)
  33.607 +            {
  33.608 +              clicked_node=i;
  33.609 +            }
  33.610 +          }
  33.611 +
  33.612 +          //if there was not, search for it between nodes
  33.613 +          if(clicked_node==INVALID)
  33.614 +          {
  33.615 +            for (NodeIt i(ms.digraph); i!=INVALID; ++i)
  33.616 +            {
  33.617 +              //at the same time only one can be active
  33.618 +              if(nodesmap[i]==active_item)
  33.619 +              {
  33.620 +                clicked_node=i;
  33.621 +              }
  33.622 +            }
  33.623 +          }
  33.624 +
  33.625 +          if(clicked_node==INVALID)
  33.626 +          {
  33.627 +            //find the activated item between texts
  33.628 +            for (ArcIt i(ms.digraph); i!=INVALID; ++i)
  33.629 +            {
  33.630 +              //at the same time only one can be active
  33.631 +              if(arctextmap[i]==active_item)
  33.632 +              {
  33.633 +                clicked_arc=i;
  33.634 +              }
  33.635 +            }
  33.636 +
  33.637 +            //if it was not between texts, search for it between arcs
  33.638 +            if(clicked_arc==INVALID)
  33.639 +            {
  33.640 +              for (ArcIt i(ms.digraph); i!=INVALID; ++i)
  33.641 +              {
  33.642 +                //at the same time only one can be active
  33.643 +                if((arcsmap[i]->getLine())==active_item)
  33.644 +                {
  33.645 +                  clicked_arc=i;
  33.646 +                }
  33.647 +              }
  33.648 +            }
  33.649 +          }
  33.650 +
  33.651 +          //if it was really a node...
  33.652 +          if(clicked_node!=INVALID)
  33.653 +          {
  33.654 +            // the id map is not editable
  33.655 +            if (nodemap_to_edit == "label") return 0;
  33.656 +
  33.657 +            //and there is activated map
  33.658 +            if(nodetextmap[clicked_node]->property_text().get_value()!="")
  33.659 +            {
  33.660 +              //activate the general variable for it
  33.661 +              active_node=clicked_node;
  33.662 +
  33.663 +              //create a dialog
  33.664 +              Gtk::Dialog dialog("Edit value", true);
  33.665 +              dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
  33.666 +              dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_ACCEPT);
  33.667 +              Gtk::VBox* vbox = dialog.get_vbox();
  33.668 +
  33.669 +              /*
  33.670 +              Gtk::SpinButton spin(0.0, 4);
  33.671 +              spin.set_increments(1.0, 10.0);
  33.672 +              spin.set_range(-1000000.0, 1000000.0);
  33.673 +              spin.set_numeric(true);
  33.674 +              spin.set_value(atof(nodetextmap[active_node]->property_text().get_value().c_str()));
  33.675 +              vbox->add(spin);
  33.676 +              spin.show();
  33.677 +              */
  33.678 +              Gtk::Entry entry;
  33.679 +              entry.set_text(nodetextmap[active_node]->property_text().get_value());
  33.680 +              vbox->add(entry);
  33.681 +              entry.show();
  33.682 +
  33.683 +              switch (dialog.run())
  33.684 +              {
  33.685 +                case Gtk::RESPONSE_NONE:
  33.686 +                case Gtk::RESPONSE_CANCEL:
  33.687 +                  break;
  33.688 +                case Gtk::RESPONSE_ACCEPT:
  33.689 +                  switch (ms.getNodeMapElementType(nodemap_to_edit))
  33.690 +                  {
  33.691 +                    case MapValue::NUMERIC:
  33.692 +                      ms.set(nodemap_to_edit, active_node,
  33.693 +                          atof(entry.get_text().c_str()));
  33.694 +                      break;
  33.695 +                    case MapValue::STRING:
  33.696 +                      ms.set(nodemap_to_edit, active_node,
  33.697 +                          static_cast<std::string>(entry.get_text()));
  33.698 +                      break;
  33.699 +                  }
  33.700 +                  nodetextmap[active_node]->property_text().set_value(
  33.701 +                      static_cast<std::string>(ms.get(nodemap_to_edit, active_node)));
  33.702 +
  33.703 +                  //mapwin.updateNode(active_node);
  33.704 +                  //mapwin.updateNode(Node(INVALID));
  33.705 +                  propertyUpdate(Node(INVALID));
  33.706 +              }
  33.707 +            }
  33.708 +          }
  33.709 +          else
  33.710 +            //if it was really an arc...
  33.711 +            if(clicked_arc!=INVALID)
  33.712 +            {
  33.713 +              // the id map is not editable
  33.714 +              if (arcmap_to_edit == "label") return 0;
  33.715 +
  33.716 +              //and there is activated map
  33.717 +              if(arctextmap[clicked_arc]->property_text().get_value()!="")
  33.718 +              {
  33.719 +                //activate the general variable for it
  33.720 +                active_arc=clicked_arc;
  33.721 +
  33.722 +                //create a dialog
  33.723 +                Gtk::Dialog dialog("Edit value", true);
  33.724 +                dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
  33.725 +                dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_ACCEPT);
  33.726 +                Gtk::VBox* vbox = dialog.get_vbox();
  33.727 +
  33.728 +                /*
  33.729 +                Gtk::SpinButton spin(0.0, 4);
  33.730 +                spin.set_increments(1.0, 10.0);
  33.731 +                spin.set_range(-1000000.0, 1000000.0);
  33.732 +                spin.set_numeric(true);
  33.733 +                spin.set_value(atof(arctextmap[active_arc]->property_text().get_value().c_str()));
  33.734 +                vbox->add(spin);
  33.735 +                spin.show();
  33.736 +                */
  33.737 +                Gtk::Entry entry;
  33.738 +                entry.set_text(arctextmap[active_arc]->property_text().get_value());
  33.739 +                vbox->add(entry);
  33.740 +                entry.show();
  33.741 +
  33.742 +                std::cout << arcmap_to_edit << std::endl;
  33.743 +                switch (dialog.run())
  33.744 +                {
  33.745 +                  case Gtk::RESPONSE_NONE:
  33.746 +                  case Gtk::RESPONSE_CANCEL:
  33.747 +                    break;
  33.748 +                  case Gtk::RESPONSE_ACCEPT:
  33.749 +                    switch (ms.getArcMapElementType(arcmap_to_edit))
  33.750 +                    {
  33.751 +                      case MapValue::NUMERIC:
  33.752 +                        ms.set(arcmap_to_edit, active_arc,
  33.753 +                            atof(entry.get_text().c_str()));
  33.754 +                        break;
  33.755 +                      case MapValue::STRING:
  33.756 +                        ms.set(arcmap_to_edit, active_arc,
  33.757 +                            static_cast<std::string>(entry.get_text()));
  33.758 +                        break;
  33.759 +                    }
  33.760 +                    arctextmap[active_arc]->property_text().set_value(
  33.761 +                        static_cast<std::string>(ms.get(arcmap_to_edit, active_arc)));
  33.762 +
  33.763 +                    //mapwin.updateArc(active_arc);
  33.764 +                    //                   mapwin.updateArc(Arc(INVALID));
  33.765 +                    propertyUpdate(Arc(INVALID));
  33.766 +                }
  33.767 +              }
  33.768 +            }
  33.769 +          break;
  33.770 +        }
  33.771 +      default:
  33.772 +        break;
  33.773 +    }
  33.774 +  }
  33.775 +  return false;  
  33.776 +}
  33.777 +
  33.778 +void DigraphDisplayerCanvas::deleteItem(Node node_to_delete)
  33.779 +{
  33.780 +  delete(nodetextmap[node_to_delete]);
  33.781 +  delete(nodesmap[node_to_delete]);
  33.782 +  mytab.mapstorage->digraph.erase(node_to_delete);
  33.783 +}
  33.784 +
  33.785 +void DigraphDisplayerCanvas::deleteItem(Arc arc_to_delete)
  33.786 +{
  33.787 +  delete(arctextmap[arc_to_delete]);
  33.788 +  delete(arcsmap[arc_to_delete]);
  33.789 +  mytab.mapstorage->digraph.erase(arc_to_delete);
  33.790 +}
  33.791 +
  33.792 +void DigraphDisplayerCanvas::textReposition(XY new_place)
  33.793 +{
  33.794 +  new_place+=(XY(10,10));
  33.795 +  arctextmap[forming_arc]->property_x().set_value(new_place.x);
  33.796 +  arctextmap[forming_arc]->property_y().set_value(new_place.y);
  33.797 +}
  33.798 +
  33.799 +void DigraphDisplayerCanvas::toggleArcActivity(ArcBase* active_bre, bool on)
  33.800 +{
  33.801 +  if(on)
  33.802 +  {
  33.803 +    if(forming_arc!=INVALID)
  33.804 +    {
  33.805 +      std::cerr << "ERROR!!!! Valid arc found!" << std::endl;
  33.806 +    }
  33.807 +    else
  33.808 +    {
  33.809 +      for (ArcIt i(mytab.mapstorage->digraph); i!=INVALID; ++i)
  33.810 +      {
  33.811 +        if(arcsmap[i]==active_bre)
  33.812 +        {
  33.813 +          forming_arc=i;
  33.814 +        }
  33.815 +      }
  33.816 +    }
  33.817 +  }
  33.818 +  else
  33.819 +  {
  33.820 +    if(forming_arc!=INVALID)
  33.821 +    {
  33.822 +      forming_arc=INVALID;
  33.823 +    }
  33.824 +    else
  33.825 +    {
  33.826 +      std::cerr << "ERROR!!!! Invalid arc found!" << std::endl;
  33.827 +    }
  33.828 +  }
  33.829 +}
  33.830 +
  33.831 +void DigraphDisplayerCanvas::moveNode(double dx, double dy, Gnome::Canvas::Item * item, Node node)
  33.832 +{
  33.833 +  MapStorage& ms = *mytab.mapstorage;
  33.834 +
  33.835 +  Gnome::Canvas::Item * moved_item=item;
  33.836 +  Node moved_node=node;
  33.837 +
  33.838 +  if(item==NULL && node==INVALID)
  33.839 +  {
  33.840 +    moved_item=active_item;
  33.841 +    moved_node=active_node;
  33.842 +  }
  33.843 +  else
  33.844 +  {
  33.845 +    isbutton=1;
  33.846 +  }
  33.847 +
  33.848 +  //repositioning node and its text
  33.849 +  moved_item->move(dx, dy);
  33.850 +  nodetextmap[moved_node]->move(dx, dy);
  33.851 +
  33.852 +  // the new coordinates of the centre of the node 
  33.853 +  double coord_x = dx + ms.getNodeCoords(moved_node).x;
  33.854 +  double coord_y = dy + ms.getNodeCoords(moved_node).y;
  33.855 +
  33.856 +  // write back the new coordinates to the coords map
  33.857 +  ms.setNodeCoords(moved_node, XY(coord_x, coord_y));
  33.858 +
  33.859 +  //all the arcs connected to the moved point has to be redrawn
  33.860 +  for(OutArcIt ei(ms.digraph,moved_node);ei!=INVALID;++ei)
  33.861 +  {
  33.862 +    XY arrow_pos;
  33.863 +
  33.864 +    if (ms.digraph.source(ei) == ms.digraph.target(ei))
  33.865 +    {
  33.866 +      arrow_pos = ms.getArrowCoords(ei) + XY(dx, dy);
  33.867 +    }
  33.868 +    else
  33.869 +    {
  33.870 +      XY moved_node_1(coord_x - dx, coord_y - dy);
  33.871 +      XY moved_node_2(coord_x, coord_y);
  33.872 +      Node target = ms.digraph.target(ei);
  33.873 +      XY fix_node = ms.getNodeCoords(target);
  33.874 +      XY old_arrow_pos(ms.getArrowCoords(ei));
  33.875 +
  33.876 +      arrow_pos = calcArrowPos(moved_node_1, moved_node_2, fix_node, old_arrow_pos, isbutton);
  33.877 +    }
  33.878 +
  33.879 +    ms.setArrowCoords(ei, arrow_pos);
  33.880 +    arcsmap[ei]->draw();
  33.881 +
  33.882 +    //reposition of arctext
  33.883 +    XY text_pos=ms.getArrowCoords(ei);
  33.884 +    text_pos+=(XY(10,10));
  33.885 +    arctextmap[ei]->property_x().set_value(text_pos.x);
  33.886 +    arctextmap[ei]->property_y().set_value(text_pos.y);
  33.887 +  }
  33.888 +
  33.889 +  for(InArcIt ei(ms.digraph,moved_node);ei!=INVALID;++ei)
  33.890 +  {
  33.891 +    if (ms.digraph.source(ei) != ms.digraph.target(ei))
  33.892 +    {
  33.893 +      XY moved_node_1(coord_x - dx, coord_y - dy);
  33.894 +      XY moved_node_2(coord_x, coord_y);
  33.895 +      Node source = ms.digraph.source(ei);
  33.896 +      XY fix_node = ms.getNodeCoords(source);
  33.897 +      XY old_arrow_pos(ms.getArrowCoords(ei));
  33.898 +
  33.899 +      XY arrow_pos;
  33.900 +      arrow_pos = calcArrowPos(moved_node_1, moved_node_2, fix_node, old_arrow_pos, isbutton);
  33.901 +
  33.902 +      ms.setArrowCoords(ei, arrow_pos);
  33.903 +      arcsmap[ei]->draw();
  33.904 +
  33.905 +      //reposition of arctext
  33.906 +      XY text_pos=ms.getArrowCoords(ei);
  33.907 +      text_pos+=(XY(10,10));
  33.908 +      arctextmap[ei]->property_x().set_value(text_pos.x);
  33.909 +      arctextmap[ei]->property_y().set_value(text_pos.y);
  33.910 +    }
  33.911 +  }
  33.912 +}
  33.913 +
  33.914 +Gdk::Color DigraphDisplayerCanvas::rainbowColorCounter(double min, double max, double w)
  33.915 +{
  33.916 +  Gdk::Color color;
  33.917 +
  33.918 +  double pos=(w-min)/(max-min);
  33.919 +  int phase=0;
  33.920 +
  33.921 +  //rainbow transitions contain 6 phase
  33.922 +  //in each phase only one color is changed
  33.923 +  //first we determine the phase, in which
  33.924 +  //the actual value belongs to
  33.925 +  for (int i=0;i<=5;i++)
  33.926 +  {
  33.927 +    if(((double)i/6<pos)&&(pos<=(double(i+1)/6)))
  33.928 +    {
  33.929 +      phase=i;
  33.930 +    }
  33.931 +  }
  33.932 +  if(phase<6)
  33.933 +  {
  33.934 +    //within its 1/6 long phase the relativ position
  33.935 +    //determines the power of the color changed in
  33.936 +    //that phase
  33.937 +    //we normalize that to one, to be able to give percentage
  33.938 +    //value for the function
  33.939 +    double rel_pos=(pos-(phase/6.0))*6.0;
  33.940 +
  33.941 +    switch(phase)
  33.942 +    {
  33.943 +      case 0:
  33.944 +        color.set_rgb_p (1, 0, 1-rel_pos);
  33.945 +        break;
  33.946 +      case 1:
  33.947 +        color.set_rgb_p (1, rel_pos, 0);
  33.948 +        break;
  33.949 +      case 2:
  33.950 +        color.set_rgb_p (1-rel_pos, 1, 0);
  33.951 +        break;
  33.952 +      case 3:
  33.953 +        color.set_rgb_p (0, 1, rel_pos);
  33.954 +        break;
  33.955 +      case 4:
  33.956 +        color.set_rgb_p (0, 1-rel_pos, 1);
  33.957 +        break;
  33.958 +      case 5:
  33.959 +        color.set_rgb_p ((rel_pos/3.0), 0, 1);
  33.960 +        break;
  33.961 +      default:
  33.962 +        std::cout << "Wrong phase: " << phase << " " << pos << std::endl;
  33.963 +    }
  33.964 +  }
  33.965 +  else
  33.966 +  {
  33.967 +    std::cout << "Wrong phase: " << phase << " " << pos << std::endl;
  33.968 +  }
  33.969 +  return color;
  33.970 +}
    34.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.2 +++ b/graph_displayer_canvas-node.cc	Mon Jul 07 08:10:39 2008 -0500
    34.3 @@ -0,0 +1,344 @@
    34.4 +/* -*- C++ -*-
    34.5 + *
    34.6 + * This file is a part of LEMON, a generic C++ optimization library
    34.7 + *
    34.8 + * Copyright (C) 2003-2006
    34.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
   34.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
   34.11 + *
   34.12 + * Permission to use, modify and distribute this software is granted
   34.13 + * provided that this copyright notice appears in all copies. For
   34.14 + * precise terms see the accompanying LICENSE file.
   34.15 + *
   34.16 + * This software is provided "AS IS" with no warranty of any kind,
   34.17 + * express or implied, and with no claim as to its suitability for any
   34.18 + * purpose.
   34.19 + *
   34.20 + */
   34.21 +
   34.22 +#include <graph_displayer_canvas.h>
   34.23 +#include <mapstorage.h>
   34.24 +#include <nbtab.h>
   34.25 +#include <cmath>
   34.26 +
   34.27 +const int minimum_node_radius=5;
   34.28 +
   34.29 +int DigraphDisplayerCanvas::changeNodeRadius (std::string mapname, Node node)
   34.30 +{
   34.31 +  MapStorage& ms = *mytab.mapstorage;
   34.32 +
   34.33 +  double min, max;
   34.34 +
   34.35 +  {
   34.36 +    NodeIt n(ms.digraph);
   34.37 +    min = max = ms.get(mapname, n);
   34.38 +    for (; n != INVALID; ++n)
   34.39 +    {
   34.40 +      if (static_cast<double>(ms.get(mapname, n)) > max)
   34.41 +        max = ms.get(mapname, n);
   34.42 +      if (static_cast<double>(ms.get(mapname, n)) < min)
   34.43 +        min = ms.get(mapname, n);
   34.44 +    }
   34.45 +  }
   34.46 +
   34.47 +  if(node==INVALID)
   34.48 +    {
   34.49 +      for (NodeIt i(ms.digraph); i!=INVALID; ++i)
   34.50 +	{
   34.51 +	  double v=fabs(ms.get(mapname,i));
   34.52 +	  int w;
   34.53 +	  if(autoscale)
   34.54 +	    {
   34.55 +	      if(min==max)
   34.56 +		{
   34.57 +		  w=(int)(node_property_defaults[N_RADIUS]);
   34.58 +		}
   34.59 +	      else
   34.60 +		{
   34.61 +		  w=(int)(minimum_node_radius+(v-min)/(max-min)*(radius_size-minimum_node_radius));
   34.62 +		}
   34.63 +	    }
   34.64 +	  else
   34.65 +	    {
   34.66 +	      w=(int)(v*radius_size);
   34.67 +	    }
   34.68 +
   34.69 +	  if(w<minimum_node_radius)
   34.70 +	    {
   34.71 +	      w=minimum_node_radius;
   34.72 +	    }
   34.73 +
   34.74 +	  if(zoomtrack)
   34.75 +	    {
   34.76 +	      double actual_ppu=get_pixels_per_unit();
   34.77 +	      w=(int)(w/actual_ppu*fixed_zoom_factor);
   34.78 +	    }
   34.79 +
   34.80 +	  if(w>=0)
   34.81 +	    {
   34.82 +	      double x1, y1, x2, y2;
   34.83 +	      x1=nodesmap[i]->property_x1().get_value();
   34.84 +	      x2=nodesmap[i]->property_x2().get_value();
   34.85 +	      y1=nodesmap[i]->property_y1().get_value();
   34.86 +	      y2=nodesmap[i]->property_y2().get_value();
   34.87 +	      nodesmap[i]->property_x1().set_value((x1+x2)/2-w);
   34.88 +	      nodesmap[i]->property_x2().set_value((x1+x2)/2+w);
   34.89 +	      nodesmap[i]->property_y1().set_value((y1+y2)/2-w);
   34.90 +	      nodesmap[i]->property_y2().set_value((y1+y2)/2+w);
   34.91 +	    }
   34.92 +	}
   34.93 +    }
   34.94 +  else
   34.95 +    {
   34.96 +      //I think only new nodes use this case
   34.97 +      //that has no own value, only the default one
   34.98 +      //int w=(int)(*actual_map)[node];
   34.99 +      int w=(int)(node_property_defaults[N_RADIUS]);
  34.100 +      if(w>=0)
  34.101 +	{
  34.102 +	  double x1, y1, x2, y2;
  34.103 +	  x1=nodesmap[node]->property_x1().get_value();
  34.104 +	  x2=nodesmap[node]->property_x2().get_value();
  34.105 +	  y1=nodesmap[node]->property_y1().get_value();
  34.106 +	  y2=nodesmap[node]->property_y2().get_value();
  34.107 +	  nodesmap[node]->property_x1().set_value((x1+x2)/2-w);
  34.108 +	  nodesmap[node]->property_x2().set_value((x1+x2)/2+w);
  34.109 +	  nodesmap[node]->property_y1().set_value((y1+y2)/2-w);
  34.110 +	  nodesmap[node]->property_y2().set_value((y1+y2)/2+w);
  34.111 +	}
  34.112 +    }
  34.113 +  return 0;
  34.114 +};
  34.115 +
  34.116 +int DigraphDisplayerCanvas::resetNodeRadius (Node node)
  34.117 +{
  34.118 +  MapStorage& ms = *mytab.mapstorage;
  34.119 +
  34.120 +  double min, max;
  34.121 +  min=node_property_defaults[N_RADIUS];
  34.122 +  max=node_property_defaults[N_RADIUS];
  34.123 +  Digraph::NodeMap<double> actual_map(ms.digraph,node_property_defaults[N_RADIUS]);
  34.124 +  
  34.125 +  if(node==INVALID)
  34.126 +    {
  34.127 +      for (NodeIt i(ms.digraph); i!=INVALID; ++i)
  34.128 +	{
  34.129 +	  double v=fabs(actual_map[i]);
  34.130 +	  int w;
  34.131 +	  if(min==max)
  34.132 +	    {
  34.133 +	      w=(int)(node_property_defaults[N_RADIUS]);
  34.134 +	    }
  34.135 +	  else
  34.136 +	    {
  34.137 +	      w=(int)(MIN_NODE_RADIUS+(v-min)/(max-min)*(MAX_NODE_RADIUS-MIN_NODE_RADIUS));
  34.138 +	    }
  34.139 +	  if(zoomtrack)
  34.140 +	    {
  34.141 +	      double actual_ppu=get_pixels_per_unit();
  34.142 +	      w=(int)(w/actual_ppu*fixed_zoom_factor);
  34.143 +	    }
  34.144 +	  if(w>=0)
  34.145 +	    {
  34.146 +	      double x1, y1, x2, y2;
  34.147 +	      x1=nodesmap[i]->property_x1().get_value();
  34.148 +	      x2=nodesmap[i]->property_x2().get_value();
  34.149 +	      y1=nodesmap[i]->property_y1().get_value();
  34.150 +	      y2=nodesmap[i]->property_y2().get_value();
  34.151 +	      nodesmap[i]->property_x1().set_value((x1+x2)/2-w);
  34.152 +	      nodesmap[i]->property_x2().set_value((x1+x2)/2+w);
  34.153 +	      nodesmap[i]->property_y1().set_value((y1+y2)/2-w);
  34.154 +	      nodesmap[i]->property_y2().set_value((y1+y2)/2+w);
  34.155 +	    }
  34.156 +	}
  34.157 +    }
  34.158 +  else
  34.159 +    {
  34.160 +      //I think only new nodes use this case
  34.161 +//       int w=(int)actual_map[node];
  34.162 +      int w=(int)(node_property_defaults[N_RADIUS]);
  34.163 +      if(w>=0)
  34.164 +	{
  34.165 +	  double x1, y1, x2, y2;
  34.166 +	  x1=nodesmap[node]->property_x1().get_value();
  34.167 +	  x2=nodesmap[node]->property_x2().get_value();
  34.168 +	  y1=nodesmap[node]->property_y1().get_value();
  34.169 +	  y2=nodesmap[node]->property_y2().get_value();
  34.170 +	  nodesmap[node]->property_x1().set_value((x1+x2)/2-w);
  34.171 +	  nodesmap[node]->property_x2().set_value((x1+x2)/2+w);
  34.172 +	  nodesmap[node]->property_y1().set_value((y1+y2)/2-w);
  34.173 +	  nodesmap[node]->property_y2().set_value((y1+y2)/2+w);
  34.174 +	}
  34.175 +    }
  34.176 +  return 0;
  34.177 +};
  34.178 +
  34.179 +int DigraphDisplayerCanvas::changeNodeColor (std::string mapname, Node node)
  34.180 +{  
  34.181 +  MapStorage& ms = *mytab.mapstorage;
  34.182 +
  34.183 +  //function maps the range of the maximum and
  34.184 +  //the minimum of the nodemap to the range of
  34.185 +  //green in RGB
  34.186 +
  34.187 +  double max, min;
  34.188 +
  34.189 +  {
  34.190 +    NodeIt n(ms.digraph);
  34.191 +    min = max = ms.get(mapname, n);
  34.192 +    for (; n != INVALID; ++n)
  34.193 +    {
  34.194 +      if (static_cast<double>(ms.get(mapname, n)) > max)
  34.195 +        max = ms.get(mapname, n);
  34.196 +      if (static_cast<double>(ms.get(mapname, n)) < min)
  34.197 +        min = ms.get(mapname, n);
  34.198 +    }
  34.199 +  }
  34.200 +
  34.201 +  if(node==INVALID)
  34.202 +    {
  34.203 +
  34.204 +      for (NodeIt i(ms.digraph); i!=INVALID; ++i)
  34.205 +	{
  34.206 +	  Gdk::Color color;
  34.207 +
  34.208 +	  double w=ms.get(mapname, i);
  34.209 +
  34.210 +	  if(max!=min)
  34.211 +	    {
  34.212 +	      color=rainbowColorCounter(min, max, w);
  34.213 +	    }
  34.214 +	  else
  34.215 +	    {
  34.216 +	      color.set_rgb_p (0, 0, 1);
  34.217 +	    }
  34.218 +
  34.219 +	  nodesmap[i]->property_fill_color_gdk().set_value(color);
  34.220 +	}
  34.221 +    }
  34.222 +  else
  34.223 +    {
  34.224 +      Gdk::Color color;
  34.225 +
  34.226 +      double w=ms.get(mapname, node);
  34.227 +
  34.228 +      if(max!=min)
  34.229 +	{
  34.230 +	  color=rainbowColorCounter(min, max, w);
  34.231 +	}
  34.232 +      else
  34.233 +	{
  34.234 +	  color.set_rgb_p (0, 0, 1);
  34.235 +	}
  34.236 +
  34.237 +      nodesmap[node]->property_fill_color_gdk().set_value(color);
  34.238 +    }
  34.239 +  return 0;
  34.240 +};
  34.241 +
  34.242 +int DigraphDisplayerCanvas::resetNodeColor (Node node)
  34.243 +{  
  34.244 +  MapStorage& ms = *mytab.mapstorage;
  34.245 +
  34.246 +  //function maps the range of the maximum and
  34.247 +  //the minimum of the nodemap to the range of
  34.248 +  //green in RGB
  34.249 +
  34.250 +  Digraph::NodeMap<double> actual_map(ms.digraph,node_property_defaults[N_COLOR]);
  34.251 +
  34.252 +  double max, min;
  34.253 +
  34.254 +  max=node_property_defaults[N_COLOR];
  34.255 +  min=node_property_defaults[N_COLOR];
  34.256 +
  34.257 +  if(node==INVALID)
  34.258 +    {
  34.259 +
  34.260 +      for (NodeIt i(ms.digraph); i!=INVALID; ++i)
  34.261 +	{
  34.262 +	  Gdk::Color color;
  34.263 +
  34.264 +	  double w=actual_map[i];
  34.265 +
  34.266 +	  if(max!=min)
  34.267 +	    {
  34.268 +	      color.set_rgb_p (0, 0, 100*(w-min)/(max-min));
  34.269 +	    }
  34.270 +	  else
  34.271 +	    {
  34.272 +	      color.set_rgb_p (0, 0, 100);
  34.273 +	    }
  34.274 +
  34.275 +	  nodesmap[i]->property_fill_color_gdk().set_value(color);
  34.276 +	}
  34.277 +    }
  34.278 +  else
  34.279 +    {
  34.280 +      Gdk::Color color;
  34.281 +
  34.282 +      double w=actual_map[node];
  34.283 +
  34.284 +      if(max!=min)
  34.285 +	{
  34.286 +	  color.set_rgb_p (0, 0, 100*(w-min)/(max-min));
  34.287 +	}
  34.288 +      else
  34.289 +	{
  34.290 +	  color.set_rgb_p (0, 0, 100);
  34.291 +	}
  34.292 +
  34.293 +      nodesmap[node]->property_fill_color_gdk().set_value(color);
  34.294 +    }
  34.295 +  return 0;
  34.296 +};
  34.297 +
  34.298 +int DigraphDisplayerCanvas::changeNodeText (std::string mapname, Node node)
  34.299 +{
  34.300 +  MapStorage& ms = *mytab.mapstorage;
  34.301 +
  34.302 +  //the number in the map will be written on the node
  34.303 +  //EXCEPT when the name of the map is Text, because
  34.304 +  //in that case empty string will be written, because
  34.305 +  //that is the deleter map
  34.306 +
  34.307 +  if(node==INVALID)
  34.308 +    {
  34.309 +      for (NodeIt i(ms.digraph); i!=INVALID; ++i)
  34.310 +	{
  34.311 +	  nodemap_to_edit=mapname;
  34.312 +
  34.313 +	  nodetextmap[i]->property_text().set_value(
  34.314 +              static_cast<std::string>(ms.get(mapname, i)));
  34.315 +	}
  34.316 +    }
  34.317 +  else
  34.318 +    {
  34.319 +      nodetextmap[node]->property_text().set_value(
  34.320 +          static_cast<std::string>(ms.get(mapname, node)));
  34.321 +    }
  34.322 +  return 0;
  34.323 +};
  34.324 +
  34.325 +int DigraphDisplayerCanvas::resetNodeText (Node node)
  34.326 +{
  34.327 +  MapStorage& ms = *mytab.mapstorage;
  34.328 +
  34.329 +  //the number in the map will be written on the node
  34.330 +  //EXCEPT when the name of the map is Text, because
  34.331 +  //in that case empty string will be written, because
  34.332 +  //that is the deleter map
  34.333 +
  34.334 +  if(node==INVALID)
  34.335 +    {
  34.336 +      for (NodeIt i(ms.digraph); i!=INVALID; ++i)
  34.337 +	{
  34.338 +	  nodemap_to_edit="";
  34.339 +	  nodetextmap[i]->property_text().set_value("");
  34.340 +	}
  34.341 +    }
  34.342 +  else
  34.343 +    {
  34.344 +      nodetextmap[node]->property_text().set_value("");
  34.345 +    }
  34.346 +  return 0;
  34.347 +};
    35.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.2 +++ b/graph_displayer_canvas-zoom.cc	Mon Jul 07 08:10:39 2008 -0500
    35.3 @@ -0,0 +1,90 @@
    35.4 +/* -*- C++ -*-
    35.5 + *
    35.6 + * This file is a part of LEMON, a generic C++ optimization library
    35.7 + *
    35.8 + * Copyright (C) 2003-2006
    35.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
   35.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
   35.11 + *
   35.12 + * Permission to use, modify and distribute this software is granted
   35.13 + * provided that this copyright notice appears in all copies. For
   35.14 + * precise terms see the accompanying LICENSE file.
   35.15 + *
   35.16 + * This software is provided "AS IS" with no warranty of any kind,
   35.17 + * express or implied, and with no claim as to its suitability for any
   35.18 + * purpose.
   35.19 + *
   35.20 + */
   35.21 +
   35.22 +#include <graph_displayer_canvas.h>
   35.23 +#include <cmath>
   35.24 +
   35.25 +void DigraphDisplayerCanvas::zoomIn()
   35.26 +{
   35.27 +  set_pixels_per_unit(
   35.28 +      (1.0 + (double) zoom_step / 100.0) * get_pixels_per_unit());
   35.29 +  if(zoomtrack)
   35.30 +    {
   35.31 +      propertyChange(false, N_RADIUS);
   35.32 +      propertyChange(true, E_WIDTH);
   35.33 +    }
   35.34 +}
   35.35 +
   35.36 +void DigraphDisplayerCanvas::zoomOut()
   35.37 +{
   35.38 +  set_pixels_per_unit(
   35.39 +      (1.0 - (double) zoom_step / 100.0) * get_pixels_per_unit());
   35.40 +  if(zoomtrack)
   35.41 +    {
   35.42 +      propertyChange(true, E_WIDTH);
   35.43 +      propertyChange(false, N_RADIUS);
   35.44 +    }
   35.45 +}
   35.46 +
   35.47 +void DigraphDisplayerCanvas::zoomFit()
   35.48 +{
   35.49 +  updateScrollRegion();
   35.50 +
   35.51 +  // get the height and width of the canvas
   35.52 +  Gtk::Allocation a = get_allocation();
   35.53 +  int aw = a.get_width();
   35.54 +  int ah = a.get_height();
   35.55 +
   35.56 +  // get the bounding box of the digraph
   35.57 +  update_now();
   35.58 +  double x1, y1, x2, y2;
   35.59 +  root()->get_bounds(x1, y1, x2, y2);
   35.60 +
   35.61 +  // fit the digraph to the window
   35.62 +  double ppu1 = (double) aw / fabs(x2 - x1);
   35.63 +  double ppu2 = (double) ah / fabs(y2 - y1);
   35.64 +  set_pixels_per_unit((ppu1 < ppu2) ? ppu1 : ppu2);
   35.65 +
   35.66 +  if(zoomtrack)
   35.67 +    {
   35.68 +      propertyChange(true, E_WIDTH);
   35.69 +      propertyChange(false, N_RADIUS);
   35.70 +    }
   35.71 +}
   35.72 +
   35.73 +void DigraphDisplayerCanvas::zoom100()
   35.74 +{
   35.75 +  updateScrollRegion();
   35.76 +  set_pixels_per_unit(1.0);
   35.77 +
   35.78 +  if(zoomtrack)
   35.79 +    {
   35.80 +      propertyChange(true, E_WIDTH);
   35.81 +      propertyChange(false, N_RADIUS);
   35.82 +    }
   35.83 +}
   35.84 +
   35.85 +void DigraphDisplayerCanvas::updateScrollRegion()
   35.86 +{
   35.87 +  // get_bounds() yields something sane only when no updates are pending
   35.88 +  // and it returns a sufficient, not an exact bounding box
   35.89 +  update_now();
   35.90 +  double x1, y1, x2, y2;
   35.91 +  root()->get_bounds(x1, y1, x2, y2);
   35.92 +  set_scroll_region(x1, y1, x2, y2);
   35.93 +}
    36.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.2 +++ b/graph_displayer_canvas.cc	Mon Jul 07 08:10:39 2008 -0500
    36.3 @@ -0,0 +1,461 @@
    36.4 +/* -*- C++ -*-
    36.5 + *
    36.6 + * This file is a part of LEMON, a generic C++ optimization library
    36.7 + *
    36.8 + * Copyright (C) 2003-2006
    36.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
   36.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
   36.11 + *
   36.12 + * Permission to use, modify and distribute this software is granted
   36.13 + * provided that this copyright notice appears in all copies. For
   36.14 + * precise terms see the accompanying LICENSE file.
   36.15 + *
   36.16 + * This software is provided "AS IS" with no warranty of any kind,
   36.17 + * express or implied, and with no claim as to its suitability for any
   36.18 + * purpose.
   36.19 + *
   36.20 + */
   36.21 +
   36.22 +#include <mapstorage.h>
   36.23 +#include <nbtab.h>
   36.24 +#include <graph_displayer_canvas.h>
   36.25 +#include <lemon/random.h>
   36.26 +#include <cmath>
   36.27 +
   36.28 +DigraphDisplayerCanvas::DigraphDisplayerCanvas(NoteBookTab & mainw) :
   36.29 +  nodesmap(mainw.mapstorage->digraph), arcsmap(mainw.mapstorage->digraph), arctextmap(mainw.mapstorage->digraph),
   36.30 +  nodetextmap(mainw.mapstorage->digraph), displayed_graph(*(root()), 0, 0),
   36.31 +  isbutton(0), active_item(NULL), target_item(NULL), nodemap_to_edit(""),
   36.32 +  arcmap_to_edit(""), autoscale(true), zoomtrack(false), radius_size(20), arc_width(10),
   36.33 +  was_redesigned(false), is_drawn(false), mytab(mainw),
   36.34 +  background_set(false)
   36.35 +{
   36.36 +  //add mouse scroll event handler - it won't be changed, it handles zoom
   36.37 +  signal_event().connect(sigc::mem_fun(*this, &DigraphDisplayerCanvas::scrollEventHandler), false);
   36.38 +
   36.39 +  //base event handler is move tool
   36.40 +  actual_handler=signal_event().connect(sigc::mem_fun(*this, &DigraphDisplayerCanvas::moveEventHandler), false);
   36.41 +  actual_tool=MOVE;
   36.42 +
   36.43 +
   36.44 +  active_node=INVALID;
   36.45 +  active_arc=INVALID;
   36.46 +  forming_arc=INVALID;
   36.47 +
   36.48 +  setBackground();
   36.49 +}
   36.50 +
   36.51 +void DigraphDisplayerCanvas::setBackground()
   36.52 +{
   36.53 +  if (background_set)
   36.54 +  {
   36.55 +    delete background;
   36.56 +  }
   36.57 +  if (mytab.mapstorage->isBackgroundSet())
   36.58 +  {
   36.59 +    background_set = true;
   36.60 +    refBackground = Gdk::Pixbuf::create_from_file(
   36.61 +      mytab.mapstorage->getBackgroundFilename());
   36.62 +    background = new Gnome::Canvas::Pixbuf(
   36.63 +        *(root()),
   36.64 +        0.0 - refBackground->get_width() / 2.0,
   36.65 +        0.0 - refBackground->get_height() / 2.0,
   36.66 +        refBackground);
   36.67 +    background->lower_to_bottom();
   36.68 +  }
   36.69 +  else
   36.70 +  {
   36.71 +    background_set = false;
   36.72 +  }
   36.73 +}
   36.74 +
   36.75 +DigraphDisplayerCanvas::~DigraphDisplayerCanvas()
   36.76 +{
   36.77 +  for (NodeIt n((mytab.mapstorage)->digraph); n != INVALID; ++n)
   36.78 +    {
   36.79 +      delete nodesmap[n];
   36.80 +      delete nodetextmap[n];
   36.81 +    }
   36.82 +  
   36.83 +  for (ArcIt e((mytab.mapstorage)->digraph); e != INVALID; ++e)
   36.84 +    {
   36.85 +      delete arcsmap[e];
   36.86 +      delete arctextmap[e];
   36.87 +    }
   36.88 +}
   36.89 +
   36.90 +void DigraphDisplayerCanvas::propertyChange(bool itisarc, int prop)
   36.91 +{
   36.92 +  if(itisarc)
   36.93 +    {
   36.94 +      propertyUpdate(Arc(INVALID), prop);
   36.95 +    }
   36.96 +  else
   36.97 +    {
   36.98 +      propertyUpdate(Node(INVALID), prop);
   36.99 +    }
  36.100 +}
  36.101 +
  36.102 +void DigraphDisplayerCanvas::propertyUpdate(Arc arc)
  36.103 +{
  36.104 +  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
  36.105 +    {
  36.106 +      propertyUpdate(arc, i);
  36.107 +    }
  36.108 +}
  36.109 +
  36.110 +void DigraphDisplayerCanvas::propertyUpdate(Node node)
  36.111 +{
  36.112 +  for(int i=0;i<NODE_PROPERTY_NUM;i++)
  36.113 +    {
  36.114 +      propertyUpdate(node, i);
  36.115 +    }
  36.116 +}
  36.117 +
  36.118 +void DigraphDisplayerCanvas::propertyUpdate(Node node, int prop)
  36.119 +{
  36.120 +  std::string mapname=mytab.getActiveNodeMap(prop);
  36.121 +
  36.122 +  if(is_drawn)
  36.123 +  {
  36.124 +    if(mapname!="")
  36.125 +    {
  36.126 +      std::vector<std::string> nodemaps = mytab.mapstorage->getNodeMapList();
  36.127 +      bool found = false;
  36.128 +      for (std::vector<std::string>::const_iterator it = nodemaps.begin();
  36.129 +          it != nodemaps.end(); ++it)
  36.130 +      {
  36.131 +        if (*it == mapname)
  36.132 +        {
  36.133 +          found = true;
  36.134 +          break;
  36.135 +        }
  36.136 +      }
  36.137 +      if (found)
  36.138 +      {
  36.139 +        switch(prop)
  36.140 +        {
  36.141 +          case N_RADIUS:
  36.142 +            changeNodeRadius(mapname, node);
  36.143 +            break;
  36.144 +          case N_COLOR:
  36.145 +            changeNodeColor(mapname, node);
  36.146 +            break;
  36.147 +          case N_TEXT:
  36.148 +            changeNodeText(mapname, node);
  36.149 +            break;
  36.150 +          default:
  36.151 +            std::cerr<<"Error\n";
  36.152 +        }
  36.153 +      }
  36.154 +    }
  36.155 +    else //mapname==""
  36.156 +    {
  36.157 +      Node node=INVALID;
  36.158 +      switch(prop)
  36.159 +      {
  36.160 +        case N_RADIUS:
  36.161 +          resetNodeRadius(node);
  36.162 +          break;
  36.163 +        case N_COLOR:
  36.164 +          resetNodeColor(node);
  36.165 +          break;
  36.166 +        case N_TEXT:
  36.167 +          resetNodeText(node);
  36.168 +          break;
  36.169 +        default:
  36.170 +          std::cerr<<"Error\n";
  36.171 +      }
  36.172 +    }
  36.173 +  }
  36.174 +}
  36.175 +
  36.176 +void DigraphDisplayerCanvas::propertyUpdate(Arc arc, int prop)
  36.177 +{
  36.178 +  std::string mapname=mytab.getActiveArcMap(prop);
  36.179 +
  36.180 +  if(is_drawn)
  36.181 +  {
  36.182 +    if(mapname!="")
  36.183 +    {
  36.184 +      std::vector<std::string> arcmaps = mytab.mapstorage->getArcMapList();
  36.185 +      bool found = false;
  36.186 +      for (std::vector<std::string>::const_iterator it = arcmaps.begin();
  36.187 +          it != arcmaps.end(); ++it)
  36.188 +      {
  36.189 +        if (*it == mapname)
  36.190 +        {
  36.191 +          found = true;
  36.192 +          break;
  36.193 +        }
  36.194 +      }
  36.195 +      if (found)
  36.196 +      {
  36.197 +        switch(prop)
  36.198 +        {
  36.199 +          case E_WIDTH:
  36.200 +            changeArcWidth(mapname, arc);
  36.201 +            break;
  36.202 +          case E_COLOR:
  36.203 +            changeArcColor(mapname, arc);
  36.204 +            break;
  36.205 +          case E_TEXT:
  36.206 +            changeArcText(mapname, arc);
  36.207 +            break;
  36.208 +          default:
  36.209 +            std::cerr<<"Error\n";
  36.210 +        }
  36.211 +      }
  36.212 +    }
  36.213 +    else //mapname==""
  36.214 +    {
  36.215 +      switch(prop)
  36.216 +      {
  36.217 +        case E_WIDTH:
  36.218 +          resetArcWidth(arc);
  36.219 +          break;
  36.220 +        case E_COLOR:
  36.221 +          resetArcColor(arc);
  36.222 +          break;
  36.223 +        case E_TEXT:
  36.224 +          resetArcText(arc);
  36.225 +          break;
  36.226 +        default:
  36.227 +          std::cerr<<"Error\n";
  36.228 +      }
  36.229 +    }
  36.230 +  }
  36.231 +}
  36.232 +
  36.233 +void DigraphDisplayerCanvas::drawDigraph()
  36.234 +{
  36.235 +  //first arcs are drawn, to hide joining with nodes later
  36.236 +
  36.237 +  for (ArcIt i((mytab.mapstorage)->digraph); i!=INVALID; ++i)
  36.238 +  {
  36.239 +    if (mytab.mapstorage->digraph.source(i) == mytab.mapstorage->digraph.target(i))
  36.240 +    {
  36.241 +      arcsmap[i]=new LoopArc(displayed_graph, i, *this);
  36.242 +    }
  36.243 +    else
  36.244 +    {
  36.245 +      arcsmap[i]=new BrokenArc(displayed_graph, i, *this);
  36.246 +    }
  36.247 +    //initializing arc-text as well, to empty string
  36.248 +
  36.249 +    XY text_pos=mytab.mapstorage->getArrowCoords(i);
  36.250 +    text_pos+=(XY(10,10));
  36.251 +
  36.252 +    arctextmap[i]=new Gnome::Canvas::Text(displayed_graph, text_pos.x, text_pos.y, "");
  36.253 +    arctextmap[i]->property_fill_color().set_value("darkgreen");
  36.254 +    arctextmap[i]->signal_event().connect(sigc::mem_fun(*this, &DigraphDisplayerCanvas::mapEditEventHandler), false);
  36.255 +    arctextmap[i]->raise_to_top();
  36.256 +  }
  36.257 +
  36.258 +  //afterwards nodes come to be drawn
  36.259 +
  36.260 +  for (NodeIt i((mytab.mapstorage)->digraph); i!=INVALID; ++i)
  36.261 +  {
  36.262 +    //drawing bule nodes, with black line around them
  36.263 +
  36.264 +    nodesmap[i]=new Gnome::Canvas::Ellipse(
  36.265 +        displayed_graph,
  36.266 +        mytab.mapstorage->getNodeCoords(i).x-20,
  36.267 +        mytab.mapstorage->getNodeCoords(i).y-20,
  36.268 +        mytab.mapstorage->getNodeCoords(i).x+20,
  36.269 +        mytab.mapstorage->getNodeCoords(i).y+20);
  36.270 +    *(nodesmap[i]) << Gnome::Canvas::Properties::fill_color("blue");
  36.271 +    *(nodesmap[i]) << Gnome::Canvas::Properties::outline_color("black");
  36.272 +    nodesmap[i]->raise_to_top();
  36.273 +
  36.274 +    //initializing arc-text as well, to empty string
  36.275 +
  36.276 +    XY text_pos(
  36.277 +        (mytab.mapstorage->getNodeCoords(i).x+node_property_defaults[N_RADIUS]+5),
  36.278 +        (mytab.mapstorage->getNodeCoords(i).y+node_property_defaults[N_RADIUS]+5));
  36.279 +
  36.280 +    nodetextmap[i]=new Gnome::Canvas::Text(displayed_graph,
  36.281 +        text_pos.x, text_pos.y, "");
  36.282 +    nodetextmap[i]->property_fill_color().set_value("darkblue");
  36.283 +    nodetextmap[i]->signal_event().connect(sigc::mem_fun(*this, &DigraphDisplayerCanvas::mapEditEventHandler), false);
  36.284 +    nodetextmap[i]->raise_to_top();
  36.285 +  }
  36.286 +
  36.287 +  is_drawn=true;
  36.288 +
  36.289 +  //upon drawing digraph
  36.290 +  //properties have to
  36.291 +  //be set in as well
  36.292 +  for(int i=0;i<NODE_PROPERTY_NUM;i++)
  36.293 +    {
  36.294 +      propertyUpdate(Node(INVALID), i);
  36.295 +    }
  36.296 +
  36.297 +  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
  36.298 +    {
  36.299 +      propertyUpdate(Arc(INVALID), i);
  36.300 +    }
  36.301 +
  36.302 +  updateScrollRegion();
  36.303 +}
  36.304 +
  36.305 +void DigraphDisplayerCanvas::clear()
  36.306 +{
  36.307 +  active_node=INVALID;
  36.308 +  active_arc=INVALID;
  36.309 +  forming_arc=INVALID;
  36.310 +
  36.311 +  for (NodeIt n((mytab.mapstorage)->digraph); n != INVALID; ++n)
  36.312 +  {
  36.313 +    delete nodesmap[n];
  36.314 +    delete nodetextmap[n];
  36.315 +  }
  36.316 +
  36.317 +  for (ArcIt e((mytab.mapstorage)->digraph); e != INVALID; ++e)
  36.318 +  {
  36.319 +    delete arcsmap[e];
  36.320 +    delete arctextmap[e];
  36.321 +  }
  36.322 +
  36.323 +  is_drawn=false;
  36.324 +}
  36.325 +
  36.326 +void DigraphDisplayerCanvas::setView(bool autoscale_p, bool zoomtrack_p, double width_p, double radius_p)
  36.327 +{
  36.328 +  autoscale=autoscale_p;
  36.329 +  arc_width=width_p;
  36.330 +  radius_size=radius_p;
  36.331 +
  36.332 +  if((!zoomtrack) && zoomtrack_p)
  36.333 +    {
  36.334 +      fixed_zoom_factor=get_pixels_per_unit();
  36.335 +    }
  36.336 +
  36.337 +  zoomtrack=zoomtrack_p;
  36.338 +
  36.339 +  propertyChange(false, N_RADIUS);
  36.340 +  propertyChange(true, E_WIDTH);
  36.341 +}
  36.342 +
  36.343 +void DigraphDisplayerCanvas::getView(bool & autoscale_p, bool & zoomtrack_p, double& width_p, double& radius_p)
  36.344 +{
  36.345 +  autoscale_p=autoscale;
  36.346 +  zoomtrack_p=zoomtrack;
  36.347 +  width_p=arc_width;
  36.348 +  radius_p=radius_size;
  36.349 +}
  36.350 +
  36.351 +void DigraphDisplayerCanvas::reDesignDigraph()
  36.352 +{
  36.353 +  MapStorage& ms = *mytab.mapstorage;
  36.354 +  NodeIt firstnode(ms.digraph);
  36.355 +  //is it not an empty digraph?
  36.356 +  if(firstnode!=INVALID)
  36.357 +    {
  36.358 +      double max_coord=50000;
  36.359 +      double min_dist=20;
  36.360 +      double init_vector_length=25;
  36.361 +
  36.362 +      if(!was_redesigned)
  36.363 +	{
  36.364 +	  NodeIt i(ms.digraph);
  36.365 +
  36.366 +	  dim2::Point<double> init(init_vector_length*rnd(),
  36.367 +				   init_vector_length*rnd());
  36.368 +	  moveNode(init.x, init.y, nodesmap[i], i);
  36.369 +	  was_redesigned=true;
  36.370 +	}
  36.371 +
  36.372 +      double attraction;
  36.373 +      double propulsation;
  36.374 +      int iterations;
  36.375 +
  36.376 +      ms.get_design_data(attraction, propulsation, iterations);
  36.377 +
  36.378 +      //iteration counter
  36.379 +      for(int l=0;l<iterations;l++)
  36.380 +	{
  36.381 +	  Digraph::NodeMap<double> x(ms.digraph);
  36.382 +	  Digraph::NodeMap<double> y(ms.digraph);
  36.383 +	  XYMap<Digraph::NodeMap<double> > actual_forces;
  36.384 +	  actual_forces.setXMap(x);
  36.385 +	  actual_forces.setYMap(y);
  36.386 +
  36.387 +	  //count actual force for each nodes
  36.388 +	  for (NodeIt i(ms.digraph); i!=INVALID; ++i)
  36.389 +	    {
  36.390 +	      //propulsation of nodes
  36.391 +	      for (NodeIt j(ms.digraph); j!=INVALID; ++j)
  36.392 +		{
  36.393 +		  if(i!=j)
  36.394 +		    {
  36.395 +		      lemon::dim2::Point<double> delta =
  36.396 +			(ms.getNodeCoords(i)-
  36.397 +			 ms.getNodeCoords(j));
  36.398 +
  36.399 +		      const double length_sqr=std::max(delta.normSquare(),min_dist);
  36.400 +
  36.401 +		      //normalize vector
  36.402 +		      delta/=sqrt(length_sqr);
  36.403 +
  36.404 +		      //calculating propulsation strength
  36.405 +		      //greater distance menas smaller propulsation strength
  36.406 +		      delta*=propulsation/length_sqr;
  36.407 +		    
  36.408 +		      actual_forces.set(i,(actual_forces[i]+delta));
  36.409 +		    }
  36.410 +		}
  36.411 +            //attraction of nodes, to which actual node is bound
  36.412 +            for(OutArcIt ei(ms.digraph,i);ei!=INVALID;++ei)
  36.413 +              {
  36.414 +                lemon::dim2::Point<double> delta =
  36.415 +                  (ms.getNodeCoords(i)-
  36.416 +                   ms.getNodeCoords(ms.digraph.target(ei)));
  36.417 +
  36.418 +                //calculating attraction strength
  36.419 +                //greater distance means greater strength
  36.420 +                delta*=attraction;
  36.421 +
  36.422 +                actual_forces.set(i,actual_forces[i]-delta);
  36.423 +              }
  36.424 +                    for(InArcIt ei(ms.digraph,i);ei!=INVALID;++ei)
  36.425 +              {
  36.426 +                lemon::dim2::Point<double> delta =
  36.427 +                  (ms.getNodeCoords(i)-
  36.428 +                   ms.getNodeCoords(ms.digraph.source(ei)));
  36.429 +
  36.430 +                //calculating attraction strength
  36.431 +                //greater distance means greater strength
  36.432 +                delta*=attraction;
  36.433 +
  36.434 +                actual_forces.set(i,actual_forces[i]-delta);
  36.435 +              }
  36.436 +	    }
  36.437 +	  for (NodeIt i(ms.digraph); i!=INVALID; ++i)
  36.438 +	    {
  36.439 +	      if((ms.getNodeCoords(i).x)+actual_forces[i].x>max_coord)
  36.440 +		{
  36.441 +		  actual_forces[i].x=max_coord-(ms.getNodeCoords(i).x);
  36.442 +		  std::cout << "Correction! " << ((ms.getNodeCoords(i).x)+actual_forces[i].x) << std::endl;
  36.443 +		}
  36.444 +	      else if((ms.getNodeCoords(i).x)+actual_forces[i].x<(0-max_coord))
  36.445 +		{
  36.446 +		  actual_forces[i].x=0-max_coord-(ms.getNodeCoords(i).x);
  36.447 +		  std::cout << "Correction! " << ((ms.getNodeCoords(i).x)+actual_forces[i].x) << std::endl;
  36.448 +		}
  36.449 +	      if((ms.getNodeCoords(i).y)+actual_forces[i].y>max_coord)
  36.450 +		{
  36.451 +		  actual_forces[i].y=max_coord-(ms.getNodeCoords(i).y);
  36.452 +		  std::cout << "Correction! " << ((ms.getNodeCoords(i).y)+actual_forces[i].y) << std::endl;
  36.453 +		}
  36.454 +	      else if((ms.getNodeCoords(i).y)+actual_forces[i].y<(0-max_coord))
  36.455 +		{
  36.456 +		  actual_forces[i].y=0-max_coord-(ms.getNodeCoords(i).y);
  36.457 +		  std::cout << "Correction! " << ((ms.getNodeCoords(i).y)+actual_forces[i].y) << std::endl;
  36.458 +		}
  36.459 +	      moveNode(actual_forces[i].x, actual_forces[i].y, nodesmap[i], i);
  36.460 +	    }
  36.461 +	}
  36.462 +    }
  36.463 +}
  36.464 +
    37.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.2 +++ b/graph_displayer_canvas.h	Mon Jul 07 08:10:39 2008 -0500
    37.3 @@ -0,0 +1,452 @@
    37.4 +/* -*- C++ -*-
    37.5 + *
    37.6 + * This file is a part of LEMON, a generic C++ optimization library
    37.7 + *
    37.8 + * Copyright (C) 2003-2006
    37.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
   37.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
   37.11 + *
   37.12 + * Permission to use, modify and distribute this software is granted
   37.13 + * provided that this copyright notice appears in all copies. For
   37.14 + * precise terms see the accompanying LICENSE file.
   37.15 + *
   37.16 + * This software is provided "AS IS" with no warranty of any kind,
   37.17 + * express or implied, and with no claim as to its suitability for any
   37.18 + * purpose.
   37.19 + *
   37.20 + */
   37.21 +
   37.22 +#ifndef GRAPH_DISPLAYER_CANVAS_H
   37.23 +#define GRAPH_DISPLAYER_CANVAS_H
   37.24 +
   37.25 +class NoteBookTab;
   37.26 +
   37.27 +#include "all_include.h"
   37.28 +#include <libgnomecanvasmm.h>
   37.29 +#include <libgnomecanvasmm/polygon.h>
   37.30 +
   37.31 +///This class is the canvas, on which the digraph can be drawn.
   37.32 +class DigraphDisplayerCanvas : public Gnome::Canvas::CanvasAA
   37.33 +{
   37.34 +  friend class BrokenArc;
   37.35 +  friend class LoopArc;
   37.36 +
   37.37 +  class ArcBase : public Gnome::Canvas::Group
   37.38 +  {
   37.39 +    protected:
   37.40 +      ///Reference to the canvas, on which the digraph is drawn.
   37.41 +
   37.42 +      ///It is needed, because some datas needed from
   37.43 +      ///digraph can be accessed by this or should be sent
   37.44 +      ///as parameter, but it would be complicated
   37.45 +      DigraphDisplayerCanvas& canvas;
   37.46 +
   37.47 +      ///The arc that the class displays.
   37.48 +
   37.49 +      ///It is needed, because some datas needed from
   37.50 +      ///digraph can be accessed by this or should be sent
   37.51 +      ///as parameter, but it would be complicated
   37.52 +      Arc arc;
   37.53 +
   37.54 +      Gnome::Canvas::Polygon arrow;
   37.55 +
   37.56 +      void drawArrow(XY);
   37.57 +    public:
   37.58 +      ArcBase(Gnome::Canvas::Group&, Arc, DigraphDisplayerCanvas&);
   37.59 +      virtual ~ArcBase();
   37.60 +      virtual void draw() = 0;
   37.61 +      virtual void setLineWidth(int) = 0;
   37.62 +      virtual void setFillColor(Gdk::Color) = 0;
   37.63 +      virtual Gnome::Canvas::Item * getLine() = 0;
   37.64 +  };
   37.65 +
   37.66 +  ///Arc displayer class
   37.67 +
   37.68 +  ///This class is responsible for displaying arcs in digraph.
   37.69 +  ///The displayed arc is broken in the middle. The
   37.70 +  ///aim of this is to be able to indicate direction of arcs
   37.71 +  ///and to be able to display more then one arcs between the
   37.72 +  ///same source and target
   37.73 +  class BrokenArc : public ArcBase
   37.74 +  {
   37.75 +    private:
   37.76 +      Gnome::Canvas::Line line;
   37.77 +
   37.78 +      ///Indicates whether the button of mouse is pressed or not at the moment.
   37.79 +      bool isbutton;
   37.80 +
   37.81 +      ///At this location was the mousebutton pressed. Horizontal component.
   37.82 +
   37.83 +      ///It helps to calculate the
   37.84 +      ///distance of dragging.
   37.85 +      double clicked_x;
   37.86 +
   37.87 +      ///At this location was the mousebutton pressed. Vertical component.
   37.88 +
   37.89 +      ///It helps to calculate the
   37.90 +      ///distance of dragging.
   37.91 +      double clicked_y;
   37.92 +
   37.93 +      ///event handler for forming broken arcs
   37.94 +
   37.95 +      ///\param event the
   37.96 +      ///event to handle
   37.97 +      bool arcFormerEventHandler(GdkEvent* event);
   37.98 +
   37.99 +    public:
  37.100 +      ///Constructor of broken arc class.
  37.101 +
  37.102 +      ///\param g the group to which the arc belongs
  37.103 +      ///\param _arc the represented arc
  37.104 +      ///\param gc the canvas
  37.105 +      BrokenArc(Gnome::Canvas::Group&, Arc, DigraphDisplayerCanvas&);
  37.106 +
  37.107 +      ///Destructor of broken arc class
  37.108 +
  37.109 +      ///Frees up
  37.110 +      ///reserved memory
  37.111 +      ~BrokenArc();
  37.112 +
  37.113 +      ///The function that draws the arc based on collected data
  37.114 +      void draw();
  37.115 +
  37.116 +      void setLineWidth(int);
  37.117 +      void setFillColor(Gdk::Color);
  37.118 +
  37.119 +      Gnome::Canvas::Item * getLine() { return (Gnome::Canvas::Item *)(&line); };
  37.120 +  };
  37.121 +
  37.122 +  class LoopArc : public ArcBase
  37.123 +  {
  37.124 +    private:
  37.125 +      Gnome::Canvas::Ellipse line;
  37.126 +      bool arcFormerEventHandler(GdkEvent* e);
  37.127 +      bool isbutton;
  37.128 +    public:
  37.129 +      LoopArc(Gnome::Canvas::Group&, Arc, DigraphDisplayerCanvas&);
  37.130 +      ~LoopArc();
  37.131 +      void draw();
  37.132 +      void setLineWidth(int);
  37.133 +      void setFillColor(Gdk::Color);
  37.134 +      Gnome::Canvas::Item * getLine() { return (Gnome::Canvas::Item *)(&line); };
  37.135 +  };
  37.136 +
  37.137 +  ///Type of canvas, on which the digraph is drawn
  37.138 +  typedef Gnome::Canvas::CanvasAA Parent;
  37.139 +
  37.140 +public:
  37.141 +  ///Constructor
  37.142 +
  37.143 +  ///\param nbt the tab of the window, in which the digraph is displayed
  37.144 +  DigraphDisplayerCanvas(NoteBookTab & nbt);
  37.145 +
  37.146 +  ///destructor of the class
  37.147 +  virtual ~DigraphDisplayerCanvas();
  37.148 +
  37.149 +  ///Returns a color of the rainbow based on a map value and the min and max value of the given map
  37.150 +
  37.151 +  ///min and max is purple, between them there is a linear assign
  37.152 +  Gdk::Color rainbowColorCounter(double, double, double);
  37.153 +
  37.154 +  ///Changes the width of arc(s) according to the given map.
  37.155 +
  37.156 +  ///\param mapname is the name of the map which contains the values to be set
  37.157 +  ///\param arc if it is given, only the width of the given arc will be set, instead of all of them.
  37.158 +  int changeArcWidth (std::string mapname, Arc arc=INVALID);
  37.159 +
  37.160 +  ///Resets width of arc(s) to the default value
  37.161 +
  37.162 +  ///\param arc if it is given, only the width of the
  37.163 +  ///given arc will be reset, instead of all of them.
  37.164 +  int resetArcWidth (Arc arc=INVALID);
  37.165 +
  37.166 +  ///Changes the color of arc(s) according to the given map.
  37.167 +
  37.168 +  ///\param mapname is the name of the map which contains the new values
  37.169 +  ///\param arc if it is given, only the color of the given arc will be set, instead of all of them.
  37.170 +  int changeArcColor (std::string mapname, Arc arc=INVALID);
  37.171 +
  37.172 +  ///Resets color of arc(s) to the default value
  37.173 +
  37.174 +  ///\param arc if it is given, only the color of the
  37.175 +  ///given arc will be reset, instead of all of them.
  37.176 +  int resetArcColor (Arc arc=INVALID);
  37.177 +
  37.178 +  ///Changes the label of arc(s) according to the given map.
  37.179 +
  37.180 +  ///\param mapname is the name of the map which contains the new values
  37.181 +  ///\param arc if it is given, only the label of the given arc will be set, instead of all of them.
  37.182 +  int changeArcText (std::string mapname, Arc arc=INVALID);
  37.183 +
  37.184 +  ///Resets label of arc(s) to the default value
  37.185 +
  37.186 +  ///\param arc if it is given, only the color of the
  37.187 +  ///given arc will be reset, instead of all of them.
  37.188 +  int resetArcText (Arc arc=INVALID);
  37.189 +
  37.190 +  ///Changes the radius of node(s) according to the given map.
  37.191 +
  37.192 +  ///\param mapname is the name of the map which contains the new values
  37.193 +  ///\param node if it is given, only the radius of the given node will be set, instead of all of them.
  37.194 +  int changeNodeRadius (std::string mapname, Node node=INVALID);
  37.195 +
  37.196 +  ///Resets radius of node(s) to the default value
  37.197 +
  37.198 +  ///\param node if it is given, only the radius of the
  37.199 +  ///given node will be reset, instead of all of them.
  37.200 +  int resetNodeRadius (Node node=INVALID);
  37.201 +
  37.202 +  ///Changes the color of node(s) according to the given map.
  37.203 +
  37.204 +  ///\param mapname is the name of the map which contains the new values
  37.205 +  ///\param node if it is given, only the color of the given node will be set, instead of all of them.
  37.206 +  int changeNodeColor (std::string mapname, Node node=INVALID);
  37.207 +
  37.208 +  ///Resets color of node(s) to the default value
  37.209 +
  37.210 +  ///\param node if it is given, only the color of the
  37.211 +  ///given node will be reset, instead of all of them.
  37.212 +  int resetNodeColor (Node node=INVALID);
  37.213 +
  37.214 +  ///Changes the label of node(s) according to the given map.
  37.215 +
  37.216 +  ///\param mapname is the name of the map which contains the new values
  37.217 +  ///\param node if it is given, only the label of the given node will be set, instead of all of them.
  37.218 +  int changeNodeText (std::string mapname, Node node=INVALID);
  37.219 +
  37.220 +  ///Resets label of node(s) to the default value
  37.221 +
  37.222 +  ///\param node if it is given, only the label of the
  37.223 +  ///given node will be reset, instead of all of them.
  37.224 +  int resetNodeText (Node node=INVALID);
  37.225 +
  37.226 +  ///This function is called, when any of the displayed attributes have to be updated, or changed
  37.227 +
  37.228 +  ///\param itisarc if true, arc property has to be changed, else node property
  37.229 +  ///\param prop the id of property that has to changed or updated
  37.230 +  void propertyChange(bool itisarc, int prop);
  37.231 +
  37.232 +  ///updates the given property
  37.233 +
  37.234 +  ///\param arc if it is not INVALID, only the property of the given arc will be updated, instead of all of them
  37.235 +  ///\param prop the property to update
  37.236 +  void propertyUpdate(Arc arc, int prop);
  37.237 +
  37.238 +  ///updates the given property
  37.239 +
  37.240 +  ///\param node if it is not INVALID, only the property of the given node will be updated, instead of all of them
  37.241 +  ///\param prop the property to update
  37.242 +  void propertyUpdate(Node node, int prop);
  37.243 +
  37.244 +  ///updates all the property for the given arc
  37.245 +  void propertyUpdate(Arc);
  37.246 +
  37.247 +  ///updates all the property for the given node
  37.248 +  void propertyUpdate(Node);
  37.249 +
  37.250 +  ///Callback for 'ViewZoomIn' action.
  37.251 +  virtual void zoomIn();
  37.252 +  ///Callback for 'ViewZoomOut' action.
  37.253 +  virtual void zoomOut();
  37.254 +  ///Callback for 'ViewZoomFit' action.
  37.255 +  virtual void zoomFit();
  37.256 +  ///Callback for 'ViewZoom100' action.
  37.257 +  virtual void zoom100();
  37.258 +  ///Sets the scroll region of the convas to the bounding box of the digraph.
  37.259 +  void updateScrollRegion();
  37.260 +
  37.261 +  ///This function changes the tool in the digraph-editor's hand
  37.262 +  void changeEditorialTool(int);
  37.263 +
  37.264 +protected:
  37.265 +
  37.266 +  //maximizing, minimizing, restoring window, etc.
  37.267 +  virtual bool on_expose_event(GdkEventExpose *);
  37.268 +
  37.269 +private:
  37.270 +
  37.271 +  ///This function is responsible for the correct
  37.272 +  ///reaction of any action happened in the territory
  37.273 +  ///of the canvas
  37.274 +  ///DEPRECATED!!!!
  37.275 +  bool eventHandler(GdkEvent* e, Node n);
  37.276 +
  37.277 +  ///actual event handler
  37.278 +  ///
  37.279 +  ///Actual event handler should be stored, to be able to disconnect it and later reconnect it.
  37.280 +  sigc::connection actual_handler;
  37.281 +
  37.282 +  ///event handler for the case when move-tool is active
  37.283 +  bool moveEventHandler(GdkEvent*);
  37.284 +  ///event handler for the case when create_node-tool is active
  37.285 +  bool createNodeEventHandler(GdkEvent*);
  37.286 +  ///event handler for the case when create_arc-tool is active
  37.287 +  bool createArcEventHandler(GdkEvent*);
  37.288 +  ///event handler for the case when eraser-tool is active
  37.289 +  bool eraserEventHandler(GdkEvent*);
  37.290 +  ///event handler for the case when map editor tool is active
  37.291 +  bool mapEditEventHandler(GdkEvent*);
  37.292 +  ///event handler for the case when user scrolls the mouse
  37.293 +  bool scrollEventHandler(GdkEvent*);
  37.294 +
  37.295 +private:
  37.296 +  ///moves node according to the given parameters
  37.297 +  void moveNode(double, double,  Gnome::Canvas::Item * item=NULL, Node node=INVALID);
  37.298 +
  37.299 +public:
  37.300 +  ///Moves the text to new place
  37.301 +  void textReposition(XY);
  37.302 +
  37.303 +  ///Activates an arc belonging to an ArcBase
  37.304 +
  37.305 +  ///After we have activated an arc this way,
  37.306 +  ///the GDC object will know, which arc is under forming
  37.307 +  ///therefore it can redraw the necessary elements on the canvas,
  37.308 +  ///for example the text belonging to the \ref ArcBase can be
  37.309 +  ///redrawn (\ref textReposition).
  37.310 +  void toggleArcActivity(ArcBase*, bool);
  37.311 +
  37.312 +public:
  37.313 +
  37.314 +  ///Returns the actual tool in hand
  37.315 +  int getActualTool();
  37.316 +
  37.317 +  ///Sets node representation settings
  37.318 +  void setView(bool, bool, double, double);
  37.319 +
  37.320 +  ///Gets node representation settings
  37.321 +  void getView(bool &, bool &, double&, double&);
  37.322 +
  37.323 +  ///draws the digraph
  37.324 +
  37.325 +  ///Called when opening a file.
  37.326 +  void drawDigraph();
  37.327 +
  37.328 +  ///Clears the canvas
  37.329 +
  37.330 +  ///It achieves this by deleting all data
  37.331 +  ///structure used to help handle the displayed digraph.
  37.332 +  void clear();
  37.333 +
  37.334 +  ///creates a new Nodemap
  37.335 +
  37.336 +  ///\param init initial value of the map
  37.337 +  ///\param mapname name of new map
  37.338 +  int addNewNodeMap(double init,std::string mapname);
  37.339 +  ///creates a new Arcmap
  37.340 +
  37.341 +  ///\param init initial value of the map
  37.342 +  ///\param mapname name of new map
  37.343 +  int addNewArcMap(double init,std::string mapname);
  37.344 +
  37.345 +  void reDesignDigraph();
  37.346 +
  37.347 +  ///Show whether the digraph is already drawn.
  37.348 +  bool is_drawn;
  37.349 +
  37.350 +private:
  37.351 +  ///Deletes the given element.
  37.352 +  void deleteItem(Node);
  37.353 +  ///Deletes the given element.
  37.354 +  void deleteItem(Arc);
  37.355 +
  37.356 +private:
  37.357 +
  37.358 +  ///Map of nodes of digraph
  37.359 +  Digraph::NodeMap<Gnome::Canvas::Ellipse *> nodesmap;
  37.360 +
  37.361 +  ///Map of arcs of digraph
  37.362 +  Digraph::ArcMap<ArcBase*> arcsmap;
  37.363 +
  37.364 +  ///Map of texts to write on arcs
  37.365 +  Digraph::ArcMap<Gnome::Canvas::Text *> arctextmap;
  37.366 +
  37.367 +  ///Map of texts to write on nodes
  37.368 +  Digraph::NodeMap<Gnome::Canvas::Text *> nodetextmap;
  37.369 +
  37.370 +  ///Group of digraphical elements of displayed_graph
  37.371 +  Gnome::Canvas::Group displayed_graph;
  37.372 +
  37.373 +private:
  37.374 +  ///Indicates whether the button of mouse is pressed or not
  37.375 +  int isbutton;
  37.376 +
  37.377 +  ///Stores the actual tool in hand
  37.378 +  int actual_tool;
  37.379 +
  37.380 +  ///At this location was the mousebutton pressed.
  37.381 +  ///It helps to calculate the distance of dragging.
  37.382 +  double clicked_x, clicked_y;
  37.383 +
  37.384 +  ///Remembers which Gnome::Canvas::Item was pressed.
  37.385 +
  37.386 +  ///this variable is needed, to work on it after selection
  37.387 +  Gnome::Canvas::Item * active_item;
  37.388 +
  37.389 +  ///Remembers which Gnome::Canvas::Item was pressed.
  37.390 +
  37.391 +  ///this variable is used at arc creation, it will
  37.392 +  ///be the secondly selected node. No local variable
  37.393 +  ///can be used for this purpose inside the function,
  37.394 +  ///because the node selected by button press, and
  37.395 +  ///the arc is created by button release. Both of
  37.396 +  ///them is different function call.
  37.397 +  Gnome::Canvas::Item * target_item;
  37.398 +
  37.399 +  ///selected node (for any editing)
  37.400 +  Node active_node;
  37.401 +
  37.402 +  ///selected arc (for any editing)
  37.403 +  Arc active_arc;
  37.404 +
  37.405 +  ///the arc that is selected by clicking on the red arrow in the middle of it
  37.406 +
  37.407 +  ///This arc is stored only for the purpose of reshape it.
  37.408 +  ///That is why it is selected in a different manner.
  37.409 +  Arc forming_arc;
  37.410 +
  37.411 +  ///Map displayed by label can be edited.
  37.412 +  std::string nodemap_to_edit;
  37.413 +
  37.414 +  ///Map displayed by label can be edited.
  37.415 +  std::string arcmap_to_edit;
  37.416 +
  37.417 +  static const int zoom_step = 5;
  37.418 +
  37.419 +  ///Is node radius autoscaled
  37.420 +  bool autoscale;
  37.421 +  
  37.422 +  ///Should we track zoomfactor changes
  37.423 +  bool zoomtrack;
  37.424 +
  37.425 +  ///to store the zoom factor when it was "fixed"
  37.426 +  double fixed_zoom_factor;
  37.427 +  
  37.428 +  ///Node radius size
  37.429 +  double radius_size;
  37.430 +
  37.431 +  ///Arc width
  37.432 +  double arc_width;
  37.433 +
  37.434 +  ///Was redesign run on this digraph already?
  37.435 +  ///
  37.436 +  ///If not, the layout will be modified randomly
  37.437 +  ///to avoid frozen layout because of wrong
  37.438 +  ///initial state
  37.439 +  bool was_redesigned;
  37.440 +  
  37.441 +private:
  37.442 +
  37.443 +  ///reference to the container, in which the canvas is
  37.444 +  NoteBookTab & mytab;
  37.445 +
  37.446 +  XY calcArrowPos(XY, XY, XY, XY, int);
  37.447 +
  37.448 +  bool background_set;
  37.449 +  Glib::RefPtr<Gdk::Pixbuf> refBackground;
  37.450 +  Gnome::Canvas::Pixbuf *background;
  37.451 +public:
  37.452 +  void setBackground();
  37.453 +};
  37.454 +
  37.455 +#endif //GRAPH_DISPLAYER_CANVAS_H
    38.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.2 +++ b/graphocska.lgf	Mon Jul 07 08:10:39 2008 -0500
    38.3 @@ -0,0 +1,39 @@
    38.4 +@nodes
    38.5 +label	coordinates_x	coordinates_y data
    38.6 +1	230	-80	1.123
    38.7 +2	230	100	3.234
    38.8 +3	120	-80	5.345
    38.9 +4	120	100	7.456
   38.10 +5	20	100	9.567
   38.11 +6	20	-80	11.678
   38.12 +7	-40	10	13.789
   38.13 +8	-100	100	15.890
   38.14 +9	-100	10	17.901
   38.15 +10	-100	-80	19.012
   38.16 +11	-200	-80	21.000
   38.17 +12	-200	10	23.001
   38.18 +13	-200	100	25.003
   38.19 +14	-300	100	27.004
   38.20 +15	-300	-80	29.9999
   38.21 +
   38.22 +@arcs
   38.23 +	        label	map1	map2	map3	map4
   38.24 +15	14	1	21	111	231	3
   38.25 +14	13	2	22	112	232	6
   38.26 +13	12	3	23	113	233	9
   38.27 +13	8	4	24	114	234	12
   38.28 +12	11	5	25	115	235	15
   38.29 +12	9	6	26	116	236	18
   38.30 +11	10	7	27	117	237	21
   38.31 +10	9	8	28	118	238	24
   38.32 +10	7	9	29	119	239	27
   38.33 +9	8	10	30	120	230	30
   38.34 +7	6	11	31	121	241	33
   38.35 +6	5	12	32	122	242	36
   38.36 +6	3	13	33	123	243	39
   38.37 +5	4	14	34	124	244	42
   38.38 +4	3	15	35	125	245	45
   38.39 +3	2	16	36	126	246	48
   38.40 +2	1	17	37	127	247	51
   38.41 +
   38.42 +@end
   38.43 \ No newline at end of file
    39.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.2 +++ b/gui_reader.cc	Mon Jul 07 08:10:39 2008 -0500
    39.3 @@ -0,0 +1,194 @@
    39.4 +/* -*- C++ -*-
    39.5 + *
    39.6 + * This file is a part of LEMON, a generic C++ optimization library
    39.7 + *
    39.8 + * Copyright (C) 2003-2006
    39.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
   39.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
   39.11 + *
   39.12 + * Permission to use, modify and distribute this software is granted
   39.13 + * provided that this copyright notice appears in all copies. For
   39.14 + * precise terms see the accompanying LICENSE file.
   39.15 + *
   39.16 + * This software is provided "AS IS" with no warranty of any kind,
   39.17 + * express or implied, and with no claim as to its suitability for any
   39.18 + * purpose.
   39.19 + *
   39.20 + */
   39.21 +
   39.22 +#include <gui_reader.h>
   39.23 +#include <mapstorage.h>
   39.24 +
   39.25 +#include <xml.h>
   39.26 +#include "io_helper.h"
   39.27 +#include <lemon/dim2.h>
   39.28 +#include <vector>
   39.29 +
   39.30 +// bool GuiReader::header(const std::string& line)
   39.31 +// {
   39.32 +//   std::istringstream ls(line);
   39.33 +//   std::string head;
   39.34 +//   ls >> head;
   39.35 +//   return head == "@gui";
   39.36 +// }
   39.37 +
   39.38 +//void GuiReader::read(std::istream& is)
   39.39 +void GuiReader::operator()(std::istream& is, int& ln)
   39.40 +{
   39.41 +  using std::vector;
   39.42 +  using std::string;
   39.43 +  using std::pair;
   39.44 +  using std::make_pair;
   39.45 +  using std::string;
   39.46 +  using std::map;
   39.47 +
   39.48 +  XmlIo x(is);
   39.49 +
   39.50 +  { x("main_node_map_names", gui_data.main_node_map_names); }
   39.51 +  { x("gui_node_map_names", gui_data.gui_node_map_names); }
   39.52 +
   39.53 +  { x("node_map_types", gui_data.node_map_types); }
   39.54 +
   39.55 +  { x("main_arc_map_names", gui_data.main_arc_map_names); }
   39.56 +  { x("gui_arc_map_names", gui_data.gui_arc_map_names); }
   39.57 +
   39.58 +  { x("arc_map_types", gui_data.arc_map_types); }
   39.59 +
   39.60 +  for (vector<string>::const_iterator it = gui_data.gui_node_map_names.begin();
   39.61 +      it != gui_data.gui_node_map_names.end(); ++it)
   39.62 +  {
   39.63 +    MapValue::Type type = gui_data.node_map_types[*it];
   39.64 +    switch (type)
   39.65 +    {
   39.66 +      case MapValue::NUMERIC:
   39.67 +        {
   39.68 +          map<int, double>* p_map_data =
   39.69 +            new map<int, double>;
   39.70 +          gui_data.numeric_node_maps[*it] = p_map_data;
   39.71 +          { x(*it, *p_map_data); }
   39.72 +        }
   39.73 +        break;
   39.74 +      case MapValue::STRING:
   39.75 +        {
   39.76 +          map<int, string>* p_map_data =
   39.77 +            new map<int, string>;
   39.78 +          gui_data.string_node_maps[*it] = p_map_data;
   39.79 +          { x(*it, *p_map_data); }
   39.80 +        }
   39.81 +        break;
   39.82 +    }
   39.83 +  }
   39.84 +
   39.85 +  for (vector<string>::const_iterator it = gui_data.gui_arc_map_names.begin();
   39.86 +      it != gui_data.gui_arc_map_names.end(); ++it)
   39.87 +  {
   39.88 +    MapValue::Type type = gui_data.arc_map_types[*it];
   39.89 +    switch (type)
   39.90 +    {
   39.91 +      case MapValue::NUMERIC:
   39.92 +        {
   39.93 +          map<int, double>* p_map_data =
   39.94 +            new map<int, double>;
   39.95 +          gui_data.numeric_arc_maps[*it] = p_map_data;
   39.96 +          { x(*it, *p_map_data); }
   39.97 +        }
   39.98 +        break;
   39.99 +      case MapValue::STRING:
  39.100 +        {
  39.101 +          map<int, string>* p_map_data =
  39.102 +            new map<int, string>;
  39.103 +          gui_data.string_arc_maps[*it] = p_map_data;
  39.104 +          { x(*it, *p_map_data); }
  39.105 +        }
  39.106 +        break;
  39.107 +    }
  39.108 +  }
  39.109 +
  39.110 +  {
  39.111 +    std::string node_coords_save_dest;
  39.112 +    { x("node_coords_save_dest", node_coords_save_dest); }
  39.113 +    if (node_coords_save_dest == "gui_sect")
  39.114 +    {
  39.115 +      // read the node coorinates
  39.116 +      gui_data.node_coords_save_dest = MapStorage::SpecMapSaveOpts::GUI_SECT;
  39.117 +      { x("node_coord_map", gui_data.node_coord_map); }
  39.118 +    }
  39.119 +    else if (node_coords_save_dest == "nodeset_sect_1_map")
  39.120 +    {
  39.121 +      gui_data.node_coords_save_dest = MapStorage::SpecMapSaveOpts::NESET_SECT;
  39.122 +      gui_data.node_coords_save_map_num = MapStorage::SpecMapSaveOpts::ONE_MAP;
  39.123 +      { x("map_name", gui_data.node_coords_one_map_name); }
  39.124 +    }
  39.125 +    else if (node_coords_save_dest == "nodeset_sect_2_maps")
  39.126 +    {
  39.127 +      gui_data.node_coords_save_dest = MapStorage::SpecMapSaveOpts::NESET_SECT;
  39.128 +      gui_data.node_coords_save_map_num = MapStorage::SpecMapSaveOpts::TWO_MAPS;
  39.129 +      { x("map1_name", gui_data.node_coords_two_maps_1_name); }
  39.130 +      { x("map2_name", gui_data.node_coords_two_maps_2_name); }
  39.131 +    }
  39.132 +  }
  39.133 +
  39.134 +  {
  39.135 +    std::string arrow_coords_save_dest;
  39.136 +    { x("arrow_coords_save_dest", arrow_coords_save_dest); }
  39.137 +    if (arrow_coords_save_dest == "gui_sect")
  39.138 +    {
  39.139 +      // read the arrow coorinates
  39.140 +      gui_data.arrow_coords_save_dest = MapStorage::SpecMapSaveOpts::GUI_SECT;
  39.141 +      { x("arrow_coord_map", gui_data.arrow_coord_map); }
  39.142 +    }
  39.143 +    else if (arrow_coords_save_dest == "arcset_sect_1_map")
  39.144 +    {
  39.145 +      gui_data.arrow_coords_save_dest = MapStorage::SpecMapSaveOpts::NESET_SECT;
  39.146 +      gui_data.arrow_coords_save_map_num = MapStorage::SpecMapSaveOpts::ONE_MAP;
  39.147 +      { x("map_name", gui_data.arrow_coords_one_map_name); }
  39.148 +    }
  39.149 +    else if (arrow_coords_save_dest == "arcset_sect_2_maps")
  39.150 +    {
  39.151 +      gui_data.arrow_coords_save_dest = MapStorage::SpecMapSaveOpts::NESET_SECT;
  39.152 +      gui_data.arrow_coords_save_map_num = MapStorage::SpecMapSaveOpts::TWO_MAPS;
  39.153 +      { x("map1_name", gui_data.arrow_coords_two_maps_1_name); }
  39.154 +      { x("map2_name", gui_data.arrow_coords_two_maps_2_name); }
  39.155 +    }
  39.156 +  }
  39.157 +
  39.158 +
  39.159 +
  39.160 +  std::map<int, std::string> nm;
  39.161 +  x("active_nodemaps", nm);
  39.162 +
  39.163 +  for(int i=0;i<NODE_PROPERTY_NUM;i++)
  39.164 +  {
  39.165 +    mapstorage->changeActiveMap(false, i, nm[i]);
  39.166 +  }
  39.167 +
  39.168 +  std::map<int, std::string> em;
  39.169 +  x("active_arcmaps", em);
  39.170 +  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
  39.171 +  {
  39.172 +    mapstorage->changeActiveMap(true, i, em[i]);
  39.173 +  }
  39.174 +
  39.175 +  double attraction;
  39.176 +  double propulsation;
  39.177 +  int iteration;
  39.178 +
  39.179 +  x("redesign-attraction", attraction);
  39.180 +  x("redesign-propulsation", propulsation);
  39.181 +  x("redesign-iteration", iteration);
  39.182 +
  39.183 +  mapstorage->set_attraction(attraction);
  39.184 +  mapstorage->set_propulsation(propulsation);
  39.185 +  mapstorage->set_iteration(iteration);
  39.186 +
  39.187 +  mapstorage->redesign_data_changed();
  39.188 +}
  39.189 +
  39.190 +//GuiReader::GuiReader(LemonReader& reader, MapStorage* _mapstorage,
  39.191 +GuiReader::GuiReader(MapStorage* _mapstorage,
  39.192 +    MapStorage::GUISectData& _gui_data) :
  39.193 +  //Parent(reader),
  39.194 +  mapstorage(_mapstorage),
  39.195 +  gui_data(_gui_data)
  39.196 +{
  39.197 +}
    40.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.2 +++ b/gui_reader.h	Mon Jul 07 08:10:39 2008 -0500
    40.3 @@ -0,0 +1,36 @@
    40.4 +/* -*- C++ -*-
    40.5 + *
    40.6 + * This file is a part of LEMON, a generic C++ optimization library
    40.7 + *
    40.8 + * Copyright (C) 2003-2006
    40.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
   40.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
   40.11 + *
   40.12 + * Permission to use, modify and distribute this software is granted
   40.13 + * provided that this copyright notice appears in all copies. For
   40.14 + * precise terms see the accompanying LICENSE file.
   40.15 + *
   40.16 + * This software is provided "AS IS" with no warranty of any kind,
   40.17 + * express or implied, and with no claim as to its suitability for any
   40.18 + * purpose.
   40.19 + *
   40.20 + */
   40.21 +
   40.22 +#ifndef GUI_READER_H
   40.23 +#define GUI_READER_H
   40.24 +
   40.25 +#include <iostream>
   40.26 +#include "mapstorage.h"
   40.27 +
   40.28 +class GuiReader
   40.29 +{
   40.30 +  private:
   40.31 +    MapStorage* mapstorage;
   40.32 +    MapStorage::GUISectData& gui_data;
   40.33 +
   40.34 +  public:
   40.35 +  void operator()(std::istream&, int&);
   40.36 +  GuiReader(MapStorage*, MapStorage::GUISectData&);
   40.37 +};
   40.38 +
   40.39 +#endif
    41.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.2 +++ b/gui_writer.cc	Mon Jul 07 08:10:39 2008 -0500
    41.3 @@ -0,0 +1,281 @@
    41.4 +/* -*- C++ -*-
    41.5 + *
    41.6 + * This file is a part of LEMON, a generic C++ optimization library
    41.7 + *
    41.8 + * Copyright (C) 2003-2006
    41.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
   41.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
   41.11 + *
   41.12 + * Permission to use, modify and distribute this software is granted
   41.13 + * provided that this copyright notice appears in all copies. For
   41.14 + * precise terms see the accompanying LICENSE file.
   41.15 + *
   41.16 + * This software is provided "AS IS" with no warranty of any kind,
   41.17 + * express or implied, and with no claim as to its suitability for any
   41.18 + * purpose.
   41.19 + *
   41.20 + */
   41.21 +
   41.22 +#include "gui_writer.h"
   41.23 +#include "io_helper.h"
   41.24 +#include "mapstorage.h"
   41.25 +#include "xml.h"
   41.26 +#include <lemon/dim2.h>
   41.27 +#include <vector>
   41.28 +
   41.29 +#include <gui_writer.h>
   41.30 +#include <mapstorage.h>
   41.31 +
   41.32 +// std::string GuiWriter::header()
   41.33 +// {
   41.34 +//   return "@gui";
   41.35 +// }
   41.36 +
   41.37 +void GuiWriter::write(std::ostream& os)
   41.38 +{
   41.39 +  using std::vector;
   41.40 +  using std::string;
   41.41 +  using std::map;
   41.42 +  using std::string;
   41.43 +
   41.44 +  os << "@gui" << std::endl;
   41.45 +
   41.46 +  XmlIo x(os);
   41.47 +
   41.48 +  vector<string> all_node_map_names = mapstorage->getNodeMapList();
   41.49 +  // name of the maps saved to the nodeset section
   41.50 +  vector<string> main_node_map_names;
   41.51 +  // name of the maps saved to the gui section
   41.52 +  vector<string> gui_node_map_names;
   41.53 +
   41.54 +  for (vector<string>::const_iterator it = all_node_map_names.begin();
   41.55 +      it != all_node_map_names.end(); ++it)
   41.56 +  {
   41.57 +    if (mapstorage->getNodeMapSaveDest(*it) == MapStorage::NESET_SECT)
   41.58 +      main_node_map_names.push_back(*it);
   41.59 +    else if (mapstorage->getNodeMapSaveDest(*it) == MapStorage::GUI_SECT)
   41.60 +      gui_node_map_names.push_back(*it);
   41.61 +  }
   41.62 +
   41.63 +  { x("main_node_map_names", main_node_map_names); }
   41.64 +  { x("gui_node_map_names", gui_node_map_names); }
   41.65 +
   41.66 +  map<string, MapValue::Type> node_map_types;
   41.67 +  for (vector<string>::const_iterator it = main_node_map_names.begin();
   41.68 +      it != main_node_map_names.end(); ++it)
   41.69 +  {
   41.70 +    node_map_types[*it] = mapstorage->getNodeMapElementType(*it);
   41.71 +  }
   41.72 +  for (vector<string>::const_iterator it = gui_node_map_names.begin();
   41.73 +      it != gui_node_map_names.end(); ++it)
   41.74 +  {
   41.75 +    node_map_types[*it] = mapstorage->getNodeMapElementType(*it);
   41.76 +  }
   41.77 +
   41.78 +  { x("node_map_types", node_map_types); }
   41.79 +
   41.80 +
   41.81 +  vector<string> all_arc_map_names = mapstorage->getArcMapList();
   41.82 +  // name of the maps saved to the arcset section
   41.83 +  vector<string> main_arc_map_names;
   41.84 +  // name of the maps saved to the gui section
   41.85 +  vector<string> gui_arc_map_names;
   41.86 +
   41.87 +  for (vector<string>::const_iterator it = all_arc_map_names.begin();
   41.88 +      it != all_arc_map_names.end(); ++it)
   41.89 +  {
   41.90 +    if (mapstorage->getArcMapSaveDest(*it) == MapStorage::NESET_SECT)
   41.91 +      main_arc_map_names.push_back(*it);
   41.92 +    if (mapstorage->getArcMapSaveDest(*it) == MapStorage::GUI_SECT)
   41.93 +      gui_arc_map_names.push_back(*it);
   41.94 +  }
   41.95 +
   41.96 +  { x("main_arc_map_names", main_arc_map_names); }
   41.97 +  { x("gui_arc_map_names", gui_arc_map_names); }
   41.98 +
   41.99 +  map<string, MapValue::Type> arc_map_types;
  41.100 +  for (vector<string>::const_iterator it = main_arc_map_names.begin();
  41.101 +      it != main_arc_map_names.end(); ++it)
  41.102 +  {
  41.103 +    arc_map_types[*it] = mapstorage->getArcMapElementType(*it);
  41.104 +  }
  41.105 +  for (vector<string>::const_iterator it = gui_arc_map_names.begin();
  41.106 +      it != gui_arc_map_names.end(); ++it)
  41.107 +  {
  41.108 +    arc_map_types[*it] = mapstorage->getArcMapElementType(*it);
  41.109 +  }
  41.110 +
  41.111 +  { x("arc_map_types", arc_map_types); }
  41.112 +
  41.113 +  // write the gui node maps
  41.114 +  for (vector<string>::const_iterator it = gui_node_map_names.begin();
  41.115 +      it != gui_node_map_names.end(); ++it)
  41.116 +  {
  41.117 +    MapValue::Type type = mapstorage->getNodeMapElementType(*it);
  41.118 +    const MapStorage::NodeLabelMap& labels = mapstorage->getNodeLabelMap();
  41.119 +    switch (type)
  41.120 +    {
  41.121 +      case MapValue::NUMERIC:
  41.122 +        {
  41.123 +          std::map<int, double> map_data;
  41.124 +          MapStorage::NumericNodeMap& map =
  41.125 +            mapstorage->getNumericNodeMap(*it);
  41.126 +          for (NodeIt n(mapstorage->getDigraph()); n != INVALID; ++n)
  41.127 +          {
  41.128 +            map_data[labels[n]] = map[n];
  41.129 +          }
  41.130 +          { x(*it, map_data); }
  41.131 +        }
  41.132 +        break;
  41.133 +      case MapValue::STRING:
  41.134 +        {
  41.135 +          std::map<int, std::string> map_data;
  41.136 +          MapStorage::StringNodeMap& map =
  41.137 +            mapstorage->getStringNodeMap(*it);
  41.138 +          for (NodeIt n(mapstorage->getDigraph()); n != INVALID; ++n)
  41.139 +          {
  41.140 +            map_data[labels[n]] = map[n];
  41.141 +          }
  41.142 +          { x(*it, map_data); }
  41.143 +        }
  41.144 +        break;
  41.145 +    }
  41.146 +  }
  41.147 +
  41.148 +  // write the gui arc maps
  41.149 +  for (vector<string>::const_iterator it = gui_arc_map_names.begin();
  41.150 +      it != gui_arc_map_names.end(); ++it)
  41.151 +  {
  41.152 +    MapValue::Type type = mapstorage->getArcMapElementType(*it);
  41.153 +    const MapStorage::ArcLabelMap& labels = mapstorage->getArcLabelMap();
  41.154 +    switch (type)
  41.155 +    {
  41.156 +      case MapValue::NUMERIC:
  41.157 +        {
  41.158 +          std::map<int, double> map_data;
  41.159 +          MapStorage::NumericArcMap& map =
  41.160 +            mapstorage->getNumericArcMap(*it);
  41.161 +          for (ArcIt e(mapstorage->getDigraph()); e != INVALID; ++e)
  41.162 +          {
  41.163 +            map_data[labels[e]] = map[e];
  41.164 +          }
  41.165 +          { x(*it, map_data); }
  41.166 +        }
  41.167 +        break;
  41.168 +      case MapValue::STRING:
  41.169 +        {
  41.170 +          std::map<int, std::string> map_data;
  41.171 +          MapStorage::StringArcMap& map =
  41.172 +            mapstorage->getStringArcMap(*it);
  41.173 +          for (ArcIt e(mapstorage->getDigraph()); e != INVALID; ++e)
  41.174 +          {
  41.175 +            map_data[labels[e]] = map[e];
  41.176 +          }
  41.177 +          { x(*it, map_data); }
  41.178 +        }
  41.179 +        break;
  41.180 +    }
  41.181 +  }
  41.182 +
  41.183 +  {
  41.184 +    switch (mapstorage->getNodeCoordsSaveDest())
  41.185 +    {
  41.186 +      case MapStorage::SpecMapSaveOpts::GUI_SECT:
  41.187 +        { x("node_coords_save_dest", string("gui_sect")); }
  41.188 +        // write the node coorinates
  41.189 +        {
  41.190 +          const MapStorage::NodeLabelMap& labels =
  41.191 +            mapstorage->getNodeLabelMap();
  41.192 +          std::map<int, XY> node_coord_map;
  41.193 +          MapStorage::NodeCoordMap& map = mapstorage->getNodeCoordMap();
  41.194 +          for (NodeIt n(mapstorage->getDigraph()); n != INVALID; ++n)
  41.195 +          {
  41.196 +            node_coord_map[labels[n]] = map[n];
  41.197 +          }
  41.198 +          { x("node_coord_map", node_coord_map); }
  41.199 +        }
  41.200 +        break;
  41.201 +      case MapStorage::SpecMapSaveOpts::NESET_SECT:
  41.202 +        switch (mapstorage->getNodeCoordsSaveMapNum())
  41.203 +        {
  41.204 +          case MapStorage::SpecMapSaveOpts::ONE_MAP:
  41.205 +            { x("node_coords_save_dest", string("nodeset_sect_1_map")); }
  41.206 +            { x("map_name", mapstorage->getNodeCoordsOneMapName()); }
  41.207 +            break;
  41.208 +          case MapStorage::SpecMapSaveOpts::TWO_MAPS:
  41.209 +            { x("node_coords_save_dest", string("nodeset_sect_2_maps")); }
  41.210 +            { x("map1_name", mapstorage->getNodeCoordsTwoMaps1Name()); }
  41.211 +            { x("map2_name", mapstorage->getNodeCoordsTwoMaps2Name()); }
  41.212 +            break;
  41.213 +        }
  41.214 +        break;
  41.215 +    }
  41.216 +  }
  41.217 +
  41.218 +  {
  41.219 +    switch (mapstorage->getArrowCoordsSaveDest())
  41.220 +    {
  41.221 +      case MapStorage::SpecMapSaveOpts::GUI_SECT:
  41.222 +        { x("arrow_coords_save_dest", string("gui_sect")); }
  41.223 +        // write the arrow coorinates
  41.224 +        {
  41.225 +          const MapStorage::ArcLabelMap& labels =
  41.226 +            mapstorage->getArcLabelMap();
  41.227 +          std::map<int, XY> arrow_coord_map;
  41.228 +          MapStorage::ArrowCoordMap& map = mapstorage->getArrowCoordMap();
  41.229 +          for (ArcIt e(mapstorage->getDigraph()); e != INVALID; ++e)
  41.230 +          {
  41.231 +            arrow_coord_map[labels[e]] = map[e];
  41.232 +          }
  41.233 +          { x("arrow_coord_map", arrow_coord_map); }
  41.234 +        }
  41.235 +        break;
  41.236 +      case MapStorage::SpecMapSaveOpts::NESET_SECT:
  41.237 +        switch (mapstorage->getArrowCoordsSaveMapNum())
  41.238 +        {
  41.239 +          case MapStorage::SpecMapSaveOpts::ONE_MAP:
  41.240 +            { x("arrow_coords_save_dest", string("arcset_sect_1_map")); }
  41.241 +            { x("map_name", mapstorage->getArrowCoordsOneMapName()); }
  41.242 +            break;
  41.243 +          case MapStorage::SpecMapSaveOpts::TWO_MAPS:
  41.244 +            { x("arrow_coords_save_dest", string("arcset_sect_2_maps")); }
  41.245 +            { x("map1_name", mapstorage->getArrowCoordsTwoMaps1Name()); }
  41.246 +            { x("map2_name", mapstorage->getArrowCoordsTwoMaps2Name()); }
  41.247 +            break;
  41.248 +        }
  41.249 +        break;
  41.250 +    }
  41.251 +  }
  41.252 +
  41.253 +
  41.254 +  std::map<int, std::string> nm;
  41.255 +  for(int i=0;i<NODE_PROPERTY_NUM;i++)
  41.256 +    {
  41.257 +      nm[i]=mapstorage->active_nodemaps[i];
  41.258 +    }
  41.259 +  { x("active_nodemaps", nm); }
  41.260 +
  41.261 +  std::map<int, std::string> em;
  41.262 +  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
  41.263 +    {
  41.264 +      em[i]=mapstorage->active_arcmaps[i];
  41.265 +    }
  41.266 +  { x("active_arcmaps", em); }
  41.267 +
  41.268 +  double attraction;
  41.269 +  double propulsation;
  41.270 +  int iteration;
  41.271 +
  41.272 +  mapstorage->get_design_data(attraction, propulsation, iteration);
  41.273 +
  41.274 +  { x("redesign-attraction", attraction); }
  41.275 +  { x("redesign-propulsation", propulsation); }
  41.276 +  { x("redesign-iteration", iteration); }
  41.277 +}
  41.278 +
  41.279 +//GuiWriter::GuiWriter(LemonWriter& writer, MapStorage* ms) :
  41.280 +GuiWriter::GuiWriter(MapStorage* ms) :
  41.281 +  //Parent(writer),
  41.282 +  mapstorage(ms)
  41.283 +{
  41.284 +}
    42.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.2 +++ b/gui_writer.h	Mon Jul 07 08:10:39 2008 -0500
    42.3 @@ -0,0 +1,35 @@
    42.4 +/* -*- C++ -*-
    42.5 + *
    42.6 + * This file is a part of LEMON, a generic C++ optimization library
    42.7 + *
    42.8 + * Copyright (C) 2003-2006
    42.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
   42.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
   42.11 + *
   42.12 + * Permission to use, modify and distribute this software is granted
   42.13 + * provided that this copyright notice appears in all copies. For
   42.14 + * precise terms see the accompanying LICENSE file.
   42.15 + *
   42.16 + * This software is provided "AS IS" with no warranty of any kind,
   42.17 + * express or implied, and with no claim as to its suitability for any
   42.18 + * purpose.
   42.19 + *
   42.20 + */
   42.21 +
   42.22 +#ifndef GUI_WRITER_H
   42.23 +#define GUI_WRITER_H
   42.24 +
   42.25 +#include <iostream>
   42.26 +
   42.27 +class MapStorage;
   42.28 +
   42.29 +class GuiWriter
   42.30 +{
   42.31 +  private:
   42.32 +    MapStorage* mapstorage;
   42.33 +  public:
   42.34 +    virtual void write(std::ostream&);
   42.35 +    GuiWriter(MapStorage*);
   42.36 +};
   42.37 +
   42.38 +#endif
    43.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.2 +++ b/i18n.h	Mon Jul 07 08:10:39 2008 -0500
    43.3 @@ -0,0 +1,7 @@
    43.4 +#ifndef I18N_H
    43.5 +#define I18N_H
    43.6 +
    43.7 +#include "gettext.h"
    43.8 +#define _(string) gettext (string)
    43.9 +
   43.10 +#endif
    44.1 Binary file icons/addlink.png has changed
    45.1 Binary file icons/addnode.png has changed
    46.1 Binary file icons/delete.png has changed
    47.1 Binary file icons/editlink.png has changed
    48.1 Binary file icons/editnode.png has changed
    49.1 Binary file icons/eps.png has changed
    50.1 Binary file icons/move.png has changed
    51.1 Binary file icons/newmap.png has changed
    52.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.2 +++ b/io_helper.cc	Mon Jul 07 08:10:39 2008 -0500
    52.3 @@ -0,0 +1,34 @@
    52.4 +#include "io_helper.h"
    52.5 +
    52.6 +namespace lemon {
    52.7 +  void xml(XmlIo &x, MapValue::Type& v)
    52.8 +  {
    52.9 +    if(x.write()) {
   52.10 +      switch (v)
   52.11 +      {
   52.12 +        case MapValue::NUMERIC:
   52.13 +          { x("type", std::string("numeric")); }
   52.14 +          break;
   52.15 +        case MapValue::STRING:
   52.16 +          { x("type", std::string("string")); }
   52.17 +          break;
   52.18 +      }
   52.19 +    }
   52.20 +    else {
   52.21 +      std::string type;
   52.22 +      { x("type", type); }
   52.23 +      if (type == "numeric")
   52.24 +      {
   52.25 +        v = MapValue::NUMERIC;
   52.26 +      }
   52.27 +      else if (type == "string")
   52.28 +      {
   52.29 +        v = MapValue::STRING;
   52.30 +      }
   52.31 +      else
   52.32 +      {
   52.33 +        throw DataFormatError("Bad format");
   52.34 +      }
   52.35 +    }
   52.36 +  }
   52.37 +};
    53.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.2 +++ b/io_helper.h	Mon Jul 07 08:10:39 2008 -0500
    53.3 @@ -0,0 +1,11 @@
    53.4 +#ifndef IO_HELPER
    53.5 +#define IO_HELPER
    53.6 +
    53.7 +#include "xml.h"
    53.8 +#include "map_value.h"
    53.9 +
   53.10 +namespace lemon {
   53.11 +  void xml(XmlIo &x, MapValue::Type& v);
   53.12 +};
   53.13 +
   53.14 +#endif
    54.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.2 +++ b/kruskalbox.cc	Mon Jul 07 08:10:39 2008 -0500
    54.3 @@ -0,0 +1,83 @@
    54.4 +/* -*- C++ -*-
    54.5 + *
    54.6 + * This file is a part of LEMON, a generic C++ optimization library
    54.7 + *
    54.8 + * Copyright (C) 2003-2006
    54.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
   54.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
   54.11 + *
   54.12 + * Permission to use, modify and distribute this software is granted
   54.13 + * provided that this copyright notice appears in all copies. For
   54.14 + * precise terms see the accompanying LICENSE file.
   54.15 + *
   54.16 + * This software is provided "AS IS" with no warranty of any kind,
   54.17 + * express or implied, and with no claim as to its suitability for any
   54.18 + * purpose.
   54.19 + *
   54.20 + */
   54.21 +
   54.22 +#include <lemon/kruskal.h>
   54.23 +
   54.24 +#include <mapstorage.h>
   54.25 +#include <mapselector.h>
   54.26 +#include <algobox.h>
   54.27 +#include <kruskalbox.h>
   54.28 +
   54.29 +enum {INPUT, OUTPUT, MAP_NUM};
   54.30 +
   54.31 +KruskalBox::KruskalBox(std::vector<std::string> t):AlgoBox()
   54.32 +{
   54.33 +  init(t);
   54.34 +}
   54.35 +    
   54.36 +void KruskalBox::run()
   54.37 +{
   54.38 +  if(
   54.39 +      tabcbt.get_active_text()!="" &&
   54.40 +      (arcmapcbts[INPUT])->get_active_text()!="" &&
   54.41 +      (arcmapcbts[OUTPUT])->get_active_text()!=""
   54.42 +    )
   54.43 +  {
   54.44 +
   54.45 +    const Digraph &g=mapstorage->getDigraph();
   54.46 +    std::string input_map_name = arcmapcbts[INPUT]->get_active_text();
   54.47 +    Digraph::ArcMap<bool> outputmap(g);
   54.48 +    const MapStorage::NumericArcMap& inputmap=
   54.49 +      mapstorage->getNumericArcMap(input_map_name);
   54.50 +    double res=kruskal(g, inputmap, outputmap);
   54.51 +
   54.52 +    for (ArcIt i(g); i!=INVALID; ++i)
   54.53 +    {
   54.54 +      if(outputmap[i])
   54.55 +      {
   54.56 +        mapstorage->set(arcmapcbts[OUTPUT]->get_active_text(), i, 1.0);
   54.57 +      }
   54.58 +      else
   54.59 +      {
   54.60 +        mapstorage->set(arcmapcbts[OUTPUT]->get_active_text(), i, 0.0);
   54.61 +      }
   54.62 +    }
   54.63 +
   54.64 +    std::ostringstream o;
   54.65 +    o << "Result: " << res;
   54.66 +    resultlabel.set_text(o.str());
   54.67 +
   54.68 +    mapstorage->mapChanged(true, (arcmapcbts[OUTPUT])->get_active_text());
   54.69 +    //   mapstorage->changeActiveMap(true, E_COLOR,
   54.70 +    // 			      (arcmapcbts[OUTPUT])->get_active_text());
   54.71 +    //   mapstorage->changeActiveMap(true, E_TEXT,
   54.72 +    // 			      (arcmapcbts[INPUT])->get_active_text());
   54.73 +
   54.74 +  }
   54.75 +}
   54.76 +    
   54.77 +void KruskalBox::build_box()
   54.78 +{
   54.79 +  std::vector<std::string> empty_vector;
   54.80 +
   54.81 +  addMapSelector("Arccosts: ", true, NUM);
   54.82 +  addMapSelector("Arcs of tree here: ", true, NUM);
   54.83 +
   54.84 +  resultlabel.set_text("Result: algorithm is not run yet.");
   54.85 +  pack_start(resultlabel);
   54.86 +}
    55.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.2 +++ b/kruskalbox.h	Mon Jul 07 08:10:39 2008 -0500
    55.3 @@ -0,0 +1,58 @@
    55.4 +/* -*- C++ -*-
    55.5 + *
    55.6 + * This file is a part of LEMON, a generic C++ optimization library
    55.7 + *
    55.8 + * Copyright (C) 2003-2006
    55.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
   55.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
   55.11 + *
   55.12 + * Permission to use, modify and distribute this software is granted
   55.13 + * provided that this copyright notice appears in all copies. For
   55.14 + * precise terms see the accompanying LICENSE file.
   55.15 + *
   55.16 + * This software is provided "AS IS" with no warranty of any kind,
   55.17 + * express or implied, and with no claim as to its suitability for any
   55.18 + * purpose.
   55.19 + *
   55.20 + */
   55.21 +
   55.22 +#ifndef KRUSKALBOX_H
   55.23 +#define KRUSKALBOX_H
   55.24 +
   55.25 +class AlgoBox;
   55.26 +
   55.27 +#include <all_include.h>
   55.28 +#include <libgnomecanvasmm.h>
   55.29 +#include <libgnomecanvasmm/polygon.h>
   55.30 +
   55.31 +///Digraphical interface to run Kruskal algorithm.
   55.32 +
   55.33 +///Child of \ref AlgoBox,
   55.34 +///therefore the only task to do at implementation was to
   55.35 +///
   55.36 +///-call init function with correct parameters from correctly parametrized constructor
   55.37 +///
   55.38 +///-implement \ref build_box function
   55.39 +///
   55.40 +///-implement \ref run function
   55.41 +class KruskalBox : public AlgoBox
   55.42 +{
   55.43 +  ///Shows result of Kruskal algorithm
   55.44 +  Gtk::Label resultlabel;
   55.45 +
   55.46 +public:
   55.47 +  ///Calls \ref AlgoBox::init function to initialize class properly, automatically.
   55.48 +  KruskalBox(std::vector<std::string> t);
   55.49 +
   55.50 +  ///Prepare, run and postprocess Kruskal algorithm.
   55.51 +
   55.52 +  ///\ref glemon works only with maps filled with double values
   55.53 +  ///at the moment. While Kruskal nedds a bool map as output.
   55.54 +  ///As postprocess this bool map should be transformed to
   55.55 +  ///double map.
   55.56 +  void run();
   55.57 +
   55.58 +  ///Builds the digraphical design of the interface.
   55.59 +  void build_box();
   55.60 +};
   55.61 +#endif //KRUSKALBOX_H
    56.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    56.2 +++ b/m4/Makefile.am	Mon Jul 07 08:10:39 2008 -0500
    56.3 @@ -0,0 +1,30 @@
    56.4 +EXTRA_DIST = \
    56.5 +	codeset.m4 \
    56.6 +	gettext.m4 \
    56.7 +	glibc21.m4 \
    56.8 +	glibc2.m4 \
    56.9 +	iconv.m4 \
   56.10 +	intdiv0.m4 \
   56.11 +	intmax.m4 \
   56.12 +	inttypes_h.m4 \
   56.13 +	inttypes.m4 \
   56.14 +	inttypes-pri.m4 \
   56.15 +	isc-posix.m4 \
   56.16 +	lcmessage.m4 \
   56.17 +	lib-ld.m4 \
   56.18 +	lib-link.m4 \
   56.19 +	lib-prefix.m4 \
   56.20 +	longdouble.m4 \
   56.21 +	longlong.m4 \
   56.22 +	nls.m4 \
   56.23 +	po.m4 \
   56.24 +	printf-posix.m4 \
   56.25 +	progtest.m4 \
   56.26 +	signed.m4 \
   56.27 +	size_max.m4 \
   56.28 +	stdint_h.m4 \
   56.29 +	uintmax_t.m4 \
   56.30 +	ulonglong.m4 \
   56.31 +	wchar_t.m4 \
   56.32 +	wint_t.m4 \
   56.33 +	xsize.m4
    57.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    57.2 +++ b/main_win.cc	Mon Jul 07 08:10:39 2008 -0500
    57.3 @@ -0,0 +1,657 @@
    57.4 +/* -*- C++ -*-
    57.5 + *
    57.6 + * This file is a part of LEMON, a generic C++ optimization library
    57.7 + *
    57.8 + * Copyright (C) 2003-2006
    57.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
   57.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
   57.11 + *
   57.12 + * Permission to use, modify and distribute this software is granted
   57.13 + * provided that this copyright notice appears in all copies. For
   57.14 + * precise terms see the accompanying LICENSE file.
   57.15 + *
   57.16 + * This software is provided "AS IS" with no warranty of any kind,
   57.17 + * express or implied, and with no claim as to its suitability for any
   57.18 + * purpose.
   57.19 + *
   57.20 + */
   57.21 +
   57.22 +#ifdef HAVE_CONFIG_H
   57.23 +#include <config.h>
   57.24 +#endif
   57.25 +
   57.26 +#include "main_win.h"
   57.27 +#include "guipixbufs.h"
   57.28 +#include "save_details_dialog.h"
   57.29 +#include "background_chooser_dialog.h"
   57.30 +
   57.31 +#include <mapstorage.h>
   57.32 +#include <graph_displayer_canvas.h>
   57.33 +#include <algowin.h>
   57.34 +#include <new_map_win.h>
   57.35 +#include <nbtab.h>
   57.36 +
   57.37 +#include "i18n.h"
   57.38 +
   57.39 +MainWin::MainWin()
   57.40 +{
   57.41 +  set_title ("no file");
   57.42 +  set_default_size(WIN_WIDTH,WIN_HEIGHT);
   57.43 +  //add(vbox);
   57.44 +  add(table);
   57.45 +
   57.46 +  // custom icons for the toolbar
   57.47 +  Glib::RefPtr<Gtk::IconFactory> p_icon_factory = Gtk::IconFactory::create();
   57.48 + 
   57.49 +  Glib::RefPtr<Gdk::Pixbuf> p_move_pixbuf = Gdk::Pixbuf::create_from_inline(
   57.50 +      2328, gui_icons_move);
   57.51 +  Glib::RefPtr<Gdk::Pixbuf> p_addnode_pixbuf = Gdk::Pixbuf::create_from_inline(
   57.52 +      2328, gui_icons_addnode);
   57.53 +  Glib::RefPtr<Gdk::Pixbuf> p_addlink_pixbuf = Gdk::Pixbuf::create_from_inline(
   57.54 +      2328, gui_icons_addlink);
   57.55 +  Glib::RefPtr<Gdk::Pixbuf> p_delete_pixbuf = Gdk::Pixbuf::create_from_inline(
   57.56 +      2328, gui_icons_delete);
   57.57 +  Glib::RefPtr<Gdk::Pixbuf> p_editlink_pixbuf = Gdk::Pixbuf::create_from_inline(
   57.58 +      2328, gui_icons_editlink);
   57.59 +  Glib::RefPtr<Gdk::Pixbuf> p_newmap_pixbuf = Gdk::Pixbuf::create_from_inline(
   57.60 +      2328, gui_icons_newmap);
   57.61 +  Glib::RefPtr<Gdk::Pixbuf> p_eps_pixbuf = Gdk::Pixbuf::create_from_inline(
   57.62 +      2328, gui_icons_eps);
   57.63 +
   57.64 +  Gtk::IconSource move_icon_source;
   57.65 +  move_icon_source.set_pixbuf(p_move_pixbuf);
   57.66 +  Gtk::IconSet move_icon_set;
   57.67 +  move_icon_set.add_source(move_icon_source);
   57.68 +  p_icon_factory->add(Gtk::StockID("gd-move"), move_icon_set);
   57.69 +
   57.70 +  Gtk::IconSource addnode_icon_source;
   57.71 +  addnode_icon_source.set_pixbuf(p_addnode_pixbuf);
   57.72 +  Gtk::IconSet addnode_icon_set;
   57.73 +  addnode_icon_set.add_source(addnode_icon_source);
   57.74 +  p_icon_factory->add(Gtk::StockID("gd-addnode"), addnode_icon_set);
   57.75 +
   57.76 +  Gtk::IconSource addlink_icon_source;
   57.77 +  addlink_icon_source.set_pixbuf(p_addlink_pixbuf);
   57.78 +  Gtk::IconSet addlink_icon_set;
   57.79 +  addlink_icon_set.add_source(addlink_icon_source);
   57.80 +  p_icon_factory->add(Gtk::StockID("gd-addlink"), addlink_icon_set);
   57.81 +
   57.82 +  Gtk::IconSource delete_icon_source;
   57.83 +  delete_icon_source.set_pixbuf(p_delete_pixbuf);
   57.84 +  Gtk::IconSet delete_icon_set;
   57.85 +  delete_icon_set.add_source(delete_icon_source);
   57.86 +  p_icon_factory->add(Gtk::StockID("gd-delete"), delete_icon_set);
   57.87 +
   57.88 +  Gtk::IconSource editlink_icon_source;
   57.89 +  editlink_icon_source.set_pixbuf(p_editlink_pixbuf);
   57.90 +  Gtk::IconSet editlink_icon_set;
   57.91 +  editlink_icon_set.add_source(editlink_icon_source);
   57.92 +  p_icon_factory->add(Gtk::StockID("gd-editlink"), editlink_icon_set);
   57.93 +
   57.94 +  Gtk::IconSource newmap_icon_source;
   57.95 +  newmap_icon_source.set_pixbuf(p_newmap_pixbuf);
   57.96 +  Gtk::IconSet newmap_icon_set;
   57.97 +  newmap_icon_set.add_source(newmap_icon_source);
   57.98 +  p_icon_factory->add(Gtk::StockID("gd-newmap"), newmap_icon_set);
   57.99 +
  57.100 +  Gtk::IconSource eps_icon_source;
  57.101 +  eps_icon_source.set_pixbuf(p_eps_pixbuf);
  57.102 +  Gtk::IconSet eps_icon_set;
  57.103 +  eps_icon_set.add_source(eps_icon_source);
  57.104 +  p_icon_factory->add(Gtk::StockID("gd-eps"), eps_icon_set);
  57.105 +
  57.106 +  p_icon_factory->add_default();
  57.107 +  
  57.108 +  ag=Gtk::ActionGroup::create();
  57.109 +
  57.110 +  ag->add( Gtk::Action::create("FileMenu", _("_File")) );
  57.111 +  ag->add( Gtk::Action::create("FileNew", Gtk::Stock::NEW),
  57.112 +      sigc::mem_fun(*this, &MainWin::newTab));
  57.113 +  ag->add( Gtk::Action::create("FileOpen", Gtk::Stock::OPEN),
  57.114 +      sigc::mem_fun(*this, &MainWin::openFile));
  57.115 +  ag->add( Gtk::Action::create("FileClearTab", _("Clear Tab")),
  57.116 +      sigc::mem_fun(*this, &MainWin::newFile));
  57.117 +  ag->add( Gtk::Action::create("FileSave", Gtk::Stock::SAVE),
  57.118 +      sigc::mem_fun(*this, &MainWin::saveFile));
  57.119 +  ag->add( Gtk::Action::create("FileSaveAs", Gtk::Stock::SAVE_AS),
  57.120 +      sigc::mem_fun(*this, &MainWin::saveFileAs));
  57.121 +  ag->add( Gtk::Action::create("SaveDetails", _("Save _Details...")),
  57.122 +	   sigc::mem_fun(*this, &MainWin::createSaveDetailsDialog));
  57.123 +  ag->add( Gtk::Action::create("Close", Gtk::Stock::CLOSE),
  57.124 +      sigc::mem_fun(*this, &MainWin::closeTab));
  57.125 +  ag->add( Gtk::Action::create("Quit", Gtk::Stock::QUIT),
  57.126 +      sigc::mem_fun(*this, &MainWin::hide));
  57.127 +
  57.128 +  ag->add( Gtk::Action::create("ViewMenu", _("_View")) );
  57.129 +  ag->add( Gtk::Action::create("ViewZoomIn", Gtk::Stock::ZOOM_IN),
  57.130 +      sigc::mem_fun(*this, &MainWin::zoomIn));
  57.131 +  ag->add( Gtk::Action::create("ViewZoomOut", Gtk::Stock::ZOOM_OUT),
  57.132 +      sigc::mem_fun(*this, &MainWin::zoomOut));
  57.133 +  ag->add( Gtk::Action::create("ViewZoomFit", Gtk::Stock::ZOOM_FIT),
  57.134 +      sigc::mem_fun(*this, &MainWin::zoomFit));
  57.135 +  ag->add( Gtk::Action::create("ViewZoom100", Gtk::Stock::ZOOM_100),
  57.136 +      sigc::mem_fun(*this, &MainWin::zoom100));
  57.137 +  ag->add( Gtk::Action::create("SetBackground", _("Set Background...")),
  57.138 +	    sigc::mem_fun(*this, &MainWin::createBackgroundChooser));
  57.139 +  
  57.140 +  ag->add( Gtk::Action::create("ShowMenu", _("_Show")) );
  57.141 +  ag->add( Gtk::Action::create("ShowMaps", _("_Maps")),
  57.142 +	   sigc::mem_fun(*this, &MainWin::createMapWin));
  57.143 +  ag->add( Gtk::Action::create("ShowDesign", _("_Design")),
  57.144 +	   sigc::mem_fun(*this, &MainWin::createDesignWin));
  57.145 +
  57.146 +  ag->add( Gtk::Action::create("AlgoMenu", _("_Algorithms")) );
  57.147 +  ag->add( Gtk::Action::create("AlgoGeneral", _("_General")),
  57.148 +	   sigc::bind( sigc::mem_fun ( *this, &MainWin::createAlgoWin ), 0) );
  57.149 +  ag->add( Gtk::Action::create("AlgoKruskal", _("_Kruskal")),
  57.150 +	   sigc::bind( sigc::mem_fun ( *this, &MainWin::createAlgoWin ), 1) );
  57.151 +  ag->add( Gtk::Action::create("AlgoDijkstra", _("_Dijkstra")),
  57.152 +	   sigc::bind( sigc::mem_fun ( *this, &MainWin::createAlgoWin ), 2) );
  57.153 +  ag->add( Gtk::Action::create("AlgoSuurballe", _("_Suurballe")),
  57.154 +	   sigc::bind( sigc::mem_fun ( *this, &MainWin::createAlgoWin ), 3) );
  57.155 +
  57.156 +  Gtk::RadioAction::Group tool_group;
  57.157 +  ag->add( Gtk::RadioAction::create(tool_group, "MoveItem", Gtk::StockID("gd-move"), _("Move")),
  57.158 +      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 0) );
  57.159 +  ag->add( Gtk::RadioAction::create(tool_group, "CreateNode", Gtk::StockID("gd-addnode"), _("Create node")),
  57.160 +      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 1) );
  57.161 +  ag->add( Gtk::RadioAction::create(tool_group, "CreateArc", Gtk::StockID("gd-addlink"), _("Create arc")),
  57.162 +      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 2) );
  57.163 +  ag->add( Gtk::RadioAction::create(tool_group, "EraseItem", Gtk::StockID("gd-delete"), _("Delete")),
  57.164 +      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 3) );
  57.165 +
  57.166 +  ag->add( Gtk::RadioAction::create(tool_group, "EditArcMap", Gtk::StockID("gd-editlink"), _("Edit arc map")),
  57.167 +      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 4) );
  57.168 +
  57.169 +  ag->add( Gtk::Action::create("AddMap", Gtk::StockID("gd-newmap"), "New map"),
  57.170 +      sigc::mem_fun ( *this , &MainWin::createNewMapWin ) );
  57.171 +
  57.172 +  ag->add( Gtk::Action::create("DesignDigraph", Gtk::Stock::REFRESH),
  57.173 +      sigc::mem_fun ( *this , &MainWin::reDesignDigraph ) );
  57.174 +
  57.175 +  ag->add( Gtk::Action::create("Eps", Gtk::StockID("gd-eps"), "Export to EPS"),
  57.176 +      sigc::mem_fun ( *this , &MainWin::exportToEPS ) );
  57.177 +
  57.178 +  uim=Gtk::UIManager::create();
  57.179 +  uim->insert_action_group(ag);
  57.180 +  add_accel_group(uim->get_accel_group());
  57.181 +
  57.182 +  try
  57.183 +  {
  57.184 +
  57.185 +    Glib::ustring ui_info =
  57.186 +      "<ui>"
  57.187 +      "  <menubar name='MenuBar'>"
  57.188 +      "    <menu action='FileMenu'>"
  57.189 +      "      <menuitem action='FileNew'/>"
  57.190 +      "      <menuitem action='FileOpen'/>"
  57.191 +      "      <menuitem action='FileClearTab'/>"
  57.192 +      "      <menuitem action='FileSave'/>"
  57.193 +      "      <menuitem action='FileSaveAs'/>"
  57.194 +      "      <menuitem action='SaveDetails'/>"
  57.195 +      "      <menuitem action='Close'/>"
  57.196 +      "      <menuitem action='Quit'/>"
  57.197 +      "    </menu>"
  57.198 +      "    <menu action='ViewMenu'>"
  57.199 +      "      <menuitem action='ViewZoomIn' />"
  57.200 +      "      <menuitem action='ViewZoomOut' />"
  57.201 +      "      <menuitem action='ViewZoom100' />"
  57.202 +      "      <menuitem action='ViewZoomFit' />"
  57.203 +      "      <menuitem action='SetBackground' />"
  57.204 +      "    </menu>"
  57.205 +      "    <menu action='ShowMenu'>"
  57.206 +      "      <menuitem action='ShowMaps'/>"
  57.207 +      "      <menuitem action='ShowDesign'/>"
  57.208 +      "    </menu>"
  57.209 +      "    <menu action='AlgoMenu'>"
  57.210 +      "      <menuitem action='AlgoGeneral'/>"
  57.211 +      "      <menuitem action='AlgoKruskal'/>"
  57.212 +      "      <menuitem action='AlgoDijkstra'/>"
  57.213 +      "      <menuitem action='AlgoSuurballe'/>"
  57.214 +      "    </menu>"
  57.215 +      "  </menubar>"
  57.216 +      "  <toolbar name='ToolBar'>"
  57.217 +      "    <toolitem action='FileNew' />"
  57.218 +      "    <toolitem action='FileOpen' />"
  57.219 +      "    <toolitem action='FileSave' />"
  57.220 +      "    <toolitem action='Close' />"
  57.221 +      "    <separator />"
  57.222 +      "    <toolitem action='ViewZoomIn' />"
  57.223 +      "    <toolitem action='ViewZoomOut' />"
  57.224 +      "    <toolitem action='ViewZoom100' />"
  57.225 +      "    <toolitem action='ViewZoomFit' />"
  57.226 +      "    <separator />"