Moved the gui to glemon/trunk.
authorladanyi
Wed, 21 Jun 2006 08:39:28 +0000
changeset 21048e27998e9b1d
parent 2103 a979fcdda073
child 2105 6e687c525503
Moved the gui to glemon/trunk.
gui/Doxyfile
gui/Makefile.am
gui/algobox.cc
gui/algobox.h
gui/algowin.cc
gui/algowin.h
gui/all_include.h
gui/gdc-broken_edge.cc
gui/gettext.h
gui/graph-displayer.cc
gui/graph_displayer_canvas-edge.cc
gui/graph_displayer_canvas-event.cc
gui/graph_displayer_canvas-node.cc
gui/graph_displayer_canvas-zoom.cc
gui/graph_displayer_canvas.cc
gui/graph_displayer_canvas.h
gui/graphocska.lgf
gui/gui_reader.cc
gui/gui_reader.h
gui/gui_writer.cc
gui/gui_writer.h
gui/i18n.h
gui/icons/addlink.png
gui/icons/addnode.png
gui/icons/delete.png
gui/icons/editlink.png
gui/icons/editnode.png
gui/icons/move.png
gui/icons/newmap.png
gui/kruskalbox.cc
gui/kruskalbox.h
gui/main_win.cc
gui/main_win.h
gui/map_win.cc
gui/map_win.h
gui/mapselector.cc
gui/mapselector.h
gui/mapstorage.cc
gui/mapstorage.h
gui/nbtab.cc
gui/nbtab.h
gui/new_map_win.cc
gui/new_map_win.h
gui/xml.h
gui/xymap.h
     1.1 --- a/gui/Doxyfile	Wed Jun 21 08:35:23 2006 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,273 +0,0 @@
     1.4 -# Doxyfile 1.4.5
     1.5 -
     1.6 -#---------------------------------------------------------------------------
     1.7 -# Project related configuration options
     1.8 -#---------------------------------------------------------------------------
     1.9 -PROJECT_NAME           = glemon
    1.10 -PROJECT_NUMBER         = 0.1
    1.11 -OUTPUT_DIRECTORY       = 
    1.12 -CREATE_SUBDIRS         = NO
    1.13 -OUTPUT_LANGUAGE        = English
    1.14 -USE_WINDOWS_ENCODING   = NO
    1.15 -BRIEF_MEMBER_DESC      = YES
    1.16 -REPEAT_BRIEF           = YES
    1.17 -ABBREVIATE_BRIEF       = "The $name class" \
    1.18 -                         "The $name widget" \
    1.19 -                         "The $name file" \
    1.20 -                         is \
    1.21 -                         provides \
    1.22 -                         specifies \
    1.23 -                         contains \
    1.24 -                         represents \
    1.25 -                         a \
    1.26 -                         an \
    1.27 -                         the
    1.28 -ALWAYS_DETAILED_SEC    = NO
    1.29 -INLINE_INHERITED_MEMB  = NO
    1.30 -FULL_PATH_NAMES        = YES
    1.31 -STRIP_FROM_PATH        = .
    1.32 -STRIP_FROM_INC_PATH    = 
    1.33 -SHORT_NAMES            = NO
    1.34 -JAVADOC_AUTOBRIEF      = NO
    1.35 -MULTILINE_CPP_IS_BRIEF = NO
    1.36 -DETAILS_AT_TOP         = NO
    1.37 -INHERIT_DOCS           = YES
    1.38 -SEPARATE_MEMBER_PAGES  = NO
    1.39 -TAB_SIZE               = 8
    1.40 -ALIASES                = 
    1.41 -OPTIMIZE_OUTPUT_FOR_C  = NO
    1.42 -OPTIMIZE_OUTPUT_JAVA   = NO
    1.43 -BUILTIN_STL_SUPPORT    = NO
    1.44 -DISTRIBUTE_GROUP_DOC   = NO
    1.45 -SUBGROUPING            = YES
    1.46 -#---------------------------------------------------------------------------
    1.47 -# Build related configuration options
    1.48 -#---------------------------------------------------------------------------
    1.49 -EXTRACT_ALL            = YES
    1.50 -EXTRACT_PRIVATE        = YES
    1.51 -EXTRACT_STATIC         = YES
    1.52 -EXTRACT_LOCAL_CLASSES  = YES
    1.53 -EXTRACT_LOCAL_METHODS  = NO
    1.54 -HIDE_UNDOC_MEMBERS     = NO
    1.55 -HIDE_UNDOC_CLASSES     = NO
    1.56 -HIDE_FRIEND_COMPOUNDS  = NO
    1.57 -HIDE_IN_BODY_DOCS      = NO
    1.58 -INTERNAL_DOCS          = NO
    1.59 -CASE_SENSE_NAMES       = YES
    1.60 -HIDE_SCOPE_NAMES       = NO
    1.61 -SHOW_INCLUDE_FILES     = YES
    1.62 -INLINE_INFO            = YES
    1.63 -SORT_MEMBER_DOCS       = YES
    1.64 -SORT_BRIEF_DOCS        = NO
    1.65 -SORT_BY_SCOPE_NAME     = NO
    1.66 -GENERATE_TODOLIST      = YES
    1.67 -GENERATE_TESTLIST      = YES
    1.68 -GENERATE_BUGLIST       = YES
    1.69 -GENERATE_DEPRECATEDLIST= YES
    1.70 -ENABLED_SECTIONS       = 
    1.71 -MAX_INITIALIZER_LINES  = 30
    1.72 -SHOW_USED_FILES        = YES
    1.73 -SHOW_DIRECTORIES       = YES
    1.74 -FILE_VERSION_FILTER    = 
    1.75 -#---------------------------------------------------------------------------
    1.76 -# configuration options related to warning and progress messages
    1.77 -#---------------------------------------------------------------------------
    1.78 -QUIET                  = NO
    1.79 -WARNINGS               = YES
    1.80 -WARN_IF_UNDOCUMENTED   = YES
    1.81 -WARN_IF_DOC_ERROR      = YES
    1.82 -WARN_NO_PARAMDOC       = NO
    1.83 -WARN_FORMAT            = "$file:$line: $text"
    1.84 -WARN_LOGFILE           = 
    1.85 -#---------------------------------------------------------------------------
    1.86 -# configuration options related to the input files
    1.87 -#---------------------------------------------------------------------------
    1.88 -INPUT                  = .
    1.89 -FILE_PATTERNS          = *.c \
    1.90 -                         *.cc \
    1.91 -                         *.cxx \
    1.92 -                         *.cpp \
    1.93 -                         *.c++ \
    1.94 -                         *.d \
    1.95 -                         *.java \
    1.96 -                         *.ii \
    1.97 -                         *.ixx \
    1.98 -                         *.ipp \
    1.99 -                         *.i++ \
   1.100 -                         *.inl \
   1.101 -                         *.h \
   1.102 -                         *.hh \
   1.103 -                         *.hxx \
   1.104 -                         *.hpp \
   1.105 -                         *.h++ \
   1.106 -                         *.idl \
   1.107 -                         *.odl \
   1.108 -                         *.cs \
   1.109 -                         *.php \
   1.110 -                         *.php3 \
   1.111 -                         *.inc \
   1.112 -                         *.m \
   1.113 -                         *.mm \
   1.114 -                         *.dox \
   1.115 -                         *.py \
   1.116 -                         *.C \
   1.117 -                         *.CC \
   1.118 -                         *.C++ \
   1.119 -                         *.II \
   1.120 -                         *.I++ \
   1.121 -                         *.H \
   1.122 -                         *.HH \
   1.123 -                         *.H++ \
   1.124 -                         *.CS \
   1.125 -                         *.PHP \
   1.126 -                         *.PHP3 \
   1.127 -                         *.M \
   1.128 -                         *.MM \
   1.129 -                         *.PY
   1.130 -RECURSIVE              = NO
   1.131 -EXCLUDE                = 
   1.132 -EXCLUDE_SYMLINKS       = NO
   1.133 -EXCLUDE_PATTERNS       = 
   1.134 -EXAMPLE_PATH           = 
   1.135 -EXAMPLE_PATTERNS       = *
   1.136 -EXAMPLE_RECURSIVE      = NO
   1.137 -IMAGE_PATH             = 
   1.138 -INPUT_FILTER           = 
   1.139 -FILTER_PATTERNS        = 
   1.140 -FILTER_SOURCE_FILES    = NO
   1.141 -#---------------------------------------------------------------------------
   1.142 -# configuration options related to source browsing
   1.143 -#---------------------------------------------------------------------------
   1.144 -SOURCE_BROWSER         = YES
   1.145 -INLINE_SOURCES         = NO
   1.146 -STRIP_CODE_COMMENTS    = YES
   1.147 -REFERENCED_BY_RELATION = YES
   1.148 -REFERENCES_RELATION    = YES
   1.149 -USE_HTAGS              = NO
   1.150 -VERBATIM_HEADERS       = YES
   1.151 -#---------------------------------------------------------------------------
   1.152 -# configuration options related to the alphabetical class index
   1.153 -#---------------------------------------------------------------------------
   1.154 -ALPHABETICAL_INDEX     = NO
   1.155 -COLS_IN_ALPHA_INDEX    = 5
   1.156 -IGNORE_PREFIX          = 
   1.157 -#---------------------------------------------------------------------------
   1.158 -# configuration options related to the HTML output
   1.159 -#---------------------------------------------------------------------------
   1.160 -GENERATE_HTML          = YES
   1.161 -HTML_OUTPUT            = html
   1.162 -HTML_FILE_EXTENSION    = .html
   1.163 -HTML_HEADER            = 
   1.164 -HTML_FOOTER            = 
   1.165 -HTML_STYLESHEET        = 
   1.166 -HTML_ALIGN_MEMBERS     = YES
   1.167 -GENERATE_HTMLHELP      = NO
   1.168 -CHM_FILE               = 
   1.169 -HHC_LOCATION           = 
   1.170 -GENERATE_CHI           = NO
   1.171 -BINARY_TOC             = NO
   1.172 -TOC_EXPAND             = NO
   1.173 -DISABLE_INDEX          = NO
   1.174 -ENUM_VALUES_PER_LINE   = 4
   1.175 -GENERATE_TREEVIEW      = NO
   1.176 -TREEVIEW_WIDTH         = 250
   1.177 -#---------------------------------------------------------------------------
   1.178 -# configuration options related to the LaTeX output
   1.179 -#---------------------------------------------------------------------------
   1.180 -GENERATE_LATEX         = NO
   1.181 -LATEX_OUTPUT           = latex
   1.182 -LATEX_CMD_NAME         = latex
   1.183 -MAKEINDEX_CMD_NAME     = makeindex
   1.184 -COMPACT_LATEX          = NO
   1.185 -PAPER_TYPE             = a4wide
   1.186 -EXTRA_PACKAGES         = 
   1.187 -LATEX_HEADER           = 
   1.188 -PDF_HYPERLINKS         = NO
   1.189 -USE_PDFLATEX           = NO
   1.190 -LATEX_BATCHMODE        = NO
   1.191 -LATEX_HIDE_INDICES     = NO
   1.192 -#---------------------------------------------------------------------------
   1.193 -# configuration options related to the RTF output
   1.194 -#---------------------------------------------------------------------------
   1.195 -GENERATE_RTF           = NO
   1.196 -RTF_OUTPUT             = rtf
   1.197 -COMPACT_RTF            = NO
   1.198 -RTF_HYPERLINKS         = NO
   1.199 -RTF_STYLESHEET_FILE    = 
   1.200 -RTF_EXTENSIONS_FILE    = 
   1.201 -#---------------------------------------------------------------------------
   1.202 -# configuration options related to the man page output
   1.203 -#---------------------------------------------------------------------------
   1.204 -GENERATE_MAN           = NO
   1.205 -MAN_OUTPUT             = man
   1.206 -MAN_EXTENSION          = .3
   1.207 -MAN_LINKS              = NO
   1.208 -#---------------------------------------------------------------------------
   1.209 -# configuration options related to the XML output
   1.210 -#---------------------------------------------------------------------------
   1.211 -GENERATE_XML           = NO
   1.212 -XML_OUTPUT             = xml
   1.213 -XML_SCHEMA             = 
   1.214 -XML_DTD                = 
   1.215 -XML_PROGRAMLISTING     = YES
   1.216 -#---------------------------------------------------------------------------
   1.217 -# configuration options for the AutoGen Definitions output
   1.218 -#---------------------------------------------------------------------------
   1.219 -GENERATE_AUTOGEN_DEF   = NO
   1.220 -#---------------------------------------------------------------------------
   1.221 -# configuration options related to the Perl module output
   1.222 -#---------------------------------------------------------------------------
   1.223 -GENERATE_PERLMOD       = NO
   1.224 -PERLMOD_LATEX          = NO
   1.225 -PERLMOD_PRETTY         = YES
   1.226 -PERLMOD_MAKEVAR_PREFIX = 
   1.227 -#---------------------------------------------------------------------------
   1.228 -# Configuration options related to the preprocessor   
   1.229 -#---------------------------------------------------------------------------
   1.230 -ENABLE_PREPROCESSING   = YES
   1.231 -MACRO_EXPANSION        = NO
   1.232 -EXPAND_ONLY_PREDEF     = NO
   1.233 -SEARCH_INCLUDES        = YES
   1.234 -INCLUDE_PATH           = 
   1.235 -INCLUDE_FILE_PATTERNS  = 
   1.236 -PREDEFINED             = 
   1.237 -EXPAND_AS_DEFINED      = 
   1.238 -SKIP_FUNCTION_MACROS   = YES
   1.239 -#---------------------------------------------------------------------------
   1.240 -# Configuration::additions related to external references   
   1.241 -#---------------------------------------------------------------------------
   1.242 -TAGFILES               = 
   1.243 -GENERATE_TAGFILE       = 
   1.244 -ALLEXTERNALS           = NO
   1.245 -EXTERNAL_GROUPS        = YES
   1.246 -PERL_PATH              = /usr/bin/perl
   1.247 -#---------------------------------------------------------------------------
   1.248 -# Configuration options related to the dot tool   
   1.249 -#---------------------------------------------------------------------------
   1.250 -CLASS_DIAGRAMS         = NO
   1.251 -HIDE_UNDOC_RELATIONS   = YES
   1.252 -HAVE_DOT               = YES
   1.253 -CLASS_GRAPH            = YES
   1.254 -COLLABORATION_GRAPH    = YES
   1.255 -GROUP_GRAPHS           = YES
   1.256 -UML_LOOK               = NO
   1.257 -TEMPLATE_RELATIONS     = NO
   1.258 -INCLUDE_GRAPH          = YES
   1.259 -INCLUDED_BY_GRAPH      = YES
   1.260 -CALL_GRAPH             = YES
   1.261 -GRAPHICAL_HIERARCHY    = YES
   1.262 -DIRECTORY_GRAPH        = YES
   1.263 -DOT_IMAGE_FORMAT       = png
   1.264 -DOT_PATH               = 
   1.265 -DOTFILE_DIRS           = 
   1.266 -MAX_DOT_GRAPH_WIDTH    = 1024
   1.267 -MAX_DOT_GRAPH_HEIGHT   = 1024
   1.268 -MAX_DOT_GRAPH_DEPTH    = 1000
   1.269 -DOT_TRANSPARENT        = NO
   1.270 -DOT_MULTI_TARGETS      = NO
   1.271 -GENERATE_LEGEND        = YES
   1.272 -DOT_CLEANUP            = YES
   1.273 -#---------------------------------------------------------------------------
   1.274 -# Configuration::additions related to the search engine   
   1.275 -#---------------------------------------------------------------------------
   1.276 -SEARCHENGINE           = NO
     2.1 --- a/gui/Makefile.am	Wed Jun 21 08:35:23 2006 +0000
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,73 +0,0 @@
     2.4 -AM_CPPFLAGS = -I$(top_srcdir) -DLOCALEDIR=\""$(datadir)/locale"\"
     2.5 -LDADD = $(top_builddir)/lemon/libemon.la
     2.6 -
     2.7 -bin_PROGRAMS = glemon
     2.8 -BUILT_SOURCES = guipixbufs.h
     2.9 -CLEANFILES = guipixbufs.h
    2.10 -
    2.11 -glemon_SOURCES = \
    2.12 -	all_include.h \
    2.13 -	algobox.cc \
    2.14 -	algobox.h \
    2.15 -	algowin.cc \
    2.16 -	algowin.h \
    2.17 -	gdc-broken_edge.cc \
    2.18 -	graph_displayer_canvas.cc \
    2.19 -	graph_displayer_canvas.h \
    2.20 -	graph_displayer_canvas-edge.cc \
    2.21 -	graph_displayer_canvas-event.cc \
    2.22 -	graph_displayer_canvas-node.cc \
    2.23 -	graph_displayer_canvas-zoom.cc \
    2.24 -	graph-displayer.cc \
    2.25 -	kruskalbox.cc \
    2.26 -	kruskalbox.h \
    2.27 -	main_win.cc \
    2.28 -	main_win.h \
    2.29 -	mapstorage.cc \
    2.30 -	mapstorage.h \
    2.31 -	map_win.cc \
    2.32 -	map_win.h \
    2.33 -	mapselector.cc \
    2.34 -	mapselector.h \
    2.35 -	nbtab.h \
    2.36 -	nbtab.cc \
    2.37 -	new_map_win.cc \
    2.38 -	new_map_win.h \
    2.39 -	xymap.h \
    2.40 -	gui_reader.h \
    2.41 -	gui_reader.cc \
    2.42 -	gui_writer.h \
    2.43 -	gui_writer.cc \
    2.44 -	xml.h \
    2.45 -	guipixbufs.h \
    2.46 -	i18n.h \
    2.47 -	gettext.h
    2.48 -
    2.49 -glemon_CXXFLAGS = $(GTK_CFLAGS)
    2.50 -glemon_LDFLAGS = $(GTK_LIBS)
    2.51 -glemon_LDADD = $(LIBINTL)
    2.52 -
    2.53 -IMAGES = \
    2.54 -	icons/addlink.png \
    2.55 -	icons/addnode.png \
    2.56 -	icons/delete.png \
    2.57 -	icons/editlink.png \
    2.58 -	icons/editnode.png \
    2.59 -	icons/move.png \
    2.60 -	icons/newmap.png
    2.61 -
    2.62 -VARIABLES = \
    2.63 -	gui_icons_addlink $(srcdir)/icons/addlink.png \
    2.64 -	gui_icons_addnode $(srcdir)/icons/addnode.png \
    2.65 -	gui_icons_delete $(srcdir)/icons/delete.png \
    2.66 -	gui_icons_editlink $(srcdir)/icons/editlink.png \
    2.67 -	gui_icons_editnode $(srcdir)/icons/editnode.png \
    2.68 -	gui_icons_move $(srcdir)/icons/move.png \
    2.69 -	gui_icons_newmap $(srcdir)/icons/newmap.png
    2.70 -
    2.71 -guipixbufs.h: $(IMAGES)
    2.72 -	gdk-pixbuf-csource \
    2.73 -	--raw --build-list $(VARIABLES) > guipixbufs.h ||  \
    2.74 -	( rm -f guipixbufs.h && false )
    2.75 -
    2.76 -EXTRA_DIST = $(IMAGES) guipixbufs.h
     3.1 --- a/gui/algobox.cc	Wed Jun 21 08:35:23 2006 +0000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,186 +0,0 @@
     3.4 -#include <algobox.h>
     3.5 -
     3.6 -enum {N_DEMO1, N_DEMO2, NODE_INPUT_NUM}; // input IDs for nodes;
     3.7 -enum {E_DEMO1, EDGE_INPUT_NUM}; // input IDs for edges;
     3.8 -
     3.9 -AlgoBox::AlgoBox(std::vector<std::string> tabnames)
    3.10 -{
    3.11 -  init(tabnames);
    3.12 -}
    3.13 -
    3.14 -void AlgoBox::init(std::vector<std::string> tabnames)
    3.15 -{
    3.16 -  set_spacing(5);
    3.17 -
    3.18 -  update_tablist(tabnames);
    3.19 -
    3.20 -  //if active tab is changed, the map names in cbt/s have to be updated
    3.21 -  tabcbt.signal_changed().connect(sigc::mem_fun(*this, &AlgoBox::emit_tab_change));
    3.22 -
    3.23 -  pack_start(tabcbt);
    3.24 -  build_box();
    3.25 -
    3.26 -  show_all_children();
    3.27 -};
    3.28 -
    3.29 -void AlgoBox::update_cbt(std::vector< std::string > stringlist, Gtk::ComboBoxText & cbt)
    3.30 -{
    3.31 -  std::string actname=cbt.get_active_text();
    3.32 -  int prev_act=-1;
    3.33 -
    3.34 -  cbt.clear();
    3.35 -  int actptr=0;
    3.36 -
    3.37 -  std::vector< std::string >::iterator emsi=stringlist.begin();
    3.38 -  for(;emsi!=stringlist.end();emsi++)
    3.39 -    {
    3.40 -      if(actname==*emsi)
    3.41 -	{
    3.42 -	  prev_act=actptr;
    3.43 -	}
    3.44 -
    3.45 -      cbt.append_text(*emsi);
    3.46 -      actptr++;
    3.47 -    }
    3.48 -
    3.49 -  if(prev_act!=-1)
    3.50 -    {
    3.51 -      cbt.set_active(prev_act);
    3.52 -    }
    3.53 -  else if(actptr>0) //so there is item in the list
    3.54 -    {
    3.55 -      //cbt.set_active(0);
    3.56 -    }
    3.57 -}
    3.58 -
    3.59 -void AlgoBox::update_tablist( std::vector< std::string > tl )
    3.60 -{
    3.61 -  update_cbt(tl, tabcbt);
    3.62 -  emit_tab_change();
    3.63 -}
    3.64 -
    3.65 -void AlgoBox::update_maplist(MapStorage * ms)
    3.66 -{
    3.67 -  mapstorage=ms;
    3.68 -  std::vector<std::string> nml;
    3.69 -  std::vector<std::string> eml;
    3.70 -  if(mapstorage!=NULL)
    3.71 -    {
    3.72 -      mapstorage->signal_node_map_ch().connect(sigc::mem_fun(*this, &AlgoBox::nodemaplist_changed));
    3.73 -      mapstorage->signal_edge_map_ch().connect(sigc::mem_fun(*this, &AlgoBox::edgemaplist_changed));
    3.74 -      nml=mapstorage->getNodeMapList();
    3.75 -      eml=mapstorage->getEdgeMapList();
    3.76 -    }
    3.77 -  for(int i=0;i<(int)nodemapcbts.size();i++)
    3.78 -    {
    3.79 -      (nodemapcbts[i])->update_list(nml);
    3.80 -      //update_cbt(nml, *(nodemapcbts[i]));
    3.81 -    }
    3.82 -  for(int i=0;i<(int)edgemapcbts.size();i++)
    3.83 -    {
    3.84 -      (edgemapcbts[i])->update_list(eml);
    3.85 -      //update_cbt(eml, *(edgemapcbts[i]));
    3.86 -    }
    3.87 -}
    3.88 -
    3.89 -void AlgoBox::nodemaplist_changed(std::string newmap)
    3.90 -{
    3.91 -  for(int i=0;i<(int)nodemapcbts.size();i++)
    3.92 -    {
    3.93 -      (nodemapcbts[i])->append_text(newmap);
    3.94 -    }
    3.95 -}
    3.96 -
    3.97 -void AlgoBox::edgemaplist_changed(std::string newmap)
    3.98 -{
    3.99 -  for(int i=0;i<(int)edgemapcbts.size();i++)
   3.100 -    {
   3.101 -      (edgemapcbts[i])->append_text(newmap);
   3.102 -    }
   3.103 -}
   3.104 -
   3.105 -void AlgoBox::run()
   3.106 -{
   3.107 -  std::cout << "Start algorithm." << std::endl;
   3.108 -}
   3.109 -
   3.110 -void AlgoBox::build_box()
   3.111 -{
   3.112 -  pack_start(*(new Gtk::HSeparator()));
   3.113 -
   3.114 -  Gtk::Label * label=new Gtk::Label("Specific part for each algorithm.");
   3.115 -      
   3.116 -  pack_start(*label);
   3.117 -  pack_start(*(new Gtk::HSeparator()));
   3.118 -
   3.119 -  label=new Gtk::Label("Maps in chosen tab:");
   3.120 -      
   3.121 -  pack_start(*label);
   3.122 -
   3.123 -  for(int i=0;i<NODE_INPUT_NUM;i++)
   3.124 -    {
   3.125 -      std::ostringstream o;
   3.126 -      o << "NodeInput " << i+1 << ":";
   3.127 -
   3.128 -      addMapSelector(o.str(), false);
   3.129 -    }
   3.130 -
   3.131 -  pack_start(*(new Gtk::HSeparator()));
   3.132 -
   3.133 -  for(int i=0;i<EDGE_INPUT_NUM;i++)
   3.134 -    {
   3.135 -
   3.136 -      std::ostringstream o;
   3.137 -      o << "EdgeInput " << i+1 << ":";
   3.138 -
   3.139 -      addMapSelector(o.str(), true);
   3.140 -    }
   3.141 -
   3.142 -  pack_start(*(new Gtk::HSeparator()));
   3.143 -}
   3.144 -
   3.145 -void AlgoBox::addMapSelector(std::string inputname, bool itisedge)
   3.146 -{
   3.147 -  std::vector<std::string> empty_vector;
   3.148 -
   3.149 -  MapSelector * msp=new MapSelector(empty_vector,"",inputname,itisedge, false);
   3.150 -
   3.151 -  if(itisedge)
   3.152 -    {
   3.153 -      edgemapcbts.resize(edgemapcbts.size()+1);
   3.154 -      edgemapcbts[edgemapcbts.size()-1]=msp;
   3.155 -    }
   3.156 -  else
   3.157 -    {
   3.158 -      nodemapcbts.resize(nodemapcbts.size()+1);
   3.159 -      nodemapcbts[nodemapcbts.size()-1]=msp;
   3.160 -    }
   3.161 -
   3.162 -  msp->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &AlgoBox::emit_new_map_signal));
   3.163 -
   3.164 -  pack_start(*msp);
   3.165 -}
   3.166 -
   3.167 -sigc::signal<void, std::string> AlgoBox::signal_maplist_needed()
   3.168 -{
   3.169 -  return signal_maplist_need;
   3.170 -}
   3.171 -
   3.172 -void AlgoBox::emit_tab_change()
   3.173 -{
   3.174 -  std::string active_tab=tabcbt.get_active_text();
   3.175 -  if(active_tab!="")
   3.176 -    {
   3.177 -      signal_maplist_need.emit(active_tab);
   3.178 -    }
   3.179 -  else
   3.180 -    {
   3.181 -      std::vector<std::string> empty_vector;
   3.182 -      update_maplist(NULL);
   3.183 -    }
   3.184 -}
   3.185 -
   3.186 -void AlgoBox::emit_new_map_signal(bool itisedge)
   3.187 -{
   3.188 -  signal_newmapwin_need.emit(tabcbt.get_active_text(), itisedge);
   3.189 -}
     4.1 --- a/gui/algobox.h	Wed Jun 21 08:35:23 2006 +0000
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,167 +0,0 @@
     4.4 -// -*- C++ -*- //
     4.5 -
     4.6 -#ifndef ALGOBOX_H
     4.7 -#define ALGOBOX_H
     4.8 -
     4.9 -class AlgoBox;
    4.10 -
    4.11 -#include <all_include.h>
    4.12 -#include <mapstorage.h>
    4.13 -#include <mapselector.h>
    4.14 -#include <libgnomecanvasmm.h>
    4.15 -#include <libgnomecanvasmm/polygon.h>
    4.16 -
    4.17 -///Ancestor class of algorithm graphical interface classes.
    4.18 -
    4.19 -///It also demonstrates, how should an algorithm graphical interface
    4.20 -///work. Children of this class have the same functions and attributes,
    4.21 -///therefore with all of them can the holder \ref AlgoWin communicate
    4.22 -///in the same way.
    4.23 -///
    4.24 -///IMPORTANT! In a child class only the following tasks are to do:
    4.25 -///
    4.26 -///-call \ref init function with correct parameters from correctly parametrized constructor
    4.27 -///
    4.28 -///-implement \ref build_box function
    4.29 -///
    4.30 -///-implement \ref run function
    4.31 -///
    4.32 -///because all other thing is automatically done in \ref init function!
    4.33 -
    4.34 -class AlgoBox : public Gtk::VBox
    4.35 -{
    4.36 -  ///Signal emitted in case of need for list of maps.
    4.37 -
    4.38 -  ///If the user has selected different tab to work on
    4.39 -  ///new maps are selected as well. These new maps should be
    4.40 -  ///provided for \ref AlgoBox. To get these maps, \ref AlgoBox
    4.41 -  ///emits this signal.
    4.42 -  sigc::signal<void, std::string> signal_maplist_need;
    4.43 -
    4.44 -  ///Signal emitted in case of need for \ref NewMapWin.
    4.45 -
    4.46 -  ///If user wants to create a new for an input, or output
    4.47 -  ///it can let \ref NewMapWin popped up from here as well.
    4.48 -  ///In that case will be this signal emitted.
    4.49 -  sigc::signal<void, std::string, bool> signal_newmapwin_need;
    4.50 -
    4.51 -protected:
    4.52 -  ///Holder of tabnames.
    4.53 -  Gtk::ComboBoxText tabcbt;
    4.54 -
    4.55 -  ///Holder of widgets, in which nodemaps can be selected to work on.
    4.56 -  std::vector<MapSelector *> nodemapcbts;
    4.57 -
    4.58 -  ///Holder of widgets, in which edgemaps can be selected to work on.
    4.59 -  std::vector<MapSelector *> edgemapcbts;
    4.60 -
    4.61 -  ///Maps of selected tabs.
    4.62 -  MapStorage * mapstorage;
    4.63 -
    4.64 -public:
    4.65 -  ///Empty constructor called by children.
    4.66 -  AlgoBox(){};
    4.67 -
    4.68 -  ///Constructor
    4.69 -
    4.70 -  ///Calls \ref init function
    4.71 -  ///with the provided parameters. \ref init function
    4.72 -  ///is needed, because it is virtual, therefore the
    4.73 -  ///functions of the proper class will be called when
    4.74 -  ///running.
    4.75 -  ///\param tablist list of tabs in \ref MainWin
    4.76 -  AlgoBox(std::vector<std::string> tablist);
    4.77 -
    4.78 -  ///Initiates \ref AlgoBox.
    4.79 -
    4.80 -  ///Creates the graphical interface for the realized algorithm, initiates variables, connects signals.
    4.81 -  ///
    4.82 -  ///List of tabs in \ref MainWin is required, but no one
    4.83 -  ///will be selected automatically. Every other
    4.84 -  ///entry field remains empty (unselected), until a \ref NoteBookTab
    4.85 -  ///is selected.
    4.86 -  ///
    4.87 -  ///It also have to bind all the signals to the correct place.
    4.88 -  ///This function is virtual, in all type of children of
    4.89 -  ///\ref AlgoBox the correct function willbe called.
    4.90 -  ///
    4.91 -  ///Therefore it is IMPORTANT that only \ref run and \ref build_box
    4.92 -  ///has to be implemented in children of \ref AlgoBox, every other
    4.93 -  ///thing will automatically work properly by the help of this
    4.94 -  ///function that must be called in constructor of child!!!
    4.95 -  virtual void init(std::vector<std::string>);
    4.96 -
    4.97 -  ///Signal emitted, when selected tab changes, and new list of maps required.
    4.98 -  sigc::signal<void, std::string> signal_maplist_needed();
    4.99 -
   4.100 -  ///Emitted if user wants to create a new map for inpuit or output.
   4.101 -  sigc::signal<void, std::string, bool> signal_newmapwin_needed(){return signal_newmapwin_need;};
   4.102 -
   4.103 -  ///Emits signal that requires list of maps for the recently selected \ref NoteBookTab.
   4.104 -  void emit_tab_change();
   4.105 -
   4.106 -  ///Interface, through which \ref AlgoBox can be notified about tab addition, deletion in \ref MainWin
   4.107 -
   4.108 -  ///\param tl list
   4.109 -  ///of new tab state.
   4.110 -  void update_tablist( std::vector< std::string > tl );
   4.111 -
   4.112 -  ///Interface, through which \ref AlgoBox can get the maps of the recently selected \ref NoteBookTab
   4.113 -
   4.114 -  ///\param ms the maps
   4.115 -  ///of the recently selected \ref NoteBookTab
   4.116 -  void update_maplist( MapStorage * ms);
   4.117 -
   4.118 -  ///Interface, through which \ref AlgoBox can be notified about nodemap addition.
   4.119 -
   4.120 -  ///If new map was added to \ref MapStorage of currently selected \ref NoteBookTab
   4.121 -  ///a signal is emitted by it. This signal is connected to this function, so \ref MapSelector s
   4.122 -  ///in \ref nodemapcbts can be notified, and those can registrate the new map. (\ref MapSelector::append_text)
   4.123 -  void nodemaplist_changed(std::string);
   4.124 -
   4.125 -  ///Interface, through which \ref AlgoBox can be notified about edgemap addition.
   4.126 -
   4.127 -  ///If new map was added to \ref MapStorage of currently selected \ref NoteBookTab
   4.128 -  ///a signal is emitted by it. This signal is connected to this function, so \ref MapSelector s
   4.129 -  ///in \ref edgemapcbts can be notified, and those can registrate the new map. (\ref MapSelector::append_text)
   4.130 -  void edgemaplist_changed(std::string);
   4.131 -
   4.132 -  ///Aid function to provide data for a given entry.
   4.133 -
   4.134 -  ///At the moment it is only used for updating info
   4.135 -  ///in \ref tabcbt. It clears it first, after that
   4.136 -  ///inserts the data got from caller, and if there
   4.137 -  ///was previously selected item it switches entry
   4.138 -  ///to that.
   4.139 -  ///\param tl list of entries (at the moment tabs in \ref MainWin)
   4.140 -  ///\param cbt the entry to update (at the moment only \ref tabcbt)
   4.141 -  void update_cbt( std::vector< std::string > tl, Gtk::ComboBoxText & cbt);
   4.142 -
   4.143 -  ///Runs the ralized algorithm.
   4.144 -
   4.145 -  ///Prepare the data for it
   4.146 -  ///and after that postprocess it if necessary.
   4.147 -  ///This is only a demo here, but in children it
   4.148 -  ///runs the algorithm really.
   4.149 -  virtual void run();
   4.150 -
   4.151 -  ///Creates the layout of the \ref AlgoBox
   4.152 -
   4.153 -  ///Place all the entries
   4.154 -  ///required. Run and close button is not
   4.155 -  ///its responsibility!
   4.156 -  virtual void build_box();
   4.157 -
   4.158 -  ///Emits \ref signal_newmapwin_need if user wants to create new input or output map.
   4.159 -
   4.160 -  ///Called in case of pressing \ref MapSelector::newbut.
   4.161 -  ///\param itisedge edge or nodemap is required.
   4.162 -  virtual void emit_new_map_signal(bool itisedge);
   4.163 -
   4.164 -  ///Aid function to make addition of \ref MapSelector easy in \ref build_box.
   4.165 -
   4.166 -  ///\param label label to show in \ref MapSelector
   4.167 -  ///\param itisedge whether edge or nodemaps stored in \ref MapSelector
   4.168 -  void addMapSelector(std::string label, bool itisedge);
   4.169 -};
   4.170 -#endif //ALGOBOX_H
     5.1 --- a/gui/algowin.cc	Wed Jun 21 08:35:23 2006 +0000
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,89 +0,0 @@
     5.4 -#include <algowin.h>
     5.5 -#include <kruskalbox.h>
     5.6 -
     5.7 -sigc::signal<void, AlgoWin *> AlgoWin::signal_closing()
     5.8 -{
     5.9 -  return signal_closed;
    5.10 -}
    5.11 -
    5.12 -sigc::signal<void, AlgoWin *, std::string> AlgoWin::signal_maplist_needed()
    5.13 -{
    5.14 -  return signal_maplist_need;
    5.15 -}
    5.16 -
    5.17 -bool AlgoWin::closeIfEscapeIsPressed(GdkEventKey* e)
    5.18 -{
    5.19 -  if(e->keyval==GDK_Escape)
    5.20 -  {
    5.21 -    on_hide();
    5.22 -  }
    5.23 -  return true;
    5.24 -}
    5.25 -
    5.26 -AlgoWin::AlgoWin(int algoid, std::vector<std::string> tabnames)
    5.27 -{
    5.28 -  signal_key_press_event().connect(sigc::mem_fun(*this, &AlgoWin::closeIfEscapeIsPressed));
    5.29 -
    5.30 -  Gtk::VBox * vbox=new Gtk::VBox();
    5.31 -  vbox->set_spacing(5);
    5.32 -
    5.33 -  Gtk::Label * label=new Gtk::Label("Select graph:");
    5.34 -
    5.35 -  switch(algoid)
    5.36 -    {
    5.37 -    case 0:
    5.38 -      ab=new AlgoBox(tabnames);
    5.39 -      set_title("Algo Win Demo");
    5.40 -      break;
    5.41 -    case 1:
    5.42 -      ab=new KruskalBox(tabnames);
    5.43 -      set_title("Kruskal Algorithm");
    5.44 -      break;
    5.45 -    default:
    5.46 -      break;
    5.47 -    }
    5.48 -  ab->signal_maplist_needed().connect(sigc::mem_fun(*this, &AlgoWin::emit_tab_change));
    5.49 -  ab->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &AlgoWin::emit_new_map_signal));
    5.50 -
    5.51 -  runbutton=new Gtk::Button("Run");
    5.52 -  runbutton->signal_released().connect(sigc::mem_fun(*ab,&AlgoBox::run));
    5.53 -  runbutton->signal_activate().connect(sigc::mem_fun(*ab,&AlgoBox::run));
    5.54 -
    5.55 -  closebutton=new Gtk::Button("Close");
    5.56 -  closebutton->signal_released().connect(sigc::mem_fun(*this,&AlgoWin::on_hide));
    5.57 -  closebutton->signal_activate().connect(sigc::mem_fun(*this,&AlgoWin::on_hide));
    5.58 -      
    5.59 -  Gtk::HBox * hbox=new Gtk::HBox();
    5.60 -
    5.61 -  hbox->pack_start(*runbutton);
    5.62 -  hbox->pack_start(*closebutton);
    5.63 -
    5.64 -  vbox->pack_start(*label);
    5.65 -  vbox->pack_start(*ab);
    5.66 -  vbox->pack_start(*hbox);
    5.67 -      
    5.68 -  add(*vbox);
    5.69 -
    5.70 -  show_all_children();
    5.71 -};
    5.72 -
    5.73 -void AlgoWin::update_tablist(std::vector<std::string> tabnames)
    5.74 -{
    5.75 -  ab->update_tablist(tabnames);
    5.76 -}
    5.77 -
    5.78 -void AlgoWin::update_maplist(MapStorage * mapstorage)
    5.79 -{
    5.80 -  ab->update_maplist(mapstorage);
    5.81 -}
    5.82 -
    5.83 -void AlgoWin::on_hide()
    5.84 -{
    5.85 -  signal_closed.emit(this);
    5.86 -  Gtk::Window::on_hide();
    5.87 -}
    5.88 -
    5.89 -void AlgoWin::emit_tab_change(std::string newtab)
    5.90 -{
    5.91 -  signal_maplist_need.emit(this, newtab);
    5.92 -}
     6.1 --- a/gui/algowin.h	Wed Jun 21 08:35:23 2006 +0000
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,134 +0,0 @@
     6.4 -// -*- C++ -*- //
     6.5 -
     6.6 -#ifndef ALGOWIN_H
     6.7 -#define ALGOWIN_H
     6.8 -
     6.9 -class AlgoWin;
    6.10 -
    6.11 -#include <all_include.h>
    6.12 -//#include <mapstorage.h>
    6.13 -#include <algobox.h>
    6.14 -#include <libgnomecanvasmm.h>
    6.15 -#include <libgnomecanvasmm/polygon.h>
    6.16 -
    6.17 -class MapStorage;
    6.18 -
    6.19 -///Algorithm identifiers.
    6.20 -enum {GENERAL, KRUSKAL, ALGO_NUM}; // algorithm IDs;
    6.21 -
    6.22 -///Window displaying graphical interface for different algorithms.
    6.23 -
    6.24 -///This class displays a graphical interface to set up
    6.25 -///and run different algorithms. Different algorithms need
    6.26 -///different inputs, running methods, etc. Therefore
    6.27 -///class \ref AlgoWin is only a holder of a base class, the so
    6.28 -///called AlgoBox. \ref AlgoBox is the ancestor of other
    6.29 -///classes. These child classes realize interfaces of different
    6.30 -///algorithms, but as their common ancestor is \ref AlgoBox
    6.31 -///the interface of them is the same. \ref AlgoWin communicates
    6.32 -///with these classes through this common interface. But it the
    6.33 -///real object to be placed in \ref AlgoWin depends on the algorithm
    6.34 -///which the \ref AlgoWin actually has to display. It gets the
    6.35 -///id of algorithm to display at initialization, and therefore it is
    6.36 -///able to place in itself the requested child of \ref AlgoBox
    6.37 -/// visualizing the appropriate algorithm.
    6.38 -class AlgoWin : public Gtk::Window
    6.39 -{
    6.40 -private:
    6.41 -  ///Algorithm specific part of \ref AlgoWin
    6.42 -  AlgoBox * ab;
    6.43 -
    6.44 -  ///Run button.
    6.45 -
    6.46 -  ///If pressed, algorithm should run.
    6.47 -  ///That is why common ancestor of different
    6.48 -  ///algorithm realizer classes have to be. In case of
    6.49 -  ///pressing run button a common method can be called.
    6.50 -  Gtk::Button * runbutton;
    6.51 -
    6.52 -  ///Close button. If pressed, \ref AlgoWin should close.
    6.53 -  Gtk::Button * closebutton;
    6.54 -
    6.55 -protected:
    6.56 -  ///Signal emitted upon close of window
    6.57 -
    6.58 -  ///It is necessary, because \ref MainWin have to
    6.59 -  ///score the opened \ref AlgoWin s, to be able to communicate
    6.60 -  ///with them: let them know about changement in tabs, maps, etc.
    6.61 -  ///If \ref AlgoWin is closed, \ref MainWin has to deregistrate it.
    6.62 -  ///Therefore signal contains address of emitter \ref AlgoWin.
    6.63 -  sigc::signal<void, AlgoWin *> signal_closed;
    6.64 -
    6.65 -  ///Signal indicating that informatino on certain maplist is required.
    6.66 -
    6.67 -  ///It is just a forwarded signal from \ref AlgoBox, benefit of common ancestor
    6.68 -  ///algorithm class. User can select the graph (the holder \ref NoteBookTab) on
    6.69 -  ///which the algorithm should run. But different graphs (\ref NoteBookTab) have
    6.70 -  ///different maps. If selected tab changes this signal is emitted by \ref AlgoBox,
    6.71 -  ///caught and reemitted by \ref AlgoWin.
    6.72 -  ///
    6.73 -  ///Signal contains the address of \ref AlgoWin to let \ref MainWin know
    6.74 -  ///where should the information needed forwarded, and the name of
    6.75 -  ///\ref NoteBookTab, of which maps are inquired.
    6.76 -  sigc::signal<void, AlgoWin *, std::string> signal_maplist_need;
    6.77 -
    6.78 -  ///Signal that indicates that a \ref NewMapWin should be popped up.
    6.79 -
    6.80 -  ///This is a forwarded signal. If \ref AlgoBox emits a signal
    6.81 -  ///to let a \ref NewMapWin pop up, |ref AlgoWin catch and reemit it.
    6.82 -  ///
    6.83 -  ///Signal contains the name of \ref NoteBookTab, in which the new map
    6.84 -  ///should be created and a boolean that indicates whether an edge or a
    6.85 -  ///nodemap should be created.
    6.86 -  sigc::signal<void, std::string, bool> signal_newmapwin_need;
    6.87 -
    6.88 -public:
    6.89 -  ///Close window if escape key is pressed.
    6.90 -  bool closeIfEscapeIsPressed(GdkEventKey* e);
    6.91 -
    6.92 -  ///Returns \ref signal_closed to be bindable somewhere.
    6.93 -  sigc::signal<void, AlgoWin *> signal_closing();
    6.94 -
    6.95 -  ///Returns \ref signal_maplist_need to be bindable somewhere.
    6.96 -  sigc::signal<void, AlgoWin *, std::string> signal_maplist_needed();
    6.97 -
    6.98 -  ///Returns \ref signal_newmapwin_need to be bindable somewhere.
    6.99 -  sigc::signal<void, std::string, bool> signal_newmapwin_needed(){return signal_newmapwin_need;};
   6.100 -
   6.101 -  ///Forwards signal emitted by \ref AlgoBox, in which it indicates changement in selection of tabs.
   6.102 -  void emit_tab_change(std::string);
   6.103 -
   6.104 -  ///Forwards signal emitted by \ref AlgoBox, in which it indicates need for \ref NewMapWin.
   6.105 -  void emit_new_map_signal(std::string tabname, bool itisedge){signal_newmapwin_need.emit(tabname, itisedge);};
   6.106 -
   6.107 -  ///Constructor
   6.108 -
   6.109 -  ///It builds the window according to the information provided
   6.110 -  ///by the creator. It needs the identifier of the algorithm
   6.111 -  ///to visualize, and a list of name of \ref NoteBookTab s that can
   6.112 -  ///be found in \ref MainWin.
   6.113 -  ///\param algoid identifier of algorithm to show
   6.114 -  ///\param tablist list of tabs in \ref MainWin
   6.115 -  AlgoWin(int algoid, std::vector<std::string> tablist);
   6.116 -
   6.117 -  ///Forwards list of \ref NoteBookTabs toward \ref AlgoBox
   6.118 -
   6.119 -  ///In case of changement in tabs in \ref MainWin
   6.120 -  ///\ref MainWin automatically updates tablist in
   6.121 -  ///\ref AlgoWin s.
   6.122 -  void update_tablist(std::vector<std::string> tabnames);
   6.123 -
   6.124 -  ///Forwards list of requested maps toward \ref AlgoBox
   6.125 -
   6.126 -  ///Upon catching the signal in which \ref AlgoBox requests
   6.127 -  ///list of maps \ref MainWin responds
   6.128 -  ///through this function.
   6.129 -  void update_maplist(MapStorage *);
   6.130 -
   6.131 -  ///Called when window is closing.
   6.132 -
   6.133 -  ///\ref AlgoWin has to be deregistrated in \ref MainWin
   6.134 -  ///thereforeit emits signal \ref signal_closed.
   6.135 -  void on_hide();
   6.136 -};
   6.137 -#endif //ALGOWIN_H
     7.1 --- a/gui/all_include.h	Wed Jun 21 08:35:23 2006 +0000
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,51 +0,0 @@
     7.4 -// -*- C++ -*- //
     7.5 -
     7.6 -#ifndef ALL_INCLUDE_H
     7.7 -#define ALL_INCLUDE_H
     7.8 -
     7.9 -#include <fstream>
    7.10 -#include <iostream>
    7.11 -
    7.12 -#include <vector>
    7.13 -
    7.14 -#include <lemon/list_graph.h>
    7.15 -#include <lemon/graph_reader.h>
    7.16 -#include <lemon/graph_writer.h>
    7.17 -#include <lemon/graph_utils.h>
    7.18 -#include <lemon/maps.h>
    7.19 -#include <lemon/error.h>
    7.20 -#include <lemon/xy.h>
    7.21 -
    7.22 -enum {E_WIDTH, E_COLOR, E_TEXT, EDGE_PROPERTY_NUM}; // edge properties;
    7.23 -enum {N_RADIUS, N_COLOR, N_TEXT, NODE_PROPERTY_NUM}; // node properties;
    7.24 -enum {MOVE, CREATE_NODE, CREATE_EDGE, ERASER, EDGE_MAP_EDIT, NODE_MAP_EDIT, TOOL_NUM}; // tools;
    7.25 -#define RANGE 3
    7.26 -#define WIN_WIDTH 900
    7.27 -#define WIN_HEIGHT 600
    7.28 -#define MIN_EDGE_WIDTH 2
    7.29 -#define MAX_EDGE_WIDTH 40
    7.30 -#define MIN_NODE_RADIUS 2
    7.31 -#define MAX_NODE_RADIUS 80
    7.32 -
    7.33 -#ifndef MAIN_PART
    7.34 -extern std::vector <std::string> edge_property_strings;
    7.35 -extern std::vector <double> edge_property_defaults;
    7.36 -extern std::vector <std::string> node_property_strings;
    7.37 -extern std::vector <double> node_property_defaults;
    7.38 -extern int longest_property_string_length;
    7.39 -#endif //MAIN_PART
    7.40 -
    7.41 -using namespace lemon;
    7.42 -
    7.43 -typedef xy<double> XY;
    7.44 -typedef ListGraph Graph;
    7.45 -typedef Graph::Node Node;
    7.46 -typedef Graph::Edge Edge;
    7.47 -typedef Graph::EdgeIt EdgeIt;
    7.48 -typedef Graph::InEdgeIt InEdgeIt;
    7.49 -typedef Graph::OutEdgeIt OutEdgeIt;
    7.50 -typedef Graph::NodeIt NodeIt;
    7.51 -
    7.52 -const std::string prog_name = "LEMON Graph Editor";
    7.53 -
    7.54 -#endif // ALL_INCLUDE_H
     8.1 --- a/gui/gdc-broken_edge.cc	Wed Jun 21 08:35:23 2006 +0000
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,133 +0,0 @@
     8.4 -#include "graph_displayer_canvas.h"
     8.5 -#include <cmath>
     8.6 -
     8.7 -GraphDisplayerCanvas::BrokenEdge::BrokenEdge(Gnome::Canvas::Group & g, Edge _edge, GraphDisplayerCanvas & gc) : Line(g), edge(_edge), gdc(gc), isbutton(false)
     8.8 -{
     8.9 -  arrow=new Gnome::Canvas::Polygon(g);
    8.10 -  *arrow << Gnome::Canvas::Properties::fill_color("red");
    8.11 -  arrow->signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::BrokenEdge::edgeFormerEventHandler));
    8.12 -  arrow->lower_to_bottom();
    8.13 -  draw();
    8.14 -}
    8.15 -
    8.16 -GraphDisplayerCanvas::BrokenEdge::~BrokenEdge()
    8.17 -{
    8.18 -  if(arrow)delete(arrow);
    8.19 -}
    8.20 -
    8.21 -void GraphDisplayerCanvas::BrokenEdge::draw()
    8.22 -{
    8.23 -  MapStorage& ms = gdc.mytab.mapstorage;
    8.24 -
    8.25 -  // update the edge
    8.26 -  {
    8.27 -    Gnome::Canvas::Points points;
    8.28 -    Node source = ms.graph.source(edge);
    8.29 -    Node target = ms.graph.target(edge);
    8.30 -    points.push_back(Gnome::Art::Point(ms.coords[source].x,
    8.31 -          ms.coords[source].y));
    8.32 -    points.push_back(Gnome::Art::Point(ms.arrow_pos[edge].x,
    8.33 -          ms.arrow_pos[edge].y));
    8.34 -    points.push_back(Gnome::Art::Point(ms.coords[target].x,
    8.35 -          ms.coords[target].y));
    8.36 -    property_points().set_value(points);
    8.37 -  }
    8.38 -
    8.39 -  // update the arrow
    8.40 -  {
    8.41 -    //calculating coordinates of the direction indicator arrow
    8.42 -    XY target(ms.coords[ms.graph.target(edge)]);
    8.43 -    XY center(ms.arrow_pos[edge]);
    8.44 -
    8.45 -    XY unit_vector_in_dir(target-center);
    8.46 -    double length=sqrt( unit_vector_in_dir.normSquare() );
    8.47 -
    8.48 -    //       std::cout << target << " - " << center << " = " << unit_vector_in_dir << "    / " <<unit_vector_in_dir.normSquare() ;
    8.49 -    unit_vector_in_dir/=length;
    8.50 -    //       std::cout << " = " << unit_vector_in_dir << std::endl;
    8.51 -
    8.52 -    XY unit_norm_vector(0-unit_vector_in_dir.y, unit_vector_in_dir.x);
    8.53 -    //       std::cout << unit_norm_vector << std::endl;
    8.54 -
    8.55 -    {      
    8.56 -      //       /\       // top
    8.57 -      //      /  \      //
    8.58 -      //      -  -      // c(enter)l(eft), ccl, ccr, cr
    8.59 -      //       ||       //
    8.60 -      //       ||       // b(ottom)l, br
    8.61 -    }
    8.62 -
    8.63 -    double size=3;
    8.64 -
    8.65 -    XY bl (center - unit_vector_in_dir * 3 * size + unit_norm_vector * size );
    8.66 -    XY br (center - unit_vector_in_dir * 3 * size - unit_norm_vector * size );
    8.67 -    XY ccl(center + unit_vector_in_dir *  size + unit_norm_vector * size );
    8.68 -    XY ccr(center + unit_vector_in_dir *  size - unit_norm_vector * size );
    8.69 -    XY cl (center + unit_vector_in_dir *  size + unit_norm_vector * 2 * size );
    8.70 -    XY cr (center + unit_vector_in_dir *  size - unit_norm_vector * 2 * size );
    8.71 -    XY top(center + unit_vector_in_dir * 3 * size);
    8.72 -
    8.73 -    //std::cout << bl << " " << br << " " << ccl << " "  << ccr << " " << cl << " " << cr << " " << top << std::endl;
    8.74 -
    8.75 -    Gnome::Canvas::Points arrow_points;
    8.76 -    arrow_points.push_back(Gnome::Art::Point( bl.x , bl.y  ) );
    8.77 -    arrow_points.push_back(Gnome::Art::Point( br.x , br.y  ) );
    8.78 -    arrow_points.push_back(Gnome::Art::Point( ccr.x, ccr.y ) );
    8.79 -    arrow_points.push_back(Gnome::Art::Point( cr.x , cr.y  ) );
    8.80 -    arrow_points.push_back(Gnome::Art::Point( top.x, top.y ) );
    8.81 -    arrow_points.push_back(Gnome::Art::Point( cl.x , cl.y  ) );
    8.82 -    arrow_points.push_back(Gnome::Art::Point( ccl.x, ccl.y ) );
    8.83 -
    8.84 -    arrow->property_points().set_value(arrow_points);
    8.85 -  }
    8.86 -}
    8.87 -
    8.88 -bool GraphDisplayerCanvas::BrokenEdge::edgeFormerEventHandler(GdkEvent* e)
    8.89 -{
    8.90 -  switch(e->type)
    8.91 -    {
    8.92 -    case GDK_BUTTON_PRESS:
    8.93 -      //we mark the location of the event to be able to calculate parameters of dragging
    8.94 -      if(gdc.getActualTool()!=CREATE_NODE)
    8.95 -	{
    8.96 -	  gdc.toggleEdgeActivity(this, true);
    8.97 -	  clicked_x=e->button.x;
    8.98 -	  clicked_y=e->button.y;
    8.99 -	  isbutton=true;
   8.100 -	}
   8.101 -      break;
   8.102 -    case GDK_BUTTON_RELEASE:
   8.103 -      if(gdc.getActualTool()!=CREATE_NODE)
   8.104 -	{
   8.105 -	  gdc.toggleEdgeActivity(this, false);
   8.106 -	  isbutton=false;
   8.107 -	}
   8.108 -      break;
   8.109 -    case GDK_MOTION_NOTIFY:
   8.110 -      //we only have to do sg. if the mouse button is pressed
   8.111 -      if(isbutton)
   8.112 -	{
   8.113 -	  //new coordinates will be the old values,
   8.114 -	  //because the item will be moved to the
   8.115 -	  //new coordinate therefore the new movement
   8.116 -	  //has to be calculated from here
   8.117 -
   8.118 -	  double dx=e->motion.x-clicked_x;
   8.119 -	  double dy=e->motion.y-clicked_y;
   8.120 -
   8.121 -	  Gnome::Canvas::Points points_new;
   8.122 -
   8.123 -          gdc.mytab.mapstorage.arrow_pos.set(edge, gdc.mytab.mapstorage.arrow_pos[edge] + XY(dx, dy));
   8.124 -
   8.125 -	  draw();
   8.126 -	  gdc.textReposition(gdc.mytab.mapstorage.arrow_pos[edge]);
   8.127 -
   8.128 -	  clicked_x=e->motion.x;
   8.129 -	  clicked_y=e->motion.y;
   8.130 -
   8.131 -	}
   8.132 -    default: break;
   8.133 -    }
   8.134 -
   8.135 -  return true;
   8.136 -}
     9.1 --- a/gui/gettext.h	Wed Jun 21 08:35:23 2006 +0000
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,79 +0,0 @@
     9.4 -/* Convenience header for conditional use of GNU <libintl.h>.
     9.5 -   Copyright (C) 1995-1998, 2000-2002, 2004 Free Software Foundation, Inc.
     9.6 -
     9.7 -   This program is free software; you can redistribute it and/or modify it
     9.8 -   under the terms of the GNU Library General Public License as published
     9.9 -   by the Free Software Foundation; either version 2, or (at your option)
    9.10 -   any later version.
    9.11 -
    9.12 -   This program is distributed in the hope that it will be useful,
    9.13 -   but WITHOUT ANY WARRANTY; without even the implied warranty of
    9.14 -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    9.15 -   Library General Public License for more details.
    9.16 -
    9.17 -   You should have received a copy of the GNU Library General Public
    9.18 -   License along with this program; if not, write to the Free Software
    9.19 -   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
    9.20 -   USA.  */
    9.21 -
    9.22 -#ifndef _LIBGETTEXT_H
    9.23 -#define _LIBGETTEXT_H 1
    9.24 -
    9.25 -/* NLS can be disabled through the configure --disable-nls option.  */
    9.26 -#if ENABLE_NLS
    9.27 -
    9.28 -/* Get declarations of GNU message catalog functions.  */
    9.29 -# include <libintl.h>
    9.30 -
    9.31 -#else
    9.32 -
    9.33 -/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which
    9.34 -   chokes if dcgettext is defined as a macro.  So include it now, to make
    9.35 -   later inclusions of <locale.h> a NOP.  We don't include <libintl.h>
    9.36 -   as well because people using "gettext.h" will not include <libintl.h>,
    9.37 -   and also including <libintl.h> would fail on SunOS 4, whereas <locale.h>
    9.38 -   is OK.  */
    9.39 -#if defined(__sun)
    9.40 -# include <locale.h>
    9.41 -#endif
    9.42 -
    9.43 -/* Many header files from the libstdc++ coming with g++ 3.3 or newer include
    9.44 -   <libintl.h>, which chokes if dcgettext is defined as a macro.  So include
    9.45 -   it now, to make later inclusions of <libintl.h> a NOP.  */
    9.46 -#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3)
    9.47 -# include <cstdlib>
    9.48 -# if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H
    9.49 -#  include <libintl.h>
    9.50 -# endif
    9.51 -#endif
    9.52 -
    9.53 -/* Disabled NLS.
    9.54 -   The casts to 'const char *' serve the purpose of producing warnings
    9.55 -   for invalid uses of the value returned from these functions.
    9.56 -   On pre-ANSI systems without 'const', the config.h file is supposed to
    9.57 -   contain "#define const".  */
    9.58 -# define gettext(Msgid) ((const char *) (Msgid))
    9.59 -# define dgettext(Domainname, Msgid) ((const char *) (Msgid))
    9.60 -# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid))
    9.61 -# define ngettext(Msgid1, Msgid2, N) \
    9.62 -    ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
    9.63 -# define dngettext(Domainname, Msgid1, Msgid2, N) \
    9.64 -    ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
    9.65 -# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
    9.66 -    ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
    9.67 -# define textdomain(Domainname) ((const char *) (Domainname))
    9.68 -# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname))
    9.69 -# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset))
    9.70 -
    9.71 -#endif
    9.72 -
    9.73 -/* A pseudo function call that serves as a marker for the automated
    9.74 -   extraction of messages, but does not call gettext().  The run-time
    9.75 -   translation is done at a different place in the code.
    9.76 -   The argument, String, should be a literal string.  Concatenated strings
    9.77 -   and other string expressions won't work.
    9.78 -   The macro's expansion is not parenthesized, so that it is suitable as
    9.79 -   initializer for static 'char[]' or 'const char[]' variables.  */
    9.80 -#define gettext_noop(String) String
    9.81 -
    9.82 -#endif /* _LIBGETTEXT_H */
    10.1 --- a/gui/graph-displayer.cc	Wed Jun 21 08:35:23 2006 +0000
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,98 +0,0 @@
    10.4 -#ifdef HAVE_CONFIG_H
    10.5 -#include <config.h>
    10.6 -#endif
    10.7 -
    10.8 -#include "all_include.h"
    10.9 -#include "mapstorage.h"
   10.10 -#include "main_win.h"
   10.11 -#include <libgnomecanvasmm.h>
   10.12 -#include <libgnomecanvasmm/polygon.h>
   10.13 -
   10.14 -#include <locale.h>
   10.15 -
   10.16 -#define MAIN_PART
   10.17 -
   10.18 -std::vector <std::string> edge_property_strings;
   10.19 -std::vector <double> edge_property_defaults;
   10.20 -std::vector <std::string> node_property_strings;
   10.21 -std::vector <double> node_property_defaults;
   10.22 -int longest_property_string_length;
   10.23 -
   10.24 -int main(int argc, char *argv[])
   10.25 -{
   10.26 -  setlocale(LC_ALL, "");
   10.27 -  bindtextdomain(PACKAGE, LOCALEDIR);
   10.28 -  bind_textdomain_codeset(PACKAGE, "UTF-8");
   10.29 -  textdomain(PACKAGE);
   10.30 -
   10.31 -  //initializing
   10.32 -
   10.33 -  edge_property_strings.resize(EDGE_PROPERTY_NUM);
   10.34 -  edge_property_strings[E_WIDTH]="Edge Width";
   10.35 -  edge_property_strings[E_COLOR]="Edge Color";
   10.36 -  edge_property_strings[E_TEXT]="Edge Text";
   10.37 -
   10.38 -  edge_property_defaults.resize(EDGE_PROPERTY_NUM);
   10.39 -  edge_property_defaults[E_WIDTH]=10.0;
   10.40 -  edge_property_defaults[E_COLOR]=100;
   10.41 -  edge_property_defaults[E_TEXT]=0;
   10.42 -
   10.43 -  node_property_strings.resize(NODE_PROPERTY_NUM);
   10.44 -  node_property_strings[N_RADIUS]="Node Radius";
   10.45 -  node_property_strings[N_COLOR]="Node Color";
   10.46 -  node_property_strings[N_TEXT]="Node Text";
   10.47 -
   10.48 -  node_property_defaults.resize(NODE_PROPERTY_NUM);
   10.49 -  node_property_defaults[N_RADIUS]=20.0;
   10.50 -  node_property_defaults[N_COLOR]=100;
   10.51 -  node_property_defaults[N_TEXT]=0;
   10.52 -
   10.53 -  longest_property_string_length=0;
   10.54 -  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
   10.55 -    {
   10.56 -      int j=edge_property_strings[i].size();
   10.57 -      if(j>longest_property_string_length)
   10.58 -	{
   10.59 -	  longest_property_string_length=j;
   10.60 -	}
   10.61 -    }
   10.62 -  for(int i=0;i<NODE_PROPERTY_NUM;i++)
   10.63 -    {
   10.64 -      int j=node_property_strings[i].size();
   10.65 -      if(j>longest_property_string_length)
   10.66 -	{
   10.67 -	  longest_property_string_length=j;
   10.68 -	}
   10.69 -    }
   10.70 -
   10.71 -
   10.72 -  //initializing GUI
   10.73 -
   10.74 -  Gnome::Canvas::init();
   10.75 -  Gtk::Main app(argc, argv);
   10.76 -
   10.77 -  MainWin mytab;
   10.78 -
   10.79 -//   if ((argc == 2) && (Glib::file_test(argv[1], Glib::FILE_TEST_IS_REGULAR)))
   10.80 -//     {
   10.81 -//       mytab.readFile(argv[1]);
   10.82 -//     }
   10.83 -  if(argc>=2)
   10.84 -    {
   10.85 -      for(int i=1;i<argc;i++)
   10.86 -	{
   10.87 -	  if(Glib::file_test(argv[i], Glib::FILE_TEST_IS_REGULAR))
   10.88 -	    {
   10.89 -	      mytab.readFile(argv[i]);
   10.90 -	    }
   10.91 -	}
   10.92 -    }
   10.93 -  else
   10.94 -    {
   10.95 -      mytab.newTab();
   10.96 -    }
   10.97 -  
   10.98 -  app.run(mytab);
   10.99 -
  10.100 -  return 0;
  10.101 -}
    11.1 --- a/gui/graph_displayer_canvas-edge.cc	Wed Jun 21 08:35:23 2006 +0000
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,240 +0,0 @@
    11.4 -#include "graph_displayer_canvas.h"
    11.5 -#include <cmath>
    11.6 -
    11.7 -
    11.8 -int GraphDisplayerCanvas::resetEdgeWidth (Edge edge)
    11.9 -{
   11.10 -  double min, max;
   11.11 -
   11.12 -  min=edge_property_defaults[E_WIDTH];
   11.13 -  max=edge_property_defaults[E_WIDTH];
   11.14 -  Graph::EdgeMap<double> actual_map((mytab.mapstorage).graph,edge_property_defaults[E_WIDTH]);
   11.15 -  
   11.16 -  if(edge==INVALID)
   11.17 -    {
   11.18 -      for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
   11.19 -	{
   11.20 -	  double v=fabs(actual_map[i]);
   11.21 -	  int w;
   11.22 -	  if(min==max)
   11.23 -	    {
   11.24 -	      w=(int)(edge_property_defaults[E_WIDTH]);
   11.25 -	    }
   11.26 -	  else
   11.27 -	    {
   11.28 -	      w=(int)(MIN_EDGE_WIDTH+(v-min)/(max-min)*(MAX_EDGE_WIDTH-MIN_EDGE_WIDTH));
   11.29 -	    }
   11.30 -	  edgesmap[i]->property_width_units().set_value(w);
   11.31 -	}
   11.32 -    }
   11.33 -  else
   11.34 -    {
   11.35 -      int w=(int)actual_map[edge];
   11.36 -      if(w>=0)
   11.37 -	{
   11.38 -	  edgesmap[edge]->property_width_units().set_value(w);
   11.39 -	}
   11.40 -    }
   11.41 -  return 0;
   11.42 -}
   11.43 -
   11.44 -
   11.45 -int GraphDisplayerCanvas::changeEdgeWidth (std::string mapname, Edge edge)
   11.46 -{
   11.47 -  Graph::EdgeMap<double> * actual_map;
   11.48 -  double min, max;
   11.49 -
   11.50 -  min=(mytab.mapstorage).minOfEdgeMap(mapname);
   11.51 -  max=(mytab.mapstorage).maxOfEdgeMap(mapname);
   11.52 -  actual_map=((mytab.mapstorage).edgemap_storage)[mapname];
   11.53 -
   11.54 -  if(edge==INVALID)
   11.55 -    {
   11.56 -      for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
   11.57 -	{
   11.58 -	  double v=fabs((*actual_map)[i]);
   11.59 -	  int w;
   11.60 -	  if(min==max)
   11.61 -	    {
   11.62 -	      w=(int)(edge_property_defaults[E_WIDTH]);
   11.63 -	    }
   11.64 -	  else
   11.65 -	    {
   11.66 -	      w=(int)(MIN_EDGE_WIDTH+(v-min)/(max-min)*(MAX_EDGE_WIDTH-MIN_EDGE_WIDTH));
   11.67 -	    }
   11.68 -	  edgesmap[i]->property_width_units().set_value(w);
   11.69 -	}
   11.70 -    }
   11.71 -  else
   11.72 -    {
   11.73 -      int w=(int)(*actual_map)[edge];
   11.74 -      if(w>=0)
   11.75 -	{
   11.76 -	  edgesmap[edge]->property_width_units().set_value(w);
   11.77 -	}
   11.78 -    }
   11.79 -  return 0;
   11.80 -};
   11.81 -
   11.82 -int GraphDisplayerCanvas::changeEdgeColor (std::string mapname, Edge edge)
   11.83 -{  
   11.84 -
   11.85 -  //function maps the range of the maximum and
   11.86 -  //the minimum of the nodemap to the range of
   11.87 -  //green in RGB
   11.88 -  Graph::EdgeMap<double> * actual_map;
   11.89 -  actual_map=((mytab.mapstorage).edgemap_storage)[mapname];
   11.90 -
   11.91 -  double max, min;
   11.92 -
   11.93 -  max=(mytab.mapstorage).maxOfEdgeMap(mapname);
   11.94 -  min=(mytab.mapstorage).minOfEdgeMap(mapname);
   11.95 -
   11.96 -  if(edge==INVALID)
   11.97 -    {
   11.98 -      for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
   11.99 -	{
  11.100 -	  double w=(*actual_map)[i];
  11.101 -
  11.102 -	  Gdk::Color color;
  11.103 -	  if(max!=min)
  11.104 -	    {
  11.105 -	      color.set_rgb_p (0, 100*(w-min)/(max-min), 0);
  11.106 -	    }
  11.107 -	  else
  11.108 -	    {
  11.109 -	      color.set_rgb_p (0, 100, 0);
  11.110 -	    }
  11.111 -	  edgesmap[i]->property_fill_color_gdk().set_value(color);
  11.112 -	}
  11.113 -    }
  11.114 -  else
  11.115 -    {
  11.116 -      Gdk::Color color;
  11.117 -
  11.118 -      double w=(*actual_map)[edge];
  11.119 -
  11.120 -      if(max!=min)
  11.121 -	{
  11.122 -	  color.set_rgb_p (0, 100*(w-min)/(max-min), 0);
  11.123 -	}
  11.124 -      else
  11.125 -	{
  11.126 -	  color.set_rgb_p (0, 100, 0);
  11.127 -	}
  11.128 -
  11.129 -      edgesmap[edge]->property_fill_color_gdk().set_value(color);
  11.130 -    }
  11.131 -  return 0;
  11.132 -};
  11.133 -
  11.134 -int GraphDisplayerCanvas::resetEdgeColor (Edge edge)
  11.135 -{  
  11.136 -
  11.137 -  //function maps the range of the maximum and
  11.138 -  //the minimum of the nodemap to the range of
  11.139 -  //green in RGB
  11.140 -  Graph::EdgeMap<double> actual_map((mytab.mapstorage).graph,edge_property_defaults[E_COLOR]);
  11.141 -
  11.142 -  double max, min;
  11.143 -
  11.144 -  max=edge_property_defaults[E_COLOR];
  11.145 -  min=edge_property_defaults[E_COLOR];
  11.146 -
  11.147 -  if(edge==INVALID)
  11.148 -    {
  11.149 -      for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
  11.150 -	{
  11.151 -	  double w=actual_map[i];
  11.152 -
  11.153 -	  Gdk::Color color;
  11.154 -	  if(max!=min)
  11.155 -	    {
  11.156 -	      color.set_rgb_p (0, 100*(w-min)/(max-min), 0);
  11.157 -	    }
  11.158 -	  else
  11.159 -	    {
  11.160 -	      color.set_rgb_p (0, 100, 0);
  11.161 -	    }
  11.162 -	  edgesmap[i]->property_fill_color_gdk().set_value(color);
  11.163 -	}
  11.164 -    }
  11.165 -  else
  11.166 -    {
  11.167 -      Gdk::Color color;
  11.168 -
  11.169 -      double w=actual_map[edge];
  11.170 -
  11.171 -      if(max!=min)
  11.172 -	{
  11.173 -	  color.set_rgb_p (0, 100*(w-min)/(max-min), 0);
  11.174 -	}
  11.175 -      else
  11.176 -	{
  11.177 -	  color.set_rgb_p (0, 100, 0);
  11.178 -	}
  11.179 -
  11.180 -      edgesmap[edge]->property_fill_color_gdk().set_value(color);
  11.181 -    }
  11.182 -  return 0;
  11.183 -};
  11.184 -
  11.185 -int GraphDisplayerCanvas::changeEdgeText (std::string mapname, Edge edge)
  11.186 -{
  11.187 -  //the number in the map will be written on the edge
  11.188 -  //EXCEPT when the name of the map is Default, because
  11.189 -  //in that case empty string will be written, because
  11.190 -  //that is the deleter map
  11.191 -  
  11.192 -  if(edge==INVALID)
  11.193 -    {
  11.194 -      for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
  11.195 -	{
  11.196 -	  edgemap_to_edit=mapname;
  11.197 -	  double number=(*((mytab.mapstorage).edgemap_storage)[mapname])[i];
  11.198 -	  
  11.199 -	  std::ostringstream ostr;
  11.200 -	  ostr << number;
  11.201 -	  
  11.202 -	  edgetextmap[i]->property_text().set_value(ostr.str());
  11.203 -	}
  11.204 -
  11.205 -    }
  11.206 -  else
  11.207 -    {
  11.208 -	  double number=(*((mytab.mapstorage).edgemap_storage)[mapname])[edge];
  11.209 -
  11.210 -	  std::ostringstream ostr;
  11.211 -	  ostr << number;
  11.212 -	  
  11.213 -	  edgetextmap[edge]->property_text().set_value(ostr.str());
  11.214 -    }
  11.215 -
  11.216 -  return 0;
  11.217 -
  11.218 -};
  11.219 -
  11.220 -int GraphDisplayerCanvas::resetEdgeText (Edge edge)
  11.221 -{
  11.222 -  //the number in the map will be written on the edge
  11.223 -  //EXCEPT when the name of the map is Default, because
  11.224 -  //in that case empty string will be written, because
  11.225 -  //that is the deleter map
  11.226 -  
  11.227 -  if(edge==INVALID)
  11.228 -    {
  11.229 -      for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
  11.230 -	{
  11.231 -	  edgemap_to_edit="";
  11.232 -	  edgetextmap[i]->property_text().set_value("");
  11.233 -	}
  11.234 -
  11.235 -    }
  11.236 -  else
  11.237 -    {
  11.238 -      edgetextmap[edge]->property_text().set_value("");
  11.239 -    }
  11.240 -
  11.241 -  return 0;
  11.242 -
  11.243 -};
    12.1 --- a/gui/graph_displayer_canvas-event.cc	Wed Jun 21 08:35:23 2006 +0000
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,862 +0,0 @@
    12.4 -#include "graph_displayer_canvas.h"
    12.5 -#include <cmath>
    12.6 -
    12.7 -
    12.8 -bool GraphDisplayerCanvas::on_expose_event(GdkEventExpose *event)
    12.9 -{
   12.10 -  Gnome::Canvas::CanvasAA::on_expose_event(event);
   12.11 -  //usleep(10000);
   12.12 -  //rezoom();
   12.13 -  return true;
   12.14 -}
   12.15 -
   12.16 -void GraphDisplayerCanvas::changeEditorialTool(int newtool)
   12.17 -{
   12.18 -  if(actual_tool!=newtool)
   12.19 -    {
   12.20 -
   12.21 -      actual_handler.disconnect();
   12.22 -
   12.23 -      switch(actual_tool)
   12.24 -	{
   12.25 -	case CREATE_EDGE:
   12.26 -	  {
   12.27 -	    GdkEvent * generated=new GdkEvent();
   12.28 -	    generated->type=GDK_BUTTON_RELEASE;
   12.29 -	    generated->button.button=3;
   12.30 -	    createEdgeEventHandler(generated);      
   12.31 -	    break;
   12.32 -	  }
   12.33 -	case EDGE_MAP_EDIT:
   12.34 -	  //has to do the same thing as in the case of NODE_MAP_EDIT
   12.35 -	case NODE_MAP_EDIT:
   12.36 -	  {
   12.37 -	    break;
   12.38 -	  }
   12.39 -	default:
   12.40 -	  break;
   12.41 -	}
   12.42 -
   12.43 -      active_item=NULL; 
   12.44 -      target_item=NULL; 
   12.45 -      active_edge=INVALID;	
   12.46 -      active_node=INVALID;	
   12.47 -
   12.48 -
   12.49 -      actual_tool=newtool;
   12.50 -  
   12.51 -      switch(newtool)
   12.52 -	{
   12.53 -	case MOVE:
   12.54 -	  actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::moveEventHandler), false);
   12.55 -	  break;
   12.56 -
   12.57 -	case CREATE_NODE:
   12.58 -	  actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::createNodeEventHandler), false);
   12.59 -	  break;
   12.60 -
   12.61 -	case CREATE_EDGE:
   12.62 -	  actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::createEdgeEventHandler), false);
   12.63 -	  break;
   12.64 -
   12.65 -	case ERASER:
   12.66 -	  actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::eraserEventHandler), false);
   12.67 -	  break;
   12.68 -
   12.69 -	case EDGE_MAP_EDIT:
   12.70 -	  grab_focus();
   12.71 -	  actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::edgeMapEditEventHandler), false);
   12.72 -	  break;
   12.73 -
   12.74 -	case NODE_MAP_EDIT:
   12.75 -	  actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::nodeMapEditEventHandler), false);
   12.76 -	  break;
   12.77 -
   12.78 -	default:
   12.79 -	  break;
   12.80 -	}
   12.81 -    }
   12.82 -}
   12.83 -
   12.84 -int GraphDisplayerCanvas::getActualTool()
   12.85 -{
   12.86 -  return actual_tool;
   12.87 -}
   12.88 -
   12.89 -bool GraphDisplayerCanvas::moveEventHandler(GdkEvent* e)
   12.90 -{
   12.91 -  static Gnome::Canvas::Text *coord_text = 0;
   12.92 -  switch(e->type)
   12.93 -  {
   12.94 -    case GDK_BUTTON_PRESS:
   12.95 -      //we mark the location of the event to be able to calculate parameters of dragging
   12.96 -      window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
   12.97 -
   12.98 -      active_item=(get_item_at(clicked_x, clicked_y));
   12.99 -      active_node=INVALID;
  12.100 -      for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
  12.101 -	{
  12.102 -	  if(nodesmap[i]==active_item)
  12.103 -	    {
  12.104 -	      active_node=i;
  12.105 -	    }
  12.106 -	}
  12.107 -      switch(e->button.button)
  12.108 -	{
  12.109 -	case 3:      
  12.110 -	  isbutton=3;
  12.111 -	  break;
  12.112 -	default:
  12.113 -	  isbutton=1;
  12.114 -	  break;
  12.115 -	}
  12.116 -      break;
  12.117 -    case GDK_BUTTON_RELEASE:
  12.118 -      if (coord_text)
  12.119 -      {
  12.120 -        delete coord_text;
  12.121 -        coord_text = 0;
  12.122 -      }
  12.123 -      isbutton=0;
  12.124 -      active_item=NULL;
  12.125 -      active_node=INVALID;
  12.126 -      break;
  12.127 -    case GDK_MOTION_NOTIFY:
  12.128 -      //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
  12.129 -      if(active_node!=INVALID)
  12.130 -      {
  12.131 -        (mytab.mapstorage).modified = true;
  12.132 -
  12.133 -	//new coordinates will be the old values,
  12.134 -	//because the item will be moved to the
  12.135 -	//new coordinate therefore the new movement
  12.136 -	//has to be calculated from here
  12.137 -
  12.138 -	double new_x, new_y;
  12.139 -
  12.140 -	window_to_world (e->motion.x, e->motion.y, new_x, new_y);
  12.141 -
  12.142 -        double dx=new_x-clicked_x;
  12.143 -        double dy=new_y-clicked_y;
  12.144 -
  12.145 -	//repositioning node and its text
  12.146 -        active_item->move(dx, dy);
  12.147 -	nodetextmap[active_node]->move(dx, dy);
  12.148 -
  12.149 -        // the new coordinates of the centre of the node 
  12.150 -        double coord_x = new_x - (clicked_x - (mytab.mapstorage).coords[active_node].x);
  12.151 -        double coord_y = new_y - (clicked_y - (mytab.mapstorage).coords[active_node].y);
  12.152 -
  12.153 -        // write back the new coordinates to the coords map
  12.154 -        (mytab.mapstorage).coords.set(active_node, xy<double>(coord_x, coord_y));
  12.155 -
  12.156 -        clicked_x=new_x;
  12.157 -        clicked_y=new_y;
  12.158 -
  12.159 -        // reposition the coordinates text
  12.160 -        std::ostringstream ostr;
  12.161 -        ostr << "(" <<
  12.162 -          (mytab.mapstorage).coords[active_node].x << ", " <<
  12.163 -          (mytab.mapstorage).coords[active_node].y << ")";
  12.164 -        double radius =
  12.165 -          (nodesmap[active_node]->property_x2().get_value() -
  12.166 -          nodesmap[active_node]->property_x1().get_value()) / 2.0;
  12.167 -        if (coord_text)
  12.168 -        {
  12.169 -          coord_text->property_text().set_value(ostr.str());
  12.170 -          coord_text->property_x().set_value((mytab.mapstorage).coords[active_node].x +
  12.171 -              radius);
  12.172 -          coord_text->property_y().set_value((mytab.mapstorage).coords[active_node].y -
  12.173 -              radius);
  12.174 -        }
  12.175 -        else
  12.176 -        {
  12.177 -          coord_text = new Gnome::Canvas::Text(
  12.178 -              displayed_graph,
  12.179 -              (mytab.mapstorage).coords[active_node].x + radius,
  12.180 -              (mytab.mapstorage).coords[active_node].y - radius,
  12.181 -              ostr.str());
  12.182 -          coord_text->property_fill_color().set_value("black");
  12.183 -          coord_text->property_anchor().set_value(Gtk::ANCHOR_SOUTH_WEST);
  12.184 -        }
  12.185 -
  12.186 -	//all the edges connected to the moved point has to be redrawn
  12.187 -        for(OutEdgeIt ei((mytab.mapstorage).graph,active_node);ei!=INVALID;++ei)
  12.188 -        {
  12.189 -            XY moved_node_1(coord_x - dx, coord_y - dy);
  12.190 -            XY moved_node_2(coord_x, coord_y);
  12.191 -            Node target = mytab.mapstorage.graph.target(ei);
  12.192 -            XY fix_node(mytab.mapstorage.coords[target].x,
  12.193 -                        mytab.mapstorage.coords[target].y);
  12.194 -            XY old_arrow_pos(mytab.mapstorage.arrow_pos[ei]);
  12.195 -
  12.196 -            XY arrow_pos;
  12.197 -	    if(isbutton==3)
  12.198 -              arrow_pos = calcArrowPos(moved_node_1, moved_node_2, fix_node, old_arrow_pos, false);
  12.199 -	    else
  12.200 -              arrow_pos = calcArrowPos(moved_node_1, moved_node_2, fix_node, old_arrow_pos, true);
  12.201 -
  12.202 -            mytab.mapstorage.arrow_pos.set(ei, arrow_pos);
  12.203 -            edgesmap[ei]->draw();
  12.204 -
  12.205 -	    //reposition of edgetext
  12.206 -	    XY text_pos=mytab.mapstorage.arrow_pos[ei];
  12.207 -	    text_pos+=(XY(10,10));
  12.208 -	    edgetextmap[ei]->property_x().set_value(text_pos.x);
  12.209 -	    edgetextmap[ei]->property_y().set_value(text_pos.y);
  12.210 -        }
  12.211 -
  12.212 -        for(InEdgeIt ei((mytab.mapstorage).graph,active_node);ei!=INVALID;++ei)
  12.213 -        {
  12.214 -            XY moved_node_1(coord_x - dx, coord_y - dy);
  12.215 -            XY moved_node_2(coord_x, coord_y);
  12.216 -            Node source = mytab.mapstorage.graph.source(ei);
  12.217 -            XY fix_node(mytab.mapstorage.coords[source].x,
  12.218 -                        mytab.mapstorage.coords[source].y);
  12.219 -            XY old_arrow_pos(mytab.mapstorage.arrow_pos[ei]);
  12.220 -
  12.221 -            XY arrow_pos;
  12.222 -	    if(isbutton==3)
  12.223 -              arrow_pos = calcArrowPos(moved_node_1, moved_node_2, fix_node, old_arrow_pos, false);
  12.224 -	    else
  12.225 -              arrow_pos = calcArrowPos(moved_node_1, moved_node_2, fix_node, old_arrow_pos, true);
  12.226 -
  12.227 -            mytab.mapstorage.arrow_pos.set(ei, arrow_pos);
  12.228 -            edgesmap[ei]->draw();
  12.229 -
  12.230 -	    //reposition of edgetext
  12.231 -	    XY text_pos=mytab.mapstorage.arrow_pos[ei];
  12.232 -	    text_pos+=(XY(10,10));
  12.233 -	    edgetextmap[ei]->property_x().set_value(text_pos.x);
  12.234 -	    edgetextmap[ei]->property_y().set_value(text_pos.y);
  12.235 -        }
  12.236 -      }
  12.237 -    default: break;
  12.238 -  }
  12.239 -
  12.240 -  return false;
  12.241 -}
  12.242 -
  12.243 -XY GraphDisplayerCanvas::calcArrowPos(XY moved_node_1, XY moved_node_2, XY fix_node, XY old_arrow_pos, bool move)
  12.244 -{
  12.245 -  if(!move)
  12.246 -  {
  12.247 -    return XY((moved_node_2.x + fix_node.x) / 2.0, (moved_node_2.y + fix_node.y) / 2.0);
  12.248 -  }
  12.249 -  else
  12.250 -  {
  12.251 -    //////////////////////////////////////////////////////////////////////////////////////////////////////
  12.252 -    /////////// keeps shape-with scalar multiplication - version 2.
  12.253 -    //////////////////////////////////////////////////////////////////////////////////////////////////////
  12.254 -
  12.255 -    //old vector from one to the other node - a
  12.256 -    xy<double> a_v(moved_node_1.x-fix_node.x,moved_node_1.y-fix_node.y);
  12.257 -    //new vector from one to the other node - b
  12.258 -    xy<double> b_v(moved_node_2.x-fix_node.x,moved_node_2.y-fix_node.y);
  12.259 -
  12.260 -    double absa=sqrt(a_v.normSquare());
  12.261 -    double absb=sqrt(b_v.normSquare());
  12.262 -
  12.263 -    if ((absa == 0.0) || (absb == 0.0))
  12.264 -    {
  12.265 -      return old_arrow_pos;
  12.266 -    }
  12.267 -    else
  12.268 -    {
  12.269 -      //old vector from one node to the breakpoint - c
  12.270 -      xy<double> c_v(old_arrow_pos.x-fix_node.x,old_arrow_pos.y-fix_node.y);
  12.271 -
  12.272 -      //unit vector with the same direction to a_v
  12.273 -      xy<double> a_v_u(a_v.x/absa,a_v.y/absa);
  12.274 -
  12.275 -      //normal vector of unit vector with the same direction to a_v
  12.276 -      xy<double> a_v_u_n(((-1)*a_v_u.y),a_v_u.x);
  12.277 -
  12.278 -      //unit vector with the same direction to b_v
  12.279 -      xy<double> b_v_u(b_v.x/absb,b_v.y/absb);
  12.280 -
  12.281 -      //normal vector of unit vector with the same direction to b_v
  12.282 -      xy<double> b_v_u_n(((-1)*b_v_u.y),b_v_u.x);
  12.283 -
  12.284 -      //vector c in a_v_u and a_v_u_n co-ordinate system
  12.285 -      xy<double> c_a(c_v*a_v_u,c_v*a_v_u_n);
  12.286 -
  12.287 -      //new vector from one node to the breakpoint - d - we have to calculate this one
  12.288 -      xy<double> d_v=absb/absa*(c_a.x*b_v_u+c_a.y*b_v_u_n);
  12.289 -
  12.290 -      return XY(d_v.x+fix_node.x,d_v.y+fix_node.y);
  12.291 -    }
  12.292 -  }
  12.293 -}
  12.294 -
  12.295 -bool GraphDisplayerCanvas::createNodeEventHandler(GdkEvent* e)
  12.296 -{
  12.297 -  switch(e->type)
  12.298 -  {
  12.299 -    //move the new node
  12.300 -    case GDK_MOTION_NOTIFY:
  12.301 -      {
  12.302 -        GdkEvent * generated=new GdkEvent();
  12.303 -        generated->motion.x=e->motion.x;
  12.304 -        generated->motion.y=e->motion.y;
  12.305 -        generated->type=GDK_MOTION_NOTIFY;
  12.306 -        moveEventHandler(generated);      
  12.307 -        break;
  12.308 -      }
  12.309 -
  12.310 -    case GDK_BUTTON_RELEASE:
  12.311 -      (mytab.mapstorage).modified = true;
  12.312 -
  12.313 -      isbutton=1;
  12.314 -
  12.315 -      active_node=(mytab.mapstorage).graph.addNode();
  12.316 -
  12.317 -      //initiating values corresponding to new node in maps
  12.318 -
  12.319 -      window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
  12.320 -
  12.321 -      // update coordinates
  12.322 -      (mytab.mapstorage).coords.set(active_node, xy<double>(clicked_x, clicked_y));
  12.323 -
  12.324 -      // update all other maps
  12.325 -      for (std::map<std::string, Graph::NodeMap<double>*>::const_iterator it =
  12.326 -          (mytab.mapstorage).nodemap_storage.begin(); it !=
  12.327 -          (mytab.mapstorage).nodemap_storage.end(); ++it)
  12.328 -      {
  12.329 -        if ((it->first != "coordinates_x") &&
  12.330 -            (it->first != "coordinates_y"))
  12.331 -        {
  12.332 -          (*(it->second))[active_node] =
  12.333 -            (mytab.mapstorage).nodemap_default[it->first];
  12.334 -        }
  12.335 -      }
  12.336 -      // increment the id map's default value
  12.337 -      (mytab.mapstorage).nodemap_default["label"] += 1.0;
  12.338 -
  12.339 -      nodesmap[active_node]=new Gnome::Canvas::Ellipse(displayed_graph,
  12.340 -          clicked_x-20, clicked_y-20, clicked_x+20, clicked_y+20);
  12.341 -      active_item=(Gnome::Canvas::Item *)(nodesmap[active_node]);
  12.342 -      *(nodesmap[active_node]) <<
  12.343 -        Gnome::Canvas::Properties::fill_color("blue");
  12.344 -      *(nodesmap[active_node]) <<
  12.345 -        Gnome::Canvas::Properties::outline_color("black");
  12.346 -      active_item->raise_to_top();
  12.347 -
  12.348 -      (nodesmap[active_node])->show();
  12.349 -
  12.350 -      nodetextmap[active_node]=new Gnome::Canvas::Text(displayed_graph,
  12.351 -          clicked_x+node_property_defaults[N_RADIUS]+5,
  12.352 -          clicked_y+node_property_defaults[N_RADIUS]+5, "");
  12.353 -      nodetextmap[active_node]->property_fill_color().set_value("darkblue");
  12.354 -      nodetextmap[active_node]->raise_to_top();
  12.355 -
  12.356 -//       mapwin.updateNode(active_node);
  12.357 -      propertyUpdate(active_node);
  12.358 -
  12.359 -      isbutton=0;
  12.360 -      target_item=NULL;
  12.361 -      active_item=NULL;
  12.362 -      active_node=INVALID;
  12.363 -      break;
  12.364 -    default:
  12.365 -      break;
  12.366 -  }
  12.367 -  return false;
  12.368 -}
  12.369 -
  12.370 -bool GraphDisplayerCanvas::createEdgeEventHandler(GdkEvent* e)
  12.371 -{
  12.372 -  switch(e->type)
  12.373 -  {
  12.374 -    case GDK_BUTTON_PRESS:
  12.375 -      //in edge creation right button has special meaning
  12.376 -      if(e->button.button!=3)
  12.377 -      {
  12.378 -        //there is not yet selected node
  12.379 -        if(active_node==INVALID)
  12.380 -        {
  12.381 -          //we mark the location of the event to be able to calculate parameters of dragging
  12.382 -
  12.383 -          window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
  12.384 -
  12.385 -          active_item=(get_item_at(clicked_x, clicked_y));
  12.386 -          active_node=INVALID;
  12.387 -          for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
  12.388 -          {
  12.389 -            if(nodesmap[i]==active_item)
  12.390 -            {
  12.391 -              active_node=i;
  12.392 -            }
  12.393 -          }
  12.394 -          //the clicked item is really a node
  12.395 -          if(active_node!=INVALID)
  12.396 -          {
  12.397 -            *(nodesmap[active_node]) << Gnome::Canvas::Properties::fill_color("red");
  12.398 -            isbutton=1;
  12.399 -          }
  12.400 -          //clicked item was not a node. It could be e.g. edge.
  12.401 -          else
  12.402 -          {
  12.403 -            active_item=NULL;
  12.404 -          }
  12.405 -        }
  12.406 -        //we only have to do sg. if the mouse button
  12.407 -        // is pressed already once AND the click was
  12.408 -        // on a node that was found in the set of 
  12.409 -        //nodes, and now we only search for the second 
  12.410 -        //node
  12.411 -        else
  12.412 -        {
  12.413 -          window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
  12.414 -          target_item=(get_item_at(clicked_x, clicked_y));
  12.415 -          Node target_node=INVALID;
  12.416 -          for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
  12.417 -          {
  12.418 -            if(nodesmap[i]==target_item)
  12.419 -            {
  12.420 -              target_node=i;
  12.421 -            }
  12.422 -          }
  12.423 -          //the clicked item is a node, the edge can be drawn
  12.424 -          if(target_node!=INVALID)
  12.425 -          {
  12.426 -            if(target_node!=active_node)		
  12.427 -            {
  12.428 -              (mytab.mapstorage).modified = true;
  12.429 -
  12.430 -              *(nodesmap[target_node]) <<
  12.431 -                Gnome::Canvas::Properties::fill_color("red");
  12.432 -
  12.433 -              //creating new edge
  12.434 -              active_edge=(mytab.mapstorage).graph.addEdge(active_node,
  12.435 -                  target_node);
  12.436 -
  12.437 -              // update maps
  12.438 -              for (std::map<std::string,
  12.439 -                  Graph::EdgeMap<double>*>::const_iterator it =
  12.440 -                  (mytab.mapstorage).edgemap_storage.begin(); it !=
  12.441 -                  (mytab.mapstorage).edgemap_storage.end(); ++it)
  12.442 -              {
  12.443 -                (*(it->second))[active_edge] =
  12.444 -                  (mytab.mapstorage).edgemap_default[it->first];
  12.445 -              }
  12.446 -              // increment the id map's default value
  12.447 -              (mytab.mapstorage).edgemap_default["label"] += 1.0;
  12.448 -
  12.449 -              //calculating coordinates of new edge
  12.450 -              Gnome::Canvas::Points coos;
  12.451 -              double x1, x2, y1, y2;
  12.452 -
  12.453 -              active_item->get_bounds(x1, y1, x2, y2);
  12.454 -              coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
  12.455 -
  12.456 -              target_item->get_bounds(x1, y1, x2, y2);
  12.457 -              coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
  12.458 -
  12.459 -              // set the coordinates of the arrow on the new edge
  12.460 -              MapStorage& ms = mytab.mapstorage;
  12.461 -              ms.arrow_pos.set(active_edge,
  12.462 -                  (ms.coords[ms.graph.source(active_edge)] +
  12.463 -                   ms.coords[ms.graph.target(active_edge)])/ 2.0);
  12.464 -
  12.465 -              //drawing new edge
  12.466 -              edgesmap[active_edge]=new BrokenEdge(displayed_graph, active_edge,
  12.467 -                  *this);
  12.468 -              *(edgesmap[active_edge]) <<
  12.469 -                Gnome::Canvas::Properties::fill_color("green");
  12.470 -              edgesmap[active_edge]->property_width_pixels().set_value(10);
  12.471 -
  12.472 -              edgesmap[active_edge]->lower_to_bottom();
  12.473 -
  12.474 -              //initializing edge-text as well, to empty string
  12.475 -              XY text_pos=mytab.mapstorage.arrow_pos[active_edge];
  12.476 -              text_pos+=(XY(10,10));
  12.477 -
  12.478 -              edgetextmap[active_edge]=new Gnome::Canvas::Text(displayed_graph,
  12.479 -                  text_pos.x, text_pos.y, "");
  12.480 -              edgetextmap[active_edge]->property_fill_color().set_value(
  12.481 -                  "darkgreen");
  12.482 -              edgetextmap[active_edge]->raise_to_top();
  12.483 -
  12.484 -              //updating its properties
  12.485 -//               mapwin.updateEdge(active_edge);
  12.486 -              propertyUpdate(active_edge);
  12.487 -            }
  12.488 -            else
  12.489 -            {
  12.490 -              target_node=INVALID;
  12.491 -              std::cerr << "Loop edge is not yet implemented!" << std::endl;
  12.492 -            }
  12.493 -          }
  12.494 -          //clicked item was not a node. it could be an e.g. edge. we do not
  12.495 -          //deal with it furthermore.
  12.496 -          else
  12.497 -          {
  12.498 -            target_item=NULL;
  12.499 -          }
  12.500 -        }
  12.501 -      }
  12.502 -      break;
  12.503 -    case GDK_BUTTON_RELEASE:
  12.504 -      isbutton=0;
  12.505 -      //we clear settings in two cases
  12.506 -      //1: the edge is ready (target_item has valid value)
  12.507 -      //2: the edge creation is cancelled with right button
  12.508 -      if((target_item)||(e->button.button==3))
  12.509 -      {
  12.510 -        if(active_item)
  12.511 -        {
  12.512 -          *active_item << Gnome::Canvas::Properties::fill_color("blue");
  12.513 -          active_item=NULL;
  12.514 -        }
  12.515 -        if(target_item)
  12.516 -        {
  12.517 -          *target_item << Gnome::Canvas::Properties::fill_color("blue");
  12.518 -          target_item=NULL;
  12.519 -        }
  12.520 -        active_node=INVALID;
  12.521 -        active_edge=INVALID;
  12.522 -      }
  12.523 -      break;
  12.524 -    default:
  12.525 -      break;
  12.526 -  }
  12.527 -  return false;
  12.528 -}
  12.529 -
  12.530 -bool GraphDisplayerCanvas::eraserEventHandler(GdkEvent* e)
  12.531 -{
  12.532 -  switch(e->type)
  12.533 -    {
  12.534 -    case GDK_BUTTON_PRESS:
  12.535 -      //finding the clicked items
  12.536 -      window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
  12.537 -      active_item=(get_item_at(clicked_x, clicked_y));
  12.538 -      active_node=INVALID;
  12.539 -      active_edge=INVALID;
  12.540 -      //was it a node?
  12.541 -      for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
  12.542 -	{
  12.543 -	  if(nodesmap[i]==active_item)
  12.544 -	    {
  12.545 -	      active_node=i;
  12.546 -	    }
  12.547 -	}
  12.548 -      //or was it an edge?
  12.549 -      if(active_node==INVALID)
  12.550 -	{
  12.551 -	  for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
  12.552 -	    {
  12.553 -	      if(edgesmap[i]==active_item)
  12.554 -		{
  12.555 -		  active_edge=i;
  12.556 -		}
  12.557 -	    }
  12.558 -	}
  12.559 -
  12.560 -      // return if the clicked object is neither an edge nor a node
  12.561 -      if (active_edge == INVALID) return false;
  12.562 -      
  12.563 -      //recolor activated item
  12.564 -      if(active_item)
  12.565 -	{
  12.566 -	  *active_item << Gnome::Canvas::Properties::fill_color("red");
  12.567 -	}
  12.568 -      break;
  12.569 -
  12.570 -    case GDK_BUTTON_RELEASE:
  12.571 -      window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
  12.572 -      if(active_item)
  12.573 -	{
  12.574 -	  //the cursor was not moved since pressing it
  12.575 -	  if( active_item == ( get_item_at (clicked_x, clicked_y) ) )
  12.576 -	    {
  12.577 -	      //a node was found
  12.578 -	      if(active_node!=INVALID)
  12.579 -		{
  12.580 -                  (mytab.mapstorage).modified = true;
  12.581 -
  12.582 -		  std::set<Graph::Edge> edges_to_delete;
  12.583 -
  12.584 -		  for(OutEdgeIt e((mytab.mapstorage).graph,active_node);e!=INVALID;++e)
  12.585 -		    {
  12.586 -		      edges_to_delete.insert(e);
  12.587 -		    }
  12.588 -		  
  12.589 -		  for(InEdgeIt e((mytab.mapstorage).graph,active_node);e!=INVALID;++e)
  12.590 -		    {
  12.591 -		      edges_to_delete.insert(e);
  12.592 -		    }
  12.593 -		  
  12.594 -		  //deleting collected edges
  12.595 -		  for(std::set<Graph::Edge>::iterator
  12.596 -			edge_set_it=edges_to_delete.begin();
  12.597 -		      edge_set_it!=edges_to_delete.end();
  12.598 -		      ++edge_set_it)
  12.599 -		    {
  12.600 -		      deleteItem(*edge_set_it);
  12.601 -		    }
  12.602 -		  deleteItem(active_node);
  12.603 -		}
  12.604 -	      //a simple edge was chosen
  12.605 -	      else if (active_edge != INVALID)
  12.606 -		{
  12.607 -		  deleteItem(active_edge);
  12.608 -		}
  12.609 -	    }
  12.610 -	  //pointer was moved, deletion is cancelled
  12.611 -	  else
  12.612 -	    {
  12.613 -	      if(active_node!=INVALID)
  12.614 -		{
  12.615 -		  *active_item << Gnome::Canvas::Properties::fill_color("blue");
  12.616 -		}
  12.617 -	      else if (active_edge != INVALID)
  12.618 -		{
  12.619 -		  *active_item << Gnome::Canvas::Properties::fill_color("green");
  12.620 -		}
  12.621 -	    }
  12.622 -	}
  12.623 -      //reseting datas
  12.624 -      active_item=NULL;
  12.625 -      active_edge=INVALID;
  12.626 -      active_node=INVALID;
  12.627 -      break;
  12.628 -
  12.629 -    case GDK_MOTION_NOTIFY:
  12.630 -      break;
  12.631 -
  12.632 -    default:
  12.633 -      break;
  12.634 -    }
  12.635 -  return false;
  12.636 -}
  12.637 -
  12.638 -bool GraphDisplayerCanvas::edgeMapEditEventHandler(GdkEvent* e)
  12.639 -{
  12.640 -  if(actual_tool==EDGE_MAP_EDIT)
  12.641 -  {
  12.642 -    switch(e->type)
  12.643 -    {
  12.644 -      case GDK_BUTTON_PRESS:
  12.645 -        {
  12.646 -          //for determine, whether it was an edge
  12.647 -          Edge clicked_edge=INVALID;
  12.648 -
  12.649 -          window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
  12.650 -          active_item=(get_item_at(clicked_x, clicked_y));
  12.651 -
  12.652 -          //find the activated item between texts
  12.653 -          for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
  12.654 -          {
  12.655 -            //at the same time only one can be active
  12.656 -            if(edgetextmap[i]==active_item)
  12.657 -            {
  12.658 -              clicked_edge=i;
  12.659 -            }
  12.660 -          }
  12.661 -
  12.662 -          //if it was not between texts, search for it between edges
  12.663 -          if(clicked_edge==INVALID)
  12.664 -          {
  12.665 -            for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
  12.666 -            {
  12.667 -              //at the same time only one can be active
  12.668 -              if((edgesmap[i]==active_item)||(edgetextmap[i]==active_item))
  12.669 -              {
  12.670 -                clicked_edge=i;
  12.671 -              }
  12.672 -            }
  12.673 -          }
  12.674 - 
  12.675 -          //if it was really an edge...
  12.676 -          if(clicked_edge!=INVALID)
  12.677 -          {
  12.678 -            // the id map is not editable
  12.679 -            if (edgemap_to_edit == "label") return 0;
  12.680 -
  12.681 -            //and there is activated map
  12.682 -            if(edgetextmap[clicked_edge]->property_text().get_value()!="")
  12.683 -            {
  12.684 -              //activate the general variable for it
  12.685 -              active_edge=clicked_edge;
  12.686 -
  12.687 -              //create a dialog
  12.688 -              Gtk::Dialog dialog("Edit value", true);
  12.689 -              dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
  12.690 -              dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_ACCEPT);
  12.691 -              Gtk::VBox* vbox = dialog.get_vbox();
  12.692 -              Gtk::SpinButton spin(0.0, 4);
  12.693 -              spin.set_increments(1.0, 10.0);
  12.694 -              spin.set_range(-1000000.0, 1000000.0);
  12.695 -              spin.set_numeric(true);
  12.696 -              vbox->add(spin);
  12.697 -              spin.show();
  12.698 -              switch (dialog.run())
  12.699 -              {
  12.700 -                case Gtk::RESPONSE_NONE:
  12.701 -                case Gtk::RESPONSE_CANCEL:
  12.702 -                  break;
  12.703 -                case Gtk::RESPONSE_ACCEPT:
  12.704 -                  double new_value = spin.get_value();
  12.705 -                  (*(mytab.mapstorage).edgemap_storage[edgemap_to_edit])[active_edge] =
  12.706 -                    new_value;
  12.707 -                  std::ostringstream ostr;
  12.708 -                  ostr << new_value;
  12.709 -                  edgetextmap[active_edge]->property_text().set_value(
  12.710 -                      ostr.str());
  12.711 -                  //mapwin.updateEdge(active_edge);
  12.712 -//                   mapwin.updateEdge(Edge(INVALID));
  12.713 -                  propertyUpdate(Edge(INVALID));
  12.714 -              }
  12.715 -            }
  12.716 -          }
  12.717 -          break;
  12.718 -        }
  12.719 -      default:
  12.720 -        break;
  12.721 -    }
  12.722 -  }
  12.723 -  return false;  
  12.724 -}
  12.725 -
  12.726 -bool GraphDisplayerCanvas::nodeMapEditEventHandler(GdkEvent* e)
  12.727 -{
  12.728 -  if(actual_tool==NODE_MAP_EDIT)
  12.729 -  {
  12.730 -    switch(e->type)
  12.731 -    {
  12.732 -      case GDK_BUTTON_PRESS:
  12.733 -        {
  12.734 -          //for determine, whether it was a node
  12.735 -          Node clicked_node=INVALID;
  12.736 -
  12.737 -          window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
  12.738 -          active_item=(get_item_at(clicked_x, clicked_y));
  12.739 -
  12.740 -          //find the activated item between texts
  12.741 -          for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
  12.742 -          {
  12.743 -            //at the same time only one can be active
  12.744 -            if(nodetextmap[i]==active_item)
  12.745 -            {
  12.746 -              clicked_node=i;
  12.747 -            }
  12.748 -          }
  12.749 -
  12.750 -          //if there was not, search for it between nodes
  12.751 -          if(clicked_node==INVALID)
  12.752 -          {
  12.753 -            for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
  12.754 -            {
  12.755 -              //at the same time only one can be active
  12.756 -              if(nodesmap[i]==active_item)
  12.757 -              {
  12.758 -                clicked_node=i;
  12.759 -              }
  12.760 -            }
  12.761 -          }
  12.762 -
  12.763 -          //if it was really a node...
  12.764 -          if(clicked_node!=INVALID)
  12.765 -          {
  12.766 -            // the id map is not editable
  12.767 -            if (nodemap_to_edit == "label") return 0;
  12.768 -
  12.769 -            //and there is activated map
  12.770 -            if(nodetextmap[clicked_node]->property_text().get_value()!="")
  12.771 -            {
  12.772 -              //activate the general variable for it
  12.773 -              active_node=clicked_node;
  12.774 -
  12.775 -              //create a dialog
  12.776 -              Gtk::Dialog dialog("Edit value", true);
  12.777 -              dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
  12.778 -              dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_ACCEPT);
  12.779 -              Gtk::VBox* vbox = dialog.get_vbox();
  12.780 -              Gtk::SpinButton spin(0.0, 4);
  12.781 -              spin.set_increments(1.0, 10.0);
  12.782 -              spin.set_range(-1000000.0, 1000000.0);
  12.783 -              spin.set_numeric(true);
  12.784 -              vbox->add(spin);
  12.785 -              spin.show();
  12.786 -              switch (dialog.run())
  12.787 -              {
  12.788 -                case Gtk::RESPONSE_NONE:
  12.789 -                case Gtk::RESPONSE_CANCEL:
  12.790 -                  break;
  12.791 -                case Gtk::RESPONSE_ACCEPT:
  12.792 -                  double new_value = spin.get_value();
  12.793 -                  (*(mytab.mapstorage).nodemap_storage[nodemap_to_edit])[active_node] =
  12.794 -                    new_value;
  12.795 -                  std::ostringstream ostr;
  12.796 -                  ostr << new_value;
  12.797 -                  nodetextmap[active_node]->property_text().set_value(
  12.798 -                      ostr.str());
  12.799 -                  //mapwin.updateNode(active_node);
  12.800 -//                   mapwin.updateNode(Node(INVALID));
  12.801 -                  propertyUpdate(Node(INVALID));
  12.802 -              }
  12.803 -            }
  12.804 -          }
  12.805 -          break;
  12.806 -        }
  12.807 -      default:
  12.808 -        break;
  12.809 -    }
  12.810 -  }
  12.811 -  return false;  
  12.812 -}
  12.813 -
  12.814 -void GraphDisplayerCanvas::deleteItem(Node node_to_delete)
  12.815 -{
  12.816 -  delete(nodetextmap[node_to_delete]);
  12.817 -  delete(nodesmap[node_to_delete]);
  12.818 -  (mytab.mapstorage).graph.erase(node_to_delete);
  12.819 -}
  12.820 -
  12.821 -void GraphDisplayerCanvas::deleteItem(Edge edge_to_delete)
  12.822 -{
  12.823 -  delete(edgetextmap[edge_to_delete]);
  12.824 -  delete(edgesmap[edge_to_delete]);
  12.825 -  (mytab.mapstorage).graph.erase(edge_to_delete);
  12.826 -}
  12.827 -
  12.828 -void GraphDisplayerCanvas::textReposition(xy<double> new_place)
  12.829 -{
  12.830 -  new_place+=(xy<double>(10,10));
  12.831 -  edgetextmap[forming_edge]->property_x().set_value(new_place.x);
  12.832 -  edgetextmap[forming_edge]->property_y().set_value(new_place.y);
  12.833 -}
  12.834 -
  12.835 -void GraphDisplayerCanvas::toggleEdgeActivity(BrokenEdge* active_bre, bool on)
  12.836 -{
  12.837 -  if(on)
  12.838 -    {
  12.839 -      if(forming_edge!=INVALID)
  12.840 -	{
  12.841 -	  std::cerr << "ERROR!!!! Valid edge found!" << std::endl;
  12.842 -	}
  12.843 -      else
  12.844 -	{
  12.845 -	  for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
  12.846 -	    {
  12.847 -	      if(edgesmap[i]==active_bre)
  12.848 -		{
  12.849 -		  forming_edge=i;
  12.850 -		}
  12.851 -	    }
  12.852 -	}
  12.853 -    }
  12.854 -  else
  12.855 -    {
  12.856 -      if(forming_edge!=INVALID)
  12.857 -	{
  12.858 -	  forming_edge=INVALID;
  12.859 -	}
  12.860 -      else
  12.861 -	{
  12.862 -	  std::cerr << "ERROR!!!! Invalid edge found!" << std::endl;
  12.863 -	}
  12.864 -    }
  12.865 -}
    13.1 --- a/gui/graph_displayer_canvas-node.cc	Wed Jun 21 08:35:23 2006 +0000
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,286 +0,0 @@
    13.4 -#include "graph_displayer_canvas.h"
    13.5 -#include <cmath>
    13.6 -
    13.7 -
    13.8 -int GraphDisplayerCanvas::changeNodeRadius (std::string mapname, Node node)
    13.9 -{
   13.10 -  Graph::NodeMap<double> * actual_map;
   13.11 -  double min, max;
   13.12 -  min=(mytab.mapstorage).minOfNodeMap(mapname);
   13.13 -  max=(mytab.mapstorage).maxOfNodeMap(mapname);
   13.14 -  actual_map=((mytab.mapstorage).nodemap_storage)[mapname];
   13.15 -
   13.16 -  if(node==INVALID)
   13.17 -    {
   13.18 -      for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
   13.19 -	{
   13.20 -	  double v=fabs((*actual_map)[i]);
   13.21 -	  int w;
   13.22 -	  if(min==max)
   13.23 -	    {
   13.24 -	      w=(int)(node_property_defaults[N_RADIUS]);
   13.25 -	    }
   13.26 -	  else
   13.27 -	    {
   13.28 -	      w=(int)(MIN_NODE_RADIUS+(v-min)/(max-min)*(MAX_NODE_RADIUS-MIN_NODE_RADIUS));
   13.29 -	    }
   13.30 -	  if(w>=0)
   13.31 -	    {
   13.32 -	      double x1, y1, x2, y2;
   13.33 -	      x1=nodesmap[i]->property_x1().get_value();
   13.34 -	      x2=nodesmap[i]->property_x2().get_value();
   13.35 -	      y1=nodesmap[i]->property_y1().get_value();
   13.36 -	      y2=nodesmap[i]->property_y2().get_value();
   13.37 -	      nodesmap[i]->property_x1().set_value((x1+x2)/2-w);
   13.38 -	      nodesmap[i]->property_x2().set_value((x1+x2)/2+w);
   13.39 -	      nodesmap[i]->property_y1().set_value((y1+y2)/2-w);
   13.40 -	      nodesmap[i]->property_y2().set_value((y1+y2)/2+w);
   13.41 -	    }
   13.42 -	}
   13.43 -    }
   13.44 -  else
   13.45 -    {
   13.46 -      //I think only new nodes use this case
   13.47 -//       int w=(int)(*actual_map)[node];
   13.48 -      int w=(int)(node_property_defaults[N_RADIUS]);
   13.49 -      if(w>=0)
   13.50 -	{
   13.51 -	  double x1, y1, x2, y2;
   13.52 -	  x1=nodesmap[node]->property_x1().get_value();
   13.53 -	  x2=nodesmap[node]->property_x2().get_value();
   13.54 -	  y1=nodesmap[node]->property_y1().get_value();
   13.55 -	  y2=nodesmap[node]->property_y2().get_value();
   13.56 -	  nodesmap[node]->property_x1().set_value((x1+x2)/2-w);
   13.57 -	  nodesmap[node]->property_x2().set_value((x1+x2)/2+w);
   13.58 -	  nodesmap[node]->property_y1().set_value((y1+y2)/2-w);
   13.59 -	  nodesmap[node]->property_y2().set_value((y1+y2)/2+w);
   13.60 -	}
   13.61 -    }
   13.62 -  return 0;
   13.63 -};
   13.64 -
   13.65 -int GraphDisplayerCanvas::resetNodeRadius (Node node)
   13.66 -{
   13.67 -  double min, max;
   13.68 -  min=node_property_defaults[N_RADIUS];
   13.69 -  max=node_property_defaults[N_RADIUS];
   13.70 -  Graph::NodeMap<double> actual_map((mytab.mapstorage).graph,node_property_defaults[N_RADIUS]);
   13.71 -  
   13.72 -  if(node==INVALID)
   13.73 -    {
   13.74 -      for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
   13.75 -	{
   13.76 -	  double v=fabs(actual_map[i]);
   13.77 -	  int w;
   13.78 -	  if(min==max)
   13.79 -	    {
   13.80 -	      w=(int)(node_property_defaults[N_RADIUS]);
   13.81 -	    }
   13.82 -	  else
   13.83 -	    {
   13.84 -	      w=(int)(MIN_NODE_RADIUS+(v-min)/(max-min)*(MAX_NODE_RADIUS-MIN_NODE_RADIUS));
   13.85 -	    }
   13.86 -	  if(w>=0)
   13.87 -	    {
   13.88 -	      double x1, y1, x2, y2;
   13.89 -	      x1=nodesmap[i]->property_x1().get_value();
   13.90 -	      x2=nodesmap[i]->property_x2().get_value();
   13.91 -	      y1=nodesmap[i]->property_y1().get_value();
   13.92 -	      y2=nodesmap[i]->property_y2().get_value();
   13.93 -	      nodesmap[i]->property_x1().set_value((x1+x2)/2-w);
   13.94 -	      nodesmap[i]->property_x2().set_value((x1+x2)/2+w);
   13.95 -	      nodesmap[i]->property_y1().set_value((y1+y2)/2-w);
   13.96 -	      nodesmap[i]->property_y2().set_value((y1+y2)/2+w);
   13.97 -	    }
   13.98 -	}
   13.99 -    }
  13.100 -  else
  13.101 -    {
  13.102 -      //I think only new nodes use this case
  13.103 -//       int w=(int)actual_map[node];
  13.104 -      int w=(int)(node_property_defaults[N_RADIUS]);
  13.105 -      if(w>=0)
  13.106 -	{
  13.107 -	  double x1, y1, x2, y2;
  13.108 -	  x1=nodesmap[node]->property_x1().get_value();
  13.109 -	  x2=nodesmap[node]->property_x2().get_value();
  13.110 -	  y1=nodesmap[node]->property_y1().get_value();
  13.111 -	  y2=nodesmap[node]->property_y2().get_value();
  13.112 -	  nodesmap[node]->property_x1().set_value((x1+x2)/2-w);
  13.113 -	  nodesmap[node]->property_x2().set_value((x1+x2)/2+w);
  13.114 -	  nodesmap[node]->property_y1().set_value((y1+y2)/2-w);
  13.115 -	  nodesmap[node]->property_y2().set_value((y1+y2)/2+w);
  13.116 -	}
  13.117 -    }
  13.118 -  return 0;
  13.119 -};
  13.120 -
  13.121 -int GraphDisplayerCanvas::changeNodeColor (std::string mapname, Node node)
  13.122 -{  
  13.123 -
  13.124 -  //function maps the range of the maximum and
  13.125 -  //the minimum of the nodemap to the range of
  13.126 -  //green in RGB
  13.127 -
  13.128 -  Graph::NodeMap<double> * actual_map;
  13.129 -  actual_map=((mytab.mapstorage).nodemap_storage)[mapname];
  13.130 -
  13.131 -  double max, min;
  13.132 -
  13.133 -  max=(mytab.mapstorage).maxOfNodeMap(mapname);
  13.134 -  min=(mytab.mapstorage).minOfNodeMap(mapname);
  13.135 -
  13.136 -  if(node==INVALID)
  13.137 -    {
  13.138 -
  13.139 -      for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
  13.140 -	{
  13.141 -	  Gdk::Color color;
  13.142 -
  13.143 -	  double w=(*actual_map)[i];
  13.144 -
  13.145 -	  if(max!=min)
  13.146 -	    {
  13.147 -	      color.set_rgb_p (0, 0, 100*(w-min)/(max-min));
  13.148 -	    }
  13.149 -	  else
  13.150 -	    {
  13.151 -	      color.set_rgb_p (0, 0, 100);
  13.152 -	    }
  13.153 -
  13.154 -	  nodesmap[i]->property_fill_color_gdk().set_value(color);
  13.155 -	}
  13.156 -    }
  13.157 -  else
  13.158 -    {
  13.159 -      Gdk::Color color;
  13.160 -
  13.161 -      double w=(*actual_map)[node];
  13.162 -
  13.163 -      if(max!=min)
  13.164 -	{
  13.165 -	  color.set_rgb_p (0, 0, 100*(w-min)/(max-min));
  13.166 -	}
  13.167 -      else
  13.168 -	{
  13.169 -	  color.set_rgb_p (0, 0, 100);
  13.170 -	}
  13.171 -
  13.172 -      nodesmap[node]->property_fill_color_gdk().set_value(color);
  13.173 -    }
  13.174 -  return 0;
  13.175 -};
  13.176 -
  13.177 -int GraphDisplayerCanvas::resetNodeColor (Node node)
  13.178 -{  
  13.179 -
  13.180 -  //function maps the range of the maximum and
  13.181 -  //the minimum of the nodemap to the range of
  13.182 -  //green in RGB
  13.183 -
  13.184 -  Graph::NodeMap<double> actual_map((mytab.mapstorage).graph,node_property_defaults[N_COLOR]);
  13.185 -
  13.186 -  double max, min;
  13.187 -
  13.188 -  max=node_property_defaults[N_COLOR];
  13.189 -  min=node_property_defaults[N_COLOR];
  13.190 -
  13.191 -  if(node==INVALID)
  13.192 -    {
  13.193 -
  13.194 -      for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
  13.195 -	{
  13.196 -	  Gdk::Color color;
  13.197 -
  13.198 -	  double w=actual_map[i];
  13.199 -
  13.200 -	  if(max!=min)
  13.201 -	    {
  13.202 -	      color.set_rgb_p (0, 0, 100*(w-min)/(max-min));
  13.203 -	    }
  13.204 -	  else
  13.205 -	    {
  13.206 -	      color.set_rgb_p (0, 0, 100);
  13.207 -	    }
  13.208 -
  13.209 -	  nodesmap[i]->property_fill_color_gdk().set_value(color);
  13.210 -	}
  13.211 -    }
  13.212 -  else
  13.213 -    {
  13.214 -      Gdk::Color color;
  13.215 -
  13.216 -      double w=actual_map[node];
  13.217 -
  13.218 -      if(max!=min)
  13.219 -	{
  13.220 -	  color.set_rgb_p (0, 0, 100*(w-min)/(max-min));
  13.221 -	}
  13.222 -      else
  13.223 -	{
  13.224 -	  color.set_rgb_p (0, 0, 100);
  13.225 -	}
  13.226 -
  13.227 -      nodesmap[node]->property_fill_color_gdk().set_value(color);
  13.228 -    }
  13.229 -  return 0;
  13.230 -};
  13.231 -
  13.232 -int GraphDisplayerCanvas::changeNodeText (std::string mapname, Node node)
  13.233 -{
  13.234 -
  13.235 -  //the number in the map will be written on the node
  13.236 -  //EXCEPT when the name of the map is Text, because
  13.237 -  //in that case empty string will be written, because
  13.238 -  //that is the deleter map
  13.239 -
  13.240 -  Graph::NodeMap<double> * actual_map=NULL;
  13.241 -  actual_map=((mytab.mapstorage).nodemap_storage)[mapname];
  13.242 -
  13.243 -  if(node==INVALID)
  13.244 -    {
  13.245 -      for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
  13.246 -	{
  13.247 -	  nodemap_to_edit=mapname;
  13.248 -	  double number=(*actual_map)[i];
  13.249 -
  13.250 -	  std::ostringstream ostr;
  13.251 -	  ostr << number;
  13.252 -	      
  13.253 -	  nodetextmap[i]->property_text().set_value(ostr.str());
  13.254 -	}
  13.255 -    }
  13.256 -  else
  13.257 -    {
  13.258 -      double number=(*actual_map)[node];
  13.259 -
  13.260 -      std::ostringstream ostr;
  13.261 -      ostr << number;
  13.262 -	      
  13.263 -      nodetextmap[node]->property_text().set_value(ostr.str());
  13.264 -    }
  13.265 -  return 0;
  13.266 -};
  13.267 -
  13.268 -int GraphDisplayerCanvas::resetNodeText (Node node)
  13.269 -{
  13.270 -
  13.271 -  //the number in the map will be written on the node
  13.272 -  //EXCEPT when the name of the map is Text, because
  13.273 -  //in that case empty string will be written, because
  13.274 -  //that is the deleter map
  13.275 -
  13.276 -  if(node==INVALID)
  13.277 -    {
  13.278 -      for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
  13.279 -	{
  13.280 -	  nodemap_to_edit="";
  13.281 -	  nodetextmap[i]->property_text().set_value("");
  13.282 -	}
  13.283 -    }
  13.284 -  else
  13.285 -    {
  13.286 -      nodetextmap[node]->property_text().set_value("");
  13.287 -    }
  13.288 -  return 0;
  13.289 -};
    14.1 --- a/gui/graph_displayer_canvas-zoom.cc	Wed Jun 21 08:35:23 2006 +0000
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,50 +0,0 @@
    14.4 -#include "graph_displayer_canvas.h"
    14.5 -#include <cmath>
    14.6 -
    14.7 -void GraphDisplayerCanvas::zoomIn()
    14.8 -{
    14.9 -  set_pixels_per_unit(
   14.10 -      (1.0 + (double) zoom_step / 100.0) * get_pixels_per_unit());
   14.11 -}
   14.12 -
   14.13 -void GraphDisplayerCanvas::zoomOut()
   14.14 -{
   14.15 -  set_pixels_per_unit(
   14.16 -      (1.0 - (double) zoom_step / 100.0) * get_pixels_per_unit());
   14.17 -}
   14.18 -
   14.19 -void GraphDisplayerCanvas::zoomFit()
   14.20 -{
   14.21 -  updateScrollRegion();
   14.22 -
   14.23 -  // get the height and width of the canvas
   14.24 -  Gtk::Allocation a = get_allocation();
   14.25 -  int aw = a.get_width();
   14.26 -  int ah = a.get_height();
   14.27 -
   14.28 -  // get the bounding box of the graph
   14.29 -  update_now();
   14.30 -  double x1, y1, x2, y2;
   14.31 -  root()->get_bounds(x1, y1, x2, y2);
   14.32 -
   14.33 -  // fit the graph to the window
   14.34 -  double ppu1 = (double) aw / fabs(x2 - x1);
   14.35 -  double ppu2 = (double) ah / fabs(y2 - y1);
   14.36 -  set_pixels_per_unit((ppu1 < ppu2) ? ppu1 : ppu2);
   14.37 -}
   14.38 -
   14.39 -void GraphDisplayerCanvas::zoom100()
   14.40 -{
   14.41 -  updateScrollRegion();
   14.42 -  set_pixels_per_unit(1.0);
   14.43 -}
   14.44 -
   14.45 -void GraphDisplayerCanvas::updateScrollRegion()
   14.46 -{
   14.47 -  // get_bounds() yields something sane only when no updates are pending
   14.48 -  // and it returns a sufficient, not an exact bounding box
   14.49 -  update_now();
   14.50 -  double x1, y1, x2, y2;
   14.51 -  root()->get_bounds(x1, y1, x2, y2);
   14.52 -  set_scroll_region(x1, y1, x2, y2);
   14.53 -}
    15.1 --- a/gui/graph_displayer_canvas.cc	Wed Jun 21 08:35:23 2006 +0000
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,236 +0,0 @@
    15.4 -#include "graph_displayer_canvas.h"
    15.5 -#include <cmath>
    15.6 -
    15.7 -GraphDisplayerCanvas::GraphDisplayerCanvas(NoteBookTab & mainw) :
    15.8 -  nodesmap(mainw.mapstorage.graph), edgesmap(mainw.mapstorage.graph), edgetextmap(mainw.mapstorage.graph),
    15.9 -  nodetextmap(mainw.mapstorage.graph), displayed_graph(*(root()), 0, 0),
   15.10 -  isbutton(0), active_item(NULL), target_item(NULL), nodemap_to_edit(""),
   15.11 -  edgemap_to_edit(""), mytab(mainw)
   15.12 -{
   15.13 -  //base event handler is move tool
   15.14 -  actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::moveEventHandler), false);
   15.15 -  actual_tool=MOVE;
   15.16 -
   15.17 -  active_node=INVALID;
   15.18 -  active_edge=INVALID;
   15.19 -  forming_edge=INVALID;
   15.20 -}
   15.21 -
   15.22 -GraphDisplayerCanvas::~GraphDisplayerCanvas()
   15.23 -{
   15.24 -  for (NodeIt n((mytab.mapstorage).graph); n != INVALID; ++n)
   15.25 -    {
   15.26 -      delete nodesmap[n];
   15.27 -      delete nodetextmap[n];
   15.28 -    }
   15.29 -  
   15.30 -  for (EdgeIt e((mytab.mapstorage).graph); e != INVALID; ++e)
   15.31 -    {
   15.32 -      delete edgesmap[e];
   15.33 -      delete edgetextmap[e];
   15.34 -    }
   15.35 -}
   15.36 -
   15.37 -void GraphDisplayerCanvas::propertyChange(bool itisedge, int prop)
   15.38 -{
   15.39 -  if(itisedge)
   15.40 -    {
   15.41 -      propertyUpdate(Edge(INVALID), prop);
   15.42 -    }
   15.43 -  else
   15.44 -    {
   15.45 -      propertyUpdate(Node(INVALID), prop);
   15.46 -    }
   15.47 -}
   15.48 -
   15.49 -void GraphDisplayerCanvas::propertyUpdate(Edge edge)
   15.50 -{
   15.51 -  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
   15.52 -    {
   15.53 -      propertyUpdate(edge, i);
   15.54 -    }
   15.55 -}
   15.56 -
   15.57 -void GraphDisplayerCanvas::propertyUpdate(Node node)
   15.58 -{
   15.59 -  for(int i=0;i<NODE_PROPERTY_NUM;i++)
   15.60 -    {
   15.61 -      propertyUpdate(node, i);
   15.62 -    }
   15.63 -}
   15.64 -
   15.65 -void GraphDisplayerCanvas::propertyUpdate(Node node, int prop)
   15.66 -{
   15.67 -  //dummy=dummy;
   15.68 -
   15.69 -  std::string mapname=mytab.getActiveNodeMap(prop);
   15.70 -
   15.71 -  if(mapname!="")
   15.72 -    {
   15.73 -      if( ( ((mytab.mapstorage).nodemap_storage).find(mapname) != ((mytab.mapstorage).nodemap_storage).end() ) )
   15.74 -	{
   15.75 -	  switch(prop)
   15.76 -	    {
   15.77 -	    case N_RADIUS:
   15.78 -	      changeNodeRadius(mapname, node);
   15.79 -	      break;
   15.80 -	    case N_COLOR:
   15.81 -	      changeNodeColor(mapname, node);
   15.82 -	      break;
   15.83 -	    case N_TEXT:
   15.84 -	      changeNodeText(mapname, node);
   15.85 -	      break;
   15.86 -	    default:
   15.87 -	      std::cerr<<"Error\n";
   15.88 -	    }
   15.89 -	}
   15.90 -    }
   15.91 -  else //mapname==""
   15.92 -    {
   15.93 -      Node node=INVALID;	
   15.94 -      switch(prop)
   15.95 -	{
   15.96 -	case N_RADIUS:
   15.97 -	  resetNodeRadius(node);
   15.98 -	  break;
   15.99 -	case N_COLOR:
  15.100 -	  resetNodeColor(node);
  15.101 -	  break;
  15.102 -	case N_TEXT:
  15.103 -	  resetNodeText(node);
  15.104 -	  break;
  15.105 -	default:
  15.106 -	  std::cerr<<"Error\n";
  15.107 -	}
  15.108 -    }
  15.109 -
  15.110 -}
  15.111 -
  15.112 -void GraphDisplayerCanvas::propertyUpdate(Edge edge, int prop)
  15.113 -{
  15.114 -  //dummy=dummy;
  15.115 -
  15.116 -  std::string mapname=mytab.getActiveEdgeMap(prop);
  15.117 -
  15.118 -  if(mapname!="")
  15.119 -    {
  15.120 -      if( ( ((mytab.mapstorage).edgemap_storage).find(mapname) != ((mytab.mapstorage).edgemap_storage).end() ) )
  15.121 -	{
  15.122 -	  switch(prop)
  15.123 -	    {
  15.124 -	    case E_WIDTH:
  15.125 -	      changeEdgeWidth(mapname, edge);
  15.126 -	      break;
  15.127 -	    case E_COLOR:
  15.128 -	      changeEdgeColor(mapname, edge);
  15.129 -	      break;
  15.130 -	    case E_TEXT:
  15.131 -	      changeEdgeText(mapname, edge);
  15.132 -	      break;
  15.133 -	    default:
  15.134 -	      std::cerr<<"Error\n";
  15.135 -	    }
  15.136 -	}
  15.137 -    }
  15.138 -  else //mapname==""
  15.139 -    {
  15.140 -      switch(prop)
  15.141 -	{
  15.142 -	case E_WIDTH:
  15.143 -	  resetEdgeWidth(edge);
  15.144 -	  break;
  15.145 -	case E_COLOR:
  15.146 -	  resetEdgeColor(edge);
  15.147 -	  break;
  15.148 -	case E_TEXT:
  15.149 -	  resetEdgeText(edge);
  15.150 -	  break;
  15.151 -	default:
  15.152 -	  std::cerr<<"Error\n";
  15.153 -	}
  15.154 -    }
  15.155 -}
  15.156 -
  15.157 -void GraphDisplayerCanvas::drawGraph()
  15.158 -{
  15.159 -  //first edges are drawn, to hide joining with nodes later
  15.160 -
  15.161 -  for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
  15.162 -  {
  15.163 -
  15.164 -    //drawing green lines, coordinates are from mapstorage.coords
  15.165 -
  15.166 -    Gnome::Canvas::Points coos;
  15.167 -    coos.push_back(Gnome::Art::Point(
  15.168 -          (mytab.mapstorage).coords[(mytab.mapstorage).graph.source(i)].x,
  15.169 -          (mytab.mapstorage).coords[(mytab.mapstorage).graph.source(i)].y));
  15.170 -    coos.push_back(Gnome::Art::Point(
  15.171 -          (mytab.mapstorage).coords[(mytab.mapstorage).graph.target(i)].x,
  15.172 -          (mytab.mapstorage).coords[(mytab.mapstorage).graph.target(i)].y));
  15.173 -    
  15.174 -    edgesmap[i]=new BrokenEdge(displayed_graph, i, *this);
  15.175 -    *(edgesmap[i]) << Gnome::Canvas::Properties::fill_color("green");
  15.176 -    edgesmap[i]->property_width_units().set_value(10);    
  15.177 -    edgesmap[i]->lower_to_bottom();
  15.178 -    
  15.179 -    //initializing edge-text as well, to empty string
  15.180 -
  15.181 -    XY text_pos=mytab.mapstorage.arrow_pos[i];
  15.182 -    text_pos+=(XY(10,10));
  15.183 -
  15.184 -    edgetextmap[i]=new Gnome::Canvas::Text(displayed_graph, text_pos.x, text_pos.y, "");
  15.185 -    edgetextmap[i]->property_fill_color().set_value("darkgreen");
  15.186 -    edgetextmap[i]->signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::edgeMapEditEventHandler), false);
  15.187 -    edgetextmap[i]->raise_to_top();
  15.188 -  }
  15.189 -
  15.190 -  //afterwards nodes come to be drawn
  15.191 -
  15.192 -  for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
  15.193 -  {
  15.194 -    //drawing bule nodes, with black line around them
  15.195 -
  15.196 -    nodesmap[i]=new Gnome::Canvas::Ellipse(
  15.197 -        displayed_graph,
  15.198 -        (mytab.mapstorage).coords[i].x-20,
  15.199 -        (mytab.mapstorage).coords[i].y-20,
  15.200 -        (mytab.mapstorage).coords[i].x+20,
  15.201 -        (mytab.mapstorage).coords[i].y+20);
  15.202 -    *(nodesmap[i]) << Gnome::Canvas::Properties::fill_color("blue");
  15.203 -    *(nodesmap[i]) << Gnome::Canvas::Properties::outline_color("black");
  15.204 -    nodesmap[i]->raise_to_top();
  15.205 -
  15.206 -    //initializing edge-text as well, to empty string
  15.207 -
  15.208 -    xy<double> text_pos(
  15.209 -        ((mytab.mapstorage).coords[i].x+node_property_defaults[N_RADIUS]+5),
  15.210 -        ((mytab.mapstorage).coords[i].y+node_property_defaults[N_RADIUS]+5));
  15.211 -
  15.212 -    nodetextmap[i]=new Gnome::Canvas::Text(displayed_graph,
  15.213 -        text_pos.x, text_pos.y, "");
  15.214 -    nodetextmap[i]->property_fill_color().set_value("darkblue");
  15.215 -    nodetextmap[i]->signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::nodeMapEditEventHandler), false);
  15.216 -    nodetextmap[i]->raise_to_top();
  15.217 -  }
  15.218 -
  15.219 -  updateScrollRegion();
  15.220 -}
  15.221 -
  15.222 -void GraphDisplayerCanvas::clear()
  15.223 -{
  15.224 -  active_node=INVALID;
  15.225 -  active_edge=INVALID;
  15.226 -  forming_edge=INVALID;
  15.227 -
  15.228 -  for (NodeIt n((mytab.mapstorage).graph); n != INVALID; ++n)
  15.229 -  {
  15.230 -    delete nodesmap[n];
  15.231 -    delete nodetextmap[n];
  15.232 -  }
  15.233 -
  15.234 -  for (EdgeIt e((mytab.mapstorage).graph); e != INVALID; ++e)
  15.235 -  {
  15.236 -    delete edgesmap[e];
  15.237 -    delete edgetextmap[e];
  15.238 -  }
  15.239 -}
    16.1 --- a/gui/graph_displayer_canvas.h	Wed Jun 21 08:35:23 2006 +0000
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,357 +0,0 @@
    16.4 -// -*- C++ -*- //
    16.5 -
    16.6 -#ifndef GRAPH_DISPLAYER_CANVAS_H
    16.7 -#define GRAPH_DISPLAYER_CANVAS_H
    16.8 -
    16.9 -class GraphDisplayerCanvas;
   16.10 -
   16.11 -#include "all_include.h"
   16.12 -#include "nbtab.h"
   16.13 -#include <libgnomecanvasmm.h>
   16.14 -#include <libgnomecanvasmm/polygon.h>
   16.15 -#include <lemon/xy.h>
   16.16 -
   16.17 -///This class is the canvas, on which the graph can be drawn.
   16.18 -class GraphDisplayerCanvas : public Gnome::Canvas::CanvasAA
   16.19 -{
   16.20 -  friend class BrokenEdge;
   16.21 -
   16.22 -  ///Edge displayer class
   16.23 -
   16.24 -  ///This class is responsible for displaying edges in graph.
   16.25 -  ///The displayed edge is broken in the middle. The
   16.26 -  ///aim of this is to be able to indicate direction of edges
   16.27 -  ///and to be able to display more then one edges between the
   16.28 -  ///same source and target
   16.29 -  class BrokenEdge : public Gnome::Canvas::Line
   16.30 -  {
   16.31 -    ///The edge that the class displays.
   16.32 -
   16.33 -    ///It is needed, because some datas needed from
   16.34 -    ///graph can be accessed by this or should be sent
   16.35 -    ///as parameter, but it would be complicated
   16.36 -    Edge edge;
   16.37 -
   16.38 -    ///Reference to the canvas, on which the graph is drawn.
   16.39 -
   16.40 -    ///It is needed, because some datas needed from
   16.41 -    ///graph can be accessed by this or should be sent
   16.42 -    ///as parameter, but it would be complicated
   16.43 -    GraphDisplayerCanvas & gdc;
   16.44 -
   16.45 -    ///An arrow that indicates the direction of the edges
   16.46 -
   16.47 -    ///in case of directional graph direction can be indicated
   16.48 -    ///by this polygon. The polygon formulates a red arrow.
   16.49 -    Gnome::Canvas::Polygon * arrow;
   16.50 -
   16.51 -    ///Indicates whether the button of mouse is pressed or not at the moment.
   16.52 -    bool isbutton;
   16.53 -
   16.54 -    ///At this location was the mousebutton pressed. Horizontal component.
   16.55 -
   16.56 -    ///It helps to calculate the
   16.57 -    ///distance of dragging.
   16.58 -    double clicked_x;
   16.59 -
   16.60 -    ///At this location was the mousebutton pressed. Vertical component.
   16.61 -
   16.62 -    ///It helps to calculate the
   16.63 -    ///distance of dragging.
   16.64 -    double clicked_y;
   16.65 -
   16.66 -    ///event handler for forming broken edges
   16.67 -
   16.68 -    ///\param event the
   16.69 -    ///event to handle
   16.70 -    bool edgeFormerEventHandler(GdkEvent* event);
   16.71 -  public:
   16.72 -
   16.73 -    ///Constructor of broken edge class.
   16.74 -
   16.75 -    ///\param g the group to which the edge belongs
   16.76 -    ///\param _edge the represented edge
   16.77 -    ///\param gc the canvas
   16.78 -    BrokenEdge(Gnome::Canvas::Group & g, Edge _edge, GraphDisplayerCanvas & gc);
   16.79 -
   16.80 -    ///Destructor of broken edge class
   16.81 -
   16.82 -    ///Frees up
   16.83 -    ///reserved memory
   16.84 -    ~BrokenEdge();
   16.85 -
   16.86 -    ///The function that draws the edge based on collected data
   16.87 -    void draw();
   16.88 -  };
   16.89 -
   16.90 -  ///Type of canvas, on which the graph is drawn
   16.91 -  typedef Gnome::Canvas::CanvasAA Parent;
   16.92 -
   16.93 -public:
   16.94 -  ///Constructor
   16.95 -
   16.96 -  ///\param nbt the tab of the window, in which the graph is displayed
   16.97 -  GraphDisplayerCanvas(NoteBookTab & nbt);
   16.98 -
   16.99 -  ///destructor of the class
  16.100 -  virtual ~GraphDisplayerCanvas();
  16.101 -
  16.102 -  ///Changes the width of edge(s) according to the given map.
  16.103 -
  16.104 -  ///\param mapname is the name of the map which contains the values to be set
  16.105 -  ///\param edge if it is given, only the width of the given edge will be set, instead of all of them.
  16.106 -  int changeEdgeWidth (std::string mapname, Edge edge=INVALID);
  16.107 -
  16.108 -  ///Resets width of edge(s) to the default value
  16.109 -
  16.110 -  ///\param edge if it is given, only the width of the
  16.111 -  ///given edge will be reset, instead of all of them.
  16.112 -  int resetEdgeWidth (Edge edge=INVALID);
  16.113 -
  16.114 -  ///Changes the color of edge(s) according to the given map.
  16.115 -
  16.116 -  ///\param mapname is the name of the map which contains the new values
  16.117 -  ///\param edge if it is given, only the color of the given edge will be set, instead of all of them.
  16.118 -  int changeEdgeColor (std::string mapname, Edge edge=INVALID);
  16.119 -
  16.120 -  ///Resets color of edge(s) to the default value
  16.121 -
  16.122 -  ///\param edge if it is given, only the color of the
  16.123 -  ///given edge will be reset, instead of all of them.
  16.124 -  int resetEdgeColor (Edge edge=INVALID);
  16.125 -
  16.126 -  ///Changes the label of edge(s) according to the given map.
  16.127 -
  16.128 -  ///\param mapname is the name of the map which contains the new values
  16.129 -  ///\param edge if it is given, only the label of the given edge will be set, instead of all of them.
  16.130 -  int changeEdgeText (std::string mapname, Edge edge=INVALID);
  16.131 -
  16.132 -  ///Resets label of edge(s) to the default value
  16.133 -
  16.134 -  ///\param edge if it is given, only the color of the
  16.135 -  ///given edge will be reset, instead of all of them.
  16.136 -  int resetEdgeText (Edge edge=INVALID);
  16.137 -
  16.138 -  ///Changes the radius of node(s) according to the given map.
  16.139 -
  16.140 -  ///\param mapname is the name of the map which contains the new values
  16.141 -  ///\param node if it is given, only the radius of the given node will be set, instead of all of them.
  16.142 -  int changeNodeRadius (std::string mapname, Node node=INVALID);
  16.143 -
  16.144 -  ///Resets radius of node(s) to the default value
  16.145 -
  16.146 -  ///\param node if it is given, only the radius of the
  16.147 -  ///given node will be reset, instead of all of them.
  16.148 -  int resetNodeRadius (Node node=INVALID);
  16.149 -
  16.150 -  ///Changes the color of node(s) according to the given map.
  16.151 -
  16.152 -  ///\param mapname is the name of the map which contains the new values
  16.153 -  ///\param node if it is given, only the color of the given node will be set, instead of all of them.
  16.154 -  int changeNodeColor (std::string mapname, Node node=INVALID);
  16.155 -
  16.156 -  ///Resets color of node(s) to the default value
  16.157 -
  16.158 -  ///\param node if it is given, only the color of the
  16.159 -  ///given node will be reset, instead of all of them.
  16.160 -  int resetNodeColor (Node node=INVALID);
  16.161 -
  16.162 -  ///Changes the label of node(s) according to the given map.
  16.163 -
  16.164 -  ///\param mapname is the name of the map which contains the new values
  16.165 -  ///\param node if it is given, only the label of the given node will be set, instead of all of them.
  16.166 -  int changeNodeText (std::string mapname, Node node=INVALID);
  16.167 -
  16.168 -  ///Resets label of node(s) to the default value
  16.169 -
  16.170 -  ///\param node if it is given, only the label of the
  16.171 -  ///given node will be reset, instead of all of them.
  16.172 -  int resetNodeText (Node node=INVALID);
  16.173 -
  16.174 -  ///This function is called, when any of the displayed attributes have to be updated, or changed
  16.175 -
  16.176 -  ///\param itisedge if true, edge property has to be changed, else node property
  16.177 -  ///\param prop the id of property that has to changed or updated
  16.178 -  void propertyChange(bool itisedge, int prop);
  16.179 -
  16.180 -  ///updates the given property
  16.181 -
  16.182 -  ///\param edge if it is not INVALID, only the property of the given edge will be updated, instead of all of them
  16.183 -  ///\param prop the property to update
  16.184 -  void propertyUpdate(Edge edge, int prop);
  16.185 -
  16.186 -  ///updates the given property
  16.187 -
  16.188 -  ///\param node if it is not INVALID, only the property of the given node will be updated, instead of all of them
  16.189 -  ///\param prop the property to update
  16.190 -  void propertyUpdate(Node node, int prop);
  16.191 -
  16.192 -  ///updates all the property for the given edge
  16.193 -  void propertyUpdate(Edge);
  16.194 -
  16.195 -  ///updates all the property for the given node
  16.196 -  void propertyUpdate(Node);
  16.197 -
  16.198 -  ///Callback for 'ViewZoomIn' action.
  16.199 -  virtual void zoomIn();
  16.200 -  ///Callback for 'ViewZoomOut' action.
  16.201 -  virtual void zoomOut();
  16.202 -  ///Callback for 'ViewZoomFit' action.
  16.203 -  virtual void zoomFit();
  16.204 -  ///Callback for 'ViewZoom100' action.
  16.205 -  virtual void zoom100();
  16.206 -  ///Sets the scroll region of the convas to the bounding box of the graph.
  16.207 -  void updateScrollRegion();
  16.208 -
  16.209 -  ///This function changes the tool in the graph-editor's hand
  16.210 -  void changeEditorialTool(int);
  16.211 -
  16.212 -protected:
  16.213 -
  16.214 -  //maximizing, minimizing, restoring window, etc.
  16.215 -  virtual bool on_expose_event(GdkEventExpose *);
  16.216 -
  16.217 -private:
  16.218 -
  16.219 -  ///This function is responsible for the correct
  16.220 -  ///reaction of any action happened in the territory
  16.221 -  ///of the canvas
  16.222 -  ///DEPRECATED!!!!
  16.223 -  bool eventHandler(GdkEvent* e, Node n);
  16.224 -
  16.225 -  ///actual event handler
  16.226 -  ///
  16.227 -  ///Actual event handler should be stored, to be able to disconnect it and later reconnect it.
  16.228 -  sigc::connection actual_handler;
  16.229 -
  16.230 -  ///event handler for the case when move-tool is active
  16.231 -  bool moveEventHandler(GdkEvent*);
  16.232 -  ///event handler for the case when create_node-tool is active
  16.233 -  bool createNodeEventHandler(GdkEvent*);
  16.234 -  ///event handler for the case when create_edge-tool is active
  16.235 -  bool createEdgeEventHandler(GdkEvent*);
  16.236 -  ///event handler for the case when eraser-tool is active
  16.237 -  bool eraserEventHandler(GdkEvent*);
  16.238 -  ///event handler for the case when edge map editor tool is active
  16.239 -  bool edgeMapEditEventHandler(GdkEvent*);
  16.240 -  ///event handler for the case when node map editor tool is active
  16.241 -  bool nodeMapEditEventHandler(GdkEvent*);
  16.242 -
  16.243 -public:
  16.244 -  ///Moves the text to new place
  16.245 -  void textReposition(xy<double>);
  16.246 -
  16.247 -  ///Activates an edge belonging to a BrokenEdge
  16.248 -
  16.249 -  ///After we have activated an edge this way,
  16.250 -  ///the GDC object will know, which edge is under forming
  16.251 -  ///therefore it can redraw the necessary elements on the canvas,
  16.252 -  ///for example the text belonging to the \ref BrokenEdge can be
  16.253 -  ///redrawn (\ref textReposition).
  16.254 -  void toggleEdgeActivity(BrokenEdge*, bool);
  16.255 -
  16.256 -public:
  16.257 -
  16.258 -  ///Returns the actual tool in hand
  16.259 -  int getActualTool();
  16.260 -
  16.261 -  ///draws the graph
  16.262 -
  16.263 -  ///Called when opening a file.
  16.264 -  void drawGraph();
  16.265 -
  16.266 -  ///Clears the canvas
  16.267 -
  16.268 -  ///It achieves this by deleting all data
  16.269 -  ///structure used to help handle the displayed graph.
  16.270 -  void clear();
  16.271 -
  16.272 -  ///creates a new Nodemap
  16.273 -
  16.274 -  ///\param init initial value of the map
  16.275 -  ///\param mapname name of new map
  16.276 -  int addNewNodeMap(double init,std::string mapname);
  16.277 -  ///creates a new Edgemap
  16.278 -
  16.279 -  ///\param init initial value of the map
  16.280 -  ///\param mapname name of new map
  16.281 -  int addNewEdgeMap(double init,std::string mapname);
  16.282 -
  16.283 -private:
  16.284 -  ///Deletes the given element.
  16.285 -  void deleteItem(Node);
  16.286 -  ///Deletes the given element.
  16.287 -  void deleteItem(Edge);
  16.288 -
  16.289 -private:
  16.290 -
  16.291 -  ///Map of nodes of graph
  16.292 -  Graph::NodeMap<Gnome::Canvas::Ellipse *> nodesmap;
  16.293 -
  16.294 -  ///Map of edges of graph
  16.295 -  Graph::EdgeMap<BrokenEdge *> edgesmap;
  16.296 -
  16.297 -  ///Map of texts to write on edges
  16.298 -  Graph::EdgeMap<Gnome::Canvas::Text *> edgetextmap;
  16.299 -
  16.300 -  ///Map of texts to write on nodes
  16.301 -  Graph::NodeMap<Gnome::Canvas::Text *> nodetextmap;
  16.302 -
  16.303 -  ///Group of graphical elements of displayed_graph
  16.304 -  Gnome::Canvas::Group displayed_graph;
  16.305 -
  16.306 -private:
  16.307 -  ///Indicates whether the button of mouse is pressed or not
  16.308 -  int isbutton;
  16.309 -
  16.310 -  ///Stores the actual tool in hand
  16.311 -  int actual_tool;
  16.312 -
  16.313 -  ///At this location was the mousebutton pressed.
  16.314 -  ///It helps to calculate the distance of dragging.
  16.315 -  double clicked_x, clicked_y;
  16.316 -
  16.317 -  ///Remembers which Gnome::Canvas::Item was pressed.
  16.318 -
  16.319 -  ///this variable is needed, to work on it after selection
  16.320 -  Gnome::Canvas::Item * active_item;
  16.321 -
  16.322 -  ///Remembers which Gnome::Canvas::Item was pressed.
  16.323 -
  16.324 -  ///this variable is used at edge creation, it will
  16.325 -  ///be the secondly selected node. No local variable
  16.326 -  ///can be used for this purpose inside the function,
  16.327 -  ///because the node selected by button press, and
  16.328 -  ///the edge is created by button release. Both of
  16.329 -  ///them is different function call.
  16.330 -  Gnome::Canvas::Item * target_item;
  16.331 -
  16.332 -  ///selected node (for any editing)
  16.333 -  Node active_node;
  16.334 -
  16.335 -  ///selected edge (for any editing)
  16.336 -  Edge active_edge;
  16.337 -
  16.338 -  ///the edge that is selected by clicking on the red arrow in the middle of it
  16.339 -
  16.340 -  ///This edge is stored only for the purpose of reshape it.
  16.341 -  ///That is why it is selected in a different manner.
  16.342 -  Edge forming_edge;
  16.343 -
  16.344 -  ///Map displayed by label can be edited.
  16.345 -  std::string nodemap_to_edit;
  16.346 -
  16.347 -  ///Map displayed by label can be edited.
  16.348 -  std::string edgemap_to_edit;
  16.349 -
  16.350 -  static const int zoom_step = 5;
  16.351 -
  16.352 -private:
  16.353 -
  16.354 -  ///reference to the container, in which the canvas is
  16.355 -  NoteBookTab & mytab;
  16.356 -
  16.357 -  XY calcArrowPos(XY, XY, XY, XY, bool);
  16.358 -};
  16.359 -
  16.360 -#endif //GRAPH_DISPLAYER_CANVAS_H
    17.1 --- a/gui/graphocska.lgf	Wed Jun 21 08:35:23 2006 +0000
    17.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3 @@ -1,39 +0,0 @@
    17.4 -@nodeset
    17.5 -label	coordinates_x	coordinates_y data
    17.6 -1	230	-80	1.123
    17.7 -2	230	100	3.234
    17.8 -3	120	-80	5.345
    17.9 -4	120	100	7.456
   17.10 -5	20	100	9.567
   17.11 -6	20	-80	11.678
   17.12 -7	-40	10	13.789
   17.13 -8	-100	100	15.890
   17.14 -9	-100	10	17.901
   17.15 -10	-100	-80	19.012
   17.16 -11	-200	-80	21.000
   17.17 -12	-200	10	23.001
   17.18 -13	-200	100	25.003
   17.19 -14	-300	100	27.004
   17.20 -15	-300	-80	29.9999
   17.21 -
   17.22 -@edgeset
   17.23 -	        cap	map1	map2	map3	map4
   17.24 -15	14	1	21	111	231	3
   17.25 -14	13	2	22	112	232	6
   17.26 -13	12	3	23	113	233	9
   17.27 -13	8	4	24	114	234	12
   17.28 -12	11	5	25	115	235	15
   17.29 -12	9	6	26	116	236	18
   17.30 -11	10	7	27	117	237	21
   17.31 -10	9	8	28	118	238	24
   17.32 -10	7	9	29	119	239	27
   17.33 -9	8	10	30	120	230	30
   17.34 -7	6	11	31	121	241	33
   17.35 -6	5	12	32	122	242	36
   17.36 -6	3	13	33	123	243	39
   17.37 -5	4	14	34	124	244	42
   17.38 -4	3	15	35	125	245	45
   17.39 -3	2	16	36	126	246	48
   17.40 -2	1	17	37	127	247	51
   17.41 -
   17.42 -@end
   17.43 \ No newline at end of file
    18.1 --- a/gui/gui_reader.cc	Wed Jun 21 08:35:23 2006 +0000
    18.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.3 @@ -1,33 +0,0 @@
    18.4 -#include "gui_reader.h"
    18.5 -#include "xml.h"
    18.6 -#include "mapstorage.h"
    18.7 -#include <lemon/xy.h>
    18.8 -#include <vector>
    18.9 -
   18.10 -bool GuiReader::header(const std::string& line)
   18.11 -{
   18.12 -  std::istringstream ls(line);
   18.13 -  std::string head;
   18.14 -  ls >> head;
   18.15 -  return head == "@gui";
   18.16 -}
   18.17 -
   18.18 -void GuiReader::read(std::istream& is)
   18.19 -{
   18.20 -  XmlIo x(is);
   18.21 -  std::map<int, xy<double> > m;
   18.22 -  x("arrow_pos", m);
   18.23 -
   18.24 -  if ((int)m.size() != countEdges(mapstorage->graph)) return;
   18.25 -
   18.26 -  for (EdgeIt e(mapstorage->graph); e != INVALID; ++e)
   18.27 -  {
   18.28 -    int edgeid = (int)(*mapstorage->edgemap_storage["label"])[e];
   18.29 -    mapstorage->arrow_pos.set(e, m[edgeid]);
   18.30 -  }
   18.31 -  mapstorage->ArrowPosReadOK();
   18.32 -}
   18.33 -
   18.34 -GuiReader::GuiReader(LemonReader& reader, MapStorage* ms) : Parent(reader), mapstorage(ms)
   18.35 -{
   18.36 -}
    19.1 --- a/gui/gui_reader.h	Wed Jun 21 08:35:23 2006 +0000
    19.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.3 @@ -1,21 +0,0 @@
    19.4 -#ifndef GUI_READER_H
    19.5 -#define GUI_READER_H
    19.6 -
    19.7 -#include "mapstorage.h"
    19.8 -#include <lemon/lemon_reader.h>
    19.9 -
   19.10 -using lemon::LemonReader;
   19.11 -
   19.12 -class GuiReader : public LemonReader::SectionReader
   19.13 -{
   19.14 -  private:
   19.15 -    MapStorage* mapstorage;
   19.16 -  protected:
   19.17 -    virtual bool header(const std::string&);
   19.18 -    virtual void read(std::istream&);
   19.19 -  public:
   19.20 -    typedef LemonReader::SectionReader Parent;
   19.21 -    GuiReader(LemonReader&, MapStorage*);
   19.22 -};
   19.23 -
   19.24 -#endif
    20.1 --- a/gui/gui_writer.cc	Wed Jun 21 08:35:23 2006 +0000
    20.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.3 @@ -1,26 +0,0 @@
    20.4 -#include "gui_writer.h"
    20.5 -#include "xml.h"
    20.6 -#include "mapstorage.h"
    20.7 -#include <lemon/xy.h>
    20.8 -#include <vector>
    20.9 -
   20.10 -std::string GuiWriter::header()
   20.11 -{
   20.12 -  return "@gui";
   20.13 -}
   20.14 -
   20.15 -void GuiWriter::write(std::ostream& os)
   20.16 -{
   20.17 -  XmlIo x(os);
   20.18 -  std::map<int, xy<double> > m;
   20.19 -  for (EdgeIt e(mapstorage->graph); e != INVALID; ++e)
   20.20 -  {
   20.21 -    int edgeid = (int)(*(mapstorage->edgemap_storage["label"]))[e];
   20.22 -    m[edgeid] = mapstorage->arrow_pos[e];
   20.23 -  }
   20.24 -  x("arrow_pos", m);
   20.25 -}
   20.26 -
   20.27 -GuiWriter::GuiWriter(LemonWriter& writer, MapStorage* ms) : Parent(writer), mapstorage(ms)
   20.28 -{
   20.29 -}
    21.1 --- a/gui/gui_writer.h	Wed Jun 21 08:35:23 2006 +0000
    21.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.3 @@ -1,21 +0,0 @@
    21.4 -#ifndef GUI_WRITER_H
    21.5 -#define GUI_WRITER_H
    21.6 -
    21.7 -#include "mapstorage.h"
    21.8 -#include <lemon/lemon_writer.h>
    21.9 -
   21.10 -using lemon::LemonWriter;
   21.11 -
   21.12 -class GuiWriter : public LemonWriter::SectionWriter
   21.13 -{
   21.14 -  private:
   21.15 -    MapStorage* mapstorage;
   21.16 -  protected:
   21.17 -    virtual std::string header();
   21.18 -    virtual void write(std::ostream&);
   21.19 -  public:
   21.20 -    typedef LemonWriter::SectionWriter Parent;
   21.21 -    GuiWriter(LemonWriter&, MapStorage*);
   21.22 -};
   21.23 -
   21.24 -#endif
    22.1 --- a/gui/i18n.h	Wed Jun 21 08:35:23 2006 +0000
    22.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.3 @@ -1,7 +0,0 @@
    22.4 -#ifndef I18N_H
    22.5 -#define I18N_H
    22.6 -
    22.7 -#include "gettext.h"
    22.8 -#define _(string) gettext (string)
    22.9 -
   22.10 -#endif
    23.1 Binary file gui/icons/addlink.png has changed
    24.1 Binary file gui/icons/addnode.png has changed
    25.1 Binary file gui/icons/delete.png has changed
    26.1 Binary file gui/icons/editlink.png has changed
    27.1 Binary file gui/icons/editnode.png has changed
    28.1 Binary file gui/icons/move.png has changed
    29.1 Binary file gui/icons/newmap.png has changed
    30.1 --- a/gui/kruskalbox.cc	Wed Jun 21 08:35:23 2006 +0000
    30.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.3 @@ -1,61 +0,0 @@
    30.4 -#include <kruskalbox.h>
    30.5 -
    30.6 -enum {INPUT, OUTPUT, MAP_NUM};
    30.7 -
    30.8 -KruskalBox::KruskalBox(std::vector<std::string> t):AlgoBox()
    30.9 -{
   30.10 -  init(t);
   30.11 -}
   30.12 -    
   30.13 -void KruskalBox::run()
   30.14 -{
   30.15 -  if(
   30.16 -     tabcbt.get_active_text()!="" &&
   30.17 -     (edgemapcbts[INPUT])->get_active_text()!="" &&
   30.18 -     (edgemapcbts[OUTPUT])->get_active_text()!=""
   30.19 -     )
   30.20 -    {
   30.21 -
   30.22 -      Graph g=mapstorage->graph;
   30.23 -      Graph::EdgeMap<double> * inputmap=
   30.24 -	((mapstorage->edgemap_storage)[(edgemapcbts[INPUT])->get_active_text()]);
   30.25 -      Graph::EdgeMap<bool> outputmap(g);
   30.26 -      double res=kruskal(g, *inputmap, outputmap);
   30.27 -
   30.28 -      for (EdgeIt i(g); i!=INVALID; ++i)
   30.29 -	{
   30.30 -	  if(outputmap[i])
   30.31 -	    {
   30.32 -	      (*((mapstorage->edgemap_storage)[(edgemapcbts[OUTPUT])->
   30.33 -					       get_active_text()]))[i]=1;
   30.34 -	    }
   30.35 -	  else
   30.36 -	    {
   30.37 -	      (*((mapstorage->edgemap_storage)[(edgemapcbts[OUTPUT])->
   30.38 -					       get_active_text()]))[i]=0;
   30.39 -	    }
   30.40 -	}
   30.41 -
   30.42 -      std::ostringstream o;
   30.43 -      o << "Result: " << res;
   30.44 -      resultlabel.set_text(o.str());
   30.45 -
   30.46 -      mapstorage->mapChanged(true, (edgemapcbts[OUTPUT])->get_active_text());
   30.47 -      //   mapstorage->changeActiveMap(true, E_COLOR,
   30.48 -      // 			      (edgemapcbts[OUTPUT])->get_active_text());
   30.49 -      //   mapstorage->changeActiveMap(true, E_TEXT,
   30.50 -      // 			      (edgemapcbts[INPUT])->get_active_text());
   30.51 -  
   30.52 -    }
   30.53 -}
   30.54 -    
   30.55 -void KruskalBox::build_box()
   30.56 -{
   30.57 -  std::vector<std::string> empty_vector;
   30.58 -
   30.59 -  addMapSelector("Edgecosts: ", true);
   30.60 -  addMapSelector("Edges of tree here: ", true);
   30.61 -
   30.62 -  resultlabel.set_text("Result: algorithm is not run yet.");
   30.63 -  pack_start(resultlabel);
   30.64 -}
    31.1 --- a/gui/kruskalbox.h	Wed Jun 21 08:35:23 2006 +0000
    31.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.3 @@ -1,44 +0,0 @@
    31.4 -// -*- C++ -*- //
    31.5 -
    31.6 -#ifndef KRUSKALBOX_H
    31.7 -#define KRUSKALBOX_H
    31.8 -
    31.9 -class KruskalBox;
   31.10 -
   31.11 -#include <all_include.h>
   31.12 -#include <algobox.h>
   31.13 -#include <lemon/kruskal.h>
   31.14 -#include <libgnomecanvasmm.h>
   31.15 -#include <libgnomecanvasmm/polygon.h>
   31.16 -
   31.17 -///Graphical interface to run Kruskal algorithm.
   31.18 -
   31.19 -///Child of \ref AlgoBox,
   31.20 -///therefore the only task to do at implementation was to
   31.21 -///
   31.22 -///-call init function with correct parameters from correctly parametrized constructor
   31.23 -///
   31.24 -///-implement \ref build_box function
   31.25 -///
   31.26 -///-implement \ref run function
   31.27 -class KruskalBox : public AlgoBox
   31.28 -{
   31.29 -  ///Shows result of Kruskal algorithm
   31.30 -  Gtk::Label resultlabel;
   31.31 -
   31.32 -public:
   31.33 -  ///Calls \ref AlgoBox::init function to initialize class properly, automatically.
   31.34 -  KruskalBox(std::vector<std::string> t);
   31.35 -
   31.36 -  ///Prepare, run and postprocess Kruskal algorithm.
   31.37 -
   31.38 -  ///\ref glemon works only with maps filled with double values
   31.39 -  ///at the moment. While Kruskal nedds a bool map as output.
   31.40 -  ///As postprocess this bool map should be transformed to
   31.41 -  ///double map.
   31.42 -  void run();
   31.43 -
   31.44 -  ///Builds the graphical design of the interface.
   31.45 -  void build_box();
   31.46 -};
   31.47 -#endif //KRUSKALBOX_H
    32.1 --- a/gui/main_win.cc	Wed Jun 21 08:35:23 2006 +0000
    32.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.3 @@ -1,489 +0,0 @@
    32.4 -#ifdef HAVE_CONFIG_H
    32.5 -#include <config.h>
    32.6 -#endif
    32.7 -
    32.8 -#include "main_win.h"
    32.9 -#include "guipixbufs.h"
   32.10 -
   32.11 -#include "i18n.h"
   32.12 -
   32.13 -MainWin::MainWin()
   32.14 -{
   32.15 -  set_title ("no file");
   32.16 -  set_default_size(WIN_WIDTH,WIN_HEIGHT);
   32.17 -  add(vbox);
   32.18 -
   32.19 -  // custom icons for the toolbar
   32.20 -  Glib::RefPtr<Gtk::IconFactory> p_icon_factory = Gtk::IconFactory::create();
   32.21 - 
   32.22 -  Glib::RefPtr<Gdk::Pixbuf> p_move_pixbuf = Gdk::Pixbuf::create_from_inline(
   32.23 -      2328, gui_icons_move);
   32.24 -  Glib::RefPtr<Gdk::Pixbuf> p_addnode_pixbuf = Gdk::Pixbuf::create_from_inline(
   32.25 -      2328, gui_icons_addnode);
   32.26 -  Glib::RefPtr<Gdk::Pixbuf> p_addlink_pixbuf = Gdk::Pixbuf::create_from_inline(
   32.27 -      2328, gui_icons_addlink);
   32.28 -  Glib::RefPtr<Gdk::Pixbuf> p_delete_pixbuf = Gdk::Pixbuf::create_from_inline(
   32.29 -      2328, gui_icons_delete);
   32.30 -  Glib::RefPtr<Gdk::Pixbuf> p_editlink_pixbuf = Gdk::Pixbuf::create_from_inline(
   32.31 -      2328, gui_icons_editlink);
   32.32 -  Glib::RefPtr<Gdk::Pixbuf> p_editnode_pixbuf = Gdk::Pixbuf::create_from_inline(
   32.33 -      2328, gui_icons_editnode);
   32.34 -  Glib::RefPtr<Gdk::Pixbuf> p_newmap_pixbuf = Gdk::Pixbuf::create_from_inline(
   32.35 -      2328, gui_icons_newmap);
   32.36 -
   32.37 -  Gtk::IconSource move_icon_source;
   32.38 -  move_icon_source.set_pixbuf(p_move_pixbuf);
   32.39 -  Gtk::IconSet move_icon_set;
   32.40 -  move_icon_set.add_source(move_icon_source);
   32.41 -  p_icon_factory->add(Gtk::StockID("gd-move"), move_icon_set);
   32.42 -
   32.43 -  Gtk::IconSource addnode_icon_source;
   32.44 -  addnode_icon_source.set_pixbuf(p_addnode_pixbuf);
   32.45 -  Gtk::IconSet addnode_icon_set;
   32.46 -  addnode_icon_set.add_source(addnode_icon_source);
   32.47 -  p_icon_factory->add(Gtk::StockID("gd-addnode"), addnode_icon_set);
   32.48 -
   32.49 -  Gtk::IconSource addlink_icon_source;
   32.50 -  addlink_icon_source.set_pixbuf(p_addlink_pixbuf);
   32.51 -  Gtk::IconSet addlink_icon_set;
   32.52 -  addlink_icon_set.add_source(addlink_icon_source);
   32.53 -  p_icon_factory->add(Gtk::StockID("gd-addlink"), addlink_icon_set);
   32.54 -
   32.55 -  Gtk::IconSource delete_icon_source;
   32.56 -  delete_icon_source.set_pixbuf(p_delete_pixbuf);
   32.57 -  Gtk::IconSet delete_icon_set;
   32.58 -  delete_icon_set.add_source(delete_icon_source);
   32.59 -  p_icon_factory->add(Gtk::StockID("gd-delete"), delete_icon_set);
   32.60 -
   32.61 -  Gtk::IconSource editlink_icon_source;
   32.62 -  editlink_icon_source.set_pixbuf(p_editlink_pixbuf);
   32.63 -  Gtk::IconSet editlink_icon_set;
   32.64 -  editlink_icon_set.add_source(editlink_icon_source);
   32.65 -  p_icon_factory->add(Gtk::StockID("gd-editlink"), editlink_icon_set);
   32.66 -
   32.67 -  Gtk::IconSource editnode_icon_source;
   32.68 -  editnode_icon_source.set_pixbuf(p_editnode_pixbuf);
   32.69 -  Gtk::IconSet editnode_icon_set;
   32.70 -  editnode_icon_set.add_source(editnode_icon_source);
   32.71 -  p_icon_factory->add(Gtk::StockID("gd-editnode"), editnode_icon_set);
   32.72 -
   32.73 -  Gtk::IconSource newmap_icon_source;
   32.74 -  newmap_icon_source.set_pixbuf(p_newmap_pixbuf);
   32.75 -  Gtk::IconSet newmap_icon_set;
   32.76 -  newmap_icon_set.add_source(newmap_icon_source);
   32.77 -  p_icon_factory->add(Gtk::StockID("gd-newmap"), newmap_icon_set);
   32.78 -
   32.79 -  p_icon_factory->add_default();
   32.80 -  
   32.81 -  ag=Gtk::ActionGroup::create();
   32.82 -
   32.83 -  ag->add( Gtk::Action::create("FileMenu", _("_File")) );
   32.84 -  ag->add( Gtk::Action::create("FileNew", Gtk::Stock::NEW),
   32.85 -      sigc::mem_fun(*this, &MainWin::newTab));
   32.86 -  ag->add( Gtk::Action::create("FileOpen", Gtk::Stock::OPEN),
   32.87 -      sigc::mem_fun(*this, &MainWin::openFile));
   32.88 -  ag->add( Gtk::Action::create("FileClearTab", _("Clear Tab")),
   32.89 -      sigc::mem_fun(*this, &MainWin::newFile));
   32.90 -  ag->add( Gtk::Action::create("FileSave", Gtk::Stock::SAVE),
   32.91 -      sigc::mem_fun(*this, &MainWin::saveFile));
   32.92 -  ag->add( Gtk::Action::create("FileSaveAs", Gtk::Stock::SAVE_AS),
   32.93 -      sigc::mem_fun(*this, &MainWin::saveFileAs));
   32.94 -  ag->add( Gtk::Action::create("Close", Gtk::Stock::CLOSE),
   32.95 -      sigc::mem_fun(*this, &MainWin::closeTab));
   32.96 -  ag->add( Gtk::Action::create("Quit", Gtk::Stock::QUIT),
   32.97 -      sigc::mem_fun(*this, &MainWin::hide));
   32.98 -
   32.99 -  ag->add( Gtk::Action::create("ViewMenu", _("_View")) );
  32.100 -  ag->add( Gtk::Action::create("ViewZoomIn", Gtk::Stock::ZOOM_IN),
  32.101 -      sigc::mem_fun(*this, &MainWin::zoomIn));
  32.102 -  ag->add( Gtk::Action::create("ViewZoomOut", Gtk::Stock::ZOOM_OUT),
  32.103 -      sigc::mem_fun(*this, &MainWin::zoomOut));
  32.104 -  ag->add( Gtk::Action::create("ViewZoomFit", Gtk::Stock::ZOOM_FIT),
  32.105 -      sigc::mem_fun(*this, &MainWin::zoomFit));
  32.106 -  ag->add( Gtk::Action::create("ViewZoom100", Gtk::Stock::ZOOM_100),
  32.107 -      sigc::mem_fun(*this, &MainWin::zoom100));
  32.108 -  
  32.109 -  ag->add( Gtk::Action::create("ShowMenu", _("_Show")) );
  32.110 -  ag->add( Gtk::Action::create("ShowMaps", _("_Maps")),
  32.111 -	   sigc::mem_fun(*this, &MainWin::createMapWin));
  32.112 -
  32.113 -  ag->add( Gtk::Action::create("AlgoMenu", _("_Algorithms")) );
  32.114 -  ag->add( Gtk::Action::create("AlgoGeneral", _("_General")),
  32.115 -	   sigc::bind( sigc::mem_fun ( *this, &MainWin::createAlgoWin ), 0) );
  32.116 -  ag->add( Gtk::Action::create("AlgoKruskal", _("_Kruskal")),
  32.117 -	   sigc::bind( sigc::mem_fun ( *this, &MainWin::createAlgoWin ), 1) );
  32.118 -
  32.119 -  Gtk::RadioAction::Group tool_group;
  32.120 -  ag->add( Gtk::RadioAction::create(tool_group, "MoveItem", Gtk::StockID("gd-move"), _("Move")),
  32.121 -      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 0) );
  32.122 -  ag->add( Gtk::RadioAction::create(tool_group, "CreateNode", Gtk::StockID("gd-addnode"), _("Create node")),
  32.123 -      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 1) );
  32.124 -  ag->add( Gtk::RadioAction::create(tool_group, "CreateEdge", Gtk::StockID("gd-addlink"), _("Create edge")),
  32.125 -      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 2) );
  32.126 -  ag->add( Gtk::RadioAction::create(tool_group, "EraseItem", Gtk::StockID("gd-delete"), _("Delete")),
  32.127 -      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 3) );
  32.128 -
  32.129 -  ag->add( Gtk::RadioAction::create(tool_group, "EditEdgeMap", Gtk::StockID("gd-editlink"), _("Edit edge map")),
  32.130 -      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 4) );
  32.131 -  ag->add( Gtk::RadioAction::create(tool_group, "EditNodeMap", Gtk::StockID("gd-editnode"), _("Edit node map")),
  32.132 -      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 5) );
  32.133 -
  32.134 -  ag->add( Gtk::Action::create("AddMap", Gtk::StockID("gd-newmap")),
  32.135 -      sigc::mem_fun ( *this , &MainWin::createNewMapWin ) );
  32.136 -
  32.137 -  uim=Gtk::UIManager::create();
  32.138 -  uim->insert_action_group(ag);
  32.139 -  add_accel_group(uim->get_accel_group());
  32.140 -
  32.141 -  try
  32.142 -  {
  32.143 -
  32.144 -    Glib::ustring ui_info =
  32.145 -      "<ui>"
  32.146 -      "  <menubar name='MenuBar'>"
  32.147 -      "    <menu action='FileMenu'>"
  32.148 -      "      <menuitem action='FileNew'/>"
  32.149 -      "      <menuitem action='FileOpen'/>"
  32.150 -      "      <menuitem action='FileClearTab'/>"
  32.151 -      "      <menuitem action='FileSave'/>"
  32.152 -      "      <menuitem action='FileSaveAs'/>"
  32.153 -      "      <menuitem action='Close'/>"
  32.154 -      "      <menuitem action='Quit'/>"
  32.155 -      "    </menu>"
  32.156 -      "    <menu action='ViewMenu'>"
  32.157 -      "      <menuitem action='ViewZoomIn' />"
  32.158 -      "      <menuitem action='ViewZoomOut' />"
  32.159 -      "      <menuitem action='ViewZoom100' />"
  32.160 -      "      <menuitem action='ViewZoomFit' />"
  32.161 -      "    </menu>"
  32.162 -      "    <menu action='ShowMenu'>"
  32.163 -      "      <menuitem action='ShowMaps'/>"
  32.164 -      "    </menu>"
  32.165 -      "    <menu action='AlgoMenu'>"
  32.166 -      "      <menuitem action='AlgoGeneral'/>"
  32.167 -      "      <menuitem action='AlgoKruskal'/>"
  32.168 -      "    </menu>"
  32.169 -      "  </menubar>"
  32.170 -      "  <toolbar name='ToolBar'>"
  32.171 -      "    <toolitem action='FileNew' />"
  32.172 -      "    <toolitem action='FileOpen' />"
  32.173 -      "    <toolitem action='FileSave' />"
  32.174 -      "    <toolitem action='Close' />"
  32.175 -      "    <separator />"
  32.176 -      "    <toolitem action='ViewZoomIn' />"
  32.177 -      "    <toolitem action='ViewZoomOut' />"
  32.178 -      "    <toolitem action='ViewZoom100' />"
  32.179 -      "    <toolitem action='ViewZoomFit' />"
  32.180 -      "    <separator />"
  32.181 -      "    <toolitem action='MoveItem' />"
  32.182 -      "    <toolitem action='CreateNode' />"
  32.183 -      "    <toolitem action='CreateEdge' />"
  32.184 -      "    <toolitem action='EraseItem' />"
  32.185 -      "    <toolitem action='EditEdgeMap' />"
  32.186 -      "    <toolitem action='EditNodeMap' />"
  32.187 -      "    <separator />"
  32.188 -      "    <toolitem action='AddMap' />"
  32.189 -      "  </toolbar>"
  32.190 -      "</ui>";
  32.191 -
  32.192 -    uim->add_ui_from_string(ui_info);
  32.193 -
  32.194 -  }
  32.195 -  catch(const Glib::Error& ex)
  32.196 -  {
  32.197 -    std::cerr << "building menus failed: " <<  ex.what();
  32.198 -  }
  32.199 -
  32.200 -  Gtk::Widget* menubar = uim->get_widget("/MenuBar");
  32.201 -  if (menubar){
  32.202 -    vbox.pack_start(*menubar, Gtk::PACK_SHRINK);
  32.203 -  }
  32.204 -
  32.205 -  Gtk::Widget* toolbar = uim->get_widget("/ToolBar");
  32.206 -  if (toolbar)
  32.207 -  {
  32.208 -    static_cast<Gtk::Toolbar*>(toolbar)->set_toolbar_style(Gtk::TOOLBAR_ICONS);
  32.209 -    vbox.pack_start(*toolbar, Gtk::PACK_SHRINK);
  32.210 -  }
  32.211 -
  32.212 -  tooltips.set_tip(*(uim->get_widget("/ToolBar/CreateNode")),"Create Node");
  32.213 -  tooltips.enable();
  32.214 -
  32.215 -  active_tab=-1;
  32.216 -  notebook.signal_switch_page().connect(sigc::mem_fun(*this, &MainWin::onChangeTab));
  32.217 -
  32.218 -  active_tool = MOVE;
  32.219 -
  32.220 -  vbox.pack_start(notebook);
  32.221 -  
  32.222 -  show_all_children();
  32.223 -}
  32.224 -
  32.225 -void MainWin::set_tabtitle(std::string name)
  32.226 -{
  32.227 -  if(strinst.find(name)==strinst.end())
  32.228 -    {
  32.229 -      tabnames[active_tab]=name;
  32.230 -      strinst[name]=1;
  32.231 -    }
  32.232 -  else
  32.233 -    {
  32.234 -      strinst[name]++;
  32.235 -      std::ostringstream o;
  32.236 -      o << strinst[name];
  32.237 -      tabnames[active_tab]=name+" - "+o.str();
  32.238 -    }
  32.239 -  set_title(tabnames[active_tab] + " - " + prog_name);
  32.240 -  notebook.set_tab_label_text((Widget&)*(tabs[active_tab]), tabnames[active_tab]);
  32.241 -  updateAlgoWinTabs();
  32.242 -}
  32.243 -
  32.244 -void MainWin::readFile(const std::string & filename)
  32.245 -{
  32.246 -  newTab();
  32.247 -  tabs[active_tab]->readFile(filename);
  32.248 -}
  32.249 -
  32.250 -void MainWin::newTab()
  32.251 -{
  32.252 -  int size=tabs.size();
  32.253 -  tabs.resize(size+1);
  32.254 -  tabnames.resize(size+1);
  32.255 -  active_tab=size;
  32.256 -  tabs[active_tab]=new NoteBookTab();
  32.257 -  tabs[active_tab]->signal_title_ch().connect(sigc::mem_fun(*this, &MainWin::set_tabtitle));
  32.258 -  tabs[active_tab]->signal_newmap_needed().connect(sigc::mem_fun(*this, &MainWin::createNewMapWinAfterSignal));
  32.259 -  tabs[active_tab]->gd_canvas->changeEditorialTool(active_tool);
  32.260 -  notebook.append_page((Gtk::Widget&)(*(tabs[active_tab])));
  32.261 -  notebook.set_current_page(size);
  32.262 -  set_tabtitle(_("unsaved file"));
  32.263 -  updateAlgoWinTabs();
  32.264 -}
  32.265 -
  32.266 -void MainWin::closeTab()
  32.267 -{
  32.268 -  if(active_tab!=-1)
  32.269 -    {
  32.270 -      if (tabs[active_tab]->mapstorage.modified)
  32.271 -	{
  32.272 -	  Gtk::MessageDialog mdialog(_("<b>Save changes before closing?</b>"), true, 
  32.273 -				     Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
  32.274 -	  mdialog.add_button(_("Close file _without Saving"), Gtk::RESPONSE_REJECT);
  32.275 -	  mdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
  32.276 -	  mdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
  32.277 -	  switch (mdialog.run())
  32.278 -	    {
  32.279 -	    case Gtk::RESPONSE_CANCEL:
  32.280 -	      return;
  32.281 -	    case Gtk::RESPONSE_REJECT:
  32.282 -	      break;
  32.283 -	    case Gtk::RESPONSE_ACCEPT:
  32.284 -	      tabs[active_tab]->saveFile();
  32.285 -	      break;
  32.286 -	    }
  32.287 -	}
  32.288 -      //tabs vector will be decreased with the deleted value
  32.289 -      int size=tabs.size();
  32.290 -      if(size>1)
  32.291 -	{
  32.292 -	  for(int i=active_tab+1;i<size;i++)
  32.293 -	    {
  32.294 -	      tabnames[i-1]=tabnames[i];
  32.295 -	      tabs[i-1]=tabs[i];
  32.296 -	    }
  32.297 -	}
  32.298 -      //if size==1 resize will delete the only element
  32.299 -      tabs.resize(size-1);
  32.300 -      tabnames.resize(size-1);
  32.301 -
  32.302 -      int old_active_tab=active_tab;
  32.303 -      notebook.remove_page(active_tab);
  32.304 -
  32.305 -      //If the first tab was active, upon delete notebook
  32.306 -      //will first switch one tab upper and not lower like
  32.307 -      //in the case, when not the first tab was active.
  32.308 -      //But after deletion it will become the first tab,
  32.309 -      //and this should be registrated in tabs vector,
  32.310 -      //as well.
  32.311 -      if((old_active_tab==0)&&(size!=1))
  32.312 -	{
  32.313 -	  onChangeTab(NULL,0);
  32.314 -	}
  32.315 -
  32.316 -      //if this was the last page in notebook, there is
  32.317 -      //no active_tab now
  32.318 -      if(size==1)
  32.319 -	{
  32.320 -	  active_tab=-1;
  32.321 -	}
  32.322 -
  32.323 -      updateAlgoWinTabs();
  32.324 -    }
  32.325 -}
  32.326 -
  32.327 -void MainWin::onChangeTab(GtkNotebookPage* page, guint page_num)
  32.328 -{
  32.329 -  page=page;
  32.330 -  active_tab=page_num;
  32.331 -  tabs[active_tab]->gd_canvas->changeEditorialTool(active_tool);
  32.332 -  set_title(tabnames[active_tab]);
  32.333 -}
  32.334 -
  32.335 -void MainWin::newFile()
  32.336 -{
  32.337 -  if(active_tab!=-1)
  32.338 -    {
  32.339 -      tabs[active_tab]->newFile();
  32.340 -    }
  32.341 -}
  32.342 - 
  32.343 -void MainWin::openFile()
  32.344 -{
  32.345 -  if(active_tab!=-1)
  32.346 -    {
  32.347 -      tabs[active_tab]->openFile();
  32.348 -    }
  32.349 -}
  32.350 - 
  32.351 -void MainWin::saveFile()
  32.352 -{
  32.353 -  if(active_tab!=-1)
  32.354 -    {
  32.355 -      tabs[active_tab]->saveFile();
  32.356 -    }
  32.357 -}
  32.358 - 
  32.359 -void MainWin::saveFileAs()
  32.360 -{
  32.361 -  if(active_tab!=-1)
  32.362 -    {
  32.363 -      tabs[active_tab]->saveFileAs();
  32.364 -    }
  32.365 -}
  32.366 - 
  32.367 -void MainWin::close()
  32.368 -{
  32.369 -  if(active_tab!=-1)
  32.370 -    {
  32.371 -      tabs[active_tab]->close();
  32.372 -    }
  32.373 -}
  32.374 -
  32.375 -void MainWin::zoomIn()
  32.376 -{
  32.377 -  if(active_tab!=-1)
  32.378 -    {
  32.379 -      tabs[active_tab]->gd_canvas->zoomIn();
  32.380 -    }
  32.381 -}
  32.382 -
  32.383 -void MainWin::zoomOut()
  32.384 -{
  32.385 -  if(active_tab!=-1)
  32.386 -    {
  32.387 -      tabs[active_tab]->gd_canvas->zoomOut();
  32.388 -    }
  32.389 -}
  32.390 -
  32.391 -void MainWin::zoomFit()
  32.392 -{
  32.393 -  if(active_tab!=-1)
  32.394 -    {
  32.395 -      tabs[active_tab]->gd_canvas->zoomFit();
  32.396 -    }
  32.397 -}
  32.398 -
  32.399 -void MainWin::zoom100()
  32.400 -{
  32.401 -  if(active_tab!=-1)
  32.402 -    {
  32.403 -      tabs[active_tab]->gd_canvas->zoom100();
  32.404 -    }
  32.405 -}
  32.406 -
  32.407 -void MainWin::createMapWin()
  32.408 -{
  32.409 -  if(active_tab!=-1)
  32.410 -    {
  32.411 -      tabs[active_tab]->createMapWin(tabnames[active_tab]);
  32.412 -    }
  32.413 -}
  32.414 -
  32.415 -void MainWin::createAlgoWin(int algoid)
  32.416 -{
  32.417 -  AlgoWin * aw=new AlgoWin(algoid, tabnames);
  32.418 -  aw->signal_closing().connect(sigc::mem_fun(*this, &MainWin::deRegisterAlgoWin));
  32.419 -  aw->signal_maplist_needed().connect(sigc::mem_fun(*this, &MainWin::updateAlgoWinMaps));
  32.420 -  aw->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &MainWin::createNewMapWinTabString));
  32.421 -  aws.insert(aw);
  32.422 -  aw->show();
  32.423 -}
  32.424 -
  32.425 -void MainWin::updateAlgoWinTabs()
  32.426 -{
  32.427 -  std::set< AlgoWin* >::iterator awsi=aws.begin();
  32.428 -  for(;awsi!=aws.end();awsi++)
  32.429 -    {
  32.430 -      (*awsi)->update_tablist(tabnames);
  32.431 -    }
  32.432 -}
  32.433 -
  32.434 -void MainWin::updateAlgoWinMaps(AlgoWin * awp, std::string tabname)
  32.435 -{
  32.436 -  int i=0;
  32.437 -  for(;(i<(int)tabnames.size())&&(tabnames[i]!=tabname);i++)
  32.438 -    {
  32.439 -    }
  32.440 -  awp->update_maplist(&(tabs[i]->mapstorage));
  32.441 -}
  32.442 -
  32.443 -void MainWin::deRegisterAlgoWin(AlgoWin * awp)
  32.444 -{
  32.445 -  aws.erase(awp);
  32.446 -}
  32.447 -
  32.448 -void MainWin::changeEditorialTool(int tool)
  32.449 -{
  32.450 -  active_tool=tool;
  32.451 -  if(active_tab!=-1)
  32.452 -    {
  32.453 -      tabs[active_tab]->gd_canvas->changeEditorialTool(tool);
  32.454 -    }
  32.455 -}
  32.456 -
  32.457 -void MainWin::createNewMapWin()
  32.458 -{
  32.459 -  if(active_tab!=-1)
  32.460 -    {
  32.461 -      NewMapWin * nmw=new NewMapWin(_("Create New Map - ")+tabnames[active_tab], *(tabs[active_tab]));
  32.462 -      nmw->show();
  32.463 -    }
  32.464 -}
  32.465 -
  32.466 -void MainWin::createNewMapWinTabString(std::string tabname, bool itisedge)
  32.467 -{
  32.468 -  int i=0;
  32.469 -  for(;((i<(int)tabnames.size())&&(tabnames[i]!=tabname));i++)
  32.470 -    {
  32.471 -    }
  32.472 -  createNewMapWinAfterSignal(tabs[i], itisedge);
  32.473 -}
  32.474 -
  32.475 -void MainWin::createNewMapWinAfterSignal(NoteBookTab * nbt, bool itisedge)
  32.476 -{
  32.477 -  std::vector<NoteBookTab*>::iterator nbti=tabs.begin();
  32.478 -  int i=0;
  32.479 -  for(;nbti!=tabs.end();nbti++)
  32.480 -    {
  32.481 -      if(*nbti!=nbt)
  32.482 -	{
  32.483 -	  i++;
  32.484 -	}
  32.485 -      else
  32.486 -	{
  32.487 -	  continue;
  32.488 -	}
  32.489 -    }
  32.490 -  NewMapWin * nmw=new NewMapWin(_("Create New Map - ")+tabnames[i], *nbt, itisedge, false);
  32.491 -  nmw->run();
  32.492 -}
    33.1 --- a/gui/main_win.h	Wed Jun 21 08:35:23 2006 +0000
    33.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.3 @@ -1,226 +0,0 @@
    33.4 -// -*- C++ -*- //
    33.5 -
    33.6 -#ifndef MAIN_WIN_H
    33.7 -#define MAIN_WIN_H
    33.8 -
    33.9 -#include "all_include.h"
   33.10 -#include "algowin.h"
   33.11 -#include "map_win.h"
   33.12 -#include "new_map_win.h"
   33.13 -#include "nbtab.h"
   33.14 -#include <libgnomecanvasmm.h>
   33.15 -#include <libgnomecanvasmm/polygon.h>
   33.16 -
   33.17 -
   33.18 -///This class is the main window of GUI.
   33.19 -
   33.20 -///It has menus, and a notebook. Notebook has different pages,
   33.21 -///the so called tabs (\ref NoteBookTab). Each \ref NoteBookTab contains a canvas on which graphs can be drawn.
   33.22 -///To manage creation and close of tabs and tabswitching is the task of MainWin.
   33.23 -class MainWin : public Gtk::Window
   33.24 -{
   33.25 -  ///Container in which the menus and the notebook is.
   33.26 -  Gtk::VBox vbox;
   33.27 -
   33.28 -  ///The notebook that has tabs (\ref NoteBookTab) with different graphs.
   33.29 -  Gtk::Notebook notebook;
   33.30 -
   33.31 -  ///The tool selected to manipulate graph.
   33.32 -
   33.33 -  ///It has to be stored, because in case of tabswitching
   33.34 -  ///the correct tool has to be set for the actual graph.
   33.35 -  int active_tool;
   33.36 -
   33.37 -  ///The number of active tab in the notebook.
   33.38 -  int active_tab;
   33.39 -
   33.40 -  ///Vector of existing tabs in the notebook.
   33.41 -  std::vector<NoteBookTab *> tabs;
   33.42 -
   33.43 -  ///Vector of the name of tabs.
   33.44 -
   33.45 -  ///All \ref NoteBookTab has a name that is stored here. The index of the name
   33.46 -  ///is the same as the index of the \ref NoteBookTab in \ref tabs.
   33.47 -  std::vector<std::string> tabnames;
   33.48 -
   33.49 -  ///Counter of occurence of the same file names.
   33.50 -
   33.51 -  ///If a file is opened more than once we have to score
   33.52 -  ///the occurences to let the titles on tabs different.
   33.53 -  ///If more than one occurence is present, from the second
   33.54 -  ///one near the filename the number of the occurence appear.
   33.55 -  std::map<std::string, int> strinst;
   33.56 -
   33.57 -  ///Set of opened \ref AlgoWin s.
   33.58 -
   33.59 -  ///More than one \refAlgoWin can be opened. We have to
   33.60 -  ///communicate with them in case of new \ref NoteBookTab creation,
   33.61 -  ///\ref NoteBookTab close, or map change. Therefore we have to score
   33.62 -  ///their occurences.
   33.63 -  std::set< AlgoWin* > aws;
   33.64 -
   33.65 -public:
   33.66 -  
   33.67 -  ///Constructor of the \ref MainWin.
   33.68 -
   33.69 -  ///It creates the menus, the toolbar and the notebook in which
   33.70 -  ///\ref NoteBookTab s take place. \ref NoteBookTab s are the
   33.71 -  ///holder of the canvases on which the graphs are drawn.
   33.72 -  MainWin();
   33.73 -
   33.74 -  ///Sets title of tabs.
   33.75 -
   33.76 -  ///It alse registrates it in \ref tabnames. If more than one
   33.77 -  ///occurence is in the notebook of the same file it has to
   33.78 -  ///extend tabname with the number of occurence.
   33.79 -  void set_tabtitle(std::string);
   33.80 -
   33.81 -  ///ActionGroup for menu
   33.82 -  Glib::RefPtr<Gtk::ActionGroup> ag;
   33.83 -
   33.84 -  ///UIManager for menu
   33.85 -  Glib::RefPtr<Gtk::UIManager> uim;
   33.86 -
   33.87 -  ///Creates a new \ref NoteBookTab and opens the given file.
   33.88 -
   33.89 -  ///It is called only with command line parameters at stratup.
   33.90 -  void readFile(const std::string &);
   33.91 -
   33.92 -  ///Tooltips
   33.93 -  Gtk::Tooltips tooltips;
   33.94 -
   33.95 -  //Call-backs of buttons
   33.96 -
   33.97 -  ///Callback for 'FileNew' action.
   33.98 -  virtual void newFile();
   33.99 -  ///Callback for 'FileOpen' action.
  33.100 -  virtual void openFile();
  33.101 -  ///Callback for 'FileSave' action.
  33.102 -  virtual void saveFile();
  33.103 -  ///Callback for 'FileSaveAs' action.
  33.104 -  virtual void saveFileAs();
  33.105 -  ///Callback for 'Close' action.
  33.106 -  virtual void close();
  33.107 -
  33.108 -  //Toolbar
  33.109 -
  33.110 -  ///Callback for 'zoomIn' action.
  33.111 -
  33.112 -  ///It calls the appropriate function in
  33.113 -  ///\ref GraphDisplayerCanvas
  33.114 -  virtual void zoomIn();
  33.115 -  ///Callback for 'zoomOut' action.
  33.116 -
  33.117 -  ///It calls the appropriate function in
  33.118 -  ///\ref GraphDisplayerCanvas
  33.119 -  virtual void zoomOut();
  33.120 -  ///Callback for 'zoomFit' action.
  33.121 -
  33.122 -  ///It calls the appropriate function in
  33.123 -  ///\ref GraphDisplayerCanvas
  33.124 -  virtual void zoomFit();
  33.125 -  ///Callback for 'zoom100' action.
  33.126 -
  33.127 -  ///It calls the appropriate function in
  33.128 -  ///\ref GraphDisplayerCanvas
  33.129 -  virtual void zoom100();
  33.130 -
  33.131 -  ///Callback for Show Maps menupoint.
  33.132 -
  33.133 -  ///It calls the appropriate function in
  33.134 -  ///\ref NoteBookTab
  33.135 -  virtual void createMapWin();
  33.136 -
  33.137 -  ///Pops up an Algorithm window.
  33.138 -
  33.139 -  ///It not only creates but registrates the newly created \ref AlgoWin.
  33.140 -  ///It is necessary, because in case of changement between tabs or maps
  33.141 -  ///we have to communicate with it. Signals are also have to be connected
  33.142 -  ///to it, because \ref AlgoWin emits signals if it needs anything (maplist, deregistration).
  33.143 -  ///\param algo type of the algorithm to run.
  33.144 -  virtual void createAlgoWin(int algo);
  33.145 -
  33.146 -  ///Deregisters AlgoWin
  33.147 -
  33.148 -  ///This is the function connected to the closing signal of \ref AlgoWin.
  33.149 -  ///It only deletes the sender \ref AlgoWin from \ref aws. This function
  33.150 -  ///is called only by the closing \ref AlgoWin itself.
  33.151 -  ///\param aw the \ref AlgoWin to delete.
  33.152 -  virtual void deRegisterAlgoWin(AlgoWin * aw);
  33.153 -
  33.154 -  ///Updates list of tabs in all of the \ref AlgoWin
  33.155 -
  33.156 -  ///When \ref NoteBookTab inserted somewhere or closed one tablist in all \ref AlgoWin
  33.157 -  ///have to be updated. That is why we score all the opened \ref AlgoWin.
  33.158 -  ///During update \ref tabnames will be passed to each \ref AlgoWin.
  33.159 -  virtual void updateAlgoWinTabs();
  33.160 -
  33.161 -  ///Refresh list of maps in the AlgoWin that requested it.
  33.162 -
  33.163 -  ///In an \ref AlgoWin there is a ComboBoxText, in which
  33.164 -  ///a \ref NoteBookTab can be chosen that contains the graph and the maps,
  33.165 -  ///on which we would like to run algorithms. If we change the
  33.166 -  ///tab the available maps also have to be updated, because
  33.167 -  ///in the different tabs different maps are available. Therefore
  33.168 -  ///on tab change the \ref AlgoWin emits a signal that contains itself
  33.169 -  ///so that the appropriate maps can be sent to it. For the sake of simplicity
  33.170 -  ///the program answers this call with the mapstorage of the newly selected tab.
  33.171 -  ///\param aw the caller \ref AlgoWin
  33.172 -  ///\param tabname the newly selected tab in the \ref AlgoWin
  33.173 -  virtual void updateAlgoWinMaps(AlgoWin * aw, std::string tabname);
  33.174 -
  33.175 -  ///Registrates the new graph-editor tool in hand.
  33.176 -
  33.177 -  ///The editor-tool in hand is global, it is the same for all tab
  33.178 -  ///at the same time. Therefore the active tool has to be scored here (\ref active_tool).
  33.179 -  ///This function is the callback function of the editor-tool buttons. It sets \ref active_tool
  33.180 -  ///to the correct value.
  33.181 -  ///\param tool the newly selected graph-editor tool (See all_include.h)
  33.182 -  virtual void changeEditorialTool(int tool);
  33.183 -
  33.184 -  ///Pops up a \ref NewMapWin dialog after requested by a \ref MapWin
  33.185 -
  33.186 -  ///Each tab can pop-up a \ref MapWin. In \ref MapWin new tab can be created.
  33.187 -  ///In this case \ref NoteBookTab emits a signal. This function is connected to that signal.
  33.188 -  ///It sends the caller \ref NoteBookTab and whether an edgemap or a nodemap should be created.
  33.189 -  ///Caller \ref NoteBookTab is necessary for the window to be able to place the new map in its
  33.190 -  ///correct place.
  33.191 -  ///\param nbt the caller tab
  33.192 -  ///\param itisedge true if edgemap has to be created, false if nodemap
  33.193 -  virtual void createNewMapWinAfterSignal(NoteBookTab * nbt, bool itisedge);
  33.194 -
  33.195 -  ///Pops up a \ref NewMapWin dialog after requested by an \ref AlgoWin
  33.196 -
  33.197 -  ///\ref AlgoWin can also can request a \ref NewMapWin to pop-up. 
  33.198 -  ///It emits a signal in this case. This function is bound to that signal.
  33.199 -  ///The signal contains the name of \ref NoteBookTab in which the new map has to be
  33.200 -  ///placed and whether the new map is an edgemap or a nodemap.
  33.201 -  ///\ref tabname the tab in which the new map has to be placed
  33.202 -  ///\ref itisedge true if the new map will be edge map, false if it will be nodemap
  33.203 -  virtual void createNewMapWinTabString(std::string tabname, bool itisedge);
  33.204 -
  33.205 -  ///Pops up a \ref NewMapWin dialog if button on \ref MainWin has been pressed.
  33.206 -
  33.207 -  ///In this case a general \ref NewMapWin will be popped up. This means that
  33.208 -  ///both edge and nodemap can be created by it. The new map will be placed in
  33.209 -  ///\MapStorage of the actual selected \ref NoteBookTab.
  33.210 -  virtual void createNewMapWin();
  33.211 -
  33.212 -  //Notebook handlers
  33.213 -  ///Callback for 'FileNewTab' action.
  33.214 -  virtual void newTab();
  33.215 -
  33.216 -  ///Callback for 'FileCloseTab' action.
  33.217 -
  33.218 -  ///It closes the actual \ref NoteBookTab and registrates this event:
  33.219 -  ///data is shifted to the correct places in vectors.
  33.220 -  virtual void closeTab();
  33.221 -
  33.222 -  ///Tabswitching handler
  33.223 -
  33.224 -  ///Sets the variables that have to store the actual state, and it
  33.225 -  ///updates the title of window to the actually selected \ref NoteBookTab.
  33.226 -  virtual void onChangeTab(GtkNotebookPage*, guint);
  33.227 -};
  33.228 -
  33.229 -#endif //MAIN_WIN_H
    34.1 --- a/gui/map_win.cc	Wed Jun 21 08:35:23 2006 +0000
    34.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.3 @@ -1,116 +0,0 @@
    34.4 -#include "map_win.h"
    34.5 -#include <set>
    34.6 -
    34.7 -bool MapWin::closeIfEscapeIsPressed(GdkEventKey* e)
    34.8 -{
    34.9 -  if(e->keyval==GDK_Escape)
   34.10 -  {
   34.11 -    mytab.closeMapWin();
   34.12 -    //    hide();
   34.13 -  }
   34.14 -  return true;
   34.15 -}
   34.16 -
   34.17 -MapWin::MapWin(const std::string& title, std::vector<std::string> eml, std::vector<std::string> nml, NoteBookTab & mw):mytab(mw)
   34.18 -{
   34.19 -  set_title(title);
   34.20 -  set_default_size(200, 50);
   34.21 -
   34.22 -  signal_key_press_event().connect(sigc::mem_fun(*this, &MapWin::closeIfEscapeIsPressed));
   34.23 -
   34.24 -  e_combo_array=new MapSelector * [EDGE_PROPERTY_NUM];
   34.25 -
   34.26 -  table=new Gtk::Table(EDGE_PROPERTY_NUM, 1, false);
   34.27 -
   34.28 -  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
   34.29 -  {
   34.30 -    e_combo_array[i]=new MapSelector(eml, mytab.getActiveEdgeMap(i), edge_property_strings[i], true);
   34.31 -
   34.32 -    (*table).attach((*(e_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
   34.33 -
   34.34 -    e_combo_array[i]->signal_cbt_ch().connect(sigc::bind(sigc::mem_fun(*this, &MapWin::edgeMapChanged), i));
   34.35 -    e_combo_array[i]->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &MapWin::newMapWinNeeded));
   34.36 -  }
   34.37 -
   34.38 -  vbox.pack_start(*(new Gtk::Label("Edge properties")));
   34.39 -
   34.40 -  vbox.pack_start(*table);
   34.41 -
   34.42 -  vbox.pack_start(*(new Gtk::HSeparator));
   34.43 -
   34.44 -  n_combo_array=new MapSelector * [NODE_PROPERTY_NUM];
   34.45 -
   34.46 -  table=new Gtk::Table(NODE_PROPERTY_NUM, 1, false);
   34.47 -
   34.48 -  for(int i=0;i<NODE_PROPERTY_NUM;i++)
   34.49 -  {
   34.50 -    n_combo_array[i]=new MapSelector(nml, mytab.getActiveNodeMap(i), node_property_strings[i], false);
   34.51 -
   34.52 -    (*table).attach((*(n_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
   34.53 -
   34.54 -    n_combo_array[i]->signal_cbt_ch().connect(sigc::bind(sigc::mem_fun(*this, &MapWin::nodeMapChanged), i));
   34.55 -    n_combo_array[i]->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &MapWin::newMapWinNeeded));
   34.56 -  }
   34.57 -
   34.58 -  add(vbox);
   34.59 -
   34.60 -  vbox.pack_start(*(new Gtk::Label("Node properties")));
   34.61 -
   34.62 -  vbox.pack_start(*table);
   34.63 -
   34.64 -  show_all_children();
   34.65 -
   34.66 -}
   34.67 -
   34.68 -void MapWin::nodeMapChanged(std::string mapname, int prop)
   34.69 -{
   34.70 -  mytab.propertyChange(false, prop, mapname);
   34.71 -}
   34.72 -
   34.73 -void MapWin::edgeMapChanged(std::string mapname, int prop)
   34.74 -{
   34.75 -  mytab.propertyChange(true, prop, mapname);
   34.76 -}
   34.77 -
   34.78 -void MapWin::newMapWinNeeded(bool itisedge)
   34.79 -{
   34.80 -  mytab.popupNewMapWin(itisedge);
   34.81 -}
   34.82 -
   34.83 -void MapWin::update(std::vector<std::string> eml, std::vector<std::string> nml)
   34.84 -{
   34.85 -  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
   34.86 -  {
   34.87 -    e_combo_array[i]->update_list(eml);
   34.88 -  }
   34.89 -
   34.90 -  for(int i=0;i<NODE_PROPERTY_NUM;i++)
   34.91 -  {
   34.92 -    n_combo_array[i]->update_list(nml);
   34.93 -  }
   34.94 -}
   34.95 -
   34.96 -void MapWin::registerNewEdgeMap(std::string newmapname)
   34.97 -{
   34.98 -  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
   34.99 -  {
  34.100 -    //filling in combo box with choices
  34.101 -    e_combo_array[i]->append_text((Glib::ustring)newmapname);
  34.102 -  }
  34.103 -}
  34.104 -
  34.105 -void MapWin::registerNewNodeMap(std::string newmapname)
  34.106 -{
  34.107 -  for(int i=0;i<NODE_PROPERTY_NUM;i++)
  34.108 -  {
  34.109 -    //filling in combo box with choices
  34.110 -    n_combo_array[i]->append_text((Glib::ustring)newmapname);
  34.111 -  }
  34.112 -}
  34.113 -
  34.114 -bool MapWin::on_delete_event(GdkEventAny * event)
  34.115 -{
  34.116 -  event=event;
  34.117 -  mytab.closeMapWin();
  34.118 -  return true;
  34.119 -}
    35.1 --- a/gui/map_win.h	Wed Jun 21 08:35:23 2006 +0000
    35.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.3 @@ -1,117 +0,0 @@
    35.4 -// -*- C++ -*- //
    35.5 -
    35.6 -#ifndef MAP_WIN_H
    35.7 -#define MAP_WIN_H
    35.8 -
    35.9 -class MapWin;
   35.10 -
   35.11 -#include <all_include.h>
   35.12 -#include <nbtab.h>
   35.13 -#include <mapselector.h>
   35.14 -#include <libgnomecanvasmm.h>
   35.15 -#include <libgnomecanvasmm/polygon.h>
   35.16 -
   35.17 -///Graph visualization setup window.
   35.18 -
   35.19 -///This class is responsible for creating a window,
   35.20 -///on which the visualization attributes can be
   35.21 -///assigned to maps.
   35.22 -class MapWin : public Gtk::Window
   35.23 -{
   35.24 -protected:
   35.25 -  ///\ref NoteBookTab to that the \ref MapWin belongs to.
   35.26 -  NoteBookTab & mytab;
   35.27 -
   35.28 -  ///Designing element
   35.29 -  Gtk::Table * table;
   35.30 -  
   35.31 -  ///\ref MapSelectors for each property
   35.32 -
   35.33 -  ///Each property has an own \ref MapSelector through which
   35.34 -  ///the map to visualize by the property van be set.
   35.35 -  MapSelector ** e_combo_array;
   35.36 -
   35.37 -  ///\ref MapSelectors for each property
   35.38 -
   35.39 -  ///Each property has an own \ref MapSelector through which
   35.40 -  ///the map to visualize by the property van be set.
   35.41 -  MapSelector ** n_combo_array;
   35.42 -
   35.43 -  ///Information holder
   35.44 -  Gtk::Label * label;
   35.45 -
   35.46 -  ///Container in which elements are organized.
   35.47 -  Gtk::VBox vbox;
   35.48 -
   35.49 -public:
   35.50 -  ///Constructor
   35.51 -
   35.52 -  ///It creates the widgets shown in \ref MapWin and
   35.53 -  ///binds the needed signal to the correct place.
   35.54 -  ///\param title title of window
   35.55 -  ///\param eml edgemap list
   35.56 -  ///\param nml nodemap list
   35.57 -  ///\param mw the owner \ref NoteBookTab (\ref mytab)
   35.58 -  MapWin(const std::string& title, std::vector<std::string> eml, std::vector<std::string> nml, NoteBookTab & mw);
   35.59 -
   35.60 -  ///Deregistrates \ref MapWin in its \ref NoteBookTab (\ref mytab)
   35.61 -  virtual bool on_delete_event(GdkEventAny *);
   35.62 -
   35.63 -  ///Handles changement in nodemap selection
   35.64 -
   35.65 -  ///If \ref MapSelector emits a signal that indicates
   35.66 -  ///changement in nodemap selection this function will
   35.67 -  ///be called. It calls the appropriate handler function,
   35.68 -  ///\ref NoteBookTab::propertyChange with parameters describing the changement.
   35.69 -  ///\param mapname the recently selected map
   35.70 -  ///\param prop the changed property
   35.71 -  void nodeMapChanged(std::string mapname, int prop);
   35.72 -
   35.73 -  ///Handles changement in edgemap selection
   35.74 -
   35.75 -  ///If \ref MapSelector emits a signal that indicates
   35.76 -  ///changement in edgemap selection this function will
   35.77 -  ///be called. It calls the appropriate handler function,
   35.78 -  ///\ref NoteBookTab::propertyChange with parameters describing the changement.
   35.79 -  ///\param mapname the recently selected map
   35.80 -  ///\param prop the changed property
   35.81 -  void edgeMapChanged(std::string mapname, int prop);
   35.82 -
   35.83 -  ///Indicates to the owner \ref NoteBookTab that a \ref NewMapWin should be opened.
   35.84 -
   35.85 -  ///This function is bound to the
   35.86 -  ///signal emitted by the \ref MapSelector in case of
   35.87 -  ///the user wants to create a new map. It only pass the
   35.88 -  ///information further to the tab owning this \ref MapWin that is needed to open the
   35.89 -  ///\ref NewMapWin. (\ref NoteBookTab::popupNewMapWin)
   35.90 -  ///\param itisedge should the new map will be an edgemap? (or nodemap)
   35.91 -  void newMapWinNeeded(bool itisedge);
   35.92 -
   35.93 -  ///This function inserts name of the new edgemap in the name list in \ref MapSelector s
   35.94 -
   35.95 -  ///\param new_name
   35.96 -  ///name of new map
   35.97 -  void registerNewEdgeMap(std::string new_name);
   35.98 -
   35.99 -  ///This function inserts name of the new nodemap in the name list in \ref MapSelector s
  35.100 -
  35.101 -  ///\param new_name
  35.102 -  ///name of new map
  35.103 -  void registerNewNodeMap(std::string new_name);
  35.104 -
  35.105 -  ///Close window if Esc key pressed.
  35.106 -  virtual bool closeIfEscapeIsPressed(GdkEventKey*);
  35.107 -
  35.108 -  ///Updates list of maps in all \ref MapSelector
  35.109 -
  35.110 -  ///This function is called by \ref NoteBookTab, when the file
  35.111 -  ///showed in it has changed, therefore the contained maps
  35.112 -  ///have changed as well. \ref NoteBookTab knows, whether it
  35.113 -  ///has to call this function or not from the \ref NoteBookTab::mapwinexists
  35.114 -  ///variable.
  35.115 -  ///\param eml edge map list
  35.116 -  ///\param nml node map list
  35.117 -  void update(std::vector<std::string> eml, std::vector<std::string> nml);
  35.118 -};
  35.119 -
  35.120 -#endif //MAP_WIN_H
    36.1 --- a/gui/mapselector.cc	Wed Jun 21 08:35:23 2006 +0000
    36.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.3 @@ -1,140 +0,0 @@
    36.4 -#include "mapselector.h"
    36.5 -
    36.6 -MapSelector::MapSelector(std::vector<std::string> ml, std::string act, std::string labeltext, bool edge, bool d):def(d),itisedge(edge),set_new_map(false)
    36.7 -{
    36.8 -  update_list(ml);
    36.9 -
   36.10 -  if(act=="")
   36.11 -    {
   36.12 -      cbt.set_active(0);
   36.13 -      default_state=true;
   36.14 -    }
   36.15 -  else
   36.16 -    {
   36.17 -      cbt.set_active_text((Glib::ustring)act);
   36.18 -      default_state=false;
   36.19 -    }
   36.20 -
   36.21 -  //binding signal to the actual entry
   36.22 -  cbt.signal_changed().connect
   36.23 -    (
   36.24 -     sigc::mem_fun((*this), &MapSelector::comboChanged),
   36.25 -     false
   36.26 -     );
   36.27 -  
   36.28 -  label=new Gtk::Label(labeltext);
   36.29 -
   36.30 -  label->set_width_chars(longest_property_string_length);
   36.31 -
   36.32 -  defbut=NULL;
   36.33 -  if(def)
   36.34 -    {
   36.35 -      defbut=new Gtk::Button();
   36.36 -      defbut->set_label("Reset");
   36.37 -      
   36.38 -      defbut->signal_pressed().connect
   36.39 -	(
   36.40 -	 sigc::mem_fun(*this, &MapSelector::reset)
   36.41 -	 );
   36.42 -    }
   36.43 -
   36.44 -  newbut=new Gtk::Button(Gtk::Stock::NEW);
   36.45 -
   36.46 -  newbut->signal_pressed().connect
   36.47 -    (
   36.48 -     sigc::mem_fun(*this, &MapSelector::new_but_pressed)
   36.49 -     );
   36.50 -
   36.51 -  add(*label);
   36.52 -
   36.53 -  add(cbt);
   36.54 -
   36.55 -  if(def)
   36.56 -    {
   36.57 -      add(*defbut);
   36.58 -    }
   36.59 -
   36.60 -  add(*newbut);
   36.61 -}
   36.62 -
   36.63 -void MapSelector::new_but_pressed()
   36.64 -{
   36.65 -  set_new_map=true;
   36.66 -  signal_newmapwin.emit(itisedge);
   36.67 -}
   36.68 -
   36.69 -void MapSelector::update_list( std::vector< std::string > ml )
   36.70 -{
   36.71 -  int prev_act=cbt.get_active_row_number();
   36.72 -  cbt.clear();
   36.73 -  std::vector< std::string >::iterator emsi=ml.begin();
   36.74 -  for(;emsi!=ml.end();emsi++)
   36.75 -    {
   36.76 -      cbt.append_text(*emsi);
   36.77 -    }
   36.78 -  if(def)
   36.79 -    {
   36.80 -      cbt.prepend_text("Default values");
   36.81 -    }
   36.82 -  if(prev_act!=-1)
   36.83 -    {
   36.84 -      cbt.set_active(prev_act);
   36.85 -    }
   36.86 -}
   36.87 -
   36.88 -void MapSelector::comboChanged()
   36.89 -{
   36.90 -  if(cbt.get_active_row_number()!=0 || !def)
   36.91 -    {
   36.92 -      default_state=false;
   36.93 -      Glib::ustring mapname = cbt.get_active_text();
   36.94 -      if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
   36.95 -	{
   36.96 -	  signal_cbt.emit(mapname);
   36.97 -	}
   36.98 -    }
   36.99 -  else if((!default_state)&&(cbt.get_active_row_number()==0))
  36.100 -    {
  36.101 -      reset();
  36.102 -    }
  36.103 -}
  36.104 -
  36.105 -void MapSelector::reset()
  36.106 -{
  36.107 -  default_state=true;
  36.108 -
  36.109 -  cbt.set_active(0);
  36.110 -
  36.111 -  signal_cbt.emit("");
  36.112 -}
  36.113 -
  36.114 -
  36.115 -Glib::ustring MapSelector::get_active_text()
  36.116 -{
  36.117 -  return cbt.get_active_text();
  36.118 -}
  36.119 -
  36.120 -void MapSelector::set_active_text(Glib::ustring text)
  36.121 -{
  36.122 -  cbt.set_active_text(text);
  36.123 -}
  36.124 -
  36.125 -void MapSelector::append_text(Glib::ustring text)
  36.126 -{
  36.127 -  cbt.append_text(text);
  36.128 -  if(set_new_map)
  36.129 -    {
  36.130 -      set_active_text(text);
  36.131 -      set_new_map=false;
  36.132 -    }
  36.133 -}
  36.134 -
  36.135 -sigc::signal<void, std::string> MapSelector::signal_cbt_ch()
  36.136 -{
  36.137 -  return signal_cbt;
  36.138 -}
  36.139 -
  36.140 -sigc::signal<void, bool> MapSelector::signal_newmapwin_needed()
  36.141 -{
  36.142 -  return signal_newmapwin;
  36.143 -}
    37.1 --- a/gui/mapselector.h	Wed Jun 21 08:35:23 2006 +0000
    37.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.3 @@ -1,158 +0,0 @@
    37.4 -// -*- C++ -*- //
    37.5 -
    37.6 -#ifndef MAPSELECTOR_H
    37.7 -#define MAPSELECTOR_H
    37.8 -
    37.9 -class MapSelector;
   37.10 -
   37.11 -#include <all_include.h>
   37.12 -#include <map_win.h>
   37.13 -#include <libgnomecanvasmm.h>
   37.14 -#include <libgnomecanvasmm/polygon.h>
   37.15 -
   37.16 -///A widget by which node and edgemaps can be selected, deselected and created.
   37.17 -
   37.18 -///During the usage of \ref glemon we have to select
   37.19 -///maps several times. We also need some aid-function
   37.20 -///like new map creation and deselecting previously
   37.21 -///selected map. Instead of writing a the mapselection
   37.22 -///at all occurences we can use this widget by connecting
   37.23 -///its signals to the correct place.
   37.24 -class MapSelector : public Gtk::HBox
   37.25 -{
   37.26 - protected:
   37.27 -  ///This signal indicates that the selection has been changed by user.
   37.28 -  sigc::signal<void, std::string> signal_cbt;
   37.29 -
   37.30 -  ///Signal that indicates that user wants to create a new map.
   37.31 -  sigc::signal<void, bool> signal_newmapwin;
   37.32 -
   37.33 -  ///If this is true, beyond the mapnames a 'Default' selection is available as well.
   37.34 -
   37.35 -  ///For example \ref MapWin needs 'Default' option as well. In this case no map
   37.36 -  ///will be visualized by the appropriate property.
   37.37 -  ///But \ref AlgoWin do not need 'Default' option, because if no map is selected,
   37.38 -  ///no algorithm can be run.
   37.39 -  ///Its value is got and set in contructor.
   37.40 -  bool def;
   37.41 -
   37.42 -  ///Are the names of edgemaps or nodemaps stored here.
   37.43 -  bool itisedge;
   37.44 -
   37.45 -  ///Shows whether 'Default' option is selected or not.
   37.46 -  bool default_state;
   37.47 -
   37.48 -  ///It is true when the new button had been pressed but the new map has not been registrated yet.
   37.49 -
   37.50 -  ///Before signal of \ref NewMapWin request is emitted by the \ref MapSelector
   37.51 -  ///this variable is set to true. When the new map
   37.52 -  ///is done, it will be registrated in all existing \ref MapSelector 
   37.53 -  ///by \ref append_text function. That function checks
   37.54 -  ///whether this variable is true. If it is true that means
   37.55 -  ///that this \ref MapSelector has requested \ref NewMapWin.
   37.56 -  ///Therefore it set itself to the recently created map.
   37.57 -  ///After that \ref set_new_map is set again false, not to
   37.58 -  ///set maps active if \ref MapSelector piece is not the requester.
   37.59 -  bool set_new_map;
   37.60 -
   37.61 -  ///The widget that holds the names of maps.
   37.62 -
   37.63 -  ///It can be rolled down
   37.64 -  ///Names in it are selectable.
   37.65 -  Gtk::ComboBoxText cbt;
   37.66 -
   37.67 -  ///New button.
   37.68 -
   37.69 -  ///By pressing it
   37.70 -  ///\ref NewMapWin wilol pop-up
   37.71 -  Gtk::Button * newbut;
   37.72 -
   37.73 -  ///Reset button.
   37.74 -
   37.75 -  ///If pressed \ref cbt will
   37.76 -  ///set to 'Default' option.
   37.77 -  ///
   37.78 -  ///It is visible only if \ref def is true.
   37.79 -  Gtk::Button * defbut;
   37.80 -
   37.81 -  ///Container in which GUI elements are packed.
   37.82 -  Gtk::HBox hbox;
   37.83 -
   37.84 -  ///Shows purpose of \ref MapSelector piece.
   37.85 -  Gtk::Label * label;
   37.86 -
   37.87 - public:
   37.88 -
   37.89 -  ///Constructor of \ref MapSelector
   37.90 -
   37.91 -  ///Creates the layout and binds signal to the correct place.
   37.92 -  ///\param optionlist list of names to place in \ref cbt
   37.93 -  ///\param act preselected option
   37.94 -  ///\param purpose text of label indicating purpose of \ref MapStorage
   37.95 -  ///\param itisedge do \ref MapSelector contains edgemap names or nodemapnames.
   37.96 -  ///\param def do we need 'Default' option. See \ref def.
   37.97 -  MapSelector(std::vector<std::string> optionlist, std::string act, std::string purpose, bool itisedge, bool def=true);
   37.98 -
   37.99 -  ///Returns signal emitted if the user has changed the selection. (\ref signal_cbt)
  37.100 -  sigc::signal<void, std::string> signal_cbt_ch();
  37.101 -
  37.102 -  ///Returns signal emitted if the user has pressed New button (\ref newbut) (\ref signal_newmapwin)
  37.103 -  sigc::signal<void, bool> signal_newmapwin_needed();
  37.104 -
  37.105 -  ///Maintain \ref cbt.
  37.106 -
  37.107 -  ///Fills in \ref cbt with names, taking
  37.108 -  ///into account that the previously selected option
  37.109 -  ///has to be set back after the operation.
  37.110 -  void update_list( std::vector<std::string> );
  37.111 -
  37.112 -  ///Handles changement in \ref cbt.
  37.113 -
  37.114 -  ///In default case it emits a signal with the selected option.
  37.115 -  ///But if 'Default' option is selected, it resets the \ref MapSelector
  37.116 -  virtual void comboChanged();
  37.117 -
  37.118 -  ///Requests a \ref NewMapWin
  37.119 -
  37.120 -  ///See \ref set_new_map.
  37.121 -  ///First it sets \ref set_new_map true to be identified
  37.122 -  ///at registration of new map that
  37.123 -  ///it has sent the \ref signal_newmapwin, therefore it
  37.124 -  ///has to set \ref cbt to that option.
  37.125 -  virtual void new_but_pressed();
  37.126 -
  37.127 -  ///If called, 'Default' option is selected, that means unselection of any maps.
  37.128 -
  37.129 -  ///Practically this means that if this is called,
  37.130 -  ///properties of graph will set to default state.
  37.131 -  ///The function achieves this by emitting appropriately
  37.132 -  ///parametrized signal_cbt.
  37.133 -  virtual void reset();
  37.134 -
  37.135 -  ///Returns the currently selected option.
  37.136 -  Glib::ustring get_active_text();
  37.137 -
  37.138 -  ///Sets the parameter active in \ref cbt.
  37.139 -
  37.140 -  ///\param new_value the
  37.141 -  ///new value to be set in \ref cbt.
  37.142 -  void set_active_text(Glib::ustring new_value);
  37.143 -
  37.144 -  ///Sets the parameter active in \ref cbt.
  37.145 -  ///\param index the
  37.146 -  ///index of row to be set in \ref cbt.
  37.147 -  void set_active(int index){cbt.set_active(index);};
  37.148 -
  37.149 -  ///Clear all options from \ref cbt.
  37.150 -  void clear(){cbt.clear();};
  37.151 -
  37.152 -  ///Appends a new option to the existing ones in \ref cbt.
  37.153 -
  37.154 -  ///If \ref set_new_map is true, the
  37.155 -  ///\ref MapSelector has requested the opened \ref NewMapWin,
  37.156 -  ///from that the option to append is coming. In this case
  37.157 -  ///this function  will set \ref cbt to the new option.
  37.158 -  ///\param new_option new option to append
  37.159 -  void append_text(Glib::ustring new_option);
  37.160 -};
  37.161 -#endif //MAPSELECTOR_H
    38.1 --- a/gui/mapstorage.cc	Wed Jun 21 08:35:23 2006 +0000
    38.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.3 @@ -1,479 +0,0 @@
    38.4 -#include "mapstorage.h"
    38.5 -#include "gui_writer.h"
    38.6 -#include "gui_reader.h"
    38.7 -#include <limits>
    38.8 -#include <cmath>
    38.9 -#include <gtkmm.h>
   38.10 -
   38.11 -MapStorage::MapStorage() : modified(false), file_name(""), arrow_pos_read_ok(false)
   38.12 -{
   38.13 -  nodemap_storage["coordinates_x"] = new Graph::NodeMap<double>(graph);
   38.14 -  coords.setXMap(*nodemap_storage["coordinates_x"]);
   38.15 -  nodemap_storage["coordinates_y"] = new Graph::NodeMap<double>(graph);
   38.16 -  coords.setYMap(*nodemap_storage["coordinates_y"]);
   38.17 -
   38.18 -  edgemap_storage["arrow_pos_x"] = new Graph::EdgeMap<double>(graph);
   38.19 -  arrow_pos.setXMap(*edgemap_storage["arrow_pos_x"]);
   38.20 -  edgemap_storage["arrow_pos_y"] = new Graph::EdgeMap<double>(graph);
   38.21 -  arrow_pos.setYMap(*edgemap_storage["arrow_pos_y"]);
   38.22 -
   38.23 -  nodemap_storage["label"] = new Graph::NodeMap<double>(graph);
   38.24 -  edgemap_storage["label"] = new Graph::EdgeMap<double>(graph);
   38.25 -
   38.26 -  nodemap_default["label"] = 1.0;
   38.27 -  edgemap_default["label"] = 1.0;
   38.28 -
   38.29 -  active_nodemaps.resize(NODE_PROPERTY_NUM);
   38.30 -  for(int i=0;i<NODE_PROPERTY_NUM;i++)
   38.31 -    {
   38.32 -      active_nodemaps[i]="";
   38.33 -    }
   38.34 -
   38.35 -  active_edgemaps.resize(EDGE_PROPERTY_NUM);
   38.36 -  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
   38.37 -    {
   38.38 -      active_edgemaps[i]="";
   38.39 -    }
   38.40 -}
   38.41 -
   38.42 -MapStorage::~MapStorage()
   38.43 -{
   38.44 -  for (std::map<std::string, Graph::NodeMap<double>*>::const_iterator it =
   38.45 -      nodemap_storage.begin(); it != nodemap_storage.end(); ++it)
   38.46 -  {
   38.47 -    delete it->second;
   38.48 -  }
   38.49 -  for (std::map<std::string, Graph::EdgeMap<double>*>::const_iterator it =
   38.50 -      edgemap_storage.begin(); it != edgemap_storage.end(); ++it)
   38.51 -  {
   38.52 -    delete it->second;
   38.53 -  }
   38.54 -}
   38.55 -
   38.56 -int MapStorage::addNodeMap(const std::string & name, Graph::NodeMap<double> *nodemap, double default_value)
   38.57 -{
   38.58 -  std::cout << default_value << std::endl;
   38.59 -  if( nodemap_storage.find(name) == nodemap_storage.end() )
   38.60 -    {
   38.61 -      nodemap_storage[name]=nodemap;
   38.62 -      // set the maps default value
   38.63 -      nodemap_default[name] = default_value;
   38.64 -
   38.65 -      //announce changement in maps
   38.66 -      signal_node_map.emit(name);
   38.67 -      return 0;
   38.68 -    }
   38.69 -  return 1;
   38.70 -}
   38.71 -
   38.72 -void MapStorage::changeActiveMap(bool itisedge, int prop, std::string mapname)
   38.73 -{
   38.74 -  if(itisedge)
   38.75 -    {
   38.76 -      active_edgemaps[prop]=mapname;
   38.77 -    }
   38.78 -  else
   38.79 -    {
   38.80 -      active_nodemaps[prop]=mapname;
   38.81 -    }
   38.82 -  signal_prop.emit(itisedge, prop);
   38.83 -}
   38.84 -
   38.85 -std::string MapStorage::getActiveEdgeMap(int prop)
   38.86 -{
   38.87 -  return active_edgemaps[prop];
   38.88 -}
   38.89 -
   38.90 -std::string MapStorage::getActiveNodeMap(int prop)
   38.91 -{
   38.92 -  return active_nodemaps[prop];
   38.93 -}
   38.94 -
   38.95 -std::vector<std::string> MapStorage::getEdgeMapList()
   38.96 -{
   38.97 -  std::vector<std::string> eml;
   38.98 -  eml.resize(edgemap_storage.size());
   38.99 -  int i=0;
  38.100 -  std::map< std::string,Graph::EdgeMap<double> * >::iterator emsi=beginOfEdgeMaps();
  38.101 -  for(;emsi!=endOfEdgeMaps();emsi++)
  38.102 -    {
  38.103 -      eml[i]=(emsi->first);
  38.104 -      i++;
  38.105 -    }
  38.106 -  return eml;
  38.107 -}
  38.108 -
  38.109 -std::vector<std::string> MapStorage::getNodeMapList()
  38.110 -{
  38.111 -  std::vector<std::string> nml;
  38.112 -  nml.resize(nodemap_storage.size());
  38.113 -  int i=0;
  38.114 -  std::map< std::string,Graph::NodeMap<double> * >::iterator nmsi=beginOfNodeMaps();
  38.115 -  for(;nmsi!=endOfNodeMaps();nmsi++)
  38.116 -    {
  38.117 -      nml[i]=(nmsi->first);
  38.118 -      i++;
  38.119 -    }
  38.120 -  return nml;
  38.121 -}
  38.122 -
  38.123 -MapStorage::Signal_Prop MapStorage::signal_prop_ch()
  38.124 -{
  38.125 -  return signal_prop;
  38.126 -}
  38.127 -
  38.128 -int MapStorage::addEdgeMap(const std::string & name, Graph::EdgeMap<double> *edgemap, double default_value)
  38.129 -{
  38.130 -  if( edgemap_storage.find(name) == edgemap_storage.end() )
  38.131 -    {
  38.132 -      edgemap_storage[name]=edgemap;
  38.133 -      // set the maps default value
  38.134 -      edgemap_default[name] = default_value;
  38.135 -
  38.136 -      //announce changement in maps
  38.137 -      signal_edge_map.emit(name);
  38.138 -      return 0;
  38.139 -    }
  38.140 -  return 1;
  38.141 -}
  38.142 -
  38.143 -double MapStorage::maxOfNodeMap(const std::string & name)
  38.144 -{
  38.145 -  double max=0;
  38.146 -  for (NodeIt j(graph); j!=INVALID; ++j)
  38.147 -  {
  38.148 -    if( (*nodemap_storage[name])[j]>max )
  38.149 -    {
  38.150 -      max=(*nodemap_storage[name])[j];
  38.151 -    }
  38.152 -  }
  38.153 -  return max;
  38.154 -}
  38.155 -
  38.156 -double MapStorage::maxOfEdgeMap(const std::string & name)
  38.157 -{
  38.158 -  double max=0;
  38.159 -  for (EdgeIt j(graph); j!=INVALID; ++j)
  38.160 -  {
  38.161 -    if( (*edgemap_storage[name])[j]>max )
  38.162 -    {
  38.163 -      max=(*edgemap_storage[name])[j];
  38.164 -    }
  38.165 -  }
  38.166 -  return max;
  38.167 -}
  38.168 -
  38.169 -double MapStorage::minOfNodeMap(const std::string & name)
  38.170 -{
  38.171 -  NodeIt j(graph);
  38.172 -  double min;
  38.173 -  if(j!=INVALID)
  38.174 -    {
  38.175 -      min=(*nodemap_storage[name])[j];
  38.176 -    }
  38.177 -  else
  38.178 -    {
  38.179 -      min=0;
  38.180 -    }
  38.181 -  for (; j!=INVALID; ++j)
  38.182 -  {
  38.183 -    if( (*nodemap_storage[name])[j]<min )
  38.184 -    {
  38.185 -      min=(*nodemap_storage[name])[j];
  38.186 -    }
  38.187 -  }
  38.188 -  return min;
  38.189 -}
  38.190 -
  38.191 -double MapStorage::minOfEdgeMap(const std::string & name)
  38.192 -{
  38.193 -  EdgeIt j(graph);
  38.194 -  double min;
  38.195 -  if(j!=INVALID)
  38.196 -    {
  38.197 -      min=(*edgemap_storage[name])[j];
  38.198 -    }
  38.199 -  else
  38.200 -    {
  38.201 -      min=0;
  38.202 -    }
  38.203 -  for (EdgeIt j(graph); j!=INVALID; ++j)
  38.204 -  {
  38.205 -    if( (*edgemap_storage[name])[j]<min )
  38.206 -    {
  38.207 -      min=(*edgemap_storage[name])[j];
  38.208 -    }
  38.209 -  }
  38.210 -  return min;
  38.211 -}
  38.212 -
  38.213 -int MapStorage::readFromFile(const std::string &filename)
  38.214 -{
  38.215 -  bool read_x = false;
  38.216 -  bool read_y = false;
  38.217 -  bool read_edge_id = false;
  38.218 -
  38.219 -  try {
  38.220 -    LemonReader lreader(filename);
  38.221 -    ContentReader content(lreader);
  38.222 -    lreader.run();
  38.223 -
  38.224 -    if (content.nodeSetNum() < 1)
  38.225 -    {
  38.226 -      Gtk::MessageDialog mdialog("No nodeset found in file.");
  38.227 -      mdialog.run();
  38.228 -      clear();
  38.229 -      return 1;
  38.230 -    }
  38.231 -
  38.232 -    if (content.edgeSetNum() < 1)
  38.233 -    {
  38.234 -      Gtk::MessageDialog mdialog("No edgeset found in file.");
  38.235 -      mdialog.run();
  38.236 -      clear();
  38.237 -      return 1;
  38.238 -    }
  38.239 -
  38.240 -    const std::vector<std::string>& nodeMapNames = content.nodeSetMaps(0);
  38.241 -    const std::vector<std::string>& edgeMapNames = content.edgeSetMaps(0);
  38.242 -
  38.243 -    GraphReader<Graph> greader(filename, graph);
  38.244 -    for (std::vector<std::string>::const_iterator it = nodeMapNames.begin();
  38.245 -        it != nodeMapNames.end(); ++it)
  38.246 -    {
  38.247 -      if (*it == "coordinates_x")
  38.248 -      {
  38.249 -        read_x = true;
  38.250 -        //std::cout << "read X nodemap" << std::endl;
  38.251 -      }
  38.252 -      else if (*it == "coordinates_y")
  38.253 -      {
  38.254 -        read_y = true;
  38.255 -        //std::cout << "read Y nodemap" << std::endl;
  38.256 -      }
  38.257 -      else if (*it == "label")
  38.258 -      {
  38.259 -        //std::cout << "read id nodemap" << std::endl;
  38.260 -      }
  38.261 -      else
  38.262 -      {
  38.263 -        nodemap_storage[*it] = new Graph::NodeMap<double>(graph);
  38.264 -        //std::cout << "read " << *it << " nodemap" << std::endl;
  38.265 -      }
  38.266 -      greader.readNodeMap(*it, *nodemap_storage[*it]);
  38.267 -    }
  38.268 -    for (std::vector<std::string>::const_iterator it = edgeMapNames.begin();
  38.269 -        it != edgeMapNames.end(); ++it)
  38.270 -    {
  38.271 -      if (*it == "label")
  38.272 -      {
  38.273 -        //std::cout << "read id edgemap" << std::endl;
  38.274 -        read_edge_id = true;
  38.275 -      }
  38.276 -      else
  38.277 -      {
  38.278 -        edgemap_storage[*it] = new Graph::EdgeMap<double>(graph);
  38.279 -        //std::cout << "read " << *it << " edgemap" << std::endl;
  38.280 -      }
  38.281 -      greader.readEdgeMap(*it, *edgemap_storage[*it]);
  38.282 -    }
  38.283 -    GuiReader gui_reader(greader, this);
  38.284 -    greader.run();
  38.285 -  } catch (Exception& error) {
  38.286 -    Gtk::MessageDialog mdialog(error.what());
  38.287 -    mdialog.run();
  38.288 -    clear();
  38.289 -    return 1;
  38.290 -  }
  38.291 -
  38.292 -  if (!read_edge_id)
  38.293 -  {
  38.294 -    edgemap_storage["label"] = new Graph::EdgeMap<double>(graph);
  38.295 -    int i = 1;
  38.296 -    for (EdgeIt e(graph); e != INVALID; ++e)
  38.297 -    {
  38.298 -      (*edgemap_storage["label"])[e] = i++;
  38.299 -    }
  38.300 -  }
  38.301 -
  38.302 -  if (!read_x || !read_y)
  38.303 -  {
  38.304 -    int node_num = 0;
  38.305 -    for (NodeIt n(graph); n != INVALID; ++n)
  38.306 -    {
  38.307 -      node_num++;
  38.308 -    }
  38.309 -    const double pi = 3.142;
  38.310 -    double step = 2 * pi / (double) node_num;
  38.311 -    int i = 0;
  38.312 -    for (NodeIt n(graph); n != INVALID; ++n)
  38.313 -    {
  38.314 -      nodemap_storage["coordinates_x"]->set(n, 250.0 * std::cos(i * step));
  38.315 -      nodemap_storage["coordinates_y"]->set(n, 250.0 * std::sin(i * step));
  38.316 -      i++;
  38.317 -    }
  38.318 -  }
  38.319 -
  38.320 -  if (!arrow_pos_read_ok)
  38.321 -  {
  38.322 -    arrow_pos_read_ok = false;
  38.323 -    for (EdgeIt e(graph); e != INVALID; ++e)
  38.324 -    {
  38.325 -      arrow_pos.set(e, (coords[graph.source(e)] + coords[graph.target(e)]) / 2.0);
  38.326 -    }
  38.327 -  }
  38.328 -
  38.329 -  // fill in the default values for the maps
  38.330 -  for (std::map<std::string, Graph::NodeMap<double>*>::const_iterator it =
  38.331 -      nodemap_storage.begin(); it != nodemap_storage.end(); ++it)
  38.332 -  {
  38.333 -    if ((it->first != "label") &&
  38.334 -        (it->first != "coordiantes_x") &&
  38.335 -        (it->first != "coordinates_y"))
  38.336 -    {
  38.337 -      nodemap_default[it->first] = 0.0;
  38.338 -    }
  38.339 -    else if (it->first == "label")
  38.340 -    {
  38.341 -      NodeIt n(graph);
  38.342 -      double max = (*nodemap_storage["label"])[n];
  38.343 -      for (; n != INVALID; ++n)
  38.344 -      {
  38.345 -        if ((*nodemap_storage["label"])[n] > max)
  38.346 -          max = (*nodemap_storage["label"])[n];
  38.347 -      }
  38.348 -      nodemap_default["label"] = max + 1.0;
  38.349 -    }
  38.350 -  }
  38.351 -  for (std::map<std::string, Graph::EdgeMap<double>*>::const_iterator it =
  38.352 -      edgemap_storage.begin(); it != edgemap_storage.end(); ++it)
  38.353 -  {
  38.354 -    if (it->first != "label")
  38.355 -    {
  38.356 -      edgemap_default[it->first] = 0.0;
  38.357 -    }
  38.358 -    else
  38.359 -    {
  38.360 -      double max = std::numeric_limits<double>::min();
  38.361 -      for (EdgeIt e(graph); e != INVALID; ++e)
  38.362 -      {
  38.363 -        if ((*edgemap_storage["label"])[e] > max)
  38.364 -          max = (*edgemap_storage["label"])[e];
  38.365 -      }
  38.366 -      if (max > std::numeric_limits<double>::min())
  38.367 -        edgemap_default["label"] = max + 1.0;
  38.368 -      else
  38.369 -        edgemap_default["label"] = 1.0;
  38.370 -    }
  38.371 -  }
  38.372 -
  38.373 -  // filter loop edges
  38.374 -  for (EdgeIt e(graph); e != INVALID; ++e)
  38.375 -  {
  38.376 -    if (graph.source(e) == graph.target(e))
  38.377 -    {
  38.378 -      std::cerr << "Removed loop edge " << (*edgemap_storage["label"])[e]
  38.379 -        << " (from " << (*nodemap_storage["label"])[graph.source(e)]
  38.380 -        << ", to " << (*nodemap_storage["label"])[graph.target(e)] << ")."
  38.381 -        << std::endl;
  38.382 -
  38.383 -      graph.erase(e);
  38.384 -    }
  38.385 -  }
  38.386 -
  38.387 -  return 0;
  38.388 -}
  38.389 -
  38.390 -void MapStorage::writeToFile(const std::string &filename)
  38.391 -{
  38.392 -  GraphWriter<Graph> gwriter(filename, graph);
  38.393 -
  38.394 -  for (std::map<std::string, Graph::NodeMap<double>*>::const_iterator it =
  38.395 -      nodemap_storage.begin(); it != nodemap_storage.end(); ++it)
  38.396 -  {
  38.397 -    gwriter.writeNodeMap(it->first, *(it->second));
  38.398 -  }
  38.399 -  for (std::map<std::string, Graph::EdgeMap<double>*>::const_iterator it =
  38.400 -      edgemap_storage.begin(); it != edgemap_storage.end(); ++it)
  38.401 -  {
  38.402 -    if ((it->first != "arrow_pos_x") &&
  38.403 -        (it->first != "arrow_pos_y"))
  38.404 -    {
  38.405 -      gwriter.writeEdgeMap(it->first, *(it->second));
  38.406 -    }
  38.407 -  }
  38.408 -
  38.409 -  GuiWriter gui_writer(gwriter, this);
  38.410 -
  38.411 -  gwriter.run();
  38.412 -}
  38.413 -
  38.414 -void MapStorage::clear()
  38.415 -{
  38.416 -  for (std::map<std::string, Graph::NodeMap<double>*>::iterator it =
  38.417 -      nodemap_storage.begin(); it != nodemap_storage.end(); ++it)
  38.418 -  {
  38.419 -    if ((it->first != "coordinates_x") &&
  38.420 -        (it->first != "coordinates_y") &&
  38.421 -        (it->first != "label"))
  38.422 -    {
  38.423 -      delete it->second;
  38.424 -      nodemap_storage.erase(it);
  38.425 -    }
  38.426 -  }
  38.427 -  for (std::map<std::string, Graph::EdgeMap<double>*>::iterator it =
  38.428 -      edgemap_storage.begin(); it != edgemap_storage.end(); ++it)
  38.429 -  {
  38.430 -    if ((it->first != "label") &&
  38.431 -        (it->first != "arrow_pos_x") &&
  38.432 -        (it->first != "arrow_pos_y"))
  38.433 -    {
  38.434 -      delete it->second;
  38.435 -      edgemap_storage.erase(it);
  38.436 -    }
  38.437 -  }
  38.438 -  for (std::map<std::string, double>::iterator it =
  38.439 -      nodemap_default.begin(); it != nodemap_default.end(); ++it)
  38.440 -  {
  38.441 -    if (it->first != "label")
  38.442 -      nodemap_default.erase(it);
  38.443 -  }
  38.444 -  for (std::map<std::string, double>::iterator it =
  38.445 -      edgemap_default.begin(); it != edgemap_default.end(); ++it)
  38.446 -  {
  38.447 -    if (it->first != "label")
  38.448 -      edgemap_default.erase(it);
  38.449 -  }
  38.450 -  graph.clear();
  38.451 -  file_name = "";
  38.452 -  modified = false;
  38.453 -}
  38.454 -
  38.455 -void MapStorage::ArrowPosReadOK()
  38.456 -{
  38.457 -  arrow_pos_read_ok = true;
  38.458 -}
  38.459 -
  38.460 -void MapStorage::mapChanged(bool itisedge, std::string mapname)
  38.461 -{
  38.462 -  if(itisedge)
  38.463 -    {
  38.464 -      for(int i=0;i<EDGE_PROPERTY_NUM;i++)
  38.465 -	{
  38.466 -	  if(active_edgemaps[i]==mapname)
  38.467 -	    {
  38.468 -	      signal_prop.emit(itisedge, i);
  38.469 -	    }
  38.470 -	}
  38.471 -    }
  38.472 -  else
  38.473 -    {
  38.474 -      for(int i=0;i<NODE_PROPERTY_NUM;i++)
  38.475 -	{
  38.476 -	  if(active_nodemaps[i]==mapname)
  38.477 -	    {
  38.478 -	      signal_prop.emit(itisedge, i);
  38.479 -	    }
  38.480 -	}
  38.481 -    }
  38.482 -}
    39.1 --- a/gui/mapstorage.h	Wed Jun 21 08:35:23 2006 +0000
    39.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.3 @@ -1,239 +0,0 @@
    39.4 -// -*- C++ -*- //
    39.5 -
    39.6 -#ifndef MAPSTORAGE_H
    39.7 -#define MAPSTORAGE_H
    39.8 -
    39.9 -class Mapstorage;
   39.10 -
   39.11 -#include "all_include.h"
   39.12 -#include "xymap.h"
   39.13 -#include <libgnomecanvasmm.h>
   39.14 -
   39.15 -///class MapStorage handles NodeMaps and EdgeMaps.
   39.16 -
   39.17 -///Class MapStorage is responsible for storing
   39.18 -///NodeMaps and EdgeMaps that can be shown later
   39.19 -///on GUI. Therefore maps can be added to it,
   39.20 -///and datas over the added maps can be queried.
   39.21 -///The maps will be stored in an std::map,
   39.22 -///referenced with their names. Unfortunately at
   39.23 -///the moment it works only with double type maps
   39.24 -///
   39.25 -///\todo too many things are public!!
   39.26 -class MapStorage
   39.27 -{
   39.28 -public:
   39.29 -
   39.30 -  ///The graph for which the datas are stored.
   39.31 -  Graph graph;
   39.32 -  /// the coordinates of the nodes
   39.33 -  XYMap<Graph::NodeMap<double> > coords;
   39.34 -  /// the coordinates of the arrows on the edges
   39.35 -  XYMap<Graph::EdgeMap<double> > arrow_pos;
   39.36 -
   39.37 -  ///The content of the object has changed, update is needed.
   39.38 -  bool modified;
   39.39 -
   39.40 -  ///Name of file loaded in object.
   39.41 -  std::string file_name;
   39.42 -
   39.43 -  ///Stores double type NodeMaps
   39.44 -  std::map< std::string,Graph::NodeMap<double> * > nodemap_storage;
   39.45 -
   39.46 -  ///Stores double type EdgeMaps
   39.47 -  std::map< std::string,Graph::EdgeMap<double> * > edgemap_storage;
   39.48 -
   39.49 -  ///Stores the default values for the different visualization node attributes
   39.50 -  std::vector<Graph::NodeMap<double> > default_nodemaps;
   39.51 -
   39.52 -  ///Stores the default values for the different visualization edge attributes
   39.53 -  std::vector<Graph::EdgeMap<double> > default_edgemaps;
   39.54 -
   39.55 -  ///Stores the active maps for the different visualization node attributes
   39.56 -  std::vector< std::string > active_nodemaps;
   39.57 -
   39.58 -  /// Stores the active maps for the different visualization edge attributes
   39.59 -  std::vector< std::string > active_edgemaps;
   39.60 -
   39.61 -  /// Default values for the maps
   39.62 -  std::map< std::string, double > nodemap_default;
   39.63 -
   39.64 -  /// Default values for the maps
   39.65 -  std::map< std::string, double > edgemap_default;
   39.66 -
   39.67 -  bool arrow_pos_read_ok;
   39.68 -
   39.69 -protected:
   39.70 -  /// type of the signal emitted if the visualization of the maps might have to be updated.
   39.71 -
   39.72 -  /// bool shows us whether the changed map is edge or nodemap.
   39.73 -  /// int tells us the refreshed property
   39.74 -  typedef sigc::signal<void, bool, int> Signal_Prop;
   39.75 -
   39.76 -  /// Signal emitted on any change made on map values
   39.77 -  Signal_Prop signal_prop;
   39.78 -
   39.79 -  /// Signal emitted in the case of nodemap addition
   39.80 -
   39.81 -  /// std::string is the
   39.82 -  ///name of the new map
   39.83 -  sigc::signal<void, std::string> signal_node_map;
   39.84 -
   39.85 -  /// Signal emitted in the case of edgemap addition
   39.86 -
   39.87 -  /// std::string is the
   39.88 -  ///name of the new map
   39.89 -  sigc::signal<void, std::string> signal_edge_map;
   39.90 -
   39.91 -public:
   39.92 -  ///Constructor of MapStorage.
   39.93 -
   39.94 -  ///Its all activity is initializing default values
   39.95 -  ///for different visualization attributes.
   39.96 -  MapStorage();
   39.97 -
   39.98 -  ///Destructor of MapStorage
   39.99 -
  39.100 -  ///Maps stored here are created with new. Destructor
  39.101 -  ///deletes them to free up the reserved memory.
  39.102 -  ~MapStorage();
  39.103 -
  39.104 -  /// Registrates if the shown map by any attribute has changed to another.
  39.105 -
  39.106 -  ///It handles the \ref active_edgemaps and
  39.107 -  ///\ref active_nodemaps vectors. It also emits \ref signal_prop signal to let
  39.108 -  ///know the interested objects that the visible map of a certain
  39.109 -  ///attribute has changed.
  39.110 -  ///\param itisedge edgemap or nodemap has changed
  39.111 -  ///\param prop the property of which the map is changed
  39.112 -  ///\param mapname the visible map
  39.113 -  void changeActiveMap(bool itisedge , int prop , std::string mapname);
  39.114 -
  39.115 -  /// Returns the active edgemap shown by a visualization property.
  39.116 -
  39.117 -  /// \param prop is the property
  39.118 -  ///that shows the requested map.
  39.119 -  std::string getActiveEdgeMap(int prop);
  39.120 -
  39.121 -  /// Returns the active nodemap shown by a visualization property.
  39.122 -
  39.123 -  /// \param prop is the property
  39.124 -  ///that shows the requested map.
  39.125 -  std::string getActiveNodeMap(int prop);
  39.126 -
  39.127 -  /// Returns the names of the edgemaps stored here.
  39.128 -  std::vector<std::string> getEdgeMapList();
  39.129 -
  39.130 -  /// Returns the names of the nodemaps stored here.
  39.131 -  std::vector<std::string> getNodeMapList();
  39.132 -
  39.133 -  ///returns \ref signal_prop to be able to connect functions to it
  39.134 -  Signal_Prop signal_prop_ch();
  39.135 -
  39.136 -  ///returns \ref signal_node_map to be able to connect functions to it
  39.137 -  sigc::signal<void, std::string> signal_node_map_ch(){return signal_node_map;};
  39.138 -
  39.139 -  ///returns \ref signal_edge_map to be able to connect functions to it
  39.140 -  sigc::signal<void, std::string> signal_edge_map_ch(){return signal_edge_map;};
  39.141 -
  39.142 -  ///Adds given map to storage.
  39.143 -
  39.144 -  ///A name and the map itself has to be provided.
  39.145 -  ///\param mapname is the name of map
  39.146 -  ///\param nodemap is the pointer of the given nodemap
  39.147 -  ///\param def the default value of the map. If not given, it will be 0.
  39.148 -  ///If new edge is added to graph the value of it in the map will be this.
  39.149 -  ///\todo map should be given by reference!
  39.150 -  ///\todo why is default value stored?
  39.151 -  int addNodeMap(const std::string & mapname,Graph::NodeMap<double> * nodemap, double def=0.0);
  39.152 -
  39.153 -  ///Adds given map to storage. A name and the map itself has to be provided.
  39.154 -
  39.155 -  ///A name and the map itself has to be provided.
  39.156 -  ///\param mapname is the name of map
  39.157 -  ///\param edgemap is the pointer of the given edgemap
  39.158 -  ///\param def the default value of the map. If not given, it will be 0.
  39.159 -  ///If new edge is added to graph the value of it in the map will be this.
  39.160 -  ///\todo map should be given by reference!
  39.161 -  int addEdgeMap(const std::string & mapname,Graph::EdgeMap<double> * edgemap, double def=0.0);
  39.162 -
  39.163 -  ///Returns how much nodemaps is stored in \ref MapStorage
  39.164 -  int numOfNodeMaps() {return nodemap_storage.size();};
  39.165 -
  39.166 -  ///Returns how much edgemaps is stored in \ref MapStorage
  39.167 -  int numOfEdgeMaps() {return edgemap_storage.size();};
  39.168 -
  39.169 -  ///Returns the maximum value of the given NodeMap.
  39.170 -
  39.171 -  ///NodeMap has to be given by its name.
  39.172 -  ///\param name the name of map of which maximum is searched
  39.173 -  double maxOfNodeMap(const std::string & name);
  39.174 -
  39.175 -  ///Returns the maximum value of the given EdgeMap.
  39.176 -
  39.177 -  ///EdgeMap has to be given by its name.
  39.178 -  ///\param name the name of map of which maximum is searched
  39.179 -  double maxOfEdgeMap(const std::string & name);
  39.180 -
  39.181 -  ///Returns the minimum value of the given NodeMap.
  39.182 -
  39.183 -  ///NodeMap has to be given by its name.
  39.184 -  ///\param name the name of map of which minimum is searched
  39.185 -  double minOfNodeMap(const std::string & name);
  39.186 -
  39.187 -  ///Returns the minimum value of the given EdgeMap.
  39.188 -
  39.189 -  ///EdgeMap has to be given by its name.
  39.190 -  ///\param name the name of map of which minimum is searched
  39.191 -  double minOfEdgeMap(const std::string & name);
  39.192 -
  39.193 -  ///Returns iterator pointing to the first NodeMap in storage.
  39.194 -
  39.195 -  ///To be able to iterate through each maps this function
  39.196 -  ///returns an iterator pointing to the first nodemap in
  39.197 -  ///the storage.
  39.198 -  std::map< std::string,Graph::NodeMap<double> * >::iterator beginOfNodeMaps(){return nodemap_storage.begin();};
  39.199 -
  39.200 -  ///Returns iterator pointing to the first EdgeMap in storage.
  39.201 -
  39.202 -  ///To be able to iterate through each maps this function
  39.203 -  ///returns an iterator pointing to the first edgemap in
  39.204 -  ///the storage.
  39.205 -  std::map< std::string,Graph::EdgeMap<double> * >::iterator beginOfEdgeMaps(){return edgemap_storage.begin();};
  39.206 -
  39.207 -  ///Returns iterator pointing after the last NodeMap in storage.
  39.208 -
  39.209 -  ///To be able to iterate through each maps this function
  39.210 -  ///returns an iterator pointing to the last nodemap in the storage.
  39.211 -  std::map< std::string,Graph::NodeMap<double> * >::iterator endOfNodeMaps(){return nodemap_storage.end();};
  39.212 -
  39.213 -  ///Returns iterator pointing after the last EdgeMap in storage.
  39.214 -
  39.215 -  ///To be able to iterate through each maps this function
  39.216 -  ///returns an iterator pointing to the last edgemap in the storage.
  39.217 -  std::map< std::string,Graph::EdgeMap<double> * >::iterator endOfEdgeMaps(){return edgemap_storage.end();};
  39.218 -
  39.219 -  ///Emits \ref signal_prop if mapvalues have changed, and MapStorage gets to know it.
  39.220 -
  39.221 -  ///If values in a map have changed, this function checks, whether it is displayed.
  39.222 -  ///This check means searching the given mapname between active maps
  39.223 -  ///(\ref active_nodemaps, \ref active_edgemaps). If it is there at a certain property,
  39.224 -  ///it emits a signal with the property, where the gotten mapname was found. One signal
  39.225 -  ///is emitted for each property displaying the given map.
  39.226 -  ///\param itisedge whether the map an edgemap or nodemap
  39.227 -  ///\param mapname name of map to visualize
  39.228 -  void mapChanged(bool itisedge, std::string mapname);
  39.229 -
  39.230 -  ///Read datas from the given filename.
  39.231 -  int readFromFile(const std::string &);
  39.232 -
  39.233 -  ///Save datas to the given filename.
  39.234 -  void writeToFile(const std::string &);
  39.235 -
  39.236 -  ///Deletes all datastructures stored here.
  39.237 -  void clear();
  39.238 -
  39.239 -  void ArrowPosReadOK();
  39.240 -};
  39.241 -
  39.242 -#endif //MAPSTORAGE_H
    40.1 --- a/gui/nbtab.cc	Wed Jun 21 08:35:23 2006 +0000
    40.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.3 @@ -1,220 +0,0 @@
    40.4 -#include <nbtab.h>
    40.5 -
    40.6 -NoteBookTab::NoteBookTab():mapwinexists(false)
    40.7 -{
    40.8 -  Gtk::ScrolledWindow *pScrolledWindow = manage(new Gtk::ScrolledWindow);
    40.9 -  gd_canvas=new GraphDisplayerCanvas(*this);
   40.10 -  pScrolledWindow->add(*gd_canvas);
   40.11 -  add(*pScrolledWindow);
   40.12 -
   40.13 -  //connecting signals - controller character
   40.14 -  mapstorage.signal_prop_ch().connect(sigc::mem_fun(*gd_canvas, &GraphDisplayerCanvas::propertyChange));
   40.15 -  mapstorage.signal_node_map_ch().connect(sigc::mem_fun(*this, &NoteBookTab::registerNewNodeMap));
   40.16 -  mapstorage.signal_edge_map_ch().connect(sigc::mem_fun(*this, &NoteBookTab::registerNewEdgeMap));
   40.17 -  show_all_children();
   40.18 -  show();
   40.19 -}
   40.20 -
   40.21 -void NoteBookTab::readFile(const std::string &file)
   40.22 -{
   40.23 -  mapstorage.readFromFile(file);
   40.24 -  mapstorage.file_name = file;
   40.25 -  mapstorage.modified = false;
   40.26 -  gd_canvas->drawGraph();
   40.27 -  if(mapwinexists)
   40.28 -    {
   40.29 -      mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
   40.30 -    }
   40.31 -  signal_title.emit(Glib::filename_display_basename(file));
   40.32 -}
   40.33 -
   40.34 -void NoteBookTab::newFile()
   40.35 -{
   40.36 -  if (mapstorage.modified)
   40.37 -  {
   40.38 -    Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true,
   40.39 -        Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
   40.40 -    mdialog.add_button("Close file _without Saving", Gtk::RESPONSE_REJECT);
   40.41 -    mdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
   40.42 -    mdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
   40.43 -    switch (mdialog.run())
   40.44 -    {
   40.45 -      case Gtk::RESPONSE_CANCEL:
   40.46 -        return;
   40.47 -      case Gtk::RESPONSE_REJECT:
   40.48 -        break;
   40.49 -      case Gtk::RESPONSE_ACCEPT:
   40.50 -        saveFile();
   40.51 -        break;
   40.52 -    }
   40.53 -  }
   40.54 -  gd_canvas->clear();
   40.55 -  mapstorage.clear();
   40.56 -  if(mapwinexists)
   40.57 -    {
   40.58 -      mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
   40.59 -    }
   40.60 -  signal_title.emit("unsaved file");
   40.61 -}
   40.62 -
   40.63 -void NoteBookTab::openFile()
   40.64 -{
   40.65 -  if (mapstorage.modified)
   40.66 -  {
   40.67 -    Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true, 
   40.68 -        Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
   40.69 -    mdialog.add_button("Close file _without Saving", Gtk::RESPONSE_REJECT);
   40.70 -    mdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
   40.71 -    mdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
   40.72 -    switch (mdialog.run())
   40.73 -    {
   40.74 -      case Gtk::RESPONSE_CANCEL:
   40.75 -        return;
   40.76 -      case Gtk::RESPONSE_REJECT:
   40.77 -        break;
   40.78 -      case Gtk::RESPONSE_ACCEPT:
   40.79 -        saveFile();
   40.80 -        break;
   40.81 -    }
   40.82 -  }
   40.83 -  Gtk::FileChooserDialog fcdialog("Open File");
   40.84 -  fcdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
   40.85 -  fcdialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_ACCEPT);
   40.86 -  if (fcdialog.run() == Gtk::RESPONSE_ACCEPT)
   40.87 -  {
   40.88 -    gd_canvas->clear();
   40.89 -    mapstorage.clear();
   40.90 -    Glib::ustring filename = fcdialog.get_filename();
   40.91 -    if (!mapstorage.readFromFile(filename))
   40.92 -    {
   40.93 -      mapstorage.file_name = filename;
   40.94 -      mapstorage.modified = false;
   40.95 -      gd_canvas->drawGraph();
   40.96 -      if(mapwinexists)
   40.97 -	{
   40.98 -	  mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
   40.99 -	}
  40.100 -      signal_title.emit(Glib::filename_display_basename(filename));
  40.101 -    }
  40.102 -  }
  40.103 -}
  40.104 -
  40.105 -void NoteBookTab::saveFile()
  40.106 -{
  40.107 -  if (mapstorage.file_name == "") {
  40.108 -    saveFileAs();
  40.109 -  }
  40.110 -  else
  40.111 -  {
  40.112 -    mapstorage.writeToFile(mapstorage.file_name);
  40.113 -    mapstorage.modified = false;
  40.114 -    signal_title.emit(Glib::filename_display_basename(mapstorage.file_name));
  40.115 -  }
  40.116 -}
  40.117 -
  40.118 -void NoteBookTab::saveFileAs()
  40.119 -{
  40.120 -  Gtk::FileChooserDialog fcdialog("Save File", Gtk::FILE_CHOOSER_ACTION_SAVE);
  40.121 -  fcdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
  40.122 -  fcdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
  40.123 -  if (fcdialog.run() == Gtk::RESPONSE_ACCEPT)
  40.124 -  {
  40.125 -    Glib::ustring filename = fcdialog.get_filename();
  40.126 -    mapstorage.file_name = filename;
  40.127 -    mapstorage.writeToFile(filename);
  40.128 -    mapstorage.modified = false;
  40.129 -    signal_title.emit(Glib::filename_display_basename(filename));
  40.130 -  }
  40.131 -}
  40.132 -
  40.133 -void NoteBookTab::close()
  40.134 -{
  40.135 -  if (mapstorage.modified)
  40.136 -  {
  40.137 -    Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true,
  40.138 -        Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
  40.139 -    mdialog.add_button("Close _without Saving", Gtk::RESPONSE_REJECT);
  40.140 -    mdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
  40.141 -    mdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
  40.142 -    switch (mdialog.run())
  40.143 -    {
  40.144 -      case Gtk::RESPONSE_CANCEL:
  40.145 -        return;
  40.146 -      case Gtk::RESPONSE_REJECT:
  40.147 -        break;
  40.148 -      case Gtk::RESPONSE_ACCEPT:
  40.149 -        saveFile();
  40.150 -        break;
  40.151 -    }
  40.152 -  }
  40.153 -  gd_canvas->clear();
  40.154 -  mapstorage.clear();
  40.155 -  if(mapwinexists)
  40.156 -    {
  40.157 -      mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
  40.158 -    }
  40.159 -  signal_title.emit("unsaved file");
  40.160 -}
  40.161 -
  40.162 -void NoteBookTab::propertyChange(bool itisedge, int prop, std::string mapname)
  40.163 -{
  40.164 -  mapstorage.changeActiveMap(itisedge, prop, mapname);
  40.165 -}
  40.166 -
  40.167 -sigc::signal<void, NoteBookTab *, bool> NoteBookTab::signal_newmap_needed()
  40.168 -{
  40.169 -  return signal_newmap;
  40.170 -}
  40.171 -
  40.172 -void NoteBookTab::popupNewMapWin(bool itisedge)
  40.173 -{
  40.174 -  signal_newmap.emit(this, itisedge);
  40.175 -}
  40.176 -
  40.177 -std::string NoteBookTab::getActiveEdgeMap(int prop)
  40.178 -{
  40.179 -  return mapstorage.getActiveEdgeMap(prop);
  40.180 -}
  40.181 -
  40.182 -std::string NoteBookTab::getActiveNodeMap(int prop)
  40.183 -{
  40.184 -  return mapstorage.getActiveNodeMap(prop);
  40.185 -}
  40.186 -
  40.187 -void NoteBookTab::registerNewEdgeMap(std::string mapname)
  40.188 -{
  40.189 -  if(mapwinexists)
  40.190 -    {
  40.191 -      mapwin->registerNewEdgeMap(mapname);
  40.192 -    }
  40.193 -}
  40.194 -
  40.195 -void NoteBookTab::registerNewNodeMap(std::string mapname)
  40.196 -{
  40.197 -  if(mapwinexists)
  40.198 -    {
  40.199 -      mapwin->registerNewNodeMap(mapname);
  40.200 -    }
  40.201 -}
  40.202 -
  40.203 -void NoteBookTab::createMapWin(std::string name)
  40.204 -{
  40.205 -  if(!mapwinexists)
  40.206 -    {
  40.207 -      mapwin=new MapWin("Map Setup - "+name, mapstorage.getEdgeMapList(), mapstorage.getNodeMapList(), *this);
  40.208 -      mapwin->show();
  40.209 -      mapwinexists=true;
  40.210 -    }
  40.211 -}
  40.212 -
  40.213 -void NoteBookTab::closeMapWin()
  40.214 -{
  40.215 -  mapwinexists=false;
  40.216 -  delete mapwin;
  40.217 -}
  40.218 -
  40.219 -sigc::signal<void, std::string> NoteBookTab::signal_title_ch()
  40.220 -{
  40.221 -  return signal_title;
  40.222 -}
  40.223 -
    41.1 --- a/gui/nbtab.h	Wed Jun 21 08:35:23 2006 +0000
    41.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.3 @@ -1,161 +0,0 @@
    41.4 -// -*- C++ -*- //
    41.5 -
    41.6 -#ifndef NBTAB_H
    41.7 -#define NBTAB_H
    41.8 -
    41.9 -class NoteBookTab;
   41.10 -
   41.11 -#include "mapstorage.h"
   41.12 -#include "map_win.h"
   41.13 -#include "graph_displayer_canvas.h"
   41.14 -#include <libgnomecanvasmm.h>
   41.15 -#include <libgnomecanvasmm/polygon.h>
   41.16 -
   41.17 -///One tab in the Notebook that is placed in the main window (\ref MainWin).
   41.18 -
   41.19 -///One graph and all of its accessories like maps are assigned to one tab in the notebook.
   41.20 -///\ref NoteBookTab is responsible for the user defined display of the graph: view can be
   41.21 -///set by visualized maps, therefore \ref NoteBookTab must provide an interface to set the
   41.22 -///view of graph. This is \ref Mapwin window.
   41.23 -///
   41.24 -///\ref NoteBookTab is also
   41.25 -///responsible for modify the graph if it is
   41.26 -///requested. Therefore it is responsible for translating user events to modifications to
   41.27 -///do on graph, like node/edge addition/deletion, map modification, addition and so on.
   41.28 -///
   41.29 -///To be able to solve these tasks the help of \ref MainWin is also needed, for example to
   41.30 -///know which editor-tool is active at the moment. Therefore \ref MainWin knows \ref NoteBookTab.
   41.31 -///
   41.32 -///Some information in the other direction is needed as well: for example when new map creation is requested for this tab
   41.33 -///\ref NoteBookTab must ask \ref MainWin to pop-up a \ref NewMapWin. Communication in this direction is realized by signals
   41.34 -///therefore \ref NoteBookTab does not know \ref MainWin at all, but in this way it is not necessary.
   41.35 -class NoteBookTab : public Gtk::VBox
   41.36 -{
   41.37 -public:
   41.38 -  
   41.39 -  ///Constructor of \ref NoteBookTab
   41.40 -
   41.41 -  ///It initiates the \re GraphDisplayerCanvas, on which the graph will be drawn
   41.42 -  ///Signals of \ref MapStorage will be bound to the appropriate callback functions here.
   41.43 -  NoteBookTab();
   41.44 -  
   41.45 -  ///Maps assigned to the graph displayed in this \ref NoteBookTab of notebook.
   41.46 -  MapStorage mapstorage;
   41.47 -    
   41.48 -  ///Title changement indicator.
   41.49 -
   41.50 -  ///If graph is loaded from disk or saved to disk or changed its name somehow
   41.51 -  ///this signal will be emit to let
   41.52 -  ///\ref MainWin know that it has to modify the title of the main window.
   41.53 -  ///It contains the new title.
   41.54 -  sigc::signal<void, std::string> signal_title;
   41.55 -
   41.56 -  ///Returns \ref signal_title to be the caller able to connect it to a callback function.
   41.57 -  sigc::signal<void, std::string> signal_title_ch();
   41.58 -
   41.59 -  ///Indicates that new map window should be popped up.
   41.60 -
   41.61 -  ///\ref NoteBookTab can ask \ref MainWin to pop up a \ref NweMapWin ny emitting this signal.
   41.62 -  ///The signal contains whether an edgemap or a nodemap should be popped up. \ref NewMapWin
   41.63 -  ///is not popped up by \ref NoteBookTab, because not only \ref NoteBookTab needs \ref NewMapWin,
   41.64 -  ///but for example \ref MainWin and \ref AlgoWin s as well.
   41.65 -  sigc::signal<void, NoteBookTab *, bool> signal_newmap;
   41.66 -
   41.67 -  ///Returns \ref signal_newmap to be the caller able to connect it to a callback function.
   41.68 -  sigc::signal<void, NoteBookTab *, bool> signal_newmap_needed();
   41.69 -
   41.70 -  ///Loads the given file.
   41.71 -
   41.72 -  ///The given file will be load in the \ref MapStorage and afeter that
   41.73 -  ///\ref GraphDisplayerCanvas will be requested to display the graph.
   41.74 -  ///\ref GraphDisplayer will get datas from the recently set \ref MapStorage.
   41.75 -  void readFile(const std::string &);
   41.76 -    
   41.77 -  ///The graph will be drawn on this \ref GraphDisplayerCanvas
   41.78 -  GraphDisplayerCanvas * gd_canvas;
   41.79 -
   41.80 -  ///Indicates whether the \ref MapWin is opened or not. See \ref mapwin.
   41.81 -  bool mapwinexists;
   41.82 -
   41.83 -  ///Address of the only \ref MapWin that the \ref NoteBookTab can open.
   41.84 -
   41.85 -  ///Only one of this window can be opened at the same time (\ref mapwinexists), 
   41.86 -  ///because there is no need for more, one per tab is enough.
   41.87 -  ///There won1t be benefit of more than one, but it would be
   41.88 -  ///more complicated to synchronize them.
   41.89 -  MapWin * mapwin;
   41.90 -    
   41.91 -public:
   41.92 -  ///Callback for 'FileNew' action.
   41.93 -  virtual void newFile();
   41.94 -  ///Callback for 'FileOpen' action.
   41.95 -  virtual void openFile();
   41.96 -  ///Callback for 'FileSave' action.
   41.97 -  virtual void saveFile();
   41.98 -  ///Callback for 'FileSaveAs' action.
   41.99 -  virtual void saveFileAs();
  41.100 -  ///Callback for 'Close' action.
  41.101 -  virtual void close();
  41.102 -
  41.103 -  ///Handles changement of view of graph.
  41.104 -
  41.105 -  ///If the user changes the map to show by a property to a nother in \ref MapWin,
  41.106 -  ///\ref MapWin will call this function. This function will registrate in \ref MapStorage
  41.107 -  ///the new map to display by the changed property. After that \ref MapStorage will
  41.108 -  ///emits a signal that will be forwarded to \ref GraphDisplayerCanvas to update the
  41.109 -  ///appropriate parts of graph.
  41.110 -  ///\param itiesedge whether the changed property is edge property or node property
  41.111 -  ///\param prop id of property, see all_include.h
  41.112 -  ///\param mapname name of the recently selected map
  41.113 -  void propertyChange(bool itisedge, int prop, std::string mapname);
  41.114 -
  41.115 -  ///Emits a signal that request \ref MainWin to pop up \ref NewMapWin
  41.116 -
  41.117 -  ///This function is called by \ref MapWin.
  41.118 -  ///\param itisedge whether the new map should be an edgemap or a nodemap.
  41.119 -  void popupNewMapWin(bool itisedge);
  41.120 -
  41.121 -  ///Returns the actually selected edgemap to visualize by the given property.
  41.122 -
  41.123 -  ///\ref MapWin calls this function, beacuse it does not know \ref MapStorage.
  41.124 -  ///\param prop property to inquire.
  41.125 -  std::string getActiveEdgeMap(int prop);
  41.126 -
  41.127 -  ///Returns the actually selected nodemap to visualize by the given property.
  41.128 -
  41.129 -  ///\ref MapWin calls this function, beacuse it does not know \ref MapStorage.
  41.130 -  ///\param prop property to inquire.
  41.131 -  std::string getActiveNodeMap(int prop);
  41.132 -
  41.133 -  ///Registers recently created edgemap in \ref MapWin.
  41.134 -
  41.135 -  ///After creation of new map \ref MapStorage emits a signal.
  41.136 -  ///This signal is bound to this callback function, that will call
  41.137 -  ///a function with the same name and same parameterin \ref MapWin.
  41.138 -  ///This call-forwarder function is needed, because \ref Mapstorage does not know \ref MapWin
  41.139 -  ///\param mapname name of new map
  41.140 -  void registerNewEdgeMap(std::string mapname);
  41.141 -
  41.142 -  ///Registers recently created nodemap in \ref MapWin.
  41.143 -
  41.144 -  ///After creation of new map \ref MapStorage emits a signal.
  41.145 -  ///This signal is bound to this callback function, that will call
  41.146 -  ///a function with the same name and same parameter in \ref MapWin.
  41.147 -  ///This call-forwarder function is needed, because \ref Mapstorage does not know \ref MapWin
  41.148 -  ///\param mapname name of new map
  41.149 -  void registerNewNodeMap(std::string mapname);
  41.150 -
  41.151 -  ///Pops up and registrates the \ref MapWin of \ref NoteBookTab.
  41.152 -  
  41.153 -  ///See also
  41.154 -  ///\ref mapwin.
  41.155 -  void createMapWin(std::string);
  41.156 -
  41.157 -  ///Closes and deregistrates the \ref MapWin of \ref NoteBookTab.
  41.158 -  
  41.159 -  ///See also
  41.160 -  ///\ref mapwin.
  41.161 -  void closeMapWin();
  41.162 -};
  41.163 -
  41.164 -#endif //NBTAB_H
    42.1 --- a/gui/new_map_win.cc	Wed Jun 21 08:35:23 2006 +0000
    42.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.3 @@ -1,499 +0,0 @@
    42.4 -#include <new_map_win.h>
    42.5 -
    42.6 -bool NewMapWin::closeIfEscapeIsPressed(GdkEventKey* e)
    42.7 -{
    42.8 -  if(e->keyval==GDK_Escape)
    42.9 -  {
   42.10 -    hide();
   42.11 -  }
   42.12 -  return true;
   42.13 -}
   42.14 -
   42.15 -NewMapWin::NewMapWin(const std::string& title, NoteBookTab & mw, bool itisedge, bool edgenode):Gtk::Dialog(title, true, true),mytab(mw),node("Create NodeMap"),edge("Create EdgeMap")
   42.16 -{
   42.17 -  set_default_size(200, 50);
   42.18 -
   42.19 -  signal_key_press_event().connect(sigc::mem_fun(*this, &NewMapWin::closeIfEscapeIsPressed));
   42.20 -
   42.21 -  Gtk::VBox * vbox=get_vbox();
   42.22 -
   42.23 -  //entries
   42.24 -  table=new Gtk::Table(3, 2, false);
   42.25 -
   42.26 -  label=new Gtk::Label;
   42.27 -  label->set_text("Name of new map:");
   42.28 -  name.set_text("");
   42.29 -
   42.30 -  (*table).attach(*label,0,1,0,1,Gtk::SHRINK,Gtk::SHRINK,10,3);
   42.31 -  (*table).attach(name,1,2,0,1,Gtk::SHRINK,Gtk::SHRINK,10,3);
   42.32 -
   42.33 -  label=new Gtk::Label;
   42.34 -  label->set_text("Default value in the map:");
   42.35 -  default_value.set_text("0");
   42.36 -
   42.37 -  (*table).attach(*label,0,1,1,2,Gtk::SHRINK,Gtk::SHRINK,10,3);
   42.38 -  (*table).attach(default_value,1,2,1,2,Gtk::SHRINK,Gtk::SHRINK,10,3);
   42.39 -
   42.40 -  //node vs. edge map selector
   42.41 -  Gtk::RadioButton::Group group = node.get_group();
   42.42 -  edge.set_group(group);
   42.43 -  
   42.44 -  if(edgenode)
   42.45 -    {
   42.46 -      (*table).attach(node,0,1,2,3,Gtk::SHRINK,Gtk::SHRINK,10,3);
   42.47 -      (*table).attach(edge,1,2,2,3,Gtk::SHRINK,Gtk::SHRINK,10,3);
   42.48 -    }
   42.49 -  else
   42.50 -    {
   42.51 -      if(itisedge)
   42.52 -	{
   42.53 -	  edge.set_active();
   42.54 -	}
   42.55 -      else
   42.56 -	{
   42.57 -	  node.set_active();
   42.58 -	}
   42.59 -    }
   42.60 -
   42.61 -  vbox->pack_start(*table);
   42.62 -
   42.63 -  //OK button
   42.64 -  add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
   42.65 -
   42.66 -  show_all_children();
   42.67 -
   42.68 -}
   42.69 -
   42.70 -void NewMapWin::on_response(int response_id)
   42.71 -{
   42.72 -  if(response_id==Gtk::RESPONSE_OK)
   42.73 -    {
   42.74 -      double def_val=0;
   42.75 -
   42.76 -      //get and formulate text
   42.77 -      std::string def_val_str=default_value.get_text();
   42.78 -
   42.79 -      bool only_nums=true;
   42.80 -      for(int i=0;i<(int)def_val_str.size() && only_nums;i++)
   42.81 -	{
   42.82 -	  if( def_val_str[i]<'0' || def_val_str[i]>'9' )
   42.83 -	    {
   42.84 -	      only_nums=false;
   42.85 -	    }
   42.86 -	}
   42.87 -      std::string polishform;
   42.88 -
   42.89 -      if(only_nums)
   42.90 -	{
   42.91 -	  def_val=atof(def_val_str.c_str());
   42.92 -	}
   42.93 -      else
   42.94 -	{
   42.95 -	  polishform=string2Polishform(def_val_str,edge.get_active());
   42.96 -	}
   42.97 -
   42.98 -      //get name of text
   42.99 -      std::string mapname=name.get_text();
  42.100 -      
  42.101 -      if(!mapname.empty()&&(!polishform.empty()||only_nums))
  42.102 -	{
  42.103 -	  int abortion=0;
  42.104 -	  if(edge.get_active())
  42.105 -	    {
  42.106 -	      //create the new map
  42.107 -	      Graph::EdgeMap<double> * emptr=new Graph::EdgeMap<double> (mytab.mapstorage.graph, def_val);
  42.108 -	      
  42.109 -	      if(!only_nums)
  42.110 -		{
  42.111 -		  std::stack<double> polishstack;
  42.112 -		  
  42.113 -		  for(EdgeIt k(mytab.mapstorage.graph); k!=INVALID; ++k)
  42.114 -		    {
  42.115 -		      for(int i=0;i<(int)polishform.size();i++)
  42.116 -			{
  42.117 -			  double op1=0, op2=0;
  42.118 -			  bool operation=true;
  42.119 -			  switch(polishform[i])
  42.120 -			    {
  42.121 -			    case '+':
  42.122 -			    case '-':
  42.123 -			    case '/':
  42.124 -			    case '*':
  42.125 -			      op1=polishstack.top();
  42.126 -			      polishstack.pop();
  42.127 -			      op2=polishstack.top();
  42.128 -			      polishstack.pop();
  42.129 -			      break;
  42.130 -			    default:
  42.131 -			      //substitute variable
  42.132 -			      std::map< std::string,Graph::EdgeMap<double> * > ems=mytab.mapstorage.edgemap_storage;
  42.133 -			      bool itisvar=(ems.find(ch2var[ polishform[i] ])!=ems.end());
  42.134 -			      if(itisvar)
  42.135 -				{
  42.136 -				  polishstack.push( (*(mytab.mapstorage.edgemap_storage[ ch2var[ polishform[i] ] ]))[k]);
  42.137 -				}
  42.138 -			      else
  42.139 -				{
  42.140 -				  polishstack.push(atof(ch2var[ polishform[i] ].c_str()));
  42.141 -				}
  42.142 -			      operation=false;
  42.143 -			      break;
  42.144 -			    }
  42.145 -			  if(operation)
  42.146 -			    {
  42.147 -			      double res;
  42.148 -			      switch(polishform[i])
  42.149 -				{
  42.150 -				case '+':
  42.151 -				  res=op1+op2;
  42.152 -				  break;
  42.153 -				case '-':
  42.154 -				  res=op2-op1;
  42.155 -				  break;
  42.156 -				case '/':
  42.157 -				  res=op2/op1;
  42.158 -				  break;
  42.159 -				case '*':
  42.160 -				  res=op1*op2;
  42.161 -				  break;
  42.162 -				default:
  42.163 -				  std::cout << "How could we get here?" << std::endl;
  42.164 -				  break;
  42.165 -				}
  42.166 -			      polishstack.push(res);
  42.167 -			    }
  42.168 -			}//foreach letter in polishform
  42.169 -		      (*emptr)[k]=polishstack.top(); 
  42.170 -		    }//foreach edge
  42.171 -		}//!only_nums
  42.172 -
  42.173 -	      //if addition was not successful addEdgeMap returns one.
  42.174 -	      //cause can be that there is already a map named like the new one
  42.175 -	      if(mytab.mapstorage.addEdgeMap(mapname, emptr, def_val))
  42.176 -		{
  42.177 -		  abortion=1;
  42.178 -		}
  42.179 -
  42.180 -	      //add it to the list of the displayable maps
  42.181 -	      //furthermore it is done by signals
  42.182 -	      //mytab.registerNewEdgeMap(mapname);
  42.183 -
  42.184 -	      //display it
  42.185 -	      //gdc.changeEdgeText(mapname);
  42.186 -	    }
  42.187 -	  else //!edge.get_active()
  42.188 -	    {
  42.189 -	      //create the new map
  42.190 -	      Graph::NodeMap<double> * emptr=new Graph::NodeMap<double> (mytab.mapstorage.graph, def_val);
  42.191 -
  42.192 -	      if(!only_nums)
  42.193 -		{
  42.194 -		  std::stack<double> polishstack;
  42.195 -  
  42.196 -		  for(NodeIt k(mytab.mapstorage.graph); k!=INVALID; ++k)
  42.197 -		    {
  42.198 -		      for(int i=0;i<(int)polishform.size();i++)
  42.199 -			{
  42.200 -			  double op1=0, op2=0;
  42.201 -			  bool operation=true;
  42.202 -			  switch(polishform[i])
  42.203 -			    {
  42.204 -			    case '+':
  42.205 -			    case '-':
  42.206 -			    case '/':
  42.207 -			    case '*':
  42.208 -			      op1=polishstack.top();
  42.209 -			      polishstack.pop();
  42.210 -			      op2=polishstack.top();
  42.211 -			      polishstack.pop();
  42.212 -			      break;
  42.213 -			    default:
  42.214 -			      std::map< std::string,Graph::NodeMap<double> * > nms=mytab.mapstorage.nodemap_storage;
  42.215 -			      bool itisvar=(nms.find(ch2var[ polishform[i] ])!=nms.end());
  42.216 -			      if(itisvar)
  42.217 -				{
  42.218 -				  polishstack.push( (*(mytab.mapstorage.nodemap_storage[ ch2var[ polishform[i] ] ]))[k]);
  42.219 -				}
  42.220 -			      else
  42.221 -				{
  42.222 -				  polishstack.push(atof(ch2var[ polishform[i] ].c_str()));
  42.223 -				}
  42.224 -			      operation=false;
  42.225 -			      break;
  42.226 -			    }
  42.227 -			  if(operation)
  42.228 -			    {
  42.229 -			      double res;
  42.230 -			      switch(polishform[i])
  42.231 -				{
  42.232 -				case '+':
  42.233 -				  res=op1+op2;
  42.234 -				  break;
  42.235 -				case '-':
  42.236 -				  res=op2-op1;
  42.237 -				  break;
  42.238 -				case '/':
  42.239 -				  res=op2/op1;
  42.240 -				  break;
  42.241 -				case '*':
  42.242 -				  res=op1*op2;
  42.243 -				  break;
  42.244 -				default:
  42.245 -				  std::cout << "How could we get here?" << std::endl;
  42.246 -				  break;
  42.247 -				}
  42.248 -			      polishstack.push(res);
  42.249 -			    }
  42.250 -			}
  42.251 -		      (*emptr)[k]=polishstack.top(); 
  42.252 -		    }
  42.253 -		}
  42.254 -	      //if addition was not successful addNodeMap returns one.
  42.255 -	      //cause can be that there is already a map named like the new one
  42.256 -	      if(mytab.mapstorage.addNodeMap(mapname,emptr, def_val))
  42.257 -		{
  42.258 -		  abortion=1;
  42.259 -		}
  42.260 -
  42.261 -	      //add it to the list of the displayable maps
  42.262 -	      //furthermore it is done by signals
  42.263 -	      //mytab.registerNewNodeMap(mapname);
  42.264 -
  42.265 -	      //display it
  42.266 -	      //gdc.changeNodeText(mapname);
  42.267 -	    }
  42.268 -	  if(!abortion)
  42.269 -	    {
  42.270 -	      name.set_text("");
  42.271 -	      default_value.set_text("0");
  42.272 -	      edge.show();
  42.273 -	      node.show();
  42.274 -	      hide();
  42.275 -	    }
  42.276 -	}
  42.277 -    }
  42.278 -}
  42.279 -
  42.280 -
  42.281 -std::string NewMapWin::string2Polishform(std::string rawcommand, bool itisedge)
  42.282 -{
  42.283 -  bool valid_entry=true;
  42.284 -
  42.285 -  std::map<std::string, int> str2i;
  42.286 -
  42.287 -  std::string command;
  42.288 -
  42.289 -  std::string variable;
  42.290 -
  42.291 -  char index='a';
  42.292 -
  42.293 -  for(int i=0;(valid_entry&&(i<(int)rawcommand.size()));i++)
  42.294 -    {
  42.295 -      switch(rawcommand[i])
  42.296 -	{
  42.297 -	case '+':
  42.298 -	case '-':
  42.299 -	case '*':
  42.300 -	case '/':
  42.301 -	case ')':
  42.302 -	case '(':
  42.303 - 	  if(!variable.empty())
  42.304 -	    {
  42.305 -	      valid_entry=validVariable(variable, itisedge);
  42.306 -	      ch2var[index]=variable;
  42.307 -	      command+=index;
  42.308 -	      index++;
  42.309 -	      variable.erase(0,variable.size());	  
  42.310 -	    }
  42.311 -	  command+=rawcommand[i];
  42.312 -	  break;
  42.313 -	default:
  42.314 -	  variable+=rawcommand[i];
  42.315 -	  break;
  42.316 -	}
  42.317 -    }
  42.318 -
  42.319 -  if(!variable.empty()&&valid_entry)
  42.320 -    {
  42.321 -      valid_entry=validVariable(variable, itisedge);
  42.322 -      ch2var[index]=variable;
  42.323 -      command+=index;
  42.324 -      index++;
  42.325 -      variable.erase(0,variable.size());	  
  42.326 -    }
  42.327 -
  42.328 -  if(valid_entry)
  42.329 -    {
  42.330 -      unsigned int pr=10000;
  42.331 -      bool prevmult=false;
  42.332 -      unsigned int prev_change=pr;
  42.333 -      unsigned int prev_br=pr;
  42.334 -      int counter=0;
  42.335 -      std::string comm_nobr="";
  42.336 -      std::vector<unsigned int> p;
  42.337 -      p.resize(counter+1);
  42.338 -      
  42.339 -      //limits
  42.340 -      //6 brackets embedded
  42.341 -      //100 operation in a row from the same priority
  42.342 -      
  42.343 -      for(int i=0;i<(int)command.size();i++)
  42.344 -	{
  42.345 -	  bool put_in_string=true;
  42.346 -	  switch(command[i])
  42.347 -	    {
  42.348 -	    case '(':
  42.349 -	      pr=prev_br+10000;
  42.350 -	      prev_br=pr;
  42.351 -	      prevmult=false;
  42.352 -	      put_in_string=false;
  42.353 -	      break;
  42.354 -	    case ')':
  42.355 -	      pr=prev_br-10000;
  42.356 -	      prev_br=pr;
  42.357 -	      prevmult=false;
  42.358 -	      put_in_string=false;
  42.359 -	      break;
  42.360 -	    case '+':
  42.361 -	    case '-':
  42.362 -	      if(prevmult)
  42.363 -		{
  42.364 -		  pr=prev_change;
  42.365 -		}
  42.366 -	      p[counter]=pr;
  42.367 -	      pr-=100;
  42.368 -
  42.369 -	      prevmult=false;
  42.370 -	      break;
  42.371 -	    case '/':
  42.372 -	    case '*':
  42.373 -	      if(!prevmult)
  42.374 -		{
  42.375 -		  prev_change=pr;
  42.376 -		  pr+=200;
  42.377 -		  pr-=1;
  42.378 -		}
  42.379 -	      p[counter]=pr;
  42.380 -	      pr-=1;
  42.381 -	      prevmult=true;
  42.382 -	      break;
  42.383 -	    default:
  42.384 -	      p[counter]=65000;
  42.385 -	      break;
  42.386 -	    }
  42.387 -	  if(put_in_string)
  42.388 -	    {
  42.389 -	      counter++;
  42.390 -	      p.resize(counter+1);
  42.391 -	      comm_nobr=comm_nobr+command[i];
  42.392 -	    }
  42.393 -	}
  42.394 -
  42.395 -      tree_node * root=weightedString2Tree(comm_nobr, p, 0);
  42.396 -
  42.397 -      std::string polishform=postOrder(root);
  42.398 -
  42.399 -      deleteTree(root);
  42.400 -
  42.401 -      return polishform;
  42.402 -    }
  42.403 -  return "";
  42.404 -}
  42.405 -
  42.406 -void NewMapWin::deleteTree(NewMapWin::tree_node * node)
  42.407 -{
  42.408 -  if(node->left_child!=NULL)
  42.409 -    {
  42.410 -      deleteTree(node->left_child);
  42.411 -    }
  42.412 -  if(node->right_child!=NULL)
  42.413 -    {
  42.414 -      deleteTree(node->right_child);
  42.415 -    }
  42.416 -  delete node;
  42.417 -}
  42.418 -
  42.419 -NewMapWin::tree_node * NewMapWin::weightedString2Tree(std::string to_tree, std::vector<unsigned int> & p, int offset)
  42.420 -{
  42.421 -  unsigned int min=p[offset];
  42.422 -  int minplace=0;
  42.423 -  for(int i=0;i<(int)to_tree.size();i++)
  42.424 -    {
  42.425 -      if(min>p[offset+i])
  42.426 -	{
  42.427 -	  min=p[offset+i];
  42.428 -	  minplace=i;
  42.429 -	}
  42.430 -    }
  42.431 -  tree_node * act_node=new tree_node;
  42.432 -  act_node->ch=to_tree[minplace];
  42.433 -  if(to_tree.size()>=3)
  42.434 -    {
  42.435 -      act_node->left_child=weightedString2Tree(to_tree.substr(0,minplace), p, offset);
  42.436 -      act_node->right_child=weightedString2Tree(to_tree.substr(minplace+1,to_tree.size()-minplace-1), p, offset+minplace+1);
  42.437 -    }
  42.438 -  else
  42.439 -    {
  42.440 -      act_node->left_child=NULL;
  42.441 -      act_node->right_child=NULL;
  42.442 -    }
  42.443 -  return act_node;
  42.444 -}
  42.445 -
  42.446 -std::string NewMapWin::postOrder(tree_node * subtree)
  42.447 -{
  42.448 -  std::string subtree_to_string;
  42.449 -  if(subtree->left_child)
  42.450 -    {
  42.451 -      subtree_to_string=postOrder(subtree->left_child);
  42.452 -    }
  42.453 -  if(subtree->right_child)
  42.454 -    {
  42.455 -      subtree_to_string=subtree_to_string+postOrder(subtree->right_child);
  42.456 -    }
  42.457 -  subtree_to_string=subtree_to_string+subtree->ch;
  42.458 -  return subtree_to_string;
  42.459 -}
  42.460 -
  42.461 -bool NewMapWin::validVariable(std::string variable, bool itisedge)
  42.462 -{
  42.463 -  bool cancel;
  42.464 -  //is it mapname?
  42.465 -  if(itisedge)
  42.466 -    {
  42.467 -      cancel=(mytab.mapstorage.edgemap_storage.find(variable)==mytab.mapstorage.edgemap_storage.end());
  42.468 -    }
  42.469 -  else
  42.470 -    {
  42.471 -      cancel=(mytab.mapstorage.nodemap_storage.find(variable)==mytab.mapstorage.nodemap_storage.end());
  42.472 -    }
  42.473 -  //maybe it is number
  42.474 -  int point_num=0;
  42.475 -  if(cancel)
  42.476 -    {
  42.477 -      cancel=false;
  42.478 -      for(int j=0;(!cancel)&&(j<(int)variable.size());j++)
  42.479 -	{
  42.480 -	  if(((variable[j]<'0')||(variable[j]>'9'))&&(variable[j]!='.'))
  42.481 -	    {
  42.482 -	      cancel=true;
  42.483 -	    }
  42.484 -	  else
  42.485 -	    {
  42.486 -	      if(variable[j]=='.')
  42.487 -		{
  42.488 -		  point_num++;
  42.489 -		  if(point_num>1)
  42.490 -		    {
  42.491 -		      cancel=true;
  42.492 -		    }
  42.493 -		}
  42.494 -	    }
  42.495 -	}
  42.496 -    }
  42.497 -  if(cancel)
  42.498 -    {
  42.499 -      return false;
  42.500 -    }
  42.501 -  return true;
  42.502 -}
    43.1 --- a/gui/new_map_win.h	Wed Jun 21 08:35:23 2006 +0000
    43.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.3 @@ -1,136 +0,0 @@
    43.4 -// -*- C++ -*- //
    43.5 -
    43.6 -#ifndef NEWMAPWIN_H
    43.7 -#define NEWMAPWIN_H
    43.8 -
    43.9 -class NewMapWin;
   43.10 -
   43.11 -#include <all_include.h>
   43.12 -#include <nbtab.h>
   43.13 -#include <libgnomecanvasmm.h>
   43.14 -#include <libgnomecanvasmm/polygon.h>
   43.15 -#include <stack>
   43.16 -
   43.17 -///Graphical interface for node/edge map creation.
   43.18 -
   43.19 -///This class is responsible for creating a window,
   43.20 -///on which the parameters of a new map can be set.
   43.21 -class NewMapWin : public Gtk::Dialog
   43.22 -{
   43.23 -  ///The \ref NoteBookTab in which the new map has to be placed.
   43.24 -  NoteBookTab & mytab;
   43.25 -
   43.26 -public:
   43.27 -
   43.28 -  ///Struct to be able to evaluate expressions.
   43.29 -
   43.30 -  ///Initial values of map elements can be given
   43.31 -  ///by numbers or by expressions. From expressions
   43.32 -  ///we build first a tree according to the priorities
   43.33 -  ///of operations in the expression. This is the data
   43.34 -  ///structure
   43.35 -  ///that can store one tree element.
   43.36 -  struct tree_node
   43.37 -  {
   43.38 -    ///Character stored in this tree element
   43.39 -    char ch;
   43.40 -    ///Left child of tree element.
   43.41 -    tree_node * left_child;
   43.42 -    ///Right child of tree element.
   43.43 -    tree_node * right_child;
   43.44 -  };
   43.45 -  
   43.46 -  ///Constructor of NewMapWin.
   43.47 -
   43.48 -  ///It creates the widgets shown in
   43.49 -  ///NewMapWin.
   43.50 -  NewMapWin(const std::string& title, NoteBookTab &, bool itisedge=true, bool edgenode=true);
   43.51 -
   43.52 -  ///Callback function for OK button. It creates the map.
   43.53 -  
   43.54 -  ///This function determines whether the input is correct:
   43.55 -  ///the name of new map must not be already used, the expression
   43.56 -  ///that gives tha initial values of map elements has to be valid.
   43.57 -  ///If input is correct it creates and registrates the new map
   43.58 -  ///to the correct place. (\ref mytab)
   43.59 -  virtual void on_response(int response_id);
   43.60 -
   43.61 -  ///Close window if Esc key pressed.
   43.62 -  virtual bool closeIfEscapeIsPressed(GdkEventKey*);
   43.63 -
   43.64 -  ///Function that creates a tree from an appropriately manipulated string.
   43.65 -
   43.66 -  ///Tree is builded according to priorities of operations in expression given by string.
   43.67 -  ///Priorities are indicated in a vector that contains weights for each operation.
   43.68 -  ///\param to_tree string to build tree from
   43.69 -  ///\param weights weights (priorities)
   43.70 -  ///\param offset this function call is recursive. This parameter tells us,
   43.71 -  ///with which part of the string do we have to deal with.
   43.72 -  tree_node * weightedString2Tree(std::string to_tree, std::vector<unsigned int> & weights, int offset);
   43.73 -
   43.74 -  ///Function that creates a string from a tree by postorder reading.
   43.75 -
   43.76 -  ///This is the last step of creating polishform
   43.77 -  ///from a given expression string.
   43.78 -  ///\param root the root of the tree to read through
   43.79 -  std::string postOrder(tree_node * root);
   43.80 -
   43.81 -  ///From the given expression it creates expression given in polish form.
   43.82 -
   43.83 -  ///First it substitutes variables and numbers in the given expression.
   43.84 -  ///The substitutions will be one character long local variables.
   43.85 -  ///The substituted-substitution pair is registrated in \ref ch2var.
   43.86 -  ///After that it gives weights fo each character in substituted expression.
   43.87 -  ///Weights are calculated according to the priority of operations in expression.
   43.88 -  ///Then it creates tree (\ref tree_node) from the weighted string. (\ref weightedString2Tree)
   43.89 -  ///\param to_polish the string to turn into polish_form
   43.90 -  ///\param itisedge do we have to create an edgemap or a nodemap.
   43.91 -  ///It is important, because variables are maps and if expression
   43.92 -  ///citates a map that does not exists the expression is not valid.
   43.93 -  ///But to determine, whether the map exists we have to know where
   43.94 -  ///to search for it. And of course for a new edgemap only edgemaps can be serve with values. 
   43.95 -  std::string string2Polishform(std::string to_polish, bool itisedge);
   43.96 -
   43.97 -  ///Returns whether a string can be used as value in an expression.
   43.98 -
   43.99 -  ///The given string has to be either a mapname or a number. If it is a mapname
  43.100 -  ///we have to know whether it is an edgemap or a nodemap.
  43.101 -  ///\param variable the string about the function has to determine whether it is usable in expressions
  43.102 -  ///\param itisedge should the mapname be between edgemaps, or nodemaps
  43.103 -  bool validVariable(std::string variable, bool itisedge);
  43.104 -
  43.105 -  ///Deletes the whole tree created for translating string to polishform.
  43.106 - 
  43.107 -  ///\param root
  43.108 -  ///root of the tree
  43.109 -  void deleteTree(tree_node * root);
  43.110 -
  43.111 -  ///Dictionary of substitutions in expression.
  43.112 -
  43.113 -  ///Variables and numbers are substituted with one character long variables in expressions.
  43.114 -  ///This is the dictionary.
  43.115 -  std::map<char, std::string> ch2var;
  43.116 -
  43.117 -  ///Entry which gives us the name of new map.
  43.118 -  Gtk::Entry name;
  43.119 -
  43.120 -  ///Entry which gives us the initial values of elements of new map.
  43.121 -
  43.122 -  ///Initial value can be a number or an expression after that the
  43.123 -  ///initial value for each map element can be calculated.
  43.124 -  Gtk::Entry default_value;
  43.125 -
  43.126 -  ///GTK Designing object.
  43.127 -  Gtk::Table * table;
  43.128 -
  43.129 -  ///Information holder in window.
  43.130 -  Gtk::Label * label;
  43.131 -
  43.132 -  ///If selected, nodemap will be created.
  43.133 -  Gtk::RadioButton node;
  43.134 -
  43.135 -  ///If selected, edgemap will be created.
  43.136 -  Gtk::RadioButton edge;
  43.137 -};
  43.138 -
  43.139 -#endif //NEWMAPWIN_H
    44.1 --- a/gui/xml.h	Wed Jun 21 08:35:23 2006 +0000
    44.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.3 @@ -1,442 +0,0 @@
    44.4 -/* -*- C++ -*-
    44.5 - * gui/xml.h - Part of LEMON, a generic C++ optimization library
    44.6 - *
    44.7 - * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    44.8 - * (Egervary Research Group on Combinatorial Optimization, EGRES).
    44.9 - *
   44.10 - * Permission to use, modify and distribute this software is granted
   44.11 - * provided that this copyright notice appears in all copies. For
   44.12 - * precise terms see the accompanying LICENSE file.
   44.13 - *
   44.14 - * This software is provided "AS IS" with no warranty of any kind,
   44.15 - * express or implied, and with no claim as to its suitability for any
   44.16 - * purpose.
   44.17 - *
   44.18 - */
   44.19 -
   44.20 -#include <iostream>
   44.21 -#include <string>
   44.22 -#include <vector>
   44.23 -#include <list>
   44.24 -#include <map>
   44.25 -#include <lemon/error.h>
   44.26 -#include <lemon/xy.h>
   44.27 -
   44.28 -namespace lemon {
   44.29 -
   44.30 -  class XmlIo 
   44.31 -  {
   44.32 -    bool _writeMode;
   44.33 -  public:
   44.34 -    ///Check if XmlIo is in write mode.
   44.35 -    bool write() { return _writeMode;}
   44.36 -    ///Check if XmlIo is in read mode.
   44.37 -    bool read() { return !_writeMode;}
   44.38 -
   44.39 -    std::ostream& os;
   44.40 -    int level;
   44.41 -    
   44.42 -  protected:
   44.43 -    void indent(int level) {
   44.44 -      os << std::endl;
   44.45 -      for(int i=0;i<level;i++) os << ' ';
   44.46 -    }
   44.47 -    void tag(const std::string &_tag) {
   44.48 -      os << '<' << _tag << '>';
   44.49 -    }
   44.50 -    void etag(const std::string &_tag) {
   44.51 -      os << "</" << _tag << '>';
   44.52 -    }
   44.53 -    void itag(const std::string &_tag) { indent();tag(_tag); }
   44.54 -    void ietag(const std::string &_tag) { indent();etag(_tag); }
   44.55 -
   44.56 -    void beginTag(const std::string &_tag) {
   44.57 -      itag(_tag);
   44.58 -      level++;
   44.59 -    }
   44.60 -    void endTag(const std::string &_tag) {
   44.61 -      level--;
   44.62 -      ietag(_tag);
   44.63 -    }
   44.64 -
   44.65 -  public:
   44.66 -    ///Indent the line according to its level.
   44.67 -
   44.68 -    ///\warning It can only be used in write mode.
   44.69 -    ///
   44.70 -    void indent()
   44.71 -    {
   44.72 -      if(write())
   44.73 -	if(level>=0) indent(level);
   44.74 -	else level=0;
   44.75 -      else throw LogicError();	
   44.76 -    }
   44.77 -  
   44.78 -    ///Read/write a tag
   44.79 -  
   44.80 -    ///Read/write a tag.
   44.81 -    ///In write mode it does not start a new line.
   44.82 -    class ContTag
   44.83 -    {
   44.84 -      XmlIo &ix;
   44.85 -      const std::string _tag;
   44.86 -    public:
   44.87 -      ///\e
   44.88 -  
   44.89 -      ///\e
   44.90 -      ///
   44.91 -      ContTag(XmlIo &_ix,const std::string &_t) :
   44.92 -	ix(_ix), _tag(_t)
   44.93 -      {
   44.94 -	if(ix.write()) ix.tag(_tag);
   44.95 -	else ix.useTag(_tag);
   44.96 -      }
   44.97 -      ~ContTag() { 
   44.98 -	if(ix.write()) ix.etag(_tag);
   44.99 -	else if(!std::uncaught_exception()) ix.useTag('/'+_tag);      
  44.100 -      }
  44.101 -    };
  44.102 -
  44.103 -    ///Read/write a tag
  44.104 -  
  44.105 -    ///Read/write a tag.
  44.106 -    ///The whole \<foo\> ... \</foo\> will be placed in a single line.
  44.107 -    class LineTag
  44.108 -    {
  44.109 -      XmlIo &ix;
  44.110 -      const std::string _tag;
  44.111 -    public:
  44.112 -      ///\e
  44.113 -    
  44.114 -      ///\e
  44.115 -      ///
  44.116 -      LineTag(XmlIo &_ix,const std::string &_t) :
  44.117 -	ix(_ix), _tag(_t)
  44.118 -      {
  44.119 -	if(ix.write()) ix.itag(_tag);
  44.120 -	else ix.useTag(_tag);
  44.121 -      }
  44.122 -      ~LineTag() { 
  44.123 -	if(ix.write()) ix.etag(_tag);
  44.124 -	else if(!std::uncaught_exception()) ix.useTag('/'+_tag);
  44.125 -      }
  44.126 -    };
  44.127 -
  44.128 -    ///Read/write a tag
  44.129 -  
  44.130 -    ///Read/write a tag.
  44.131 -    ///
  44.132 -    class Tag
  44.133 -    {
  44.134 -      XmlIo &ix;
  44.135 -      const std::string _tag;
  44.136 -    public:
  44.137 -      ///\e
  44.138 -  
  44.139 -      ///\e
  44.140 -      ///
  44.141 -      Tag(XmlIo &_ix,const std::string &_t) :
  44.142 -	ix(_ix), _tag(_t)
  44.143 -      {
  44.144 -	if(ix.write()) ix.beginTag(_tag);
  44.145 -	else ix.useTag(_tag);
  44.146 -      }
  44.147 -      ~Tag() {
  44.148 -	if(ix.write()) ix.endTag(_tag);
  44.149 -	else if(!std::uncaught_exception()) ix.useTag('/'+_tag);
  44.150 -      }
  44.151 -    };
  44.152 -
  44.153 -  private:
  44.154 -    std::istream& is;
  44.155 -    std::string next_tag;
  44.156 -    int line_number;
  44.157 -
  44.158 -    void skipWhiteSpaces()
  44.159 -    {
  44.160 -      if(write()) throw LogicError();
  44.161 -      {
  44.162 -	char c;
  44.163 -	while (is.get(c) && std::isspace(c,is.getloc()))
  44.164 -	  if(c=='\n') line_number++;
  44.165 -	is.unget();
  44.166 -      }
  44.167 -    }
  44.168 -  protected:
  44.169 -    /// Use the next tag.
  44.170 -
  44.171 -    ///\e
  44.172 -    ///
  44.173 -    void useTag() {next_tag.clear();}
  44.174 -  
  44.175 -    ///Use the next tag and check if it is equal with \c _tag
  44.176 -  
  44.177 -    ///\e
  44.178 -    ///
  44.179 -    void useTag(const std::string &_tag) {
  44.180 -      if(nextTag()==_tag) useTag();
  44.181 -      else throw DataFormatError("",line_number,"Unexpected token name");
  44.182 -    }
  44.183 -  public:
  44.184 -    ///Return the next tag (if a tag follows on the stream).
  44.185 -  
  44.186 -    ///\warning It can only be used in read mode.
  44.187 -    ///
  44.188 -    const std::string &nextTag() 
  44.189 -    {
  44.190 -      if(write()) throw LogicError();
  44.191 -      else if(next_tag.empty()) {
  44.192 -	char c;
  44.193 -	skipWhiteSpaces();
  44.194 -	if(!is.get(c) || c!='<')
  44.195 -	  throw DataFormatError("",line_number,"Bad format");
  44.196 -	next_tag.clear();
  44.197 -	while (is.get(c) && c!='>') next_tag.push_back(c);
  44.198 -	if(c!='>')
  44.199 -	  throw DataFormatError("",line_number,"Bad format");
  44.200 -      }
  44.201 -      return next_tag;
  44.202 -    }
  44.203 -
  44.204 -    /**********************************************************************/
  44.205 -
  44.206 -
  44.207 -    ///\e
  44.208 -  
  44.209 -    ///\e
  44.210 -    ///
  44.211 -    XmlIo(std::ostream& _os) : _writeMode(true), os(_os),
  44.212 -			       level(-1),
  44.213 -			       is(std::cin) {}
  44.214 -    ///\e
  44.215 -    ///
  44.216 -    XmlIo(std::istream& _is) : _writeMode(false),
  44.217 -			       os(std::cout), is(_is),
  44.218 -			       line_number(1) {}
  44.219 -
  44.220 -    ~XmlIo() { if(write()) os<< std::endl; }
  44.221 -  
  44.222 -
  44.223 -
  44.224 -    XmlIo &operator()(const int &v) 
  44.225 -    { 
  44.226 -      if(write()) os << v;
  44.227 -      else {
  44.228 -	skipWhiteSpaces();
  44.229 -	if(!(is >> const_cast<int &>(v))) 
  44.230 -	  throw DataFormatError("",line_number,"Not an 'int'");
  44.231 -      }
  44.232 -      return *this;
  44.233 -    }
  44.234 -    XmlIo &operator()(const double &v) 
  44.235 -    {
  44.236 -      if(write()) os << v;
  44.237 -      else {
  44.238 -	skipWhiteSpaces();
  44.239 -	if(!(is >> const_cast<double &>(v))) 
  44.240 -	  throw DataFormatError("",line_number,"Not an 'double'");
  44.241 -      }
  44.242 -      return *this;
  44.243 -    }
  44.244 -    XmlIo &operator()(const std::string &v)
  44.245 -    {
  44.246 -      if(write())
  44.247 -	for(std::string::const_iterator i=v.begin();i!=v.end();++i)
  44.248 -	  switch(*i) {
  44.249 -	  case '\\':
  44.250 -	    os << "\\\\";
  44.251 -	    break;
  44.252 -	  case '<':
  44.253 -	    os << "\\<";
  44.254 -	    break;
  44.255 -	  case '&':
  44.256 -	    os << "\\&";
  44.257 -	    break;
  44.258 -	  case '\n':
  44.259 -	    os << "\\n";
  44.260 -	    break;
  44.261 -	  default:
  44.262 -	    os<<*i;
  44.263 -	    break;
  44.264 -	  }
  44.265 -      else {
  44.266 -	std::string &w = const_cast<std::string &>(v);
  44.267 -	w.clear();
  44.268 -	char c;
  44.269 -	while (is.get(c) && c!='<')
  44.270 -	  if(c=='\\')
  44.271 -	    if(!is.get(c))
  44.272 -	      throw DataFormatError("",line_number,"Bad string");
  44.273 -	    else switch(c) {
  44.274 -	    case 'n':
  44.275 -	      w.push_back('\n');
  44.276 -	      break;
  44.277 -	    default:
  44.278 -	      w.push_back(c);
  44.279 -	      break;
  44.280 -	    }
  44.281 -	  else {
  44.282 -	    if(c=='\n') line_number++;
  44.283 -	    w.push_back(c);
  44.284 -	  }
  44.285 -	if(c!='<')
  44.286 -	  throw DataFormatError("",line_number,"Unexpected eof");
  44.287 -	is.unget();
  44.288 -      }
  44.289 -      return *this;
  44.290 -    }
  44.291 -
  44.292 -
  44.293 -    XmlIo &operator()(const std::string &_tag,const int &v) 
  44.294 -    { 
  44.295 -      LineTag t(*this,_tag);
  44.296 -      (*this)(v);
  44.297 -      return *this;
  44.298 -    }
  44.299 -    XmlIo &operator()(const std::string &_tag,const double &v) 
  44.300 -    {
  44.301 -      LineTag t(*this,_tag);
  44.302 -      (*this)(v);
  44.303 -      return *this;
  44.304 -    }
  44.305 -    XmlIo &operator()(const std::string &_tag,const std::string &v)
  44.306 -    {
  44.307 -      LineTag t(*this,_tag);
  44.308 -      (*this)(v);
  44.309 -      return *this;
  44.310 -    }
  44.311 -    ///\e
  44.312 -  
  44.313 -    ///\e
  44.314 -    ///
  44.315 -    template<class V>
  44.316 -    XmlIo &operator()(const std::string &_tag,const V &v)
  44.317 -    {
  44.318 -      Tag t(*this,_tag);
  44.319 -      xml(*this,const_cast<V &>(v));
  44.320 -      return *this;
  44.321 -    }
  44.322 -    ///\e
  44.323 -  
  44.324 -    ///\e
  44.325 -    ///
  44.326 -    template<class V>
  44.327 -    XmlIo &operator()(const V &v)
  44.328 -    {
  44.329 -      xml(*this,const_cast<V &>(v));
  44.330 -      return *this;
  44.331 -    }
  44.332 -    };
  44.333 -
  44.334 -  //////////////////////////////////////////////////////////////////////
  44.335 -  //////////////////////////////////////////////////////////////////////
  44.336 -
  44.337 -  ///\e
  44.338 -  
  44.339 -  ///\relates XmlIo
  44.340 -  ///
  44.341 -  template<class A>
  44.342 -  void xml(XmlIo &x,std::auto_ptr<A> &v)
  44.343 -  {
  44.344 -    if(x.write()) v=new A;
  44.345 -    x(*v);
  44.346 -  }
  44.347 -  
  44.348 -  ///\e
  44.349 -  
  44.350 -  ///\relates XmlIo
  44.351 -  ///
  44.352 -  template<class A,class B>
  44.353 -  void xml(XmlIo &x,std::pair<A,B> &v)
  44.354 -  {
  44.355 -    x("first",v.first);
  44.356 -    x("second",v.second);
  44.357 -  }
  44.358 -
  44.359 -  ///\e
  44.360 -  
  44.361 -  ///\relates XmlIo
  44.362 -  ///
  44.363 -  template<class T>
  44.364 -  void xml(XmlIo &x,std::list<T> &v)
  44.365 -  {
  44.366 -    if(x.write())
  44.367 -      for(typename std::list<T>::const_iterator it=v.begin();
  44.368 -	  it!=v.end();++it) x("item",*it);
  44.369 -    else while(x.nextTag()=="item")
  44.370 -      {
  44.371 -	v.push_back(T());
  44.372 -	x("item",v.back());
  44.373 -      }
  44.374 -  }
  44.375 -  ///\e
  44.376 -  
  44.377 -  ///\relates XmlIo
  44.378 -  ///
  44.379 -  template<class T>
  44.380 -  void xml(XmlIo &x,std::vector<T> &v)
  44.381 -  {
  44.382 -    if(x.write())
  44.383 -      for(typename std::vector<T>::const_iterator it=v.begin();
  44.384 -	  it!=v.end();++it) x("item",*it);
  44.385 -    else while(x.nextTag()=="item")
  44.386 -      {
  44.387 -	v.push_back(T());
  44.388 -	x("item",v.back());      
  44.389 -      }
  44.390 -  }
  44.391 -
  44.392 -  ///\e
  44.393 -  
  44.394 -  ///\relates XmlIo
  44.395 -  ///
  44.396 -  template<class K,class V>
  44.397 -  void xml(XmlIo &x,std::map<K,V> &v)
  44.398 -  {
  44.399 -    if(x.write()) 
  44.400 -      for(typename std::map<K,V>::const_iterator it=v.begin();
  44.401 -	  it!=v.end();++it) x("item",*it);
  44.402 -    else while(x.nextTag()=="item")
  44.403 -      {
  44.404 -	typename std::map<K,V>::value_type it;
  44.405 -	x("item",it);
  44.406 -	v.insert(it);
  44.407 -      }
  44.408 -  }
  44.409 -
  44.410 -  ///\e
  44.411 -  
  44.412 -  ///\relates XmlIo
  44.413 -  ///
  44.414 -  template<class T>
  44.415 -  void xml(XmlIo &x,lemon::xy<T> &v)
  44.416 -  {
  44.417 -    { XmlIo::LineTag t(x,"x"); x(v.x); }
  44.418 -    { XmlIo::ContTag t(x,"y"); x(v.y); }
  44.419 -  }
  44.420 -
  44.421 -  ///\e
  44.422 -  
  44.423 -  ///\relates XmlIo
  44.424 -  ///
  44.425 -  template<class T>
  44.426 -  void xml(XmlIo &x,lemon::BoundingBox<T> &v)
  44.427 -  {
  44.428 -    if(x.write()) {
  44.429 -      if(!v.empty()) {
  44.430 -	x("point",v.bottomLeft());
  44.431 -	if(v.bottomLeft()!=v.topRight()) x("point",v.topRight());
  44.432 -      }
  44.433 -    }
  44.434 -    else {
  44.435 -      v.clear();
  44.436 -      while(x.nextTag()=="point") {
  44.437 -	lemon::xy<T> co;
  44.438 -	x("point",co);
  44.439 -	v.add(co);
  44.440 -      }
  44.441 -    }
  44.442 -  }
  44.443 -  
  44.444 -}
  44.445 -
    45.1 --- a/gui/xymap.h	Wed Jun 21 08:35:23 2006 +0000
    45.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.3 @@ -1,32 +0,0 @@
    45.4 -#ifndef XYMAP_H
    45.5 -#define XYMAP_H
    45.6 -
    45.7 -#include <lemon/list_graph.h>
    45.8 -#include <lemon/xy.h>
    45.9 -
   45.10 -template<class M>
   45.11 -class XYMap
   45.12 -{
   45.13 -  private:
   45.14 -    M *xmap, *ymap;
   45.15 -
   45.16 -  public:
   45.17 -    typedef typename M::Key Key;
   45.18 -    typedef lemon::xy<typename M::Value> Value;
   45.19 -    XYMap() {}
   45.20 -    XYMap(M &_xmap, M &_ymap) : xmap(&_xmap), ymap(&_ymap) {}
   45.21 -    void setXMap(M &_xmap) { xmap = &_xmap; }
   45.22 -    void setYMap(M &_ymap) { ymap = &_ymap; }
   45.23 -    Value operator[](Key k) const
   45.24 -    {
   45.25 -      Value v(xmap->operator[](k), ymap->operator[](k));
   45.26 -      return v;
   45.27 -    }
   45.28 -    void set(Key k, Value v)
   45.29 -    {
   45.30 -      xmap->set(k, v.x);
   45.31 -      ymap->set(k, v.y);
   45.32 -    }
   45.33 -};
   45.34 -
   45.35 -#endif