Author: derek Date: Thu Sep 7 01:14:21 2006 New Revision: 76 Added: sofaswitch/trunk/callflow/src/Makefile.in sofaswitch/trunk/callflow/src/conditional.cpp sofaswitch/trunk/callflow/src/conditional.h sofaswitch/trunk/callflow/src/endcall.cpp sofaswitch/trunk/callflow/src/endcall.h sofaswitch/trunk/callflow/src/endfor.cpp sofaswitch/trunk/callflow/src/endfor.h sofaswitch/trunk/callflow/src/endhere.cpp sofaswitch/trunk/callflow/src/endhere.h sofaswitch/trunk/callflow/src/eventer.cpp sofaswitch/trunk/callflow/src/eventer.h sofaswitch/trunk/callflow/src/joinblocks.cpp sofaswitch/trunk/callflow/src/joinblocks.h sofaswitch/trunk/callflow/src/listpoints.cpp sofaswitch/trunk/callflow/src/listpoints.h sofaswitch/trunk/callflow/src/makecall.cpp sofaswitch/trunk/callflow/src/makecall.h sofaswitch/trunk/callflow/src/python.cpp sofaswitch/trunk/callflow/src/python.h sofaswitch/trunk/callflow/src/requestnode.cpp sofaswitch/trunk/callflow/src/requestnode.h sofaswitch/trunk/callflow/src/shapeselect.cpp sofaswitch/trunk/callflow/src/shapeselect.h sofaswitch/trunk/callflow/src/startfor.cpp sofaswitch/trunk/callflow/src/startfor.h sofaswitch/trunk/callflow/src/starthere.cpp sofaswitch/trunk/callflow/src/starthere.h sofaswitch/trunk/callflow/src/timer.cpp sofaswitch/trunk/callflow/src/timer.h Modified: sofaswitch/trunk/callflow/src/Makefile.am sofaswitch/trunk/callflow/src/callflow.cpp sofaswitch/trunk/callflow/src/dnd.cpp sofaswitch/trunk/callflow/src/dnd.h sofaswitch/trunk/callflow/src/shapelist.cpp Log: Fixes. Move towards a saner compile process with a separate file for call flow. Modified: sofaswitch/trunk/callflow/src/Makefile.am ============================================================================== --- sofaswitch/trunk/callflow/src/Makefile.am (original) +++ sofaswitch/trunk/callflow/src/Makefile.am Thu Sep 7 01:14:21 2006 @@ -4,8 +4,7 @@ callflow_LDADD = $(WX_LIBS) -override CXXFLAGS = @CXXFLAGS@ -I.. - +override CXXFLAGS = @CXXFLAGS@ -I.. callflow_SOURCES = \ callflow.cpp \ Added: sofaswitch/trunk/callflow/src/Makefile.in ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/Makefile.in Thu Sep 7 01:14:21 2006 @@ -0,0 +1,494 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 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@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +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 = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = callflow$(EXEEXT) +subdir = src +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am_callflow_OBJECTS = callflow.$(OBJEXT) canvas.$(OBJEXT) \ + conditional.$(OBJEXT) dnd.$(OBJEXT) drawshape.$(OBJEXT) \ + endcall.$(OBJEXT) endfor.$(OBJEXT) endhere.$(OBJEXT) \ + eventer.$(OBJEXT) information.$(OBJEXT) joinblocks.$(OBJEXT) \ + listpoints.$(OBJEXT) makecall.$(OBJEXT) python.$(OBJEXT) \ + requestnode.$(OBJEXT) shapelist.$(OBJEXT) \ + shapeselect.$(OBJEXT) startfor.$(OBJEXT) starthere.$(OBJEXT) \ + timer.$(OBJEXT) +callflow_OBJECTS = $(am_callflow_OBJECTS) +am__DEPENDENCIES_1 = +callflow_DEPENDENCIES = $(am__DEPENDENCIES_1) +DEFAULT_INCLUDES = -I. -I$(srcdir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(callflow_SOURCES) +DIST_SOURCES = $(callflow_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +WX_CONFIG = @WX_CONFIG@ +WX_LIBS = @WX_LIBS@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +SUFFIXES = .cpp .rc +callflow_LDADD = $(WX_LIBS) +callflow_SOURCES = \ + callflow.cpp \ + canvas.cpp \ + conditional.cpp \ + dnd.cpp \ + drawshape.cpp \ + endcall.cpp \ + endfor.cpp \ + endhere.cpp \ + eventer.cpp \ + information.cpp \ + joinblocks.cpp \ + listpoints.cpp \ + makecall.cpp \ + python.cpp \ + requestnode.cpp \ + shapelist.cpp \ + shapeselect.cpp \ + startfor.cpp \ + starthere.cpp \ + timer.cpp + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .rc .lo .o .obj +$(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 \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/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 +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +callflow$(EXEEXT): $(callflow_OBJECTS) $(callflow_DEPENDENCIES) + @rm -f callflow$(EXEEXT) + $(CXXLINK) $(callflow_LDFLAGS) $(callflow_OBJECTS) $(callflow_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/callflow.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/canvas.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conditional.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dnd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drawshape.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/endcall.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/endfor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/endhere.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eventer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/information.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/joinblocks.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/listpoints.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/makecall.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/python.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/requestnode.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shapelist.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shapeselect.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/startfor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/starthere.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timer.Po@am__quote@ + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: + for dir in "$(DESTDIR)$(bindir)"; 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) + +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-binPROGRAMS clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-binPROGRAMS + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool ctags distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-binPROGRAMS install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-info-am + +override CXXFLAGS = @CXXFLAGS@ -I.. +# 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: Modified: sofaswitch/trunk/callflow/src/callflow.cpp ============================================================================== --- sofaswitch/trunk/callflow/src/callflow.cpp (original) +++ sofaswitch/trunk/callflow/src/callflow.cpp Thu Sep 7 01:14:21 2006 @@ -474,7 +474,7 @@ } if (canvas->Compile(file)) - wxMessageBox(wxString::Format("wrote compile code to %s", filedlg.GetFilename().c_str())); + SetStatusText(wxString::Format("wrote compiled code to %s", filedlg.GetFilename().c_str())); else wxMessageBox(wxString::Format("failed - could not compile code to %s", filedlg.GetFilename().c_str())); Added: sofaswitch/trunk/callflow/src/conditional.cpp ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/conditional.cpp Thu Sep 7 01:14:21 2006 @@ -0,0 +1,119 @@ +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif +#include <wx/textfile.h> +#include <wx/tokenzr.h> +#include "shapelist.h" + + +#include "conditional.h" + +///////////////////////////////////////////////////////////////////////////// +DndShapeConditional::DndShapeConditional() + : DndShape(Conditional) +{ + wxSize newSize(50, 50); + SetSize(newSize); + + relInputPoints.Add(25, 0); + relOutputPoints.Add(25, 50); + relOutputPoints.Add(50, 25); + + AdjustIoPoints(); + + displayData[displayData.size()] = + InformationSection(wxT("Test"), wxT("variable == 0")); +} + +void DndShapeConditional::Draw(wxDC& dc) +{ + DrawCompileError(dc); + dc.SetPen(*wxBLACK_PEN); + + wxPoint p1(m_rect.GetPosition()); + wxPoint pA(p1.x + 25, p1.y + 35); + wxPoint pB(p1.x + 25, p1.y + 50); + + dc.DrawLine(pA, pB); + + if (OutputPointConnected(0)) + DrawArrow(dc, pB, ArrowDown, Connected); + else + DrawArrow(dc, pB, ArrowDown, Loose); + + wxPoint pt(p1.x + 25, p1.y); + wxPoint pr(p1.x + 25, p1.y + 15); + dc.DrawLine(pt, pr); + if (InputPointConnected(0)) + DrawArrow(dc, pr, ArrowDown, Connected); + else + DrawArrow(dc, pr, ArrowDown, Loose); + + wxPoint pll(p1.x + 15, p1.y + 25); + wxPoint prr(p1.x + 35, p1.y + 25); + + dc.DrawLine(pll, pr); + dc.DrawLine(pr, prr); + dc.DrawLine(prr, pA); + dc.DrawLine(pA, pll); + + wxPoint pvr(p1.x + 50, p1.y + 25); + dc.DrawLine(pvr, prr); + DrawArrow(dc, pvr, ArrowRight, OutputPointConnected(1) ? Connected : Loose); + + wxString text("T"); + dc.SetFont(*wxITALIC_FONT); + dc.DrawText(text, m_rect.x + 10, m_rect.y + 35); + + text = "F"; + dc.DrawText(text, m_rect.x + 35, m_rect.y + 5); + + DndShape::Draw(dc); +} + +bool DndShapeConditional::WriteSystemCode(wxTextFile & file) +{ + file.AddLine(" def Conditional(self, aTuple): "); + file.AddLine(" a,b,c = aTuple"); + wxString test = wxString::Format(" if %s:", + displayData[1].data.c_str()); + file.AddLine(test); + file.AddLine(" return self.data[a][\"OutputTrue\"]"); + file.AddLine(" return self.data[a][\"OutputFalse\"]"); + file.AddLine(""); + + return true; +} + +bool DndShapeConditional::WriteThisShapeInfo(wxTextFile & file) +{ + file.AddLine(wxString::Format(" \"%s\" : { ", GetKey().c_str())); + + file.AddLine(wxString::Format(" \"Test\" : ")); + file.AddLine(wxString::Format(" \"%s\", ", displayData[1].data.c_str())); + + wxNode *outputNode = (wxNode *)GetOutputPoints().GetFirst(); + const wxString & outputLabel = ((LabelledPoint *)outputNode->GetData())->GetFullLabel(); + + file.AddLine(wxString::Format(" \"OutputTrue\" : ")); + file.AddLine(wxString::Format(" %s, ", outputLabel.c_str())); + + outputNode = outputNode->GetNext(); + const wxString & outputLabel2 = ((LabelledPoint *)outputNode->GetData())->GetFullLabel(); + file.AddLine(wxString::Format(" \"OutputFalse\" : ")); + file.AddLine(wxString::Format(" %s, ", outputLabel2.c_str())); + + file.AddLine(wxString::Format(" },")); + + return true; +} + + + Added: sofaswitch/trunk/callflow/src/conditional.h ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/conditional.h Thu Sep 7 01:14:21 2006 @@ -0,0 +1,36 @@ +#ifndef SHAPE_CONDITIONAL_H +#define SHAPE_CONDITIONAL_H + +#include "dnd.h" + + +////////////////////////////////////////////////////////////////////////////////////////////// +/**Define an if statement, or conditional shape. Store values for size, location, input & output points. + This instance has the ability to draw this shape to a specified location on the canvas */ +class DndShapeConditional : public DndShape +{ +public: + /**Construtor, Define this shape in terms of size and points etc */ + DndShapeConditional(); + + /**Destroy this shape, and log it */ + virtual ~DndShapeConditional() + { + } + + /**Draw this particular shape to the screen..*/ + virtual void Draw(wxDC& dc); + + /** Used to report the name of this particular class. */ + static wxString GetKindName() { return wxString("Conditional"); } + + /**Write the code generic to this Conditional shape */ + virtual bool WriteSystemCode(wxTextFile & file); + + /**Write the dictionary containing relevant points for this shape */ + virtual bool WriteThisShapeInfo(wxTextFile & file); +}; + + + +#endif // SHAPE_CONDITIONAL_H Modified: sofaswitch/trunk/callflow/src/dnd.cpp ============================================================================== --- sofaswitch/trunk/callflow/src/dnd.cpp (original) +++ sofaswitch/trunk/callflow/src/dnd.cpp Thu Sep 7 01:14:21 2006 @@ -463,22 +463,20 @@ DndShape * DndShape::Construct(Kind shapeRequired) { - if (shapeRequired == None) { - printf("Construction failed for build shape of None.\n"); - return NULL; - } - switch (shapeRequired) { + case None: return NULL; case StartHere: return new DndShapeStartHere(); case EndHere: return new DndShapeEndHere(); - case RequestNode: return new DndShapeRequestNode(); - case EndCall: return new DndShapeEndCall(); case StartFor: return new DndShapeStartFor(); case EndFor: return new DndShapeEndFor(); case Conditional: return new DndShapeConditional(); + case MakeCall: return new DndShapeMakeCall(); + case EndCall: return new DndShapeEndCall(); + case Select: return new DndShapeSelect(); case JoinBlocks: return new DndShapeJoinBlocks(); case Python: return new DndShapePython(); + case RequestNode: return new DndShapeRequestNode(); case Timer: return new DndShapeTimer(); case Eventer: return new DndShapeEventer(); default: Modified: sofaswitch/trunk/callflow/src/dnd.h ============================================================================== --- sofaswitch/trunk/callflow/src/dnd.h (original) +++ sofaswitch/trunk/callflow/src/dnd.h Thu Sep 7 01:14:21 2006 @@ -264,7 +264,7 @@ /* 11*/ RequestNode /**Query a supervisor for a node to use to talk on*/, /**12*/ Timer /**Initiate a timer, which runs for some specified time interval */, /**13*/ Eventer /**Mark me as registering for an event. Possibly, wait for the registered for event */, - /* 13*/ KnownShapes /**Indicates the number of known shapes we can manage */ + /* 14*/ KnownShapes /**Indicates the number of known shapes we can manage */ }; /**Constructor to a predefined shape */ Added: sofaswitch/trunk/callflow/src/endcall.cpp ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/endcall.cpp Thu Sep 7 01:14:21 2006 @@ -0,0 +1,57 @@ +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif +#include <wx/textfile.h> +#include <wx/tokenzr.h> +#include "shapelist.h" + + +#include "endcall.h" + + +///////////////////////////////////////////////////////////////////////////// +DndShapeEndCall::DndShapeEndCall() + : DndShape(EndCall) +{ + wxSize newSize(50, 50); + SetSize(newSize); + relInputPoints.Add(25, 0); + AdjustIoPoints(); +} + +void DndShapeEndCall::Draw(wxDC& dc) +{ + DrawCompileError(dc); + dc.SetPen(*wxBLACK_PEN); + + wxPoint p1(m_rect.GetPosition()); + wxPoint pA(p1.x + 25, p1.y); + wxPoint pB(p1.x + 25, p1.y + 15); + + DrawBox(dc, 0, 15, 50, 35); + dc.DrawLine(pA, pB); + if (InputPointConnected(0)) + DrawArrow(dc, pB, ArrowDown, Connected); + else + DrawArrow(dc, pB, ArrowDown, Loose); + + DndShape::Draw(dc); // Draw the selected overlay if required. +} + +bool DndShapeEndCall::WriteSystemCode(wxTextFile & file) +{ + file.AddLine(" def End_Call(self, sTuple): "); + file.AddLine(" a,b,c = sTuple"); + file.AddLine(" return self.data[a][\"Output\"]"); + file.AddLine(""); + + return true; +} + Added: sofaswitch/trunk/callflow/src/endcall.h ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/endcall.h Thu Sep 7 01:14:21 2006 @@ -0,0 +1,37 @@ +#ifndef END_CALL_H +#define END_CALL_H + +#include "dnd.h" + + + +////////////////////////////////////////////////////////////////////////////////////////////// +/**Define a end call shape. Store values for size, location, input & output points. + This instance has the ability to draw this shape to a specified location on the canvas */ +class DndShapeEndCall : public DndShape +{ +public: + /**Construtor, Define this shape in terms of size and points etc */ + DndShapeEndCall(); + + /**Destroy this shape, and log it */ + virtual ~DndShapeEndCall() + { + } + + /**Draw this particular shape to the screen..*/ + virtual void Draw(wxDC& dc); + + /** Used to report the name of this particular class. */ + static wxString GetKindName() { return wxString("End Call"); } + + /**Write the code generic to this End Call shape */ + virtual bool WriteSystemCode(wxTextFile & file); +}; + + + + + +#endif // END_CALL_H + Added: sofaswitch/trunk/callflow/src/endfor.cpp ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/endfor.cpp Thu Sep 7 01:14:21 2006 @@ -0,0 +1,94 @@ +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif +#include <wx/textfile.h> +#include <wx/tokenzr.h> +#include "shapelist.h" + + +#include "endfor.h" + + +///////////////////////////////////////////////////////////////////////////// +DndShapeEndFor::DndShapeEndFor() + : DndShape(EndFor) +{ + wxSize newSize(50, 50); + SetSize(newSize); + + relInputPoints.Add(32, 0); + relOutputPoints.Add(0, 25); + relOutputPoints.Add(32, 50); + + AdjustIoPoints(); +} + +void DndShapeEndFor::Draw(wxDC& dc) +{ + DrawCompileError(dc); + dc.SetPen(*wxBLACK_PEN); + + wxPoint tm(m_rect.x + 32, m_rect.y); + wxPoint tm1(tm.x, m_rect.y + 15); + + wxPoint lm(m_rect.x, m_rect.y + 25); + wxPoint lm1(m_rect.x + 15, lm.y); + + wxPoint bm(tm.x, m_rect.y + 35); + wxPoint bm1(tm.x, m_rect.y + 50); + + DrawBox(dc, 15, 15, 35, 20); + dc.DrawLine(tm, tm1); + dc.DrawLine(lm, lm1); + dc.DrawLine(bm, bm1); + + wxPoint ellipse(m_rect.x + 24, m_rect.y + 21); + wxSize eSize(16, 8); + dc.DrawEllipse(ellipse, eSize); + + DrawArrow(dc, tm1, ArrowDown, InputPointConnected(0) ? Connected : Loose); + DrawArrow(dc, lm, ArrowLeft, OutputPointConnected(0) ? Connected : Loose); + DrawArrow(dc, bm1, ArrowDown, OutputPointConnected(1) ? Connected : Loose); + + DndShape::Draw(dc); // Draw the selected overlay if required. +} + +bool DndShapeEndFor::WriteSystemCode(wxTextFile & file) +{ + file.AddLine(" def End_For_Loop(self, aTuple): "); + file.AddLine(" a,b,c = aTuple"); + file.AddLine(" return self.data[a][\"LoopAgain\"]"); + file.AddLine(""); + + return true; +} + +bool DndShapeEndFor::WriteThisShapeInfo(wxTextFile & file) +{ + file.AddLine(wxString::Format(" \"%s\" : { ", GetKey().c_str())); + + wxNode *outputNode = (wxNode *)GetOutputPoints().GetFirst(); + const wxString & outputLabel = ((LabelledPoint *)outputNode->GetData())->GetFullLabel(); + + file.AddLine(wxString::Format(" \"LoopAgain\" : ")); + file.AddLine(wxString::Format(" %s, ", outputLabel.c_str())); + + outputNode = outputNode->GetNext(); + const wxString & outputLabel2 = ((LabelledPoint *)outputNode->GetData())->GetFullLabel(); + file.AddLine(wxString::Format(" \"AllDone\" : ")); + file.AddLine(wxString::Format(" %s, ", outputLabel2.c_str())); + + file.AddLine(wxString::Format(" },")); + + return true; +} + + + Added: sofaswitch/trunk/callflow/src/endfor.h ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/endfor.h Thu Sep 7 01:14:21 2006 @@ -0,0 +1,38 @@ +#ifndef END_FOR_H + +#define END_FOR_H + + +#include "dnd.h" + +////////////////////////////////////////////////////////////////////// +/**Define a shape to indicate the end of a for loop. Store values for + size, location, input & output points. This instance has the + ability to draw this shape to a specified location on the canvas */ +class DndShapeEndFor : public DndShape +{ +public: + /**Construtor, Define this shape in terms of size and points etc */ + DndShapeEndFor(); + + /**Destroy this shape, and log it */ + virtual ~DndShapeEndFor() + { + } + + /**Draw this particular shape to the screen..*/ + virtual void Draw(wxDC& dc); + + /** Used to report the name of this particular class. */ + static wxString GetKindName() { return wxString("End For Loop"); } + + /**Write the code generic to this End For loop shape */ + virtual bool WriteSystemCode(wxTextFile & file); + + /**Write the dictionary containing relevant points for this shape */ + virtual bool WriteThisShapeInfo(wxTextFile & file); +}; + + +#endif + Added: sofaswitch/trunk/callflow/src/endhere.cpp ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/endhere.cpp Thu Sep 7 01:14:21 2006 @@ -0,0 +1,76 @@ +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif +#include <wx/textfile.h> +#include <wx/tokenzr.h> +#include "shapelist.h" + + +#include "endhere.h" + + + +///////////////////////////////////////////////////////////////////////////// +DndShapeEndHere::DndShapeEndHere() + : DndShape(EndHere) +{ + wxSize newSize(50, 50); + SetSize(newSize); + + relInputPoints.Add(25, 0); + AdjustIoPoints(); +} + +void DndShapeEndHere::Draw(wxDC& dc) +{ + DrawCompileError(dc); + dc.SetPen(*wxBLACK_PEN); + + wxPoint p1(m_rect.GetPosition()); + wxPoint pA(p1.x + 25, p1.y + 35); + wxPoint pB(p1.x + 25, p1.y + 0); + + DrawBox(dc, 0, 35, 50, 15); + DrawBox(dc, 0, 15, 20, 20); + DrawBox(dc, 30, 15, 20, 20); + + dc.DrawLine(pA, pB); + DrawArrow(dc, pA, ArrowDown, InputPointConnected(0) ? Connected : Loose); + + DndShape::Draw(dc); +} + +bool DndShapeEndHere::WriteSystemCode(wxTextFile & file) +{ + file.AddLine(" def End_Processing(self, sTuple): "); + file.AddLine(" self.keepGoing = False"); + file.AddLine(" a,b,c = sTuple"); + file.AddLine(" print \"end of processing at \", a "); + file.AddLine(" return (1,2,3)"); + file.AddLine(""); + + return true; +} + +bool DndShapeEndHere::WriteThisShapeInfo(wxTextFile & file) +{ + file.AddLine(wxString::Format(" \"%s\" : { ", GetKey().c_str())); + + wxNode *inputNode = (wxNode *)GetInputPoints().GetFirst(); + const wxString & inputLabel = ((LabelledPoint *)inputNode->GetData())->GetFullLabel(); + + file.AddLine(wxString::Format(" \"Input\" : ")); + file.AddLine(wxString::Format(" %s, ", inputLabel.c_str())); + + file.AddLine(wxString::Format(" },")); + + return true; +} + Added: sofaswitch/trunk/callflow/src/endhere.h ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/endhere.h Thu Sep 7 01:14:21 2006 @@ -0,0 +1,35 @@ +#ifndef END_HERE_H + +#define END_HERE_H + +#include "dnd.h" + + +////////////////////////////////////////////////////////////////////////////////////////////// +/**Define a start shape. Store values for size, location, input & output points. + This instance has the ability to draw this shape to a specified location on the canvas */ +class DndShapeEndHere : public DndShape +{ +public: + /**Construtor, Define this shape in terms of size and points etc */ + DndShapeEndHere(); + + /**Destroy this shape, and log it */ + virtual ~DndShapeEndHere() + { + } + + /**Draw this particular shape to the screen..*/ + virtual void Draw(wxDC& dc); + + /** Used to report the name of this particular class. */ + static wxString GetKindName() { return wxString("End Processing"); } + + /**Write the code generic to this EndHere shape */ + virtual bool WriteSystemCode(wxTextFile & file); + + /**Write the dictionary containing relevant points for this shape */ + virtual bool WriteThisShapeInfo(wxTextFile & file); +}; + +#endif Added: sofaswitch/trunk/callflow/src/eventer.cpp ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/eventer.cpp Thu Sep 7 01:14:21 2006 @@ -0,0 +1,116 @@ +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif +#include <wx/textfile.h> +#include <wx/tokenzr.h> +#include "shapelist.h" + + +#include "drawshape.h" + +///////////////////////////////////////////////////////////////////////////// + +DndShapeEventer::DndShapeEventer() + : DndShape(Eventer) +{ + wxSize newSize(50, 50); + SetSize(newSize); + + relInputPoints.Add(13, 0); + relOutputPoints.Add(13, 50); + relOutputPoints.Add(50, 22); + AdjustIoPoints(); + + displayData[displayData.size()] = + InformationSection(wxT("Event"), wxT("timer1")); +} + +void DndShapeEventer::Draw(wxDC& dc) +{ + DrawCompileError(dc); + dc.SetPen(*wxBLACK_PEN); + + wxPoint p1(m_rect.GetPosition()); + wxPoint pA(p1.x + 13, p1.y + 0); + wxPoint pB(p1.x + 13, p1.y + 15); + + wxPoint pC(p1.x + 13, p1.y + 35); + wxPoint pD(p1.x + 13, p1.y + 50); + dc.DrawLine(pA, pB); + dc.DrawLine(pC, pD); + + DrawBox(dc, 0, 15, 30, 15); + + wxPoint pI(p1.x + 30, p1.y + 17); + wxPoint pJ(p1.x + 35, p1.y + 22); + wxPoint pK(p1.x + 30, p1.y + 27); + wxPoint pL(p1.x + 50, p1.y + 22); + dc.DrawLine(pI, pJ); + dc.DrawLine(pJ, pK); + dc.DrawLine(pJ, pL); + + wxPoint pX(p1.x + 8, p1.y + 30); + wxPoint pY(p1.x + 13, p1.y + 35); + wxPoint pZ(p1.x + 18, p1.y + 30); + dc.DrawLine(pX, pY); + dc.DrawLine(pY, pZ); + + DrawArrow(dc, pA, ArrowDown, InputPointConnected(0) ? Connected : Loose); + DrawArrow(dc, pD, ArrowDown, OutputPointConnected(0) ? Connected : Loose); + DrawArrow(dc, pL, ArrowRight, OutputPointConnected(1) ? Connected : Loose); + + DndShape::Draw(dc); +} + +bool DndShapeEventer::WriteSystemCode(wxTextFile & file) +{ + file.AddLine(" def Eventer(self, sTuple): "); + file.AddLine(" a,b,c = sTuple"); + file.AddLine(" print \"Eventer \", a "); + file.AddLine(" return (1,2,3)"); + file.AddLine(""); + + return true; +} + +bool DndShapeEventer::WriteThisShapeInfo(wxTextFile & file) +{ + file.AddLine(wxString::Format("\"%s\" : { ", GetKey().c_str())); + + wxNode *inputNode = (wxNode *)GetInputPoints().GetFirst(); + const wxString & inputLabel = ((LabelledPoint *)inputNode->GetData())->GetFullLabel(); + + file.AddLine(wxString::Format(" \"Input\" : ")); + file.AddLine(wxString::Format(" %s, ", inputLabel.c_str())); + + wxNode *outputNode = (wxNode *)GetOutputPoints().GetFirst(); + const wxString & outputLabel = ((LabelledPoint *)outputNode->GetData())->GetFullLabel(); + + file.AddLine(wxString::Format(" \"OutputFromEvent\" : ")); + file.AddLine(wxString::Format(" %s, ", outputLabel.c_str())); + + outputNode = outputNode->GetNext(); + const wxString & outputLabel2 = ((LabelledPoint *)outputNode->GetData())->GetFullLabel(); + file.AddLine(wxString::Format(" \"OutputKeepGoing\" : ")); + file.AddLine(wxString::Format(" %s, ", outputLabel2.c_str())); + + file.AddLine(wxString::Format(" \"Event\" : ")); + file.AddLine(wxString::Format(" \"%s\", ", displayData[1].data.c_str())); + + file.AddLine(wxString::Format(" },")); + + return true; +} + +bool DndShapeEventer::CheckOutputPointsLinked() +{ + return outputPoints.PointLinked(0); +} + Added: sofaswitch/trunk/callflow/src/eventer.h ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/eventer.h Thu Sep 7 01:14:21 2006 @@ -0,0 +1,38 @@ +#ifndef SHAPE_EVENTER_H +#define SHAPE_EVENTER_H +#include "dnd.h" + + +////////////////////////////////////////////////////////////////////////////////////////////// +/**Define a event registration, and wait for event shape. Normal flow of execution enters this shape, +and an event is registered for. There is always a connection to the event detected and process output. +There is an optional outgoing connection for the "do other things while waiting" output. */ +class DndShapeEventer : public DndShape +{ +public: + /**Construtor, Define this shape in terms of size and points etc */ + DndShapeEventer(); + + /**Destroy this shape, and log it */ + virtual ~DndShapeEventer() + { + } + + /**Draw this particular shape to the screen..*/ + virtual void Draw(wxDC& dc); + + /** Used to report the name of this particular class. */ + static wxString GetKindName() { return wxString("Eventer"); } + + /**Write the code generic to this End Call shape */ + virtual bool WriteSystemCode(wxTextFile & file); + + /**Write the dictionary containing relevant points for this shape */ + virtual bool WriteThisShapeInfo(wxTextFile & file); + + /**Check that every output point of this shape goes + somewhere. Return False if there is a dangling output point */ + virtual bool CheckOutputPointsLinked(); +}; + +#endif // SHAPE_EVENTER_H Added: sofaswitch/trunk/callflow/src/joinblocks.cpp ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/joinblocks.cpp Thu Sep 7 01:14:21 2006 @@ -0,0 +1,280 @@ +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif +#include <wx/textfile.h> +#include <wx/tokenzr.h> +#include "shapelist.h" + + +#include "joinblocks.h" + + +///////////////////////////////////////////////////////////////////////////// +DndShapeJoinBlocks::DndShapeJoinBlocks() + : DndShape(JoinBlocks) +{ + SetSelected(); + ZeroPositionSize(); +} + +void DndShapeJoinBlocks::DrawSelected(wxDC & dc) +{ + dc.SetPen(*wxBLUE); + DrawShapeNow(dc); +} + +void DndShapeJoinBlocks::DrawShapeNow(wxDC & dc) +{ + wxNode *node = (wxNode *)points.GetFirst(); + if (node == NULL) + return; + + wxPoint firstPoint = *((wxPoint *)node->GetData()); + node = node->GetNext(); + while(node != NULL) { + wxPoint thisPoint = *((wxPoint *)node->GetData()); + dc.DrawLine(firstPoint, thisPoint); + firstPoint = thisPoint; + node = node->GetNext(); + } + + ioPointsLinked = false; +} + +void DndShapeJoinBlocks::Draw(wxDC & dc) +{ + if(isSelected) + DrawSelected(dc); + else { + dc.SetPen(*wxBLACK_PEN); + DrawShapeNow(dc); + } +} + + +void DndShapeJoinBlocks::AdjustPosition(wxPoint &moveSize) +{ + m_rect.Offset(moveSize); + + int minX = 1 << 30; + int minY = 1 << 30; + int maxX = 0 - minX; + int maxY = 0 - minY; + + wxNode *node = (wxNode *)points.GetFirst(); + if (node == NULL) + return; + + while (node != NULL) { + wxPoint *firstPoint = (wxPoint *)node->GetData(); + + firstPoint->x += moveSize.x; + firstPoint->y += moveSize.y; + + if (firstPoint->x < minX) + minX = firstPoint->x; + if (firstPoint->x > maxX) + maxX = firstPoint->x; + + if (firstPoint->y < minY) + minY = firstPoint->y; + if (firstPoint->y > maxY) + maxY = firstPoint->y; + + node = node->GetNext(); + } + + m_rect.SetWidth(maxX - minX); + m_rect.SetHeight(maxY - minY); +} + +void DndShapeJoinBlocks::PrintSizeInformation() +{ + return; + printf("Location:: %d %d\n %d %d xxx %d %d\n %d %d\n", + m_rect.x, m_rect.y, + m_rect.GetX(), m_rect.GetY(), m_rect.GetWidth(), m_rect.GetHeight(), + m_rect.GetWidth(), m_rect.GetHeight()); +} + +void DndShapeJoinBlocks::AddNewPoint(wxPoint & newPoint) +{ + // printf("Add new point %d %d \n", newPoint.x, newPoint.y); + if (GetCount() == 0) { + m_rect.SetX(newPoint.x); + m_rect.SetY(newPoint.y); + m_rect.SetWidth(0); + m_rect.SetHeight(0); + } else { + if (newPoint.x < m_rect.x) { + m_rect.SetWidth(m_rect.GetWidth() + (m_rect.x - newPoint.x)); + m_rect.SetX(newPoint.x); + } + + if (newPoint.y < m_rect.y) { + m_rect.SetHeight(m_rect.GetHeight() + (m_rect.y - newPoint.y)); + m_rect.SetY(newPoint.y); + } + + if (newPoint.x > (m_rect.x + m_rect.GetWidth())) { + m_rect.SetWidth(newPoint.x - m_rect.x); + } + + if (newPoint.y > (m_rect.y + m_rect.GetHeight())) { + m_rect.SetHeight(newPoint.y - m_rect.y); + } + + } + + PrintSizeInformation(); + + points.Add(newPoint); +} + +void DndShapeJoinBlocks::RemoveCurrentPoints() +{ + points.RemoveCurrentPoints(); + ZeroPositionSize(); +} + +void DndShapeJoinBlocks::SetPosition(wxPoint & newPosition) +{ + +} + +bool DndShapeJoinBlocks::GetFirstPoint(wxPoint & coord) +{ + return points.GetFirstPoint(coord); +} + +bool DndShapeJoinBlocks::GetLastPoint(wxPoint & coord) +{ + return points.GetLastPoint(coord); +} + +wxString DndShapeJoinBlocks::GetDescendantShapeInfo() +{ + wxNode *node = (wxNode *)points.GetFirst(); + if (node == NULL) + return wxString(""); + + wxString answer; + while (node != NULL) { + wxPoint onePoint = *((wxPoint *)node->GetData()); + if (answer.Length() == 0) + answer = answer + wxString::Format("%d,%d", onePoint.x, onePoint.y); + else + answer = answer + wxString::Format(",%d,%d", onePoint.x, onePoint.y); + node = node->GetNext(); + } + return answer; +} + +void DndShapeJoinBlocks::SetDescendantShapeInfo(const wxString & newValue) +{ + wxStringTokenizer bits(newValue, ",", wxTOKEN_RET_EMPTY); + + if ((bits.CountTokens() % 2) != 0) { + wxMessageBox("invalid string to process"); + printf(" %s \n", newValue.c_str()); + return; + } + + while (bits.HasMoreTokens()) { + long xpos, ypos; + if (bits.GetNextToken().ToLong(&xpos) && + bits.GetNextToken().ToLong(&ypos)) { + wxPoint newPoint(xpos, ypos); + AddNewPoint(newPoint); + } + } +} + + + +bool DndShapeJoinBlocks::Intersects(const wxRect & testRectangle) const +{ + if (DndShape::Intersects(testRectangle)) { + return true; + } else { + return false; + } +} + +bool DndShapeJoinBlocks::Intersects(const wxPoint & testPoint) const +{ + wxNode *node = (wxNode *)points.GetFirst(); + if (node == NULL) + return false; + + wxPoint firstPoint = *((wxPoint *)node->GetData()); + node = node->GetNext(); + while(node != NULL) { + wxPoint thisPoint = *((wxPoint *)node->GetData()); + + if (DistancePointToLine(testPoint, firstPoint, thisPoint) < 5) + return true; + + firstPoint = thisPoint; + node = node->GetNext(); + } + + return false; +} + +double DndShapeJoinBlocks::DistancePointToLine(const wxPoint & point, + const wxPoint & lineA, + wxPoint & lineB) const +{ + /**Calculation of distance from a point to a line was derived from + http://www.simdesign.nl/tips/tip001.html */ + + double q; + + if (lineA == lineB) + return PointToPointDist(point, lineA); + + q = ((point.x - lineA.x) * (lineB.x - lineA.x) + (point.y - lineA.y)*(lineB.y - lineA.y)); + + q = q / (sqr(lineB.x - lineA.x) + sqr(lineB.y - lineA.y)); + + if (q < 0) + q = 0; + if (q > 1) + q = 1; + + wxPoint intersection((int)((1 - q) * lineA.x + q * lineB.x), + (int)((1 - q) * lineA.y + q * lineB.y) ); + + return PointToPointDist(point, intersection); +} + +int DndShapeJoinBlocks::sqr(const int & aa) const +{ + return aa * aa; +} + +double DndShapeJoinBlocks::PointToPointDist(const wxPoint & ptA, const wxPoint & ptB) const +{ + return sqrt(sqr(ptA.x - ptB.x) + sqr(ptA.y - ptB.y)); +} + + + +bool DndShapeJoinBlocks::WriteSystemCode(wxTextFile & /*file*/) +{ + return true; +} + + +bool DndShapeJoinBlocks::WriteThisShapeInfo(wxTextFile & /*file*/) +{ + return true; +} Added: sofaswitch/trunk/callflow/src/joinblocks.h ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/joinblocks.h Thu Sep 7 01:14:21 2006 @@ -0,0 +1,108 @@ +#ifndef JOIN_BLOCKS_H +#define JOIN_BLOCKS_H +#include "dnd.h" + +#include "listpoints.h" + +/////////////////////////////////////////////////////////////////// +/**Define a shape to draw lines between individual entities. It has no + particular rectangle, except that which encompasses the whole thing + - a sort of BoundingBox type thing from postscript. This instance + has the ability to draw this shape to a specified location on the + canvas */ +class DndShapeJoinBlocks : public DndShape +{ +public: + /**Construtor, Define this shape in terms of size and points etc */ + DndShapeJoinBlocks(); + + /**Destroy this shape, and log it */ + virtual ~DndShapeJoinBlocks() + { + } + + /**Draw this particular shape (which is a collection of joined + lines) to the screen..*/ + virtual void Draw(wxDC& dc); + + /**Draw this shape (which is a collection of joined lines) in a + selected fashion to the screen. */ + virtual void DrawSelected(wxDC &dc); + + /** Used to report the name of this particular class. */ + static wxString GetKindName() { return wxString("Join blocks shape"); } + + /**Mark this shape as having a top left postion as determined by the parameter */ + virtual void SetPosition(wxPoint & newPosition); + + /**Modify the location of this shape by the specified delta. This is used when + the user is dragging this selecting region across the screen */ + virtual void AdjustPosition(wxPoint &moveSize); + + /**Report the information needed by some special shapes for internal used */ + virtual wxString GetDescendantShapeInfo(); + + /**Set the special info which is relevant to the particular shape being represented */ + virtual void SetDescendantShapeInfo(const wxString & newValue); + + /**Append one new point to the this join blocks shape */ + void AddNewPoint(wxPoint & newPoint); + + /**Remove all data from this shape, and zero variables */ + void RemoveCurrentPoints(); + + /**Report the number of data points in this structure right now */ + int GetCount() { return points.GetCount(); } + + /**Report the first coordinate entered in this structure. If it is + empty, return false. */ + bool GetFirstPoint(wxPoint & coord); + + /**Report the last coordinate entered in this structure. If it is + empty, return false. */ + bool GetLastPoint(wxPoint & coord); + + /**Return TRUE if any part of this shape is inside the supplied + rectangle */ + virtual bool Intersects(const wxRect & testRectangle) const; + + /**Return TRUE if the specified point is inside this particular shape */ + virtual bool Intersects(const wxPoint & testPoint) const; + + /**Write the code generic to this shape */ + virtual bool WriteSystemCode(wxTextFile & file); + + /**Write the dictionary containing relevant points for this shape */ + virtual bool WriteThisShapeInfo(wxTextFile & file); + + + protected: + /**This has been put in for debugging, and prints the size of the + region surrounding this join blocks shape */ + void PrintSizeInformation(); + + /**Actually render this shape now to the drawing context. It is + expected that the user will have set the desired pen colour etc + before calling this method */ + void DrawShapeNow(wxDC & dc); + + /**Report the distance between the test point and the line.which joins the endpoints of the line */ + double DistancePointToLine(const wxPoint & point, const wxPoint & lineA, wxPoint & lineB) const; + + /**Calculate the value of the argument squared */ + int sqr(const int & aa) const; + + /**The distance between the two points, calculated by determining + the length of the hypotenuse - square the x&y deltas, sum these + squares, and do a square root */ + double PointToPointDist(const wxPoint & ptA, const wxPoint & ptB) const; + + /**The location of all points in this shape. These points are + placed in this table in the same coordinate system as the m_rect + variable. Note that the m_rect variable is the location of the + top left corner of the boundingbox for this shape */ + ListWxPoints points; +}; + + +#endif // JOIN_BLOCKS_H Added: sofaswitch/trunk/callflow/src/listpoints.cpp ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/listpoints.cpp Thu Sep 7 01:14:21 2006 @@ -0,0 +1,54 @@ +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + + +#include "listpoints.h" + +#include <wx/listimpl.cpp> +WX_DEFINE_LIST(AListWxPoints); + + + + +///////////////////////////////////////////////////////////////////////////// + +void ListWxPoints::RemoveCurrentPoints() +{ + DeleteContents(true); + + Clear(); +} + +bool ListWxPoints::GetFirstPoint(wxPoint & point) +{ + if (GetCount() == 0) + return false; + + wxNode *node = (wxNode *)GetFirst(); + point = *((wxPoint *)node->GetData()); + return true; +} + +bool ListWxPoints::GetLastPoint(wxPoint & point) +{ + if (GetCount() == 0) + return false; + + wxNode *node = (wxNode *)GetLast(); + point = *((wxPoint *)node->GetData()); + return true; +} + +void ListWxPoints::Add (wxPoint & newData) +{ + wxPoint *newPoint = new wxPoint(newData); + Append(newPoint); +} Added: sofaswitch/trunk/callflow/src/listpoints.h ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/listpoints.h Thu Sep 7 01:14:21 2006 @@ -0,0 +1,39 @@ +#ifndef LIST_POINTS_H + +#define LIST_POINTS_H + +#include <wx/list.h> + + +WX_DECLARE_LIST(wxPoint, AListWxPoints); + +///////////////////////////////////////////////////////////////////////////// +/**A simple list of wxPoints. No additional fields are required, just the points themselves. + Add in some simple methods to ease access to data etc */ +class ListWxPoints : public AListWxPoints +{ + public: + /**Constructor - provided to do any initialisation */ + ListWxPoints() { } + + /**Destructor - this ensures the list is empty at the end */ + ~ListWxPoints() { RemoveCurrentPoints(); } + + /**Remove all the points in this list, and the associated data */ + void RemoveCurrentPoints(); + + /**Return the first point in this list. Returns false if no + available point.. Returns true if the list contains 1 or more + points. */ + bool GetFirstPoint(wxPoint & point); + + /**Return the last point in this list. Returns false if no available + point..Returns true if the list contains 1 or more points. */ + bool GetLastPoint(wxPoint & point); + + /**Add a new point to this list */ + void Add (wxPoint & newData); +}; + + +#endif //LIST_POINTS_H Added: sofaswitch/trunk/callflow/src/makecall.cpp ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/makecall.cpp Thu Sep 7 01:14:21 2006 @@ -0,0 +1,69 @@ +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif +#include <wx/textfile.h> +#include <wx/tokenzr.h> +#include "shapelist.h" + + +#include "makecall.h" + + +///////////////////////////////////////////////////////////////////////////// +DndShapeMakeCall::DndShapeMakeCall() + : DndShape(MakeCall) +{ + wxSize newSize(50, 50); + SetSize(newSize); + + relInputPoints.Add(25, 0); + relOutputPoints.Add(25, 50); + AdjustIoPoints(); +} + +bool DndShapeMakeCall::WriteSystemCode(wxTextFile & file) +{ + file.AddLine(" def Make_Call(self, sTuple): "); + file.AddLine(" a,b,c = sTuple"); + file.AddLine(" return self.data[a][\"Output\"]"); + file.AddLine(""); + + return true; +} + + +void DndShapeMakeCall::Draw(wxDC& dc) +{ + DrawCompileError(dc); + dc.SetPen(*wxBLACK_PEN); + + wxPoint p1(m_rect.GetPosition()); + wxPoint pA(p1.x + 25, p1.y); + wxPoint pB(p1.x + 25, p1.y + 15); + + wxPoint pY(p1.x + 25, p1.y + 35); + wxPoint pZ(p1.x + 25, p1.y + 50); + + DrawBox(dc, 0, 15, 50, 20); + dc.DrawLine(pA, pB); + if (InputPointConnected(0)) + DrawArrow(dc, pB, ArrowDown, Connected); + else + DrawArrow(dc, pB, ArrowDown, Loose); + + dc.DrawLine(pY, pZ); + if (OutputPointConnected(0)) + DrawArrow(dc, pZ, ArrowDown, Connected); + else + DrawArrow(dc, pZ, ArrowDown, Loose); + + DndShape::Draw(dc); // Draw the selected overlay if required. +} + Added: sofaswitch/trunk/callflow/src/makecall.h ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/makecall.h Thu Sep 7 01:14:21 2006 @@ -0,0 +1,31 @@ +#ifndef MAKE_CALL_H +#define MAKE_CALL_H + +#include "dnd.h" + +////////////////////////////////////////////////////////////////////////////////////////////// +/**Define a create a call shape. Store values for size, location, input & output points. + This instance has the ability to draw this shape to a specified location on the canvas */ +class DndShapeMakeCall : public DndShape +{ +public: + /**Construtor, Define this shape in terms of size and points etc */ + DndShapeMakeCall(); + + /**Destroy this shape, and log it */ + virtual ~DndShapeMakeCall() + { + } + + /**Draw this particular shape to the screen..*/ + virtual void Draw(wxDC& dc); + + /**Write the code generic to this Make Call shape */ + virtual bool WriteSystemCode(wxTextFile & file); + + /** Used to report the name of this particular class. */ + static wxString GetKindName() { return wxString("Make Call"); } +}; + + +#endif // MAKE_CALL_H Added: sofaswitch/trunk/callflow/src/python.cpp ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/python.cpp Thu Sep 7 01:14:21 2006 @@ -0,0 +1,104 @@ +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif +#include <wx/textfile.h> +#include <wx/tokenzr.h> +#include "shapelist.h" + + +#include "python.h" + + +///////////////////////////////////////////////////////////////////////////// +DndShapePython::DndShapePython() + : DndShape(Python) +{ + wxSize newSize(50, 50); + SetSize(newSize); + + relInputPoints.Add(25, 0); + relOutputPoints.Add(25, 50); + + displayData[displayData.size()] = + InformationSection(wxT("Python Code"), wxT("self.i = 0")); + + AdjustIoPoints(); +} + +void DndShapePython::Draw(wxDC& dc) +{ + DrawCompileError(dc); + dc.SetPen(*wxBLACK_PEN); + + wxPoint p1(m_rect.GetPosition()); + wxPoint pA(p1.x + 25, p1.y + 15); + wxPoint pB(p1.x + 25, p1.y + 0); + wxPoint pC(p1.x + 25, p1.y + 50); + + DrawArrow(dc, pA, ArrowDown, InputPointConnected(0) ? Connected : Loose); + DrawArrow(dc, pC, ArrowDown, OutputPointConnected(0) ? Connected : Loose); + dc.DrawLine(pC, pB); + + DrawBox(dc, 0, 10, 21, 21); + DrawBox(dc, 29, 10, 21, 21); + + wxString text("Pyt"); + dc.SetFont(*wxITALIC_FONT); + wxCoord w, h; + dc.GetTextExtent(text, &w, &h); + int xPos = m_rect.x + 0 + ((21 - w)/2); + int yPos = m_rect.y + 10 + ((21 - h)/2); + dc.DrawText(text, xPos, yPos); + + text = "hon"; + dc.GetTextExtent(text, &w, &h); + xPos = m_rect.x + 29 + ((21 - w)/2); + yPos = m_rect.y + 10 + ((21 - h)/2); + dc.DrawText(text, xPos, yPos); + + + DrawBox(dc, 0, 35, 13, 13); + DrawBox(dc, 37, 35, 13, 13); + + DndShape::Draw(dc); +} + +bool DndShapePython::WriteSystemCode(wxTextFile & file) +{ + file.AddLine(" def Python(self, sTuple): "); + file.AddLine(" a,b,c = sTuple"); + file.AddLine(" exec(self.data[a][\"Python Code\"])"); + file.AddLine(" return self.data[a][\"Output\"]"); + file.AddLine(""); + + return true; +} + +bool DndShapePython::WriteThisShapeInfo(wxTextFile & file) +{ + file.AddLine(wxString::Format(" \"%s\" : { ", GetKey().c_str())); + + wxNode *inputNode = (wxNode *)GetInputPoints().GetFirst(); + const wxString & inputLabel = ((LabelledPoint *)inputNode->GetData())->GetFullLabel(); + file.AddLine(wxString::Format(" \"Input\" : ")); + file.AddLine(wxString::Format(" %s, ", inputLabel.c_str())); + + wxNode *outputNode = (wxNode *)GetOutputPoints().GetFirst(); + const wxString & outputLabel = ((LabelledPoint *)outputNode->GetData())->GetFullLabel(); + file.AddLine(wxString::Format(" \"Output\" : ")); + file.AddLine(wxString::Format(" %s, ", outputLabel.c_str())); + + file.AddLine(wxString::Format(" \"Python Code\" : ")); + file.AddLine(wxString::Format(" \"%s\", ", displayData[1].data.c_str())); + + file.AddLine(wxString::Format(" },")); + + return true; +} Added: sofaswitch/trunk/callflow/src/python.h ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/python.h Thu Sep 7 01:14:21 2006 @@ -0,0 +1,35 @@ +#ifndef SHAPE_PYTHON_H + +#define SHAPE_PYTHON_H + +#include "dnd.h" + +////////////////////////////////////////////////////////////////////////// +/**Define a shape to indicate an arbitrary block of python code. + */ +class DndShapePython : public DndShape +{ +public: + /**Construtor, Define this shape in terms of size and points etc */ + DndShapePython(); + + /**Destroy this shape, and log it */ + virtual ~DndShapePython() + { + } + + /**Draw this particular shape to the screen..*/ + virtual void Draw(wxDC& dc); + + /** Used to report the name of this particular class. */ + static wxString GetKindName() { return wxString("Python"); } + + /**Write the code generic to this Python code shape */ + virtual bool WriteSystemCode(wxTextFile & file); + + /**Write the dictionary containing relevant points for this shape */ + virtual bool WriteThisShapeInfo(wxTextFile & file); +}; + + +#endif Added: sofaswitch/trunk/callflow/src/requestnode.cpp ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/requestnode.cpp Thu Sep 7 01:14:21 2006 @@ -0,0 +1,97 @@ +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif +#include <wx/textfile.h> +#include <wx/tokenzr.h> +#include "shapelist.h" + + +#include "requestnode.h" + +///////////////////////////////////////////////////////////////////////////// + + + + +DndShapeRequestNode::DndShapeRequestNode() + : DndShape(RequestNode) +{ + wxSize newSize(50, 50); + SetSize(newSize); + + displayData[displayData.size()] = + InformationSection(wxT("request node from "), wxT("voip")); + + relInputPoints.Add(25, 0); + relOutputPoints.Add(25, 50); + AdjustIoPoints(); +} + +void DndShapeRequestNode::Draw(wxDC& dc) +{ + DrawCompileError(dc); + dc.SetPen(*wxBLACK_PEN); + + wxPoint p1(m_rect.GetPosition()); + wxPoint pA(p1.x + 25, p1.y + 0); + wxPoint pB(p1.x + 25, p1.y + 50); + + + dc.DrawLine(pA, pB); + + wxString text("R ?"); + wxFont f = wxFont(*wxITALIC_FONT); + f.SetPointSize(20); + dc.SetFont(f);//*wxITALIC_FONT); + wxCoord w, h; + dc.GetTextExtent(text, &w, &h); + + int xPos = m_rect.x + 0 + ((50 - w)/2); + int yPos = m_rect.y + 10 + ((21 - h)/2); + dc.DrawText(text, xPos, yPos); + + DrawArrow(dc, pA, ArrowDown, InputPointConnected(0) ? Connected : Loose); + DrawArrow(dc, pB, ArrowDown, OutputPointConnected(0) ? Connected : Loose); + + DndShape::Draw(dc); +} + +bool DndShapeRequestNode::WriteSystemCode(wxTextFile & file) +{ + file.AddLine(" def Request_Node(self, aTuple): "); + file.AddLine(" id,y,z = aTuple"); + file.AddLine(" return data[id][\"Output\"]"); + file.AddLine(""); + return true; +} + +bool DndShapeRequestNode::WriteThisShapeInfo(wxTextFile & file) +{ + file.AddLine(wxString::Format("\"%s\" : { ", GetKey().c_str())); + + wxNode *inputNode = (wxNode *)GetInputPoints().GetFirst(); + const wxString & inputLabel = ((LabelledPoint *)inputNode->GetData())->GetFullLabel(); + file.AddLine(wxString::Format(" \"Input\" : ")); + file.AddLine(wxString::Format(" %s, ", inputLabel.c_str())); + + wxNode *outputNode = (wxNode *)GetOutputPoints().GetFirst(); + const wxString & outputLabel = ((LabelledPoint *)outputNode->GetData())->GetFullLabel(); + file.AddLine(wxString::Format(" \"Output\" : ")); + file.AddLine(wxString::Format(" %s, ", outputLabel.c_str())); + + + file.AddLine(wxString::Format(" \"request node from\" : ")); + file.AddLine(wxString::Format(" \"%s\", ", displayData[1].data.c_str())); + + file.AddLine(wxString::Format(" },")); + + return true; +} + Added: sofaswitch/trunk/callflow/src/requestnode.h ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/requestnode.h Thu Sep 7 01:14:21 2006 @@ -0,0 +1,39 @@ +#ifndef REQUEST_NODE_H + +#define REQUEST_NODE_H + +#include "dnd.h" + +/////////////////////////////////////////////////////////////////////////// +/**Define a request node shape. This code will return almost immediately, and + we leave it to the timer object to recover from if there was an answer, or + noting Store values for size, location, input & output points. This + instance has the ability to draw this shape to a specified location on the + canvas */ +class DndShapeRequestNode : public DndShape +{ +public: + /**Construtor, Define this shape in terms of size and points etc */ + DndShapeRequestNode(); + + /**Destroy this shape, and log it */ + virtual ~DndShapeRequestNode() + { + } + + /**Draw this particular shape to the screen..*/ + virtual void Draw(wxDC& dc); + + /** Used to report the name of this particular class. */ + static wxString GetKindName() { return wxString("Request Node"); } + + /**Write the code generic to this StartHere shape */ + virtual bool WriteSystemCode(wxTextFile & file); + + /**Write the dictionary containing relevant points for this shape */ + virtual bool WriteThisShapeInfo(wxTextFile & file); +}; + + +#endif + Modified: sofaswitch/trunk/callflow/src/shapelist.cpp ============================================================================== --- sofaswitch/trunk/callflow/src/shapelist.cpp (original) +++ sofaswitch/trunk/callflow/src/shapelist.cpp Thu Sep 7 01:14:21 2006 @@ -179,7 +179,10 @@ bool MyListShapesExtended::WriteGraphData(wxTextFile & file) { wxString graphName(file.GetName()); - graphName = graphName + ".graph"; + int index = graphName.Find("."); + if (index >= 0) + graphName = graphName.Left(index); + graphName = graphName + "_graph"; wxTextFile graphFile(graphName); if (!graphFile.Exists()) graphFile.Create(); @@ -192,7 +195,7 @@ graphFile.AddLine("#!/usr/bin/python"); graphFile.AddLine(" "); - graphFile.AddLine(" data = {"); + graphFile.AddLine("data = {"); MyListShapes::iterator it = begin(); @@ -287,8 +290,6 @@ file.Clear(); - bool shapeInitialised[DndShape::KnownShapes]; - file.AddLine("#!/usr/bin/python"); file.AddLine(" "); file.AddLine("import sys"); @@ -301,60 +302,36 @@ file.AddLine("from twisted.internet import reactor, protocol"); file.AddLine(" "); - file.AddLine("class EchoClient(protocol.Protocol):"); - - file.AddLine(" def connectionMade(self): "); - file.AddLine(" self.myId = \"\" "); - file.AddLine(" self.countReceived = 0 "); - file.AddLine(" self.transport.write(\"?\0\") "); - file.AddLine(" self.transport.write(\"whoami\0\");"); - file.AddLine(" self.colonChar = \':\' "); - file.AddLine(" "); - file.AddLine(" def connectionLost(self, reason): "); - file.AddLine(" print \"connection lost\" "); - file.AddLine(" "); - file.AddLine(" def dataReceived(self, data): "); - file.AddLine(" ssdata = str(data).split(\'\0\') "); - file.AddLine(" for oneMessage in ssdata: "); - file.AddLine(" self.countReceived = self.countReceived + 1"); - file.AddLine(" if self.countReceived == 1: "); - file.AddLine(" self.myId = oneMessage; "); - file.AddLine(" else: "); - file.AddLine(" self.processReceivedMessage(oneMessage)"); - file.AddLine(" "); - file.AddLine(" def replyNow(self, data):"); - file.AddLine(" self.transport.write(self.tstring) "); - file.AddLine(" "); - file.AddLine(" "); - - file.AddLine("class Controller(EchoClient):"); - file.AddLine(" "); - - file.AddLine(" def processReceivedMessage(self, thisMessage): "); - file.AddLine(" print \"Received \", thisMessage "); - file.AddLine(" "); - - file.AddLine(" def __init__(self):"); - file.AddLine(" self.endProgramNow = False"); + file.AddLine("class Controller(protocol.Protocol): "); + file.AddLine(" def __init__(self): "); + file.AddLine(" self.graphSet = False "); + file.AddLine(" self.connectionMade = False "); + file.AddLine(" self.endProgramNow = False "); char c= 34; wxString tString = wxString::Format(" self.quote = \"\\%c\"", c); file.AddLine(tString.c_str()); - bool keepLooking = true; - it = begin(); - while ((it != end()) && keepLooking) { - DndShape *thisShape = it->second; - if (thisShape->GetKind() == DndShape::StartHere) - keepLooking = false; - else - it++; - } - if (keepLooking) - return false; - - wxString startNode = wxString::Format(" self.firstNode = \"%s\"", it->second->GetKey().c_str()); - file.AddLine(startNode); - + file.AddLine(" "); + file.AddLine(" def setGraphData(self, graphFile): "); + file.AddLine(" import graphFile "); + file.AddLine(" self.data = graphFile.data "); + file.AddLine(" "); + file.AddLine(" self.firstNode = None "); + file.AddLine(" for k,v in aa.data.iteritems(): "); + file.AddLine(" if k[:16] == \"Start_Processing\": "); + file.AddLine(" self.firstNode = k "); + file.AddLine(" break "); + file.AddLine(" self.timeout = reactor.callLater(0, self.startTimerExpired, \"graph\")"); + file.AddLine(" "); + file.AddLine(" def startTimerExpired(self, data):"); + file.AddLine(" if data == \"graph\": "); + file.AddLine(" self.connectionMade = True "); + file.AddLine(" if data == \"connected\": "); + file.AddLine(" self.graphSet = True; "); + file.AddLine(" if self.graphSet and self.connectionMade:"); + file.AddLine(" print \"start processing now \" "); + file.AddLine(" "); + file.AddLine(" def startWorkNow(): "); file.AddLine(" sTuple = \"(\" + self.quote + self.firstNode + self.quote + \", 0, \" +self.quote + \"Start_Processing\" + self.quote + \")\""); file.AddLine(" self.DoWork(eval(sTuple))"); file.AddLine(" "); @@ -366,29 +343,65 @@ file.AddLine(" while self.keepGoing:"); file.AddLine(" command = \"self.\" + str(c) + \"(\" + str(sTuple) + \")\""); file.AddLine(" a,b,c = sTuple = eval(command)"); - file.AddLine(" "); - file.AddLine(" "); + file.AddLine(" "); + file.AddLine(" def connectionMade(self): "); + file.AddLine(" self.myId = \"\" "); + file.AddLine(" self.countReceived = 0 "); + file.AddLine(" self.transport.write(\"?\\0\") "); + file.AddLine(" self.transport.write(\"whoami\\0\");"); + file.AddLine(" self.colonChar = \':\' "); + file.AddLine(" "); + file.AddLine(" def connectionLost(self, reason): "); + file.AddLine(" print \"connection lost\" "); + file.AddLine(" "); + file.AddLine(" def dataReceived(self, data): "); + file.AddLine(" ssdata = str(data).split(\'\\0\') "); + file.AddLine(" for oneMessage in ssdata: "); + file.AddLine(" self.countReceived = self.countReceived + 1"); + file.AddLine(" if self.countReceived == 1: "); + file.AddLine(" self.myId = oneMessage; "); + file.AddLine(" self.timeout2 = reactor.callLater(0, self.startTimerExpired, \"connected\")"); + file.AddLine(" else: "); + file.AddLine(" self.processReceivedMessage(oneMessage)"); + file.AddLine(" "); + file.AddLine(" def replyNow(self, data):"); + file.AddLine(" self.transport.write(self.tstring) "); + file.AddLine(" "); + file.AddLine(" "); - - - for (int i = 0; i < DndShape::KnownShapes; i++) - shapeInitialised[i] = false; - - it = begin(); - while (it != end()) { - DndShape *thisShape = it->second; - if (!shapeInitialised[thisShape->GetKind()]) { - shapeInitialised[thisShape->GetKind()] = true; + for (int i = 0; i < DndShape::KnownShapes; i++) { + DndShape *thisShape = DndShape::Construct((DndShape::Kind)i); + if (thisShape == NULL) + continue; bool writeOk = thisShape->WriteSystemCode(file); + delete thisShape; if (!writeOk) - return false; - } - it++; + return false; } - file.AddLine("a=Controller()"); - - + file.AddLine(" "); + file.AddLine(" def processReceivedMessage(self, thisMessage): "); + file.AddLine(" print \"Received \", thisMessage "); + file.AddLine(" "); + + file.AddLine("class MyFactory(protocol.ClientFactory): "); + file.AddLine(" protocol = Controller "); + file.AddLine(" "); + file.AddLine(" def clientConnectionFailed(self, connector, reason): "); + file.AddLine(" print \"Connection failed - goodbye!\" "); + file.AddLine(" reactor.stop() "); + file.AddLine(" "); + file.AddLine(" def clientConnectionLost(self, connector, reason): "); + file.AddLine(" print \"Connection lost - goodbye!\" "); + file.AddLine(" reactor.stop() "); + file.AddLine(" "); + file.AddLine(" def setGraphData(self, graphFile): "); + file.AddLine(" protocol.setGraphData(graphFile) "); + file.AddLine(" "); + file.AddLine("f = MyFactory() "); + file.AddLine("f.setGraphData(\"a_graph\") "); + file.AddLine("reactor.connectTCP(\"localhost\", 5000, f) "); + file.AddLine("reactor.run() "); file.AddLine(" "); file.Write(); return true; Added: sofaswitch/trunk/callflow/src/shapeselect.cpp ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/shapeselect.cpp Thu Sep 7 01:14:21 2006 @@ -0,0 +1,74 @@ +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif +#include <wx/textfile.h> +#include <wx/tokenzr.h> +#include "shapelist.h" + + +#include "shapeselect.h" + + +///////////////////////////////////////////////////////////////////////////// +DndShapeSelect::DndShapeSelect() + : DndShape(Select) +{ + SetSelected(); + wxSize newSize(0, 0); + SetSize(newSize); +} + +void DndShapeSelect::DrawSelected(wxDC & dc) +{ + dc.SetBrush(wxBrush(*wxBLUE, wxTRANSPARENT)); + dc.SetPen(*wxBLUE); + dc.DrawRoundedRectangle(m_rect.x, m_rect.y, m_rect.GetWidth(), m_rect.GetHeight(), 10); + + dc.SetBrush(wxBrush(*wxBLACK, wxSOLID) ); +} + + +void DndShapeSelect::AdjustPosition(wxPoint &moveSize) +{ + m_rect.Offset(moveSize); +} + + +void DndShapeSelect::SetOtherCorner(wxPoint & newPosition) +{ + wxPoint topLeft; + wxSize newSize; + + if (newPosition.x > firstCorner.x) { + topLeft.x = firstCorner.x; + newSize.SetWidth(newPosition.x - firstCorner.x); + } else { + topLeft.x = newPosition.x; + newSize.SetWidth(firstCorner.x - newPosition.x); + } + + if (newPosition.y > firstCorner.y) { + topLeft.y = firstCorner.y; + newSize.SetHeight(newPosition.y - firstCorner.y); + } else { + topLeft.y = newPosition.y; + newSize.SetHeight(firstCorner.y - newPosition.y); + } + // printf("Set other corner, move size to be %d %d\n", newSize.GetWidth(), newSize.GetHeight()); + SetSize(newSize); + DndShape::SetPosition(topLeft); +} + + +void DndShapeSelect::SetPosition(wxPoint & newPosition) +{ + firstCorner = newPosition; + DndShape::SetPosition(newPosition); +} Added: sofaswitch/trunk/callflow/src/shapeselect.h ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/shapeselect.h Thu Sep 7 01:14:21 2006 @@ -0,0 +1,51 @@ +#ifndef SHAPE_SELECT_H +#define SHAPE_SELECT_H +#include "dnd.h" + +////////////////////////////////////////////////////////////////////////////////////////////// +/**Define a shape to indicate the region on the screen we have + selected. Store values for size, location, input & output points. + This instance has the ability to draw this shape to a specified + location on the canvas */ +class DndShapeSelect : public DndShape +{ +public: + /**Construtor, Define this shape in terms of size and points etc */ + DndShapeSelect(); + + /**Destroy this shape, and log it */ + virtual ~DndShapeSelect() + { + } + + /**Write the python code generic to this "Shape Select" shape */ + virtual bool WriteSystemCode(wxTextFile & file) { } + + /**Draw this shape (which is a rectangle) in a selected fashion to + the screen. */ + virtual void DrawSelected(wxDC &dc); + + /**Set the location o the other corner of this rectangle. One corner has + already been specified and is stored in m_pos - now do the other corner.*/ + void SetOtherCorner(wxPoint & newPosition); + + /** Used to report the name of this particular class. */ + static wxString GetKindName() { return wxString("Select"); } + + /**Mark this shape as having a top left postion as determined by the parameter */ + virtual void SetPosition(wxPoint & newPosition); + + /**Modify the location of this shape by the specified delta. This is used when + the user is dragging this selecting region across the screen */ + virtual void AdjustPosition(wxPoint &moveSize); + + protected: + /**This is the location of the very first point marked for this + shape. From now on, we will make the location of the other + corner. */ + wxPoint firstCorner; +}; + + + +#endif // SHAPE_SELECT_H Added: sofaswitch/trunk/callflow/src/startfor.cpp ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/startfor.cpp Thu Sep 7 01:14:21 2006 @@ -0,0 +1,138 @@ +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif +#include <wx/textfile.h> +#include <wx/tokenzr.h> +#include "shapelist.h" + + +#include "startfor.h" + + +///////////////////////////////////////////////////////////////////////////// +DndShapeStartFor::DndShapeStartFor() + : DndShape(StartFor) +{ + wxSize newSize(50, 50); + SetSize(newSize); + + relInputPoints.Add(32, 0); + relInputPoints.Add(0, 25); + + relOutputPoints.Add(32, 50); + AdjustIoPoints(); + + displayData[displayData.size()] = + InformationSection(wxT("Initialise"), wxT("i = 0")); + + displayData[displayData.size()] = + InformationSection(wxT("Test for Termination"), wxT("i < loops")); + + displayData[displayData.size()] = + InformationSection(wxT("Increment"), wxT("i++")); +} + +void DndShapeStartFor::Draw(wxDC& dc) +{ + DrawCompileError(dc); + dc.SetPen(*wxBLACK_PEN); + + wxPoint tm(m_rect.x + 32, m_rect.y); + wxPoint tm1(tm.x, m_rect.y + 15); + + wxPoint lm(m_rect.x, m_rect.y + 25); + wxPoint lm1(m_rect.x + 15, lm.y); + + wxPoint bm(tm.x, m_rect.y + 35); + wxPoint bm1(tm.x, m_rect.y + 50); + + wxString text("For"); + dc.SetFont(*wxITALIC_FONT); + wxCoord w, h; + dc.GetTextExtent(text, &w, &h); + int xPos = m_rect.x + 15 + ((35 - w)/2); + int yPos = m_rect.y + 15 + ((20 - h)/2); + dc.DrawText(text, xPos, yPos); + DrawBox(dc, 15, 15, 35, 20); + dc.DrawLine(tm, tm1); + dc.DrawLine(lm, lm1); + dc.DrawLine(bm, bm1); + + + DrawArrow(dc, tm1, ArrowDown, InputPointConnected(0)? Connected : Loose); + DrawArrow(dc, lm1, ArrowRight, InputPointConnected(1)? Connected : Loose); + DrawArrow(dc, bm1, ArrowDown, OutputPointConnected(0) ? Connected : Loose); + + DndShape::Draw(dc); // Draw the selected overlay if required. +} + + +bool DndShapeStartFor::WriteSystemCode(wxTextFile & file) +{ + file.AddLine(" def Start_For(self, aTuple): "); + file.AddLine(" a,b,c = aTuple"); + + file.AddLine(" if b==0:"); + file.AddLine(" exec(self.data[a][\"Initialise\"])"); + file.AddLine(" else:"); + file.AddLine(" exec(self.data[a][\"Increment\"])"); + file.AddLine(" "); + file.AddLine(" if eval(self.data[a][\"Test\"]):"); + file.AddLine(" return self.data[a][\"Output\"]"); + file.AddLine(" "); + file.AddLine(" next = self.data[a][\"EndForLoop\"]"); + file.AddLine(" return self.data[next][\"AllDone\"]"); + file.AddLine(" "); + + return true; +} + +bool DndShapeStartFor::WriteThisShapeInfo(wxTextFile & file) +{ + file.AddLine(wxString::Format(" \"%s\" : { ", GetKey().c_str())); + + file.AddLine(wxString::Format(" \"Initialise\" : ")); + file.AddLine(wxString::Format(" \"%s\", ", displayData[1].data.c_str())); + + file.AddLine(wxString::Format(" \"Test\" : ")); + file.AddLine(wxString::Format(" \"%s\", ", displayData[2].data.c_str())); + + file.AddLine(wxString::Format(" \"Increment\" : ")); + file.AddLine(wxString::Format(" \"%s\", ", displayData[3].data.c_str())); + + wxNode *outputNode = (wxNode *)GetOutputPoints().GetFirst(); + const wxString & outputLabel = ((LabelledPoint *)outputNode->GetData())->GetFullLabel(); + + file.AddLine(wxString::Format(" \"Output\" : ")); + file.AddLine(wxString::Format(" %s, ", outputLabel.c_str())); + + /**This is the identity of the node at the bottom of the for loop. We have to jump + to this node on failing the test.*/ + file.AddLine(wxString::Format(" \"EndForLoop\" : ")); + file.AddLine(wxString::Format(" \"%s\", ", endForLoop.c_str())); + + file.AddLine(wxString::Format(" },")); + + return true; +} + +bool DndShapeStartFor::SearchOtherNodes(const MyListShapesExtended &allCurrentShapes) +{ + MyListShapes::const_iterator it = allCurrentShapes.begin(); + while (it != allCurrentShapes.end()) { + DndShape *oneShape = it->second; + if (oneShape->LinkedTo(EndFor, GetKey(), 0)) { + endForLoop = oneShape->GetKey(); + return true; + } + it++; + } + return false; +} Added: sofaswitch/trunk/callflow/src/startfor.h ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/startfor.h Thu Sep 7 01:14:21 2006 @@ -0,0 +1,49 @@ +#ifndef START_FOR_H + +#define START_FOR_H + +#include "dnd.h" + +////////////////////////////////////////////////////////////////////// +/**Define a shape to indicate the start of a foor loop. Store values + for size, location, input & output points. This instance has the + ability to draw this shape to a specified location on the canvas */ +class DndShapeStartFor : public DndShape +{ +public: + /**Construtor, Define this shape in terms of size and points etc */ + DndShapeStartFor(); + + /**Destroy this shape, and log it */ + virtual ~DndShapeStartFor() + { + } + + /**Draw this particular shape to the screen..*/ + virtual void Draw(wxDC& dc); + + /** Used to report the name of this particular class. */ + static wxString GetKindName() { return wxString("Start For"); } + + /**Write the code generic to this StartFor shape */ + virtual bool WriteSystemCode(wxTextFile & file); + + /**Write the dictionary containing relevant points for this shape */ + virtual bool WriteThisShapeInfo(wxTextFile & file); + + /**As in the case of the Start_For -- End_For pairing, there are times when + a node, to compile correctly, has to search the list of all other nodes. + This method is provided as a means for one node to search all other nodes + + return true/false depending on if it satisfied by the search.*/ + virtual bool SearchOtherNodes(const MyListShapesExtended & allCurrentShapes); + + protected: + /**The unique key of the end_for structure, who is at the end of + the loop we have started */ + wxString endForLoop; + +}; + + +#endif Added: sofaswitch/trunk/callflow/src/starthere.cpp ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/starthere.cpp Thu Sep 7 01:14:21 2006 @@ -0,0 +1,72 @@ +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif +#include <wx/textfile.h> +#include <wx/tokenzr.h> +#include "shapelist.h" + + +#include "starthere.h" + + +///////////////////////////////////////////////////////////////////////////// +DndShapeStartHere::DndShapeStartHere() + : DndShape(StartHere) +{ + wxSize newSize(50, 50); + SetSize(newSize); + + relOutputPoints.Add(25, 50); + AdjustIoPoints(); +} + +void DndShapeStartHere::Draw(wxDC& dc) +{ + DrawCompileError(dc); + dc.SetPen(*wxBLACK_PEN); + + wxPoint p1(m_rect.GetPosition()); + wxPoint pA(p1.x + 25, p1.y + 15); + wxPoint pB(p1.x + 25, p1.y + 50); + + DrawBox(dc, 0, 0, 50, 15); + DrawBox(dc, 0, 15, 20, 20); + DrawBox(dc, 30, 15, 20, 20); + + dc.DrawLine(pA, pB); + DrawArrow(dc, pB, ArrowDown, OutputPointConnected(0) ? Connected : Loose); + + + DndShape::Draw(dc); +} + +bool DndShapeStartHere::WriteSystemCode(wxTextFile & file) +{ + file.AddLine(" def Start_Processing(self, aTuple): "); + file.AddLine(" id,y,z = aTuple"); + file.AddLine(" return self.data[id][\"Output\"]"); + file.AddLine(""); + return true; +} + +bool DndShapeStartHere::WriteThisShapeInfo(wxTextFile & file) +{ + file.AddLine(wxString::Format(" \"%s\" : { ", GetKey().c_str())); + + wxNode *outputNode = (wxNode *)GetOutputPoints().GetFirst(); + const wxString & outputLabel = ((LabelledPoint *)outputNode->GetData())->GetFullLabel(); + + file.AddLine(wxString::Format(" \"Output\" : ")); + file.AddLine(wxString::Format(" %s, ", outputLabel.c_str())); + + file.AddLine(wxString::Format(" },")); + + return true; +} Added: sofaswitch/trunk/callflow/src/starthere.h ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/starthere.h Thu Sep 7 01:14:21 2006 @@ -0,0 +1,34 @@ +#ifndef START_HERE_H +#define START_HERE_H + +#include "dnd.h" + +////////////////////////////////////////////////////////////////////////////////////////////// +/**Define a start shape. Store values for size, location, input & output points. + This instance has the ability to draw this shape to a specified location on the canvas */ +class DndShapeStartHere : public DndShape +{ +public: + /**Construtor, Define this shape in terms of size and points etc */ + DndShapeStartHere(); + + /**Destroy this shape, and log it */ + virtual ~DndShapeStartHere() + { + } + + /**Draw this particular shape to the screen..*/ + virtual void Draw(wxDC& dc); + + /** Used to report the name of this particular class. */ + static wxString GetKindName() { return wxString("Start Processing"); } + + /**Write the code generic to this StartHere shape */ + virtual bool WriteSystemCode(wxTextFile & file); + + /**Write the dictionary containing relevant points for this shape */ + virtual bool WriteThisShapeInfo(wxTextFile & file); +}; + + +#endif Added: sofaswitch/trunk/callflow/src/timer.cpp ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/timer.cpp Thu Sep 7 01:14:21 2006 @@ -0,0 +1,111 @@ +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif +#include <wx/textfile.h> +#include <wx/tokenzr.h> +#include "shapelist.h" + + +#include "timer.h" + + +///////////////////////////////////////////////////////////////////////////// +DndShapeTimer::DndShapeTimer() + : DndShape(Timer) +{ + wxSize newSize(50, 50); + SetSize(newSize); + + relInputPoints.Add(25, 0); + relOutputPoints.Add(25, 50); + + displayData[displayData.size()] = + InformationSection(wxT("Timer period"), wxT("self.period = 2000")); + + displayData[displayData.size()] = + InformationSection(wxT("Timer label"), wxT("self.label=\"first\"")); + + AdjustIoPoints(); +} + +wxPoint DndShapeTimer::HourLocation(int hour, int radius) +{ + double angle = (2 * M_PI * (hour + 9))/12.0; + + wxPoint result(25 + m_rect.x + (int)(radius * cos(angle)), 25 + m_rect.y + (int)(radius * sin(angle))); + return result; +} + +void DndShapeTimer::Draw(wxDC& dc) +{ + DrawCompileError(dc); + + + wxPoint p1(m_rect.GetPosition()); + wxPoint pA(p1.x + 25, p1.y + 0); + wxPoint pE(p1.x + 25, p1.y + 10); + wxPoint pB(p1.x + 25, p1.y + 13); + wxPoint pC(p1.x + 25, p1.y + 37); + wxPoint pD(p1.x + 25, p1.y + 50); + wxPoint pM(p1.x + 25, p1.y + 25); + + DrawArrow(dc, pE, ArrowDown, InputPointConnected(0) ? Connected : Loose); + DrawArrow(dc, pD, ArrowDown, OutputPointConnected(0) ? Connected : Loose); + dc.DrawLine(pA, pB); + dc.DrawLine(pC, pD); + + dc.SetBrush(wxBrush(*wxBLACK, wxTRANSPARENT) ); + dc.DrawCircle(pM, 12); + dc.SetBrush(wxBrush(*wxBLACK, wxSOLID) ); + + for(int i = 0; i < 12; i++) + dc.DrawLine(HourLocation(i, 10), HourLocation(i, 12)); + + dc.DrawLine(HourLocation(2, 10), HourLocation(0, 0)); + dc.DrawLine(HourLocation(7, 6), HourLocation(0, 0)); + + DndShape::Draw(dc); +} + +bool DndShapeTimer::WriteSystemCode(wxTextFile & file) +{ + file.AddLine(" def Timer(self, sTuple): "); + file.AddLine(" a,b,c = sTuple"); + file.AddLine(" return data[a][\"Output\"]"); + file.AddLine(""); + + return true; +} + +bool DndShapeTimer::WriteThisShapeInfo(wxTextFile & file) +{ + file.AddLine(wxString::Format("\"%s\" : { ", GetKey().c_str())); + + wxNode *inputNode = (wxNode *)GetInputPoints().GetFirst(); + const wxString & inputLabel = ((LabelledPoint *)inputNode->GetData())->GetFullLabel(); + file.AddLine(wxString::Format(" \"Input\" : ")); + file.AddLine(wxString::Format(" %s, ", inputLabel.c_str())); + + wxNode *outputNode = (wxNode *)GetOutputPoints().GetFirst(); + const wxString & outputLabel = ((LabelledPoint *)outputNode->GetData())->GetFullLabel(); + file.AddLine(wxString::Format(" \"Output\" : ")); + file.AddLine(wxString::Format(" %s, ", outputLabel.c_str())); + + file.AddLine(wxString::Format(" \"Timer period\" : ")); + file.AddLine(wxString::Format(" \"%s\", ", displayData[1].data.c_str())); + + file.AddLine(wxString::Format(" \"Timer label\" : ")); + file.AddLine(wxString::Format(" \"%s\", ", displayData[2].data.c_str())); + + file.AddLine(wxString::Format(" },")); + + return true; +} + Added: sofaswitch/trunk/callflow/src/timer.h ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/timer.h Thu Sep 7 01:14:21 2006 @@ -0,0 +1,43 @@ +#ifndef SHAPE_TIMER_H +#define SHAPE_TIMER_H + +#include "dnd.h" + +////////////////////////////////////////////////////////////////////////// +/**Define a shape to indicate the setting of a timer. This timer will run for + some number of milliseconds + */ +class DndShapeTimer : public DndShape +{ +public: + /**Construtor, Define this shape in terms of size and points etc */ + DndShapeTimer(); + + /**Destroy this shape, and log it */ + virtual ~DndShapeTimer() + { + } + + /**Draw this particular shape to the screen..*/ + virtual void Draw(wxDC& dc); + + /** Used to report the name of this particular class. */ + static wxString GetKindName() { return wxString("Timer"); } + + /**Write the code generic to this End For loop shape */ + virtual bool WriteSystemCode(wxTextFile & file); + + /**Write the dictionary containing relevant points for this shape */ + virtual bool WriteThisShapeInfo(wxTextFile & file); + + protected: + /**When drawing the hour marks on the clock, determine the location of these hour marks. + The supplied parameter specifies the radius, which hour it is (a value of 0 == 12). + Returns the wxPoint value, after adding the offset of this icons location */ + wxPoint HourLocation(int hour, int radius); +}; + + + + +#endif //SHAPE_TIMER_H