Commits

Anonymous committed d3ac809

add CORE gui unrevised

Comments (0)

Files changed (128)

+# CORE
+# (c)2010-2012 the Boeing Company.
+# See the LICENSE file included in this distribution.
+#
+# author: Jeff Ahrenholz  <jeffrey.m.ahrenholz@boeing.com>
+#
+# Makefile for installing the CORE GUI. Since it is a Tcl/Tk script, we do not
+# build anything here.
+#
+
+TCL_FILES	= annotations.tcl api.tcl canvas.tcl cfgparse.tcl \
+		core.tcl debug.tcl editor.tcl exec.tcl \
+		filemgmt.tcl gpgui.tcl \
+		graph_partitioning.tcl help.tcl \
+		initgui.tcl ipv4.tcl ipv6.tcl \
+		linkcfg.tcl mobility.tcl nodecfg.tcl \
+		nodes.tcl ns2imunes.tcl plugins.tcl \
+		tooltips.tcl topogen.tcl traffic.tcl util.tcl \
+		version.tcl widget.tcl wlan.tcl wlanscript.tcl \
+		exceptions.tcl
+
+TINY_ICONS	= icons/tiny/button.play.gif \
+		icons/tiny/select.gif icons/tiny/marker.gif \
+		icons/tiny/rj45.gif icons/tiny/text.gif \
+		icons/tiny/edit-delete.gif icons/tiny/stop.gif \
+		icons/tiny/blank.gif icons/tiny/mobility.gif \
+		icons/tiny/script_play.gif icons/tiny/arrow.gif \
+		icons/tiny/lanswitch.gif icons/tiny/script_pause.gif \
+		icons/tiny/pc.gif icons/tiny/rectangle.gif \
+		icons/tiny/observe.gif icons/tiny/document-new.gif \
+		icons/tiny/document-save.gif \
+		icons/tiny/view-refresh.gif icons/tiny/moboff.gif \
+		icons/tiny/document-properties.gif icons/tiny/arrow.up.gif \
+		icons/tiny/host.gif icons/tiny/hub.gif \
+		icons/tiny/twonode.gif icons/tiny/router.gif \
+		icons/tiny/eraser.gif \
+		icons/tiny/stock_connect.gif icons/tiny/stock_disconnect.gif \
+		icons/tiny/ping.gif icons/tiny/link.gif \
+		icons/tiny/start.gif \
+		icons/tiny/trace.gif icons/tiny/button.stop.gif \
+		icons/tiny/arrow.down.gif icons/tiny/oval.gif \
+		icons/tiny/wlan.gif icons/tiny/delete.gif \
+		icons/tiny/run.gif icons/tiny/tunnel.gif \
+		icons/tiny/script_stop.gif \
+		icons/tiny/router_black.gif icons/tiny/router_green.gif \
+		icons/tiny/router_red.gif icons/tiny/router_yellow.gif \
+		icons/tiny/router_purple.gif \
+		icons/tiny/ap.gif icons/tiny/mdr.gif \
+		icons/tiny/folder.gif \
+		icons/tiny/cel.gif \
+		icons/tiny/fileopen.gif
+
+NORM_ICONS	= icons/normal/gps-diagram.xbm \
+		icons/normal/router_black.gif icons/normal/host.gif \
+		icons/normal/hub.gif \
+		icons/normal/router.gif \
+		icons/normal/rj45.gif icons/normal/antenna.gif \
+		icons/normal/text.gif \
+		icons/normal/lanswitch.gif icons/normal/core-icon.png \
+		icons/normal/core-icon.xbm icons/normal/oval.gif \
+		icons/normal/wlan.gif icons/normal/pc.gif \
+		icons/normal/tunnel.gif icons/normal/core-logo-275x75.gif \
+		icons/normal/router_red.gif icons/normal/router_green.gif \
+		icons/normal/simple.xbm \
+		icons/normal/document-properties.gif \
+		icons/normal/thumb-unknown.gif \
+		icons/normal/router_purple.gif icons/normal/router_yellow.gif \
+		icons/normal/ap.gif icons/normal/mdr.gif
+
+CONFIG_FILES	= configs/sample1.imn configs/sample1.scen \
+		configs/sample1-bg.gif configs/sample2-ssh.imn \
+		configs/sample3-bgp.imn	configs/sample4-nrlsmf.imn \
+		configs/sample4.scen configs/sample4-bg.jpg \
+		configs/sample5-mgen.imn configs/sample6-emane-rfpipe.imn \
+		configs/sample7-emane-ieee80211abg.imn
+
+OTHER_FILES	= core-bsd-cleanup.sh
+
+#
+# CORE GUI script (/usr/local/bin/core)
+#
+dist_bin_SCRIPTS = core
+
+#
+# Tcl/Tk scripts (/usr/local/lib/core)
+#
+coredir			= $(CORE_LIB_DIR)
+dist_core_DATA		= $(TCL_FILES) 
+dist_core_SCRIPTS	= $(OTHER_FILES)
+
+#
+# Icon files (/usr/local/lib/core/icons/[tiny,normal])
+#
+coreiconnormaldir	= $(coredir)/icons/normal
+dist_coreiconnormal_DATA = $(NORM_ICONS)
+coreicontinydir		= $(coredir)/icons/tiny
+dist_coreicontiny_DATA	= $(TINY_ICONS)
+
+#
+# Sample configs (/usr/local/share/core/examples/configs)
+#
+coreconfigsdir		= $(datadir)/core/examples/configs
+dist_coreconfigs_DATA	= $(CONFIG_FILES) 
+
+
+dist-hook:
+	rm -rf $(distdir)/addons/.svn
+
+# extra cruft to remove
+DISTCLEANFILES	= Makefile.in
+
+# files to include in source tarball not included elsewhere
+EXTRA_DIST 	= addons
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# CORE
+# (c)2010-2012 the Boeing Company.
+# See the LICENSE file included in this distribution.
+#
+# author: Jeff Ahrenholz  <jeffrey.m.ahrenholz@boeing.com>
+#
+# Makefile for installing the CORE GUI. Since it is a Tcl/Tk script, we do not
+# build anything here.
+#
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+subdir = gui
+DIST_COMMON = $(dist_bin_SCRIPTS) $(dist_core_DATA) \
+	$(dist_core_SCRIPTS) $(dist_coreconfigs_DATA) \
+	$(dist_coreiconnormal_DATA) $(dist_coreicontiny_DATA) \
+	$(srcdir)/Makefile.am $(srcdir)/Makefile.in $(srcdir)/core.in \
+	$(srcdir)/version.tcl.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES = core version.tcl
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(coredir)" \
+	"$(DESTDIR)$(coredir)" "$(DESTDIR)$(coreconfigsdir)" \
+	"$(DESTDIR)$(coreiconnormaldir)" \
+	"$(DESTDIR)$(coreicontinydir)"
+SCRIPTS = $(dist_bin_SCRIPTS) $(dist_core_SCRIPTS)
+SOURCES =
+DIST_SOURCES =
+DATA = $(dist_core_DATA) $(dist_coreconfigs_DATA) \
+	$(dist_coreiconnormal_DATA) $(dist_coreicontiny_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+ARCH = @ARCH@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BINDIR = @BINDIR@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COREDPY_VERSION = @COREDPY_VERSION@
+CORED_VERSION = @CORED_VERSION@
+CORE_CONF_DIR = @CORE_CONF_DIR@
+CORE_DATA_DIR = @CORE_DATA_DIR@
+CORE_GUI_CONF_DIR = @CORE_GUI_CONF_DIR@
+CORE_LIB_DIR = @CORE_LIB_DIR@
+CORE_STATE_DIR = @CORE_STATE_DIR@
+CORE_VERSION = @CORE_VERSION@
+CORE_VERSION_DATE = @CORE_VERSION_DATE@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+HELP2MAN = @HELP2MAN@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIB_DIR = @LIB_DIR@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+RANLIB = @RANLIB@
+SBINDIR = @SBINDIR@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+brctl_path = @brctl_path@
+build_alias = @build_alias@
+builddir = @builddir@
+convert = @convert@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+ebtables_path = @ebtables_path@
+exec_prefix = @exec_prefix@
+gmake = @gmake@
+help2man = @help2man@
+host_alias = @host_alias@
+htmldir = @htmldir@
+ifconfig_path = @ifconfig_path@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+ip_path = @ip_path@
+libdir = @libdir@
+libev_CFLAGS = @libev_CFLAGS@
+libev_LIBS = @libev_LIBS@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+make_info = @make_info@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+mount_path = @mount_path@
+ngctl_path = @ngctl_path@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+tc_path = @tc_path@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+umount_path = @umount_path@
+vimage_path = @vimage_path@
+TCL_FILES = annotations.tcl api.tcl canvas.tcl cfgparse.tcl \
+		core.tcl debug.tcl editor.tcl exec.tcl \
+		filemgmt.tcl gpgui.tcl \
+		graph_partitioning.tcl help.tcl \
+		initgui.tcl ipv4.tcl ipv6.tcl \
+		linkcfg.tcl mobility.tcl nodecfg.tcl \
+		nodes.tcl ns2imunes.tcl plugins.tcl \
+		tooltips.tcl topogen.tcl traffic.tcl util.tcl \
+		version.tcl widget.tcl wlan.tcl wlanscript.tcl \
+		exceptions.tcl
+
+TINY_ICONS = icons/tiny/button.play.gif \
+		icons/tiny/select.gif icons/tiny/marker.gif \
+		icons/tiny/rj45.gif icons/tiny/text.gif \
+		icons/tiny/edit-delete.gif icons/tiny/stop.gif \
+		icons/tiny/blank.gif icons/tiny/mobility.gif \
+		icons/tiny/script_play.gif icons/tiny/arrow.gif \
+		icons/tiny/lanswitch.gif icons/tiny/script_pause.gif \
+		icons/tiny/pc.gif icons/tiny/rectangle.gif \
+		icons/tiny/observe.gif icons/tiny/document-new.gif \
+		icons/tiny/document-save.gif \
+		icons/tiny/view-refresh.gif icons/tiny/moboff.gif \
+		icons/tiny/document-properties.gif icons/tiny/arrow.up.gif \
+		icons/tiny/host.gif icons/tiny/hub.gif \
+		icons/tiny/twonode.gif icons/tiny/router.gif \
+		icons/tiny/eraser.gif \
+		icons/tiny/stock_connect.gif icons/tiny/stock_disconnect.gif \
+		icons/tiny/ping.gif icons/tiny/link.gif \
+		icons/tiny/start.gif \
+		icons/tiny/trace.gif icons/tiny/button.stop.gif \
+		icons/tiny/arrow.down.gif icons/tiny/oval.gif \
+		icons/tiny/wlan.gif icons/tiny/delete.gif \
+		icons/tiny/run.gif icons/tiny/tunnel.gif \
+		icons/tiny/script_stop.gif \
+		icons/tiny/router_black.gif icons/tiny/router_green.gif \
+		icons/tiny/router_red.gif icons/tiny/router_yellow.gif \
+		icons/tiny/router_purple.gif \
+		icons/tiny/ap.gif icons/tiny/mdr.gif \
+		icons/tiny/folder.gif \
+		icons/tiny/cel.gif \
+		icons/tiny/fileopen.gif
+
+NORM_ICONS = icons/normal/gps-diagram.xbm \
+		icons/normal/router_black.gif icons/normal/host.gif \
+		icons/normal/hub.gif \
+		icons/normal/router.gif \
+		icons/normal/rj45.gif icons/normal/antenna.gif \
+		icons/normal/text.gif \
+		icons/normal/lanswitch.gif icons/normal/core-icon.png \
+		icons/normal/core-icon.xbm icons/normal/oval.gif \
+		icons/normal/wlan.gif icons/normal/pc.gif \
+		icons/normal/tunnel.gif icons/normal/core-logo-275x75.gif \
+		icons/normal/router_red.gif icons/normal/router_green.gif \
+		icons/normal/simple.xbm \
+		icons/normal/document-properties.gif \
+		icons/normal/thumb-unknown.gif \
+		icons/normal/router_purple.gif icons/normal/router_yellow.gif \
+		icons/normal/ap.gif icons/normal/mdr.gif
+
+CONFIG_FILES = configs/sample1.imn configs/sample1.scen \
+		configs/sample1-bg.gif configs/sample2-ssh.imn \
+		configs/sample3-bgp.imn	configs/sample4-nrlsmf.imn \
+		configs/sample4.scen configs/sample4-bg.jpg \
+		configs/sample5-mgen.imn configs/sample6-emane-rfpipe.imn \
+		configs/sample7-emane-ieee80211abg.imn
+
+OTHER_FILES = core-bsd-cleanup.sh
+
+#
+# CORE GUI script (/usr/local/bin/core)
+#
+dist_bin_SCRIPTS = core
+
+#
+# Tcl/Tk scripts (/usr/local/lib/core)
+#
+coredir = $(CORE_LIB_DIR)
+dist_core_DATA = $(TCL_FILES) 
+dist_core_SCRIPTS = $(OTHER_FILES)
+
+#
+# Icon files (/usr/local/lib/core/icons/[tiny,normal])
+#
+coreiconnormaldir = $(coredir)/icons/normal
+dist_coreiconnormal_DATA = $(NORM_ICONS)
+coreicontinydir = $(coredir)/icons/tiny
+dist_coreicontiny_DATA = $(TINY_ICONS)
+
+#
+# Sample configs (/usr/local/share/core/examples/configs)
+#
+coreconfigsdir = $(datadir)/core/examples/configs
+dist_coreconfigs_DATA = $(CONFIG_FILES) 
+
+# extra cruft to remove
+DISTCLEANFILES = Makefile.in
+
+# files to include in source tarball not included elsewhere
+EXTRA_DIST = addons
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gui/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign gui/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+core: $(top_builddir)/config.status $(srcdir)/core.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+version.tcl: $(top_builddir)/config.status $(srcdir)/version.tcl.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+install-dist_binSCRIPTS: $(dist_bin_SCRIPTS)
+	@$(NORMAL_INSTALL)
+	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+	@list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
+	for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+	done | \
+	sed -e 'p;s,.*/,,;n' \
+	    -e 'h;s|.*|.|' \
+	    -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+	    if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+	      if (++n[d] == $(am__install_max)) { \
+		print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+	    else { print "f", d "/" $$4, $$1 } } \
+	  END { for (d in files) print "f", d, files[d] }' | \
+	while read type dir files; do \
+	     if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+	     test -z "$$files" || { \
+	       echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+	       $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+	     } \
+	; done
+
+uninstall-dist_binSCRIPTS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
+	files=`for p in $$list; do echo "$$p"; done | \
+	       sed -e 's,.*/,,;$(transform)'`; \
+	test -n "$$list" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(bindir)" && rm -f $$files
+install-dist_coreSCRIPTS: $(dist_core_SCRIPTS)
+	@$(NORMAL_INSTALL)
+	test -z "$(coredir)" || $(MKDIR_P) "$(DESTDIR)$(coredir)"
+	@list='$(dist_core_SCRIPTS)'; test -n "$(coredir)" || list=; \
+	for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+	done | \
+	sed -e 'p;s,.*/,,;n' \
+	    -e 'h;s|.*|.|' \
+	    -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+	    if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+	      if (++n[d] == $(am__install_max)) { \
+		print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+	    else { print "f", d "/" $$4, $$1 } } \
+	  END { for (d in files) print "f", d, files[d] }' | \
+	while read type dir files; do \
+	     if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+	     test -z "$$files" || { \
+	       echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(coredir)$$dir'"; \
+	       $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(coredir)$$dir" || exit $$?; \
+	     } \
+	; done
+
+uninstall-dist_coreSCRIPTS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(dist_core_SCRIPTS)'; test -n "$(coredir)" || exit 0; \
+	files=`for p in $$list; do echo "$$p"; done | \
+	       sed -e 's,.*/,,;$(transform)'`; \
+	test -n "$$list" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(coredir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(coredir)" && rm -f $$files
+install-dist_coreDATA: $(dist_core_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(coredir)" || $(MKDIR_P) "$(DESTDIR)$(coredir)"
+	@list='$(dist_core_DATA)'; test -n "$(coredir)" || list=; \
+	for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(coredir)'"; \
+	  $(INSTALL_DATA) $$files "$(DESTDIR)$(coredir)" || exit $$?; \
+	done
+
+uninstall-dist_coreDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(dist_core_DATA)'; test -n "$(coredir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	test -n "$$files" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(coredir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(coredir)" && rm -f $$files
+install-dist_coreconfigsDATA: $(dist_coreconfigs_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(coreconfigsdir)" || $(MKDIR_P) "$(DESTDIR)$(coreconfigsdir)"
+	@list='$(dist_coreconfigs_DATA)'; test -n "$(coreconfigsdir)" || list=; \
+	for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(coreconfigsdir)'"; \
+	  $(INSTALL_DATA) $$files "$(DESTDIR)$(coreconfigsdir)" || exit $$?; \
+	done
+
+uninstall-dist_coreconfigsDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(dist_coreconfigs_DATA)'; test -n "$(coreconfigsdir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	test -n "$$files" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(coreconfigsdir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(coreconfigsdir)" && rm -f $$files
+install-dist_coreiconnormalDATA: $(dist_coreiconnormal_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(coreiconnormaldir)" || $(MKDIR_P) "$(DESTDIR)$(coreiconnormaldir)"
+	@list='$(dist_coreiconnormal_DATA)'; test -n "$(coreiconnormaldir)" || list=; \
+	for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(coreiconnormaldir)'"; \
+	  $(INSTALL_DATA) $$files "$(DESTDIR)$(coreiconnormaldir)" || exit $$?; \
+	done
+
+uninstall-dist_coreiconnormalDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(dist_coreiconnormal_DATA)'; test -n "$(coreiconnormaldir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	test -n "$$files" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(coreiconnormaldir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(coreiconnormaldir)" && rm -f $$files
+install-dist_coreicontinyDATA: $(dist_coreicontiny_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(coreicontinydir)" || $(MKDIR_P) "$(DESTDIR)$(coreicontinydir)"
+	@list='$(dist_coreicontiny_DATA)'; test -n "$(coreicontinydir)" || list=; \
+	for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(coreicontinydir)'"; \
+	  $(INSTALL_DATA) $$files "$(DESTDIR)$(coreicontinydir)" || exit $$?; \
+	done
+
+uninstall-dist_coreicontinyDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(dist_coreicontiny_DATA)'; test -n "$(coreicontinydir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	test -n "$$files" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(coreicontinydir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(coreicontinydir)" && rm -f $$files
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+	$(MAKE) $(AM_MAKEFLAGS) \
+	  top_distdir="$(top_distdir)" distdir="$(distdir)" \
+	  dist-hook
+check-am: all-am
+check: check-am
+all-am: Makefile $(SCRIPTS) $(DATA)
+installdirs:
+	for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(coredir)" "$(DESTDIR)$(coredir)" "$(DESTDIR)$(coreconfigsdir)" "$(DESTDIR)$(coreiconnormaldir)" "$(DESTDIR)$(coreicontinydir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+	-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_coreDATA install-dist_coreSCRIPTS \
+	install-dist_coreconfigsDATA install-dist_coreiconnormalDATA \
+	install-dist_coreicontinyDATA
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-dist_binSCRIPTS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dist_binSCRIPTS uninstall-dist_coreDATA \
+	uninstall-dist_coreSCRIPTS uninstall-dist_coreconfigsDATA \
+	uninstall-dist_coreiconnormalDATA \
+	uninstall-dist_coreicontinyDATA
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic dist-hook \
+	distclean distclean-generic distdir dvi dvi-am html html-am \
+	info info-am install install-am install-data install-data-am \
+	install-dist_binSCRIPTS install-dist_coreDATA \
+	install-dist_coreSCRIPTS install-dist_coreconfigsDATA \
+	install-dist_coreiconnormalDATA install-dist_coreicontinyDATA \
+	install-dvi install-dvi-am install-exec install-exec-am \
+	install-html install-html-am install-info install-info-am \
+	install-man install-pdf install-pdf-am install-ps \
+	install-ps-am install-strip installcheck installcheck-am \
+	installdirs maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \
+	uninstall-am uninstall-dist_binSCRIPTS uninstall-dist_coreDATA \
+	uninstall-dist_coreSCRIPTS uninstall-dist_coreconfigsDATA \
+	uninstall-dist_coreiconnormalDATA \
+	uninstall-dist_coreicontinyDATA
+
+
+dist-hook:
+	rm -rf $(distdir)/addons/.svn
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:

gui/annotations.tcl

+#
+# Copyright 2005-2012 the Boeing Company.
+# See the LICENSE file included in this distribution.
+#
+
+#
+# Copyright 2007-2008 University of Zagreb, Croatia.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+
+#****h* imunes/annotations.tcl
+# NAME
+#  annotations.tcl -- oval, rectangle, text, background, ...
+# FUNCTION
+#  This module is used for configuration/image annotations, such as oval, 
+#  rectangle, text, background or some other.
+#****
+
+#****f* annotations.tcl/annotationConfig
+# NAME
+#   annotationConfig -- 
+# SYNOPSIS
+#   annotationConfig $canvas $target
+# FUNCTION
+#   . . .
+# INPUTS
+#   * canvas -- 
+#   * target -- oval or rectangle object
+#****
+
+proc annotationConfig { c target } {
+    switch -exact -- [nodeType $target] {
+	oval {
+	    popupAnnotationDialog $c $target "true"
+	}
+	rectangle {
+	    popupAnnotationDialog $c $target "true"
+	}
+	text {
+	    popupAnnotationDialog $c $target "true"
+	}
+	default {
+	    puts "Unknown type [nodeType $target] for target $target"
+	}
+    }
+    redrawAll
+}
+
+
+#****f* annotations.tcl/popupOvalDialog
+# NAME
+#   popupOvalDialog -- creates a new oval or modifies existing oval
+# SYNOPSIS
+#   popupOvalDialog $canvas $modify $color $label $lcolor
+# FUNCTION
+#   Called from:
+#   - editor.tcl/button1-release when new oval is drawn 
+#   - annotationConfig which is called from popupConfigDialog bound to 
+#     Double-1 on various objects
+#   - configureOval called from button3annotation procedure which creates
+#     a menu for configuration and deletion (bound to 3 on oval, 
+#     rectangle and text) 
+# INPUTS
+#   * canvas -- 
+#   * modify -- create new oval "newoval" if modify=false or 
+#     modify an existing oval "newoval" if modify=true
+#   * color  -- oval color
+#   * label  -- label text
+#   * lcolor -- label (text) color
+#****
+
+
+#****f* annotations.tcl/destroyNewoval
+# NAME
+#   destroyNewoval -- helper for popupOvalDialog and popupOvalApply
+# SYNOPSIS
+#   destroyNewoval $canvas
+# FUNCTION
+#   . . .
+# INPUTS
+#   * canvas -- 
+#****
+
+proc destroyNewoval { c } {
+    global newoval
+    $c delete -withtags newoval
+    set newoval ""
+}
+
+
+# oval/rectangle/text right-click menu
+
+proc button3annotation { type c x y } {
+
+    if { $type == "oval" } {
+	set procname "Oval"
+	set item [lindex [$c gettags {oval && current}] 1]
+    } elseif { $type == "rectangle" } {
+	set procname "Rectangle"
+	set item [lindex [$c gettags {rectangle && current}] 1]
+    } elseif { $type == "label" } {
+	set procname "Label"
+	set item [lindex [$c gettags {label && current}] 1]
+    } elseif { $type == "text" } {
+	set procname "Text"
+	set item [lindex [$c gettags {text && current}] 1]
+    } elseif { $type == "marker" } {
+ 	# erase markings
+	$c delete -withtags {marker && current}
+	return
+    } else {
+	# ???
+	return
+    }
+    if { $item == "" } {
+	return
+    }
+    set menutext "$type $item"
+
+    .button3menu delete 0 end
+
+    .button3menu add command -label "Configure $menutext" \
+	-command "annotationConfig $c $item"
+    .button3menu add command -label "Delete $menutext" \
+	-command "deleteAnnotation $c $type $item"
+
+    set x [winfo pointerx .]
+    set y [winfo pointery .]
+    tk_popup .button3menu $x $y
+}
+
+
+proc deleteAnnotation { c type target } {
+    global changed annotation_list
+    
+    $c delete -withtags "$type && $target"
+    $c delete -withtags "new$type"
+    set i [lsearch -exact $annotation_list $target]
+    set annotation_list [lreplace $annotation_list $i $i]
+    set changed 1
+    updateUndoLog
+}
+
+
+proc drawOval {oval} {
+    global $oval defOvalColor zoom curcanvas
+    global defTextFontFamily defTextFontSize
+
+    set coords [getNodeCoords $oval]
+    if { [llength $coords] < 4 } {
+	puts "Bad coordinates for oval $oval"
+    	return
+    }
+    set x1 [expr {[lindex $coords 0] * $zoom}]
+    set y1 [expr {[lindex $coords 1] * $zoom}]
+    set x2 [expr {[lindex $coords 2] * $zoom}]
+    set y2 [expr {[lindex $coords 3] * $zoom}]
+    set color [lindex [lsearch -inline [set $oval] "color *"] 1]
+    set label [lindex [lsearch -inline [set $oval] "label *"] 1]
+    set lcolor [lindex [lsearch -inline [set $oval] "labelcolor *"] 1]
+    set bordercolor [lindex [lsearch -inline [set $oval] "border *"] 1]
+    set width [lindex [lsearch -inline [set $oval] "width *"] 1]
+    set lx [expr $x1 + (($x2 - $x1) / 2)]
+    set ly [expr ($y1 + 20)]
+
+    if { $color == "" } { set color $defOvalColor }
+    if { $lcolor == "" } { set lcolor black }
+    if { $width == "" } { set width 0 }
+    if { $bordercolor == "" } { set bordercolor black }
+
+    # -outline red -stipple gray50
+    set newoval [.c create oval $x1 $y1 $x2 $y2 \
+	-fill $color -width $width -outline $bordercolor \
+	-tags "oval $oval annotation"]
+    .c raise $newoval background
+
+    set fontfamily [lindex [lsearch -inline [set $oval] "fontfamily *"] 1]
+    set fontsize [lindex [lsearch -inline [set $oval] "fontsize *"] 1]
+    if { $fontfamily == "" } {
+	set fontfamily $defTextFontFamily
+    }
+    if { $fontsize == "" } {
+	set fontsize $defTextFontSize
+    }
+    set newfontsize $fontsize
+    set font [list "$fontfamily" $fontsize]
+    set effects [lindex [lsearch -inline [set $oval] "effects *"] 1]
+
+    .c create text $lx $ly -tags "oval $oval annotation" -text $label \
+	-justify center -font "$font $effects" -fill $lcolor
+
+    setNodeCanvas $oval $curcanvas
+    setType $oval "oval"
+}
+
+
+# Color helper for popupOvalDialog and popupLabelDialog
+proc popupColor { type l settext } {
+    # popup color selection dialog with current color
+    if { $type == "fg" } {
+	set initcolor [$l cget -fg]
+    } else {
+	set initcolor [$l cget -bg]
+    }
+    set newcolor [tk_chooseColor -initialcolor $initcolor]
+
+    # set fg or bg of the "l" label control
+    if { $newcolor == "" } {
+	return
+    }
+    if { $settext == "true" } {
+	$l configure -text $newcolor -$type $newcolor
+    } else {
+	$l configure -$type $newcolor
+    }
+}
+
+
+#****f* annotations.tcl/roundRect
+# NAME
+#   roundRect -- Draw a rounded rectangle in the canvas.
+#		Called from drawRect procedure
+# SYNOPSIS
+#   roundRect $w $x0 $y0 $x3 $y3 $radius $args
+# FUNCTION
+#   Creates a rounded rectangle as a smooth polygon in the canvas
+#   and returns the canvas item number of the rounded rectangle.
+# INPUTS
+#   * w      -- Path name of the canvas
+#   * x0, y0 -- Coordinates of the upper left corner, in pixels
+#   * x3, y3 -- Coordinates of the lower right corner, in pixels
+#   * radius -- Radius of the bend at the corners, in any form
+#		acceptable to Tk_GetPixels
+#   * args   -- Other args suitable to a 'polygon' item on the canvas
+# Example:
+#   roundRect .c 100 50 500 250 $rad -fill white -outline black -tags rectangle
+#****
+
+proc roundRect { w x0 y0 x3 y3 radius args } {
+
+    set r [winfo pixels $w $radius]
+    set d [expr { 2 * $r }]
+
+    # Make sure that the radius of the curve is less than 3/8 size of the box
+
+    set maxr 0.75
+
+    if { $d > $maxr * ( $x3 - $x0 ) } {
+	set d [expr { $maxr * ( $x3 - $x0 ) }]
+    }
+    if { $d > $maxr * ( $y3 - $y0 ) } {
+	set d [expr { $maxr * ( $y3 - $y0 ) }]
+    }
+
+    set x1 [expr { $x0 + $d }]
+    set x2 [expr { $x3 - $d }]
+    set y1 [expr { $y0 + $d }]
+    set y2 [expr { $y3 - $d }]
+
+    set cmd [list $w create polygon]
+    lappend cmd $x0 $y0 $x1 $y0 $x2 $y0 $x3 $y0 $x3 $y1 $x3 $y2 
+    lappend cmd $x3 $y3 $x2 $y3 $x1 $y3 $x0 $y3 $x0 $y2 $x0 $y1
+    lappend cmd -smooth 1
+    return [eval $cmd $args]
+ }
+
+proc drawRect {rectangle} {
+    global $rectangle defRectColor zoom curcanvas
+    global defTextFontFamily defTextFontSize
+
+    set coords [getNodeCoords $rectangle]
+    if {$coords == "" || [llength $coords] != 4 } {
+	puts "Bad coordinates for rectangle $rectangle"
+	return
+    }
+
+    set x1 [expr {[lindex $coords 0] * $zoom}]
+    set y1 [expr {[lindex $coords 1] * $zoom}]
+    set x2 [expr {[lindex $coords 2] * $zoom}]
+    set y2 [expr {[lindex $coords 3] * $zoom}]
+    set color [lindex [lsearch -inline [set $rectangle] "color *"] 1]
+    set label [lindex [lsearch -inline [set $rectangle] "label *"] 1]
+    set lcolor [lindex [lsearch -inline [set $rectangle] "labelcolor *"] 1]
+    set bordercolor [lindex [lsearch -inline [set $rectangle] "border *"] 1]
+    set width [lindex [lsearch -inline [set $rectangle] "width *"] 1]
+    set rad [lindex [lsearch -inline [set $rectangle] "rad *"] 1]
+    set lx [expr $x1 + (($x2 - $x1) / 2)]
+    set ly [expr ($y1 + 20)]
+
+    if { $color == "" } { set color $defRectColor }
+    if { $lcolor == "" } { set lcolor black }
+    if { $bordercolor == "" } { set bordercolor black }
+    if { $width == "" } { set width 0 }
+    # rounded-rectangle radius
+    if { $rad == "" } { set rad 25 }
+
+    # Boeing: allow borderless rectangles
+    if { $width == 0 } {
+    set newrect [roundRect .c $x1 $y1 $x2 $y2 $rad \
+	-fill $color -tags "rectangle $rectangle annotation"]
+    } else {
+    # end Boeing
+    set newrect [roundRect .c $x1 $y1 $x2 $y2 $rad \
+	-fill $color -outline $bordercolor -width $width \
+	-tags "rectangle $rectangle annotation"]
+    .c raise $newrect background
+    # Boeing
+    }
+    # end Boeing
+
+    set fontfamily [lindex [lsearch -inline [set $rectangle] "fontfamily *"] 1]
+    set fontsize [lindex [lsearch -inline [set $rectangle] "fontsize *"] 1]
+    if { $fontfamily == "" } {
+	set fontfamily $defTextFontFamily
+    }
+    if { $fontsize == "" } {
+	set fontsize $defTextFontSize
+    }
+    set newfontsize $fontsize
+    set font [list "$fontfamily" $fontsize]
+    set effects [lindex [lsearch -inline [set $rectangle] "effects *"] 1]
+
+    .c create text $lx $ly -tags "rectangle $rectangle annotation" \
+	-text $label -justify center -font "$font $effects" -fill $lcolor
+
+    setNodeCanvas $rectangle $curcanvas
+    setType $rectangle "rectangle"
+}
+
+
+proc popupAnnotationDialog { c target modify } {
+    global $target newrect newoval 
+    global width rad fontfamily fontsize
+    global defFillColor defTextColor defTextFontFamily defTextFontSize
+
+    # do nothing, return, if coords are empty
+    if { $target == 0 \
+	    && [$c coords "$newrect"] == "" \
+	    && [$c coords "$newoval"] == "" } {
+	return
+    }
+    if { $target == 0 } {
+	set width 0
+	set rad 25
+	set coords [$c bbox "$newrect"]
+	if { [$c coords "$newrect"] == "" } {
+	    set coords [$c bbox "$newoval"]
+	    set annotationType "oval"
+	} else {
+	    set annotationType "rectangle"
+	}
+	set fontfamily ""
+	set fontsize ""
+	set effects ""
+	set color ""
+	set label ""
+	set lcolor ""
+	set bordercolor ""
+    } else {
+	set width [lindex [lsearch -inline [set $target] "width *"] 1]
+	set rad [lindex [lsearch -inline [set $target] "rad *"] 1]
+	set coords [$c bbox "$target"]
+	set color [lindex [lsearch -inline [set $target] "color *"] 1]
+	set fontfamily [lindex [lsearch -inline [set $target] "fontfamily *"] 1]
+	set fontsize [lindex [lsearch -inline [set $target] "fontsize *"] 1]
+	set effects [lindex [lsearch -inline [set $target] "effects *"] 1]
+
+	set label [lindex [lsearch -inline [set $target] "label *"] 1]
+	set lcolor [lindex [lsearch -inline [set $target] "labelcolor *"] 1]
+	set bordercolor [lindex [lsearch -inline [set $target] "border *"] 1]
+	set annotationType [nodeType $target]
+    }
+
+    if { $color == "" } {
+	# Boeing: use default shape colors
+	if { $annotationType == "oval" } {
+	    global defOvalColor
+	    set color $defOvalColor
+	} elseif { $annotationType == "rectangle" } {
+	    global defRectColor
+	    set color $defRectColor
+	} else {
+	    set color $defFillColor
+	}
+    }
+    if { $lcolor == "" } { set lcolor black }
+    if { $bordercolor == "" } { set bordercolor black }
+    if { $width == "" } { set width 0 }
+    if { $rad == "" } { set rad 25 }
+    if { $fontfamily == "" } { set fontfamily $defTextFontFamily }
+    if { $fontsize == "" } { set fontsize $defTextFontSize }
+
+    set textBold 0
+    set textItalic 0
+    set textUnderline 0
+    if { [lsearch $effects bold ] != -1} {set textBold 1}
+    if { [lsearch $effects italic ] != -1} {set textItalic 1}
+    if { [lsearch $effects underline ] != -1} {set textUnderline 1}
+
+    set x1 [lindex $coords 0] 
+    set y1 [lindex $coords 1]
+    set x2 [lindex $coords 2]
+    set y2 [lindex $coords 3]
+    set xx [expr {abs($x2 - $x1)}] 
+    set yy [expr {abs($y2 - $y1)}] 
+    if { $xx > $yy } {
+	set maxrad [expr $yy * 3.0 / 8.0]
+    } else {
+	set maxrad [expr $xx * 3.0 / 8.0]
+    }
+
+    set wi .popup
+    catch {destroy $wi}
+    toplevel $wi
+
+    wm transient $wi .
+    wm resizable $wi 0 0
+
+    if { $modify == "true" } {
+	set windowtitle "Configure $annotationType $target"
+    } else {
+	set windowtitle "Add a new $annotationType"
+    }
+    wm title $wi $windowtitle
+
+    frame $wi.text -relief groove -bd 2
+    frame $wi.text.lab
+    label $wi.text.lab.name_label -text "Text for top of $annotationType:"
+    entry $wi.text.lab.name -bg white -fg $lcolor -width 32 \
+	-validate focus -invcmd "focusAndFlash %W"
+    $wi.text.lab.name insert 0 $label
+    pack $wi.text.lab.name_label $wi.text.lab.name -side left -anchor w \
+	-padx 2 -pady 2 -fill x
+    pack $wi.text.lab -side top -fill x
+
+    frame $wi.text.format 
+
+    set fontmenu [tk_optionMenu $wi.text.format.fontmenu fontfamily "$fontfamily"]
+    set sizemenu [tk_optionMenu $wi.text.format.fontsize fontsize "$fontsize"]
+
+
+    # color selection 
+    if { $color == "" } {
+	set color $defTextColor
+    }
+    button $wi.text.format.fg -text "Text color" -command \
+	"popupColor fg $wi.text.lab.name false"
+    checkbutton $wi.text.format.bold -text "Bold" -variable textBold \
+	-command [list fontupdate $wi.text.lab.name bold]
+    checkbutton $wi.text.format.italic -text "Italic" -variable textItalic \
+	-command [list fontupdate $wi.text.lab.name italic]
+    checkbutton $wi.text.format.underline -text "Underline" \
+	-variable textUnderline \
+	-command [list fontupdate $wi.text.lab.name underline]
+
+    if {$textBold == 1} {	$wi.text.format.bold select
+    } else {			$wi.text.format.bold deselect }
+    if {$textItalic == 1} {	$wi.text.format.italic select
+    } else {			$wi.text.format.italic deselect }
+    if {$textUnderline == 1} {	$wi.text.format.underline select
+    } else {			$wi.text.format.underline deselect }
+
+    pack $wi.text.format.fontmenu \
+	$wi.text.format.fontsize \
+	$wi.text.format.fg \
+	$wi.text.format.bold \
+	$wi.text.format.italic \
+	$wi.text.format.underline \
+	-side left -pady 2
+
+    pack $wi.text.format -side top -fill x
+
+    pack $wi.text -side top -fill x
+
+    fontupdate $wi.text.lab.name fontfamily $fontfamily
+    fontupdate $wi.text.lab.name fontsize $fontsize
+
+    $fontmenu delete 0
+    foreach f [lsort -dictionary [font families]] {
+	$fontmenu add radiobutton -value "$f" -label $f \
+	    -variable fontfamily \
+	    -command [list fontupdate $wi.text.lab.name fontfamily $f]
+    }
+ 
+    $sizemenu delete 0
+    foreach f {8 9 10 11 12 14 16 18 20 22 24 26 28 36 48 72} {
+	$sizemenu add radiobutton -value "$f" -label $f \
+	    -variable fontsize \
+	    -command [list fontupdate $wi.text.lab.name fontsize $f]
+    }
+ 
+if { "$annotationType" == "rectangle" || "$annotationType" == "oval" } {
+
+    # fill color, border color
+    frame $wi.colors -relief groove -bd 2
+    # color selection controls
+    label $wi.colors.label -text "Fill color:"
+
+    label $wi.colors.color -text $color -width 8 \
+	-bg $color -fg $lcolor
+    button $wi.colors.bg -text "Color" -command \
+	"popupColor bg $wi.colors.color true"
+    pack $wi.colors.label $wi.colors.color $wi.colors.bg \
+	-side left -padx 2 -pady 2 -anchor w -fill x
+    pack $wi.colors -side top -fill x
+
+    # border selection controls
+    frame $wi.border -relief groove -bd 2
+    label $wi.border.label -text "Border color:"
+    label $wi.border.color -text $bordercolor -width 8 \
+	-bg $color -fg $bordercolor
+    label $wi.border.width_label -text "Border width:"
+    set widthMenu [tk_optionMenu $wi.border.width width "$width"]
+    $widthMenu delete 0
+    foreach f {0 1 2 3 4 5 6 7 8 9 10} {
+	$widthMenu add radiobutton -value $f -label $f \
+	    -variable width
+    }
+    button $wi.border.fg -text "Color" -command \
+	"popupColor fg $wi.border.color true"
+    pack $wi.border.label $wi.border.color $wi.border.fg \
+	$wi.border.width_label $wi.border.width \
+	$wi.border.fg $wi.border.color $wi.border.label \
+	-side left -padx 2 -pady 2 -anchor w -fill x
+    pack $wi.border -side top -fill x
+
+}
+
+if { $annotationType == "rectangle" } {
+    frame $wi.radius -relief groove -bd 2
+    scale $wi.radius.rad -from 0 -to [expr int($maxrad)] \
+	-length 400 -variable rad \
+	-orient horizontal -label "Radius of the bend at the corners: " \
+	-tickinterval [expr int($maxrad / 15) + 1] -showvalue true
+    pack $wi.radius.rad -side left -padx 2 -pady 2 -anchor w -fill x
+    pack $wi.radius -side top -fill x
+}
+
+    # Add new oval or modify old one?
+    if { $modify == "true"  } {
+	set cancelcmd "destroy $wi"
+	set applytext "Modify $annotationType"
+    } else {
+	set cancelcmd "destroy $wi; destroyNewRect $c"
+	set applytext "Add $annotationType"
+    }
+    
+    frame $wi.butt -borderwidth 6
+    button $wi.butt.apply -text $applytext -command "popupAnnotationApply $c $wi $target $annotationType"
+
+    button $wi.butt.cancel -text "Cancel" -command $cancelcmd
+    bind $wi <Key-Escape> "$cancelcmd" 
+    bind $wi <Key-Return> "popupAnnotationApply $c $wi $target $annotationType"
+    pack $wi.butt.cancel $wi.butt.apply -side right
+    pack $wi.butt -side bottom
+
+    after 100 {
+	grab .popup
+    }
+    return
+}
+
+# helper for popupOvalDialog and popupOvalApply
+proc destroyNewRect { c } {
+    global newrect
+    $c delete -withtags newrect
+    set newrect ""
+}
+
+
+proc popupAnnotationApply { c wi target type } {
+    global newrect newoval annotation_list
+    global $target
+    global changed
+    global width rad
+    global fontfamily fontsize textBold textItalic textUnderline
+
+    # attributes
+    set caption [string trim [$wi.text.lab.name get]]
+    set labelcolor [$wi.text.lab.name cget -fg]
+    set coords [$c coords "$target"]
+    set iconcoords "iconcoords"
+
+    if {"$type" == "rectangle" || "$type" == "oval" } {
+	set color [$wi.colors.color cget -text]
+	set bordercolor [$wi.border.color cget -text]
+    }
+
+    if { $target == 0 } {
+	# Create a new annotation object
+	set target [newObjectId annotation]
+	global $target
+	lappend annotation_list $target
+	if {"$type" == "rectangle" } {
+	    set coords [$c coords $newrect]
+        } elseif { "$type" == "oval" } {
+	    set coords [$c coords $newoval]
+	}
+    } else {
+	set coords [getNodeCoords $target]
+    }
+    set $target {}
+    lappend $iconcoords $coords
+    lappend $target $iconcoords "label {$caption}" "labelcolor $labelcolor" \
+	"fontfamily {$fontfamily}" "fontsize $fontsize"
+    if {"$type" == "rectangle" || "$type" == "oval" } {
+	lappend $target "color $color" "width $width" "border $bordercolor" 
+    }
+    if {"$type" == "rectangle" } {
+	lappend $target "rad $rad"
+    }
+
+    set ef {}
+    if {"$textBold" == 1}   { lappend ef bold} 
+    if {"$textItalic" == 1} { lappend ef italic} 
+    if {"$textUnderline" == 1}   { lappend ef underline} 
+    if {"$ef" != ""} { lappend $target "effects {$ef}"}
+
+    # draw it
+    if { $type == "rectangle" } {
+        drawRect $target
+        destroyNewRect $c
+    } elseif { $type == "oval" } {
+        drawOval $target
+        destroyNewoval $c
+    } elseif { $type == "text" } {
+        drawText $target
+    }
+
+    set changed 1
+    updateUndoLog
+    redrawAll
+    destroy $wi 
+}
+
+proc selectmarkEnter {c x y} {
+    set obj [lindex [$c gettags current] 1]
+    set type [nodeType $obj]
+
+    if {$type != "oval" && $type != "rectangle"} { return }
+
+    set bbox [$c bbox $obj]
+    set x1 [lindex $bbox 0]
+    set y1 [lindex $bbox 1]
+    set x2 [lindex $bbox 2]
+    set y2 [lindex $bbox 3]
+    set l 0 ;# left
+    set r 0 ;# right
+    set u 0 ;# up
+    set d 0 ;# down
+
+    set x [$c canvasx $x]
+    set y [$c canvasy $y]
+
+    if { $x < [expr $x1+($x2-$x1)/8.0]} { set l 1 }
+    if { $x > [expr $x2-($x2-$x1)/8.0]} { set r 1 }
+    if { $y < [expr $y1+($y2-$y1)/8.0]} { set u 1 }
+    if { $y > [expr $y2-($y2-$y1)/8.0]} { set d 1 }
+
+    if {$l==1} {
+	if {$u==1} { 
+	    $c config -cursor top_left_corner
+	} elseif {$d==1} { 
+	    $c config -cursor bottom_left_corner
+	} else { 
+	    $c config -cursor left_side
+	} 
+    } elseif {$r==1} {
+	if {$u==1} { 
+	    $c config -cursor top_right_corner
+	} elseif {$d==1} { 
+	    $c config -cursor bottom_right_corner
+	} else { 
+	    $c config -cursor right_side
+	} 
+    } elseif {$u==1} { 
+	$c config -cursor top_side
+    } elseif {$d==1} {
+	$c config -cursor bottom_side
+    } else {
+	$c config -cursor left_ptr
+    }
+}
+
+proc selectmarkLeave {c x y} {
+    .bottom.textbox config -text {}
+    $c config -cursor left_ptr
+}
+
+
+proc textEnter { c x y } {
+    global annotation_list
+    global curcanvas
+
+    set object [newObjectId annotation]
+    set newtext [$c create text $x $y -text "" \
+	-anchor w -justify left -tags "text $object annotation"]
+
+    set coords [$c coords "text && $object"]
+    set iconcoords "iconcoords"
+
+    global $object
+    set $object {}
+    setType $object "text"
+    lappend $iconcoords $coords
+    lappend $object $iconcoords
+    lappend $object "label {}"
+    setNodeCanvas $object $curcanvas
+
+    lappend annotation_list $object
+    popupAnnotationDialog $c $object "false"
+}
+
+
+proc drawText {text} {
+    global $text defTextColor defTextFont defTextFontFamily defTextFontSize
+    global zoom curcanvas newfontsize
+
+    set coords [getNodeCoords $text]
+    if { [llength $coords] < 2 } {
+	puts "Bad coordinates for text $text"
+    	return
+    }
+    set x [expr {[lindex $coords 0] * $zoom}]
+    set y [expr {[lindex $coords 1] * $zoom}]
+    set color [lindex [lsearch -inline [set $text] "labelcolor *"] 1]
+    if { $color == "" } {
+	set color $defTextColor
+    }
+    set label [lindex [lsearch -inline [set $text] "label *"] 1]
+    set fontfamily [lindex [lsearch -inline [set $text] "fontfamily *"] 1]
+    set fontsize [lindex [lsearch -inline [set $text] "fontsize *"] 1]
+    if { $fontfamily == "" } {
+	set fontfamily $defTextFontFamily
+    }
+    if { $fontsize == "" } {
+	set fontsize $defTextFontSize
+    }
+    set newfontsize $fontsize
+    set font [list "$fontfamily" $fontsize]
+    set effects [lindex [lsearch -inline [set $text] "effects *"] 1]
+    set newtext [.c create text $x $y -text $label -anchor w \
+	-font "$font $effects" -justify left -fill $color \
+	-tags "text $text annotation"]
+
+    .c addtag text withtag $newtext
+    .c raise $text background
+    setNodeCanvas $text $curcanvas
+    setType $text "text"
+}
+
+
+proc fontupdate { label type args} {
+    global fontfamily fontsize
+    global textBold textItalic textUnderline
+
+    if {"$textBold" == 1} {set bold "bold"} else {set bold {} }
+    if {"$textItalic"} {set italic "italic"} else {set italic {} }
+    if {"$textUnderline"} {set underline "underline"} else {set underline {} }
+    switch $type {
+	fontsize {
+	    set fontsize $args
+	}
+	fontfamily {
+	    set fontfamily "$args"
+	}
+    }
+    set f [list "$fontfamily" $fontsize]
+    lappend f "$bold $italic $underline"
+    $label configure -font "$f"
+}
+
+
+proc drawAnnotation { obj } {
+    switch -exact -- [nodeType $obj] {
+	oval {
+	    drawOval $obj
+	}
+	rectangle {
+	    drawRect $obj
+	}
+	text {
+	    drawText $obj
+	}
+    }
+}
+
+#
+# CORE API
+# Copyright 2005-2012 the Boeing Company.
+# See the LICENSE file included in this distribution.
+#
+# author:	Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
+#
+
+# version of the API document that is used
+set CORE_API_VERSION 1.18
+
+set DEFAULT_API_PORT 4038
+set g_api_exec_num 100; # starting execution number
+
+# set scale for X/Y coordinate translation
+set XSCALE 1.0
+set YSCALE 1.0
+set XOFFSET 0
+set YOFFSET 0
+
+# current session; 0 is a new session
+set g_current_session 0
+
+# this is an array of lists, with one array entry for each widget or callback,
+# and the entry is a list of execution numbers (for matching replies with
+# requests)
+array set g_execRequests { shell "" observer "" }
+
+# for a simulator, uncomment this line or cut/paste into debugger:
+#  set XSCALE 4.0; set YSCALE 4.0; set XOFFSET 1800; set YOFFSET 300
+
+array set nodetypes { 	0 def 1 phys 2 xen 3 tbd 4 lanswitch 5 hub \
+			6 wlan 7 rj45 8 tunnel 9 ktunnel 10 emane }
+
+array set regtypes { wl 1 mob 2 util 3 exec 4 gui 5 emul 6 }
+array set regntypes { 1 wl 2 mob 3 util 4 exec 5 gui 6 emul }
+array set regtxttypes { wl "Wireless Module" mob "Mobility Module"	\
+			util "Utility Module" exec "Execution Server" 	\
+			gui "Graphical User Interface" emul "Emulation Server" \
+}
+set DEFAULT_GUI_REG "gui core_2d_gui"
+array set eventtypes {	definition_state 1 configuration_state 2 \
+			instantiation_state 3 runtime_state 4 \
+			datacollect_state 5 shutdown_state 6 \
+			event_start 7 event_stop 8 event_pause 9 \
+		        event_restart 10 file_open 11 file_save 12 }
+
+set CORE_STATES \
+    "NONE DEFINITION CONFIGURATION INSTANTIATION RUNTIME DATACOLLECT SHUTDOWN"
+
+set EXCEPTION_LEVELS \
+    "NONE FATAL ERROR WARNING NOTICE"
+
+# Event handler invoked for each message received by peer
+proc receiveMessage { channel } {
+    global curcanvas showAPI
+    set prmsg $showAPI
+    set type 0
+    set flags 0
+    set len 0
+    set seq 0
+
+    #puts "API receive data."
+    # disable the fileevent here, then reinstall the handler at the end
+    fileevent $channel readable ""
+    # channel closed
+    if { [eof $channel] } {
+	resetChannel channel 1
+	return
+    }
+
+    #
+    # read first four bytes of message header
+    set more_data 1
+    while { $more_data == 1 } {
+	set bytes [read $channel 4]
+	if { [fblocked $channel]  == 1} {
+	    # 4 bytes not available yet
+	    break;
+	} elseif { [eof $channel] } {
+	    resetChannel channel 1
+	    break;
+	} elseif { [string bytelength $bytes] == 0 } {
+	    # zero bytes read - parseMessageHeader would fail
+	    break;
+	}
+	# parse type/flags/length
+            if { [parseMessageHeader $bytes type flags len] < 0 } {
+	    # Message header error
+	    break;
+	}
+	# read message data of specified length
+	set bytes [read $channel $len]
+	#if { $prmsg== 1} {
+	#  puts "read $len bytes (type=$type, flags=$flags, len=$len)..."
+	#}
+	# handle each message type
+	switch -exact -- "$type" {
+	    1 { parseNodeMessage $bytes $len $flags }
+	    2 { parseLinkMessage $bytes $len $flags }
+	    3 { parseExecMessage $bytes $len $flags $channel }
+	    4 { parseRegMessage $bytes $len $flags $channel }
+	    5 { parseConfMessage $bytes $len $flags $channel }
+	    6 { parseFileMessage $bytes $len $flags $channel }
+	    8 { parseEventMessage $bytes $len $flags $channel }
+	    9 { parseSessionMessage $bytes $len $flags $channel }
+	    10 { parseExceptionMessage $bytes $len $flags $channel;
+	    #7 { parseIfaceMessage $bytes $len $flags $channel }
+		#
+	      }
+	    default { puts "Unknown Message = $type" }
+	}
+	# end switch
+    }
+    # end while
+
+    # update the canvas
+    catch {
+    # this messes up widgets
+    #raiseAll .c
+    .c config -cursor left_ptr ;# otherwise we have hourglass/pirate
+    update
+    }
+
+    if {$channel != -1 } {
+        resetChannel channel 0
+    }
+}
+
+#
+# Open an API socket to the specified server:port, prompt user for retry
+# if specified; set the readable file event and parameters; 
+# returns the channel name or -1 on error.
+#
+proc openAPIChannel { server port retry } {
+    # use default values (localhost:4038) when none specified
+    if { $server == "" || $server == 0 } {
+	set server "localhost"
+    }
+    if { $port == 0 } {
+	global DEFAULT_API_PORT
+	set port $DEFAULT_API_PORT
+    }
+
+    # loop when retry is true
+    set s -1
+    while { $s < 0 } {
+	# TODO: fix this to remove lengthy timeout periods...
+	#       (need to convert all channel I/O to use async channel)
+	#       vwait doesn't work here, blocks on socket call
+	#puts "Connecting to $server:$port..."; # verbose
+	set svcstart [getServiceStartString]
+	set e "Couldn't connect to CORE daemon at $server:$port!\n"
+	set e "$e\nHave you started the CORE daemon with"
+	set e "$e '$svcstart'?"
+	if { [catch {set s [socket $server $port]} ex] } {
+	    puts "\n$e\n  (Error: $ex)"
+	    set s -1
+	    if { ! $retry } { return $s; }; # error, don't retry
+	}
+	if { $s > 0 } {	puts "connected." }; # verbose
+	if { $retry } {; # prompt user with retry dialog
+	    if { $s < 0 } {
+	        set choice [tk_messageBox -icon error -type retrycancel \
+			    -title "Error" -message $e]
+	        if { $choice == "cancel" } { return $s }
+	    }
+	}
+    }; # end while
+
+    # now we have a valid socket, set up encoding and receive event
+    fconfigure $s -blocking 0 -encoding binary -translation { binary binary } \
+		   -buffering full -buffersize 4096 
+    fileevent $s readable [list receiveMessage $s]
+    return $s
+}
+
+#
+# Reinstall the receiveMessage event handler
+#
+proc resetChannel { channel_ptr close } {
+    upvar 1 $channel_ptr channel
+    if {$close == 1} {
+	close $channel
+	pluginChannelClosed $channel
+	set $channel -1
+    }
+    if { [catch { fileevent $channel readable \
+		[list receiveMessage $channel] } ] } {
+	# may print error here
+    }
+}
+
+#
+# Catch errors when flushing sockets
+#
+proc flushChannel { channel_ptr msg } {
+    upvar 1 $channel_ptr channel
+    if { [catch { flush $channel } err] } {
+	puts "*** $msg: $err"
+	set channel -1
+	return -1
+    }
+   return 0
+}
+
+
+#
+# CORE message header
+#
+proc parseMessageHeader { bytes type flags len } {
+    # variables are passed by reference
+    upvar 1 $type mytype
+    upvar 1 $flags myflags
+    upvar 1 $len mylen
+
+    #
+    # read the four-byte message header
+    #
+    if { [binary scan $bytes ccS mytype myflags mylen] != 3 } {
+	puts "*** warning: message header error"
+	return -1
+    } else {
+	set mytype [expr {$mytype & 0xFF}]; # convert signed to unsigned
+	set myflags [expr {$myflags & 0xFF}]
+	if { $mylen == 0 } {
+	    puts "*** warning: zero length message header!"
+	    # empty the channel
+	    #set bytes [read $channel]
+	    return -1
+	}
+    }
+    return 0
+}
+
+
+#
+# CORE API Node message TLVs
+#
+proc parseNodeMessage { data len flags } {
+    global node_list curcanvas c router eid showAPI nodetypes LIBDIR
+    global XSCALE YSCALE XOFFSET YOFFSET deployCfgAPI_lock
+    #puts "Parsing node message of length=$len, flags=$flags"
+    set prmsg $showAPI
+    set current 0
+
+    array set typenames { 1 num 2 type 3 name 4 ipv4_addr 5 mac_addr \
+			6 ipv6_addr 7 model 8 emulsrv 32 xpos 33 ypos 34 canv \
+			35 emuid 36 netid 48 lat 49 long 50 alt \
+			66 icon 80 opaque }
+    array set typesizes { num 4 type 4 name -1 ipv4_addr 4 ipv6_addr 16 \
+			mac_addr 8 model -1 emulsrv -1 \
+			xpos 2 ypos 2 canv 2 emuid 4 \
+			netid 4 lat 4 long 4 alt 4 \
+			icon -1 opaque -1 }
+    array set vals { 	num 0 type 0 name "" ipv4_addr -1 ipv6_addr -1 \
+			mac_addr -1 model "" emulsrv "" xpos 0 ypos 0 canv "" \
+			emuid -1 netid -1 \
+			lat 0 long 0 alt 0 \
+			icon "" opaque "" }
+
+    if { $prmsg==1 } { puts -nonewline "NODE(flags=$flags," }
+
+    #
+    # TLV parsing
+    #
+    while { $current < $len } {
+	# TLV header
+	if { [binary scan $data @${current}cc type length] != 2 } {
+	    puts "TLV header error"
+	    break
+	}
+	set length [expr {$length & 0xFF}]; # convert signed to unsigned
+	if { $length == 0 } {; # prevent endless looping
+	    if { $type == 0 } { puts -nonewline "(extra padding)"; break
+	    } else { puts "Found zero-length TLV for type=$type, dropping.";
+	        break }
+	}
+	set pad [pad_32bit $length]
+	# verbose debugging
+	#puts "tlv type=$type length=$length pad=$pad current=$current"
+	incr current 2
+	
+	if {![info exists typenames($type)] } { ;# unknown TLV type
+	    if { $prmsg } { puts -nonewline "unknown=$type," }
+	    incr current $length
+	    continue
+	}
+	set typename $typenames($type)
+	set size $typesizes($typename)
+	# 32-bit and 64-bit vals pre-padded
+	if { $size == 4 || $size == 8 } { incr current $pad }
+	# read TLV data depending on size
+	switch -exact -- "$size" {
+	2 { binary scan $data @${current}S vals($typename) }
+	4 { binary scan $data @${current}I vals($typename) }
+	8 { binary scan $data @${current}W vals($typename) }
+	16 { binary scan $data @${current}c16 vals($typename) }
+	-1 { binary scan $data @${current}a${length} vals($typename) }
+	}
+	if { $size == -1 } { incr current $pad } ;# string vals post-padded
+	if { $type == 6 } { incr current $pad } ;# 128-bit vals post-padded
+	incr current $length
+	# special handling of data here
+	switch -exact -- "$typename" {
+	ipv4_addr { array set vals [list $typename \
+		[ipv4ToString $vals($typename)] ] }
+	mac_addr { array set vals [list $typename \
+		[macToString $vals($typename)] ] }
+	ipv6_addr { array set vals [list $typename \
+		[ipv6ToString $vals($typename)] ] }
+	xpos { array set vals [list $typename  \
+			[expr { ($vals($typename) * $XSCALE) - $XOFFSET }] ] }
+	ypos { array set vals [list $typename \
+			[expr { ($vals($typename) * $YSCALE) - $YOFFSET }] ] }
+	}
+	if { $prmsg } { puts -nonewline "$typename=$vals($typename)," }
+    }
+
+    if { $prmsg } { puts ") "}
+
+    #
+    # Execution
+    #
+    # TODO: enforce message parameters here
+    if { ![info exists nodetypes($vals(type))] } {
+	puts "NODE: invalid node type ($vals(type)), dropping"; return
+    }
+    set node "n$vals(num)"
+    set node_id "$eid\_$node"
+    if { $vals(name) == "" } {; # make sure there is a node name
+	array set vals [list name $node] 
+    }
+    if { [lsearch $node_list $node] != -1 } {; # check for node existance
+	if { $flags == 1 } {
+	puts "Node add msg but node ($node) already exists, dropping."
+	return
+	}
+    } elseif { $flags != 1 } {
+	puts -nonewline "Node modify/delete message but node ($node) does "
+	puts "not exist dropping."
+	return
+    }
+    if { $vals(icon) != "" } {
+	set icon $vals(icon)
+	if { [file pathtype $icon] == "relative" } {
+	    set icon "$LIBDIR/icons/normal/$icon"
+	}
+	if { ![file exists $icon ] } {
+	    puts "Node icon '$vals(icon)' does not exist."
+	    array set vals [list icon ""]
+	} else {
+	    array set vals [list icon $icon]
+	}
+    }
+    global $node
+
+    set wlans_needing_update { }
+    if { $vals(emuid) != -1 } {
+	# For Linux (FreeBSD populates ngnodeidmap in l3node.instantiate/
+	#  buildInterface when the netgraph ID is known)
+	# populate ngnodeidmap for later use with wireless; it is treated as
+	# a hex value string (without the leading "0x")
+	global ngnodeidmap
+	foreach wlan [findWlanNodes $node] {
+	if { ![info exists ngnodeidmap($eid\_$wlan)] } {
+	    set netid [string range $wlan 1 end]
+	    set emulation_type [lindex [getEmulPlugin $node] 1]
+	    # TODO: verify that this incr 1000 is for OpenVZ
+	    if { $emulation_type == "openvz" } { incr netid 1000 }
+	    set ngnodeidmap($eid\_$wlan) [format "%x" $netid]
+	}
+	if { ![info exists ngnodeidmap($eid\_$wlan-$node)] } {
+	    set ngnodeidmap($eid\_$wlan-$node) [format "%x" $vals(emuid)]
+	    lappend wlans_needing_update $wlan
+	}
+	} ;# end foreach wlan
+    }
+    # trigger range calculation on WLANs that were flagged for update
+    #  using the force flag because this is a new node
+    #  (11/21/11 disabled this due to external range calcs)
+    #if { [info exists deployCfgAPI_lock] && $deployCfgAPI_lock == 0 } {
+    #	foreach wlan $wlans_needing_update {
+    #	     updateAllRanges $wlan 1
+    #	}
+    #}
+
+    # local flags: informational message that node was added or deleted
+    if {[expr {$flags & 0x8}]} {
+	if { ![info exists c] } { return }
+	if {[expr {$flags & 0x1}] } { ;# add flag
+	    nodeHighlights $c $node on green
+	    after 3000 "nodeHighlights .c $node off green"
+	} elseif {[expr {$flags & 0x2}] } { ;# delete flag
+	    nodeHighlights $c $node on black
+	    after 3000 "nodeHighlights .c $node off black"
+	}
+	# note: we may want to save other data passed in this message here
+	#       rather than just returning...
+	return
+    }
+    # now we have all the information about this node
+    switch -exact -- "$flags" {
+	0 { apiNodeModify $node vals }
+	1 { apiNodeCreate $node vals }
+	2 { apiNodeDelete $node }
+	default { puts "NODE: unsupported flags ($flags)"; return }
+    }
+}
+
+#
+# modify a node
+#
+proc apiNodeModify { node vals_ref } {
+    global c eid
+    upvar $vals_ref vals
+    if { $vals(icon) != "" } {
+	setCustomImage $node $vals(icon)
+	.c delete withtag "node && $node"
+	.c delete withtag "nodelabel && $node"
+	drawNode .c $node
+    }
+    # move the node and its links
+    if {$vals(xpos) != 0 && $vals(ypos) != 0} {
+	moveNodeAbs $c $node $vals(xpos) $vals(ypos)
+    }
+    if { $vals(name) != "" } {
+	setNodeName $node $vals(name)
+    }
+    # TODO: handle other optional on-screen data
+    # lat, long, alt, heading, platform type, platform id
+}
+
+#
+# add a node
+#
+proc apiNodeCreate { node vals_ref } {
+    global $node nodetypes node_list curcanvas eid
+    upvar $vals_ref vals
+
+    # create GUI object
+    set nodetype $nodetypes($vals(type))
+    set nodename $vals(name)
+    if { $nodetype == "emane" } { set nodetype "wlan" } ;# special case - EMANE
+    if { $nodetype == "def" || $nodetype == "xen" } { set nodetype "router" }
+    newNode [list $nodetype $node] ;# use node number supplied from API message
+    setNodeName $node $nodename
+    setNodeCanvas $node $curcanvas
+    setNodeCoords $node "$vals(xpos) $vals(ypos)"
+    setNodeLabelCoords $node "$vals(xpos) [expr $vals(ypos) + 28]"
+    setNodeLocation $node $vals(emulsrv)
+    if { $vals(icon) != "" } {
+	setCustomImage $node $vals(icon)
+    }
+    drawNode .c $node
+
+    set model $vals(model)
+    if { $model != "" } {
+	setNodeModel $node $model
+	if { [lsearch -exact [getNodeTypeNames] $model] == -1 } {
+	    puts "warning: unknown node type '$model' in Node message!"
+	}
+    }
+
+    if { $vals(type) == 7 } { ;# RJ45 node - used later to control linking
+	netconfInsertSection $node [list model $vals(model)]
+    } elseif { $vals(type) == 10 } { ;# EMANE node
+	set section [list mobmodel coreapi ""]
+	netconfInsertSection $node $section
+        set sock [lindex [getEmulPlugin $node] 2]
+	sendConfRequestMessage $sock $node "all" 0x1 -1 ""
+    } elseif { $vals(type) == 6 } { ;# WLAN node
+	if { $vals(opaque) != "" } {
+	    # treat opaque as a list to accomodate other data
+	    set i [lsearch $vals(opaque) "range=*"]
+	    if { $i != -1 } {
+		set range [lindex $vals(opaque) $i]
+		setNodeRange $node [lindex [split $range =] 1]
+	    }
+	}
+    }
+}
+
+#
+# delete a node
+#
+proc apiNodeDelete { node } {
+# XXX remove netgraph
+#    removeNetgraphNode $node
+    removeGUINode $node
+}
+
+#
+# CORE API Link message TLVs
+#
+proc parseLinkMessage { data len flags } {
+    global router def_router_model eid
+    global link_list node_list ngnodeidmap ngnodeidrmap showAPI
+    set prmsg $showAPI
+    set current 0
+    set c .c
+    #puts "Parsing link message of length=$len, flags=$flags"
+
+    array set typenames {	1 node1num 2 node2num 3 delay 4 bw 5 per \
+			6 dup 7 jitter 8 mer 9 burst 16 mburst 32 ltype \
+			35 emuid1 36 netid 37 key \
+			48 if1num 49 if1ipv4 50 if1ipv4mask 51 if1mac \
+			52 if1ipv6 53 if1ipv6mask \