]> git.saurik.com Git - wxWidgets.git/commitdiff
lots'o' wxpython modules files
authorHarco de Hilster <harcoh@caos.kun.nl>
Wed, 11 Aug 1999 17:14:49 +0000 (17:14 +0000)
committerHarco de Hilster <harcoh@caos.kun.nl>
Wed, 11 Aug 1999 17:14:49 +0000 (17:14 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3345 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

43 files changed:
utils/wxPython/modules/glcanvas/Makefile.pre.in [new file with mode: 0644]
utils/wxPython/modules/glcanvas/Setup.in [new file with mode: 0644]
utils/wxPython/modules/glcanvas/glcanvas.i [new file with mode: 0644]
utils/wxPython/modules/glcanvas/glcanvasc.def [new file with mode: 0644]
utils/wxPython/modules/glcanvas/makefile.vc [new file with mode: 0644]
utils/wxPython/modules/html/BUGS [new file with mode: 0644]
utils/wxPython/modules/html/Makefile.pre.in [new file with mode: 0644]
utils/wxPython/modules/html/README [new file with mode: 0644]
utils/wxPython/modules/html/Setup.in [new file with mode: 0644]
utils/wxPython/modules/html/html.i [new file with mode: 0644]
utils/wxPython/modules/html/htmlc.def [new file with mode: 0644]
utils/wxPython/modules/html/htmlhelper.py [new file with mode: 0644]
utils/wxPython/modules/html/makefile.vc [new file with mode: 0644]
utils/wxPython/modules/html/test/htmlview.py [new file with mode: 0644]
utils/wxPython/modules/html/test/htmlwidget.py [new file with mode: 0644]
utils/wxPython/modules/lseditor/BUGS [new file with mode: 0644]
utils/wxPython/modules/lseditor/COPYING [new file with mode: 0644]
utils/wxPython/modules/lseditor/Makefile.pre.in [new file with mode: 0644]
utils/wxPython/modules/lseditor/README [new file with mode: 0644]
utils/wxPython/modules/lseditor/Setup.in [new file with mode: 0644]
utils/wxPython/modules/lseditor/config.h [new file with mode: 0644]
utils/wxPython/modules/lseditor/controlarea.h [new file with mode: 0644]
utils/wxPython/modules/lseditor/editorpl.h [new file with mode: 0644]
utils/wxPython/modules/lseditor/finddlg.cpp [new file with mode: 0644]
utils/wxPython/modules/lseditor/finddlg.h [new file with mode: 0644]
utils/wxPython/modules/lseditor/lseditor.i [new file with mode: 0644]
utils/wxPython/modules/lseditor/lseditorc.def [new file with mode: 0644]
utils/wxPython/modules/lseditor/lseditorpl.cpp [new file with mode: 0644]
utils/wxPython/modules/lseditor/lseditorpl.h [new file with mode: 0644]
utils/wxPython/modules/lseditor/markup.cpp [new file with mode: 0644]
utils/wxPython/modules/lseditor/markup.h [new file with mode: 0644]
utils/wxPython/modules/lseditor/plugin.cpp [new file with mode: 0644]
utils/wxPython/modules/lseditor/plugin.h [new file with mode: 0644]
utils/wxPython/modules/lseditor/sourcepainter.cpp [new file with mode: 0644]
utils/wxPython/modules/lseditor/sourcepainter.h [new file with mode: 0644]
utils/wxPython/modules/lseditor/tdefs.cpp [new file with mode: 0644]
utils/wxPython/modules/lseditor/tdefs.h [new file with mode: 0644]
utils/wxPython/modules/lseditor/test/editor.py [new file with mode: 0644]
utils/wxPython/modules/lseditor/wxsdefs.h [new file with mode: 0644]
utils/wxPython/modules/lseditor/wxstlac.h [new file with mode: 0644]
utils/wxPython/modules/lseditor/wxstldefs.h [new file with mode: 0644]
utils/wxPython/modules/lseditor/wxstllst.h [new file with mode: 0644]
utils/wxPython/modules/lseditor/wxstlvec.h [new file with mode: 0644]

diff --git a/utils/wxPython/modules/glcanvas/Makefile.pre.in b/utils/wxPython/modules/glcanvas/Makefile.pre.in
new file mode 100644 (file)
index 0000000..7f4ac98
--- /dev/null
@@ -0,0 +1,365 @@
+# Universal Unix Makefile for Python extensions
+# =============================================
+
+# Short Instructions
+# ------------------
+
+# 1. Build and install Python (1.5 or newer).
+# 2. "make -f Makefile.pre.in boot"
+# 3. "make"
+# You should now have a shared library.
+
+# Long Instructions
+# -----------------
+
+# Build *and install* the basic Python 1.5 distribution.  See the
+# Python README for instructions.  (This version of Makefile.pre.in
+# only withs with Python 1.5, alpha 3 or newer.)
+
+# Create a file Setup.in for your extension.  This file follows the
+# format of the Modules/Setup.in file; see the instructions there.
+# For a simple module called "spam" on file "spammodule.c", it can
+# contain a single line:
+#   spam spammodule.c
+# You can build as many modules as you want in the same directory --
+# just have a separate line for each of them in the Setup.in file.
+
+# If you want to build your extension as a shared library, insert a
+# line containing just the string
+#   *shared*
+# at the top of your Setup.in file.
+
+# Note that the build process copies Setup.in to Setup, and then works
+# with Setup.  It doesn't overwrite Setup when Setup.in is changed, so
+# while you're in the process of debugging your Setup.in file, you may
+# want to edit Setup instead, and copy it back to Setup.in later.
+# (All this is done so you can distribute your extension easily and
+# someone else can select the modules they actually want to build by
+# commenting out lines in the Setup file, without editing the
+# original.  Editing Setup is also used to specify nonstandard
+# locations for include or library files.)
+
+# Copy this file (Misc/Makefile.pre.in) to the directory containing
+# your extension.
+
+# Run "make -f Makefile.pre.in boot".  This creates Makefile
+# (producing Makefile.pre and sedscript as intermediate files) and
+# config.c, incorporating the values for sys.prefix, sys.exec_prefix
+# and sys.version from the installed Python binary.  For this to work,
+# the python binary must be on your path.  If this fails, try
+#   make -f Makefile.pre.in Makefile VERSION=1.5 installdir=<prefix>
+# where <prefix> is the prefix used to install Python for installdir
+# (and possibly similar for exec_installdir=<exec_prefix>).
+
+# Note: "make boot" implies "make clobber" -- it assumes that when you
+# bootstrap you may have changed platforms so it removes all previous
+# output files.
+
+# If you are building your extension as a shared library (your
+# Setup.in file starts with *shared*), run "make" or "make sharedmods"
+# to build the shared library files.  If you are building a statically
+# linked Python binary (the only solution of your platform doesn't
+# support shared libraries, and sometimes handy if you want to
+# distribute or install the resulting Python binary), run "make
+# python".
+
+# Note: Each time you edit Makefile.pre.in or Setup, you must run
+# "make Makefile" before running "make".
+
+# Hint: if you want to use VPATH, you can start in an empty
+# subdirectory and say (e.g.):
+#   make -f ../Makefile.pre.in boot srcdir=.. VPATH=..
+
+
+# === Bootstrap variables (edited through "make boot") ===
+
+# The prefix used by "make inclinstall libainstall" of core python
+installdir=    /usr/local
+
+# The exec_prefix used by the same
+exec_installdir=$(installdir)
+
+# Source directory and VPATH in case you want to use VPATH.
+# (You will have to edit these two lines yourself -- there is no
+# automatic support as the Makefile is not generated by
+# config.status.)
+srcdir=                .
+VPATH=         .
+
+# === Variables that you may want to customize (rarely) ===
+
+# (Static) build target
+TARGET=                python
+
+# Installed python binary (used only by boot target)
+PYTHON=                python
+
+# Add more -I and -D options here
+CFLAGS=                $(OPT) -I$(INCLUDEPY) -I$(EXECINCLUDEPY) $(DEFS)
+
+# These two variables can be set in Setup to merge extensions.
+# See example[23].
+BASELIB=
+BASESETUP=
+
+# === Variables set by makesetup ===
+
+MODOBJS=       _MODOBJS_
+MODLIBS=       _MODLIBS_
+
+# === Definitions added by makesetup ===
+
+# === Variables from configure (through sedscript) ===
+
+VERSION=       @VERSION@
+CC=            @CC@
+LINKCC=                @LINKCC@
+SGI_ABI=       @SGI_ABI@
+OPT=           @OPT@
+LDFLAGS=       @LDFLAGS@
+LDLAST=                @LDLAST@
+DEFS=          @DEFS@
+LIBS=          @LIBS@
+LIBM=          @LIBM@
+LIBC=          @LIBC@
+RANLIB=                @RANLIB@
+MACHDEP=       @MACHDEP@
+SO=            @SO@
+LDSHARED=      @LDSHARED@
+CCSHARED=      @CCSHARED@
+LINKFORSHARED= @LINKFORSHARED@
+#@SET_CCC@
+
+# Install prefix for architecture-independent files
+prefix=                /usr/local
+
+# Install prefix for architecture-dependent files
+exec_prefix=   $(prefix)
+
+# === Fixed definitions ===
+
+# Shell used by make (some versions default to the login shell, which is bad)
+SHELL=         /bin/sh
+
+# Expanded directories
+BINDIR=                $(exec_installdir)/bin
+LIBDIR=                $(exec_prefix)/lib
+MANDIR=                $(installdir)/man
+INCLUDEDIR=    $(installdir)/include
+SCRIPTDIR=     $(prefix)/lib
+
+# Detailed destination directories
+BINLIBDEST=    $(LIBDIR)/python$(VERSION)
+LIBDEST=       $(SCRIPTDIR)/python$(VERSION)
+INCLUDEPY=     $(INCLUDEDIR)/python$(VERSION)
+EXECINCLUDEPY= $(exec_installdir)/include/python$(VERSION)
+LIBP=          $(exec_installdir)/lib/python$(VERSION)
+DESTSHARED=    $(BINLIBDEST)/site-packages
+
+LIBPL=         $(LIBP)/config
+
+PYTHONLIBS=    $(LIBPL)/libpython$(VERSION).a
+
+MAKESETUP=     $(LIBPL)/makesetup
+MAKEFILE=      $(LIBPL)/Makefile
+CONFIGC=       $(LIBPL)/config.c
+CONFIGCIN=     $(LIBPL)/config.c.in
+SETUP=         $(LIBPL)/Setup
+
+SYSLIBS=       $(LIBM) $(LIBC)
+
+ADDOBJS=       $(LIBPL)/python.o config.o
+
+# Portable install script (configure doesn't always guess right)
+INSTALL=       $(LIBPL)/install-sh -c
+# Shared libraries must be installed with executable mode on some systems;
+# rather than figuring out exactly which, we always give them executable mode.
+# Also, making them read-only seems to be a good idea...
+INSTALL_SHARED=        ${INSTALL} -m 555
+
+#---------------------------------------------------
+# Possibly change some definintions for C++
+ifdef MY_LDSHARED
+LDSHARED=$(MY_LDSHARED)
+endif
+ifdef MY_LINKCC
+LINKCC=$(MY_LINKCC)
+endif
+
+
+# === Fixed rules ===
+
+# Default target.  This builds shared libraries only
+default:       sharedmods
+
+# Build everything
+all:           static sharedmods
+
+# Build shared libraries from our extension modules
+sharedmods:    $(SHAREDMODS)
+
+# Build a static Python binary containing our extension modules
+static:                $(TARGET)
+$(TARGET):     $(ADDOBJS) lib.a $(PYTHONLIBS) Makefile $(BASELIB)
+               $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) \
+                $(ADDOBJS) lib.a $(PYTHONLIBS) \
+                $(LINKPATH) $(BASELIB) $(MODLIBS) $(LIBS) $(SYSLIBS) \
+                -o $(TARGET) $(LDLAST)
+
+#------------------------------------------------------------------------
+#------------------------------------------------------------------------
+# This is a default version of the install target for wxPython.  It just
+# redirects to wxInstall below...
+
+install:       wxInstall
+
+#install:      sharedmods
+#              if test ! -d $(DESTSHARED) ; then \
+#                      mkdir $(DESTSHARED) ; else true ; fi
+#              -for i in X $(SHAREDMODS); do \
+#                      if test $$i != X; \
+#                      then $(INSTALL_SHARED) $$i $(DESTSHARED)/$$i; \
+#                      fi; \
+#              done
+
+
+# Build the library containing our extension modules
+lib.a:         $(MODOBJS)
+               -rm -f lib.a
+               ar cr lib.a $(MODOBJS)
+               -$(RANLIB) lib.a
+
+# This runs makesetup *twice* to use the BASESETUP definition from Setup
+config.c Makefile:     Makefile.pre Setup $(BASESETUP) $(MAKESETUP)
+               $(MAKESETUP) \
+                -m Makefile.pre -c $(CONFIGCIN) Setup -n $(BASESETUP) $(SETUP)
+               $(MAKE) -f Makefile do-it-again
+
+# Internal target to run makesetup for the second time
+do-it-again:
+               $(MAKESETUP) \
+                -m Makefile.pre -c $(CONFIGCIN) Setup -n $(BASESETUP) $(SETUP)
+
+# Make config.o from the config.c created by makesetup
+config.o:      config.c
+               $(CC) $(CFLAGS) -c config.c
+
+# Setup is copied from Setup.in *only* if it doesn't yet exist
+Setup:
+               cp Setup.in Setup
+
+# Make the intermediate Makefile.pre from Makefile.pre.in
+Makefile.pre: Makefile.pre.in sedscript
+               sed -f sedscript Makefile.pre.in >Makefile.pre
+
+# Shortcuts to make the sed arguments on one line
+P=prefix
+E=exec_prefix
+H=Generated automatically from Makefile.pre.in by sedscript.
+L=LINKFORSHARED
+
+# Make the sed script used to create Makefile.pre from Makefile.pre.in
+sedscript:     $(MAKEFILE)
+       sed -n \
+        -e '1s/.*/1i\\/p' \
+        -e '2s%.*%# $H%p' \
+        -e '/^VERSION=/s/^VERSION=[    ]*\(.*\)/s%@VERSION[@]%\1%/p' \
+        -e '/^CC=/s/^CC=[      ]*\(.*\)/s%@CC[@]%\1%/p' \
+        -e '/^CCC=/s/^CCC=[    ]*\(.*\)/s%#@SET_CCC[@]%CCC=\1%/p' \
+        -e '/^LINKCC=/s/^LINKCC=[      ]*\(.*\)/s%@LINKCC[@]%\1%/p' \
+        -e '/^OPT=/s/^OPT=[    ]*\(.*\)/s%@OPT[@]%\1%/p' \
+        -e '/^LDFLAGS=/s/^LDFLAGS=[    ]*\(.*\)/s%@LDFLAGS[@]%\1%/p' \
+        -e '/^DEFS=/s/^DEFS=[  ]*\(.*\)/s%@DEFS[@]%\1%/p' \
+        -e '/^LIBS=/s/^LIBS=[  ]*\(.*\)/s%@LIBS[@]%\1%/p' \
+        -e '/^LIBM=/s/^LIBM=[  ]*\(.*\)/s%@LIBM[@]%\1%/p' \
+        -e '/^LIBC=/s/^LIBC=[  ]*\(.*\)/s%@LIBC[@]%\1%/p' \
+        -e '/^RANLIB=/s/^RANLIB=[      ]*\(.*\)/s%@RANLIB[@]%\1%/p' \
+        -e '/^MACHDEP=/s/^MACHDEP=[    ]*\(.*\)/s%@MACHDEP[@]%\1%/p' \
+        -e '/^SO=/s/^SO=[      ]*\(.*\)/s%@SO[@]%\1%/p' \
+        -e '/^LDSHARED=/s/^LDSHARED=[  ]*\(.*\)/s%@LDSHARED[@]%\1%/p' \
+        -e '/^CCSHARED=/s/^CCSHARED=[  ]*\(.*\)/s%@CCSHARED[@]%\1%/p' \
+        -e '/^$L=/s/^$L=[      ]*\(.*\)/s%@$L[@]%\1%/p' \
+        -e '/^$P=/s/^$P=\(.*\)/s%^$P=.*%$P=\1%/p' \
+        -e '/^$E=/s/^$E=\(.*\)/s%^$E=.*%$E=\1%/p' \
+        $(MAKEFILE) >sedscript
+       echo "/^#@SET_CCC@/d" >>sedscript
+       echo "/^installdir=/s%=.*%=     $(installdir)%" >>sedscript
+       echo "/^exec_installdir=/s%=.*%=$(exec_installdir)%" >>sedscript
+       echo "/^srcdir=/s%=.*%=         $(srcdir)%" >>sedscript
+       echo "/^VPATH=/s%=.*%=          $(VPATH)%" >>sedscript
+       echo "/^LINKPATH=/s%=.*%=       $(LINKPATH)%" >>sedscript
+       echo "/^BASELIB=/s%=.*%=        $(BASELIB)%" >>sedscript
+       echo "/^BASESETUP=/s%=.*%=      $(BASESETUP)%" >>sedscript
+
+# Bootstrap target
+boot:  clobber
+       VERSION=`$(PYTHON) -c "import sys; print sys.version[:3]"`; \
+       installdir=`$(PYTHON) -c "import sys; print sys.prefix"`; \
+       exec_installdir=`$(PYTHON) -c "import sys; print sys.exec_prefix"`; \
+       $(MAKE) -f Makefile.pre.in VPATH=$(VPATH) srcdir=$(srcdir) \
+               VERSION=$$VERSION \
+               installdir=$$installdir \
+               exec_installdir=$$exec_installdir \
+               Makefile
+
+# Handy target to remove intermediate files and backups
+clean:
+               -rm -f *.o *~
+
+# Handy target to remove everything that is easily regenerated
+clobber:       clean
+               -rm -f *.a tags TAGS config.c Makefile.pre $(TARGET) sedscript
+               -rm -f *.so *.sl so_locations
+
+
+# Handy target to remove everything you don't want to distribute
+distclean:     clobber
+               -rm -f Makefile Setup
+
+
+
+
+#------------------------------------------------------------------------
+#------------------------------------------------------------------------
+# Custom rules and dependencies added for wxPython
+#
+
+WXP_VERSION=2.1b2
+
+# WXP_SRCDIR=../wxPython/src
+
+SWIGFLAGS=-c++ -shadow -python -dnone -I$(WXP_SRCDIR) -D__WXGTK__ $(SEPARATE)
+
+
+# Implicit rules to run SWIG
+$(GENCODEDIR)/%.cpp : %.i
+       swig $(SWIGFLAGS) -c -o $@ $<
+
+$(GENCODEDIR)/%.py : %.i
+       swig $(SWIGFLAGS) -c -o $@ $<
+$(GENCODEDIR)/%.py : %.i
+       swig $(SWIGFLAGS) -c -o $(GENCODEDIR)/tmp_wrap.cpp $<
+       rm $(GENCODEDIR)/tmp_wrap.cpp
+               
+
+wxInstall :    sharedmods $(PYMODULES)
+       if test ! -d $(TARGETDIR) ; then \
+               mkdir $(TARGETDIR) ; else true ; fi
+       if [ "$(SHAREDMODS)" != "" ]; then \
+                chmod 755 $(SHAREDMODS); \
+                cp $(SHAREDMODS) $(TARGETDIR); fi
+       -for i in $(PYMODULES); do \
+               cp $$i $(TARGETDIR); \
+       done
+       if [ "$(TARGETDIR)" != ".." ]; then      \
+               python $(LIBDEST)/compileall.py $(TARGETDIR);      \
+               python -O $(LIBDEST)/compileall.py $(TARGETDIR);   \
+       else                                                       \
+               python $(LIBDEST)/compileall.py -l $(TARGETDIR);   \
+               python -O $(LIBDEST)/compileall.py -l $(TARGETDIR);\
+       fi
+
+$(GENCODEDIR)/_glcanvas.cpp:
+       -cp $(WXWIN)/utils/glcanvas/$(GENCODEDIR)/glcanvas.cpp $@
+       -cp $(WXWIN)/utils/glcanvas/$(GENCODEDIR)/glcanvas.h $(GENCODEDIR)/glcanvas.h
+               
diff --git a/utils/wxPython/modules/glcanvas/Setup.in b/utils/wxPython/modules/glcanvas/Setup.in
new file mode 100644 (file)
index 0000000..6dcb1ab
--- /dev/null
@@ -0,0 +1,52 @@
+## This file gives the details of what is needed to build this extension
+## module so the Makefile can be created.
+
+## If you have not done "make install" for wxWindows then see Setup.in.linux
+## for a more verbose version of this file.
+
+*shared*
+
+CCC=c++
+WXWIN=../../../..
+GENCODEDIR=gtk
+# srcdir=$(GENCODEDIR)
+WX_CONFIG_CFLAGS=`wx-config --cflags`
+WX_CONFIG_LIBS=`wx-config --libs`
+
+
+## Depending on how your Python was built, you may have to set this
+## value to use the C++ driver to link with instead of the default
+## C driver.  For example:
+MY_LDSHARED=$(CCC) -shared
+
+## Same as above, but for statically linking Python and wxPython together,
+## in other words, if you comment out the *shared* above.  If this is the
+## case then you should ensure that the main() function is Python's, not
+## wxWindows'.  You can rebuild $(WXWIN)/src/gtk/app.cpp with NOMAIN defined
+## to force this...
+MY_LINKCC=$(CCC)
+
+#--------------------------------------------------------------------
+#
+# Below follow settings that may be specific for a wxPython module
+#
+#--------------------------------------------------------------------
+
+## Pick one of these, or set your own.  This is where the wxPython module
+## should be installed.  It should be a subdirectory named wxPython.
+#TARGETDIR=../..
+TARGETDIR=$(BINLIBDEST)/site-packages/wxPython
+
+# The location of the wxPython source dir
+WXP_SRCDIR=../../src
+
+# These defines are usually best left alone
+C_DEFINES = -DSWIG_GLOBAL -DWXP_USE_THREAD -DSEPARATE
+C_FLAGS = -I. -I$(WXP_SRCDIR) $(WX_CONFIG_CFLAGS)
+# Add a couple of GL libraries
+C_LIBS = -lwxPyHelpers -lMesaGL -lMesaGLU $(WX_CONFIG_LIBS) 
+
+PYMODULES = $(GENCODEDIR)/glcanvas.py
+
+glcanvasc      $(GENCODEDIR)/glcanvas.cpp $(GENCODEDIR)/_glcanvas.cpp \
+       $(C_DEFINES) $(C_FLAGS) -Xlinker $(C_LIBS)
diff --git a/utils/wxPython/modules/glcanvas/glcanvas.i b/utils/wxPython/modules/glcanvas/glcanvas.i
new file mode 100644 (file)
index 0000000..6f9f644
--- /dev/null
@@ -0,0 +1,1104 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        glcanvas.i
+// Purpose:     SWIG definitions for the OpenGL wxWindows classes
+//
+// Author:      Robin Dunn
+//
+// Created:     15-Mar-1999
+// RCS-ID:      $Id$
+// Copyright:   (c) 1998 by Total Control Software
+// Licence:     wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+
+%module glcanvas
+
+%{
+#include "helpers.h"
+#include <glcanvas.h>
+%}
+
+//---------------------------------------------------------------------------
+
+%include typemaps.i
+%include my_typemaps.i
+
+%extern wx.i
+%extern windows.i
+%extern windows2.i
+%extern windows3.i
+%extern frames.i
+%extern _defs.i
+%extern misc.i
+%extern gdi.i
+%extern controls.i
+%extern events.i
+
+
+%{
+#if defined(SEPARATE) && defined(__WXMSW__)
+    static wxString wxPyEmptyStr("");
+    static wxPoint  wxPyDefaultPosition(-1, -1);
+    static wxSize   wxPyDefaultSize(-1, -1);
+#endif
+%}
+
+%pragma(python) code = "import wx"
+
+//---------------------------------------------------------------------------
+
+class wxPalette;
+class wxWindow;
+class wxSize;
+class wxPoint;
+class wxGLCanvas;
+
+//---------------------------------------------------------------------------
+
+class wxGLContext {
+public:
+    wxGLContext(bool isRGB, wxGLCanvas *win, const wxPalette& palette = wxNullPalette);
+    ~wxGLContext();
+
+    void SetCurrent();
+    void SetColour(const char *colour);
+    void SwapBuffers();
+
+#ifdef __WXGTK__
+    void SetupPixelFormat();
+    void SetupPalette(const wxPalette& palette);
+    wxPalette CreateDefaultPalette();
+    wxPalette* GetPalette();
+#endif
+
+    wxWindow* GetWindow();
+};
+
+//---------------------------------------------------------------------------
+
+class wxGLCanvas : public wxScrolledWindow {
+public:
+    wxGLCanvas(wxWindow *parent, wxWindowID id = -1,
+               const wxPoint& pos = wxPyDefaultPosition,
+               const wxSize& size = wxPyDefaultSize, long style = 0,
+               const char* name = "GLCanvas",
+               int *attribList = 0,
+               const wxPalette& palette = wxNullPalette);
+
+    %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
+
+    void SetCurrent();
+    void SetColour(const char *colour);
+    void SwapBuffers();
+
+    wxGLContext* GetContext();
+};
+
+
+//---------------------------------------------------------------------------
+
+typedef unsigned int GLenum;
+typedef unsigned char GLboolean;
+typedef unsigned int GLbitfield;
+typedef signed char GLbyte;
+typedef short GLshort;
+typedef int GLint;
+typedef int GLsizei;
+typedef unsigned char GLubyte;
+typedef unsigned short GLushort;
+typedef unsigned int GLuint;
+typedef float GLfloat;
+typedef float GLclampf;
+typedef double GLdouble;
+typedef double GLclampd;
+typedef void GLvoid;
+
+
+//---------------------------------------------------------------------------
+/* EXT_vertex_array */
+void glArrayElementEXT(GLint i);
+void glColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+void glDrawArraysEXT(GLenum mode, GLint first, GLsizei count);
+void glEdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *pointer);
+void glGetPointervEXT(GLenum pname, GLvoid* *params);
+void glIndexPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+void glNormalPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+void glTexCoordPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+void glVertexPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+
+#ifndef __WXGTK__
+/* EXT_color_subtable */
+void glColorSubtableEXT(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *table);
+#endif
+
+/* EXT_color_table */
+void glColorTableEXT(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
+#ifndef __WXGTK__
+void glCopyColorTableEXT(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
+#endif
+void glGetColorTableEXT(GLenum target, GLenum format, GLenum type, GLvoid *table);
+#ifndef __WXGTK__
+void glGetColorTableParamaterfvEXT(GLenum target, GLenum pname, GLfloat *params);
+void glGetColorTavleParameterivEXT(GLenum target, GLenum pname, GLint *params);
+#endif
+
+#ifndef __WXGTK__
+/* SGI_compiled_vertex_array */
+void glLockArraysSGI(GLint first, GLsizei count);
+void glUnlockArraysSGI();
+
+/* SGI_cull_vertex */
+void glCullParameterdvSGI(GLenum pname, GLdouble* params);
+void glCullParameterfvSGI(GLenum pname, GLfloat* params);
+
+/* SGI_index_func */
+void glIndexFuncSGI(GLenum func, GLclampf ref);
+
+/* SGI_index_material */
+void glIndexMaterialSGI(GLenum face, GLenum mode);
+
+/* WIN_swap_hint */
+void glAddSwapHintRectWin(GLint x, GLint y, GLsizei width, GLsizei height);
+#endif
+
+//----------------------------------------------------------------------
+// From GL.H
+
+enum {
+    GL_2D,
+    GL_2_BYTES,
+    GL_3D,
+    GL_3D_COLOR,
+    GL_3D_COLOR_TEXTURE,
+    GL_3_BYTES,
+    GL_4D_COLOR_TEXTURE,
+    GL_4_BYTES,
+    GL_ACCUM,
+    GL_ACCUM_ALPHA_BITS,
+    GL_ACCUM_BLUE_BITS,
+    GL_ACCUM_BUFFER_BIT,
+    GL_ACCUM_CLEAR_VALUE,
+    GL_ACCUM_GREEN_BITS,
+    GL_ACCUM_RED_BITS,
+    GL_ADD,
+    GL_ALL_ATTRIB_BITS,
+    GL_ALPHA,
+    GL_ALPHA12,
+    GL_ALPHA16,
+    GL_ALPHA4,
+    GL_ALPHA8,
+    GL_ALPHA_BIAS,
+    GL_ALPHA_BITS,
+    GL_ALPHA_SCALE,
+    GL_ALPHA_TEST,
+    GL_ALPHA_TEST_FUNC,
+    GL_ALPHA_TEST_REF,
+    GL_ALWAYS,
+    GL_AMBIENT,
+    GL_AMBIENT_AND_DIFFUSE,
+    GL_AND,
+    GL_AND_INVERTED,
+    GL_AND_REVERSE,
+    GL_ATTRIB_STACK_DEPTH,
+    GL_AUTO_NORMAL,
+    GL_AUX0,
+    GL_AUX1,
+    GL_AUX2,
+    GL_AUX3,
+    GL_AUX_BUFFERS,
+    GL_BACK,
+    GL_BACK_LEFT,
+    GL_BACK_RIGHT,
+#ifndef __WXGTK__
+    GL_BGRA_EXT,
+    GL_BGR_EXT,
+#endif
+    GL_BITMAP,
+    GL_BITMAP_TOKEN,
+    GL_BLEND,
+    GL_BLEND_DST,
+    GL_BLEND_SRC,
+    GL_BLUE,
+    GL_BLUE_BIAS,
+    GL_BLUE_BITS,
+    GL_BLUE_SCALE,
+    GL_BYTE,
+    GL_C3F_V3F,
+    GL_C4F_N3F_V3F,
+    GL_C4UB_V2F,
+    GL_C4UB_V3F,
+    GL_CCW,
+    GL_CLAMP,
+    GL_CLEAR,
+    GL_CLIENT_ALL_ATTRIB_BITS,
+    GL_CLIENT_ATTRIB_STACK_DEPTH,
+    GL_CLIENT_PIXEL_STORE_BIT,
+    GL_CLIENT_VERTEX_ARRAY_BIT,
+    GL_CLIP_PLANE0,
+    GL_CLIP_PLANE1,
+    GL_CLIP_PLANE2,
+    GL_CLIP_PLANE3,
+    GL_CLIP_PLANE4,
+    GL_CLIP_PLANE5,
+    GL_COEFF,
+    GL_COLOR,
+    GL_COLOR_ARRAY,
+    GL_COLOR_ARRAY_COUNT_EXT,
+    GL_COLOR_ARRAY_EXT,
+    GL_COLOR_ARRAY_POINTER,
+    GL_COLOR_ARRAY_POINTER_EXT,
+    GL_COLOR_ARRAY_SIZE,
+    GL_COLOR_ARRAY_SIZE_EXT,
+    GL_COLOR_ARRAY_STRIDE,
+    GL_COLOR_ARRAY_STRIDE_EXT,
+    GL_COLOR_ARRAY_TYPE,
+    GL_COLOR_ARRAY_TYPE_EXT,
+    GL_COLOR_BUFFER_BIT,
+    GL_COLOR_CLEAR_VALUE,
+    GL_COLOR_INDEX,
+    GL_COLOR_INDEX12_EXT,
+    GL_COLOR_INDEX16_EXT,
+    GL_COLOR_INDEX1_EXT,
+    GL_COLOR_INDEX2_EXT,
+    GL_COLOR_INDEX4_EXT,
+    GL_COLOR_INDEX8_EXT,
+    GL_COLOR_INDEXES,
+    GL_COLOR_LOGIC_OP,
+    GL_COLOR_MATERIAL,
+    GL_COLOR_MATERIAL_FACE,
+    GL_COLOR_MATERIAL_PARAMETER,
+    GL_COLOR_TABLE_ALPHA_SIZE_EXT,
+    GL_COLOR_TABLE_BLUE_SIZE_EXT,
+    GL_COLOR_TABLE_FORMAT_EXT,
+    GL_COLOR_TABLE_GREEN_SIZE_EXT,
+    GL_COLOR_TABLE_INTENSITY_SIZE_EXT,
+    GL_COLOR_TABLE_LUMINANCE_SIZE_EXT,
+    GL_COLOR_TABLE_RED_SIZE_EXT,
+    GL_COLOR_TABLE_WIDTH_EXT,
+    GL_COLOR_WRITEMASK,
+    GL_COMPILE,
+    GL_COMPILE_AND_EXECUTE,
+    GL_CONSTANT_ATTENUATION,
+    GL_COPY,
+    GL_COPY_INVERTED,
+    GL_COPY_PIXEL_TOKEN,
+    GL_CULL_FACE,
+    GL_CULL_FACE_MODE,
+    GL_CURRENT_BIT,
+    GL_CURRENT_COLOR,
+    GL_CURRENT_INDEX,
+    GL_CURRENT_NORMAL,
+    GL_CURRENT_RASTER_COLOR,
+    GL_CURRENT_RASTER_DISTANCE,
+    GL_CURRENT_RASTER_INDEX,
+    GL_CURRENT_RASTER_POSITION,
+    GL_CURRENT_RASTER_POSITION_VALID,
+    GL_CURRENT_RASTER_TEXTURE_COORDS,
+    GL_CURRENT_TEXTURE_COORDS,
+    GL_CW,
+    GL_DECAL,
+    GL_DECR,
+    GL_DEPTH,
+    GL_DEPTH_BIAS,
+    GL_DEPTH_BITS,
+    GL_DEPTH_BUFFER_BIT,
+    GL_DEPTH_CLEAR_VALUE,
+    GL_DEPTH_COMPONENT,
+    GL_DEPTH_FUNC,
+    GL_DEPTH_RANGE,
+    GL_DEPTH_SCALE,
+    GL_DEPTH_TEST,
+    GL_DEPTH_WRITEMASK,
+    GL_DIFFUSE,
+    GL_DITHER,
+    GL_DOMAIN,
+    GL_DONT_CARE,
+    GL_DOUBLE,
+    GL_DOUBLEBUFFER,
+#ifndef __WXGTK__
+    GL_DOUBLE_EXT,
+#endif
+    GL_DRAW_BUFFER,
+    GL_DRAW_PIXEL_TOKEN,
+    GL_DST_ALPHA,
+    GL_DST_COLOR,
+    GL_EDGE_FLAG,
+    GL_EDGE_FLAG_ARRAY,
+    GL_EDGE_FLAG_ARRAY_COUNT_EXT,
+    GL_EDGE_FLAG_ARRAY_EXT,
+    GL_EDGE_FLAG_ARRAY_POINTER,
+    GL_EDGE_FLAG_ARRAY_POINTER_EXT,
+    GL_EDGE_FLAG_ARRAY_STRIDE,
+    GL_EDGE_FLAG_ARRAY_STRIDE_EXT,
+    GL_EMISSION,
+    GL_ENABLE_BIT,
+    GL_EQUAL,
+    GL_EQUIV,
+    GL_EVAL_BIT,
+    GL_EXP,
+    GL_EXP2,
+    GL_EXTENSIONS,
+#ifndef __WXGTK__
+    GL_EXT_bgra,
+#endif
+    GL_EXT_paletted_texture,
+    GL_EXT_vertex_array,
+    GL_EYE_LINEAR,
+    GL_EYE_PLANE,
+    GL_FALSE,
+    GL_FASTEST,
+    GL_FEEDBACK,
+    GL_FEEDBACK_BUFFER_POINTER,
+    GL_FEEDBACK_BUFFER_SIZE,
+    GL_FEEDBACK_BUFFER_TYPE,
+    GL_FILL,
+    GL_FLAT,
+    GL_FLOAT,
+    GL_FOG,
+    GL_FOG_BIT,
+    GL_FOG_COLOR,
+    GL_FOG_DENSITY,
+    GL_FOG_END,
+    GL_FOG_HINT,
+    GL_FOG_INDEX,
+    GL_FOG_MODE,
+    GL_FOG_START,
+    GL_FRONT,
+    GL_FRONT_AND_BACK,
+    GL_FRONT_FACE,
+    GL_FRONT_LEFT,
+    GL_FRONT_RIGHT,
+    GL_GEQUAL,
+    GL_GREATER,
+    GL_GREEN,
+    GL_GREEN_BIAS,
+    GL_GREEN_BITS,
+    GL_GREEN_SCALE,
+    GL_HINT_BIT,
+    GL_INCR,
+    GL_INDEX_ARRAY,
+    GL_INDEX_ARRAY_COUNT_EXT,
+    GL_INDEX_ARRAY_EXT,
+    GL_INDEX_ARRAY_POINTER,
+    GL_INDEX_ARRAY_POINTER_EXT,
+    GL_INDEX_ARRAY_STRIDE,
+    GL_INDEX_ARRAY_STRIDE_EXT,
+    GL_INDEX_ARRAY_TYPE,
+    GL_INDEX_ARRAY_TYPE_EXT,
+    GL_INDEX_BITS,
+    GL_INDEX_CLEAR_VALUE,
+    GL_INDEX_LOGIC_OP,
+    GL_INDEX_MODE,
+    GL_INDEX_OFFSET,
+    GL_INDEX_SHIFT,
+    GL_INDEX_WRITEMASK,
+    GL_INT,
+    GL_INTENSITY,
+    GL_INTENSITY12,
+    GL_INTENSITY16,
+    GL_INTENSITY4,
+    GL_INTENSITY8,
+    GL_INVALID_ENUM,
+    GL_INVALID_OPERATION,
+    GL_INVALID_VALUE,
+    GL_INVERT,
+    GL_KEEP,
+    GL_LEFT,
+    GL_LEQUAL,
+    GL_LESS,
+    GL_LIGHT0,
+    GL_LIGHT1,
+    GL_LIGHT2,
+    GL_LIGHT3,
+    GL_LIGHT4,
+    GL_LIGHT5,
+    GL_LIGHT6,
+    GL_LIGHT7,
+    GL_LIGHTING,
+    GL_LIGHTING_BIT,
+    GL_LIGHT_MODEL_AMBIENT,
+    GL_LIGHT_MODEL_LOCAL_VIEWER,
+    GL_LIGHT_MODEL_TWO_SIDE,
+    GL_LINE,
+    GL_LINEAR,
+    GL_LINEAR_ATTENUATION,
+    GL_LINEAR_MIPMAP_LINEAR,
+    GL_LINEAR_MIPMAP_NEAREST,
+    GL_LINES,
+    GL_LINE_BIT,
+    GL_LINE_LOOP,
+    GL_LINE_RESET_TOKEN,
+    GL_LINE_SMOOTH,
+    GL_LINE_SMOOTH_HINT,
+    GL_LINE_STIPPLE,
+    GL_LINE_STIPPLE_PATTERN,
+    GL_LINE_STIPPLE_REPEAT,
+    GL_LINE_STRIP,
+    GL_LINE_TOKEN,
+    GL_LINE_WIDTH,
+    GL_LINE_WIDTH_GRANULARITY,
+    GL_LINE_WIDTH_RANGE,
+    GL_LIST_BASE,
+    GL_LIST_BIT,
+    GL_LIST_INDEX,
+    GL_LIST_MODE,
+    GL_LOAD,
+    GL_LOGIC_OP,
+    GL_LOGIC_OP_MODE,
+    GL_LUMINANCE,
+    GL_LUMINANCE12,
+    GL_LUMINANCE12_ALPHA12,
+    GL_LUMINANCE12_ALPHA4,
+    GL_LUMINANCE16,
+    GL_LUMINANCE16_ALPHA16,
+    GL_LUMINANCE4,
+    GL_LUMINANCE4_ALPHA4,
+    GL_LUMINANCE6_ALPHA2,
+    GL_LUMINANCE8,
+    GL_LUMINANCE8_ALPHA8,
+    GL_LUMINANCE_ALPHA,
+    GL_MAP1_COLOR_4,
+    GL_MAP1_GRID_DOMAIN,
+    GL_MAP1_GRID_SEGMENTS,
+    GL_MAP1_INDEX,
+    GL_MAP1_NORMAL,
+    GL_MAP1_TEXTURE_COORD_1,
+    GL_MAP1_TEXTURE_COORD_2,
+    GL_MAP1_TEXTURE_COORD_3,
+    GL_MAP1_TEXTURE_COORD_4,
+    GL_MAP1_VERTEX_3,
+    GL_MAP1_VERTEX_4,
+    GL_MAP2_COLOR_4,
+    GL_MAP2_GRID_DOMAIN,
+    GL_MAP2_GRID_SEGMENTS,
+    GL_MAP2_INDEX,
+    GL_MAP2_NORMAL,
+    GL_MAP2_TEXTURE_COORD_1,
+    GL_MAP2_TEXTURE_COORD_2,
+    GL_MAP2_TEXTURE_COORD_3,
+    GL_MAP2_TEXTURE_COORD_4,
+    GL_MAP2_VERTEX_3,
+    GL_MAP2_VERTEX_4,
+    GL_MAP_COLOR,
+    GL_MAP_STENCIL,
+    GL_MATRIX_MODE,
+    GL_MAX_ATTRIB_STACK_DEPTH,
+    GL_MAX_CLIENT_ATTRIB_STACK_DEPTH,
+    GL_MAX_CLIP_PLANES,
+    GL_MAX_EVAL_ORDER,
+    GL_MAX_LIGHTS,
+    GL_MAX_LIST_NESTING,
+    GL_MAX_MODELVIEW_STACK_DEPTH,
+    GL_MAX_NAME_STACK_DEPTH,
+    GL_MAX_PIXEL_MAP_TABLE,
+    GL_MAX_PROJECTION_STACK_DEPTH,
+    GL_MAX_TEXTURE_SIZE,
+    GL_MAX_TEXTURE_STACK_DEPTH,
+    GL_MAX_VIEWPORT_DIMS,
+    GL_MODELVIEW,
+    GL_MODELVIEW_MATRIX,
+    GL_MODELVIEW_STACK_DEPTH,
+    GL_MODULATE,
+    GL_MULT,
+    GL_N3F_V3F,
+    GL_NAME_STACK_DEPTH,
+    GL_NAND,
+    GL_NEAREST,
+    GL_NEAREST_MIPMAP_LINEAR,
+    GL_NEAREST_MIPMAP_NEAREST,
+    GL_NEVER,
+    GL_NICEST,
+    GL_NONE,
+    GL_NOOP,
+    GL_NOR,
+    GL_NORMALIZE,
+    GL_NORMAL_ARRAY,
+    GL_NORMAL_ARRAY_COUNT_EXT,
+    GL_NORMAL_ARRAY_EXT,
+    GL_NORMAL_ARRAY_POINTER,
+    GL_NORMAL_ARRAY_POINTER_EXT,
+    GL_NORMAL_ARRAY_STRIDE,
+    GL_NORMAL_ARRAY_STRIDE_EXT,
+    GL_NORMAL_ARRAY_TYPE,
+    GL_NORMAL_ARRAY_TYPE_EXT,
+    GL_NOTEQUAL,
+    GL_NO_ERROR,
+    GL_OBJECT_LINEAR,
+    GL_OBJECT_PLANE,
+    GL_ONE,
+    GL_ONE_MINUS_DST_ALPHA,
+    GL_ONE_MINUS_DST_COLOR,
+    GL_ONE_MINUS_SRC_ALPHA,
+    GL_ONE_MINUS_SRC_COLOR,
+    GL_OR,
+    GL_ORDER,
+    GL_OR_INVERTED,
+    GL_OR_REVERSE,
+    GL_OUT_OF_MEMORY,
+    GL_PACK_ALIGNMENT,
+    GL_PACK_LSB_FIRST,
+    GL_PACK_ROW_LENGTH,
+    GL_PACK_SKIP_PIXELS,
+    GL_PACK_SKIP_ROWS,
+    GL_PACK_SWAP_BYTES,
+    GL_PASS_THROUGH_TOKEN,
+    GL_PERSPECTIVE_CORRECTION_HINT,
+    GL_PIXEL_MAP_A_TO_A,
+    GL_PIXEL_MAP_A_TO_A_SIZE,
+    GL_PIXEL_MAP_B_TO_B,
+    GL_PIXEL_MAP_B_TO_B_SIZE,
+    GL_PIXEL_MAP_G_TO_G,
+    GL_PIXEL_MAP_G_TO_G_SIZE,
+    GL_PIXEL_MAP_I_TO_A,
+    GL_PIXEL_MAP_I_TO_A_SIZE,
+    GL_PIXEL_MAP_I_TO_B,
+    GL_PIXEL_MAP_I_TO_B_SIZE,
+    GL_PIXEL_MAP_I_TO_G,
+    GL_PIXEL_MAP_I_TO_G_SIZE,
+    GL_PIXEL_MAP_I_TO_I,
+    GL_PIXEL_MAP_I_TO_I_SIZE,
+    GL_PIXEL_MAP_I_TO_R,
+    GL_PIXEL_MAP_I_TO_R_SIZE,
+    GL_PIXEL_MAP_R_TO_R,
+    GL_PIXEL_MAP_R_TO_R_SIZE,
+    GL_PIXEL_MAP_S_TO_S,
+    GL_PIXEL_MAP_S_TO_S_SIZE,
+    GL_PIXEL_MODE_BIT,
+    GL_POINT,
+    GL_POINTS,
+    GL_POINT_BIT,
+    GL_POINT_SIZE,
+    GL_POINT_SIZE_GRANULARITY,
+    GL_POINT_SIZE_RANGE,
+    GL_POINT_SMOOTH,
+    GL_POINT_SMOOTH_HINT,
+    GL_POINT_TOKEN,
+    GL_POLYGON,
+    GL_POLYGON_BIT,
+    GL_POLYGON_MODE,
+    GL_POLYGON_OFFSET_FACTOR,
+    GL_POLYGON_OFFSET_FILL,
+    GL_POLYGON_OFFSET_LINE,
+    GL_POLYGON_OFFSET_POINT,
+    GL_POLYGON_OFFSET_UNITS,
+    GL_POLYGON_SMOOTH,
+    GL_POLYGON_SMOOTH_HINT,
+    GL_POLYGON_STIPPLE,
+    GL_POLYGON_STIPPLE_BIT,
+    GL_POLYGON_TOKEN,
+    GL_POSITION,
+    GL_PROJECTION,
+    GL_PROJECTION_MATRIX,
+    GL_PROJECTION_STACK_DEPTH,
+    GL_PROXY_TEXTURE_1D,
+    GL_PROXY_TEXTURE_2D,
+    GL_Q,
+    GL_QUADRATIC_ATTENUATION,
+    GL_QUADS,
+    GL_QUAD_STRIP,
+    GL_R,
+    GL_R3_G3_B2,
+    GL_READ_BUFFER,
+    GL_RED,
+    GL_RED_BIAS,
+    GL_RED_BITS,
+    GL_RED_SCALE,
+    GL_RENDER,
+    GL_RENDERER,
+    GL_RENDER_MODE,
+    GL_REPEAT,
+    GL_REPLACE,
+    GL_RETURN,
+    GL_RGB,
+    GL_RGB10,
+    GL_RGB10_A2,
+    GL_RGB12,
+    GL_RGB16,
+    GL_RGB4,
+    GL_RGB5,
+    GL_RGB5_A1,
+    GL_RGB8,
+    GL_RGBA,
+    GL_RGBA12,
+    GL_RGBA16,
+    GL_RGBA2,
+    GL_RGBA4,
+    GL_RGBA8,
+    GL_RGBA_MODE,
+    GL_RIGHT,
+    GL_S,
+    GL_SCISSOR_BIT,
+    GL_SCISSOR_BOX,
+    GL_SCISSOR_TEST,
+    GL_SELECT,
+    GL_SELECTION_BUFFER_POINTER,
+    GL_SELECTION_BUFFER_SIZE,
+    GL_SET,
+    GL_SHADE_MODEL,
+    GL_SHININESS,
+    GL_SHORT,
+    GL_SMOOTH,
+    GL_SPECULAR,
+    GL_SPHERE_MAP,
+    GL_SPOT_CUTOFF,
+    GL_SPOT_DIRECTION,
+    GL_SPOT_EXPONENT,
+    GL_SRC_ALPHA,
+    GL_SRC_ALPHA_SATURATE,
+    GL_SRC_COLOR,
+    GL_STACK_OVERFLOW,
+    GL_STACK_UNDERFLOW,
+    GL_STENCIL,
+    GL_STENCIL_BITS,
+    GL_STENCIL_BUFFER_BIT,
+    GL_STENCIL_CLEAR_VALUE,
+    GL_STENCIL_FAIL,
+    GL_STENCIL_FUNC,
+    GL_STENCIL_INDEX,
+    GL_STENCIL_PASS_DEPTH_FAIL,
+    GL_STENCIL_PASS_DEPTH_PASS,
+    GL_STENCIL_REF,
+    GL_STENCIL_TEST,
+    GL_STENCIL_VALUE_MASK,
+    GL_STENCIL_WRITEMASK,
+    GL_STEREO,
+    GL_SUBPIXEL_BITS,
+    GL_T,
+    GL_T2F_C3F_V3F,
+    GL_T2F_C4F_N3F_V3F,
+    GL_T2F_C4UB_V3F,
+    GL_T2F_N3F_V3F,
+    GL_T2F_V3F,
+    GL_T4F_C4F_N3F_V4F,
+    GL_T4F_V4F,
+    GL_TEXTURE,
+    GL_TEXTURE_1D,
+    GL_TEXTURE_2D,
+    GL_TEXTURE_ALPHA_SIZE,
+    GL_TEXTURE_BINDING_1D,
+    GL_TEXTURE_BINDING_2D,
+    GL_TEXTURE_BIT,
+    GL_TEXTURE_BLUE_SIZE,
+    GL_TEXTURE_BORDER,
+    GL_TEXTURE_BORDER_COLOR,
+    GL_TEXTURE_COMPONENTS,
+    GL_TEXTURE_COORD_ARRAY,
+    GL_TEXTURE_COORD_ARRAY_COUNT_EXT,
+    GL_TEXTURE_COORD_ARRAY_EXT,
+    GL_TEXTURE_COORD_ARRAY_POINTER,
+    GL_TEXTURE_COORD_ARRAY_POINTER_EXT,
+    GL_TEXTURE_COORD_ARRAY_SIZE,
+    GL_TEXTURE_COORD_ARRAY_SIZE_EXT,
+    GL_TEXTURE_COORD_ARRAY_STRIDE,
+    GL_TEXTURE_COORD_ARRAY_STRIDE_EXT,
+    GL_TEXTURE_COORD_ARRAY_TYPE,
+    GL_TEXTURE_COORD_ARRAY_TYPE_EXT,
+    GL_TEXTURE_ENV,
+    GL_TEXTURE_ENV_COLOR,
+    GL_TEXTURE_ENV_MODE,
+    GL_TEXTURE_GEN_MODE,
+    GL_TEXTURE_GEN_Q,
+    GL_TEXTURE_GEN_R,
+    GL_TEXTURE_GEN_S,
+    GL_TEXTURE_GEN_T,
+    GL_TEXTURE_GREEN_SIZE,
+    GL_TEXTURE_HEIGHT,
+    GL_TEXTURE_INTENSITY_SIZE,
+    GL_TEXTURE_INTERNAL_FORMAT,
+    GL_TEXTURE_LUMINANCE_SIZE,
+    GL_TEXTURE_MAG_FILTER,
+    GL_TEXTURE_MATRIX,
+    GL_TEXTURE_MIN_FILTER,
+    GL_TEXTURE_PRIORITY,
+    GL_TEXTURE_RED_SIZE,
+    GL_TEXTURE_RESIDENT,
+    GL_TEXTURE_STACK_DEPTH,
+    GL_TEXTURE_WIDTH,
+    GL_TEXTURE_WRAP_S,
+    GL_TEXTURE_WRAP_T,
+    GL_TRANSFORM_BIT,
+    GL_TRIANGLES,
+    GL_TRIANGLE_FAN,
+    GL_TRIANGLE_STRIP,
+    GL_TRUE,
+    GL_UNPACK_ALIGNMENT,
+    GL_UNPACK_LSB_FIRST,
+    GL_UNPACK_ROW_LENGTH,
+    GL_UNPACK_SKIP_PIXELS,
+    GL_UNPACK_SKIP_ROWS,
+    GL_UNPACK_SWAP_BYTES,
+    GL_UNSIGNED_BYTE,
+    GL_UNSIGNED_INT,
+    GL_UNSIGNED_SHORT,
+    GL_V2F,
+    GL_V3F,
+    GL_VENDOR,
+    GL_VERSION,
+    GL_VERTEX_ARRAY,
+    GL_VERTEX_ARRAY_COUNT_EXT,
+    GL_VERTEX_ARRAY_EXT,
+    GL_VERTEX_ARRAY_POINTER,
+    GL_VERTEX_ARRAY_POINTER_EXT,
+    GL_VERTEX_ARRAY_SIZE,
+    GL_VERTEX_ARRAY_SIZE_EXT,
+    GL_VERTEX_ARRAY_STRIDE,
+    GL_VERTEX_ARRAY_STRIDE_EXT,
+    GL_VERTEX_ARRAY_TYPE,
+    GL_VERTEX_ARRAY_TYPE_EXT,
+    GL_VIEWPORT,
+    GL_VIEWPORT_BIT,
+    GL_XOR,
+    GL_ZERO,
+    GL_ZOOM_X,
+    GL_ZOOM_Y,
+};
+
+
+void glAccum (GLenum op, GLfloat value);
+void glAlphaFunc (GLenum func, GLclampf ref);
+GLboolean glAreTexturesResident (GLsizei n, const GLuint *textures, GLboolean *residences);
+void glArrayElement (GLint i);
+void glBegin (GLenum mode);
+void glBindTexture (GLenum target, GLuint texture);
+void glBitmap (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);
+void glBlendFunc (GLenum sfactor, GLenum dfactor);
+void glCallList (GLuint list);
+void glCallLists (GLsizei n, GLenum type, const GLvoid *lists);
+void glClear (GLbitfield mask);
+void glClearAccum (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+void glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+void glClearDepth (GLclampd depth);
+void glClearIndex (GLfloat c);
+void glClearStencil (GLint s);
+void glClipPlane (GLenum plane, const GLdouble *equation);
+void glColor3b (GLbyte red, GLbyte green, GLbyte blue);
+void glColor3bv (const GLbyte *v);
+void glColor3d (GLdouble red, GLdouble green, GLdouble blue);
+void glColor3dv (const GLdouble *v);
+void glColor3f (GLfloat red, GLfloat green, GLfloat blue);
+void glColor3fv (const GLfloat *v);
+void glColor3i (GLint red, GLint green, GLint blue);
+void glColor3iv (const GLint *v);
+void glColor3s (GLshort red, GLshort green, GLshort blue);
+void glColor3sv (const GLshort *v);
+void glColor3ub (GLubyte red, GLubyte green, GLubyte blue);
+void glColor3ubv (const GLubyte *v);
+void glColor3ui (GLuint red, GLuint green, GLuint blue);
+void glColor3uiv (const GLuint *v);
+void glColor3us (GLushort red, GLushort green, GLushort blue);
+void glColor3usv (const GLushort *v);
+void glColor4b (GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
+void glColor4bv (const GLbyte *v);
+void glColor4d (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
+void glColor4dv (const GLdouble *v);
+void glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+void glColor4fv (const GLfloat *v);
+void glColor4i (GLint red, GLint green, GLint blue, GLint alpha);
+void glColor4iv (const GLint *v);
+void glColor4s (GLshort red, GLshort green, GLshort blue, GLshort alpha);
+void glColor4sv (const GLshort *v);
+void glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
+void glColor4ubv (const GLubyte *v);
+void glColor4ui (GLuint red, GLuint green, GLuint blue, GLuint alpha);
+void glColor4uiv (const GLuint *v);
+void glColor4us (GLushort red, GLushort green, GLushort blue, GLushort alpha);
+void glColor4usv (const GLushort *v);
+void glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+void glColorMaterial (GLenum face, GLenum mode);
+void glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+void glCopyPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
+void glCopyTexImage1D (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border);
+void glCopyTexImage2D (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+void glCopyTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
+void glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+void glCullFace (GLenum mode);
+void glDeleteLists (GLuint list, GLsizei range);
+void glDeleteTextures (GLsizei n, const GLuint *textures);
+void glDepthFunc (GLenum func);
+void glDepthMask (GLboolean flag);
+void glDepthRange (GLclampd zNear, GLclampd zFar);
+void glDisable (GLenum cap);
+void glDisableClientState (GLenum array);
+void glDrawArrays (GLenum mode, GLint first, GLsizei count);
+void glDrawBuffer (GLenum mode);
+void glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
+void glDrawPixels (GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
+void glEdgeFlag (GLboolean flag);
+void glEdgeFlagPointer (GLsizei stride, const GLvoid *pointer);
+void glEdgeFlagv (const GLboolean *flag);
+void glEnable (GLenum cap);
+void glEnableClientState (GLenum array);
+void glEnd (void);
+void glEndList (void);
+void glEvalCoord1d (GLdouble u);
+void glEvalCoord1dv (const GLdouble *u);
+void glEvalCoord1f (GLfloat u);
+void glEvalCoord1fv (const GLfloat *u);
+void glEvalCoord2d (GLdouble u, GLdouble v);
+void glEvalCoord2dv (const GLdouble *u);
+void glEvalCoord2f (GLfloat u, GLfloat v);
+void glEvalCoord2fv (const GLfloat *u);
+void glEvalMesh1 (GLenum mode, GLint i1, GLint i2);
+void glEvalMesh2 (GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
+void glEvalPoint1 (GLint i);
+void glEvalPoint2 (GLint i, GLint j);
+void glFeedbackBuffer (GLsizei size, GLenum type, GLfloat *buffer);
+void glFinish (void);
+void glFlush (void);
+void glFogf (GLenum pname, GLfloat param);
+void glFogfv (GLenum pname, const GLfloat *params);
+void glFogi (GLenum pname, GLint param);
+void glFogiv (GLenum pname, const GLint *params);
+void glFrontFace (GLenum mode);
+void glFrustum (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
+GLuint glGenLists (GLsizei range);
+void glGenTextures (GLsizei n, GLuint *textures);
+void glGetBooleanv (GLenum pname, GLboolean *params);
+void glGetClipPlane (GLenum plane, GLdouble *equation);
+void glGetDoublev (GLenum pname, GLdouble *params);
+GLenum glGetError (void);
+void glGetFloatv (GLenum pname, GLfloat *params);
+void glGetIntegerv (GLenum pname, GLint *params);
+void glGetLightfv (GLenum light, GLenum pname, GLfloat *params);
+void glGetLightiv (GLenum light, GLenum pname, GLint *params);
+void glGetMapdv (GLenum target, GLenum query, GLdouble *v);
+void glGetMapfv (GLenum target, GLenum query, GLfloat *v);
+void glGetMapiv (GLenum target, GLenum query, GLint *v);
+void glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params);
+void glGetMaterialiv (GLenum face, GLenum pname, GLint *params);
+void glGetPixelMapfv (GLenum map, GLfloat *values);
+void glGetPixelMapuiv (GLenum map, GLuint *values);
+void glGetPixelMapusv (GLenum map, GLushort *values);
+void glGetPointerv (GLenum pname, GLvoid* *params);
+void glGetPolygonStipple (GLubyte *mask);
+const GLubyte * glGetString (GLenum name);
+void glGetTexEnvfv (GLenum target, GLenum pname, GLfloat *params);
+void glGetTexEnviv (GLenum target, GLenum pname, GLint *params);
+void glGetTexGendv (GLenum coord, GLenum pname, GLdouble *params);
+void glGetTexGenfv (GLenum coord, GLenum pname, GLfloat *params);
+void glGetTexGeniv (GLenum coord, GLenum pname, GLint *params);
+void glGetTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
+void glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params);
+void glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params);
+void glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
+void glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);
+void glHint (GLenum target, GLenum mode);
+void glIndexMask (GLuint mask);
+void glIndexPointer (GLenum type, GLsizei stride, const GLvoid *pointer);
+void glIndexd (GLdouble c);
+void glIndexdv (const GLdouble *c);
+void glIndexf (GLfloat c);
+void glIndexfv (const GLfloat *c);
+void glIndexi (GLint c);
+void glIndexiv (const GLint *c);
+void glIndexs (GLshort c);
+void glIndexsv (const GLshort *c);
+void glIndexub (GLubyte c);
+void glIndexubv (const GLubyte *c);
+void glInitNames (void);
+void glInterleavedArrays (GLenum format, GLsizei stride, const GLvoid *pointer);
+GLboolean glIsEnabled (GLenum cap);
+GLboolean glIsList (GLuint list);
+GLboolean glIsTexture (GLuint texture);
+void glLightModelf (GLenum pname, GLfloat param);
+void glLightModelfv (GLenum pname, const GLfloat *params);
+void glLightModeli (GLenum pname, GLint param);
+void glLightModeliv (GLenum pname, const GLint *params);
+void glLightf (GLenum light, GLenum pname, GLfloat param);
+void glLightfv (GLenum light, GLenum pname, const GLfloat *params);
+void glLighti (GLenum light, GLenum pname, GLint param);
+void glLightiv (GLenum light, GLenum pname, const GLint *params);
+void glLineStipple (GLint factor, GLushort pattern);
+void glLineWidth (GLfloat width);
+void glListBase (GLuint base);
+void glLoadIdentity (void);
+void glLoadMatrixd (const GLdouble *m);
+void glLoadMatrixf (const GLfloat *m);
+void glLoadName (GLuint name);
+void glLogicOp (GLenum opcode);
+void glMap1d (GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
+void glMap1f (GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
+void glMap2d (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
+void glMap2f (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
+void glMapGrid1d (GLint un, GLdouble u1, GLdouble u2);
+void glMapGrid1f (GLint un, GLfloat u1, GLfloat u2);
+void glMapGrid2d (GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
+void glMapGrid2f (GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
+void glMaterialf (GLenum face, GLenum pname, GLfloat param);
+void glMaterialfv (GLenum face, GLenum pname, const GLfloat *params);
+void glMateriali (GLenum face, GLenum pname, GLint param);
+void glMaterialiv (GLenum face, GLenum pname, const GLint *params);
+void glMatrixMode (GLenum mode);
+void glMultMatrixd (const GLdouble *m);
+void glMultMatrixf (const GLfloat *m);
+void glNewList (GLuint list, GLenum mode);
+void glNormal3b (GLbyte nx, GLbyte ny, GLbyte nz);
+void glNormal3bv (const GLbyte *v);
+void glNormal3d (GLdouble nx, GLdouble ny, GLdouble nz);
+void glNormal3dv (const GLdouble *v);
+void glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz);
+void glNormal3fv (const GLfloat *v);
+void glNormal3i (GLint nx, GLint ny, GLint nz);
+void glNormal3iv (const GLint *v);
+void glNormal3s (GLshort nx, GLshort ny, GLshort nz);
+void glNormal3sv (const GLshort *v);
+void glNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer);
+void glOrtho (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
+void glPassThrough (GLfloat token);
+void glPixelMapfv (GLenum map, GLsizei mapsize, const GLfloat *values);
+void glPixelMapuiv (GLenum map, GLsizei mapsize, const GLuint *values);
+void glPixelMapusv (GLenum map, GLsizei mapsize, const GLushort *values);
+void glPixelStoref (GLenum pname, GLfloat param);
+void glPixelStorei (GLenum pname, GLint param);
+void glPixelTransferf (GLenum pname, GLfloat param);
+void glPixelTransferi (GLenum pname, GLint param);
+void glPixelZoom (GLfloat xfactor, GLfloat yfactor);
+void glPointSize (GLfloat size);
+void glPolygonMode (GLenum face, GLenum mode);
+void glPolygonOffset (GLfloat factor, GLfloat units);
+void glPolygonStipple (const GLubyte *mask);
+void glPopAttrib (void);
+void glPopClientAttrib (void);
+void glPopMatrix (void);
+void glPopName (void);
+void glPrioritizeTextures (GLsizei n, const GLuint *textures, const GLclampf *priorities);
+void glPushAttrib (GLbitfield mask);
+void glPushClientAttrib (GLbitfield mask);
+void glPushMatrix (void);
+void glPushName (GLuint name);
+void glRasterPos2d (GLdouble x, GLdouble y);
+void glRasterPos2dv (const GLdouble *v);
+void glRasterPos2f (GLfloat x, GLfloat y);
+void glRasterPos2fv (const GLfloat *v);
+void glRasterPos2i (GLint x, GLint y);
+void glRasterPos2iv (const GLint *v);
+void glRasterPos2s (GLshort x, GLshort y);
+void glRasterPos2sv (const GLshort *v);
+void glRasterPos3d (GLdouble x, GLdouble y, GLdouble z);
+void glRasterPos3dv (const GLdouble *v);
+void glRasterPos3f (GLfloat x, GLfloat y, GLfloat z);
+void glRasterPos3fv (const GLfloat *v);
+void glRasterPos3i (GLint x, GLint y, GLint z);
+void glRasterPos3iv (const GLint *v);
+void glRasterPos3s (GLshort x, GLshort y, GLshort z);
+void glRasterPos3sv (const GLshort *v);
+void glRasterPos4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+void glRasterPos4dv (const GLdouble *v);
+void glRasterPos4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+void glRasterPos4fv (const GLfloat *v);
+void glRasterPos4i (GLint x, GLint y, GLint z, GLint w);
+void glRasterPos4iv (const GLint *v);
+void glRasterPos4s (GLshort x, GLshort y, GLshort z, GLshort w);
+void glRasterPos4sv (const GLshort *v);
+void glReadBuffer (GLenum mode);
+void glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
+void glRectd (GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
+void glRectdv (const GLdouble *v1, const GLdouble *v2);
+void glRectf (GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
+void glRectfv (const GLfloat *v1, const GLfloat *v2);
+void glRecti (GLint x1, GLint y1, GLint x2, GLint y2);
+void glRectiv (const GLint *v1, const GLint *v2);
+void glRects (GLshort x1, GLshort y1, GLshort x2, GLshort y2);
+void glRectsv (const GLshort *v1, const GLshort *v2);
+GLint glRenderMode (GLenum mode);
+void glRotated (GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
+void glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
+void glScaled (GLdouble x, GLdouble y, GLdouble z);
+void glScalef (GLfloat x, GLfloat y, GLfloat z);
+void glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
+void glSelectBuffer (GLsizei size, GLuint *buffer);
+void glShadeModel (GLenum mode);
+void glStencilFunc (GLenum func, GLint ref, GLuint mask);
+void glStencilMask (GLuint mask);
+void glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
+void glTexCoord1d (GLdouble s);
+void glTexCoord1dv (const GLdouble *v);
+void glTexCoord1f (GLfloat s);
+void glTexCoord1fv (const GLfloat *v);
+void glTexCoord1i (GLint s);
+void glTexCoord1iv (const GLint *v);
+void glTexCoord1s (GLshort s);
+void glTexCoord1sv (const GLshort *v);
+void glTexCoord2d (GLdouble s, GLdouble t);
+void glTexCoord2dv (const GLdouble *v);
+void glTexCoord2f (GLfloat s, GLfloat t);
+void glTexCoord2fv (const GLfloat *v);
+void glTexCoord2i (GLint s, GLint t);
+void glTexCoord2iv (const GLint *v);
+void glTexCoord2s (GLshort s, GLshort t);
+void glTexCoord2sv (const GLshort *v);
+void glTexCoord3d (GLdouble s, GLdouble t, GLdouble r);
+void glTexCoord3dv (const GLdouble *v);
+void glTexCoord3f (GLfloat s, GLfloat t, GLfloat r);
+void glTexCoord3fv (const GLfloat *v);
+void glTexCoord3i (GLint s, GLint t, GLint r);
+void glTexCoord3iv (const GLint *v);
+void glTexCoord3s (GLshort s, GLshort t, GLshort r);
+void glTexCoord3sv (const GLshort *v);
+void glTexCoord4d (GLdouble s, GLdouble t, GLdouble r, GLdouble q);
+void glTexCoord4dv (const GLdouble *v);
+void glTexCoord4f (GLfloat s, GLfloat t, GLfloat r, GLfloat q);
+void glTexCoord4fv (const GLfloat *v);
+void glTexCoord4i (GLint s, GLint t, GLint r, GLint q);
+void glTexCoord4iv (const GLint *v);
+void glTexCoord4s (GLshort s, GLshort t, GLshort r, GLshort q);
+void glTexCoord4sv (const GLshort *v);
+void glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+void glTexEnvf (GLenum target, GLenum pname, GLfloat param);
+void glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params);
+void glTexEnvi (GLenum target, GLenum pname, GLint param);
+void glTexEnviv (GLenum target, GLenum pname, const GLint *params);
+void glTexGend (GLenum coord, GLenum pname, GLdouble param);
+void glTexGendv (GLenum coord, GLenum pname, const GLdouble *params);
+void glTexGenf (GLenum coord, GLenum pname, GLfloat param);
+void glTexGenfv (GLenum coord, GLenum pname, const GLfloat *params);
+void glTexGeni (GLenum coord, GLenum pname, GLint param);
+void glTexGeniv (GLenum coord, GLenum pname, const GLint *params);
+void glTexImage1D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+void glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+void glTexParameterf (GLenum target, GLenum pname, GLfloat param);
+void glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params);
+void glTexParameteri (GLenum target, GLenum pname, GLint param);
+void glTexParameteriv (GLenum target, GLenum pname, const GLint *params);
+void glTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
+void glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
+void glTranslated (GLdouble x, GLdouble y, GLdouble z);
+void glTranslatef (GLfloat x, GLfloat y, GLfloat z);
+void glVertex2d (GLdouble x, GLdouble y);
+void glVertex2dv (const GLdouble *v);
+void glVertex2f (GLfloat x, GLfloat y);
+void glVertex2fv (const GLfloat *v);
+void glVertex2i (GLint x, GLint y);
+void glVertex2iv (const GLint *v);
+void glVertex2s (GLshort x, GLshort y);
+void glVertex2sv (const GLshort *v);
+void glVertex3d (GLdouble x, GLdouble y, GLdouble z);
+void glVertex3dv (const GLdouble *v);
+void glVertex3f (GLfloat x, GLfloat y, GLfloat z);
+void glVertex3fv (const GLfloat *v);
+void glVertex3i (GLint x, GLint y, GLint z);
+void glVertex3iv (const GLint *v);
+void glVertex3s (GLshort x, GLshort y, GLshort z);
+void glVertex3sv (const GLshort *v);
+void glVertex4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+void glVertex4dv (const GLdouble *v);
+void glVertex4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+void glVertex4fv (const GLfloat *v);
+void glVertex4i (GLint x, GLint y, GLint z, GLint w);
+void glVertex4iv (const GLint *v);
+void glVertex4s (GLshort x, GLshort y, GLshort z, GLshort w);
+void glVertex4sv (const GLshort *v);
+void glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+void glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
+
+//---------------------------------------------------------------------------
+
+%init %{
+
+    wxClassInfo::CleanUpClasses();
+    wxClassInfo::InitializeClasses();
+
+%}
+
+//---------------------------------------------------------------------------
+//---------------------------------------------------------------------------
diff --git a/utils/wxPython/modules/glcanvas/glcanvasc.def b/utils/wxPython/modules/glcanvas/glcanvasc.def
new file mode 100644 (file)
index 0000000..8be1ced
--- /dev/null
@@ -0,0 +1,2 @@
+EXPORTS
+  initglcanvasc
diff --git a/utils/wxPython/modules/glcanvas/makefile.vc b/utils/wxPython/modules/glcanvas/makefile.vc
new file mode 100644 (file)
index 0000000..09d9d54
--- /dev/null
@@ -0,0 +1,38 @@
+
+#----------------------------------------------------------------------
+
+TARGET = glcanvasc
+
+OBJECTS = glcanvas.obj
+
+PYMODULES = $(TARGETDIR)\html.py $(TARGETDIR)\htmlhelper.py 
+
+SOURCES = $(GENCODEDIR)\html.cpp 
+
+
+#----------------------------------------------------------------------
+
+!include ..\makeinc.vc
+
+# override this
+EXTRAINC = $(EXTRAINC) -I$(WXDIR)\utils\glcanvas\win
+GLLIBS=$(WXDIR)\lib\glcanvas.lib glu32.lib opengl32.lib
+
+#----------------------------------------------------------------------
+
+default: $(TARGETDIR)\$(TARGET).pyd pycfiles
+
+all:    $(TARGET)
+
+#----------------------------------------------------------------------
+
+$(TARGETDIR)\$(TARGET).pyd : $(DUMMYOBJ) $(WXLIB) $(OBJECTS) # $(TARGET).res
+       $(link) @<<
+/out:$@ /dll
+$(LFLAGS) /def:$(TARGET).def /implib:./$(TARGET).lib
+$(DUMMYOBJ) $(OBJECTS) 
+$(LIBS) $(GLLIBS)
+<<
+
+#----------------------------------------------------------------------
+
diff --git a/utils/wxPython/modules/html/BUGS b/utils/wxPython/modules/html/BUGS
new file mode 100644 (file)
index 0000000..bc434f1
--- /dev/null
@@ -0,0 +1,23 @@
+Known bugs
+
+html, all:
+        - keys can move the vertical scrollbar, but the window moveth not.
+        problem in wxHTML.
+
+        - widgets are not removed when the HTML contents is changed
+        (this can be fixed by adding ~HtmlWidgetCell { wnd->Destroy(); } )
+
+        - potential problem with the use of ThreadState in html.i
+        (mainly because I don't really know what I'm doing there)
+
+html, msw:
+        - vertical scrollbar behaves erratically when content smaller than
+        window
+
+        - page with widgets takes forever to draw when constructed
+        in frame constructor
+
+        - sometimes the python scripts with html crash on startup, before
+        the window is displayed (illegal operation). this seems mainly to
+        happen when the various libs are not yet in the disk cache. race
+        condition?
diff --git a/utils/wxPython/modules/html/Makefile.pre.in b/utils/wxPython/modules/html/Makefile.pre.in
new file mode 100644 (file)
index 0000000..9dd1b1c
--- /dev/null
@@ -0,0 +1,363 @@
+# Universal Unix Makefile for Python extensions
+# =============================================
+
+# Short Instructions
+# ------------------
+
+# 1. Build and install Python (1.5 or newer).
+# 2. "make -f Makefile.pre.in boot"
+# 3. "make"
+# You should now have a shared library.
+
+# Long Instructions
+# -----------------
+
+# Build *and install* the basic Python 1.5 distribution.  See the
+# Python README for instructions.  (This version of Makefile.pre.in
+# only withs with Python 1.5, alpha 3 or newer.)
+
+# Create a file Setup.in for your extension.  This file follows the
+# format of the Modules/Setup.in file; see the instructions there.
+# For a simple module called "spam" on file "spammodule.c", it can
+# contain a single line:
+#   spam spammodule.c
+# You can build as many modules as you want in the same directory --
+# just have a separate line for each of them in the Setup.in file.
+
+# If you want to build your extension as a shared library, insert a
+# line containing just the string
+#   *shared*
+# at the top of your Setup.in file.
+
+# Note that the build process copies Setup.in to Setup, and then works
+# with Setup.  It doesn't overwrite Setup when Setup.in is changed, so
+# while you're in the process of debugging your Setup.in file, you may
+# want to edit Setup instead, and copy it back to Setup.in later.
+# (All this is done so you can distribute your extension easily and
+# someone else can select the modules they actually want to build by
+# commenting out lines in the Setup file, without editing the
+# original.  Editing Setup is also used to specify nonstandard
+# locations for include or library files.)
+
+# Copy this file (Misc/Makefile.pre.in) to the directory containing
+# your extension.
+
+# Run "make -f Makefile.pre.in boot".  This creates Makefile
+# (producing Makefile.pre and sedscript as intermediate files) and
+# config.c, incorporating the values for sys.prefix, sys.exec_prefix
+# and sys.version from the installed Python binary.  For this to work,
+# the python binary must be on your path.  If this fails, try
+#   make -f Makefile.pre.in Makefile VERSION=1.5 installdir=<prefix>
+# where <prefix> is the prefix used to install Python for installdir
+# (and possibly similar for exec_installdir=<exec_prefix>).
+
+# Note: "make boot" implies "make clobber" -- it assumes that when you
+# bootstrap you may have changed platforms so it removes all previous
+# output files.
+
+# If you are building your extension as a shared library (your
+# Setup.in file starts with *shared*), run "make" or "make sharedmods"
+# to build the shared library files.  If you are building a statically
+# linked Python binary (the only solution of your platform doesn't
+# support shared libraries, and sometimes handy if you want to
+# distribute or install the resulting Python binary), run "make
+# python".
+
+# Note: Each time you edit Makefile.pre.in or Setup, you must run
+# "make Makefile" before running "make".
+
+# Hint: if you want to use VPATH, you can start in an empty
+# subdirectory and say (e.g.):
+#   make -f ../Makefile.pre.in boot srcdir=.. VPATH=..
+
+
+# === Bootstrap variables (edited through "make boot") ===
+
+# The prefix used by "make inclinstall libainstall" of core python
+installdir=    /usr/local
+
+# The exec_prefix used by the same
+exec_installdir=$(installdir)
+
+# Source directory and VPATH in case you want to use VPATH.
+# (You will have to edit these two lines yourself -- there is no
+# automatic support as the Makefile is not generated by
+# config.status.)
+srcdir=                .
+VPATH=         .
+
+# === Variables that you may want to customize (rarely) ===
+
+# (Static) build target
+TARGET=                python
+
+# Installed python binary (used only by boot target)
+PYTHON=                python
+
+# Add more -I and -D options here
+CFLAGS=                $(OPT) -I$(INCLUDEPY) -I$(EXECINCLUDEPY) $(DEFS)
+
+# These two variables can be set in Setup to merge extensions.
+# See example[23].
+BASELIB=
+BASESETUP=
+
+# === Variables set by makesetup ===
+
+MODOBJS=       _MODOBJS_
+MODLIBS=       _MODLIBS_
+
+# === Definitions added by makesetup ===
+
+# === Variables from configure (through sedscript) ===
+
+VERSION=       @VERSION@
+CC=            @CC@
+LINKCC=                @LINKCC@
+SGI_ABI=       @SGI_ABI@
+OPT=           @OPT@
+LDFLAGS=       @LDFLAGS@
+LDLAST=                @LDLAST@
+DEFS=          @DEFS@
+LIBS=          @LIBS@
+LIBM=          @LIBM@
+LIBC=          @LIBC@
+RANLIB=                @RANLIB@
+MACHDEP=       @MACHDEP@
+SO=            @SO@
+LDSHARED=      @LDSHARED@
+CCSHARED=      @CCSHARED@
+LINKFORSHARED= @LINKFORSHARED@
+#@SET_CCC@
+
+# Install prefix for architecture-independent files
+prefix=                /usr/local
+
+# Install prefix for architecture-dependent files
+exec_prefix=   $(prefix)
+
+# === Fixed definitions ===
+
+# Shell used by make (some versions default to the login shell, which is bad)
+SHELL=         /bin/sh
+
+# Expanded directories
+BINDIR=                $(exec_installdir)/bin
+LIBDIR=                $(exec_prefix)/lib
+MANDIR=                $(installdir)/man
+INCLUDEDIR=    $(installdir)/include
+SCRIPTDIR=     $(prefix)/lib
+
+# Detailed destination directories
+BINLIBDEST=    $(LIBDIR)/python$(VERSION)
+LIBDEST=       $(SCRIPTDIR)/python$(VERSION)
+INCLUDEPY=     $(INCLUDEDIR)/python$(VERSION)
+EXECINCLUDEPY= $(exec_installdir)/include/python$(VERSION)
+LIBP=          $(exec_installdir)/lib/python$(VERSION)
+DESTSHARED=    $(BINLIBDEST)/site-packages
+
+LIBPL=         $(LIBP)/config
+
+PYTHONLIBS=    $(LIBPL)/libpython$(VERSION).a
+
+MAKESETUP=     $(LIBPL)/makesetup
+MAKEFILE=      $(LIBPL)/Makefile
+CONFIGC=       $(LIBPL)/config.c
+CONFIGCIN=     $(LIBPL)/config.c.in
+SETUP=         $(LIBPL)/Setup
+
+SYSLIBS=       $(LIBM) $(LIBC)
+
+ADDOBJS=       $(LIBPL)/python.o config.o
+
+# Portable install script (configure doesn't always guess right)
+INSTALL=       $(LIBPL)/install-sh -c
+# Shared libraries must be installed with executable mode on some systems;
+# rather than figuring out exactly which, we always give them executable mode.
+# Also, making them read-only seems to be a good idea...
+INSTALL_SHARED=        ${INSTALL} -m 555
+
+#---------------------------------------------------
+# Possibly change some definintions for C++
+ifdef MY_LDSHARED
+LDSHARED=$(MY_LDSHARED)
+endif
+ifdef MY_LINKCC
+LINKCC=$(MY_LINKCC)
+endif
+
+
+# === Fixed rules ===
+
+# Default target.  This builds shared libraries only
+default:       sharedmods
+
+# Build everything
+all:           static sharedmods
+
+# Build shared libraries from our extension modules
+sharedmods:    $(SHAREDMODS)
+
+# Build a static Python binary containing our extension modules
+static:                $(TARGET)
+$(TARGET):     $(ADDOBJS) lib.a $(PYTHONLIBS) Makefile $(BASELIB)
+               $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) \
+                $(ADDOBJS) lib.a $(PYTHONLIBS) \
+                $(LINKPATH) $(BASELIB) $(MODLIBS) $(LIBS) $(SYSLIBS) \
+                -o $(TARGET) $(LDLAST)
+
+#------------------------------------------------------------------------
+#------------------------------------------------------------------------
+# This is a default version of the install target for wxPython.  It just
+# redirects to wxInstall below...
+
+install:       wxInstall
+
+#install:      sharedmods
+#              if test ! -d $(DESTSHARED) ; then \
+#                      mkdir $(DESTSHARED) ; else true ; fi
+#              -for i in X $(SHAREDMODS); do \
+#                      if test $$i != X; \
+#                      then $(INSTALL_SHARED) $$i $(DESTSHARED)/$$i; \
+#                      fi; \
+#              done
+
+
+# Build the library containing our extension modules
+lib.a:         $(MODOBJS)
+               -rm -f lib.a
+               ar cr lib.a $(MODOBJS)
+               -$(RANLIB) lib.a
+
+# This runs makesetup *twice* to use the BASESETUP definition from Setup
+config.c Makefile:     Makefile.pre Setup $(BASESETUP) $(MAKESETUP)
+               $(MAKESETUP) \
+                -m Makefile.pre -c $(CONFIGCIN) Setup -n $(BASESETUP) $(SETUP)
+               $(MAKE) -f Makefile do-it-again
+
+# Internal target to run makesetup for the second time
+do-it-again:
+               $(MAKESETUP) \
+                -m Makefile.pre -c $(CONFIGCIN) Setup -n $(BASESETUP) $(SETUP)
+
+# Make config.o from the config.c created by makesetup
+config.o:      config.c
+               $(CC) $(CFLAGS) -c config.c
+
+# Setup is copied from Setup.in *only* if it doesn't yet exist
+Setup:
+               cp Setup.in Setup
+
+# Make the intermediate Makefile.pre from Makefile.pre.in
+Makefile.pre: Makefile.pre.in sedscript
+               sed -f sedscript Makefile.pre.in >Makefile.pre
+
+# Shortcuts to make the sed arguments on one line
+P=prefix
+E=exec_prefix
+H=Generated automatically from Makefile.pre.in by sedscript.
+L=LINKFORSHARED
+
+# Make the sed script used to create Makefile.pre from Makefile.pre.in
+sedscript:     $(MAKEFILE)
+       sed -n \
+        -e '1s/.*/1i\\/p' \
+        -e '2s%.*%# $H%p' \
+        -e '/^VERSION=/s/^VERSION=[    ]*\(.*\)/s%@VERSION[@]%\1%/p' \
+        -e '/^CC=/s/^CC=[      ]*\(.*\)/s%@CC[@]%\1%/p' \
+        -e '/^CCC=/s/^CCC=[    ]*\(.*\)/s%#@SET_CCC[@]%CCC=\1%/p' \
+        -e '/^LINKCC=/s/^LINKCC=[      ]*\(.*\)/s%@LINKCC[@]%\1%/p' \
+        -e '/^OPT=/s/^OPT=[    ]*\(.*\)/s%@OPT[@]%\1%/p' \
+        -e '/^LDFLAGS=/s/^LDFLAGS=[    ]*\(.*\)/s%@LDFLAGS[@]%\1%/p' \
+        -e '/^DEFS=/s/^DEFS=[  ]*\(.*\)/s%@DEFS[@]%\1%/p' \
+        -e '/^LIBS=/s/^LIBS=[  ]*\(.*\)/s%@LIBS[@]%\1%/p' \
+        -e '/^LIBM=/s/^LIBM=[  ]*\(.*\)/s%@LIBM[@]%\1%/p' \
+        -e '/^LIBC=/s/^LIBC=[  ]*\(.*\)/s%@LIBC[@]%\1%/p' \
+        -e '/^RANLIB=/s/^RANLIB=[      ]*\(.*\)/s%@RANLIB[@]%\1%/p' \
+        -e '/^MACHDEP=/s/^MACHDEP=[    ]*\(.*\)/s%@MACHDEP[@]%\1%/p' \
+        -e '/^SO=/s/^SO=[      ]*\(.*\)/s%@SO[@]%\1%/p' \
+        -e '/^LDSHARED=/s/^LDSHARED=[  ]*\(.*\)/s%@LDSHARED[@]%\1%/p' \
+        -e '/^CCSHARED=/s/^CCSHARED=[  ]*\(.*\)/s%@CCSHARED[@]%\1%/p' \
+        -e '/^$L=/s/^$L=[      ]*\(.*\)/s%@$L[@]%\1%/p' \
+        -e '/^$P=/s/^$P=\(.*\)/s%^$P=.*%$P=\1%/p' \
+        -e '/^$E=/s/^$E=\(.*\)/s%^$E=.*%$E=\1%/p' \
+        $(MAKEFILE) >sedscript
+       echo "/^#@SET_CCC@/d" >>sedscript
+       echo "/^installdir=/s%=.*%=     $(installdir)%" >>sedscript
+       echo "/^exec_installdir=/s%=.*%=$(exec_installdir)%" >>sedscript
+       echo "/^srcdir=/s%=.*%=         $(srcdir)%" >>sedscript
+       echo "/^VPATH=/s%=.*%=          $(VPATH)%" >>sedscript
+       echo "/^LINKPATH=/s%=.*%=       $(LINKPATH)%" >>sedscript
+       echo "/^BASELIB=/s%=.*%=        $(BASELIB)%" >>sedscript
+       echo "/^BASESETUP=/s%=.*%=      $(BASESETUP)%" >>sedscript
+
+# Bootstrap target
+boot:  clobber
+       VERSION=`$(PYTHON) -c "import sys; print sys.version[:3]"`; \
+       installdir=`$(PYTHON) -c "import sys; print sys.prefix"`; \
+       exec_installdir=`$(PYTHON) -c "import sys; print sys.exec_prefix"`; \
+       $(MAKE) -f Makefile.pre.in VPATH=$(VPATH) srcdir=$(srcdir) \
+               VERSION=$$VERSION \
+               installdir=$$installdir \
+               exec_installdir=$$exec_installdir \
+               Makefile
+
+# Handy target to remove intermediate files and backups
+clean:
+               -rm -f *.o *~
+
+# Handy target to remove everything that is easily regenerated
+clobber:       clean
+               -rm -f *.a tags TAGS config.c Makefile.pre $(TARGET) sedscript
+               -rm -f *.so *.sl so_locations
+
+
+# Handy target to remove everything you don't want to distribute
+distclean:     clobber
+               -rm -f Makefile Setup
+
+
+
+
+#------------------------------------------------------------------------
+#------------------------------------------------------------------------
+# Custom rules and dependencies added for wxPython
+#
+
+WXP_VERSION=2.1b2
+
+# WXP_SRCDIR=../wxPython/src
+
+SWIGFLAGS=-c++ -shadow -python -dnone -I$(WXP_SRCDIR) -D__WXGTK__ $(SEPARATE)
+
+
+# Implicit rules to run SWIG
+$(GENCODEDIR)/%.cpp : %.i
+       swig $(SWIGFLAGS) -c -o $@ $<
+
+$(GENCODEDIR)/%.py : %.i
+       swig $(SWIGFLAGS) -c -o $@ $<
+$(GENCODEDIR)/%.py : %.i
+       swig $(SWIGFLAGS) -c -o $(GENCODEDIR)/tmp_wrap.cpp $<
+       rm $(GENCODEDIR)/tmp_wrap.cpp
+               
+
+wxInstall :    sharedmods $(PYMODULES)
+       if test ! -d $(TARGETDIR) ; then \
+               mkdir $(TARGETDIR) ; else true ; fi
+       if [ "$(SHAREDMODS)" != "" ]; then \
+                chmod 755 $(SHAREDMODS); \
+                cp $(SHAREDMODS) $(TARGETDIR); fi
+       -for i in $(PYMODULES); do \
+               cp $$i $(TARGETDIR); \
+       done
+       if [ "$(TARGETDIR)" != ".." ]; then      \
+               python $(LIBDEST)/compileall.py $(TARGETDIR);      \
+               python -O $(LIBDEST)/compileall.py $(TARGETDIR);   \
+       else                                                       \
+               python $(LIBDEST)/compileall.py -l $(TARGETDIR);   \
+               python -O $(LIBDEST)/compileall.py -l $(TARGETDIR);\
+       fi
+
+
+
diff --git a/utils/wxPython/modules/html/README b/utils/wxPython/modules/html/README
new file mode 100644 (file)
index 0000000..0e3d872
--- /dev/null
@@ -0,0 +1,11 @@
+Aug. 2 1999 Harm van der Heijden
+
+What's in here:
+
+html
+       -- minimal wrap of Vaclaf Slavik's wxHTML (now part of
+       wxWindows); only parts of the wxHtmlWindow class are used.
+       Testsample htmlview.py.
+       There's also a python tag handler, see htmlwidget.py for
+       a demonstration.
+
diff --git a/utils/wxPython/modules/html/Setup.in b/utils/wxPython/modules/html/Setup.in
new file mode 100644 (file)
index 0000000..167fec5
--- /dev/null
@@ -0,0 +1,45 @@
+## This file gives the details of what is needed to build this extension
+## module so the Makefile can be created.
+
+## If you have not done "make install" for wxWindows then see Setup.in.linux
+## for a more verbose version of this file.
+
+*shared*
+
+CCC=c++
+WXWIN=../../..
+GENCODEDIR=gtk
+# srcdir=$(GENCODEDIR)
+WX_CONFIG_CFLAGS=`wx-config --cflags`
+WX_CONFIG_LIBS=`wx-config --libs`
+
+
+## Depending on how your Python was built, you may have to set this
+## value to use the C++ driver to link with instead of the default
+## C driver.  For example:
+MY_LDSHARED=$(CCC) -shared
+
+## Same as above, but for statically linking Python and wxPython together,
+## in other words, if you comment out the *shared* above.  If this is the
+## case then you should ensure that the main() function is Python's, not
+## wxWindows'.  You can rebuild $(WXWIN)/src/gtk/app.cpp with NOMAIN defined
+## to force this...
+MY_LINKCC=$(CCC)
+
+
+## Pick one of these, or set your own.  This is where the wxPython module
+## should be installed.  It should be a subdirectory named wxPython.
+#TARGETDIR=..
+TARGETDIR=$(BINLIBDEST)/site-packages/wxPython
+
+# The location of the wxPython source dir
+WXP_SRCDIR=../../src
+
+C_DEFINES = -DSWIG_GLOBAL -DWXP_USE_THREAD -DSEPARATE
+C_FLAGS = -I. -I$(WXP_SRCDIR) $(WX_CONFIG_CFLAGS)
+C_LIBS = -lwxPyHelpers $(WX_CONFIG_LIBS)
+
+PYMODULES = $(GENCODEDIR)/html.py htmlhelper.py
+
+htmlc  $(GENCODEDIR)/html.cpp \
+       $(C_DEFINES) $(C_FLAGS) -Xlinker $(C_LIBS)
diff --git a/utils/wxPython/modules/html/html.i b/utils/wxPython/modules/html/html.i
new file mode 100644 (file)
index 0000000..05eea37
--- /dev/null
@@ -0,0 +1,259 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        html.i
+// Purpose:     SWIG definitions of html classes
+//
+// Author:      Robin Dunn
+//
+// Created:     25-nov-1998
+// RCS-ID:      $Id$
+// Copyright:   (c) 1998 by Total Control Software
+// Licence:     wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+
+%module html
+
+%{
+#include "helpers.h"
+#include <wx/html/htmlwin.h>
+#include <wx/image.h>
+#include <wx/fs_zip.h>
+#include <wx/fs_inet.h>
+%}
+
+//---------------------------------------------------------------------------
+
+%include typemaps.i
+%include my_typemaps.i
+
+%extern wx.i
+%extern windows.i
+%extern _defs.i
+%extern events.i
+//%extern windows2.i
+//%extern windows3.i
+//%extern frames.i
+//%extern misc.i
+//%extern gdi.i
+//%extern controls.i
+
+
+%{
+#ifdef __WXMSW__
+static wxString wxPyEmptyStr("");
+static wxPoint wxPyDefaultPosition(wxDefaultPosition);
+static wxSize wxPyDefaultSize(wxDefaultSize);
+#endif
+static PyThreadState* wxPyThreadState;
+%}
+
+%pragma(python) code = "import wx,htmlhelper"
+%pragma(python) code = "widget = htmlc"
+
+%{
+
+static PyObject* mod_dict = NULL; // will be set by init
+
+#include <wx/html/mod_templ.h>
+
+TAG_HANDLER_BEGIN(PYTHONTAG, "PYTHON")
+    TAG_HANDLER_PROC(tag)
+    {
+       wxWindow *wnd;
+       wxString errmsg;
+       char pbuf[256];
+       
+       int fl = 0;
+       
+       while (1) {
+          #ifdef WXP_WITH_THREAD
+           PyEval_RestoreThread(wxPyThreadState);
+          #endif
+          if (tag.HasParam("FLOAT"))
+              tag.ScanParam("FLOAT", "%i", &fl);
+          PyObject* pyfunc = PyDict_GetItemString(mod_dict, "WidgetStarter");
+          if (pyfunc == NULL) {
+              errmsg = "Could not find object WidgetStarter";
+              break;
+          }
+          if (! PyCallable_Check(pyfunc)) {
+              errmsg = "WidgetStarter does not appear to be callable";
+              break;
+          }
+          SWIG_MakePtr(pbuf, m_WParser->GetWindow(), "_wxHtmlWindow_p");
+           PyObject* arglist = Py_BuildValue("(s,s)", pbuf,
+                              (const char*)tag.GetAllParams());
+          if (! arglist) {
+              errmsg = "Failed making argument list";
+              break;
+          }
+          PyObject* ret = PyEval_CallObject(pyfunc, arglist);
+          Py_DECREF(arglist);
+          if (ret == NULL) {
+              errmsg = "An error occured while calling WidgetStarter";
+             if (PyErr_Occurred())
+                PyErr_Print();
+             break;
+          }
+          wnd = NULL;
+          if (PyString_Check(ret)) {
+             char* thisc = PyString_AsString(ret);
+             SWIG_GetPtr(thisc, (void**)&wnd, "_wxWindow_p");
+          }
+          Py_DECREF(ret);
+          if (! wnd) {
+               errmsg = "Could not make a wxWindow pointer from return ptr";
+              break;
+          }
+          #ifdef WXP_WITH_THREAD
+          PyEval_SaveThread();
+          #endif
+          wnd -> Show(TRUE);
+          m_WParser->OpenContainer()->InsertCell(new wxHtmlWidgetCell(wnd, fl));
+          return FALSE;
+       }
+       
+       /* we got out of the loop. Must be an error. Show a box stating it. */
+       
+       #ifdef WXP_WITH_THREAD
+       PyEval_SaveThread();
+       #endif
+       
+        wnd = new wxTextCtrl( m_WParser -> GetWindow(), -1,
+                             errmsg, wxPoint(0,0), 
+                             wxSize(300, 100), wxTE_MULTILINE );
+       wnd -> Show(TRUE);
+       m_WParser->OpenContainer()->InsertCell(new wxHtmlWidgetCell(wnd, 100));
+        return FALSE;
+    }
+    
+TAG_HANDLER_END(PYTHONTAG)
+
+TAGS_MODULE_BEGIN(PythonTag)
+
+    TAGS_MODULE_ADD(PYTHONTAG)
+    
+TAGS_MODULE_END(PythonTag)
+
+// Note: see also the init function where we add the module!
+
+%}
+
+//---------------------------------------------------------------------------
+
+// item of history list
+class HtmlHistoryItem
+{
+    public:
+        HtmlHistoryItem(const char* p, const char* a);
+        int GetPos() const {return m_Pos;}
+        void SetPos(int p) {m_Pos = p;}
+        const wxString& GetPage() const ;
+        const wxString& GetAnchor() const ;
+};
+
+class wxHtmlWindow : public wxScrolledWindow
+{
+    public:
+        wxHtmlWindow(wxWindow *parent, wxWindowID id = -1, 
+                     const wxPoint& pos = wxPyDefaultPosition, 
+                    const wxSize& size = wxPyDefaultSize,
+                    int flags=wxHW_SCROLLBAR_AUTO, 
+                    const char* name = "htmlWindow");
+        %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
+       %pragma(python) addtomethod = "__init__:wx._StdOnScrollCallbacks(self)"
+
+        bool SetPage(const char* source);
+                // Set HTML page and display it. !! source is HTML document itself,
+                // it is NOT address/filename of HTML document. If you want to 
+                // specify document location, use LoadPage() istead
+                // Return value : FALSE if an error occured, TRUE otherwise
+                
+        bool LoadPage(const char* location);
+                // Load HTML page from given location. Location can be either
+                // a) /usr/wxGTK2/docs/html/wx.htm
+                // b) http://www.somewhere.uk/document.htm
+                // c) ftp://ftp.somesite.cz/pub/something.htm
+                // In case there is no prefix (http:,ftp:), the method
+                // will try to find it itself (1. local file, then http or ftp)
+                // After the page is loaded, the method calls SetPage() to display it.
+                // Note : you can also use path relative to previously loaded page
+                // Return value : same as SetPage
+
+        wxString GetOpenedPage() const {return m_OpenedPage;}
+                // Returns full location of opened page
+        
+        void SetRelatedFrame(wxFrame* frame, const char* format);
+                // sets frame in which page title will  be displayed. Format is format of
+                // frame title, e.g. "HtmlHelp : %s". It must contain exactly one %s 
+        wxFrame* GetRelatedFrame() const;
+
+        void SetRelatedStatusBar(int bar);
+                // after(!) calling SetRelatedFrame, this sets statusbar slot where messages
+                // will be displayed. Default is -1 = no messages.
+
+        void SetFonts(wxString normal_face, int normal_italic_mode, wxString fixed_face, int fixed_italic_mode, int *sizes);
+                // sets fonts to be used when displaying HTML page.
+                // *_italic_mode can be either wxSLANT or wxITALIC
+
+        void SetTitle(const char* title);
+                // Sets the title of the window
+                // (depending on the information passed to SetRelatedFrame() method)
+
+        void SetBorders(int b);
+                // Sets space between text and window borders.
+
+        //virtual void ReadCustomization(wxConfigBase *cfg, wxString path = wxEmptyString);
+                // saves custom settings into cfg config. it will use the path 'path'
+                // if given, otherwise it will save info into currently selected path.
+                // saved values : things set by SetFonts, SetBorders.
+        //virtual void WriteCustomization(wxConfigBase *cfg, wxString path = wxEmptyString);
+                // ...
+
+        bool HistoryBack();
+        bool HistoryForward();
+                // Goes to previous/next page (in browsing history)
+                // Returns TRUE if successful, FALSE otherwise
+        void HistoryClear();
+                // Resets history
+
+        //wxHtmlContainerCell* GetInternalRepresentation() const;
+                // Returns pointer to conteiners/cells structure.
+                // It should be used ONLY when printing
+
+        //static void AddFilter(wxHtmlFilter *filter);
+                // Adds input filter
+
+        /* This function needs to be eventified! */
+        //virtual void OnLinkClicked(const char* link);
+                // called when users clicked on hypertext link. Default behavior is to
+                // call LoadPage(loc)
+               
+       //static void CleanUpStatics();
+               // cleans static variables
+
+};
+
+
+//---------------------------------------------------------------------------
+
+%init %{
+
+    /* This is a bit cheesy. SWIG happens to call the dictionary d... 
+     * I save it here, 'cause I don't know how to get it back later! */
+    mod_dict = d;
+    wxPyThreadState = PyThreadState_Get();
+    wxClassInfo::CleanUpClasses();
+    wxClassInfo::InitializeClasses();
+
+    /* specifically add our python tag handler; it doesn't seem to
+     * happen by itself... */
+    wxHtmlWinParser::AddModule(new HTML_ModulePythonTag());
+    
+    // Until wxFileSystem is wrapped...
+    #if wxUSE_FS_ZIP
+       wxFileSystem::AddHandler(new wxZipFSHandler);
+    #endif
+%}
+
+//---------------------------------------------------------------------------
diff --git a/utils/wxPython/modules/html/htmlc.def b/utils/wxPython/modules/html/htmlc.def
new file mode 100644 (file)
index 0000000..8593112
--- /dev/null
@@ -0,0 +1,2 @@
+EXPORTS
+        inithtmlc
diff --git a/utils/wxPython/modules/html/htmlhelper.py b/utils/wxPython/modules/html/htmlhelper.py
new file mode 100644 (file)
index 0000000..d8fe3c3
--- /dev/null
@@ -0,0 +1,59 @@
+#
+# htmlhelper.py 
+# 
+# A few helper functions for putting wxPython widgets in html pages
+#
+# Harm van der Heijden, 11 aug 1999.
+
+import wx
+import string
+import htmlc
+
+# Function to parse a param string (of the form 'item=value item2="value etc"'
+# and creates a dictionary
+def _param2dict(param):
+    i = 0; j = 0; s = len(param); d = {}
+    d['param_str'] = param
+    while 1:
+       while i<s and param[i] == " " : i = i+1
+       if i>=s: break
+       j = i
+       while j<s and param[j] != "=": j=j+1
+       if j+1>=s:
+           break
+       word = param[i:j]
+       i=j+1
+       if (param[i] == '"'):
+           j=i+1
+           while j<s and param[j] != '"' : j=j+1
+           if j == s: break
+           val = param[i+1:j]
+       elif (param[i] != " "):
+           j=i+1
+           while j<s and param[j] != " " : j=j+1
+           val = param[i:j]
+       else:
+           val = ""
+       i=j+1
+       d[string.lower(word)] = val
+    return d
+
+# This function gets called by the <python> tag handler.
+# Arguments are the parent (wxHtmlWindow) SWIG pointer (in python, a string)
+# and a string containing the parameters.
+# The return value must be the SWIG pointer of the created widget (the 'this'
+# attribute in python). The widget must be derived from a wxWindow or one
+# of its descendants.
+def _WidgetStarter(parentptr, param):
+    # create a python instance of the parent
+    parent = wx.wxWindowPtr(parentptr)
+    # try to find the widget class in the htmlwinc (=htmlwidget) module
+    dict = _param2dict(param)
+    classname = dict['class']
+    obj = htmlc.__dict__[classname]
+    # now create the class with arguments parent, dictionary
+    cls = apply(obj, (parent, dict))
+    # return the class instance's pointer
+    return cls.this
+
+htmlc.WidgetStarter = _WidgetStarter
diff --git a/utils/wxPython/modules/html/makefile.vc b/utils/wxPython/modules/html/makefile.vc
new file mode 100644 (file)
index 0000000..7b8f282
--- /dev/null
@@ -0,0 +1,35 @@
+
+#----------------------------------------------------------------------
+
+TARGET = htmlc
+
+OBJECTS = html.obj
+
+PYMODULES = $(TARGETDIR)\html.py $(TARGETDIR)\htmlhelper.py 
+
+SOURCES = $(GENCODEDIR)\html.cpp 
+
+
+#----------------------------------------------------------------------
+
+!include ..\makeinc.vc
+
+#----------------------------------------------------------------------
+
+default: $(TARGETDIR)\$(TARGET).pyd pycfiles
+
+all:    $(TARGET)
+
+#----------------------------------------------------------------------
+
+$(TARGETDIR)\$(TARGET).pyd : $(DUMMYOBJ) $(WXLIB) $(OBJECTS) # $(TARGET).res
+       $(link) @<<
+/out:$@ /dll
+$(LFLAGS) /def:$(TARGET).def /implib:./$(TARGET).lib
+$(DUMMYOBJ) $(OBJECTS) 
+$(LIBS)
+<<
+
+
+#----------------------------------------------------------------------
+
diff --git a/utils/wxPython/modules/html/test/htmlview.py b/utils/wxPython/modules/html/test/htmlview.py
new file mode 100644 (file)
index 0000000..906f322
--- /dev/null
@@ -0,0 +1,77 @@
+from wxPython.wx import *
+from wxPython.html import *
+import sys
+
+default_page = """
+<H1>HTML Viewer</H1>Please select <I>File->Open</I>
+to open a HTML file, or edit this page in the
+text control below and select <I>File->Update</I>
+<P>
+The python source can be seen
+<a href="%s">here</a>.
+""" % (sys.argv[0], )
+
+class HtmlViewer(wxFrame):
+       def __init__(self, parent, id, title, pos = wxDefaultPosition, size = wxSize(400,400)):
+               wxFrame.__init__(self, parent, id, title, pos, size)
+                self.CreateStatusBar(1)
+                split = wxSplitterWindow(self, -1)
+                self.html = wxHtmlWindow(split)
+                self.html.SetRelatedFrame(self, "HTML Viewer:  \%s")
+                self.html.SetRelatedStatusBar(0)
+                self.txt = wxTextCtrl(split, -1, default_page,
+                                      wxDefaultPosition, wxDefaultSize,
+                                      wxTE_MULTILINE)
+                split.SplitHorizontally(self.html, self.txt, size.y/2)
+               mbar = wxMenuBar()
+               menu = wxMenu()
+               menu.Append(1500, "Open")
+                menu.Append(1501, "Reset")
+                menu.Append(1502, "Update HTML")
+               menu.AppendSeparator()
+               menu.Append(1503, "Exit")
+               mbar.Append(menu, "File")
+                menu = wxMenu()
+                menu.Append(1510, "Back")
+                menu.Append(1511, "Forward")
+                mbar.Append(menu, "Go")
+               self.SetMenuBar(mbar)
+               self.filename = ""
+                EVT_MENU(self, 1500, self.OnFileOpen)
+                EVT_MENU(self, 1501, self.OnFileReset)
+                EVT_MENU(self, 1502, self.OnFileUpdate)
+                EVT_MENU(self, 1503, self.OnClose)
+                EVT_MENU(self, 1510, self.OnGoBack)
+                EVT_MENU(self, 1511, self.OnGoForward)
+                # A default opening text
+                self.html.SetPage( default_page )
+        def OnFileOpen(self, event):
+               dlg = wxFileDialog(NULL, "Open file")
+               if dlg.ShowModal() == wxID_OK:
+                       self.filename = dlg.GetPath()
+                        self.html.LoadPage(self.filename)
+        def OnFileReset(self, event):
+                self.html.SetPage( default_page )
+                self.txt.SetValue( default_page )
+        def OnFileUpdate(self, event):
+                self.html.SetPage( self.txt.GetValue() )
+        def OnGoBack(self, event):
+                self.html.HistoryBack()
+        def OnGoForward(self, event):
+                self.html.HistoryForward()
+       def OnClose(self,event):
+               self.Destroy()
+
+class MyApp(wxApp):
+       def OnInit(self):
+               frame = HtmlViewer(NULL, -1, "HTML Viewer")
+               frame.Show(TRUE)
+               self.SetTopWindow(frame)
+               return TRUE
+
+wxImage_AddHandler(wxPNGHandler())
+wxImage_AddHandler(wxGIFHandler())
+wxImage_AddHandler(wxJPEGHandler())
+
+theApp = MyApp(0)
+theApp.MainLoop()
diff --git a/utils/wxPython/modules/html/test/htmlwidget.py b/utils/wxPython/modules/html/test/htmlwidget.py
new file mode 100644 (file)
index 0000000..ffa0fcb
--- /dev/null
@@ -0,0 +1,97 @@
+from wxPython.wx import *
+from wxPython.html import *
+import sys,string
+
+# A bunch of simple widgets, all somehow derived from wxWindow
+class Widget1(wxWindow):
+    def __init__(self, parent, param):
+       wxWindow.__init__(self, parent, -1)
+       self.text = wxTextCtrl(self, -1, param['param_str'], wxPoint(5,5),
+                          wxSize(200,150), wxTE_MULTILINE)
+       but = wxButton(self, 1001, "Click me", wxPoint(50,160), wxSize(100,30))
+       EVT_BUTTON(self, 1001, self.OnButton)
+       self.SetSize(wxSize(210,200))
+    def OnButton(self, event):
+       self.text.AppendText( "Click!\n" )
+
+class Widget2(wxButton):
+    def __init__(self, parent, param):
+       wxButton.__init__(self, parent, int(param['id']), param['title'])
+
+class Widget3(wxTextCtrl):
+    def __init__(self, parent, param):
+       wxTextCtrl.__init__(self, parent, -1, "No clicks")
+       self.clicked = 0;
+       EVT_BUTTON(parent, int(param['button_id']), self.OnButton)
+    def OnButton(self, event):
+       self.clicked = self.clicked + 1
+       self.SetValue("%d clicks" % (self.clicked,))
+
+# make the widgets known in the widget module (aka htmlc)
+widget.Widget1 = Widget1
+widget.Widget2 = Widget2
+widget.Widget3 = Widget3
+
+# our default page
+default_page = """
+<H2>wxPython widgets go HTML</H2>
+A bunch of wxPython widgets are scattered on this HTML page.
+Here's one:
+<center><python class="Widget1" greeting="Hello World"></center>
+<hr>
+Here's another:
+<center><python class="Widget2" float=70 id=1002 title="Button A"></center>
+It should always take up 70% of the page width.
+<p>And then there's this, listening to button A:
+<python class="Widget3" button_id=1002></p>
+"""
+
+# our explanation
+apology = """
+For some bizarre reason, it takes forever and a day to display the
+widgets if they are constructed in the frame's constructor. This
+only happens in MSW, wxGTK works fine.
+<p>Select <I>File->Show it</I> to draw the widgets."""
+
+default_page = default_page + "The HTML code for this page is\n <pre>" + default_page + "</pre>"
+
+
+class HtmlViewer(wxFrame):
+       def __init__(self, parent, id, title, pos = wxDefaultPosition, size = wxSize(400,400)):
+               wxFrame.__init__(self, parent, id, title, pos, size)
+                self.CreateStatusBar(1)
+                self.html = wxHtmlWindow(self)
+                self.html.SetRelatedFrame(self, "HTML Viewer:  \%s")
+                self.html.SetRelatedStatusBar(0)
+               mbar = wxMenuBar()
+               menu = wxMenu()
+                menu.Append(1500, "Show it")
+               menu.Append(1503, "Exit")
+               mbar.Append(menu, "File")
+                EVT_MENU(self, 1500, self.OnShowIt)
+                EVT_MENU(self, 1503, self.OnClose)
+                self.SetMenuBar(mbar)
+                # change apology below to default_page, if you dare!
+                self.html.SetPage( default_page )
+       def OnClose(self,event):
+               self.Destroy()
+        def OnShowIt(self,event):
+                self.html.SetPage( default_page )
+                # now quickly remove the menu option, to hide that
+                # other bug; namely that widgets aren't removed when the
+                # HTML page is.
+                self.GetMenuBar().Enable(1500, FALSE)        
+
+class MyApp(wxApp):
+       def OnInit(self):
+               frame = HtmlViewer(NULL, -1, "HTML Viewer")
+               frame.Show(TRUE)
+                self.SetTopWindow(frame)
+               return TRUE
+
+wxImage_AddHandler(wxPNGHandler())
+wxImage_AddHandler(wxGIFHandler())
+wxImage_AddHandler(wxJPEGHandler())
+
+theApp = MyApp(0)
+theApp.MainLoop()
diff --git a/utils/wxPython/modules/lseditor/BUGS b/utils/wxPython/modules/lseditor/BUGS
new file mode 100644 (file)
index 0000000..988cb32
--- /dev/null
@@ -0,0 +1,28 @@
+Known bugs
+
+html, all:
+        - keys can move the vertical scrollbar, but the window moveth not.
+        problem in wxHTML.
+
+        - widgets are not removed when the HTML contents is changed
+        (this can be fixed by adding ~HtmlWidgetCell { wnd->Destroy(); } )
+
+        - potential problem with the use of ThreadState in html.i
+        (mainly because I don't really know what I'm doing there)
+
+html, msw:
+        - vertical scrollbar behaves erratically when content smaller than
+        window
+
+        - page with widgets takes forever to draw when constructed
+        in frame constructor
+
+html, gtk:
+        - segfault on exit; sometimes warning about assert failure
+        (m_Object->refcount > 0)
+
+
+editor, all:
+        - (missing feature, really) syntax highlighting data is
+        compile time.
+
diff --git a/utils/wxPython/modules/lseditor/COPYING b/utils/wxPython/modules/lseditor/COPYING
new file mode 100644 (file)
index 0000000..eeb586b
--- /dev/null
@@ -0,0 +1,340 @@
+                   GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+\f
+                   GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+\f
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+\f
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+\f
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                           NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
+\f
+           How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) 19yy  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) 19yy name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/utils/wxPython/modules/lseditor/Makefile.pre.in b/utils/wxPython/modules/lseditor/Makefile.pre.in
new file mode 100644 (file)
index 0000000..9dd1b1c
--- /dev/null
@@ -0,0 +1,363 @@
+# Universal Unix Makefile for Python extensions
+# =============================================
+
+# Short Instructions
+# ------------------
+
+# 1. Build and install Python (1.5 or newer).
+# 2. "make -f Makefile.pre.in boot"
+# 3. "make"
+# You should now have a shared library.
+
+# Long Instructions
+# -----------------
+
+# Build *and install* the basic Python 1.5 distribution.  See the
+# Python README for instructions.  (This version of Makefile.pre.in
+# only withs with Python 1.5, alpha 3 or newer.)
+
+# Create a file Setup.in for your extension.  This file follows the
+# format of the Modules/Setup.in file; see the instructions there.
+# For a simple module called "spam" on file "spammodule.c", it can
+# contain a single line:
+#   spam spammodule.c
+# You can build as many modules as you want in the same directory --
+# just have a separate line for each of them in the Setup.in file.
+
+# If you want to build your extension as a shared library, insert a
+# line containing just the string
+#   *shared*
+# at the top of your Setup.in file.
+
+# Note that the build process copies Setup.in to Setup, and then works
+# with Setup.  It doesn't overwrite Setup when Setup.in is changed, so
+# while you're in the process of debugging your Setup.in file, you may
+# want to edit Setup instead, and copy it back to Setup.in later.
+# (All this is done so you can distribute your extension easily and
+# someone else can select the modules they actually want to build by
+# commenting out lines in the Setup file, without editing the
+# original.  Editing Setup is also used to specify nonstandard
+# locations for include or library files.)
+
+# Copy this file (Misc/Makefile.pre.in) to the directory containing
+# your extension.
+
+# Run "make -f Makefile.pre.in boot".  This creates Makefile
+# (producing Makefile.pre and sedscript as intermediate files) and
+# config.c, incorporating the values for sys.prefix, sys.exec_prefix
+# and sys.version from the installed Python binary.  For this to work,
+# the python binary must be on your path.  If this fails, try
+#   make -f Makefile.pre.in Makefile VERSION=1.5 installdir=<prefix>
+# where <prefix> is the prefix used to install Python for installdir
+# (and possibly similar for exec_installdir=<exec_prefix>).
+
+# Note: "make boot" implies "make clobber" -- it assumes that when you
+# bootstrap you may have changed platforms so it removes all previous
+# output files.
+
+# If you are building your extension as a shared library (your
+# Setup.in file starts with *shared*), run "make" or "make sharedmods"
+# to build the shared library files.  If you are building a statically
+# linked Python binary (the only solution of your platform doesn't
+# support shared libraries, and sometimes handy if you want to
+# distribute or install the resulting Python binary), run "make
+# python".
+
+# Note: Each time you edit Makefile.pre.in or Setup, you must run
+# "make Makefile" before running "make".
+
+# Hint: if you want to use VPATH, you can start in an empty
+# subdirectory and say (e.g.):
+#   make -f ../Makefile.pre.in boot srcdir=.. VPATH=..
+
+
+# === Bootstrap variables (edited through "make boot") ===
+
+# The prefix used by "make inclinstall libainstall" of core python
+installdir=    /usr/local
+
+# The exec_prefix used by the same
+exec_installdir=$(installdir)
+
+# Source directory and VPATH in case you want to use VPATH.
+# (You will have to edit these two lines yourself -- there is no
+# automatic support as the Makefile is not generated by
+# config.status.)
+srcdir=                .
+VPATH=         .
+
+# === Variables that you may want to customize (rarely) ===
+
+# (Static) build target
+TARGET=                python
+
+# Installed python binary (used only by boot target)
+PYTHON=                python
+
+# Add more -I and -D options here
+CFLAGS=                $(OPT) -I$(INCLUDEPY) -I$(EXECINCLUDEPY) $(DEFS)
+
+# These two variables can be set in Setup to merge extensions.
+# See example[23].
+BASELIB=
+BASESETUP=
+
+# === Variables set by makesetup ===
+
+MODOBJS=       _MODOBJS_
+MODLIBS=       _MODLIBS_
+
+# === Definitions added by makesetup ===
+
+# === Variables from configure (through sedscript) ===
+
+VERSION=       @VERSION@
+CC=            @CC@
+LINKCC=                @LINKCC@
+SGI_ABI=       @SGI_ABI@
+OPT=           @OPT@
+LDFLAGS=       @LDFLAGS@
+LDLAST=                @LDLAST@
+DEFS=          @DEFS@
+LIBS=          @LIBS@
+LIBM=          @LIBM@
+LIBC=          @LIBC@
+RANLIB=                @RANLIB@
+MACHDEP=       @MACHDEP@
+SO=            @SO@
+LDSHARED=      @LDSHARED@
+CCSHARED=      @CCSHARED@
+LINKFORSHARED= @LINKFORSHARED@
+#@SET_CCC@
+
+# Install prefix for architecture-independent files
+prefix=                /usr/local
+
+# Install prefix for architecture-dependent files
+exec_prefix=   $(prefix)
+
+# === Fixed definitions ===
+
+# Shell used by make (some versions default to the login shell, which is bad)
+SHELL=         /bin/sh
+
+# Expanded directories
+BINDIR=                $(exec_installdir)/bin
+LIBDIR=                $(exec_prefix)/lib
+MANDIR=                $(installdir)/man
+INCLUDEDIR=    $(installdir)/include
+SCRIPTDIR=     $(prefix)/lib
+
+# Detailed destination directories
+BINLIBDEST=    $(LIBDIR)/python$(VERSION)
+LIBDEST=       $(SCRIPTDIR)/python$(VERSION)
+INCLUDEPY=     $(INCLUDEDIR)/python$(VERSION)
+EXECINCLUDEPY= $(exec_installdir)/include/python$(VERSION)
+LIBP=          $(exec_installdir)/lib/python$(VERSION)
+DESTSHARED=    $(BINLIBDEST)/site-packages
+
+LIBPL=         $(LIBP)/config
+
+PYTHONLIBS=    $(LIBPL)/libpython$(VERSION).a
+
+MAKESETUP=     $(LIBPL)/makesetup
+MAKEFILE=      $(LIBPL)/Makefile
+CONFIGC=       $(LIBPL)/config.c
+CONFIGCIN=     $(LIBPL)/config.c.in
+SETUP=         $(LIBPL)/Setup
+
+SYSLIBS=       $(LIBM) $(LIBC)
+
+ADDOBJS=       $(LIBPL)/python.o config.o
+
+# Portable install script (configure doesn't always guess right)
+INSTALL=       $(LIBPL)/install-sh -c
+# Shared libraries must be installed with executable mode on some systems;
+# rather than figuring out exactly which, we always give them executable mode.
+# Also, making them read-only seems to be a good idea...
+INSTALL_SHARED=        ${INSTALL} -m 555
+
+#---------------------------------------------------
+# Possibly change some definintions for C++
+ifdef MY_LDSHARED
+LDSHARED=$(MY_LDSHARED)
+endif
+ifdef MY_LINKCC
+LINKCC=$(MY_LINKCC)
+endif
+
+
+# === Fixed rules ===
+
+# Default target.  This builds shared libraries only
+default:       sharedmods
+
+# Build everything
+all:           static sharedmods
+
+# Build shared libraries from our extension modules
+sharedmods:    $(SHAREDMODS)
+
+# Build a static Python binary containing our extension modules
+static:                $(TARGET)
+$(TARGET):     $(ADDOBJS) lib.a $(PYTHONLIBS) Makefile $(BASELIB)
+               $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) \
+                $(ADDOBJS) lib.a $(PYTHONLIBS) \
+                $(LINKPATH) $(BASELIB) $(MODLIBS) $(LIBS) $(SYSLIBS) \
+                -o $(TARGET) $(LDLAST)
+
+#------------------------------------------------------------------------
+#------------------------------------------------------------------------
+# This is a default version of the install target for wxPython.  It just
+# redirects to wxInstall below...
+
+install:       wxInstall
+
+#install:      sharedmods
+#              if test ! -d $(DESTSHARED) ; then \
+#                      mkdir $(DESTSHARED) ; else true ; fi
+#              -for i in X $(SHAREDMODS); do \
+#                      if test $$i != X; \
+#                      then $(INSTALL_SHARED) $$i $(DESTSHARED)/$$i; \
+#                      fi; \
+#              done
+
+
+# Build the library containing our extension modules
+lib.a:         $(MODOBJS)
+               -rm -f lib.a
+               ar cr lib.a $(MODOBJS)
+               -$(RANLIB) lib.a
+
+# This runs makesetup *twice* to use the BASESETUP definition from Setup
+config.c Makefile:     Makefile.pre Setup $(BASESETUP) $(MAKESETUP)
+               $(MAKESETUP) \
+                -m Makefile.pre -c $(CONFIGCIN) Setup -n $(BASESETUP) $(SETUP)
+               $(MAKE) -f Makefile do-it-again
+
+# Internal target to run makesetup for the second time
+do-it-again:
+               $(MAKESETUP) \
+                -m Makefile.pre -c $(CONFIGCIN) Setup -n $(BASESETUP) $(SETUP)
+
+# Make config.o from the config.c created by makesetup
+config.o:      config.c
+               $(CC) $(CFLAGS) -c config.c
+
+# Setup is copied from Setup.in *only* if it doesn't yet exist
+Setup:
+               cp Setup.in Setup
+
+# Make the intermediate Makefile.pre from Makefile.pre.in
+Makefile.pre: Makefile.pre.in sedscript
+               sed -f sedscript Makefile.pre.in >Makefile.pre
+
+# Shortcuts to make the sed arguments on one line
+P=prefix
+E=exec_prefix
+H=Generated automatically from Makefile.pre.in by sedscript.
+L=LINKFORSHARED
+
+# Make the sed script used to create Makefile.pre from Makefile.pre.in
+sedscript:     $(MAKEFILE)
+       sed -n \
+        -e '1s/.*/1i\\/p' \
+        -e '2s%.*%# $H%p' \
+        -e '/^VERSION=/s/^VERSION=[    ]*\(.*\)/s%@VERSION[@]%\1%/p' \
+        -e '/^CC=/s/^CC=[      ]*\(.*\)/s%@CC[@]%\1%/p' \
+        -e '/^CCC=/s/^CCC=[    ]*\(.*\)/s%#@SET_CCC[@]%CCC=\1%/p' \
+        -e '/^LINKCC=/s/^LINKCC=[      ]*\(.*\)/s%@LINKCC[@]%\1%/p' \
+        -e '/^OPT=/s/^OPT=[    ]*\(.*\)/s%@OPT[@]%\1%/p' \
+        -e '/^LDFLAGS=/s/^LDFLAGS=[    ]*\(.*\)/s%@LDFLAGS[@]%\1%/p' \
+        -e '/^DEFS=/s/^DEFS=[  ]*\(.*\)/s%@DEFS[@]%\1%/p' \
+        -e '/^LIBS=/s/^LIBS=[  ]*\(.*\)/s%@LIBS[@]%\1%/p' \
+        -e '/^LIBM=/s/^LIBM=[  ]*\(.*\)/s%@LIBM[@]%\1%/p' \
+        -e '/^LIBC=/s/^LIBC=[  ]*\(.*\)/s%@LIBC[@]%\1%/p' \
+        -e '/^RANLIB=/s/^RANLIB=[      ]*\(.*\)/s%@RANLIB[@]%\1%/p' \
+        -e '/^MACHDEP=/s/^MACHDEP=[    ]*\(.*\)/s%@MACHDEP[@]%\1%/p' \
+        -e '/^SO=/s/^SO=[      ]*\(.*\)/s%@SO[@]%\1%/p' \
+        -e '/^LDSHARED=/s/^LDSHARED=[  ]*\(.*\)/s%@LDSHARED[@]%\1%/p' \
+        -e '/^CCSHARED=/s/^CCSHARED=[  ]*\(.*\)/s%@CCSHARED[@]%\1%/p' \
+        -e '/^$L=/s/^$L=[      ]*\(.*\)/s%@$L[@]%\1%/p' \
+        -e '/^$P=/s/^$P=\(.*\)/s%^$P=.*%$P=\1%/p' \
+        -e '/^$E=/s/^$E=\(.*\)/s%^$E=.*%$E=\1%/p' \
+        $(MAKEFILE) >sedscript
+       echo "/^#@SET_CCC@/d" >>sedscript
+       echo "/^installdir=/s%=.*%=     $(installdir)%" >>sedscript
+       echo "/^exec_installdir=/s%=.*%=$(exec_installdir)%" >>sedscript
+       echo "/^srcdir=/s%=.*%=         $(srcdir)%" >>sedscript
+       echo "/^VPATH=/s%=.*%=          $(VPATH)%" >>sedscript
+       echo "/^LINKPATH=/s%=.*%=       $(LINKPATH)%" >>sedscript
+       echo "/^BASELIB=/s%=.*%=        $(BASELIB)%" >>sedscript
+       echo "/^BASESETUP=/s%=.*%=      $(BASESETUP)%" >>sedscript
+
+# Bootstrap target
+boot:  clobber
+       VERSION=`$(PYTHON) -c "import sys; print sys.version[:3]"`; \
+       installdir=`$(PYTHON) -c "import sys; print sys.prefix"`; \
+       exec_installdir=`$(PYTHON) -c "import sys; print sys.exec_prefix"`; \
+       $(MAKE) -f Makefile.pre.in VPATH=$(VPATH) srcdir=$(srcdir) \
+               VERSION=$$VERSION \
+               installdir=$$installdir \
+               exec_installdir=$$exec_installdir \
+               Makefile
+
+# Handy target to remove intermediate files and backups
+clean:
+               -rm -f *.o *~
+
+# Handy target to remove everything that is easily regenerated
+clobber:       clean
+               -rm -f *.a tags TAGS config.c Makefile.pre $(TARGET) sedscript
+               -rm -f *.so *.sl so_locations
+
+
+# Handy target to remove everything you don't want to distribute
+distclean:     clobber
+               -rm -f Makefile Setup
+
+
+
+
+#------------------------------------------------------------------------
+#------------------------------------------------------------------------
+# Custom rules and dependencies added for wxPython
+#
+
+WXP_VERSION=2.1b2
+
+# WXP_SRCDIR=../wxPython/src
+
+SWIGFLAGS=-c++ -shadow -python -dnone -I$(WXP_SRCDIR) -D__WXGTK__ $(SEPARATE)
+
+
+# Implicit rules to run SWIG
+$(GENCODEDIR)/%.cpp : %.i
+       swig $(SWIGFLAGS) -c -o $@ $<
+
+$(GENCODEDIR)/%.py : %.i
+       swig $(SWIGFLAGS) -c -o $@ $<
+$(GENCODEDIR)/%.py : %.i
+       swig $(SWIGFLAGS) -c -o $(GENCODEDIR)/tmp_wrap.cpp $<
+       rm $(GENCODEDIR)/tmp_wrap.cpp
+               
+
+wxInstall :    sharedmods $(PYMODULES)
+       if test ! -d $(TARGETDIR) ; then \
+               mkdir $(TARGETDIR) ; else true ; fi
+       if [ "$(SHAREDMODS)" != "" ]; then \
+                chmod 755 $(SHAREDMODS); \
+                cp $(SHAREDMODS) $(TARGETDIR); fi
+       -for i in $(PYMODULES); do \
+               cp $$i $(TARGETDIR); \
+       done
+       if [ "$(TARGETDIR)" != ".." ]; then      \
+               python $(LIBDEST)/compileall.py $(TARGETDIR);      \
+               python -O $(LIBDEST)/compileall.py $(TARGETDIR);   \
+       else                                                       \
+               python $(LIBDEST)/compileall.py -l $(TARGETDIR);   \
+               python -O $(LIBDEST)/compileall.py -l $(TARGETDIR);\
+       fi
+
+
+
diff --git a/utils/wxPython/modules/lseditor/README b/utils/wxPython/modules/lseditor/README
new file mode 100644 (file)
index 0000000..8ac706c
--- /dev/null
@@ -0,0 +1,13 @@
+Aug. 2 1999 Harm van der Heijden
+
+What's in here:
+
+lseditorplugin
+       -- minimal wrap of Alexanders Gluchovas' editor plugin. The code was
+       ransacked from the wxStudio (http://wxstudio.linuxbox.com) project.
+       Since the editor is released under the Gnu Public License, this
+       module, as a derivative work, is also released under this licence
+       and NOT THE WXWINDOWS LICENSE. See the file COPYING for details.
+       the file 'editor.py' contains a sample implementation using the
+       editorplugin object.
+
diff --git a/utils/wxPython/modules/lseditor/Setup.in b/utils/wxPython/modules/lseditor/Setup.in
new file mode 100644 (file)
index 0000000..dcde799
--- /dev/null
@@ -0,0 +1,49 @@
+## This file gives the details of what is needed to build this extension
+## module so the Makefile can be created.
+
+## If you have not done "make install" for wxWindows then see Setup.in.linux
+## for a more verbose version of this file.
+
+*shared*
+
+CCC=c++
+WXWIN=../../..
+GENCODEDIR=gtk
+# srcdir=$(GENCODEDIR)
+WX_CONFIG_CFLAGS=`wx-config --cflags`
+WX_CONFIG_LIBS=`wx-config --libs`
+
+
+## Depending on how your Python was built, you may have to set this
+## value to use the C++ driver to link with instead of the default
+## C driver.  For example:
+MY_LDSHARED=$(CCC) -shared
+
+## Same as above, but for statically linking Python and wxPython together,
+## in other words, if you comment out the *shared* above.  If this is the
+## case then you should ensure that the main() function is Python's, not
+## wxWindows'.  You can rebuild $(WXWIN)/src/gtk/app.cpp with NOMAIN defined
+## to force this...
+MY_LINKCC=$(CCC)
+
+
+## Pick one of these, or set your own.  This is where the wxPython module
+## should be installed.  It should be a subdirectory named wxPython.
+#TARGETDIR=..
+TARGETDIR=$(BINLIBDEST)/site-packages/wxPython
+
+# The location of the wxPython source dir
+WXP_SRCDIR=../../src
+
+## define SEPARATE so that the individual modules 'know' at compile time
+## they're not going to be part of a big wxcmodule.so
+C_DEFINES = -DSWIG_GLOBAL -DWXP_USE_THREAD -DSEPARATE
+C_FLAGS = -I. -I$(WXP_SRCDIR) $(WX_CONFIG_CFLAGS)
+C_LIBS = -lwxPyHelpers $(WX_CONFIG_LIBS)
+
+PYMODULES = $(GENCODEDIR)/lseditor.py 
+
+lseditorc      $(GENCODEDIR)/lseditor.cpp finddlg.cpp lseditorpl.cpp markup.cpp \
+       plugin.cpp sourcepainter.cpp tdefs.cpp \
+       $(C_DEFINES) $(C_FLAGS) -Xlinker $(C_LIBS)
+
diff --git a/utils/wxPython/modules/lseditor/config.h b/utils/wxPython/modules/lseditor/config.h
new file mode 100644 (file)
index 0000000..b22aa25
--- /dev/null
@@ -0,0 +1,82 @@
+/* config.h.  Generated automatically by configure.  */
+/* config.h.in.  Generated automatically from configure.in by autoheader.  */
+
+/* Define if using alloca.c.  */
+/* #undef C_ALLOCA */
+
+/* Define to empty if the keyword does not work.  */
+/* #undef const */
+
+/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
+   This function is required for alloca.c support on those systems.  */
+/* #undef CRAY_STACKSEG_END */
+
+/* Define if you have alloca, as a function or macro.  */
+#define HAVE_ALLOCA 1
+
+/* Define if you have <alloca.h> and it should be used (not on Ultrix).  */
+#define HAVE_ALLOCA_H 1
+
+/* Define as __inline if that's what the C compiler calls it.  */
+/* #undef inline */
+
+/* Define as the return type of signal handlers (int or void).  */
+#define RETSIGTYPE void
+
+/* Define to `unsigned' if <sys/types.h> doesn't define.  */
+/* #undef size_t */
+
+/* If using the C implementation of alloca, define if you know the
+   direction of stack growth for your system; otherwise it will be
+   automatically deduced at run-time.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown
+ */
+/* #undef STACK_DIRECTION */
+
+/* Define if you have the ANSI C header files.  */
+#define STDC_HEADERS 1
+
+/* Define if your <sys/time.h> declares struct tm.  */
+/* #undef TM_IN_SYS_TIME */
+
+/* Define to use template STL (vs. wxSTL) */
+#define wxUSE_TEMPLATE_STL 1
+
+/* Define to use framelayout library */
+/* #undef wxsUSE_FRAME_LAYOUT */
+
+/* Define to use class-info plugin */
+#define wxsUSE_CLASS_INFO 1
+
+/* Define to use window manager plugin */
+#define wxsUSE_WINDOWMANAGER 1
+
+/* Define if you have the strdup function.  */
+#define HAVE_STRDUP 1
+
+/* Define if you have the <fcntl.h> header file.  */
+#define HAVE_FCNTL_H 1
+
+/* Define if you have the <limits.h> header file.  */
+#define HAVE_LIMITS_H 1
+
+/* Define if you have the <malloc.h> header file.  */
+#define HAVE_MALLOC_H 1
+
+/* Define if you have the <strings.h> header file.  */
+#define HAVE_STRINGS_H 1
+
+/* Define if you have the <sys/time.h> header file.  */
+#define HAVE_SYS_TIME_H 1
+
+/* Define if you have the <unistd.h> header file.  */
+#define HAVE_UNISTD_H 1
+
+/* Name of package */
+#define PACKAGE "wxStudio"
+
+/* Version number of package */
+#define VERSION "0.0.2"
+
diff --git a/utils/wxPython/modules/lseditor/controlarea.h b/utils/wxPython/modules/lseditor/controlarea.h
new file mode 100644 (file)
index 0000000..15cb938
--- /dev/null
@@ -0,0 +1,262 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        No names yet.
+// Purpose:     Contrib. demo
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     07/09/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleksandras Gluchovas
+// Licence:    wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __CONTROLAREA_G__
+#define __CONTROLAREA_G__
+
+#ifdef __GNUG__
+#pragma interface "controlarea.h"
+#endif
+
+#include "wx/defs.h"
+#include "wx/window.h"
+#include "wx/string.h"
+
+#define WXCONTROLAREA_VERSION      1.0
+
+// layout types for title bars of the tabs
+// (are selected up by evaluating the available free space )
+
+class twTabInfo; // forward decl.
+
+#define wxTITLE_IMG_AND_TEXT 0
+#define wxTITLE_IMG_ONLY     1
+#define wxTITLE_BORDER_ONLY  2
+
+/*
+ * class manages and decorates contained "tab"-windows. 
+ * Draws decorations similar to those in "Project Workplace"
+ * of Microsoft Developer Studio 4.xx 
+ */
+
+class wxTabbedWindow : public wxPanel
+{
+       DECLARE_DYNAMIC_CLASS( wxTabbedWindow )
+
+public:        
+
+       friend class wxTabbedWindowSerializer;
+
+       wxList mTabs;
+       int    mActiveTab;
+       int    mTitleHeight;
+       int    mLayoutType;
+
+       void HideInactiveTabs( bool andRepaint );
+
+       // overrride,to provide different font for tab-labels
+
+       virtual wxFont GetLabelingFont();
+
+       // FOR NOW:: scrollbars are actually related to wxPaggedWindow
+
+       wxScrollBar* mpTabScroll;
+       wxScrollBar* mpHorizScroll;
+       wxScrollBar* mpVertScroll;
+
+public:
+
+       // public properties (invoke ReclaclLayout(TRUE) to apply changes)
+
+       wxPen  mWhitePen;        // default: RGB(255,255,255)
+       wxPen  mLightPen;                // wxSYS_COLOUR_3DHIGHLIGHT
+       wxPen  mGrayPen;         // wxSYS_COLOUR_3DFACE
+       wxPen  mDarkPen;         // wxSYS_COLOUR_3DSHADOW
+       wxPen  mBlackPen;        // default: RGB(  0,  0,  0)
+
+       int    mVertGap;         // default: 3
+       int    mHorizGap;        // default: 5
+       int    mTitleVertGap;    // default: 3
+       int    mTitleHorizGap;   // default: 4
+       int    mImageTextGap;    // default: 2
+       int    mFirstTitleGap;   // default: 11
+       int    mBorderOnlyWidth; // default: 8
+
+       // notifications (can be handled by derivatives)
+
+       virtual void OnTabAdded( twTabInfo* pInfo ) {}
+
+       virtual void SizeTabs(int x,int y, int width, int height, bool repant);
+
+public:
+       wxTabbedWindow();
+       virtual ~wxTabbedWindow();
+
+       // tabs can be also added when the window is 
+       // already displayed - "on the fly"
+
+       virtual void AddTab( wxWindow* pContent,           // contained window
+                                                wxString  tabText,                    // tab label
+                                wxString  imageFileName = "", // if "", only text label is displayed
+                                                long      imageType     = wxBITMAP_TYPE_BMP );
+
+       // NOTE:: if this AddTab(..) overload is called, the 
+       //        image bitmap will not be serialized (if performed),
+       //        use the above method instead, so that images could 
+       //        be restored using the given file names
+
+       virtual void AddTab( wxWindow* pContent,
+                                                wxString  tabText,
+                                wxBitmap* pImage = NULL );
+
+
+       virtual void RemoveTab( int tabNo );
+
+       /* misc accessors */
+
+       virtual int GetTabCount();
+       virtual wxWindow* GetTab( int tabNo );
+       virtual wxWindow* GetActiveTab();
+       virtual void SetActiveTab( int tabNo );
+
+       void DrawShadedRect( int x, int y, int width, int height,
+                                                wxPen& upperPen, wxPen& lowerPen, wxDC& dc );
+
+       virtual void DrawDecorations( wxDC& dc );
+
+       // return -1, if non of the title bars was hitted,
+       // otherwise the index of the hitted tab title bar
+
+       virtual int HitTest( const wxPoint& pos );
+
+       // should be invoked to redisplay window with changed properties
+
+       virtual void RecalcLayout( bool andRepaint = TRUE );
+
+       // event handlers
+
+       void OnPaint( wxPaintEvent& event );
+       void OnSize ( wxSizeEvent& event );
+
+       void OnBkErase( wxEraseEvent& event );
+       void OnLButtonDown( wxMouseEvent& event );
+
+       DECLARE_EVENT_TABLE()
+};
+
+/*
+ * class manages and decorates contained "sheets" (or pages). 
+ * Draws decorations similar to those in "Output window"
+ * of Microsoft Developer Studio 4.xx 
+ */
+
+class wxPaggedWindow : public wxTabbedWindow
+{
+       DECLARE_DYNAMIC_CLASS( wxPaggedWindow )
+protected:
+
+       bool         mScrollEventInProgress;
+
+       // drag&drop state variables
+
+       bool         mIsDragged;
+       int          mDagOrigin;
+       wxCursor     mResizeCursor;
+       wxCursor     mNormalCursor;
+       bool         mCursorChanged;
+       int          mOriginalTitleRowLen;
+
+       void DrawPaperBar( twTabInfo& tab, int x, int y, 
+                                          wxBrush& brush, wxPen& pen, wxDC& dc );
+
+       int GetWholeTabRowLen();
+
+       // adjusts scorllbars to fit around tabs
+
+       virtual void OnTabAdded( twTabInfo* pInfo );
+
+       // sets smaller font for page-labels
+
+       virtual wxFont GetLabelingFont();
+
+public:
+       int          mTitleRowStart;
+       int          mResizeNailGap;
+       int          mTabTrianGap;  
+       int          mTitleRowLen;               // actual title row length
+       int          mAdjustableTitleRowLen; // setup by dragging mini-sash 
+                                            // with the mosue pointer
+       int          mCurentRowOfs;
+
+       wxBrush      mGrayBrush;
+       wxBrush      mWhiteBrush;
+
+public:
+       wxPaggedWindow();
+       ~wxPaggedWindow();
+
+       // NOTE:: use public methods of the base class
+       //        to add "pages" to this window
+
+       /* misc accessors */
+
+       // below two methods should be called after
+       // the tabs were added (AddTab(..)). Set up
+       // these scrollbars to match the needs of the
+       // tabs added into this area
+
+       wxScrollBar& GetVerticalScrollBar();
+       wxScrollBar& GetHorizontalScrollBar();
+
+       virtual void DrawDecorations( wxDC& dc );
+
+       // return -1, if non of the title bars was hitted,
+       // otherwise the index of the hitted tab title bar
+
+       virtual int HitTest( const wxPoint& pos );
+
+       virtual void RecalcLayout( bool andRepaint = TRUE );
+
+       // event handlers
+
+       void OnPaint( wxPaintEvent& event );
+       void OnSize ( wxSizeEvent& event );
+       void OnLButtonDown( wxMouseEvent& event );
+       void OnLButtonUp  ( wxMouseEvent& event );
+       void OnMouseMove  ( wxMouseEvent& event );
+       void OnScroll     ( wxScrollEvent& event );
+
+       DECLARE_EVENT_TABLE()
+};
+
+// helper structure of wxTabbedWindow
+
+class twTabInfo : public wxObject
+{
+       DECLARE_DYNAMIC_CLASS( twTabInfo )
+public:
+       twTabInfo();
+       ~twTabInfo();
+
+       int ImgWidth();
+       int ImgHeight();
+       int ImageToTxtGap( int prefGap );
+
+       bool HasImg();
+       wxBitmap& GetImg();
+       bool HasText();
+       wxString& GetText();
+       wxWindow& GetContent();
+
+public:
+       wxWindow* mpContent;
+       wxBitmap  mBitMap;  
+
+       wxString  mText;
+       wxSize    mDims;
+
+       // used for serialization
+       wxString  mImageFile;
+       long      mImageType;
+
+};
+
+#endif
diff --git a/utils/wxPython/modules/lseditor/editorpl.h b/utils/wxPython/modules/lseditor/editorpl.h
new file mode 100644 (file)
index 0000000..05563eb
--- /dev/null
@@ -0,0 +1,153 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        editorbase.h
+// Purpose:     General interfaces for editor plug-ins.
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     11/04/1999
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleskandars Gluchovas
+// Licence:    GNU General Public License wxWindows licence v2.0
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __EDITORBASE_G__
+#define __EDITORBASE_G__
+
+#include "plugin.h"
+#include "wx/window.h"
+
+class wxsSourceEditorPlugin : public wxsComponent
+{
+protected:
+       string mFileName;
+
+public:
+       /*** overridables (with default implementations) ***/
+
+       // user-level commands
+
+       virtual void OnOpen( const string& fname ) = 0;
+       virtual void OnSave( const string& fname ) = 0;
+
+       virtual void OnCopy() {}
+       virtual void OnCut() {}
+       virtual void OnPaste() {}
+       virtual void OnDelete() {}
+
+       virtual void OnUndo() {}
+       virtual void OnRedo() {}
+
+       virtual void SelectAll() {}
+
+       // NOTE:: column -1 should result cursor to appear
+       //        at the start of the first word in the line (if any)
+       
+       virtual void OnGotoLine( int lineNo, int column = -1 ) {}
+
+       // should invoke editor's own "goto-line" dialog
+       virtual void OnGotoLine() {}
+
+       virtual void OnProperties() {}
+
+       virtual void OnFind() {}
+       virtual void OnFindNext() {}
+       virtual void OnFindPrevious() {}
+       virtual void OnReplace() {}
+
+       virtual void OnToggleBookmark() {}
+       virtual void OnNextBookmark() {}
+       virtual void OnPreviousBookmark() {}
+       virtual void OnShowBookmarks() {}
+
+       virtual void SetCheckpoint() {}
+       virtual bool CheckpointModified() { return TRUE; }
+
+       // UI-updates
+
+       virtual bool CanCopy()  { return FALSE; }
+       virtual bool CanCut()   { return FALSE; }
+       virtual bool CanPaste() { return FALSE; }
+       virtual bool CanUndo()  { return FALSE; }
+       virtual bool CanRedo()  { return FALSE; }
+
+       // accesed by framework
+
+       virtual bool IsModified() { return TRUE; }
+
+       // returned buffer is NULL, if operation is not supported
+       // by this concrete editor
+
+       virtual void GetAllText( char** ppBuf, size_t* length ) 
+               
+               { *ppBuf = NULL; *length = 0; }
+
+       virtual string FindWordAtCursor() = 0;
+
+       // returned line and column are -1s, if operation
+       // is not supported this concrete editor
+
+       virtual void GetCursorPos( int* line, int* column )
+
+               { *line = -1; *column = -1; } 
+
+       virtual void GetPagePos( int* line, int* column )
+
+               { *line = -1; *column = -1; } 
+
+       virtual void SetCursorPos( int line, int column ) {}
+
+       // returned buffer is NULL, if operation is not supported
+       // by this concrete editor,
+       // (NOTE: range is given from "fromLine", but not
+       //        including tillLine, [fomrLine,tillLine) )
+
+       virtual void GetText( int fromLine, int fromColumn,
+                                 int tillLine, int tillColumn,
+                                                 char** ppBuf, size_t* length ) 
+               { ppBuf = NULL; }
+
+       virtual void InsertText( int line, int column,
+                                                        char* text, size_t lenght )
+       {}
+
+       virtual void DeleteText( int fromLine, int fromColumn,
+                                                    int tillLine, int tillColumn  )
+       {}
+
+       virtual void PositionToXY( int line, int column, int* x, int* y )
+
+               { *x = -1; *y = -1; }
+
+       virtual void GetSelectionRange( int* fromLine, int* fromColumn,
+                                                                   int* tillLine, int* tillColumn  )
+       
+               { *fromLine = -1; // not supported by default 
+           }
+
+       virtual wxSize GetCharacterSize() { return wxSize(-1,-1); }
+
+       virtual bool IsUnixText() 
+
+// default impl., actual implementation should use auto-detection
+
+#ifdef __WINDOWS__
+       { return FALSE; }
+#else
+       { return TRUE; }
+#endif
+
+       // requests editor to keep cursor blinking, even when
+       // the window has lost it's focus
+
+       virtual void HoldCursor( bool hold ) 
+               {}
+
+       virtual string GetFileName() { return mFileName; }
+       virtual void SetFileName( const string& fname ) { mFileName = fname; } 
+
+       // overriden methods of wxStudioPluginBase
+       virtual WXS_PLUGIN_TYPE GetType() {return WXS_EDITOR_PLUGIN;}
+    virtual string GetCategory() { return "Editor";}    
+};
+
+#endif
+         // __EDITORBASE_G__
diff --git a/utils/wxPython/modules/lseditor/finddlg.cpp b/utils/wxPython/modules/lseditor/finddlg.cpp
new file mode 100644 (file)
index 0000000..0270cac
--- /dev/null
@@ -0,0 +1,146 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        No names yet.
+// Purpose:     Contrib. demo
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     08/05/1999
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleksandars Gluchovas
+// Licence:    GNU General Public License 
+/////////////////////////////////////////////////////////////////////////////
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#include "finddlg.h"
+
+/***** Implementation for class wxFindTextDialog *****/
+
+//#define wxID_OK 3453453
+
+BEGIN_EVENT_TABLE( wxFindTextDialog, wxDialog )
+
+       // FIXME:: why OnOk() is not called??
+       //EVT_BUTTON( wxID_OK, wxFindTextDialog::OnOK )
+
+    EVT_CHAR_HOOK(wxFindTextDialog::OnKeyHook)
+
+END_EVENT_TABLE()
+
+wxString wxFindTextDialog::mLastExpr;
+bool     wxFindTextDialog::mMatchCase = TRUE;
+bool     wxFindTextDialog::mMatchWord = FALSE;
+StrListT wxFindTextDialog::mExprList;  
+
+// FIXME:: workaround for mystic. crashes wiht MSDev4.0
+
+static wxComboBox* __gpCombo = NULL;
+
+wxFindTextDialog::wxFindTextDialog( wxWindow* parent, const string& expr )
+
+       : wxDialog( parent, -1, "Find",
+                   wxDefaultPosition, wxSize( 335, 130 ),
+                               wxDIALOG_MODAL | wxCAPTION | wxTAB_TRAVERSAL |
+                               wxDEFAULT_DIALOG_STYLE
+                 )
+{
+       mLastExpr = expr;
+
+       int leftMargin = 20;
+       int inputY = 20;
+       int inputWidth = 200;
+
+       wxStaticText* pStatic = 
+               new wxStaticText( this, -1, "Fi&nd what:", 
+                                                 wxPoint( leftMargin, inputY ) );
+
+       int checkY = inputY + 25;
+
+       mpWordCheck = new wxCheckBox( this, -1, "Match &whole word only",
+                                                             wxPoint( leftMargin, checkY ) );
+
+       mpCaseCheck = new wxCheckBox( this, -1, "Match &case",
+                                                             wxPoint( leftMargin, checkY + 20 ) );
+
+       mpCaseCheck->SetValue( mMatchCase );
+       mpWordCheck->SetValue( mMatchWord );
+
+       int btnX = inputWidth + leftMargin + 23;
+       int btnY = inputY - 4;
+
+       wxSize btnSize( 70, 25 );
+
+       wxButton* pOkBtn = new wxButton( this, wxID_OK, "&Find", 
+                                                                        wxPoint( btnX, btnY ), btnSize );
+
+       wxButton* pCancelBtn = new wxButton( this, wxID_CANCEL, "&Cancel", 
+                                                                            wxPoint( btnX, btnY  + 10 + btnSize.y ), btnSize );
+
+       __gpCombo = new wxComboBox( this, -1, mLastExpr, 
+                                       wxPoint( leftMargin + 60, inputY - 2 ), 
+                                       wxSize( inputWidth - 50, 20 ) );
+
+       for( size_t i = 0; i != mExprList.size(); ++i )
+
+               __gpCombo->Append( mExprList[i] );
+
+       pOkBtn->SetDefault();
+       __gpCombo->SetFocus();
+
+       Center( wxBOTH );
+}
+
+void wxFindTextDialog::SetExpr( const wxString& expr ) 
+{ 
+       mLastExpr = expr; 
+       __gpCombo->SetValue( mLastExpr );
+
+}
+
+wxComboBox* wxFindTextDialog::GetCombo()
+{
+       return __gpCombo;
+}
+
+bool wxFindTextDialog::TransferDataFromWindow()
+{
+       mLastExpr  = GetCombo()->GetValue();
+       mMatchCase = mpCaseCheck->GetValue();
+       mMatchWord = mpWordCheck->GetValue();
+
+       if ( mLastExpr != "" )
+       {
+               for( size_t i = 0; i != mExprList.size(); ++i )
+
+                       if ( mExprList[i] == mLastExpr )
+
+                               return TRUE;
+       }
+
+       if ( mExprList.size() > 20 ) 
+
+               mExprList.pop_back();
+
+       mExprList.push_back( mLastExpr );
+
+       return TRUE;
+}
+
+void wxFindTextDialog::OnKeyHook( wxKeyEvent& event )
+{
+       if ( event.m_keyCode == WXK_RETURN )
+       {
+               TransferDataFromWindow();
+               EndModal( wxID_OK );
+       }
+       else
+               event.Skip();
+}
diff --git a/utils/wxPython/modules/lseditor/finddlg.h b/utils/wxPython/modules/lseditor/finddlg.h
new file mode 100644 (file)
index 0000000..dbceaa2
--- /dev/null
@@ -0,0 +1,38 @@
+#ifndef __FINDDLG_G__
+#define __FINDDLG_G__
+
+#include "wx/dialog.h"
+#include "wx/checkbox.h"
+#include "wx/combobox.h"
+
+#include "wxstldefs.h"
+
+class wxFindTextDialog : public wxDialog
+{
+public:
+       static wxString mLastExpr;
+       static bool     mMatchCase;
+       static bool     mMatchWord;
+       static StrListT mExprList;  
+
+       wxCheckBox* mpCaseCheck;
+       wxCheckBox* mpWordCheck;
+
+public:
+       wxFindTextDialog( wxWindow* parent, const string& expr = "" );
+
+       bool     MatchWordOn()  { return mMatchWord; }
+       bool     MatchCaseOn() { return mMatchCase; }
+       wxString GetExpr()      { return mLastExpr;  }
+       void     SetExpr( const wxString& expr );
+
+       wxComboBox* GetCombo();
+
+       virtual bool TransferDataFromWindow();
+
+       void OnKeyHook( wxKeyEvent& event );
+
+       DECLARE_EVENT_TABLE()
+};
+       
+#endif
diff --git a/utils/wxPython/modules/lseditor/lseditor.i b/utils/wxPython/modules/lseditor/lseditor.i
new file mode 100644 (file)
index 0000000..19d3641
--- /dev/null
@@ -0,0 +1,150 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        utils.i
+// Purpose:     SWIG definitions of various utility classes
+//
+// Author:      Robin Dunn
+//
+// Created:     25-nov-1998
+// RCS-ID:      $Id$
+// Copyright:   (c) 1998 by Total Control Software
+// Licence:     wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+
+%module lseditor
+
+%{
+#include "helpers.h"
+#include "lseditorpl.h"
+%}
+
+//---------------------------------------------------------------------------
+
+%include typemaps.i
+%include my_typemaps.i
+
+%extern wx.i
+%extern windows.i
+%extern windows2.i
+%extern windows3.i
+%extern frames.i
+%extern _defs.i
+%extern misc.i
+%extern gdi.i
+%extern controls.i
+%extern events.i
+
+
+%{
+#ifdef SEPARATE
+    wxString wxPyEmptyStr("");
+#endif
+%}
+
+%pragma(python) code = "import wx"
+
+//---------------------------------------------------------------------------
+
+class wxsLSEditorPlugin
+{
+public:
+       wxsLSEditorPlugin();
+       ~wxsLSEditorPlugin();
+
+       void Create( wxWindow* parent, wxWindowID id );
+
+       virtual void OnOpen( const char* fname );
+       virtual void OnSave( const char* fname );
+
+       virtual void OnCopy();
+       virtual void OnCut();
+       virtual void OnPaste();
+       virtual void OnDelete();
+
+       void OnUndo();
+       void OnRedo();
+
+       void SelectAll();
+       void OnGotoLine( int lineNo, int column = 0 );
+       void OnGotoLine();
+       void OnProperties();
+
+       void OnFind();
+       void OnFindNext();
+       void OnFindPrevious();
+       void OnReplace();
+
+       virtual void OnToggleBookmark();
+       virtual void OnNextBookmark();
+       virtual void OnPreviousBookmark();
+       virtual void OnShowBookmarks();
+
+       virtual void SetCheckpoint();
+       virtual bool CheckpointModified();
+
+       // UI-updates
+
+       bool CanCopy();
+       bool CanCut();
+       bool CanPaste();
+       bool CanUndo();
+       bool CanRedo();
+
+       // accesed by framework
+    
+    virtual string GetName(){ return "Alex's Language Sensitive Editor"; }
+
+       virtual bool IsModified();
+
+       virtual wxWindow* GetWindow();
+
+       //virtual void GetAllText( char** ppBuf, size_t* length );
+
+       virtual void SetFileName( const char* fname );
+
+       virtual void HoldCursor( bool hold );
+
+       //virtual wxsPluginBase* Clone() { return new wxsLSEditorPlugin(); };
+
+       virtual string FindWordAtCursor();
+
+       virtual void GetCursorPos( int* line, int* column );
+       virtual void SetCursorPos( int line, int column );
+
+       virtual void GetPagePos( int* line, int* column );
+
+       virtual void GetText( int fromLine, int fromColumn,
+                                 int tillLine, int tillColumn,
+                                                 char** ppBuf, size_t* length );
+
+       virtual void InsertText( int line, int column,
+                                                        char* text, size_t lenght );
+
+       virtual void DeleteText( int fromLine, int fromColumn,
+                                                    int tillLine, int tillColumn  );
+
+       virtual void PositionToXY( int line, int column, int* x, int* y );
+
+       virtual void GetSelectionRange( int* fromLine, int* fromColumn,
+                                                                   int* tillLine, int* tillColumn  );
+
+       virtual wxSize GetCharacterSize();
+
+       virtual bool IsUnixText();
+
+       // some extras (just in case..)
+
+       //wxTextEditorModel& GetModel();
+       //wxTextEditorView&  GetView();
+};
+
+//---------------------------------------------------------------------------
+
+%init %{
+
+    wxClassInfo::CleanUpClasses();
+    wxClassInfo::InitializeClasses();
+
+%}
+
+//---------------------------------------------------------------------------
diff --git a/utils/wxPython/modules/lseditor/lseditorc.def b/utils/wxPython/modules/lseditor/lseditorc.def
new file mode 100644 (file)
index 0000000..b404f41
--- /dev/null
@@ -0,0 +1,2 @@
+EXPORTS
+        initlseditorc
diff --git a/utils/wxPython/modules/lseditor/lseditorpl.cpp b/utils/wxPython/modules/lseditor/lseditorpl.cpp
new file mode 100644 (file)
index 0000000..e9fab6a
--- /dev/null
@@ -0,0 +1,344 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        lseditorpl.cpp
+// Purpose:     Language-sensative editor plugin for wxStudio
+// Copyright:   (c) Aleksandars Gluchovas
+// Modified by:
+// Created:     11/04/1999
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleskandars Gluchovas
+// Licence:    GNU General Public License 
+/////////////////////////////////////////////////////////////////////////////
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation; either version 2 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+/////////////////////////////////////////////////////////////////////////////
+
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+
+#include "lseditorpl.h"
+#include "tdefs.h"
+
+/***** Impelmentation for class wxsLSEditorPlugin *****/
+
+wxsLSEditorPlugin::wxsLSEditorPlugin()
+
+       : mpModel( NULL ),
+         mpView( NULL )
+{}
+
+wxsLSEditorPlugin::~wxsLSEditorPlugin()
+{
+       // view is destroyed by wxWindows along
+       // with it's owned model
+}
+
+void wxsLSEditorPlugin::Create( wxWindow* parent, wxWindowID id )
+{
+       mpModel = new wxTextEditorModel();
+
+       mpView = new wxTextEditorView( parent, id, mpModel );
+
+       mpModel->AddView( mpView );
+       mpView->Activate();
+
+       mpView->AddPinPainter( new TBreakpointPainter() );
+
+       mpView->SyncScrollbars();
+}
+
+void wxsLSEditorPlugin::OnOpen( const string& fname )
+{
+       mpModel->LoadTextFromFile( fname );
+
+       SetFileName( fname );
+}
+
+void wxsLSEditorPlugin::OnSave( const string& fname )
+{
+       mpModel->SaveTextToFile( fname );
+}
+
+void wxsLSEditorPlugin::OnCopy()
+{
+       mpModel->OnCopy();
+}
+
+void wxsLSEditorPlugin::OnCut()
+{
+       mpModel->OnCut();
+}
+
+void wxsLSEditorPlugin::OnPaste()
+{
+       mpModel->OnPaste();
+}
+
+void wxsLSEditorPlugin::OnDelete()
+{
+       mpModel->OnDelete();
+}
+
+void wxsLSEditorPlugin::OnUndo()
+{
+       mpModel->OnUndo();
+}
+
+void wxsLSEditorPlugin::OnRedo()
+{
+       mpModel->OnRedo();
+}
+
+void wxsLSEditorPlugin::SelectAll()
+{
+       mpModel->OnSelectAll();
+}
+
+void wxsLSEditorPlugin::OnGotoLine()
+{
+       mpModel->OnGotoLine();
+}
+
+void wxsLSEditorPlugin::OnGotoLine( int lineNo, int column )
+{
+       mpModel->ResetSelection();
+       mpModel->OnGotoLine( lineNo, column );
+}
+
+void wxsLSEditorPlugin::OnProperties()
+{
+       // not impl.
+}
+
+void wxsLSEditorPlugin::OnFind()
+{
+       mpModel->OnFind();
+}
+
+void wxsLSEditorPlugin::OnFindNext()
+{
+       mpModel->OnFindNext();
+}
+
+void wxsLSEditorPlugin::OnFindPrevious()
+{
+       mpModel->OnFindPrevious();
+}
+
+void wxsLSEditorPlugin::OnReplace()
+{
+       // not impl.
+}
+
+void wxsLSEditorPlugin::OnToggleBookmark()
+{
+       mpModel->OnToggleBookmark();
+}
+
+void wxsLSEditorPlugin::OnNextBookmark()
+{
+       mpModel->OnNextBookmark();
+}
+
+void wxsLSEditorPlugin::OnPreviousBookmark()
+{
+       mpModel->OnPreviousBookmark();
+}
+
+void wxsLSEditorPlugin::OnShowBookmarks()
+{
+       // not impl.
+}
+
+void wxsLSEditorPlugin::SetCheckpoint()
+{
+       mpModel->SetCheckpoint();
+}
+
+bool wxsLSEditorPlugin::CheckpointModified()
+{
+       return mpModel->CheckpointModified();
+}
+
+// UI-updates
+
+bool wxsLSEditorPlugin::CanCopy()
+{
+       return mpModel->CanCopy();
+}
+
+bool wxsLSEditorPlugin::CanCut()
+{
+       return mpModel->CanCopy();
+}
+
+bool wxsLSEditorPlugin::CanPaste()
+{
+       return mpModel->CanPaste();
+}
+
+bool wxsLSEditorPlugin::CanUndo()
+{
+       return mpModel->CanUndo();
+}
+
+bool wxsLSEditorPlugin::CanRedo()
+{
+       return mpModel->CanRedo();
+}
+
+// accesed by framework
+
+bool wxsLSEditorPlugin::IsModified()
+{
+       return mpModel->IsModified();
+}
+
+wxWindow* wxsLSEditorPlugin::GetWindow()
+{
+       return mpView;
+}
+
+void wxsLSEditorPlugin::GetAllText( char** ppBuf, size_t* length )
+{
+       mpModel->GetAllText( ppBuf, *length );
+}
+
+void wxsLSEditorPlugin::SetFileName( const string& fname )
+{
+       mFileName = fname;
+
+       if ( mpView ) 
+               
+               mpView->SetName( fname );
+}
+
+void wxsLSEditorPlugin::HoldCursor( bool hold )
+{
+       mpView->HoldCursor( hold );
+}
+
+string wxsLSEditorPlugin::FindWordAtCursor()
+{
+       mpModel->OnSelectWord();
+
+       char* buf = NULL; size_t len = 0;
+       
+       mpModel->GetSelection( &buf, len );
+
+       if ( buf ) 
+       {
+               string word = string( buf, 0, len );
+               delete [] buf;
+               return word;
+       }
+       else
+               return "";
+}
+
+void wxsLSEditorPlugin::GetCursorPos( int* line, int* column )
+{
+       TPosition pos = mpModel->GetCursor();
+
+       *line   = (int)pos.mRow;
+       *column = (int)pos.mCol;
+}
+
+void wxsLSEditorPlugin::SetCursorPos( int line, int column )
+{
+       mpModel->OnGotoLine( line, column );
+}
+
+void wxsLSEditorPlugin::GetPagePos( int* line, int* column )
+{
+       TPosition pos = mpView->GetPagePos();
+
+       *line   = pos.mRow;
+       *column = pos.mCol;
+}
+
+void wxsLSEditorPlugin::GetText( int fromLine, int fromColumn,
+                                                                int tillLine, int tillColumn,
+                                                                char** ppBuf, size_t* length )
+{
+       mpModel->GetTextFromRange( TPosition( fromLine, fromColumn ),
+                                                          TPosition( tillLine, tillColumn ),
+                                                          ppBuf, *length );
+}
+
+void wxsLSEditorPlugin::InsertText( int line, int column,
+                                                                   char* text, size_t lenght )
+{
+       mpModel->InsertText( TPosition( line, column ),
+                                                text, lenght );
+}
+
+void wxsLSEditorPlugin::DeleteText( int fromLine, int fromColumn,
+                                                                       int tillLine, int tillColumn  )
+{
+       mpModel->DeleteRange( TPosition( fromLine, fromColumn ),
+                                                 TPosition( tillLine, tillColumn ) );
+}
+
+void wxsLSEditorPlugin::PositionToXY( int line, int column, int* x, int* y )
+{
+       TPosition scrPos;
+
+       mpView->TextPosToScreenPos( TPosition( line, column ), scrPos );
+       mpView->ScreenPosToPixels( scrPos, *x, *y );
+
+       *y += mpView->mCharDim.y; // lower-right corner
+}
+
+void wxsLSEditorPlugin::GetSelectionRange( int* fromLine, int* fromColumn,
+                                                                                  int* tillLine, int* tillColumn  )
+{
+       TPosition start = mpModel->GetStartOfSelection();
+       TPosition end   = mpModel->GetEndOfSelection();
+
+       *fromLine   = (int)start.mRow;
+       *fromColumn = (int)start.mCol;
+       *tillLine   = (int)end.mRow;
+       *tillColumn = (int)end.mCol;
+}
+
+wxSize wxsLSEditorPlugin::GetCharacterSize()
+{
+       return mpView->GetCharacterSize();
+}
+
+bool wxsLSEditorPlugin::IsUnixText()
+{
+       return mpModel->IsUnixText();
+}
+
+wxTextEditorModel& wxsLSEditorPlugin::GetModel() 
+{ 
+       return *mpModel; 
+}
+
+wxTextEditorView&  wxsLSEditorPlugin::GetView()  
+{ 
+       return *mpView;  
+}
diff --git a/utils/wxPython/modules/lseditor/lseditorpl.h b/utils/wxPython/modules/lseditor/lseditorpl.h
new file mode 100644 (file)
index 0000000..6866d0d
--- /dev/null
@@ -0,0 +1,133 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        nativeeditorpl.h
+// Purpose:     Language-sensative editor plugin for wxStudio
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     11/04/1999
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleskandars Gluchovas
+// Licence:    GNU General Public License 
+/////////////////////////////////////////////////////////////////////////////
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation; either version 2 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __LSEDITORPL_G__
+#define __LSEDITORPL_G__
+
+#include "editorpl.h"
+
+class wxTextEditorModel;
+class wxTextEditorView;
+
+class wxsLSEditorPlugin : public wxsSourceEditorPlugin
+{
+protected:
+       wxTextEditorModel* mpModel;
+       wxTextEditorView*  mpView;
+
+public:
+       wxsLSEditorPlugin();
+       ~wxsLSEditorPlugin();
+
+       void Create( wxWindow* parent, wxWindowID id );
+
+       virtual void OnOpen( const string& fname );
+       virtual void OnSave( const string& fname );
+
+       virtual void OnCopy();
+       virtual void OnCut();
+       virtual void OnPaste();
+       virtual void OnDelete();
+
+       void OnUndo();
+       void OnRedo();
+
+       void SelectAll();
+       void OnGotoLine( int lineNo, int column = 0 );
+       void OnGotoLine();
+       void OnProperties();
+
+       void OnFind();
+       void OnFindNext();
+       void OnFindPrevious();
+       void OnReplace();
+
+       virtual void OnToggleBookmark();
+       virtual void OnNextBookmark();
+       virtual void OnPreviousBookmark();
+       virtual void OnShowBookmarks();
+
+       virtual void SetCheckpoint();
+       virtual bool CheckpointModified();
+
+       // UI-updates
+
+       bool CanCopy();
+       bool CanCut();
+       bool CanPaste();
+       bool CanUndo();
+       bool CanRedo();
+
+       // accesed by framework
+    
+    virtual string GetName(){ return "Alex's Language Sensitive Editor"; }
+
+       virtual bool IsModified();
+
+       virtual wxWindow* GetWindow();
+
+       virtual void GetAllText( char** ppBuf, size_t* length );
+
+       virtual void SetFileName( const string& fname );
+
+       virtual void HoldCursor( bool hold );
+
+       virtual wxsPluginBase* Clone() { return new wxsLSEditorPlugin(); };
+
+       virtual string FindWordAtCursor();
+
+       virtual void GetCursorPos( int* line, int* column );
+       virtual void SetCursorPos( int line, int column );
+
+       virtual void GetPagePos( int* line, int* column );
+
+       virtual void GetText( int fromLine, int fromColumn,
+                                 int tillLine, int tillColumn,
+                                                 char** ppBuf, size_t* length );
+
+       virtual void InsertText( int line, int column,
+                                                        char* text, size_t lenght );
+
+       virtual void DeleteText( int fromLine, int fromColumn,
+                                                    int tillLine, int tillColumn  );
+
+       virtual void PositionToXY( int line, int column, int* x, int* y );
+
+       virtual void GetSelectionRange( int* fromLine, int* fromColumn,
+                                                                   int* tillLine, int* tillColumn  );
+
+       virtual wxSize GetCharacterSize();
+
+       virtual bool IsUnixText();
+
+       // some extras (just in case..)
+
+       wxTextEditorModel& GetModel();
+       wxTextEditorView&  GetView();
+};
+
+#endif
+        //     __LSEDITORPL_G__
diff --git a/utils/wxPython/modules/lseditor/markup.cpp b/utils/wxPython/modules/lseditor/markup.cpp
new file mode 100644 (file)
index 0000000..82306b2
--- /dev/null
@@ -0,0 +1,46 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        No names yet.
+// Purpose:     Contrib. demo
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     22/09/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleskandars Gluchovas
+// Licence:    GNU General Public License 
+/////////////////////////////////////////////////////////////////////////////
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#include "markup.h"
+
+static TagStructT htmlTags[] =
+{
+       { "<b>","</b>" }, // 0
+       { "<i>","</i>" }, // 1
+       { "<pre>","</pre>" }, // 2
+       { "<font color=\"#000000\">","</font>" }, // 3
+       { "<font color=\"#8F0000\">","</font>" }, // 4
+       { "<font color=\"#008F00\">","</font>" }, // 5
+       { "<font color=\"#0000CF\">","</font>" }, // 6
+       { "<p>","</p>" }, // 7
+       { "<br>","" }, // 8
+       { "<h1>","</h1>" }, // 9
+       { "<h2>","</h2>" }, // 10
+       { "<h3>","</h3>" }, // 11
+       { "<ul>","</ul>" }, // 12
+       { "<li>","</li>" }, // 13
+};
+
+MarkupTagsT get_HTML_markup_tags()
+{
+       return htmlTags;
+}
diff --git a/utils/wxPython/modules/lseditor/markup.h b/utils/wxPython/modules/lseditor/markup.h
new file mode 100644 (file)
index 0000000..a901135
--- /dev/null
@@ -0,0 +1,51 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        No names yet.
+// Purpose:     Contrib. demo
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     22/09/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleskandars Gluchovas
+// Licence:    GNU General Public License 
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __MARKUP_G__
+#define __MARKUP_G__
+
+// indicies for the MarkupTagsT array
+
+#define TAG_BOLD        0
+#define TAG_ITALIC             1
+
+#define TAG_FIXED_FONT  2
+#define TAG_BLACK_FONT 3
+#define TAG_RED_FONT   4
+#define TAG_GREEN_FONT 5
+#define TAG_BLUE_FONT  6
+
+#define TAG_PARAGRAPH  7
+#define TAG_NEW_LINE   8
+#define TAG_HEADING_1  9
+#define TAG_HEADING_2  10
+#define TAG_HEADING_3   11
+
+#define TAG_ITEM_LIST   12
+#define TAG_LIST_ITEM   13 
+
+struct TagStructT
+{
+       char* start; // tag that starts style
+       char* end;   // tag that finishes style
+};
+
+// tag array
+typedef TagStructT* MarkupTagsT;
+
+// returns array of TagStructT with tag strings for HTML
+
+MarkupTagsT get_HTML_markup_tags();
+
+// MarkupTagsT get_PostScript_markup_tags();
+// MarkupTagsT get_Latex_markup_tags();
+
+#endif
diff --git a/utils/wxPython/modules/lseditor/plugin.cpp b/utils/wxPython/modules/lseditor/plugin.cpp
new file mode 100644 (file)
index 0000000..a6f2962
--- /dev/null
@@ -0,0 +1,58 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        wxsplbase.cpp
+// Purpose:     General interfaces for all plug-ins in wxStudio
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     11/04/1999
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleksandars Gluchovas
+// Licence:    GNU General Public License wxWindows licence v2.0
+/////////////////////////////////////////////////////////////////////////////
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#include "plugin.h"
+
+/***** Implementation for class wxStudioPluginManager *****/
+
+void wxsPluginManager::RegisterMenuCommand( const wxString& itemName, 
+                                                                                       const wxString& menuName,
+                                                                                       int   id, 
+                                                                                       wxsPluginBase* forPlugin )
+{
+       // TBD::
+}
+
+void wxsPluginManager::UnregisterPlugin( wxsPluginBase* plugin )
+{
+       // TBD::
+}
+
+/***** Implementation for class wxStudioPluginBase *****/
+
+wxsPluginBase::wxsPluginBase()
+{}
+
+wxsPluginBase::~wxsPluginBase()
+{}
+
+
+wxsPluginManager& wxsPluginBase::GetPluginManager()
+{
+       wxASSERT( mpPluginMgr );
+       return *mpPluginMgr;
+}
+
+void wxsPluginBase::SetPluginManager( wxsPluginManager* pMgr )
+{
+       mpPluginMgr = pMgr;
+}
diff --git a/utils/wxPython/modules/lseditor/plugin.h b/utils/wxPython/modules/lseditor/plugin.h
new file mode 100644 (file)
index 0000000..98781e4
--- /dev/null
@@ -0,0 +1,98 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        wxsplbase.h
+// Purpose:     General interfaces for all plug-ins in wxStudio
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     11/04/1999
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleskandars Gluchovas
+// Licence:    GNU General Public License wxWindows licence v2.0
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __PLUGIN_G__
+#define __PLUGIN_G__
+
+#include "wxstldefs.h"
+#include "wxsdefs.h"
+
+class wxsPluginBase;
+typedef  wxsPluginBase* wxsPluginBasePtrT;
+#ifdef wxUSE_TEMPLATE_STL
+typedef vector<wxsPluginBasePtrT> wxsPluginListT;
+#else
+typedef WXSTL_VECTOR_SHALLOW_COPY(wxsPluginBasePtrT) wxsPluginListT;
+#endif
+
+
+class wxsPluginManager : public wxObject
+{
+public:
+    
+    wxsPluginListT& GetPlugins();
+
+       // allows to present plugin-specific features
+       // as items in the menu-bar
+
+       void RegisterMenuCommand( const string& itemName, 
+                                                         const string& menuName,
+                                                         int   id, 
+                                 wxsPluginBase* forPlugin );
+
+       // should be called by plugin, when it's being destroyed
+
+       void UnregisterPlugin( wxsPluginBase* plugin );
+};
+
+
+
+// Used by create settings panel:
+enum {
+    WXS_SETTINGS_GLOBAL,
+    WXS_SETTINGS_PROJECT
+};
+
+
+class wxsPluginBase : public wxObject
+{
+protected:
+       wxsPluginManager* mpPluginMgr;
+
+public:
+
+       wxsPluginBase();
+       virtual ~wxsPluginBase();
+
+       virtual void InitPlugin() {}
+
+       // utilities
+
+       wxsPluginManager& GetPluginManager();
+       void SetPluginManager( wxsPluginManager* mgr );
+
+       // overridables
+
+    // Current Types = UNKNOWN,EDITOR,CLASSBROWSER,FILEBROWSER,CLASSINFO,TOOL
+       virtual WXS_PLUGIN_TYPE GetType() = 0;
+    virtual string GetCategory() = 0;
+    
+    virtual string GetName() = 0;
+    // will return a help panel
+    virtual wxWindow* CreateSettingsPanel(wxWindow *parent, int type) {return NULL;}
+       virtual wxsPluginBase* Clone() = 0;
+
+       virtual string Command( const string& name, const string& args ) 
+               
+               { return "NO_SUPPORTED"; }
+};
+
+// base clas for all plugins which are presented as windows
+
+class wxsComponent : public wxsPluginBase 
+{
+public:
+       virtual void Create( wxWindow* parent, wxWindowID id ) = 0;
+       virtual wxWindow* GetWindow() = 0;
+};
+
+#endif 
+         // __PLUGIN_G__
diff --git a/utils/wxPython/modules/lseditor/sourcepainter.cpp b/utils/wxPython/modules/lseditor/sourcepainter.cpp
new file mode 100644 (file)
index 0000000..bd54eef
--- /dev/null
@@ -0,0 +1,696 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        No names yet.
+// Purpose:     Contrib. demo
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     22/09/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleksandars Gluchovas
+// Licence:    GNU General Public License 
+/////////////////////////////////////////////////////////////////////////////
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation; either version 2 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+/////////////////////////////////////////////////////////////////////////////
+
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#include "config.h"
+
+#if defined( wxUSE_TEMPLATE_STL )
+
+       #include <map>
+        using namespace std;
+#else
+
+       #include <wxstlac.h>
+
+#endif
+
+#include "sourcepainter.h"
+
+const int MAX_KEYWORD_LEN = 16;
+
+struct KeywordT
+{
+       char  keyWord[MAX_KEYWORD_LEN];
+       int   rank;
+};
+
+// source fragment ranks :
+
+// 0 - nomral text
+// 1 - basic types
+// 2 - reserved words
+
+// multil-language keywords map
+
+static KeywordT __gKeyWords[] =
+{
+       { "for", 1 },
+       { "FOR", 1 },
+       { "For", 1 },
+       
+       { "next", 1 },
+       { "Next", 1 },
+       { "NEXT", 1 },
+
+       { "if", 1 },
+       { "If", 1 },
+       { "IF", 1 },
+
+       { "then", 1 },
+       { "Then", 1 },
+       { "THEN", 1 },
+
+       { "else", 1 },
+       { "Else", 1 },
+       { "ELSE", 1 },
+                
+       { "do", 1 },
+       { "Do", 1 },
+       { "DO", 1 },
+
+
+       { "break", 1 },
+       { "Break", 1 },
+       { "BREAK", 1 },
+
+       { "continue", 1 },
+
+       { "goto", 1 },
+       { "Goto", 1 },
+       { "GOTO", 1 },
+
+       { "switch",  1 },
+       { "default", 1 },
+       { "case",    1 },
+
+       { "repeat", 1 },
+       { "Repeat", 1 },
+       { "REPEAT", 1 },
+
+       { "until", 1 },
+       { "Until", 1 },
+       { "UNTIL", 1 },
+
+       { "return", 1 },
+       { "Return", 1 },
+       { "RETURN", 1 },
+
+       { "unit",      1 },
+       { "Unit",      1 },
+       { "UNIT",      1 },
+
+       { "procedure", 1 },
+       { "Procedure", 1 },
+       { "PROCEDURE", 1 },
+
+       { "function", 1 },
+       { "Function", 1 },
+       { "FUNCTION", 1 },
+
+       { "begin", 1 },
+       { "Begin", 1 },
+       { "BEGIN", 1 },
+
+       { "End", 1 },
+       { "END", 1 },
+
+       ////////////////////////////////////////////////////
+
+       { "enum",     1 },
+       { "static",   1 },
+       { "const",    1 },
+       { "mutable",  1 },
+       { "volatile", 1 },
+       { "__asm",    1 },
+       { "asm",      1 },
+
+       { "typeid",   1 },
+       { "sizeof",   1 },
+       { "typeof",   1 },
+
+
+       { "native",   1 },
+
+       { "#include", 1 },
+       { "#define",  1 },
+       { "#def",     1 },
+       { "#undef",   1 },
+    { "#ifdef",   1 },
+       { "#ifndef",  1 },
+       { "#if",      1 },
+       { "#endif",   1 },
+       { "#elif",    1 },
+       { "#else",    1 },
+       { "#pragma",  1 },
+       { "#line",    1 },
+
+       { "package",  1 },
+       { "import",   1 },
+       { "export",   1 },
+
+       ////////////////////////////////////////////////////
+
+       { "dynamic_cast",     1 },
+       { "const_cast",       1 },
+
+       //////// some hacks for VB /////////
+
+       { "sub", 1 },
+       { "Sub", 1 },
+       { "SUB", 1 },
+       { "as",  1 },
+       { "As",  1 },
+       { "AS",  1 },
+
+       /////// data types ///////
+
+       { "int" ,    1 },
+       { "integer", 1 },
+       { "Integer", 1 },
+       { "INTEGER", 1 },
+
+       { "real", 1 },
+       { "Real", 1 },
+       { "REAL", 1 },
+
+       { "float", 1 },
+       { "Float", 1 },
+       { "FLOAT", 1 },
+
+       { "char",  1 },
+       { "Char",  1 },
+       { "CHAR",  1 },
+
+       { "register",   1 },
+
+       { "string", 1 },
+       { "String", 1 },
+       { "STRING", 1 },
+
+       { "array", 1 },
+       { "Array", 1 },
+       { "ARRAY", 1 },
+
+       { "packed", 1 },
+       { "Packed", 1 },
+       { "PACKED", 1 },
+
+       { "property", 1 },
+       { "Property", 1 },
+       { "PROPERTY", 1 },
+
+       { "unsigned", 1 },
+
+       { "long",   1 },
+       { "double", 1 },
+       { "short",  1 },
+       { "bool",   1 },
+
+       { "longint", 1 },
+       { "Longint", 1 },
+       { "LONGINT", 1 },
+
+       { "extended", 1 },
+       { "Extended", 1 },
+       { "EXTENTED", 1 },
+
+       { "pointer", 1 },
+       { "Pointer", 1 },
+       { "POINTER", 1 },
+
+       { "and",     1 },
+       { "And",     1 },
+       { "AND",     1 },
+       { "or",      1 },
+       { "Or",      1 },
+       { "OR",      1 },
+       { "xor",     1 },
+       { "Xor",     1 },
+       { "XOR",     1 },
+
+       { "void",       1 },
+       { "__stdcall",  1 },
+       { "__declspec", 1 },
+       { "extern",     1 },
+       { "stdcall",    1 },
+       { "dllimport",  1 },
+       { "dllexport",  1 },
+       { "__cdecl",    1 },
+       { "cdecl",      1 },
+       { "template",   1 },
+       { "typedef",    1 },
+       { "naked",      1 },
+
+       { "try",        1 },
+       { "catch",      1 },
+       { "throw",      2 }, // C++
+       { "throws",     1 }, // Java
+
+
+       { "finalize",   1 },
+
+       // "STL-suport"
+
+       { "size_t",     1 },
+       { "NPOS",       1 },
+       { "vector",     1 },
+       { "list",       1 },
+       { "map",        1 },
+       { "multimap",   1 },
+
+       { "external", 1 },
+       { "External", 1 },
+       { "EXTERNAL", 1 },
+
+       //////////// meta-information //////////////
+
+       { "virtual", 2 },
+       { "Virtual", 2 },
+
+       { "override", 2 },
+       { "Override", 2 },
+
+       { "class", 2 },
+       { "Class", 2 },
+       { "CLASS", 2 },
+
+       { "struct", 2 }, 
+       { "union",  2 },
+
+       { "record", 2 },
+       { "Record", 2 },
+       { "RECORD", 2 },
+
+       { "form",     1 },
+       { "Form",     1 },
+       { "FORM",     1 },
+
+       { "namespace", 2 },
+
+       { "interface" , 2 },
+       { "abstract",   2 },
+
+       { "Interface" , 2 },
+       { "INTERFACE" , 2 },
+
+       { "implementation", 2 },
+       { "Implementation", 2 },
+       { "IMPLEMENTATION", 2 },
+
+       { "label", 2 },
+       { "Label", 2 },
+       { "LABEL", 2 },
+
+       { "implements", 2 },
+       { "extends",    2 },
+
+       { "public",    2 },
+       { "private",   2 },
+       { "protected", 2 },
+
+       { "this", 1 },
+       { "This", 1 },
+       { "THIS", 1 },
+
+       { "new", 1 },
+       { "New", 1 },
+       { "NEW", 1 },
+       
+       { "delete", 2 },
+       { "inline", 2 },
+
+       { "operator",  1 },
+
+       { "Inherited", 2 },
+       { "Inherited", 2 },
+       
+       { "final", 2 },
+       { "implements", 2 },
+       { "super", 2 },
+
+       // even more...
+       { "java",      2 },
+       { "Java",      2 },
+       { "JAVA",      2 },
+       { "delphi",    2 },
+       { "Delphi",    2 },
+       { "SmallTalk", 2 },
+       { "Smalltalk", 2 },
+       { "smalltalk", 2 },
+       { "assembler", 2 },
+       { "Assembler", 2 },
+       { "Basic",     2 },
+       { "BASIC",     2 },
+       { "basic",     2 },
+       { "CORBA",     2 },
+       { "COBOL",     2 },
+       { "ADA",       2 },
+       { "LISP",      2 },
+       
+       // just for fun...
+       { "life",        2 },
+       { "sucks",       2 },
+       { "rules",       2 },
+       { "Quake",       2 },
+       { "QuakeWorld",  2 },
+       { "[ag_slammer]",2 },
+       { "Aleksandras", 2 },
+       { "Gluchovas"  , 2 },
+       { "Alex",        2 },
+       { "alex",        2 },
+       { "aleks",       2 },
+       { "aleksas",     3 },
+       { "AlexSoft",    2 },
+       { "Alexsoft",    2 },
+       { "SpringSky",   2 },
+       { "SK_Team",     2 },
+       { "soften",      2 },
+       { "UB40",        2 },
+       { "U96",         2 }
+};
+
+struct less_c_str 
+{
+    inline bool operator()( char* x, char* y) const 
+       {       return ( strcmp( x,y ) < 0 );
+       }
+};
+
+#if defined( wxUSE_TEMPLATE_STL )
+
+       typedef map< char*, char*, less_c_str > KeywordMapT;
+
+#else
+
+       typedef char* CharPtrT;
+       typedef WXSTL_MAP( CharPtrT, CharPtrT ,less_c_str) KeywordMapT;
+
+#endif
+
+static KeywordMapT __gMultiLangMap;
+static int         __gMapReady = 0;
+
+void check_keyword_map( int keywordMapNr )
+{
+       if ( !__gMapReady )
+       {
+               __gMapReady = 1;
+
+               // "make sure" the address of the first member of non-polimorphic class
+               // coinsides with the address of the instance
+
+               KeywordT dummy;
+
+               if ( (char*)& dummy != &dummy.keyWord[0] )
+                       throw;
+
+               int size = sizeof(__gKeyWords) / sizeof( KeywordT );
+
+               for( int i = 0; i != size; ++i )
+
+                       __gMultiLangMap.insert( 
+                                       KeywordMapT::value_type( (char*)&__gKeyWords[i],
+                                                                                        (char*)&__gKeyWords[i]
+                                                                                  )
+                                                                 );    
+       }
+}
+
+int get_rank( char* start, char* end )
+{
+       // FIXME:: what if end is no longer leagal adress?
+
+       char tmp = *end;
+       *end = '\0'; // put temporary terminator
+
+       KeywordMapT::iterator i; 
+
+       if (  (i = __gMultiLangMap.find( start ) ) != __gMultiLangMap.end() )
+       {
+               KeywordT* pKey = (KeywordT*)(*i).second;
+
+               *end = tmp;
+
+               return pKey->rank;
+       }
+       else
+       {
+               *end = tmp;
+               return 0;
+       }
+}
+
+static inline void store_range( IntListT& results, int rank, int range_len )
+{
+       if ( !range_len ) return;
+
+       results.push_back ( ( rank << 16 ) | ( range_len ) );
+}
+
+
+#define STORE_RANGE  store_range( results, cur_rank, cur_range_len );\
+                        cur_rank = cur_range_len = 0;
+
+#define NEXT_CHAR cur_range_len++; \
+                     ++cur;           \
+                                 continue;
+
+static inline int is_alpha( char ch )
+{
+       return ( (( ch >= '_' ) && ( ch <= 'z' )) ||
+                    (( ch >= 'A' ) && ( ch <= 'Z' ))
+                  );
+}
+
+  // _       .       .
+  // Ziema atEjo netikEtai
+
+static void heighlight_syntax( char* str,   int strLen, 
+                                                          IntListT& results, bool& isComment )
+{
+       bool isMultiline = 0;
+       char* cur = str;
+       char* end = str + strLen;
+
+       int cur_rank      = ( isComment == 1 ) ? RANK_GREEN : RANK_BLACK;
+       int cur_range_len = 0;
+
+       while ( cur != end )
+       {
+               int has_next = ( cur+1 != end );
+
+               if ( isComment )
+               {
+                       if ( *cur == '*' )
+                               if ( has_next && *(cur+1) == '/' )
+                               {
+                                        // turn off multiline comment mode
+                                        cur           += 2;
+                                        cur_range_len += 2;
+                                        isComment      = 0;
+                                        isMultiline    = 0;
+                                        STORE_RANGE;
+
+                                        continue;
+                               }
+
+                       ++cur_range_len;
+                       ++cur;
+                       continue;
+               }
+
+               /*
+               if ( *cur == 10 )
+                       if ( isComment )
+                          if ( isMultiline )
+               {
+                        cur_rank      = RANK_GREEN;
+                        cur_range_len = end - cur;
+                        STORE_RANGE;
+                        isComment = 0;
+                        isMultiline = 0;
+                        continue;
+               }*/
+
+               if ( *cur == '/' )
+               {
+                       if ( has_next )
+                       {
+                                if ( *(cur+1) == '/' )
+                                {
+                                        STORE_RANGE;
+
+                                        char* eol = cur;
+                                        while ( eol < end && *eol != 10 )
+                                                ++eol;
+
+                                        cur_rank      = RANK_GREEN;
+                                        cur_range_len = eol - cur;
+                                        cur = eol;
+                                        STORE_RANGE;
+
+                                        continue;
+                                }
+
+                                if ( *(cur+1) == '*' )
+                                {
+                                        STORE_RANGE;
+                                        cur_rank      = RANK_GREEN;
+                                        cur_range_len = 2;
+                                        isComment     = 1;
+                                        cur          += 2;
+                                        isMultiline   = 1;
+                                        continue;
+                                }
+                       }
+                       
+                       NEXT_CHAR;
+               }
+
+           if (  ( is_alpha( *cur ) || *(cur) == '#' ) 
+                         && has_next 
+                  )
+               {
+                       if ( is_alpha( *(cur+1) ) )
+                       {
+                               char* start = cur;
+                               cur += 2;
+
+                               while ( cur != end && is_alpha(*cur) ) ++cur;
+
+                               int wordRank;
+                               
+                               if ( (wordRank = get_rank( start, cur )) > 0 )
+                               {
+                                       STORE_RANGE;
+
+                                       store_range( results, wordRank, int(cur-start) );
+                       cur_rank = cur_range_len = 0;
+                                       continue;
+                               }
+
+                               cur_range_len += ( cur-start );
+                               continue;
+                       }
+                       else
+                               NEXT_CHAR;
+               }
+
+               NEXT_CHAR;
+       }
+
+       if ( cur_range_len > 0 )  STORE_RANGE;
+}
+
+/***** Implementation for class SourcePainter ******/
+
+SourcePainter::SourcePainter( bool assembleResultString )
+       : mCollectResultsOn( assembleResultString ),
+         mIsInComment( FALSE ),
+         mCommentIsMultiline( FALSE )
+{
+       check_keyword_map(0);
+}
+
+void SourcePainter::ProcessSource( char* src, int srcLen )
+{
+       // TBD:: multilne state...
+
+       heighlight_syntax( src, srcLen, mBlocks, mIsInComment );
+
+       if ( mCollectResultsOn )
+       
+               mResultStr += string( src, srcLen );
+}
+
+void SourcePainter::SetState( bool isInComment,
+                                                         bool commentIsMultiline )
+{
+       mIsInComment        = isInComment;
+       mCommentIsMultiline = commentIsMultiline;
+}
+
+void SourcePainter::Init(bool assembleResultString)
+{
+       mIsInComment        = 0;
+       mCommentIsMultiline = 0;
+       mCollectResultsOn   = assembleResultString;
+
+       mResultStr = "";
+
+       mBlocks.erase( mBlocks.begin(), mBlocks.end() );
+}
+
+static int rank_tags_map[] = 
+{ 
+       TAG_BLACK_FONT, 
+       TAG_BLUE_FONT,
+       TAG_RED_FONT,
+       TAG_GREEN_FONT
+};
+
+void SourcePainter::GetResultString(string& result, MarkupTagsT tags)
+{
+       // this method works, only if results of processing 
+       // are collected
+       ASSERT( mCollectResultsOn ); 
+       result = "";
+
+       int pos = 0;
+
+       for( size_t i = 0; i != mBlocks.size(); ++i )
+       {
+               int desc = mBlocks[i];
+
+               int len  = desc & 0xFFFF;
+               int rank = (desc >> 16) & 0xFFFF;
+
+               result += tags[ rank_tags_map[rank] ].start;
+
+               for( int n = 0; n != len; ++n )
+               
+                       result += mResultStr[pos+n];
+
+               pos += len;
+
+               result += tags[ rank_tags_map[rank] ].end;
+       }
+}
+
+IntListT& SourcePainter::GetBlocks()
+{
+       return mBlocks;
+}
+
+bool SourcePainter::IsKeyword( char* word, int wordLen )
+{
+       check_keyword_map(0);
+
+       int rank = get_rank( word, word + wordLen );
+
+       return (  rank == RANK_BLUE || rank == RANK_RED );
+}
diff --git a/utils/wxPython/modules/lseditor/sourcepainter.h b/utils/wxPython/modules/lseditor/sourcepainter.h
new file mode 100644 (file)
index 0000000..ac177a9
--- /dev/null
@@ -0,0 +1,109 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        No names yet.
+// Purpose:     Contrib. demo
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     22/09/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleskandars Gluchovas
+// Licence:    GNU General Public License 
+/////////////////////////////////////////////////////////////////////////////
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation; either version 2 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef __SOURCEPAINTER_G__
+#define __SOURCEPAINTER_G__
+
+#ifndef ASSERT
+#define ASSERT(x) if (!(x)) throw
+#endif
+
+#include "wxstldefs.h"
+
+#include "markup.h" // import MarkupTagsT definition
+
+// "colored" codes for highlighted blocks
+
+#define RANK_BLACK  0 // common source fragments
+#define RANK_BLUE   1 // basic types
+#define RANK_RED    2 // reserved words
+#define RANK_GREEN  3 // comments
+
+// colored block description format :
+// int( ( rank << 16 ) | ( source_range_len ) )
+
+inline int get_src_block_rank( int block )
+{
+       return (block >> 16) & 0xFFFF;
+}
+
+inline int get_src_block_len( int block )
+{
+       return block & 0xFFFF;
+}
+
+// FOR NOW:: no lagnguage-map selection
+
+// source code syntax heighlighter (CPP+JAVA+VB+PASCAL)
+
+class SourcePainter
+{
+protected:
+       string            mResultStr;
+       IntListT  mBlocks;
+       bool          mCollectResultsOn;
+
+       // state variables
+       bool        mIsInComment;
+       bool        mCommentIsMultiline;
+public:
+
+       // assembleResultString == TRUE - instructs painter
+       // to collect each chunk of srouce passed to ProcessSource(),
+       // so that results cann be futher obtained in a single string 
+       // instead of vector of block descriptions
+
+       SourcePainter( bool assembleResultString = TRUE );
+       virtual ~SourcePainter() {}
+
+       // can be called multiple times (e.g. on each source line)
+       virtual void ProcessSource( char* src, int srcLen );
+
+       // method, for manually adjusting state of source painter
+       virtual void SetState( bool isInComment,
+                                              bool commentIsMultiline );
+
+       // reinitializes object - clears results of previouse processing
+       virtual void Init( bool assembleResultString = TRUE );
+
+       // generates string of highlighted source for the scipting
+       // language given by "tags" argument
+       
+       virtual void GetResultString(string& result, MarkupTagsT tags);
+
+       // returns vector of block descriptors, see IntListT definition
+       // (block descriptors can be used for fast custom hightlighted text generation)
+
+       virtual IntListT& GetBlocks();
+
+       // NOTE:: static method
+       // returns if the given word is a reserved word or basic type identifier
+       static bool IsKeyword( char* word, int wordLen );
+};
+
+#endif
diff --git a/utils/wxPython/modules/lseditor/tdefs.cpp b/utils/wxPython/modules/lseditor/tdefs.cpp
new file mode 100644 (file)
index 0000000..e65b2fe
--- /dev/null
@@ -0,0 +1,4233 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        No names yet.
+// Purpose:     Contrib. demo
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     03/04/1999
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleksandars Gluchovas
+// Licence:    GNU General Public License 
+/////////////////////////////////////////////////////////////////////////////
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation; either version 2 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+/////////////////////////////////////////////////////////////////////////////
+
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#include "wx/file.h"
+#include "wx/textdlg.h"
+#include "wx/clipbrd.h"
+#include "wx/dataobj.h"
+
+#include <stdio.h>
+
+#include "tdefs.h"
+#include "finddlg.h"
+
+#include <memory.h>
+
+/***** Implementation for class TBlock *****/
+
+void TBlock::RecalcBlockProperties()
+{
+       char* cur = mBuf;
+       char* end = mBuf + mTextLen;
+       mRowCount = 0;
+
+       while( cur < end )
+       {
+               if ( is_eol_char( *cur ) ) ++mRowCount;
+
+               ++cur;
+       }
+}
+
+/***** Implementation for class TTextIterator *****/
+
+string TTextIterator::mSeparators = ",.()[]\t\\+-*/|=<>:;\t\n~?!%";
+
+bool TTextIterator::IsSeparator( char ch )
+{
+       size_t sz = mSeparators.size();
+
+       for( size_t i = 0; i != sz; ++i )
+
+               if ( mSeparators[i] == ch ) return TRUE;
+
+       return FALSE;
+}
+
+char* TTextIterator::GetClosestPos()
+{
+       char*  end = GetBlockEnd();
+       char*  cur = mpCurRowStart;
+       size_t col = 0;
+
+       while( cur < end && col < mPos.mCol && !is_eol_char(*cur) )
+       {
+               if ( !is_DOS_eol_char( *cur ) ) ++col;
+               ++cur;
+       }
+
+       if ( is_DOS_eol_char( *cur ) ) ++cur;
+
+       return cur;
+}
+
+char* TTextIterator::GotoClosestPos()
+{
+       char*  end = GetBlockEnd();
+       char*  cur = mpCurRowStart;
+       size_t col = 0;
+
+       while( cur < end && col < mPos.mCol && !is_eol_char(*cur) )
+       {
+               if ( !is_DOS_eol_char( *cur ) ) ++col;
+               ++cur;
+       }
+
+       mPos.mCol = col;
+
+       if ( is_DOS_eol_char( *cur ) ) ++cur;
+
+       return cur;
+}
+
+TTextIterator::TTextIterator()
+
+       : mIsEof( FALSE )
+{}
+
+bool TTextIterator::IsLastLine()
+{
+       TBlockIteratorT nextBlk = mBlockIter;
+       ++nextBlk;
+
+       if ( nextBlk != mEndOfListIter ) return FALSE;
+
+       char* cur = mpCurRowStart;
+       char* end = GetBlockEnd();
+
+       while( cur < end && !is_eol_char( *cur ) ) ++cur;
+
+       if ( cur == end ) return TRUE;
+
+       ++cur;
+
+       return ( cur == end );
+}
+
+char TTextIterator::GetChar()
+{
+       char* cur = GetClosestPos();
+
+       if ( is_DOS_eol_char( *cur ) ) 
+
+               return *(cur+1);
+       else
+               return *cur;
+}
+
+bool TTextIterator::IsEol()
+{
+       return is_eol_char( GetChar() ) || mIsEof;
+}
+
+bool TTextIterator::IsEof()
+{
+       return mIsEof;
+}
+
+int TTextIterator::GetDistFromEol()
+{
+       return 0; // TBD::
+}
+
+void TTextIterator::NextChar()
+{
+       char* cur = GotoClosestPos();
+
+       if ( cur + 1 >= GetBlockEnd() )
+       {
+               TBlockIteratorT nextBlk = mBlockIter;
+               ++nextBlk;
+
+               if ( nextBlk == mEndOfListIter )
+               {
+                       if ( cur != GetBlockEnd() ) 
+                               ++mPos.mCol;    
+
+                       mIsEof = TRUE;
+                       return;
+               }
+
+               ++mPos.mRow ;
+               mPos.mCol = 0;
+
+               mBlockIter = nextBlk;
+
+               mFirstRowInBlock = mPos.mRow;
+               mActualRow       = mPos.mRow;
+               mpCurRowStart    = (*mBlockIter).mBuf;
+
+               mIsEof = ( (*mBlockIter).mTextLen == 0 );
+       }
+       else
+       {
+               if ( is_eol_char( *cur ) ) 
+               {
+                       ++mPos.mRow;
+                       mPos.mCol = 0;
+                       
+                       mActualRow    = mPos.mRow;
+                       mpCurRowStart = cur + 1;
+               }
+               else
+                       ++mPos.mCol;
+       }
+
+       mIsEof = (mpCurRowStart + mPos.mCol) == GetBlockEnd();
+}
+
+void TTextIterator::PreviousChar()
+{
+       char* cur = GotoClosestPos();
+
+       if ( cur == (*mBlockIter).mBuf )
+       {
+               TBlockIteratorT prevBlk = mBlockIter;
+               --prevBlk;
+
+               if ( prevBlk == mEndOfListIter )
+               {
+                       mIsEof = TRUE;
+                       return;
+               }
+
+               --mPos.mRow;
+
+               mBlockIter = prevBlk;
+
+               cur = GetBlockEnd() - 1;
+
+               char* eolPos = cur;
+               --cur; // skip EOL
+               char* start = (*mBlockIter).mBuf;
+
+               while( cur != start && !is_eol_char( *cur ) ) --cur; // goto start of line
+
+               if ( is_eol_char( *cur ) ) ++cur;
+
+               mPos.mCol     = (size_t)(eolPos - cur);
+               mpCurRowStart = cur;
+
+               mFirstRowInBlock = mPos.mRow;
+               mActualRow       = mPos.mRow;
+       }
+       else
+       {
+               do
+               {
+                       // FIXME FIXME:: this is more then messy .... !
+
+                       if ( is_eol_char( *(cur-1) ) ) 
+                       {
+                               --cur; // goto EOL
+
+                               --mPos.mRow;
+
+                               char* eolPos = cur;
+                               --cur; // skip EOL
+                               char* start = (*mBlockIter).mBuf;
+
+                               while( cur != start && !is_eol_char( *cur ) ) --cur; // goto start of line
+
+                               if ( is_eol_char( *cur ) ) ++cur;
+
+                               mPos.mCol     = (size_t)(eolPos - cur);
+                               mpCurRowStart = cur;
+
+                               if ( eolPos != cur && is_DOS_eol_char( *(eolPos-1) ) ) --mPos.mCol;
+                               
+                               mActualRow    = mPos.mRow;
+
+                               break;
+                       }
+                       else
+                       if ( is_DOS_eol_char( *(cur-1) ) )
+                       {
+                               --cur;
+
+                               if ( cur != (*mBlockIter).mBuf && is_eol_char( *(cur-1) ) )
+
+                                       continue;
+                               else
+                               {
+                                       --mPos.mCol;
+                                       --cur;
+                               }
+                       }
+                       else
+                       {
+                               --mPos.mCol;
+                               break;
+                       }
+
+               } while( 1 );
+       }
+
+       mIsEof = (mpCurRowStart + mPos.mCol) == GetBlockEnd();
+}
+
+void TTextIterator::NextWord()
+{
+       GotoClosestPos();
+
+       // skip non-white space ahead
+
+       bool wasSeparator = IsSeparator( GetChar() );
+
+       while( !IsEof() )
+       {
+               char ch = GetChar();
+
+               if ( ch == ' '  || 
+                        ch == '\t' || 
+                        is_eol_char(ch) ||
+                        wasSeparator != IsSeparator(ch) )
+
+                       break;
+
+               NextChar();
+       }
+
+       // skip all white stpace if any
+       while( !IsEof() )
+       {
+               char ch = GetChar();
+
+               if ( ch != ' ' && ch != '\t' && !is_eol_char(ch) )
+
+                       break;
+
+               NextChar();
+       }
+}
+
+void TTextIterator::PreviousWord()
+{
+       GotoClosestPos();
+
+       PreviousChar();
+
+       // skip all white stpace if any
+       while( !IsEof() )
+       {
+               char ch = GetChar();
+
+               if ( ch != ' ' && ch != '\t' && !is_eol_char(ch) )
+
+                       break;
+
+               PreviousChar();
+       }
+
+       bool wasSeparator = IsSeparator( GetChar() );
+
+       // skip word;
+       while( !IsEof() )
+       {
+               char ch = GetChar();
+
+               if ( ch == ' '       || 
+                        ch == '\t'      || 
+                        is_eol_char(ch) ||
+                        wasSeparator != IsSeparator(ch) 
+                  )
+               {
+                       NextChar();
+                       break;
+               }
+
+               PreviousChar();
+       }
+}
+
+void TTextIterator::ToEndOfLine()
+{
+       GotoClosestPos();
+
+       while( !IsEof() )
+       {
+               char ch = GetChar();
+
+               if ( is_eol_char( ch ) ) break;
+
+               NextChar();
+       }
+}
+
+void TTextIterator::ToStartOfLine()
+{
+       GotoClosestPos();
+
+       mPos.mCol = 0;
+       mPos.mRow = mActualRow;
+}
+
+size_t TTextIterator::GetLineLen()
+{
+       char* cur = mpCurRowStart;
+       char* end = GetBlockEnd();
+
+       size_t len = 0;
+
+       while( cur < end && !is_eol_char( *cur ) )
+       {
+               if ( !is_DOS_eol_char( *cur ) ) ++len;
+               ++cur;
+       }
+
+       return len;
+}
+
+TPosition TTextIterator::GetPosition()
+{
+       return mPos;
+}
+
+bool TTextIterator::IsInLastBlock()
+{
+       TBlockIteratorT next = mBlockIter;
+       ++next;
+
+       return next == mEndOfListIter;
+}
+
+bool TTextIterator::DetectUnixText()
+{
+       char* cur = GetBlockStart();
+       char* end = GetBlockEnd();
+
+       bool isUnixText = IS_UNIX_TEXT_BY_DEFAULT;
+
+       while( cur < end ) 
+       {
+               if ( is_DOS_eol_char( *cur ) ) return FALSE;
+
+               if ( is_eol_char( *cur ) ) return TRUE;
+
+               ++cur;
+       }
+
+       return isUnixText;
+}
+
+/***** Implementation for class TCppJavaHighlightListener *****/
+
+void TCppJavaHighlightListener::OnTextChanged( wxTextEditorModel* pModel, 
+                                                                                          size_t atRow, size_t nRows, 
+                                                                                          TEXT_CHANGE_TYPE ct ) 
+{
+       mpModel = pModel;
+       
+       /*
+
+       int state = GetStateAtRow( atRow );
+
+       if ( ct == CT_INSERTED )
+       {
+               RemoveCommentTags( atRow, atRow + nRows + 1 );
+               GenerateTagsForRange( atRows, atRows + nRows + 1 );
+       }
+       else
+       if ( ct == CT_DELETED )
+       {
+               RemoveCommentTags( atRow, atRow + 1 );
+               GenerateTagsForRange( atRows, atRows + 1 );
+       }
+       */
+}
+
+/***** Implementation for class wxTextEditorModel *****/
+
+/*** protected methods ***/
+
+size_t wxTextEditorModel::GetLineCountInRange( char* from, char* till )
+{
+       size_t nLines = 0;
+
+       while( from != till )
+       {
+               if ( is_eol_char( *from ) ) ++nLines;
+
+               ++from;
+       }
+
+       return nLines;
+}
+
+void wxTextEditorModel::DoInsertText( const TPosition& pos, 
+                                                                         char* text, size_t len,
+                                                                         TRange& actualRange )
+{
+       // FOR NOW:: very dummy imp.
+
+       char* end = text + len;
+
+       TTextIterator iter = CreateIterator( pos );
+
+       TBlock& blk = (*iter.mBlockIter);
+
+       char* cur = text;
+
+       char*  insertPos = iter.GotoClosestPos();
+       actualRange.mFrom = iter.GetPosition();
+
+       if ( is_eol_char( *insertPos ) &&
+                insertPos != iter.GetBlockStart()   &&
+                is_DOS_eol_char( *(insertPos-1) )
+          )
+          --insertPos;
+
+       size_t sizeAfter = (size_t)(iter.GetBlockEnd() - insertPos);
+
+       size_t nLines = GetLineCountInRange( text, text + len );
+
+       if ( blk.mTextLen + len < FILLED_BLOCK_LEN )
+       {
+               memmove( insertPos + len, insertPos, sizeAfter );
+
+               memcpy( insertPos, text, len );
+
+               blk.mTextLen += len;
+               
+
+               blk.RecalcBlockProperties();
+
+               if ( iter.IsInLastBlock() )
+
+                       ++blk.mRowCount; // last block have always the-last-row-to-spare -
+                                    // the "nature" of most text editors
+
+               char* endPos = insertPos + len;
+
+               bool found = FALSE;
+
+               /*
+               // OLD STUFF:: slow & buggy
+
+               while( !iter.IsEof() )
+               {
+                       if ( iter.GetClosestPos() == endPos )
+                       {
+                               actualRange.mTill = iter.GetPosition();
+                               found = TRUE;
+                               break;
+                       }
+
+                       iter.NextChar();
+               }
+
+               if ( !found )
+               {
+                       actualRange.mTill = iter.GetPosition();
+                       ++actualRange.mTill.mCol;
+                       
+                       //T_ASSERT( found ); // DBG::
+               }
+               */
+
+               actualRange.mTill       = actualRange.mFrom;
+               actualRange.mTill.mRow += nLines;
+
+               if ( nLines == 0 )
+
+                       actualRange.mTill.mCol = actualRange.mFrom.mCol + (len);
+               else
+               {
+                       cur = end;
+
+                       while( cur != insertPos && !is_eol_char( *cur ) )
+
+                               --cur;
+
+                       if ( is_eol_char( *cur ) ) ++cur;
+
+                       actualRange.mTill.mCol = (int)(end - cur);
+               }
+
+               NotifyTextChanged( pos.mRow, nLines, CT_INSERTED );
+       }
+       else
+       {
+               // TBD:::
+
+               char buf[16];
+               sprintf( buf, "%d", FILLED_BLOCK_LEN );
+               string msg = "Sorry!!! Currently editor is limited to files less then ";
+               msg += buf;
+               msg += " bytes\n(the requested text length is " + 
+               sprintf( buf, "%d", blk.mTextLen + len );
+               msg += buf; 
+               msg += " bytes)\n Please, close this file without making any changes.";
+
+               wxMessageBox( msg );
+
+               GetActiveView()->SetFocus();
+
+               //T_ASSERT(0); // DBG:: for now
+       }
+}
+
+void wxTextEditorModel::DoDeleteRange( const TPosition& from, const TPosition& till,
+                                                                          TRange& actualRange
+                                                                        )
+{
+       // FOR NOW:: very dummy imp.
+
+       TTextIterator iterFrom = CreateIterator( from );
+       TTextIterator iterTill = CreateIterator( till );
+
+       if ( iterFrom.mBlockIter == iterTill.mBlockIter )
+       {
+               char* fromPos = iterFrom.GotoClosestPos();
+               char* tillPos = iterTill.GotoClosestPos();
+               char* blockStart = (*iterFrom.mBlockIter).mBuf;
+               
+               if ( is_eol_char( *fromPos ) &&
+                        fromPos != blockStart   &&
+                        is_DOS_eol_char( *(fromPos-1) )
+                  )
+                  --fromPos;
+
+               if ( is_eol_char( *tillPos ) &&
+                        tillPos != blockStart   &&
+                        is_DOS_eol_char( *(tillPos-1) )
+                  )
+                  --tillPos;
+
+               size_t len = (size_t)( tillPos -fromPos );
+               
+               size_t nLines = GetLineCountInRange( fromPos, fromPos + len );
+
+               size_t sizeAfter = (size_t)(iterFrom.GetBlockEnd() - tillPos);
+
+               memmove( fromPos, tillPos, sizeAfter );
+
+               (*iterFrom.mBlockIter).mTextLen -= len;
+
+               (*iterFrom.mBlockIter).RecalcBlockProperties();
+
+               if ( iterFrom.IsInLastBlock() )
+
+                       ++(*iterFrom.mBlockIter).mRowCount; // last block have always the-last-row-to-spare -
+                                                                                               // the "nature" of most text editors
+
+               actualRange.mFrom = iterFrom.GetPosition();
+               actualRange.mTill = iterTill.GetPosition();
+
+               NotifyTextChanged( from.mRow, nLines, CT_DELETED );
+       }
+       else
+               T_ASSERT(0); // DBG:: for now
+}
+
+void wxTextEditorModel::GetTextFromRange( const TPosition& from, const TPosition& till, 
+                                                                                 char** text, size_t& textLen 
+                                                                               )
+{
+       TTextIterator iterFrom = CreateIterator( from );
+       TTextIterator iterTill = CreateIterator( till );
+
+       if ( iterFrom.mBlockIter == iterTill.mBlockIter )
+       {
+               char* blockStart = (*iterFrom.mBlockIter).mBuf;
+
+               char* fromPos = iterFrom.GetClosestPos();
+               char* tillPos = iterTill.GetClosestPos();
+
+               if ( is_eol_char( *fromPos ) &&
+                        fromPos != blockStart   &&
+                        is_DOS_eol_char( *(fromPos-1) )
+                  )
+                  --fromPos;
+
+               if ( is_eol_char( *tillPos ) &&
+                        tillPos != blockStart   &&
+                        is_DOS_eol_char( *(tillPos-1) )
+                  )
+                  --tillPos;
+
+               textLen = (size_t)( tillPos -fromPos );
+
+               *text = AllocCharacters( textLen );
+
+               memcpy( *text, fromPos, textLen );
+       }
+       else
+               T_ASSERT(0); // DBG:: for now
+}
+
+void wxTextEditorModel::LoadTextFromFile( const wxString& fname )
+{
+       T_ASSERT( wxFile::Exists( fname ) );
+
+       DeleteAllText();
+
+       wxFile fl( fname );
+
+       char* buf = AllocCharacters( fl.Length() );
+
+       fl.Read( buf, fl.Length() );
+
+       TRange result;
+       DoInsertText( TPosition( 0,0 ), buf, fl.Length(), result );
+
+       FreeCharacters( buf );
+
+       TTextIterator iter = CreateIterator( TPosition( 0,0 ) );
+
+       mIsUnixText = iter.DetectUnixText();
+
+       ClearUndoBuffer();
+
+       NotifyAllViews();
+}
+
+void wxTextEditorModel::SaveTextToFile( const wxString& fname )
+{
+       wxFile fl( fname, wxFile::write );
+
+       char* text = 0;
+       size_t len = 0;
+
+       GetTextFromRange( TPosition(0,0), TPosition( GetTotalRowCount()+1,0 ), &text, len );
+
+       fl.Write( text, len );
+       fl.Close();
+
+       FreeCharacters( text );
+}
+
+void wxTextEditorModel::NotifyTextChanged( size_t atRow, size_t nRows, TEXT_CHANGE_TYPE ct )
+{
+       if ( nRows > 0  )
+       
+               MergeChange( atRow, mRowsPerPage );
+       else
+               MergeChange( atRow, 1 );
+
+       // reposition bookmarsk
+
+       if ( nRows > 0 )
+       {
+               if ( ct == CT_INSERTED )
+               {
+                       size_t curPin = FindNextPinFrom( atRow + 1 );
+
+                       while( curPin != NPOS )
+                       {
+                               mPins[curPin]->mRow += nRows;
+
+                               ++curPin;
+
+                               if ( curPin == mPins.size() ) break;
+                       }
+               }
+               else
+               if ( ct == CT_DELETED )
+               {
+                       size_t curPin  = FindNextPinFrom( atRow + 1 );
+                       size_t fromPin = curPin;
+                       size_t tillRow = atRow + nRows;
+
+                       while( curPin != NPOS && mPins[curPin]->mRow < tillRow )
+                       {
+                               ++curPin;
+
+                               if ( curPin == mPins.size() ) break;
+                       }
+
+                       if ( fromPin != NPOS && nRows != 0 )
+                       {
+                               mPins.erase( &mPins[fromPin], &mPins[curPin] );
+
+                               while( curPin < mPins.size() )
+                               {
+                                       mPins[curPin]->mRow -= nRows;
+                                       ++curPin;
+                               }
+                       }
+               }
+       }
+
+
+       // send notificaitons
+
+       for( size_t i = 0; i != mChangeListeners.size(); ++i )
+
+               mChangeListeners[i]->OnTextChanged( this, atRow, nRows, ct );
+}
+
+void wxTextEditorModel::NotifyTextChanged( TPosition from, TPosition till, TEXT_CHANGE_TYPE ct )
+{
+       ArrangePositions( from, till );
+
+       NotifyTextChanged( from.mRow, till.mRow - from.mRow + 1, ct );
+}
+
+void wxTextEditorModel::DoExecuteNewCommand( TCommand& cmd )
+{
+       if ( cmd.mType == TCMD_INSERT )
+       {
+               cmd.mPrePos = mCursorPos;
+               DoInsertText( cmd.mRange.mFrom, cmd.mData, cmd.mDataLen, cmd.mRange );
+       }
+       else
+       if ( cmd.mType == TCMD_DELETE )
+       {
+               cmd.mPrePos = mCursorPos;
+               DoDeleteRange( cmd.mRange.mFrom, cmd.mRange.mTill, cmd.mRange );
+       }
+}
+
+void wxTextEditorModel::DoReexecuteCommand( TCommand& cmd )
+{
+       NotifyTextChanged( mCursorPos.mRow, 1, CT_MODIFIED ); // indicate update of current cursor position
+
+       if ( cmd.mType == TCMD_INSERT )
+       {
+               DoInsertText( cmd.mRange.mFrom, cmd.mData, cmd.mDataLen, cmd.mRange );
+               mCursorPos = cmd.mPostPos;
+       }
+       else
+       if ( cmd.mType == TCMD_DELETE )
+       {
+               DoDeleteRange( cmd.mRange.mFrom, cmd.mRange.mTill, cmd.mRange );
+               mCursorPos = cmd.mPostPos;
+       }
+
+       NotifyTextChanged( mCursorPos.mRow, 1, CT_MODIFIED ); // indicate update of current cursor position
+}
+
+void wxTextEditorModel::DoUnexecuteCommand( TCommand& cmd )
+{
+       NotifyTextChanged( mCursorPos.mRow, 1, CT_MODIFIED ); // indicate update of current cursor position
+       
+       if ( cmd.mType == TCMD_INSERT )
+       {
+               DoDeleteRange( cmd.mRange.mFrom, cmd.mRange.mTill, cmd.mRange );
+               mCursorPos = cmd.mPrePos;
+       }
+       else                                    
+       if ( cmd.mType == TCMD_DELETE )
+       {
+               DoInsertText( cmd.mRange.mFrom, cmd.mData, cmd.mDataLen, cmd.mRange );
+               mCursorPos = cmd.mPrePos;
+       }
+
+       NotifyTextChanged( mCursorPos.mRow, 1, CT_MODIFIED ); // indicate update of current cursor position
+}
+
+void wxTextEditorModel::UndoImpl()
+{
+       --mCurCommand;
+
+       DoUnexecuteCommand( *mCommands[mCurCommand] );
+}
+
+void wxTextEditorModel::RedoImpl()
+{
+       DoReexecuteCommand( *mCommands[mCurCommand] );
+
+       ++mCurCommand;
+}
+
+void wxTextEditorModel::ExecuteCommand( TCommand* pCmd )
+{
+       if ( mCurCommand < mCheckPointCmdNo )
+
+               // new command is executed before the checkpoint,
+               // and every thing is sliced - invalidate it
+
+               mCheckPointDestroyed = TRUE;
+
+       // slice undo-able commands ahead in the queue,
+       // they wont ever be reexecuted
+
+       while( mCommands.size() > mCurCommand )
+       {
+               delete mCommands.back();
+
+               mCommands.pop_back();
+       }
+
+       mCommands.push_back( pCmd );
+
+       DoExecuteNewCommand( *pCmd );
+       ++mCurCommand;
+}
+
+bool wxTextEditorModel::CanPrependCommand( TCommand* pCmd )
+{
+       if ( mCommands.size() != mCurCommand ||
+                mCommands.size() == 0 ) 
+                
+                return FALSE;
+
+       TCommand& prevCmd = *mCommands.back();
+
+       if ( !(prevCmd.mRange.mTill == pCmd->mRange.mFrom) ) 
+
+               return FALSE;
+
+       char prevCh = prevCmd.mData[ prevCmd.mDataLen - 1];
+       char curCh  = pCmd->mData[0];
+
+       if ( prevCh == curCh ) return TRUE;
+
+       if ( prevCh == ' ' || curCh == ' ') return FALSE;
+
+       if ( TTextIterator::IsSeparator(prevCh) !=
+                TTextIterator::IsSeparator(curCh) )
+
+                return FALSE;
+       
+       return TRUE;
+}
+
+void wxTextEditorModel::PrependCommand( TCommand* pCmd )
+{
+       if ( mCheckPointCmdNo == mCurCommand )
+
+               mCheckPointDestroyed = TRUE;
+
+       TCommand& prevCmd = *mCommands.back();
+
+       DoExecuteNewCommand( *pCmd );
+
+       TCommand* pComb = new TCommand();
+
+       pComb->mType    = TCMD_INSERT;
+       pComb->mDataLen = prevCmd.mDataLen + pCmd->mDataLen;
+
+       pComb->mData        = AllocCharacters( pComb->mDataLen );
+       pComb->mRange.mFrom = prevCmd.mRange.mFrom;
+       pComb->mRange.mTill = pCmd->mRange.mTill;
+       pComb->mPrePos      = prevCmd.mPrePos;
+       pComb->mPostPos     = pCmd->mPostPos;
+
+       memcpy( pComb->mData, prevCmd.mData, prevCmd.mDataLen );
+       memcpy( pComb->mData + prevCmd.mDataLen, pCmd->mData, pCmd->mDataLen );
+
+       FreeCharacters( prevCmd.mData );
+       FreeCharacters( pCmd->mData );
+
+       delete &prevCmd;
+       delete pCmd;
+
+       mCommands[ mCommands.size() - 1 ] = pComb;
+}
+
+void wxTextEditorModel::SetPostPos( const TPosition& pos )
+{
+       mCommands[mCurCommand-1]->mPostPos = pos;
+}
+
+bool wxTextEditorModel::SelectionIsEmpty()
+{
+       return mSelectionStart == mSelectionEnd;
+}
+
+void wxTextEditorModel::StartBatch()
+{
+       // TBD::
+}
+
+void wxTextEditorModel::FinishBatch()
+{
+       // TBD::
+}
+
+void wxTextEditorModel::DeleteRange( const TPosition& from, const TPosition& till )
+{
+       TCommand* pCmd = new TCommand();
+
+       pCmd->mType     = TCMD_DELETE;
+
+       pCmd->mRange.mFrom = from;
+       pCmd->mRange.mTill = till;
+       pCmd->mPrePos      = mCursorPos;
+
+       GetTextFromRange( from, till, &pCmd->mData, pCmd->mDataLen );
+
+       ExecuteCommand( pCmd );
+}
+
+void wxTextEditorModel::InsertText( const TPosition& pos, const char* text, size_t len )
+{
+       TCommand* pCmd = new TCommand();
+
+       pCmd->mType     = TCMD_INSERT;
+
+       pCmd->mRange.mFrom = pos;
+
+       pCmd->mData     = AllocCharacters( len, text ), 
+       pCmd->mDataLen  = len;
+       pCmd->mPrePos   = mCursorPos;
+
+       ExecuteCommand( pCmd );
+}
+
+void wxTextEditorModel::DeleteSelection()
+{
+       DeleteRange( mSelectionStart, mSelectionEnd );
+
+       ResetSelection();       
+}
+
+bool wxTextEditorModel::IsLastLine( const TPosition& pos )
+{
+       return FALSE;
+}
+
+TTextIterator wxTextEditorModel::CreateIterator( const TPosition& pos )
+{
+       size_t curRow = 0;
+
+       TBlockIteratorT bIter = mBlocks.begin();
+
+       TTextIterator tIter;
+
+       while( bIter != mBlocks.end() )
+       {
+               TBlockIteratorT nextBlk = bIter;
+               ++nextBlk;
+
+               if ( nextBlk == mBlocks.end() ||
+                        ( pos.mRow >= curRow && 
+                          pos.mRow <= curRow + (*bIter).mRowCount )
+                  )
+               {
+                       tIter.mFirstRowInBlock = curRow;
+
+                       char* cur = (*bIter).mBuf;
+                       char* end = cur + (*bIter).mTextLen;
+
+                       // slightly optimized
+
+                       if ( curRow < pos.mRow )
+                       {
+                               while( cur < end )
+                               {
+                                       if ( is_eol_char( *cur ) ) 
+                                       {
+                                               ++curRow;
+
+                                               if ( !(curRow < pos.mRow) ) 
+                                               {
+                                                       ++cur;
+                                                       break;
+                                               }
+                                       }
+
+                                       ++cur;
+                               }
+                       }
+
+                       tIter.mActualRow    = curRow;
+                       tIter.mpCurRowStart = cur;
+                       tIter.mPos          = pos;
+
+                       // FOR NOW:: positioning past the end of file is not supported
+                       tIter.mPos.mRow     = curRow;
+
+                       tIter.mBlockIter     = bIter;
+                       tIter.mEndOfListIter = mBlocks.end();
+
+                       break;
+               }
+               else
+               {
+                       curRow += (*bIter).mRowCount;
+                       ++bIter;
+               }
+       }
+
+       return tIter;
+}
+
+void wxTextEditorModel::ArrangePositions( TPosition& upper, TPosition& lower )
+{
+       if ( upper > lower )
+       {
+               TPosition tmp( lower );
+               lower = upper;
+               upper = tmp;
+       }
+}
+
+void wxTextEditorModel::ArrangePositions( size_t& upper, size_t& lower )
+{
+       if ( upper > lower )
+       {
+               size_t tmp = lower;
+               lower = upper;
+               upper = tmp;
+       }
+}
+
+void wxTextEditorModel::MergeChange( size_t fromRow, size_t nRows )
+{
+       if ( mTextChanged == FALSE )
+       {
+               mChangedFromRow = fromRow;
+               mChangedTillRow = fromRow + nRows;
+               mTextChanged    = TRUE;
+       }
+       else
+       {
+               if ( mChangedFromRow > fromRow )
+
+                       mChangedFromRow = fromRow;
+
+               if ( mChangedTillRow < fromRow + nRows )
+
+                       mChangedTillRow = fromRow + nRows;
+       }
+}
+
+void wxTextEditorModel::TrackSelection()
+{
+       if ( !mIsSelectionEditMode ) return;
+
+       if ( mPrevCursorPos == mSelectionStart )
+
+               mSelectionStart = mCursorPos;
+       else
+               mSelectionEnd   = mCursorPos;
+               
+       ArrangePositions( mSelectionStart, mSelectionEnd );
+
+       NotifyTextChanged( mSelectionStart, mPrevSelectionStart, CT_MODIFIED );
+       NotifyTextChanged( mSelectionEnd,   mPrevSelectionEnd,   CT_MODIFIED );
+}
+
+void wxTextEditorModel::CheckSelection()
+{
+       ArrangePositions( mSelectionStart, mSelectionEnd );
+
+       if ( mIsSelectionEditMode && SelectionIsEmpty() )
+       {
+               mSelectionStart = mCursorPos;
+               mSelectionEnd   = mCursorPos;
+       }
+
+       if ( !mIsSelectionEditMode && !SelectionIsEmpty() )
+       {
+               ResetSelection();
+       }
+
+       mPrevSelectionStart = mSelectionStart;
+       mPrevSelectionEnd   = mSelectionEnd;
+       mPrevCursorPos      = mCursorPos;
+}
+
+void wxTextEditorModel::ResetSelection()
+{
+       if ( SelectionIsEmpty() ) return;
+
+       MergeChange( mSelectionStart.mRow, 
+                                mSelectionEnd.mRow - mSelectionStart.mRow + 1 );
+
+       NotifyTextChanged( mSelectionStart, mSelectionEnd, CT_MODIFIED );
+
+       mSelectionStart = TPosition(0,0);
+       mSelectionEnd   = TPosition(0,0);
+
+}
+
+void wxTextEditorModel::ClearUndoBuffer()
+{
+       for( size_t i = 0; i != mCommands.size(); ++i )
+       {
+               TCommand& cmd = *mCommands[i];
+
+               if ( cmd.mData ) delete [] cmd.mData;
+
+               delete &cmd;
+       }
+
+       mCommands.erase( mCommands.begin(), mCommands.end() );
+
+       mCurCommand = 0;
+}
+
+void wxTextEditorModel::GetAllText( char** text, size_t& textLen )
+{
+       GetTextFromRange( TPosition(0,0), TPosition( GetTotalRowCount()+1, 0 ),
+                             text, textLen
+                           );
+}
+
+void wxTextEditorModel::DeleteAllText()
+{
+       ResetSelection();
+
+       DeleteRange( TPosition(0,0), TPosition( GetTotalRowCount()+1, 0 ) );
+}
+
+void wxTextEditorModel::SetSelectionEditMode( bool editIsOn )
+{
+       mIsSelectionEditMode = editIsOn;
+}
+
+size_t wxTextEditorModel::GetTotalRowCount()
+{
+       size_t nRows = 0;
+
+       for( TBlockIteratorT i = mBlocks.begin(); i != mBlocks.end(); ++i )
+
+               nRows += (*i).mRowCount;
+
+       return nRows;
+}
+
+void wxTextEditorModel::GetSelection( char** text, size_t& textLen )
+{
+       GetTextFromRange( GetStartOfSelection(), GetEndOfSelection(), text, textLen );
+}
+
+void wxTextEditorModel::NotifyView()
+{
+       mpActiveView->OnModelChanged();
+}
+
+void wxTextEditorModel::NotifyAllViews()
+{
+       for( size_t i = 0; i != mViews.size(); ++i )
+
+               mViews[i]->OnModelChanged();
+}
+
+void wxTextEditorModel::PrepreForCommand()
+{
+       mTextChanged    = 0;
+       mChangedFromRow = 0;
+       mChangedTillRow = 0;
+}
+
+size_t wxTextEditorModel::TextToScrColumn( const TPosition& pos )
+{
+       TPosition spos;
+
+       mpActiveView->TextPosToScreenPos( pos, spos );
+       
+       return spos.mCol + mpActiveView->GetPagePos().mCol;
+}
+
+size_t wxTextEditorModel::ScrToTextColumn( TPosition pos )
+{
+       TPosition tpos;
+
+       pos.mCol -= mpActiveView->GetPagePos().mCol;
+       pos.mRow -= mpActiveView->GetPagePos().mRow;
+
+       mpActiveView->ScreenPosToTextPos( pos, tpos );
+
+       return tpos.mCol;
+}
+
+void wxTextEditorModel::DoMoveCursor( int rows, int cols )
+{
+       mCursorPos.mCol = TextToScrColumn( mCursorPos );
+
+       mCursorPos.mRow += rows;
+       mCursorPos.mCol += cols;
+
+       mCursorPos.mCol = ScrToTextColumn( mCursorPos );
+}
+
+/*** public interface ***/
+
+wxTextEditorModel::wxTextEditorModel()
+
+       : 
+         mpActiveView( NULL ),
+         mTabSize( 4 ),
+         mIsSelectionEditMode( FALSE ),
+         mRowsPerPage( 0 ),
+         mTextChanged( FALSE ),
+         mCurCommand( 0 ),
+
+         mInsertMode     ( TRUE  ),
+         mAutoIndentMode ( TRUE  ),
+         mSmartIndentMode( TRUE  ),
+         mWasChanged     ( FALSE ),
+         mIsReadOnly     ( FALSE ),
+         mIsUnixText     ( IS_UNIX_TEXT_BY_DEFAULT )
+{
+       // at least one block should be present
+       // (otherwise text-iterators wont work)
+
+       mBlocks.push_back( TBlock() );
+}
+
+wxTextEditorModel::~wxTextEditorModel()
+{
+       ClearUndoBuffer();
+}
+
+char* wxTextEditorModel::AllocCharacters( size_t n )
+{
+       return new char[n];
+}
+
+char* wxTextEditorModel::AllocCharacters( size_t n, const char* srcBuf )
+{
+       char* destBuf = AllocCharacters( n );
+
+       memcpy( destBuf, srcBuf, n );
+
+       return destBuf;
+}
+
+void wxTextEditorModel::FreeCharacters( char* buf )
+{
+       delete [] buf;
+}
+
+void wxTextEditorModel::OnInsertChar( char ch )
+{
+       if ( ch == 27 ) return; // hack
+
+       if ( is_DOS_eol_char( ch ) ) ch = '\n';
+
+       PrepreForCommand();
+       StartBatch();
+
+       TCommand* pCmd = new TCommand();
+
+       pCmd->mType    = TCMD_INSERT;
+
+       if ( ch == '\n' && !mIsUnixText ) 
+       {
+               // DOS text with CR-LF pair
+               pCmd->mData    = AllocCharacters( 2 );
+               pCmd->mDataLen = 2;
+               pCmd->mData[0] = (char)13;
+               pCmd->mData[1] = (char)10;
+       }
+       else
+       {
+               pCmd->mData    = AllocCharacters( 1 );
+               pCmd->mDataLen = 1;
+               pCmd->mData[0] = ch;
+       }
+
+
+       if ( !SelectionIsEmpty() )
+       {
+               mCursorPos = mSelectionStart;
+               DeleteSelection();
+       }
+
+       pCmd->mRange.mFrom = mCursorPos;
+
+       if ( mInsertMode == FALSE )
+       {
+               TPosition nextPos( mCursorPos.mRow, mCursorPos.mCol + 1 );
+               DeleteRange( mCursorPos, nextPos );
+
+               SetPostPos( mCursorPos );
+       }
+
+       TTextIterator iter = CreateIterator( mCursorPos );
+
+       size_t lineLen = iter.GetLineLen();
+
+       bool indentAdded = FALSE;
+
+       if ( mCursorPos.mCol > lineLen )
+       {
+
+               wxString s( ' ', mCursorPos.mCol - lineLen );
+               InsertText( TPosition( mCursorPos.mRow, lineLen ), s.c_str(), s.length() );
+
+               SetPostPos( mCursorPos );
+
+               indentAdded = TRUE;
+       }
+
+       if ( CanPrependCommand( pCmd ) || indentAdded )
+
+               PrependCommand( pCmd );
+       else
+               ExecuteCommand( pCmd );
+
+       ++mCursorPos.mCol;
+
+       if ( is_eol_char( ch ) )
+       {
+               mCursorPos.mCol = 0;
+               ++mCursorPos.mRow;
+
+               SetPostPos( mCursorPos );
+
+               if ( mAutoIndentMode )
+               {
+                       iter.ToStartOfLine();
+                       wxString indent;
+
+                       while( !iter.IsEol() )
+                       {
+                               char ch = iter.GetChar();
+
+                               if ( ch == '\t' || ch == ' ' )
+
+                                       indent += ch;
+                               else
+                                       break;
+
+                               iter.NextChar();
+                       }
+
+                       if ( indent.length() )
+                       {
+                               // auto-indent is always prepended to the command which
+                               // caused it
+
+                               mCursorPos = TPosition( mCursorPos.mRow, 0 );
+
+
+                               TCommand* pICmd = new TCommand();
+                               pICmd->mType    = TCMD_INSERT;
+                               pICmd->mData    = AllocCharacters( indent.length() );
+                               pICmd->mDataLen = indent.length();
+                               memcpy( pICmd->mData, indent, indent.length() );
+
+                               pICmd->mRange.mFrom = TPosition( mCursorPos.mRow, 0 );
+
+                               PrependCommand( pICmd );
+
+                               SetPostPos( mCursorPos );
+
+                               mCursorPos.mCol = indent.length();
+                       }
+               }
+       }
+       else
+               SetPostPos( mCursorPos );
+
+       FinishBatch();
+
+       NotifyAllViews();
+}
+
+void wxTextEditorModel::OnDelete()
+{
+       PrepreForCommand();
+       StartBatch();
+
+       if ( !SelectionIsEmpty() )
+       {
+               TPosition startPos = mSelectionStart;
+               DeleteSelection();
+               mCursorPos = startPos;
+       }
+       else
+       {
+               TTextIterator iter = CreateIterator( mCursorPos );
+               
+               if ( iter.GetLineLen() == mCursorPos.mCol && !iter.IsLastLine() )
+               {
+                       TPosition nextPos( mCursorPos.mRow+1, 0 );
+                       DeleteRange( mCursorPos, nextPos );
+                       NotifyTextChanged( mCursorPos.mRow, 2, CT_DELETED );
+               }
+               else
+               {
+                       TPosition nextPos( mCursorPos.mRow, mCursorPos.mCol + 1 );
+                       DeleteRange( mCursorPos, nextPos );
+               }
+       }
+
+       SetPostPos( mCursorPos );
+
+       FinishBatch();
+
+       NotifyAllViews();
+}
+
+void wxTextEditorModel::OnDeleteBack()
+{
+       PrepreForCommand();
+       StartBatch();
+
+       if ( !SelectionIsEmpty() )
+       {
+               mCursorPos = mSelectionStart;
+               DeleteSelection();
+       }
+       else
+       if ( !(mCursorPos == TPosition(0,0)) )
+       {
+               TPosition prevPos;
+
+               if ( mCursorPos.mCol == 0 )
+               {
+                       TTextIterator iter = CreateIterator( mCursorPos );
+                       iter.PreviousChar();
+
+                       prevPos = iter.GetPosition();
+               }
+               else
+                       prevPos = TPosition( mCursorPos.mRow, mCursorPos.mCol - 1 );
+
+               DeleteRange( prevPos, mCursorPos );
+
+               mCursorPos = prevPos;
+       }
+
+       SetPostPos( mCursorPos );
+
+       FinishBatch();
+
+       NotifyAllViews();
+
+}
+
+void wxTextEditorModel::OnDeleteLine()
+{
+       PrepreForCommand();
+       StartBatch();
+
+       DeleteSelection();
+
+       TTextIterator iter = CreateIterator( mCursorPos );
+
+       iter.ToStartOfLine();
+
+       TPosition from = iter.GetPosition();
+
+       iter.ToEndOfLine();
+
+       if ( iter.IsLastLine() == FALSE )
+
+               iter.NextChar(); // delete eol-char also, if it's not the last line
+
+       TPosition till = iter.GetPosition();
+
+       DeleteRange( from, till );
+       SetPostPos( mCursorPos );
+
+       FinishBatch();
+
+       NotifyAllViews();
+}
+
+void wxTextEditorModel::OnShiftSelectionIndent( bool left )
+{
+       if ( SelectionIsEmpty() ) return;
+
+       PrepreForCommand();
+       StartBatch();
+
+       for( size_t row = mSelectionStart.mRow; row != mSelectionEnd.mRow; ++row )
+       {
+               TTextIterator iter = CreateIterator( TPosition( row, 0 ) );
+
+               if ( left )
+               {
+                       int n = 0, pos = 0;
+
+                       while( !iter.IsEol() && !iter.IsEof() )
+                       {
+                               char ch = iter.GetChar();
+
+                               if ( pos == mTabSize ) break;
+
+                               if ( ch != ' ' && ch != '\t' ) break;
+
+                               ++n;
+
+                               if ( ch == '\t' ) break;
+
+                               ++pos;
+
+                               iter.NextChar();
+                       }
+
+                       if ( n ) DeleteRange( TPosition( row,0 ), TPosition( row, n ) );
+               }
+               else
+               {
+                       char txt = '\t';
+
+                       InsertText( TPosition( row, 0 ), &txt, sizeof(char) );
+               }
+       }
+
+       FinishBatch();
+       NotifyAllViews();
+}
+
+void wxTextEditorModel::OnPaste()
+{
+       // FIXME:: "wxLogQueryInterface(..)" linking problems with MSDev4.0
+       
+#ifdef __HACK_MY_MSDEV40__
+
+       bool alreadyOpen=wxClipboardOpen();
+       if (!alreadyOpen)
+       {
+               wxOpenClipboard();
+       }
+
+       char* data = (char*)::wxGetClipboardData( wxDF_TEXT );
+
+       wxCloseClipboard();
+
+       if ( data == NULL ) return;
+
+       PrepreForCommand();
+       StartBatch();
+
+       if ( !SelectionIsEmpty() )
+       {
+               mCursorPos = GetStartOfSelection();
+               DeleteSelection();
+       }
+
+       InsertText( mCursorPos, data, strlen( data ) );
+
+       delete [] data;
+#else
+
+       if ( !wxTheClipboard->Open() ) return;
+
+       wxTextDataObject data;
+       if ( !wxTheClipboard->IsSupported(wxDF_TEXT) ) 
+       {
+               wxTheClipboard->Close();
+               return;
+       }
+
+       wxTheClipboard->GetData(&data);
+
+       string txt = data.GetText();
+
+       wxTheClipboard->Close();
+
+       PrepreForCommand();
+       StartBatch();
+
+       DeleteSelection();
+
+       InsertText( mCursorPos, txt.c_str(), txt.length() );
+#endif
+
+
+       mCursorPos = mCommands.back()->mRange.mTill;
+       SetPostPos( mCursorPos );
+
+       FinishBatch();
+       NotifyAllViews();
+}
+
+void wxTextEditorModel::OnCut()
+{
+       OnCopy();
+
+       PrepreForCommand();
+       StartBatch();
+
+       DeleteSelection();
+       SetPostPos( mCursorPos );
+
+
+       FinishBatch();
+       NotifyAllViews();
+}
+
+void wxTextEditorModel::OnCopy()
+{
+       if ( !SelectionIsEmpty() )
+       {
+               size_t len  = 0;
+               char*  text = NULL;
+
+#ifndef __HACK_MY_MSDEV40__
+
+               if ( !wxTheClipboard->Open() ) return;
+
+               GetTextFromRange( mSelectionStart, mSelectionEnd, &text, len );
+
+               wxString s( text, len );
+
+           wxTheClipboard->AddData( new wxTextDataObject(s) );
+               wxTheClipboard->Close();
+
+               FreeCharacters( text );
+#else
+               bool alreadyOpen=wxClipboardOpen();
+               if (!alreadyOpen)
+               {
+                       wxOpenClipboard();
+                       if (!wxEmptyClipboard()) 
+                       {
+                               wxCloseClipboard();
+                               return;
+                       }
+               }
+
+               GetTextFromRange( mSelectionStart, mSelectionEnd, &text, len );
+
+               wxString s( text, len );
+
+               bool success = ::wxEmptyClipboard();
+
+               success = wxSetClipboardData( wxDF_TEXT, (wxObject*)s.c_str(), 0,0 );
+
+               FreeCharacters( text );
+
+               wxCloseClipboard();
+
+#endif
+       }
+}
+
+bool wxTextEditorModel::CanCopy()
+{
+       return !SelectionIsEmpty();
+}
+
+bool wxTextEditorModel::CanPaste()
+{
+       if ( mIsReadOnly ) return FALSE;
+
+#ifndef __HACK_MY_MSDEV40__
+
+       if ( !wxTheClipboard->Open() ) return FALSE;
+
+       if ( !wxTheClipboard->IsSupported(wxDF_TEXT) )
+               return FALSE;
+
+       wxTheClipboard->Close();
+
+       return TRUE;
+
+#else
+
+       bool success = ::wxClipboardOpen();
+
+       bool alreadyOpen=wxClipboardOpen();
+       if (!alreadyOpen)
+       {
+               wxOpenClipboard();
+       }
+
+       char* data = (char*)::wxGetClipboardData( wxDF_TEXT );
+
+       wxCloseClipboard();
+
+       if ( data != NULL && strlen(data) != 0 )
+       {
+               delete [] data;
+               return TRUE;
+       }
+       else
+       {
+               delete [] data;
+               return FALSE;
+       }
+
+#endif
+
+}
+
+bool wxTextEditorModel::CanUndo()
+{
+       return !( mCommands.size() == 0 ||
+                         mCurCommand == 0 );
+}
+
+bool wxTextEditorModel::CanRedo()
+{
+       return mCurCommand != mCommands.size();
+}
+
+void wxTextEditorModel::OnUndo()
+{
+       if ( !CanUndo() ) return;
+
+       PrepreForCommand();
+       StartBatch();
+
+       ResetSelection();
+
+       UndoImpl();
+
+       FinishBatch();
+       NotifyAllViews();
+}
+
+void wxTextEditorModel::OnRedo()
+{
+       if ( !CanRedo() ) return;
+
+       PrepreForCommand();
+       StartBatch();
+
+       ResetSelection();
+
+       RedoImpl();
+
+       FinishBatch();
+       NotifyAllViews();
+}
+
+void wxTextEditorModel::OnMoveLeft()
+{
+       PrepreForCommand();
+       CheckSelection();
+
+       if ( mCursorPos.mCol == 0 )
+       {
+               if ( mCursorPos.mRow != 0 )
+               {
+                       --mCursorPos.mRow;
+
+                       TTextIterator iter = CreateIterator( mCursorPos );
+
+                       iter.ToEndOfLine();
+
+                       mCursorPos.mCol = iter.GetPosition().mCol;
+               }
+       }
+       else
+               --mCursorPos.mCol;
+
+       TrackSelection();
+       NotifyView();
+}
+
+void wxTextEditorModel::OnMoveRight()
+{
+       PrepreForCommand();
+       CheckSelection();
+
+       ++mCursorPos.mCol;
+
+       TrackSelection();
+       NotifyView();
+}
+
+void wxTextEditorModel::OnMoveUp()
+{
+       PrepreForCommand();
+       CheckSelection();
+
+       if ( mCursorPos.mRow != 0 )
+       
+               DoMoveCursor( -1,0 );
+
+       TrackSelection();
+       NotifyView();
+}
+
+void wxTextEditorModel::OnMoveDown()
+{
+       PrepreForCommand();
+       CheckSelection();
+
+       if ( mCursorPos.mRow + 1 < GetTotalRowCount() )
+
+               DoMoveCursor( 1,0 );
+
+       TrackSelection();
+       NotifyView();
+}
+
+void wxTextEditorModel::OnWordRight()
+{
+       PrepreForCommand();
+       CheckSelection();
+
+       TTextIterator iter = CreateIterator( mCursorPos );
+
+       iter.NextWord();
+
+       mCursorPos = iter.GetPosition();
+
+       TrackSelection();
+       NotifyView();
+}
+
+void wxTextEditorModel::OnWordLeft()
+{
+       PrepreForCommand();
+       CheckSelection();
+
+       TTextIterator iter = CreateIterator( mCursorPos );
+
+       iter.PreviousWord();
+
+       mCursorPos = iter.GetPosition();
+
+       TrackSelection();
+       NotifyView();
+}
+
+void wxTextEditorModel::OnMoveToPosition( const TPosition& pos )
+{
+       PrepreForCommand();
+       CheckSelection();
+
+       mCursorPos = pos;
+
+       TrackSelection();
+       NotifyView();
+}
+
+void wxTextEditorModel::OnEndOfLine()
+{
+       PrepreForCommand();
+       CheckSelection();
+
+       TTextIterator iter = CreateIterator( mCursorPos );
+       iter.ToEndOfLine();
+
+       mCursorPos = iter.GetPosition();
+
+       TrackSelection();
+       NotifyView();
+}
+
+void wxTextEditorModel::OnStartOfLine()
+{
+       PrepreForCommand();
+       CheckSelection();
+
+       int prevCol = mCursorPos.mCol;
+
+       TTextIterator iter = CreateIterator( mCursorPos );
+       iter.ToStartOfLine();
+
+       // bypass leading white-space at the begining of the line
+
+       while( !iter.IsEol() )
+       {
+               char ch = iter.GetChar();
+
+               if ( ch != ' ' && ch != '\t' ) break;
+
+               ++mCursorPos.mCol;
+
+               iter.NextChar();
+       }
+
+       mCursorPos = iter.GetPosition();
+
+       if ( mCursorPos.mCol == prevCol )
+
+               mCursorPos.mCol = 0;
+
+       TrackSelection();
+       NotifyView();
+}
+
+void wxTextEditorModel::OnPageUp()
+{
+       PrepreForCommand();
+       CheckSelection();
+
+       if ( mCursorPos.mRow < mRowsPerPage )
+
+               mCursorPos.mRow = 0;
+       else
+               DoMoveCursor( -mRowsPerPage,0 );
+
+       mpActiveView->ScrollView( -(int)mRowsPerPage, 0 );
+
+       TrackSelection();
+       NotifyView();
+}
+
+void wxTextEditorModel::OnPageDown()
+{
+       PrepreForCommand();
+       CheckSelection();
+
+       if ( mCursorPos.mRow + mRowsPerPage >= GetTotalRowCount() )
+       {
+               if ( GetTotalRowCount() != 0 )
+
+                       mCursorPos.mRow = GetTotalRowCount() - 1;
+               else
+                       mCursorPos.mRow = 0;
+       }
+       else
+               DoMoveCursor( mRowsPerPage,0 );
+
+       mpActiveView->ScrollView( mRowsPerPage, 0 );
+
+       TrackSelection();
+       NotifyView();
+}
+
+void wxTextEditorModel::OnSlideUp()
+{
+       PrepreForCommand();
+       
+       if ( mpActiveView->GetPagePos().mRow + mRowsPerPage - 1 == mCursorPos.mRow  )
+       {
+               if ( mCursorPos.mRow == 0 )
+
+                       return;
+
+               DoMoveCursor( -1,0 );
+       }
+
+       mpActiveView->ScrollView( -1, 0 );
+
+       NotifyView();
+}
+
+void wxTextEditorModel::OnSlideDown()
+{
+       PrepreForCommand();
+       
+       if ( mCursorPos.mRow == mpActiveView->GetPagePos().mRow )
+       {
+               if ( mCursorPos.mRow + 1 >= GetTotalRowCount() )
+
+                       return;
+
+               DoMoveCursor( 1,0 );
+       }
+
+       mpActiveView->ScrollView( 1, 0 );
+
+       NotifyView();
+}
+
+void wxTextEditorModel::OnStartOfText()
+{
+       PrepreForCommand();
+       CheckSelection();
+
+       mCursorPos.mRow = mCursorPos.mCol = 0;
+
+       TrackSelection();
+       NotifyView();
+}
+
+void wxTextEditorModel::OnEndOfText()
+{
+       PrepreForCommand();
+       CheckSelection();
+
+       mCursorPos.mRow = GetTotalRowCount() - 1;
+
+       TTextIterator iter = CreateIterator( mCursorPos );
+
+       iter.ToEndOfLine();
+
+       mCursorPos = iter.GetPosition();
+
+       TrackSelection();
+       NotifyView();
+}
+
+void wxTextEditorModel::OnSelectWord()
+{
+       PrepreForCommand();
+
+       TTextIterator iter1 = CreateIterator( mCursorPos );
+       iter1.GotoClosestPos();
+
+       if ( mCursorPos == iter1.GetPosition() )
+       {
+               TTextIterator iter2 = iter1;
+
+               // find the left-edge of the word
+
+               bool wasSeparator = TTextIterator::IsSeparator( iter1.GetChar() );
+
+               while( !iter1.IsEol() )
+               {
+                       char ch = iter1.GetChar();
+
+                       if ( ch == '\t' || 
+                                ch == ' '  ||
+                                wasSeparator != TTextIterator::IsSeparator( iter1.GetChar() )
+                         ) 
+                       {
+                               iter1.NextChar();
+                               break;
+                       }
+
+                       iter1.PreviousChar();
+               }
+
+               // find the left-edge of the word
+
+               while( !iter2.IsEol() )
+               {
+                       char ch = iter2.GetChar();
+
+                       if ( ch == '\t' || 
+                                ch == ' '  ||
+                                wasSeparator != TTextIterator::IsSeparator( iter2.GetChar() ) 
+                       )
+                               break;
+
+                       iter2.NextChar();
+               }
+
+               if ( !(iter1.GetPosition() == iter2.GetPosition()) )
+               {
+                       mSelectionStart = iter1.GetPosition();
+                       mSelectionEnd   = iter2.GetPosition();
+                       mCursorPos      = iter2.GetPosition();
+
+                       NotifyTextChanged( mSelectionStart.mRow, 1, CT_MODIFIED );
+               }
+       }
+
+       NotifyView();
+}
+
+void wxTextEditorModel::OnSelectAll()
+{
+       PrepreForCommand();
+
+       ResetSelection();
+
+       mSelectionStart = TPosition(0,0);
+       mSelectionEnd   = TPosition( GetTotalRowCount(), 1024 ); // FOR NOW:: hack
+
+       mCursorPos = mSelectionStart;
+
+       NotifyTextChanged( mSelectionStart.mRow, mSelectionEnd.mRow, CT_MODIFIED );
+
+       NotifyView();
+}
+
+void wxTextEditorModel::OnToggleBookmark()
+{
+       size_t curRow = GetCursor().mRow;
+
+       if ( GetPinAt( curRow, TBookmarkPin::GetPinTypeCode() ) != NULL )
+
+               RemovePinAt( curRow, TBookmarkPin::GetPinTypeCode() );
+       else
+               AddPin( new TBookmarkPin( curRow ) );
+
+       MergeChange( curRow, 1 );
+
+       NotifyAllViews();
+}
+
+void wxTextEditorModel::OnNextBookmark()
+{
+       size_t pinNo = FindNextPinFrom( mCursorPos.mRow + 1 );
+
+       while( pinNo != NPOS )
+       {
+               TPinBase& pin = *mPins[pinNo];
+
+               if ( pin.mTypeCode == BOOKMARK_PIN_TC )
+               {
+                       OnGotoLine( pin.mRow, 0 );
+                       break;
+               }
+
+               if ( pinNo == mPins.size() ) break;
+
+               ++pinNo;
+       }
+}
+
+void wxTextEditorModel::OnPreviousBookmark()
+{
+       if ( mCursorPos.mRow == 0 ) return;
+
+       size_t pinNo = FindPreviousPinFrom( mCursorPos.mRow - 1 );
+
+       while( pinNo != NPOS )
+       {
+               TPinBase& pin = *mPins[pinNo];
+
+               if ( pin.mTypeCode == BOOKMARK_PIN_TC )
+               {
+                       OnGotoLine( pin.mRow, 0 );
+                       break;
+               }
+
+               if ( pinNo == 0 ) break;
+
+               --pinNo;
+       }
+}
+
+bool wxTextEditorModel::OnFind()
+{
+       if ( !SelectionIsEmpty() )
+       {
+               if ( GetStartOfSelection().mRow == GetEndOfSelection().mRow )
+               {
+                       char* buf = NULL; size_t len = 0;
+
+                       GetSelection( &buf, len );
+
+                       mLastFindExpr = string( buf, 0, len );
+
+                       delete [] buf;
+               }
+       }
+
+       wxFindTextDialog dlg( GetActiveView(), mLastFindExpr );
+       //dlg.SetExpr( mLastFindExpr );
+
+       if( dlg.ShowModal() == wxID_OK )
+       {
+               mLastFindExpr = dlg.GetExpr();
+
+               GetActiveView()->SetFocus();
+
+               return OnFindNext();
+       }
+
+       GetActiveView()->SetFocus();
+
+       return FALSE;
+}
+
+bool wxTextEditorModel::OnFindNext()
+{
+       PrepreForCommand();
+
+       string& val = mLastFindExpr;
+       size_t  len = val.length();
+
+       if ( len == 0 ) 
+       {
+               NotifyView();
+               wxMessageBox( "Secarch string not found!" );
+
+               GetActiveView()->SetFocus();
+
+               return FALSE;
+       }
+
+       char ch1 = val[0];
+
+       TTextIterator iter = CreateIterator( mCursorPos );
+
+       while( !iter.IsEof() )
+       {
+               char ch = iter.GetChar();
+
+               if ( ch == ch1 )
+               {
+                       size_t startCol = iter.mPos.mCol;
+                       iter.NextChar();
+                       ch = iter.GetChar();
+
+                       size_t i = 1;
+                       while( i < len && !iter.IsEof() && ch == val[i] )
+                       {
+                               ++i;
+                               iter.NextChar();
+                               ch = iter.GetChar();
+                       }
+
+                       if ( i == len )
+                       {
+                               if ( !SelectionIsEmpty() )
+
+                                       ResetSelection();
+
+                               SetStartOfSelection( TPosition( iter.mPos.mRow, startCol ) );
+                               SetEndOfSelection( iter.mPos );
+
+                               MergeChange( iter.mPos.mRow, 1 );
+
+                               mCursorPos = iter.mPos;
+
+                               OnGotoLine( iter.mPos.mRow, iter.mPos.mCol );
+                               return TRUE;
+                       }
+               }
+               else
+                       iter.NextChar();
+       }
+
+       NotifyView();
+       MergeChange( mCursorPos.mRow, 2 );
+       wxMessageBox( "Secarch string not found!" );
+
+       GetActiveView()->SetFocus();
+
+       return FALSE;
+}
+
+bool wxTextEditorModel::OnFindPrevious()
+{
+       // TBD::
+       return FALSE;
+}
+
+void wxTextEditorModel::OnGotoLine( int line, int col )
+{
+       if ( mpActiveView == NULL ) return;
+
+       TPosition pagePos = mpActiveView->GetPagePos();
+
+       if ( line >= pagePos.mRow &&
+                line <  pagePos.mRow + mRowsPerPage )
+       {
+               mCursorPos.mRow = (size_t)line;
+               mCursorPos.mCol = (size_t)col;
+
+               if ( col == - 1)
+               {
+                       mCursorPos.mCol = 0;
+                       OnStartOfLine();
+               }
+               else
+                       NotifyView();
+
+               return;
+       }
+
+       size_t third = mRowsPerPage / 3;
+       size_t newTop = 0;
+
+       if ( line < third )
+
+               newTop = 0;
+       else
+               newTop = line - third;
+
+
+       mpActiveView->ScrollView( (int)newTop - (int)pagePos.mRow, -(int)pagePos.mCol );
+
+       mCursorPos.mRow = line;
+       mCursorPos.mCol = col;
+
+       if ( col == - 1)
+       {
+               mCursorPos.mCol = 0;
+               OnStartOfLine();
+       }
+       else
+               NotifyView();
+}
+
+void wxTextEditorModel::OnGotoLine()
+{
+       wxTextEntryDialog* dlg = 
+               new wxTextEntryDialog( mpActiveView, "Line number:", "Goto line", "" );
+
+       int nTries = 3;
+
+       while( dlg->ShowModal() == wxID_OK && nTries )
+       {
+               ResetSelection();
+
+               int i = -1;
+               sscanf( dlg->GetValue(), "%d", &i );
+
+               if ( i == -1  )
+               {
+                       wxMessageBox( "Please enter a number" );
+                       continue;
+               }
+
+
+               if ( i == 0 ) ++i;
+
+               OnGotoLine( (size_t)(i-1), 0 );
+               break;
+
+               --nTries;
+       }
+
+       GetActiveView()->SetFocus();
+}
+
+
+bool wxTextEditorModel::IsReadOnly()
+{
+       return mIsReadOnly;
+}
+
+bool wxTextEditorModel::IsModified()
+{
+       return mCurCommand != 0;
+}
+
+bool wxTextEditorModel::IsInsertMode()
+{
+       return mInsertMode;
+}
+
+void wxTextEditorModel::SetCheckpoint()
+{
+       mCheckPointDestroyed = FALSE;
+       mCheckPointCmdNo     = mCurCommand;
+}
+
+bool wxTextEditorModel::CheckpointModified()
+{
+       if ( mCheckPointDestroyed ) return TRUE;
+
+       return mCheckPointCmdNo != mCurCommand;
+}
+
+TPosition wxTextEditorModel::GetStartOfSelection()
+{
+       ArrangePositions( mSelectionStart, mSelectionEnd );
+
+       return mSelectionStart;
+}
+
+TPosition wxTextEditorModel::GetEndOfSelection()
+{
+       ArrangePositions( mSelectionStart, mSelectionEnd );
+
+       return mSelectionEnd;
+}
+
+TPosition wxTextEditorModel::GetCursor()
+{
+       return mCursorPos;
+}
+
+void wxTextEditorModel::SetStartOfSelection( const TPosition& pos )
+{
+       mSelectionStart = pos;
+}
+
+void wxTextEditorModel::SetEndOfSelection( const TPosition& pos )
+{
+       mSelectionEnd = pos;
+}
+
+void wxTextEditorModel::SetCursor( const TPosition& pos )
+{
+       mCursorPos = pos;
+}
+
+void wxTextEditorModel::AddView( wxTextEditorView* pView )
+{
+       mViews.push_back( pView );
+       pView->SetModel( this );
+}
+
+void wxTextEditorModel::RemoveView( wxTextEditorView* pView )
+{
+       for( size_t i = 0; i != mViews.size(); ++i )
+
+               if ( mViews[i] == pView )
+               {
+                       mViews.erase( & mViews[i] );
+                       return;
+               }
+}
+
+void wxTextEditorModel::SetActiveView( wxTextEditorView* pView )
+{
+       mpActiveView = pView;
+}
+
+wxTextEditorView* wxTextEditorModel::GetActiveView()
+{
+       return mpActiveView;
+}
+
+void wxTextEditorModel::SetRowsPerPage( size_t n )
+{
+       mRowsPerPage = n;
+}
+
+void wxTextEditorModel::AddPin( TPinBase* pPin )
+{
+       // FIXME:: binary search should be used
+
+       size_t beforePin = FindNextPinFrom( pPin->mRow );
+
+       if ( beforePin != NPOS )
+       {
+               // pins in the same row are ordered in the
+               // descending order of their type-codes
+
+               while( beforePin < mPins.size() &&
+                          mPins[beforePin]->mRow == pPin->mRow &&
+                          mPins[beforePin]->mTypeCode < pPin->mTypeCode )
+
+                          ++beforePin;
+
+               if ( beforePin < mPins.size() )
+                       
+                       mPins.insert( &mPins[beforePin], pPin );
+               else
+                       mPins.push_back( pPin );
+       }
+       else
+               mPins.push_back( pPin );
+}
+
+PinListT& wxTextEditorModel::GetPins()
+{
+       return mPins;
+}
+
+size_t wxTextEditorModel::FindFirstPinInRange( size_t fromRow, size_t tillRow )
+{
+       // FIXME:: pefrom binary search instead
+
+       for( size_t i = 0; i != mPins.size(); ++i )
+       {
+               TPinBase& pin = *mPins[i];
+
+               if ( pin.mRow >= tillRow ) return NPOS;
+
+               if ( pin.mRow >= fromRow )
+
+                       return i;
+       }
+
+       return NPOS;
+}
+
+size_t wxTextEditorModel::FindNextPinFrom( size_t fromRow )
+{
+       // FIXME:: pefrom binary search instead
+
+       for( size_t i = 0; i != mPins.size(); ++i )
+       {
+               TPinBase& pin = *mPins[i];
+
+               if ( pin.mRow >= fromRow )
+
+                       return i;
+       }
+
+       return NPOS;
+
+}
+
+size_t wxTextEditorModel::FindPreviousPinFrom( size_t fromRow )
+{
+       // FIXME:: pefrom binary search instead
+
+       if ( mPins.size() == 0 ) return NPOS;
+
+       size_t i = mPins.size() - 1;
+
+       for(;;)
+       {
+               TPinBase& pin = *mPins[i];
+
+               if ( pin.mRow <= fromRow )
+
+                       return i;
+
+               if ( i == 0 ) break;
+
+               --i;
+       }
+
+       return NPOS;
+}
+
+size_t wxTextEditorModel::GetPinNoAt( size_t row, int pinTypeCode )
+{
+       size_t curPin = FindNextPinFrom( row );
+
+       while( curPin != NPOS )
+       {
+               TPinBase& pin = *mPins[curPin];
+
+               if ( pin.mRow > row ) return NPOS;
+
+               if ( pin.mTypeCode == pinTypeCode ) return curPin;
+
+               ++curPin;
+
+               if ( curPin == mPins.size() ) return NPOS;
+       }
+
+       return NPOS;
+}
+
+TPinBase* wxTextEditorModel::GetPinAt( size_t row, int pinTypeCode )
+{
+       size_t pinNo = GetPinNoAt( row, pinTypeCode );
+
+       return ( pinNo == NPOS ) ? NULL : mPins[pinNo];
+}
+
+void wxTextEditorModel::RemovePinAt( size_t row, int pinTypeCode )
+{
+       size_t pinNo = GetPinNoAt( row, pinTypeCode );
+
+       if ( pinNo != NPOS )
+
+               mPins.erase( &mPins[pinNo] );
+}
+
+void wxTextEditorModel::AddChangeListener( TTextChangeListenerBase* pListener )
+{
+       mChangeListeners.push_back( pListener );
+}
+
+/***** Implementation for class wxTextEditorView *****/
+
+BEGIN_EVENT_TABLE( wxTextEditorView, wxScrolledWindow )
+
+       EVT_SIZE  ( wxTextEditorView::OnSize   )
+#if (( wxVERSION_NUMBER < 2100 ) || (( wxVERSION_NUMBER == 2100 ) && (wxBETA_NUMBER <= 4)))
+       EVT_SCROLL( wxTextEditorView::OnScroll )
+#else
+       EVT_SCROLLWIN( wxTextEditorView::OnScroll )
+#endif 
+       EVT_PAINT ( wxTextEditorView::OnPaint  )
+
+       EVT_LEFT_DOWN  ( wxTextEditorView::OnLButtonDown )
+       EVT_LEFT_UP    ( wxTextEditorView::OnLButtonUp   )
+       EVT_MOTION     ( wxTextEditorView::OnMotion      )
+       EVT_LEFT_DCLICK( wxTextEditorView::OnDblClick    )
+
+       EVT_SET_FOCUS  ( wxTextEditorView::OnSetFocus  )
+       EVT_KILL_FOCUS ( wxTextEditorView::OnKillFocus )
+
+       EVT_CHAR( wxTextEditorView::OnChar )
+       EVT_KEY_DOWN( wxTextEditorView::OnKeyDown )
+
+       EVT_ERASE_BACKGROUND( wxTextEditorView::OnEraseBackground )
+
+
+END_EVENT_TABLE()
+
+TCursorTimer* wxTextEditorView::mpTimer = new TCursorTimer();
+
+wxTextEditorView::wxTextEditorView( wxWindow* parent, 
+                                                                       wxWindowID id, 
+                                                                       wxTextEditorModel* pModel,
+                                                                       int wndStyle,
+                                                                       bool ownsModel )
+
+       : wxScrolledWindow( parent, id, wxPoint(32768,32768), wxSize(0,0),
+                                               wxHSCROLL | wxVSCROLL | wndStyle
+                         ),
+         mPagePos( 0,0 ),
+         mDragStarted( FALSE ),
+         mpDraggedText( NULL ),
+         mAdjustScrollPending( FALSE ),
+         mLTMode( FALSE ),
+         mMaxColumns( 500 ),
+
+         mScrollingOn( TRUE ),
+         mCursorOn  ( TRUE ),
+         mOwnsModel ( ownsModel ),
+
+         mLastRowsTotal( (size_t)(-1) )
+{
+       SetModel( pModel );
+
+       SetTextDefaults();
+
+       SetSourcePainter( new SourcePainter() );
+
+       mCashedIter.mPos = TPosition( (size_t)(-1), 0 );
+
+       // default
+       AddPinPainter( new TBookmarkPainter() );
+}
+
+wxTextEditorView::~wxTextEditorView()
+{
+       if ( mpTimer->GetView() == this && 
+                mCursorOn && !mLTMode )
+       {
+               mpTimer->SetView( NULL );
+               mpTimer->HideCursor( TRUE );
+       }
+
+       if ( mOwnsModel && mpModel )
+
+               delete mpModel;
+}
+
+void wxTextEditorView::SetTextDefaults()
+{
+       mLeftMargin   = 22;
+       mRightMargin  = 0;
+       mTopMargin    = 0;
+       mBottomMargin = 0;
+
+       mCharDim.x = -1; // not detected yet
+       mCharDim.y = -1;
+
+       mNormalTextCol       = *wxBLACK;
+       mIndentifierTextCol  = *wxBLUE;
+       mReservedWordTextCol = *wxRED;
+       mCommentTextCol      = wxColour( 0,128,128 );
+
+       mNormalBkCol    = wxColour(255,255,255);//*wxWHITE;//wxColour( 128,220,128 );
+       mSelectionFgCol = wxColour(255,255,255);//*wxWHITE;
+       mSelectionBkCol = wxColour( 0,0,128 );
+
+       mNormalBkBrush   = wxBrush( mNormalBkCol,    wxSOLID );
+       mSelectedBkBrush = wxBrush( mSelectionBkCol, wxSOLID );
+
+#if defined(__WXMSW__) || defined(__WINDOWS__)
+    mFont.SetFaceName("Fixedsys");
+    mFont.SetStyle(40);
+    mFont.SetWeight(40);
+    mFont.SetPointSize( 11);
+#else
+    //mFont.SetFamily( wxSWISS );
+       mFont = wxSystemSettings::GetSystemFont(wxSYS_OEM_FIXED_FONT);
+#endif
+
+
+#if defined(__WXMSW__) || defined(__WINDOWS__)
+    mFont.RealizeResource();
+#endif
+
+       // reduce flicker un wxGtk
+       SetBackgroundColour( mNormalBkCol );
+}
+
+void wxTextEditorView::SetColours( const wxColour& normalBkCol,
+                                                                  const wxColour& selectedBkCol,
+                                                                  const wxColour& selectedTextCol )
+{
+       mNormalBkCol    = normalBkCol;
+       mSelectionFgCol = selectedTextCol;
+       mSelectionBkCol = selectedBkCol;
+
+       mNormalBkBrush   = wxBrush( mNormalBkCol,    wxSOLID );
+       mSelectedBkBrush = wxBrush( mSelectionBkCol, wxSOLID );
+}
+
+void wxTextEditorView::SetHeighlightingColours( const wxColour& normalTextCol,
+                                                                                           const wxColour& identifierTextCol,
+                                                                                           const wxColour& reservedWordTextCol,
+                                                                                           const wxColour& commentTextCol )
+{
+       mNormalTextCol       = normalTextCol;
+       mIndentifierTextCol  = identifierTextCol;
+       mReservedWordTextCol = reservedWordTextCol;
+       mCommentTextCol      = commentTextCol;
+}
+
+void wxTextEditorView::SetMargins( int top, int left, int bottom, int right )
+{
+       mLeftMargin   = left;
+       mRightMargin  = right;
+       mTopMargin    = top;
+       mBottomMargin = bottom;
+}
+
+void wxTextEditorView::RecalcPagingInfo()
+{
+       bool firstRefresh = mCharDim.x == -1;
+
+       if ( firstRefresh )
+
+               ObtainFontProperties();
+
+       int w = 0, h = 0;
+       GetClientSize( &w, &h );
+
+       w -= mLeftMargin + mRightMargin;
+       h -= mTopMargin  + mBottomMargin;
+
+       mColsPerPage = ( ( w / mCharDim.x ) +
+                                  ( ( w % mCharDim.x ) ? 0 : 0 ) );
+
+
+       mRowsPerPage = ( ( h / mCharDim.y ) +
+                                  ( ( h % mCharDim.y ) ? 0 : 0 ) );
+
+       if ( mpModel->GetActiveView() == this )
+
+               mpModel->SetRowsPerPage( mRowsPerPage );
+
+       if ( firstRefresh ) 
+       {
+               // scrolling should not happen at DC-level
+               EnableScrolling( FALSE, FALSE );
+
+               if ( mScrollingOn )
+
+                       SetScrollbars( mCharDim.x, mCharDim.y,
+                                                  mMaxColumns,
+                                                  mpModel->GetTotalRowCount(),
+                                                  mPagePos.mCol,
+                                                  mPagePos.mRow,
+                                                  TRUE
+                                                );
+       }
+
+       PositionCursor();
+}
+
+#if (( wxVERSION_NUMBER < 2100 ) || (( wxVERSION_NUMBER == 2100 ) && (wxBETA_NUMBER <= 4)))
+ // this changed in ver 2.1
+void wxTextEditorView::OnScroll( wxScrollEvent& event )
+#else
+void wxTextEditorView::OnScroll( wxScrollWinEvent& event )
+#endif
+{
+       if ( !mScrollingOn ) return;
+
+       // overriden implementation of wxScrolledWindow::OnScroll,
+       // to reduce flicker on wxGtk, by using wxClientDC 
+       // instead of Refresh()
+
+       int orient = event.GetOrientation();
+
+       int nScrollInc = CalcScrollInc(event);
+       if (nScrollInc == 0) return;
+
+       if (orient == wxHORIZONTAL)
+       {
+               int newPos = m_xScrollPosition + nScrollInc;
+               SetScrollPos(wxHORIZONTAL, newPos, TRUE );
+       }
+       else
+       {
+               int newPos = m_yScrollPosition + nScrollInc;
+               SetScrollPos(wxVERTICAL, newPos, TRUE );
+       }
+
+       if (orient == wxHORIZONTAL)
+       {
+               m_xScrollPosition += nScrollInc;
+       }
+       else
+       {
+               m_yScrollPosition += nScrollInc;
+       }
+
+       int x,y;
+       ViewStart( &x, &y );
+
+       mPagePos.mRow = y;
+       mPagePos.mCol = x;
+
+       PositionCursor();
+
+       if ( mAdjustScrollPending )
+       {
+               mLastRowsTotal = mpModel->GetTotalRowCount();
+               SetScrollbars( mCharDim.x, mCharDim.y,
+                                          mMaxColumns,   // FOR NOW:: maximal line-length not calculated
+                                          mLastRowsTotal,
+                                          mPagePos.mCol,
+                                          mPagePos.mRow,
+                                          TRUE
+                                        );
+
+               mLastViewStart = mPagePos;
+
+               mAdjustScrollPending = FALSE;
+
+               return;
+       }
+
+       wxClientDC dc( this );
+
+       mFullRefreshPending = TRUE;
+
+       PaintRows( mPagePos.mRow, mPagePos.mRow + mRowsPerPage, dc );
+}
+
+void wxTextEditorView::OnPaint( wxPaintEvent& event )
+{
+       //wxScrolledWindow::OnPaint( event );
+       if ( mCharDim.x == -1 ) ObtainFontProperties();
+
+       wxPaintDC dc( this );
+
+       mFullRefreshPending = TRUE;
+
+       PaintRows( mPagePos.mRow, mPagePos.mRow + mRowsPerPage, dc );
+}
+
+void wxTextEditorView::OnSize( wxSizeEvent& event )
+{
+       RecalcPagingInfo();
+
+       SyncScrollbars();
+
+       event.Skip();
+}
+
+void wxTextEditorView::OnEraseBackground( wxEraseEvent& event )
+{
+#if 0
+       int w = 0, h = 0;
+
+       GetClientSize( &w, &h );
+       
+       wxPaintDC dc( this );
+
+       dc.SetPen( *wxTRANSPARENT_PEN );
+       dc.SetBrush( *wxWHITE_BRUSH );
+       dc.DrawRectangle( 0,0, w,h );
+#endif
+}
+
+void wxTextEditorView::OnLButtonDown( wxMouseEvent& event )
+{
+       if ( mDragStarted ) return;
+
+       mDragStarted = TRUE;
+
+       TPosition textPos;
+       PixelsToTextPos( event.m_x, event.m_y, textPos );
+
+       mpModel->SetSelectionEditMode( FALSE );
+
+       mpModel->OnMoveToPosition( textPos );
+
+       mpModel->SetSelectionEditMode( TRUE );
+
+       SetFocus();
+
+       CaptureMouse();
+}
+
+void wxTextEditorView::OnLButtonUp( wxMouseEvent& event )
+{
+       if ( mDragStarted )
+       {
+               OnMotion( event ); // simulate last motion event
+
+               mpModel->SetSelectionEditMode( FALSE );
+
+               ReleaseMouse();
+               mDragStarted = FALSE;
+       }
+}
+
+void wxTextEditorView::OnMotion( wxMouseEvent& event )
+{
+       if ( mDragStarted )
+       {
+               TPosition textPos;
+
+               if ( event.m_y < 0 && mpModel->GetCursor().mRow == 0 )
+               
+                       event.m_y = 0;
+
+               PixelsToTextPos( event.m_x, event.m_y, textPos );
+
+               mpModel->OnMoveToPosition( textPos );
+       }
+}
+
+void wxTextEditorView::OnDblClick( wxMouseEvent& event )
+{
+       event.Skip();
+       mpModel->OnSelectWord();
+}
+
+void wxTextEditorView::OnSetFocus( wxFocusEvent& event )
+{
+       if ( !mLTMode && mCursorOn )
+       {
+               mpTimer->SetView( this );
+               mpTimer->ShowCursor( TRUE );
+       }
+}
+
+void wxTextEditorView::OnKillFocus( wxFocusEvent& event )
+{
+       if ( !mLTMode && mCursorOn )
+       {
+               mpTimer->HideCursor( TRUE );
+               mpTimer->SetView( NULL );
+       }
+}
+
+void wxTextEditorView::HoldCursor( bool hold )
+{
+       if ( mLTMode || !mCursorOn ) return;
+
+       if ( !hold )
+       {
+               if ( wxWindow::FindFocus() != this )
+               {       
+                       mpTimer->HideCursor();
+                       mpTimer->SetView( NULL );
+               }
+       }
+       else
+       {
+               mpTimer->SetView( this );
+               mpTimer->ShowCursor();
+       }
+}
+
+void wxTextEditorView::OnKeyDown( wxKeyEvent& event )
+{
+       // FOR NOW:: hard-coded key-bindings
+
+       mpModel->SetSelectionEditMode( event.ShiftDown() );
+
+       if ( event.ControlDown() )
+       {
+               if ( event.m_keyCode == WXK_LEFT ) 
+               
+                       mpModel->OnWordLeft();
+               else
+               if ( event.m_keyCode == WXK_RIGHT ) 
+               
+                       mpModel->OnWordRight();
+               else
+               if ( event.m_keyCode == WXK_UP ) 
+               
+                       mpModel->OnSlideUp();
+               else
+               if ( event.m_keyCode == WXK_DOWN ) 
+               
+                       mpModel->OnSlideDown();
+               else
+               if ( event.m_keyCode == WXK_HOME ) 
+               
+                       mpModel->OnStartOfText();
+               else
+               if ( event.m_keyCode == WXK_END ) 
+               
+                       mpModel->OnEndOfText();
+               else
+               if ( event.m_keyCode == WXK_INSERT )
+
+                       mpModel->OnCopy();
+               else
+                       event.Skip();
+
+               /*
+               else
+               if ( event.m_keyCode == WXK_NEXT ) 
+               
+                       mpModel->();
+               else
+               if ( event.m_keyCode == WXK_PRIOR ) 
+               
+                       mpModel->();
+               */
+       }
+       else
+       {
+               if ( event.m_keyCode == WXK_LEFT ) 
+               
+                       mpModel->OnMoveLeft();
+               else
+               if ( event.m_keyCode == WXK_RIGHT ) 
+               
+                       mpModel->OnMoveRight();
+               else
+               if ( event.m_keyCode == WXK_UP ) 
+               
+                       mpModel->OnMoveUp();
+               else
+               if ( event.m_keyCode == WXK_DOWN ) 
+               
+                       mpModel->OnMoveDown();
+               else
+               if ( event.m_keyCode == WXK_HOME ) 
+               
+                       mpModel->OnStartOfLine();
+               else
+               if ( event.m_keyCode == WXK_END ) 
+               
+                       mpModel->OnEndOfLine();
+               else
+               if ( event.m_keyCode == WXK_NEXT ) 
+               
+                       mpModel->OnPageDown();
+               else
+               if ( event.m_keyCode == WXK_PRIOR ) 
+               
+                       mpModel->OnPageUp();
+               else
+               if ( event.m_keyCode == WXK_DELETE )
+
+                       mpModel->OnDelete();
+               else
+               if ( event.m_keyCode ==  WXK_INSERT && event.ShiftDown() )
+               
+                       mpModel->OnPaste();
+               else
+                       event.Skip();
+       }       
+}
+
+void wxTextEditorView::OnChar( wxKeyEvent& event )
+{
+       if ( event.ControlDown() )
+       {
+               if ( event.m_keyCode == 'y' )
+
+                       mpModel->OnDeleteLine();
+               else
+               if ( event.m_keyCode == 'v' )
+
+                       mpModel->OnPaste();
+               else
+               if ( event.m_keyCode == 'c' )
+
+                       mpModel->OnCopy();
+               else
+               if ( event.m_keyCode == 'z' )
+
+                       mpModel->OnUndo();
+               else
+               if ( event.m_keyCode == 'a' )
+
+                       mpModel->OnRedo();
+               else
+                       event.Skip();
+       }
+       else
+       if ( event.AltDown() )
+       {
+               if ( event.m_keyCode == WXK_BACK ) 
+
+                       mpModel->OnUndo();
+               else
+                       event.Skip();
+       }
+       else
+       if ( event.m_keyCode ==  WXK_BACK )
+       
+               mpModel->OnDeleteBack();
+       else
+       if ( event.m_keyCode == WXK_TAB && event.ShiftDown() )
+
+               mpModel->OnShiftSelectionIndent( TRUE );
+       else
+       {
+               if ( !mpModel->SelectionIsEmpty() && event.m_keyCode == WXK_TAB )
+
+                       mpModel->OnShiftSelectionIndent( FALSE );
+               else
+                       mpModel->OnInsertChar( event.m_keyCode );
+       }
+}
+
+void wxTextEditorView::SetModel( wxTextEditorModel* pModel )
+{
+       mpModel = pModel;
+       mSelectionStart = pModel->GetStartOfSelection();
+       mSelectionEnd   = pModel->GetEndOfSelection();
+       mCursorPos      = pModel->GetCursor();
+}
+
+void wxTextEditorView::SetSourcePainter( SourcePainter* pPainter )
+{
+       mpPainter = pPainter;
+}
+
+void wxTextEditorView::AddPinPainter( TPinPainterBase* pPainter )
+{
+       mPinPainters.push_back( pPainter );
+}
+
+void wxTextEditorView::SetDefaultFont( const wxFont& font )
+{
+       mFont = font;
+
+#if defined(__WXMSW__) || defined(__WINDOWS__)
+    mFont.RealizeResource();
+#endif
+
+       mCharDim.x = -1;
+       mCharDim.y = -1;
+
+       RecalcPagingInfo();
+}
+
+void wxTextEditorView::SetRowsPerPage( size_t n )
+{
+       mpModel->SetRowsPerPage( n );
+
+       mRowsPerPage = n;
+       SyncScrollbars();
+       PositionCursor();
+}
+
+void wxTextEditorView::SetMaxColumns( size_t n )
+{
+       mMaxColumns = n;
+
+       SyncScrollbars();
+       PositionCursor();
+}
+
+wxFont& wxTextEditorView::GetDefaultFont()
+{
+       return mFont;
+}
+
+void wxTextEditorView::SetLineTrackingMode( bool on, const wxColour& col )
+{
+       mLTColour = col;
+       mLTMode   = on;
+
+       if ( mpTimer->GetView() == this )
+
+               mpTimer->HideCursor();
+}
+
+void wxTextEditorView::EnableCursor( bool enable )
+{
+       mCursorOn = enable;
+}
+
+void wxTextEditorView::EnableScrollbars( bool enable )
+{
+       mScrollingOn = enable;
+}
+
+bool wxTextEditorView::IsActiveView()
+{
+       return this == mpModel->GetActiveView();
+}
+
+void wxTextEditorView::PositionCursor()
+{
+       if ( !IsActiveView() || 
+                mLTMode || !mCursorOn ) return;
+
+       mpTimer->HideCursor();
+
+       TextPosToScreenPos( mpModel->GetCursor(), mCursorScrPos );
+
+       mpTimer->ShowCursor();
+}
+
+void wxTextEditorView::PixelsToScrPos( int x, int y, int& scrRow, int& scrCol )
+{
+       x -= mLeftMargin;
+       y -= mTopMargin;
+
+       //if ( x < 0 ) x = 0; // FOR NOW:: horizontal auto-scroll disabled
+
+       scrCol = x / mCharDim.x;
+       scrRow = y / mCharDim.y;
+}
+
+void wxTextEditorView::PixelsToTextPos( int x, int y, TPosition& textPos )
+{
+       int scrRow = 0, scrCol = 0;
+       PixelsToScrPos( x, y, scrRow, scrCol );
+
+       if ( scrRow + (int)mPagePos.mRow < 0 )
+
+               scrRow = -(int)mPagePos.mRow;
+
+       if ( scrCol + (int)mPagePos.mCol < 0 )
+
+               scrCol = -(int)mPagePos.mCol;
+
+       ScreenPosToTextPos( TPosition( scrRow, scrCol ), textPos );
+}
+
+void wxTextEditorView::ScreenPosToPixels( const TPosition& scrPos, int& x, int& y )
+{
+       x = mLeftMargin + scrPos.mCol * mCharDim.x;
+       y = mTopMargin  + scrPos.mRow * mCharDim.y;
+}
+
+void wxTextEditorView::TextPosToScreenPos( const TPosition& txtPos, TPosition& scrPos )
+{
+       TTextIterator iter;
+
+       if ( txtPos.mRow != mCashedIter.mPos.mRow )
+       {
+               iter = mpModel->CreateIterator( txtPos );
+               mCashedIter = iter;
+       }
+       else
+       {
+               iter = mCashedIter;
+               iter.mPos.mCol = txtPos.mCol;
+       }
+
+       iter.ToStartOfLine();
+
+       size_t scrCol = 0;
+       size_t txtCol = 0;
+
+       while( !iter.IsEol() && txtCol < txtPos.mCol )
+       {
+               if ( iter.GetChar() == '\t' )
+               {
+                       size_t spacing = ( (scrCol / mpModel->mTabSize) + 1 ) * mpModel->mTabSize - scrCol;
+
+                       scrCol += spacing;
+               }
+               else
+                       ++scrCol;
+
+               ++txtCol;
+               iter.NextChar();
+       }
+
+       TPosition actualPos = iter.GetPosition();
+
+       scrCol += txtPos.mCol - txtCol;
+
+       scrPos.mRow = actualPos.mRow - mPagePos.mRow;
+       scrPos.mCol = scrCol - mPagePos.mCol;
+}
+
+void wxTextEditorView::ScreenPosToTextPos( const TPosition& scrPos, TPosition& txtPos )
+{
+       TPosition absScrPos( scrPos.mRow + mPagePos.mRow, scrPos.mCol + mPagePos.mCol );
+
+       TTextIterator iter = mpModel->CreateIterator( TPosition( absScrPos.mRow, 0 ) );
+
+       size_t scrCol = 0;
+       size_t txtCol = 0;
+
+       // iterate over all possible on-screen positions, and find one which matches "absScrPos"
+
+       while( !iter.IsEol() && scrCol < absScrPos.mCol )
+       {
+               if ( iter.GetChar() == '\t' )
+               {
+                       size_t spacing = ( (scrCol / mpModel->mTabSize) + 1 ) * mpModel->mTabSize - scrCol;
+
+                       scrCol += spacing;
+               }
+               else
+                       ++scrCol;
+
+               ++txtCol;
+               iter.NextChar();
+       }
+
+       TPosition actualPos = iter.GetPosition();
+
+       if ( scrCol == absScrPos.mCol )
+       {
+               txtPos = actualPos;
+               return;
+       }
+       else
+       if ( scrCol < absScrPos.mCol )
+       {
+               // the absScrPos points past the eol
+
+               txtPos = actualPos;
+               txtPos.mCol += absScrPos.mCol - scrCol;
+       }
+       else
+       if ( scrCol > absScrPos.mCol )
+       {
+               // there should have been a '\t' char, which made us jump too far forward
+
+               txtPos = actualPos;
+               --txtPos.mCol;
+       }
+}
+
+bool wxTextEditorView::IsClipboardCmd( wxKeyEvent& key )
+{
+       if ( key.ControlDown() && key.m_keyCode == WXK_CONTROL )
+
+               return TRUE;
+
+       if ( key.ShiftDown() && key.m_keyCode == WXK_SHIFT )
+
+               return TRUE;
+
+       if ( key.ControlDown() )
+       {
+               return ( key.m_keyCode == 'C' ||
+                                key.m_keyCode == 'c' ||
+                                key.m_keyCode == WXK_INSERT );
+       }
+
+       return FALSE;
+}
+
+void wxTextEditorView::ObtainFontProperties()
+{
+       wxClientDC dc(this);
+       dc.SetFont( mFont );
+
+       long w,h;
+
+       dc.GetTextExtent( "X", &w, &h );
+
+       mCharDim.x = w;
+       mCharDim.y = h;
+}
+
+void wxTextEditorView::SyncViewPortPosition()
+{
+
+       TPosition pos = mpModel->GetCursor();
+
+       TextPosToScreenPos( pos, pos );
+       pos.mRow += mPagePos.mRow;
+       pos.mCol += mPagePos.mCol;
+
+       if ( pos.mRow < mPagePos.mRow )
+       {
+               mPagePos.mRow = pos.mRow;
+               mFullRefreshPending = TRUE;
+       }
+       else
+       if ( pos.mRow >= mPagePos.mRow + mRowsPerPage && mRowsPerPage != 0 )
+       {
+               mPagePos.mRow = pos.mRow - mRowsPerPage + 1;
+               mFullRefreshPending = TRUE;
+       }
+
+       if ( pos.mCol < mPagePos.mCol )
+       {
+               mPagePos.mCol = pos.mCol;
+               mFullRefreshPending = TRUE;
+       }
+       else
+       if ( pos.mCol >= mPagePos.mCol + mColsPerPage )
+       {
+               mPagePos.mCol = pos.mCol - mColsPerPage + 1;
+               mFullRefreshPending = TRUE;
+       }
+}
+
+void wxTextEditorView::SyncScrollbars()
+{
+       if ( !mScrollingOn ) return;
+
+       size_t nRows = mpModel->GetTotalRowCount();
+
+#if !defined(__WINDOWS__)
+
+       if ( mLastViewStart == mPagePos )
+       {
+               if ( mLastRowsTotal != nRows )
+
+                       mAdjustScrollPending = TRUE;
+
+                return;
+       }
+#else
+       if ( mLastViewStart == mPagePos &&
+                mLastRowsTotal == nRows )
+
+                return;
+#endif
+       SetScrollbars( mCharDim.x, mCharDim.y,
+                                  mMaxColumns,
+                                  nRows,
+                                  mPagePos.mCol,
+                                  mPagePos.mRow,
+                                  TRUE
+                                );
+
+       mLastViewStart = mPagePos;
+       mLastRowsTotal = nRows;
+}
+
+void wxTextEditorView::ScrollView( int rows, int cols )
+{
+       int pageRow = (int)mPagePos.mRow; 
+       int pageCol = (int)mPagePos.mCol;
+
+       if ( pageRow + rows < 0 ) 
+               pageRow = 0;
+       else
+       if ( pageRow + rows > (int)mpModel->GetTotalRowCount() )
+
+               pageRow = mpModel->GetTotalRowCount();
+       else
+               pageRow = pageRow + rows;
+
+       mPagePos.mRow = (size_t)pageRow;
+
+       if ( pageCol + cols < 0 )
+
+               pageCol = 0;
+       else
+               pageCol = pageCol + cols;
+
+       mPagePos.mCol = pageCol;
+
+       mFullRefreshPending = TRUE;
+}
+
+void wxTextEditorView::OnModelChanged()
+{
+       // invalidate pre-cached iterator
+       mCashedIter.mPos = TPosition( (size_t)(-1), 0 );
+
+       SyncViewPortPosition();
+
+       if ( mLTMode ) mFullRefreshPending = TRUE;
+
+       if ( mpModel->mTextChanged && !mFullRefreshPending )
+       {
+               wxClientDC dc( this );
+               PaintRows( mpModel->mChangedFromRow, mpModel->mChangedTillRow, dc );
+       }
+       else
+       if ( mFullRefreshPending )
+       {
+               wxClientDC dc( this );
+               PaintRows( mPagePos.mRow, mPagePos.mRow + mRowsPerPage, dc );
+       }
+
+       if ( IsActiveView() )
+       {       
+               PositionCursor();
+               SyncScrollbars();
+       }
+}
+
+void wxTextEditorView::Activate()
+{
+       mpModel->SetStartOfSelection( mSelectionStart );
+       mpModel->SetEndOfSelection( mSelectionEnd );
+       mpModel->SetCursor( mCursorPos );
+
+       mpModel->SetRowsPerPage( mRowsPerPage );
+
+       if ( !mLTMode && mCursorOn )
+       {
+               mpTimer->SetView( this );
+               mpTimer->ShowCursor();
+       }
+
+       mpModel->SetActiveView( this );
+}
+
+void wxTextEditorView::Deactivate()
+{
+       mSelectionStart = mpModel->GetStartOfSelection();
+       mSelectionEnd   = mpModel->GetEndOfSelection();
+       mCursorPos      = mpModel->GetCursor();
+
+       if ( mpTimer->GetView() == this && 
+                !mLTMode && mCursorOn )
+               
+               mpTimer->HideCursor( TRUE );
+}
+
+/*** protected methods ***/
+
+char*  wxTextEditorView::mpLineBuffer    = NULL;
+size_t wxTextEditorView::mpLineBufferLen = 0;
+
+char* wxTextEditorView::GetLineBuffer( size_t len )
+{
+       if ( mpLineBuffer == NULL || mpLineBufferLen < len )
+       {
+               if ( !mpLineBuffer ) mpModel->FreeCharacters( mpLineBuffer );
+
+               mpLineBuffer = mpModel->AllocCharacters( len );
+
+               mpLineBufferLen = len;
+       }
+
+       return mpLineBuffer;
+}
+
+TPinPainterBase* wxTextEditorView::FindPainterForPin( TPinBase& pin )
+{
+       int pinTc = pin.mTypeCode;
+
+       for( size_t i = 0; i != mPinPainters.size(); ++i )
+
+               if ( mPinPainters[i]->mPinTypeCode == pinTc )
+
+                       return mPinPainters[i];
+
+       return NULL;
+}
+
+void wxTextEditorView::PaintDecorations( size_t fromRow, 
+                                                                                size_t tillRow, 
+                                                                                wxDC& dc, TTextIterator& iter )
+{
+       int dcY = ( fromRow - mPagePos.mRow ) * mCharDim.y + mTopMargin;
+               
+       size_t curPin = mpModel->FindFirstPinInRange( fromRow, tillRow );
+
+       PinListT& pins = mpModel->GetPins();
+       TPinPainterBase* pPainter = NULL;
+
+       size_t prevRow = fromRow;
+       int    prevY   = dcY;
+
+       wxPoint pos;
+       wxSize  dim( mLeftMargin, mCharDim.y );
+
+       while( curPin != NPOS )
+       {
+               TPinBase& pin = *pins[curPin];
+
+               if ( pPainter == NULL ||
+                        pPainter->mPinTypeCode != pin.mTypeCode )
+
+                        pPainter = FindPainterForPin( pin );
+       
+
+               // only pins which have their painters can be "visualized"
+
+               if ( pPainter )
+               {
+                       pos.x = 0;
+                       pos.y = ( pin.mRow - mPagePos.mRow )* mCharDim.y + mTopMargin;
+
+                       if ( prevRow < pin.mRow )
+                       {
+                               // fill upper gap
+
+                               dc.SetBrush( mNormalBkBrush );
+                               dc.SetPen( *wxTRANSPARENT_PEN );
+                               dc.DrawRectangle( 0, prevY, 
+                                                                 mLeftMargin + 1, 
+                                                                 mCharDim.y * ( pin.mRow - prevRow ) + 1 );
+                       }
+
+                       pPainter->DrawPin( &pin, *this, dc, pos, dim );
+
+                       prevRow = pin.mRow + 1;
+                       prevY = pos.y + mCharDim.y;
+               }
+
+               ++curPin;
+
+               if ( curPin >= pins.size() ||
+                        pins[curPin]->mRow >= tillRow )
+
+                        break;
+       }
+
+       // fill the reminder 
+
+       if ( prevRow < tillRow )
+       {
+               dc.SetBrush( mNormalBkBrush );
+               dc.SetPen( *wxTRANSPARENT_PEN );
+               dc.DrawRectangle( 0, prevY, 
+                                                 mLeftMargin + 1, 
+                                                 mCharDim.y * ( tillRow - prevRow ) + 1 );
+       }
+
+       dc.SetPen( *wxTRANSPARENT_PEN );
+}
+
+void wxTextEditorView::PaintRows( size_t fromRow, size_t tillRow, wxDC& dc )
+{
+       // NOTE:: raws are painted from "fromRow" but not including "tillRow" - [fromRow,tillRow)
+
+       dc.SetPen( *wxTRANSPARENT_PEN );
+
+       // how much on-screen columns are visable?
+
+       size_t fromScrCol = mPagePos.mCol;
+       size_t tillScrCol = fromScrCol + mColsPerPage;
+
+       TPosition selStart = mpModel->GetStartOfSelection();
+       TPosition selEnd   = mpModel->GetEndOfSelection();
+
+       bool selectionIsEmpty = ( selStart == selEnd );
+
+       wxColour curFgCol;
+       wxColour curBkCol;
+
+       wxBrush mLTBrush( mLTColour, wxSOLID );
+
+       // clip given row-region to the current page
+
+       if ( ( fromRow >= mPagePos.mRow + mRowsPerPage) || 
+                ( tillRow <= mPagePos.mRow )
+          )
+
+               return;
+
+       if ( fromRow < mPagePos.mRow ) fromRow = mPagePos.mRow;
+       if ( tillRow > mPagePos.mRow + mRowsPerPage ) tillRow = mPagePos.mRow + mRowsPerPage;
+
+       if ( fromRow >= tillRow ) return;
+
+       // now start the renderng
+
+       if ( mpTimer->GetView() == this && mCursorOn && !mLTMode ) 
+       {
+               mpTimer->Lock();
+               mpTimer->SetIsShown( FALSE );
+       }
+
+       dc.SetFont( mFont );
+       dc.SetBackgroundMode( wxSOLID );
+
+       TTextIterator iter = mpModel->CreateIterator( TPosition( fromRow, 0 ) );
+
+       PaintDecorations( fromRow, tillRow, dc, iter );
+
+       size_t cursorRow = mpModel->GetCursor().mRow;
+
+       size_t curRow = fromRow;
+       for( ; curRow != tillRow; ++curRow )
+       {
+               // place text into line-buffer
+
+               iter.ToStartOfLine();
+               size_t lineLen = iter.GetLineLen();
+
+               char* lineBuf = GetLineBuffer( lineLen + 1 );
+
+               size_t i = 0;
+
+               while( !iter.IsEof() && !iter.IsEol() )
+               {
+                       lineBuf[i++] = iter.GetChar();
+                       iter.NextChar();
+               }
+
+               iter.NextChar(); // skip eol
+
+               // obtain "highlights"
+               
+               mpPainter->SetState( FALSE, FALSE );
+               mpPainter->Init( FALSE );
+               mpPainter->ProcessSource( lineBuf, lineLen );
+               IntListT& blocks = mpPainter->GetBlocks();
+
+               // setup state vars
+
+               int dcY = ( curRow - mPagePos.mRow ) * mCharDim.y + mTopMargin;
+               
+               size_t scrCol = 0;
+               size_t txtCol = 0;
+
+               size_t curBlk = 0;
+               size_t curBlkCol = 0;
+
+               int    chunkLen      = -1;
+               size_t chunkTxtStart = 0;
+               size_t chunkScrStart = 0;
+
+               // pre-detect occurance of selection
+
+               bool lineHasSelection = ( selStart.mRow == curRow ) ||
+                                           ( selEnd.mRow == curRow   );
+
+               bool isInSelection    = ( selStart.mRow <= curRow ) &&
+                                           ( selEnd.mRow >= curRow   );
+
+               if ( isInSelection && selStart.mRow == curRow &&
+                        selStart.mCol != 0 )
+
+                        isInSelection = FALSE;
+
+               if ( selStart == selEnd ) 
+               {
+                       lineHasSelection = FALSE;
+                       isInSelection = FALSE;
+               }
+               
+               char ch = '\0';
+
+               // loop though the text in this row
+
+               do
+               {
+                       TPosition curPos( curRow, txtCol );
+
+                       // first check if we can finish the current chunk
+
+                       bool finishChunk = FALSE;
+
+                       if ( curBlk < blocks.size() &&
+                                curBlkCol + get_src_block_len( blocks[curBlk] ) == txtCol )
+                       {
+                               curBlkCol += get_src_block_len( blocks[curBlk] );
+                               ++curBlk;
+                               finishChunk = TRUE;
+                       }
+                       else
+                       if ( ( !selectionIsEmpty && ( curPos == selStart || curPos == selEnd ) )
+                                || lineBuf[txtCol] == '\t' 
+                                || txtCol == lineLen )
+
+                                finishChunk = TRUE;
+                       
+                       if ( finishChunk && chunkLen != -1 )
+                       {
+                               // is any part of the chunk visable?
+
+                               size_t chunkScrEnd = chunkScrStart + chunkLen;
+
+                               if ( ( // if hits from one side or is inside
+                                          ( chunkScrStart >= fromScrCol &&
+                                            chunkScrStart <  tillScrCol    ) ||
+                                          ( chunkScrEnd   >= fromScrCol &&
+                                            chunkScrEnd   <  tillScrCol    ) ) ||
+
+                                          // if overlaps the whole range
+                                        (      chunkScrStart <   fromScrCol &&
+                                           chunkScrEnd   >=  tillScrCol      )
+
+                                  )
+                               {
+                                       // render chunk data to the given DC
+
+                                       dc.SetTextForeground( curFgCol );
+                                       dc.SetTextBackground( curBkCol );
+
+                                       // clip left edge
+
+                                       if ( chunkScrStart < fromScrCol )
+                                       {
+                                               size_t diff = fromScrCol - chunkScrStart;
+                                               chunkLen      -= diff;
+                                               chunkTxtStart += diff;
+                                               chunkScrStart += diff;
+                                       }
+
+                                       // clip right edge
+
+                                       if ( chunkScrEnd > tillScrCol )
+                                       {
+                                               size_t diff  = chunkScrEnd - tillScrCol;
+                                               chunkLen    -= diff;
+                                               chunkScrEnd -= diff;
+                                       }
+
+                                       // create string
+
+                                       char tmp = lineBuf[chunkTxtStart + chunkLen];
+                                       
+                                       lineBuf[chunkTxtStart + chunkLen] = '\0';
+
+                                       // use member-variable, reuse heap-buffer between outputs
+                                       mFragment = lineBuf + chunkTxtStart;
+
+                                       lineBuf[chunkTxtStart + chunkLen] = tmp;
+
+                                       // draw it
+
+                                       int dcX = (chunkScrStart - fromScrCol) * mCharDim.x + mLeftMargin;
+
+                                       dc.DrawText( mFragment, dcX, dcY );
+                               }
+
+                               chunkLen = -1;
+
+                       } // end of "if ( finishChunk )"
+
+                       if ( txtCol == lineLen ) 
+                               break;
+
+                       if ( chunkLen == -1 )
+                       {
+                               // prepare the new chunk
+
+                               if ( curBlk < blocks.size() )
+                               {
+                                               switch( get_src_block_rank( blocks[curBlk] ) )
+                                               {
+                                                       case RANK_BLACK : curFgCol = mNormalTextCol; break;
+                                                       case RANK_BLUE  : curFgCol = mIndentifierTextCol; break;
+                                                       case RANK_RED   : curFgCol = mReservedWordTextCol; break;
+                                                       case RANK_GREEN : curFgCol = mCommentTextCol; break;
+                                                       default : break;
+                                               }
+                               }
+
+                               // track occurence of selection
+
+                               if ( lineHasSelection )
+                               {
+                                       isInSelection = TRUE;
+
+                                       if ( selEnd.mRow == curRow &&
+                                                selEnd.mCol <= txtCol )
+
+                                                isInSelection = FALSE;
+
+                                       if ( selStart.mRow == curRow &&
+                                                selStart.mCol > txtCol )
+
+                                                isInSelection = FALSE;
+                               }
+
+                               if ( isInSelection )
+                               {
+                                       curFgCol = mSelectionFgCol;
+                                       curBkCol = mSelectionBkCol;
+                               }
+                               else
+                               {
+                                       if ( mLTMode && curRow == cursorRow ) 
+
+                                               curBkCol = mLTColour;
+                                       else
+                                               curBkCol = mNormalBkCol ;
+                               }
+
+                               chunkScrStart = scrCol;
+                               chunkTxtStart = txtCol;
+                               chunkLen      = 0;
+                       }
+
+                       
+                       ch = lineBuf[txtCol];
+
+                       if ( ch == '\t' )
+                       {
+                               // tab's are treated specially (for simplicity and speed)
+
+                               int dcX = (chunkScrStart - fromScrCol) * mCharDim.x + mLeftMargin;
+
+                               if ( !isInSelection ) 
+                               {
+                                       if ( mLTMode && curRow == cursorRow ) 
+                                               
+                                               dc.SetBrush( mLTBrush );
+                                       else 
+                                               dc.SetBrush( mNormalBkBrush );
+                               }
+                               else dc.SetBrush( mSelectedBkBrush );
+
+                               // *** "the rule of TAB..." ***
+
+                               size_t spacing = ( (scrCol / mpModel->mTabSize) + 1 ) * mpModel->mTabSize - scrCol;
+
+                               int width = spacing * mCharDim.x + 1;
+
+                               if ( dcX < mLeftMargin )
+                               {
+                                       width -= mLeftMargin - dcX;
+
+                                       dcX = mLeftMargin;
+                               }
+
+                               if ( width > 0 )
+
+                                       dc.DrawRectangle( dcX, dcY, width, mCharDim.y + 1 );
+
+                               scrCol += spacing;
+                               txtCol += 1;
+                               
+                               // move chunk-start forward, after the occurance of '\t'
+
+                               chunkLen = -1;
+                       }
+                       else
+                       {
+                               // increase on-screen/in-text positions
+
+                               ++scrCol;
+                               ++txtCol;
+                               ++chunkLen;
+                       }
+               
+               } while( TRUE );
+
+               // fill the reminding white-space after eol
+
+               if ( scrCol < tillScrCol && 
+                        ( !isInSelection ||
+                          ( isInSelection && curRow == selEnd.mRow ) )
+                  )
+               {
+                       if ( scrCol < fromScrCol ) scrCol = fromScrCol;
+
+                       int dcX = ( scrCol - fromScrCol ) * mCharDim.x + mLeftMargin;
+
+                       if ( mLTMode && curRow == cursorRow )
+
+                               dc.SetBrush ( mLTBrush );
+                       else
+                               dc.SetBrush( mNormalBkBrush );
+
+                       dc.DrawRectangle( dcX, dcY, 
+                                                         mCharDim.x * ( tillScrCol - scrCol ) + 1, 
+                                                         mCharDim.y + 1 );
+               }
+
+               // render selection which is located past the eol
+
+               if ( ( lineHasSelection || isInSelection ) && 
+                        !( selEnd.mRow == curRow && selEnd.mCol <= txtCol )
+                  )
+               {
+                       // determine start of selection on-screen
+
+                       size_t scrSelStart = scrCol + ( selStart.mCol - txtCol );
+
+                       if ( isInSelection )
+
+                               scrSelStart = scrCol;
+
+                       size_t scrSelEnd = tillScrCol;
+
+                       if ( selEnd.mRow == curRow )
+
+                               scrSelEnd = scrCol + ( selEnd.mCol - txtCol );
+
+                       // clipping 
+
+                       if ( scrSelStart < fromScrCol ) scrSelStart = fromScrCol;
+                       if ( scrSelEnd   > tillScrCol ) scrSelEnd = tillScrCol;
+
+                       // drawing 
+
+                       if ( scrSelEnd > scrSelStart )
+                       {
+                               int dcX = ( scrSelStart - fromScrCol ) * mCharDim.x + mLeftMargin;
+
+                               dc.SetBrush( mSelectedBkBrush );
+                               dc.DrawRectangle( dcX, dcY, 
+                                                                 mCharDim.x * ( scrSelEnd - scrSelStart ) + 1, 
+                                                                 mCharDim.y + 1 );
+                       }
+               }
+
+               if ( iter.IsEof() ) 
+               {
+                       ++curRow;
+                       break;
+               }
+
+       } // end of "for(...)"
+
+       if ( curRow < tillRow )
+       {
+               dc.SetBrush( mNormalBkBrush );
+
+               int dcY = mTopMargin + (curRow - mPagePos.mRow)*mCharDim.y;
+               int dcX = mLeftMargin;
+
+               dc.DrawRectangle( dcX, dcY, mColsPerPage*mCharDim.x + 1, 
+                                                 ( tillRow - curRow ) * mCharDim.y + 1
+                                       );
+       }
+
+       if ( mFullRefreshPending )
+       {
+               dc.SetBrush( mNormalBkBrush );
+
+               // fill in "corners" which are never reached by characters
+               
+               int w,h;
+               GetClientSize( &w, &h );
+
+               dc.SetBrush( mNormalBkBrush );
+
+               int dcX = tillScrCol*mCharDim.x + mLeftMargin;
+
+               dc.DrawRectangle( dcX, mTopMargin, w - dcX + 1, h );
+
+               int dcY = mTopMargin + mRowsPerPage*mCharDim.y;
+
+               dc.DrawRectangle( 0, dcY, w, h - dcY + 2 );
+
+               ++curRow;
+
+               // any past-the-eof lines left at the bottom?
+       }
+
+       mFullRefreshPending = FALSE;
+
+       if ( mpTimer->GetView() == this && mCursorOn && !mLTMode ) 
+
+               mpTimer->Unlock();
+
+} // end of PaintRows(..)
+
+/***** Implementation for class TBookmarkPainter *****/
+
+TBookmarkPainter::TBookmarkPainter() 
+
+       : TPinPainterBase( BOOKMARK_PIN_TC ),
+         mBkBrush( wxColour( 0,255,255 ), wxSOLID )
+{
+}
+
+void TBookmarkPainter::DrawPin( TPinBase* pPin, wxTextEditorView& view, wxDC& dc, 
+                                                           const wxPoint& pos, const wxSize& dim )
+{
+       dc.SetPen( *wxBLACK_PEN );
+       dc.SetBrush( mBkBrush );
+       dc.DrawRoundedRectangle( pos.x+2, pos.y, dim.x-4, dim.y, 4 );
+}
+
+/***** Implementation for class TBreakpointPainter *****/
+
+TBreakpointPainter::TBreakpointPainter() 
+
+       : TPinPainterBase( BRKPOINT_PIN_TC ),
+         mBkBrush( wxColour( 196,0,0 ), wxSOLID )
+{
+}
+
+void TBreakpointPainter::DrawPin( TPinBase* pPin, wxTextEditorView& view, wxDC& dc, 
+                                                                 const wxPoint& pos, const wxSize& dim )
+{
+       dc.SetPen( *wxBLACK_PEN );
+       dc.SetBrush( mBkBrush );
+       dc.DrawRoundedRectangle( pos.x+6, pos.y+2, dim.x-12, dim.y-4, 30 );
+}
+
+/***** Implementation for class TCursorTimer *****/
+
+TCursorTimer::TCursorTimer()
+
+       : mIsLocked( FALSE ),
+         mIsShown ( FALSE ),
+         mBlinkInterval( 500 ),
+         mBrush( wxColour(0,0,0), wxSOLID ),
+         mMissOneTick( FALSE )
+{
+}
+
+void TCursorTimer::Notify()
+{
+       if ( mIsLocked ) return;
+
+       if ( mMissOneTick )
+       {
+               // this trick is used because it's not
+               // possible to restart the timer under wxGtk
+
+               mMissOneTick = FALSE;
+               return;
+       }
+
+
+       mIsLocked = TRUE;
+
+       DrawCursor();
+
+       mIsShown = !mIsShown;
+
+       mIsLocked = FALSE;
+}
+
+void TCursorTimer::SetView( wxTextEditorView* pView )
+{
+       mpView = pView;
+}
+
+wxTextEditorView* TCursorTimer::GetView()
+{
+       return mpView;
+
+}
+
+void TCursorTimer::HideCursor( bool forceHide )
+{
+       Lock();
+
+       if ( mIsShown  ) 
+       {
+               DrawCursor();
+               mIsShown = FALSE;
+       }
+
+       Unlock();
+}
+
+void TCursorTimer::ShowCursor( bool forceShow )
+{
+       Lock();
+
+       if ( !forceShow ) 
+       {
+               DrawCursor();
+               mIsShown = TRUE;
+
+               if ( mStarted )
+                       mMissOneTick = TRUE;
+       }
+
+       Unlock();
+
+       if ( !mStarted )
+       {
+               Start( mBlinkInterval );
+               mStarted = TRUE;
+       }
+}
+
+void TCursorTimer::Lock()
+{
+//     while( mIsLocked );
+
+       mIsLocked = TRUE;
+}
+
+void TCursorTimer::Unlock()
+{
+       mIsLocked = FALSE;
+}
+
+void TCursorTimer::SetIsShown( bool isShown )
+{
+       mIsShown = isShown;
+}
+
+/*** protected methods ***/
+
+void TCursorTimer::DrawCursor()
+{
+       if ( mpView == NULL ) return;
+
+       wxClientDC dc( mpView );
+
+       int x = 0, y = 0;
+
+       mpView->ScreenPosToPixels( mpView->mCursorScrPos, x, y );
+
+       dc.SetLogicalFunction( wxINVERT );
+       dc.SetBrush( mBrush );
+
+       dc.SetPen( *wxTRANSPARENT_PEN );
+       dc.DrawRectangle( x,y, 3, mpView->mCharDim.y + 1 );
+       dc.SetBackgroundMode( wxSOLID );
+}
diff --git a/utils/wxPython/modules/lseditor/tdefs.h b/utils/wxPython/modules/lseditor/tdefs.h
new file mode 100644 (file)
index 0000000..7538980
--- /dev/null
@@ -0,0 +1,903 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        No names yet.
+// Purpose:     Contrib. demo
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     03/04/1999
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleskandars Gluchovas
+// Licence:    GNU General Public License 
+/////////////////////////////////////////////////////////////////////////////
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation; either version 2 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef __TDEFS_G__
+#define __TDEFS_G__
+
+// should be compiled with wxSTL-v.1.2 (or higher)
+
+#include "wxstldefs.h"
+
+#if defined( wxUSE_TEMPLATE_STL )
+       #include <vector>
+       #include <list>
+#else
+       #include "wxstlvec.h"
+       #include "wxstllst.h"
+#endif
+
+#include "wx/window.h"
+#include "wx/scrolbar.h"
+
+#include "sourcepainter.h"
+
+#define NPOS ((size_t)(-1))
+
+class wxTextEditorModel;
+class wxTextEditorView;
+
+/*
+ * class represents column-row position in the source text,
+ * may refere to the column past the end-of-line,
+ * but should not point past the last-line in the text
+ */
+
+class TPosition
+{
+public:
+       size_t mRow;
+       size_t mCol;
+
+       inline TPosition() : mRow(0), mCol(0) {}
+
+       inline TPosition( size_t row, size_t col )
+
+               : mRow( row ), mCol( col ) {}
+
+       inline bool operator>( const TPosition& rhs ) const
+       { 
+               if ( mRow == rhs.mRow ) return mCol > rhs.mCol;
+               else
+                       return mRow > rhs.mRow;
+       }
+
+       inline bool operator<( const TPosition& rhs ) const
+       { 
+               if ( mRow == rhs.mRow ) return mCol < rhs.mCol;
+               else
+                       return mRow < rhs.mRow;
+       }
+};
+
+class TRange
+{
+public:
+       TPosition mFrom;
+       TPosition mTill;
+
+       TRange() {}
+       TRange( const TPosition& from, const TPosition& till )
+               : mFrom( from ), mTill( till )
+       {}
+};
+
+inline bool operator==( const TPosition& lhs, const TPosition& rhs )
+{
+       return lhs.mRow == rhs.mRow && lhs.mCol == rhs.mCol;
+}
+
+// FOR NOW:: bigger ones...
+
+#define MAX_BLOCK_LEN      (1024*164)
+#define BALANCED_BLOCK_LEN (1024*152)           
+#define FILLED_BLOCK_LEN   (1024*148)
+
+// FOR NOW::
+#define T_ASSERT( x ) if ( !(x) ) throw;
+
+// to speed up debug v. :
+
+#define is_eol_char( ch )     ( ch == (char)10 )
+#define is_DOS_eol_char( ch ) ( ch == (char)13 )
+
+// the target-platfrom eol-marking is selected when
+// new text document is created or auto-detection
+// failed to determine the text-format (e.g. no EOLs found at all)
+
+#if defined(__WINDOWS__) || defined(__WXMSW__)
+
+         #define IS_UNIX_TEXT_BY_DEFAULT FALSE
+#else
+         #define IS_UNIX_TEXT_BY_DEFAULT TRUE
+#endif
+
+//inline bool is_eol_char( char ch ) { return ch == 10 && ch == 13 ; }
+
+/*
+ * Class contains single fragment of the source text, which
+ * may grow or shrink in the process of editing. Blocks always
+ * start at the begining of the line and end at eol, i.e. lines
+ * are not broken among blocks
+ */
+
+class TBlock
+{
+public:
+       char mBuf[MAX_BLOCK_LEN];
+       size_t mTextLen;
+       size_t mRowCount;
+
+       TBlock() : mTextLen(0), mRowCount(0) { mBuf[0] = '\0'; }
+
+       void RecalcBlockProperties();
+
+       bool operator==( const TBlock& blk ) const { return this == &blk; }
+
+        bool operator!=( const TBlock& blk ) const { return this != &blk; }
+
+       bool operator<( const TBlock& blk ) const { return TRUE; }
+
+        bool operator>( const TBlock& blk ) const { return FALSE; }
+};
+
+/*
+ * captures info about mutable command 
+ */
+
+class TCommand
+{
+public:
+
+       TCommand() : mType(-1) {}
+       TCommand( int type ) : mType( type ) {}
+       ~TCommand() {}
+
+       int       mType;
+       char*     mData;
+       size_t    mDataLen;
+
+       TRange    mRange;
+
+       // positions of cursor before and after executions of this command
+       TPosition mPrePos;
+       TPosition mPostPos;
+
+};
+
+enum TEXT_EDITOR_COMMAND
+{
+       TCMD_INSERT,
+       TCMD_DELETE
+};
+
+enum TEXT_CHANGE_TYPE
+{
+       CT_MODIFIED,
+       CT_DELETED,
+       CT_INSERTED
+};
+
+class wxTextEditorView;
+
+// STL-list is used for managing blocks, since it's alg. collects
+// removed elements into a free-list, from which they
+// can be reclaimed later, that way heap-fragmentation may be reduced
+
+#if defined( wxUSE_TEMPLATE_STL )
+       typedef list<TBlock>      TBlockListT;
+       typedef vector<TCommand*> TCommandListT;
+       typedef vector<wxTextEditorView*> TextViewListT;
+#else
+       typedef WXSTL_LIST( TBlock )  TBlockListT;
+
+       typedef TCommand* TCommandPtrT;
+       typedef WXSTL_VECTOR_SHALLOW_COPY( TCommandPtrT ) TCommandListT;
+
+       typedef wxTextEditorView* TextViewPtrT;
+       typedef WXSTL_VECTOR_SHALLOW_COPY( TextViewPtrT ) TextViewListT;
+#endif
+
+typedef TBlockListT::iterator TBlockIteratorT;
+
+
+/*
+ * class shields the higher-level operations from direct access
+ * to blocks of fragmented in-memory buffers
+ */
+
+class TTextIterator
+{
+public:
+       TBlockIteratorT   mBlockIter;
+       TBlockIteratorT   mEndOfListIter;
+       TPosition         mPos;
+
+       size_t            mActualRow;
+       size_t            mFirstRowInBlock;
+
+       char*             mpCurRowStart;
+       bool              mIsEof;
+
+public:
+       TTextIterator();
+
+       char GetChar();
+       bool IsEol();
+       bool IsEof();
+       bool IsLastLine();
+       int  GetDistFromEol();
+
+       void NextChar();
+       void PreviousChar();
+       void NextWord();
+       void PreviousWord();
+       void ToEndOfLine();
+       void ToStartOfLine();
+
+       bool IsInLastBlock();
+
+       // accesors
+
+       size_t    GetLineLen();
+       TPosition GetPosition();
+
+       char* GetClosestPos(); 
+       char* GotoClosestPos();
+
+       inline char* GetBlockStart() { return (*mBlockIter).mBuf; }
+       inline char* GetBlockEnd()   { return (*mBlockIter).mBuf + (*mBlockIter).mTextLen; }
+
+       bool DetectUnixText();
+
+       // adjust this member to add specific separators, 
+       // the default value is : ",.()[]\t\\+-*/|=<>:;\t\n~?!%"
+
+       static string mSeparators;
+
+       static bool IsSeparator( char ch );
+};
+
+class wxTextEditorModel;
+
+class TTextChangeListenerBase
+{
+public:
+       virtual void OnTextChanged( wxTextEditorModel* pModel, size_t atRow, size_t nRows, TEXT_CHANGE_TYPE ct ) = 0;
+};
+
+class TCppJavaHighlightListener : public TTextChangeListenerBase
+{
+protected:
+       wxTextEditorModel* mpModel; // is set up temporarely
+
+       enum { IN_COMMENT_STATE, OUT_OF_COMMENT_STATE };
+
+public:
+       virtual void OnTextChanged( wxTextEditorModel* pModel, size_t atRow, size_t nRows, TEXT_CHANGE_TYPE ct );
+};
+
+
+/*
+ * Base class for user-defined "bookmarks" within the source-text, bookmarks
+ * are automatically repositioned or deleted as the text is edited. Class
+ * can be subclassed to add pin-specific data (e.g. breakpoint information)
+ */
+
+class TPinBase
+{
+public:
+       int    mTypeCode;
+       size_t mRow;
+
+public:
+       TPinBase() 
+               : mTypeCode(-1), mRow(NPOS) {}
+
+       TPinBase( int typeCode, size_t row )
+               : mTypeCode( typeCode ), mRow( row ) {}
+
+       size_t GetRow()      { return mRow; }
+       int    GetTypeCode() { return mTypeCode; }
+
+       virtual ~TPinBase() {}
+};
+
+// "recommened" type-code ranges for custom pins
+
+#define HIHGLIGHTING_PINS_TC_STARRT 50
+#define OTHER_PINS_TC_START         100
+
+inline bool operator<( const TPinBase& lhs, TPinBase& rhs )
+
+       { return lhs.mRow < rhs.mRow; }
+
+#if defined( wxUSE_TEMPLATE_STL )
+
+       typedef vector<TPinBase*> PinListT;
+       typedef vector<TTextChangeListenerBase*> ChangeListenerListT;
+#else
+       typedef TPinBase* TPinBasePtrT;
+       typedef WXSTL_VECTOR_SHALLOW_COPY( TPinBasePtrT ) PinListT;
+
+       typedef TTextChangeListenerBase* TTextChangeListenerBasePtrT;
+       typedef WXSTL_VECTOR_SHALLOW_COPY( TTextChangeListenerBasePtrT ) ChangeListenerListT;
+#endif
+
+/* OLD STUFF::
+
+struct TPinBaseCompareFunctor
+{
+       inline int operator()(const TPinBasePtrT* x, const TPinBasePtrT*& y ) const 
+       { 
+               return x->mLine < y->mLine;
+       }
+};
+
+typedef WXSTL_MULTIMAP( TPinBasePtrT, TPinBasePtrT, TPinBaseCompareFunctor ) PinMapT;
+typedef PinMapT::iterator PinIteratorT;
+*/
+
+/* 
+ * Class manages access and manpulation of in-memory text. Can
+ * be accessed by multiple views, only one of which can be active
+ * at a time.
+ */
+
+class wxTextEditorModel
+{
+protected:
+       TBlockListT         mBlocks;
+       
+       TCommandListT       mCommands;
+       size_t              mCurCommand;
+
+       TextViewListT       mViews;
+       wxTextEditorView*   mpActiveView;
+
+       PinListT            mPins;
+       bool                mIsUnixText;
+
+       ChangeListenerListT mChangeListeners;
+
+public:
+       /*** public properties ***/
+
+       bool          mTextChanged;
+       size_t        mChangedFromRow;
+       size_t        mChangedTillRow;
+
+       bool          mWasChanged;                        // TRUE, if any content has been changed
+
+       TPosition     mCursorPos;
+
+       TPosition         mPrevSelectionStart;
+       TPosition     mPrevSelectionEnd;
+       TPosition     mPrevCursorPos;
+
+       TPosition     mSelectionStart;
+       TPosition     mSelectionEnd;
+       size_t        mRowsPerPage;
+
+       bool          mIsReadOnly;           // default: FALSE
+       bool          mIsModified;     
+       bool          mInsertMode;                       // default: TRUE
+       bool          mAutoIndentMode;       // default: TRUE
+       bool          mSmartIndentMode;      // default: TRUE
+
+       bool          mIsSelectionEditMode;  // default: TRUE
+       size_t        mTabSize;              // default: 4
+
+       StrListT      mSearchExprList;
+       string        mLastFindExpr;
+
+       bool          mCheckPointDestroyed;
+       size_t        mCheckPointCmdNo;
+
+protected:
+
+       size_t GetLineCountInRange( char* from, char* till ); 
+
+       // two lowest-level operations
+       void DoInsertText ( const TPosition& pos, char* text, size_t len, TRange& actualRange );
+       void DoDeleteRange( const TPosition& from, const TPosition& till, TRange& actualRange );
+
+       void DoExecuteNewCommand( TCommand& cmd );
+
+       void DoReexecuteCommand( TCommand& cmd );
+       void DoUnexecuteCommand( TCommand& cmd );
+
+
+       void ExecuteCommand( TCommand* pCmd );
+
+       // to methods enabling grouping of undo-able commands
+       bool CanPrependCommand( TCommand* pCmd );
+       void PrependCommand( TCommand* pCmd );
+
+       void SetPostPos( const TPosition& pos );
+
+       void UndoImpl();
+       void RedoImpl();
+
+       void StartBatch();
+       void FinishBatch();
+
+       void CheckSelection();
+       void TrackSelection();
+
+       void NotifyView();
+       void NotifyAllViews();
+
+       void NotifyTextChanged( size_t atRow, size_t nRows, TEXT_CHANGE_TYPE ct );
+       void NotifyTextChanged( TPosition from, TPosition till, TEXT_CHANGE_TYPE ct );
+
+       void ArrangePositions( TPosition& upper, TPosition& lower );
+       void ArrangePositions( size_t& upper, size_t& lower );
+
+       void MergeChange( size_t fromRow, size_t nRows );
+
+       void PrepreForCommand();
+
+       size_t TextToScrColumn( const TPosition& pos );
+       size_t ScrToTextColumn( TPosition pos );
+
+       void DoMoveCursor( int rows, int cols );
+
+public:
+       wxTextEditorModel();
+       virtual ~wxTextEditorModel();
+
+       // utilities
+
+       char* AllocCharacters( size_t n );
+       char* AllocCharacters( size_t n, const char* srcBuf );
+       void FreeCharacters( char* buf );
+
+       void DeleteSelection();
+       TTextIterator CreateIterator( const TPosition& pos );
+
+       void DeleteRange( const TPosition& from, const TPosition& till );
+       void InsertText( const TPosition& pos, const char* text, size_t len );
+       void GetTextFromRange( const TPosition& from, const TPosition& till, char** text, size_t& textLen );
+       void LoadTextFromFile( const wxString& fname );
+       void SaveTextToFile( const wxString& fname );
+       void ResetSelection();
+       void ClearUndoBuffer();
+
+
+       void DeleteAllText();
+       void GetAllText( char** text, size_t& textLen );
+
+       void SetSelectionEditMode( bool editIsOn );
+
+       /*** user-level commands ***/
+
+       // mutable (undoable) commands
+
+       void OnInsertChar( char ch );
+       void OnDelete();
+       void OnDeleteBack();
+       void OnDeleteLine();
+
+       void OnShiftSelectionIndent( bool left );
+
+       // clipboard functions
+
+       void OnCopy();
+       void OnPaste();
+       void OnCut();
+       bool CanCopy();
+       bool CanPaste();
+
+       // undo-redo
+
+       bool CanUndo();
+       bool CanRedo();
+       void OnUndo();
+       void OnRedo();
+
+       // imutable commands
+
+       void OnMoveLeft();
+       void OnMoveRight();
+       void OnMoveUp();
+       void OnMoveDown();
+
+       void OnWordLeft();
+       void OnWordRight();
+
+       void OnMoveToPosition( const TPosition& pos );
+
+       void OnEndOfLine();
+       void OnStartOfLine();
+       void OnPageUp();
+       void OnPageDown();
+       void OnSlideUp();
+       void OnSlideDown();
+       void OnStartOfText();
+       void OnEndOfText();
+
+       void OnSelectWord();
+       void OnSelectAll();
+
+       // bookmarks
+
+       void OnToggleBookmark();
+       void OnNextBookmark();
+       void OnPreviousBookmark();
+
+       // search
+
+       bool OnFind();
+       bool OnFindNext();
+       bool OnFindPrevious();
+       void OnGotoLine( int line, int col );
+       void OnGotoLine();
+
+       // status
+
+       bool IsReadOnly();
+       bool IsModified();
+       bool IsInsertMode();
+
+       // check-pointin
+
+       void SetCheckpoint();
+       bool CheckpointModified();
+
+       // accessors
+
+       TPosition GetStartOfSelection();
+       TPosition GetEndOfSelection();
+       TPosition GetCursor();
+
+       size_t    GetTotalRowCount();
+       bool      SelectionIsEmpty();
+       bool      IsLastLine( const TPosition& pos );
+
+       bool      IsUnixText() { return mIsUnixText; }
+
+       void GetSelection( char** text, size_t& textLen );
+
+       void SetStartOfSelection( const TPosition& pos );
+       void SetEndOfSelection( const TPosition& pos );
+       void SetCursor( const TPosition& pos );
+
+       void AddView( wxTextEditorView* pView );
+       void RemoveView( wxTextEditorView* pView );
+       void SetActiveView( wxTextEditorView* pView );
+       wxTextEditorView* GetActiveView();
+
+       void SetRowsPerPage( size_t n );
+
+       void AddPin( TPinBase* pPin );
+       PinListT& GetPins(); 
+
+       // returns NPOS, if non
+       size_t FindFirstPinInRange( size_t fromRow, size_t tillRow );
+       size_t FindNextPinFrom( size_t fromRow );
+       size_t FindPreviousPinFrom( size_t fromRow );
+
+       size_t GetPinNoAt( size_t row, int pinTypeCode );
+       TPinBase* GetPinAt( size_t row, int pinTypeCode );
+       void RemovePinAt( size_t row, int pinTypeCode );
+
+       void AddChangeListener( TTextChangeListenerBase* pListener );
+};
+
+class TCursorTimer;
+class wxTextEditorView;
+
+class TPinPainterBase : public wxObject
+{
+public:
+       int    mPinTypeCode;
+
+public:
+       TPinPainterBase( int pinTc ) : mPinTypeCode( pinTc ) {}
+       TPinPainterBase() : mPinTypeCode( -1 ) {}
+
+       inline int GetPinTypeCode() { return mPinTypeCode; }
+
+       virtual void DrawPin( TPinBase* pPin, wxTextEditorView& view, wxDC& dc, 
+                                                 const wxPoint& pos, const wxSize& dim ) = 0;
+};
+
+/*
+ * a couple very common ping objects/painters
+ */
+
+#define BOOKMARK_PIN_TC  (OTHER_PINS_TC_START)
+#define BRKPOINT_PIN_TC  (BOOKMARK_PIN_TC + 1)
+
+class TBookmarkPainter : public TPinPainterBase
+{
+protected:
+       wxBrush mBkBrush;
+
+public:
+       TBookmarkPainter();
+
+       virtual void DrawPin( TPinBase* pPin, wxTextEditorView& view, wxDC& dc, 
+                                                 const wxPoint& pos, const wxSize& dim );
+};
+
+class TBookmarkPin : public TPinBase
+{
+public:
+       TBookmarkPin( size_t row )
+               : TPinBase( BOOKMARK_PIN_TC, row )
+       {}
+
+       static int GetPinTypeCode() { return BOOKMARK_PIN_TC; }
+};
+
+class TBreakpointPainter : public TPinPainterBase
+{
+protected:
+       wxBrush mBkBrush;
+
+public:
+       TBreakpointPainter();
+
+       virtual void DrawPin( TPinBase* pPin, wxTextEditorView& view, wxDC& dc, 
+                                                 const wxPoint& pos, const wxSize& dim );
+};
+
+class TBreakpointPin : public TPinBase
+{
+public:
+       TBreakpointPin( size_t row )
+               : TPinBase( BRKPOINT_PIN_TC, row )
+       {}
+
+       static int GetPinTypeCode() { return BRKPOINT_PIN_TC; }
+};
+
+
+#if defined( wxUSE_TEMPLATE_STL )
+       typedef vector<TPinPainterBase*> PinPainterListT;
+#else
+       typedef TPinPainterBase* TPinPainterBasePtrT;
+       typedef WXSTL_VECTOR_SHALLOW_COPY( TPinPainterBasePtrT ) PinPainterListT;
+#endif
+
+/*
+ * Class displays graphical view of data contained in wxTextModel
+ */
+
+class wxTextEditorView : public wxScrolledWindow
+{
+protected:
+
+       wxTextEditorModel*  mpModel;
+       TPosition           mSelectionStart;
+       TPosition           mSelectionEnd;
+       TPosition           mCursorPos;
+
+       TPosition           mLastViewStart;
+       size_t              mLastRowsTotal;
+
+       size_t              mRowsPerPage;
+       size_t              mColsPerPage;
+
+       static char*        mpLineBuffer;
+       static size_t       mpLineBufferLen;
+
+       bool                mFullRefreshPending;
+       bool                mAdjustScrollPending;
+
+       wxFont              mFont;
+
+       bool                mScrollingOn; // default: TRUE
+       bool                mCursorOn;   // default: TRUE;
+
+       bool                mLTMode; // line-tracking mode
+                                                                // (when the whole line is coloured,
+                                    //  instead of showing blinking cursor position)
+
+       wxColour            mLTColour; // fill-colour for LT-mode
+
+       bool                mDragStarted;
+       char*               mpDraggedText;
+
+       bool                mOwnsModel;
+
+       wxString            mFragment; // reused heap-buffer 
+                                                                  // for coloured fragments
+       SourcePainter*      mpPainter;
+       PinPainterListT     mPinPainters;
+       TTextIterator       mCashedIter;
+
+       static TCursorTimer* mpTimer;
+
+public: /*** public properties ***/
+
+       int                mLeftMargin;         // default: 20
+       int                mRightMargin;        // default: 0
+       int                mTopMargin;          // default: 0
+       int                mBottomMargin;       // default: 0
+       int                mMaxColumns;     // default: 500
+
+       TPosition          mPagePos;
+
+       // color-scheme properties
+
+       wxColour           mNormalTextCol;
+       wxColour           mIndentifierTextCol;
+       wxColour           mReservedWordTextCol;
+       wxColour           mCommentTextCol;
+
+       wxColour           mNormalBkCol;
+       wxColour           mSelectionFgCol;
+       wxColour           mSelectionBkCol;
+
+       wxBrush            mNormalBkBrush;
+       wxBrush            mSelectedBkBrush;
+
+       // accessed by timer
+
+       TPosition           mCursorScrPos;
+       wxSize              mCharDim;
+
+protected:
+
+       char* GetLineBuffer( size_t len );
+
+       virtual void PaintDecorations( size_t fromRow, size_t tillRow, wxDC& dc, TTextIterator& iter );
+       virtual void PaintRows( size_t fromRow, size_t tillRow, wxDC& dc );
+
+       void ObtainFontProperties();
+
+       bool IsActiveView();
+       void SetTextDefaults();
+       void RecalcPagingInfo();
+
+       TPinPainterBase* FindPainterForPin( TPinBase& pin );
+
+public:
+       wxTextEditorView( wxWindow* parent, wxWindowID id = -1, 
+                                         wxTextEditorModel* pModel = NULL, 
+                                         int wndStyle = wxSUNKEN_BORDER,
+                                         bool ownsModel = TRUE );
+       ~wxTextEditorView();
+
+       /*** setup methods ***/
+
+       void SetModel( wxTextEditorModel* pModel );
+
+       // sets custom syntax-higlighting implementation
+       void SetSourcePainter( SourcePainter* pPainter );
+       void AddPinPainter( TPinPainterBase* pPainter );
+
+       void SetDefaultFont( const wxFont& font );
+       wxFont& GetDefaultFont(); 
+
+       wxSize GetCharacterSize() { return mCharDim; }
+
+       size_t GetRowsPerPage() { return mRowsPerPage; }
+       void SetRowsPerPage( size_t n );
+       void SetMaxColumns( size_t n );
+
+       void SetLineTrackingMode( bool on, const wxColour& col = wxColour(255,255,0) );
+
+       void EnableCursor( bool enable );
+       void EnableScrollbars( bool enable );
+
+       void SetColours( const wxColour& normalBkCol,
+                                        const wxColour& selectedBkCol,
+                                        const wxColour& selectedTextCol );
+
+       void SetHeighlightingColours( const wxColour& normalTextCol,
+                                                                 const wxColour& identifierTextCol,
+                                                                 const wxColour& reservedWordTextCol,
+                                                                 const wxColour& commentTextCol );
+
+       void SetMargins( int top, int left, int bottom, int right );
+
+       // notifications from editor-model:
+
+       void OnModelChanged();
+       void ScrollView( int rows, int cols );
+
+       // accessors
+
+       void Activate();
+       void Deactivate();
+
+       // event handlers
+
+#if (( wxVERSION_NUMBER < 2100 ) || (( wxVERSION_NUMBER == 2100 ) && (wxBETA_NUMBER <= 4)))
+       void OnScroll( wxScrollEvent& event );
+#else
+        void OnScroll( wxScrollWinEvent& event );
+#endif
+       void OnPaint ( wxPaintEvent& event );
+       void OnSize  ( wxSizeEvent& event );
+       void OnEraseBackground( wxEraseEvent& event );
+
+       void OnLButtonDown( wxMouseEvent& event );
+       void OnLButtonUp  ( wxMouseEvent& event );
+       void OnMotion     ( wxMouseEvent& event );
+       void OnDblClick   ( wxMouseEvent& event );
+
+       void OnSetFocus( wxFocusEvent& event );
+       void OnKillFocus( wxFocusEvent& event );
+
+       // requests editor to keep cursor blinking, even when
+       // the window has lost it's focus
+
+       void HoldCursor( bool hold );
+
+       // FOR NOW:: hard-coded key-bindings
+
+       void OnChar( wxKeyEvent& event );
+       void OnKeyDown( wxKeyEvent& event );
+
+       // utilities
+
+       virtual void SyncViewPortPosition();
+       virtual void SyncScrollbars();
+       virtual void PositionCursor();
+
+       void TextPosToScreenPos( const TPosition& txtPos, TPosition& scrPos );
+       void ScreenPosToTextPos( const TPosition& scrPos, TPosition& txtPos );
+       void ScreenPosToPixels ( const TPosition& scrPos, int& x, int& y );
+       void PixelsToScrPos    ( int x, int y, int& scrRow, int& scrCol );
+       void PixelsToTextPos   ( int x, int y, TPosition& textPos );
+
+       bool IsClipboardCmd( wxKeyEvent& key );
+
+       TPosition GetPagePos() { return mPagePos; }
+
+       DECLARE_EVENT_TABLE()
+};
+
+// TODO:: mutex class should be used to avoid race on updates
+
+class TCursorTimer : public wxTimer
+{
+protected:
+       wxTextEditorView* mpView;
+       volatile bool mIsLocked;
+       volatile bool mIsShown;
+       volatile bool mStarted;
+       wxBrush       mBrush;
+       bool          mMissOneTick;
+
+       int           mBlinkInterval;  // default: 500mills
+protected:
+
+       void DrawCursor();
+
+public:
+
+       TCursorTimer();
+
+       virtual void Notify();
+
+       void SetView( wxTextEditorView* pView );
+       wxTextEditorView* GetView();
+       void HideCursor( bool forceHide = FALSE );
+       void ShowCursor( bool forceShow = FALSE );
+
+       void SetIsShown( bool isShown );
+       void Lock();
+       void Unlock();
+};
+
+#endif // __TDEFS_G__
diff --git a/utils/wxPython/modules/lseditor/test/editor.py b/utils/wxPython/modules/lseditor/test/editor.py
new file mode 100644 (file)
index 0000000..715b1e5
--- /dev/null
@@ -0,0 +1,118 @@
+from wxPython.wx import *
+from wxPython.lseditor import *
+
+class LSEditorFrame(wxFrame):
+       def __init__(self, parent, id, title, pos = wxDefaultPosition, size = wxSize(400,400)):
+               wxFrame.__init__(self, parent, id, title, pos, size)
+               self.editor = wxsLSEditorPlugin()
+               self.editor.Create(self, -1)
+               self.SetMenuBar(self.GetDefaultMenuBar())               
+               self.CreateStatusBar()
+               self.SetDefaultEvents()
+               self.filename = ""
+       def GetDefaultMenuBar(self):
+               mbar = wxMenuBar()
+               menu = wxMenu()
+               menu.Append(1500, "Open")
+               menu.Append(1501, "Save")
+               menu.Append(1502, "SaveAs")
+               menu.AppendSeparator()
+               menu.Append(1503, "Exit")
+               mbar.Append(menu, "File")
+               menu = wxMenu()
+               menu.Append(1510, "Copy")
+               menu.Append(1511, "Cut")
+               menu.Append(1512, "Paste")
+               menu.AppendSeparator()
+               menu.Append(1513, "Delete")
+               menu.AppendSeparator()
+               menu.Append(1514, "Undo")
+               menu.Append(1515, "Redo")
+               menu.AppendSeparator()
+               menu.Append(1516, "Find...")
+               menu.Append(1517, "Find Next")
+               menu.Append(1518, "Find Previous")
+               menu.Append(1519, "Replace...")
+               mbar.Append(menu, "Edit")       
+               menu = wxMenu()
+               menu.Append(1520, "Toggle")
+               menu.Append(1521, "Next")
+               menu.Append(1522, "Prev")
+               mbar.Append(menu, "Bookmarks")
+               return mbar
+       def SetDefaultEvents(self):     
+               EVT_MENU(self, 1500, self.evt_OnOpen)
+               EVT_MENU(self, 1501, self.evt_OnSave)
+               EVT_MENU(self, 1502, self.evt_OnSaveAs)
+               EVT_MENU(self, 1503, self.OnClose)
+               EVT_MENU(self, 1510, self.evt_OnCopy)
+               EVT_MENU(self, 1511, self.evt_OnCut)
+               EVT_MENU(self, 1512, self.evt_OnPaste)
+               EVT_MENU(self, 1513, self.evt_OnDelete)
+               EVT_MENU(self, 1514, self.evt_OnUndo)
+               EVT_MENU(self, 1515, self.evt_OnRedo)
+               EVT_MENU(self, 1516, self.evt_OnFind)
+               EVT_MENU(self, 1517, self.evt_OnFindNext)
+               EVT_MENU(self, 1518, self.evt_OnFindPrevious)
+               EVT_MENU(self, 1519, self.evt_OnReplace)
+               EVT_MENU(self, 1520, self.evt_OnToggle)
+               EVT_MENU(self, 1521, self.evt_OnNext)
+               EVT_MENU(self, 1522, self.evt_OnPrev)
+               #EVT_MENU(self, 15, self.evt_)
+               #EVT_MENU(self, 15, self.evt_)
+       def evt_OnOpen(self, event):
+               dlg = wxFileDialog(NULL, "Open file")
+               if dlg.ShowModal() == wxID_OK:
+                       self.filename = dlg.GetPath()
+                       self.editor.OnOpen(self.filename)
+       def evt_OnSaveAs(self, event):
+               dlg = wxFileDialog(NULL, "Save As", self.filename)
+               if dlg.ShowModal() == wxID_OK:
+                       self.filename = dlg.GetPath()
+                       self.editor.OnSave(self.filename)
+       def evt_OnSave(self, event):
+               if self.filename:
+                       self.editor.OnSave(self.filename)
+               else:
+                       self.evt_OnSaveAs(None)
+       def OnClose(self,event):
+               self.Destroy()
+       def evt_OnCopy(self,event):
+               self.editor.OnCopy()
+       def evt_OnCut(self,event):
+               self.editor.OnCut()
+       def evt_OnPaste(self,event):
+               self.editor.OnPaste()
+       def evt_OnDelete(self,event):
+               self.editor.OnDelete()
+       def evt_OnUndo(self,event):
+               self.editor.OnUndo()
+       def evt_OnRedo(self,event):
+               self.editor.OnRedo()
+       def evt_OnToggle(self,event):
+               self.editor.OnToggleBookmark()
+       def evt_OnNext(self,event):
+               self.editor.OnNextBookmark()
+       def evt_OnPrev(self,event):
+               self.editor.OnPreviousBookmark()
+       def evt_OnFind(self,event):
+               self.editor.OnFind()
+       def evt_OnFind(self,event):
+               self.editor.OnFind()
+       def evt_OnFindNext(self,event):
+               self.editor.OnFindNext()
+       def evt_OnFindPrevious(self,event):
+               self.editor.OnFindPrevious()
+               self.SetStatusText("OnFindPrevious: Not implemented")
+       def evt_OnReplace(self,event):
+               self.editor.OnReplace()
+               self.SetStatusText("OnReplace: Not implemented")
+
+class MyApp(wxApp):
+       def OnInit(self):
+               frame = LSEditorFrame(NULL, -1, "Editor")
+               frame.Show(TRUE)
+               return TRUE
+
+App = MyApp(0)
+App.MainLoop()
diff --git a/utils/wxPython/modules/lseditor/wxsdefs.h b/utils/wxPython/modules/lseditor/wxsdefs.h
new file mode 100644 (file)
index 0000000..0014d7f
--- /dev/null
@@ -0,0 +1,374 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        No names yet.
+// Purpose:     Contrib. demo
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     24/04/1999
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleskandars Gluchovas
+// Licence:    GNU General Public License
+/////////////////////////////////////////////////////////////////////////////
+#ifndef __WXSDEFS_G__
+#define __WXSDEFS_G__
+
+#include <config.h>
+
+
+#include "controlarea.h"
+
+#ifdef wxUSE_TEMPLATE_STL
+#include <vector>
+#include <map>
+//using std::map;
+//using std::vector;
+using namespace std;
+#else
+#include "wxstldefs.h" // imports predefine StrListT, IntListT containers
+#include "wxstlac.h"
+#endif
+class wxsProject;
+class wxsComponent;
+class wxsWorkplace;
+class wxsOpenedFileInfo;
+class wxsWorkplaceListener;
+class wxsSourceEditorPlugin;
+class wxsSourceInfoPlugin;
+class wxsAppListener;
+class wxsAppInterface;
+
+class wxFrame;
+
+typedef wxsWorkplaceListener* wxsWorkplaceListenerPtrT;
+
+#ifdef wxUSE_TEMPLATE_STL
+typedef vector<wxsWorkplaceListenerPtrT> wxsWorkplaceListenerListT;
+#else
+typedef WXSTL_VECTOR_SHALLOW_COPY( wxsWorkplaceListenerPtrT ) wxsWorkplaceListenerListT;
+#endif
+
+// IDs for the controls and the menu commands
+enum
+{
+    // menu items
+    WXS_Quit = 3300,  // FIXEM:: ids..
+    WXS_About,
+       WXS_Open,
+    WXS_Close,
+       WXS_OpenWorkplace,
+       WXS_Save,
+    WXS_SaveAs,
+       WXS_SaveAll,
+       WXS_CloseWorkplace,
+    WXS_SaveWorkplace,
+       WXS_NewProject,
+
+       WXS_ShowTips,
+
+       WXS_Undo = 9000, 
+       WXS_NextWindow,
+       WXS_PreviousWindow,
+       WXS_CloseWindow,
+       WXS_ListWindows,
+       WXS_UpdateBrowser,
+       WXS_ToggleWorkplaceWindow,
+
+       WXS_InsertFiles,
+       WXS_Test,
+    WXS_Settings,
+
+       WXS_ClassView,
+       WXS_FileView,
+       WXS_GotoEditor,
+
+    WXS_Test1,
+    WXS_Test2,
+
+    // controls start here (the numbers are, of course, arbitrary)
+    WXS_Text = 1000,
+
+       ID_EDIT_UNDO,       
+       ID_EDIT_REDO,             
+       ID_EDIT_CUT,              
+       ID_EDIT_COPY,             
+       ID_EDIT_PASTE,    
+       ID_EDIT_DELETE,   
+       ID_EDIT_SELECT_ALL, 
+       ID_EDIT_FIND,             
+       ID_EDIT_FIND_NEXT,
+       ID_EDIT_REPLACE,          
+       ID_EDIT_GOTO,             
+       ID_EDIT_TOGGLE_BM,  
+       ID_EDIT_NEXT_BM,          
+       ID_EDIT_PREV_BM,          
+       ID_EDIT_TOGGLE_BRKPNT,
+       ID_EDIT_BOOKMARKS,  
+       ID_EDIT_SETFONT,  
+    ID_LEFT_SASH,
+    ID_BOTTOM_SASH
+};
+
+// bitmaps/icons
+enum WXS_ICON_ENUM{
+    WXS_ICON_class = 1,
+    WXS_ICON_priv_mtd,
+    WXS_ICON_prot_mtd,
+    WXS_ICON_pub_mtd,
+    WXS_ICON_priv_mtd_def,
+    WXS_ICON_prot_mtd_def,
+    WXS_ICON_pub_mtd_def,
+    WXS_ICON_priv_var,
+    WXS_ICON_prot_var,
+    WXS_ICON_pub_var,
+    WXS_ICON_pub_pure_mtd,
+    WXS_ICON_file,
+    WXS_ICON_folder,
+    WXS_ICON_mru_folder,
+    WXS_ICON_class_gray,
+    WXS_ICON_file_gray,
+};
+
+
+typedef char* CharPtrT;
+
+struct UU_cmp
+{ 
+       inline int operator()(const CharPtrT x, const CharPtrT y ) const { return 0; } 
+};
+
+typedef wxBitmap* wxBitmapPtrT;
+#ifdef wxUSE_TEMPLATE_STL
+typedef map<WXS_ICON_ENUM, wxBitmapPtrT> WXS_BitmapsMapT;
+#else
+typedef WXSTL_MAP( WXS_ICON_ENUM, wxBitmapPtrT, 
+                                  LESS_THEN_FUNCTOR(WXS_ICON_ENUM) ) WXS_BitmapsMapT;
+#endif
+
+extern WXS_BitmapsMapT WXS_Bitmaps;
+#define WXS_ICON(name) (*WXS_Bitmaps[WXS_ICON_##name])
+
+
+// very general file categories
+
+enum WXS_FILE_CATEGORY
+{
+       WXS_UNKNOWN_FILE,
+       WXS_SOURCE_FILE,
+       WXS_RESOURCE_FILE,
+       WXS_DOCUMENTATION_FILE,
+       WXS_CONFIGURAITON_FILE
+};
+
+enum WXS_PLUGIN_TYPE
+{
+       WXS_UNKNOWN_PLUGIN,
+       WXS_EDITOR_PLUGIN,
+       WXS_CLASSINFO_PLUGIN,
+       WXS_CLASSBROWSER_PLUGIN,
+       WXS_FILEBROWSER_PLUGIN,
+       WXS_TOOL_PLUGIN,
+       WXS_OUTPUTTOOL_PLUGIN
+};
+
+
+
+class wxsAppListener
+{
+public:
+       virtual void OnWindowSwitched( wxWindow* fromWnd, wxWindow* toWnd ) {};
+       virtual bool OnCloseWindow( wxWindow* wnd ) { return TRUE; }
+    virtual void OnTabSwitched() {};
+    virtual void OnPageSwitched() {};
+};
+
+class wxsAppInterface
+{
+public:
+    virtual void SetAppListener(wxsAppListener* pLsn) = 0;
+    
+       virtual void AddEditor(wxsSourceEditorPlugin* editor,wxString title,wxBitmap* pImage = NULL) = 0;
+       virtual void ActivateEditor( wxsSourceEditorPlugin* editor ) = 0;
+       virtual void CloseEditor( wxsSourceEditorPlugin* editor ) = 0;
+
+    virtual void ShowNextWindow() = 0;
+    virtual void ShowPreviousWindow() = 0;
+    virtual void CloseActiveWindow() = 0;
+    virtual void CloseWindow( wxWindow* wnd ) = 0;
+    virtual void ShowWindowList() = 0;
+    virtual wxWindow* GetActiveWindow() = 0;
+    virtual wxTabbedWindow* GetTabbedWindow() = 0;
+       virtual void AddTab(wxsComponent* pContent, wxString tabText, wxBitmap* pImage = NULL) = 0;
+    virtual void ShowNextTab() = 0;
+    virtual wxPaggedWindow* GetPaggedWindow() = 0;
+       virtual void AddPage(wxsComponent* pContent, wxString tabText, wxBitmap* pImage = NULL) = 0;
+    virtual void ShowNextPage() = 0;
+       virtual wxFrame* GetMainFrame() = 0;
+       virtual void SetStatusText( const string& text ) = 0;
+
+       static wxsAppInterface& GetInstance();
+
+protected:
+       static wxsAppInterface* mpInstance;
+       friend wxsAppInterface& wxsGetApp();
+};
+
+// short-cut for wxsAppInterface::GetInstance()
+
+wxsAppInterface& wxsGetApp();
+
+class wxsWorkplaceListener : public wxObject
+{
+public:
+       virtual void OnSubprojectAdded(   wxsProject& subPrj, wxsProject& toPrj   ) {}
+       virtual void OnSubprojectRemoved( wxsProject& subPrj, wxsProject& fromPrj ) {}
+       virtual void OnProjectCreated( wxsProject& prj ) {}
+       virtual void OnRootProjectLoaded() {}
+       virtual void OnRootProjectClosed() {}
+       virtual void OnFilesAddedToProject( wxsProject& prj, StrListT& files, WXS_FILE_CATEGORY cat ) {}
+       virtual void OnFilesRemovedFromProject( wxsProject& prj, StrListT& files, WXS_FILE_CATEGORY cat ) {}
+
+       virtual void OnFileContentChanged( wxsProject& prj, const string& file, WXS_FILE_CATEGORY cat,
+                                                                          char* newContent, size_t len ) {}
+
+       virtual void OnFileOpened( wxsOpenedFileInfo& file ) {}
+};
+
+typedef wxsProject* wxsProjectPtrT;
+#ifdef wxUSE_TEMPLATE_STL
+typedef vector<wxsProjectPtrT> wxsProjectListT;
+#else
+typedef WXSTL_VECTOR_SHALLOW_COPY( wxsProjectPtrT ) wxsProjectListT;
+#endif
+
+class wxsProject : public wxObject
+{
+public:
+    // Basic project info
+    virtual void SetName(const string& name) = 0;
+    virtual void SetFileName(const string& fname) = 0;
+    virtual void SetDescription(const string& desc) = 0;
+    virtual void SetLanguage(const string& lang) = 0;
+       virtual string GetName() = 0;
+       virtual string GetFileName() = 0;
+       virtual string GetDescription() = 0;
+       virtual string GetLanguage() = 0;
+    // File manipulation
+    virtual bool AddFile( const string& file) = 0;
+    virtual bool RemoveFile ( const string& file ) = 0;
+       virtual StrListT GetFiles() = 0;
+    // Sub-Project manipulation
+    virtual void AddSubproject( wxsProject* subPrj) = 0;
+    virtual void RemoveSubproject( wxsProject* subPrj) = 0;
+       virtual wxsProjectListT& GetSubprojects() = 0;
+    // Transient information (parent only exists when loaded
+    virtual void SetParent( wxsProject* parentPrj) = 0;
+       virtual wxsProject* GetParent() = 0;
+    // configuration info storage
+    virtual string CreateConfig ( const string& file = "" ) = 0;
+    virtual bool SetCurrentConfig ( const string& configkey ) = 0;
+    virtual bool AddConfigValue( const string& key, string& value) = 0;
+    virtual bool SetConfigValue( const string& key, string& value) = 0;
+    virtual bool RemoveConfigValue( const string& key ) = 0;
+    virtual string GetConfigValue ( const string& key ) = 0;
+    
+    
+};
+
+class wxsOpenedFileInfo : public wxObject
+{
+public:
+       string      mFullName;
+       wxsProject* mpProject; // NULL, if file does not belong to any project
+       wxsSourceEditorPlugin* mpEditor;
+       WXS_FILE_CATEGORY      mCategory;
+       bool                   mIsSaved;
+
+public:
+       wxsOpenedFileInfo() : mIsSaved( TRUE ), mpProject( NULL ) {}
+
+       wxsProject* GetProject() { return mpProject; }
+       const string& GetFullName() { return mFullName; }
+       wxsSourceEditorPlugin& GetEditor() { return *mpEditor; }
+       WXS_FILE_CATEGORY GetCategory() { return mCategory; }
+};
+
+typedef wxsOpenedFileInfo* wxsOpenedFileInfoPtrT;
+#ifdef wxUSE_TEMPLATE_STL
+typedef vector<wxsOpenedFileInfoPtrT> wxsOpenedFileInfoListT;
+#else
+typedef WXSTL_VECTOR_SHALLOW_COPY( wxsOpenedFileInfoPtrT ) wxsOpenedFileInfoListT;
+#endif
+
+// abstract interface
+
+class wxsWorkplace : public wxObject
+{
+public:
+       virtual void CreateProject( const string& name, const string& projectFile, const wxsProject* parent=NULL) = 0;
+
+       virtual void LoadRootProject( const string& projectFile ) = 0;
+       virtual void SaveProject( wxsProject& prj ) = 0;
+       virtual void CloseRootProject() = 0;
+
+       virtual wxsProject& GetRootProject() = 0;
+       virtual wxsProject* FindProjectByName( const string& name ) = 0;
+       virtual wxsOpenedFileInfo* FindFileByEditor( wxsSourceEditorPlugin& editor ) = 0;
+
+       virtual void AddWorkpalceListener( wxsWorkplaceListener* pListener ) = 0;
+       
+       virtual void AddSubproject( wxsProject& intoPrj,const string& projectFile ) = 0;
+       virtual void RemoveSubproject( wxsProject& prj ) = 0;
+
+       virtual void AddFilesToProject( wxsProject& prj, StrListT& files ) = 0;
+       virtual void RemoveFilesFromProject( wxsProject& prj, StrListT& files ) = 0;
+
+       virtual void NotifyFileContentChanged( wxsProject& prj, const string& file, 
+                                                                                  char* newContent, size_t len ) = 0;
+
+       virtual void NotifyFileContentChanged( wxsOpenedFileInfo& info ) = 0;
+       virtual void NotifyEditorDeactivated( wxsSourceEditorPlugin& editor ) = 0;
+
+       // if pPrj is NULL, the specified file does not belong to any projects,
+       // i.e. it blongs to the workplace
+
+       virtual wxsOpenedFileInfo*
+               OpenFileInEditor( const string& file, wxsProject* pPrj = NULL,
+                          int line = -1, int column = -1) = 0;
+
+       virtual void GetCurrentFileContent( wxsProject& prj, const string& file,
+                                                                               char** buf, size_t& len 
+                                                                         ) = 0;
+
+       // returns FALSE, if source was already up-to-date
+       virtual bool SyncSourceInfo() = 0;
+
+       virtual wxsProject* FindSubproject( wxsProject& parentPrj, const string& prjName ) = 0;
+       virtual wxsOpenedFileInfo* FindOpenedFile( const string& name ) = 0;
+       virtual bool FileIsOpened( wxsProject& prj, const string& file ) = 0;
+       virtual wxsSourceEditorPlugin* GetSourceEditor( wxsProject& prj, const string& file ) = 0;
+       virtual wxsSourceInfoPlugin* GetSourceInfoPlugin() = 0;
+
+       static wxsWorkplace& GetInstance() { return *wxsWorkplace::mpInstance; }
+
+       virtual wxsOpenedFileInfoListT& GetOpenedFiles() = 0;
+       virtual wxsOpenedFileInfo* GetActiveFile() = 0;
+
+       virtual void SaveFile( wxsOpenedFileInfo& info ) = 0;
+       virtual void SaveAllFiles() = 0;
+
+       virtual bool CloseFile( wxsOpenedFileInfo& info, bool closeWindow = TRUE ) = 0;
+       virtual bool CloseAllFiles() = 0;
+
+       virtual bool CloseInProgress() = 0;
+
+       virtual WXS_FILE_CATEGORY GetFileCategory( const string& file ) = 0;
+
+protected:
+       static wxsWorkplace* mpInstance;
+       friend wxsWorkplace& wxsGetWorkplace();
+};
+
+// short-cut for wxsWorkplace::GetInstance()
+
+wxsWorkplace& wxsGetWorkplace();
+
+#endif
diff --git a/utils/wxPython/modules/lseditor/wxstlac.h b/utils/wxPython/modules/lseditor/wxstlac.h
new file mode 100644 (file)
index 0000000..447bc1b
--- /dev/null
@@ -0,0 +1,659 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        No names yet.
+// Purpose:     Contrib. demo
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     27/09/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleskandars Gluchovas
+// Licence:    wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __WXSTLAC_G__
+#define __WXSTLAC_G__
+
+#include <stddef.h>
+#include <sys/types.h>
+#include <memory.h>
+#include <limits.h>
+#include <new>
+
+
+// the below macro used internally (see actual interface after this macro)
+
+// arguments:
+//
+//         ARG_IS_UNIQUE
+//             ASSOC_CONT_CLASS_NAME
+//
+//         ARG_VALUE_TYPE
+//      ARG_KEY_TYPE
+//      ARG_ACTUAL_VALUE_TYPE
+//      
+//      _KEY_NAME
+//      _VALUE_NAME
+//
+//             _X_KEY_NAME
+//             _X_VALUE_NAME
+//
+//      _INSERT_METHOD_DEFINITION
+
+#define __DEFINE_ASOC_CLASS( ARG_IS_UNIQUE, \
+FUNCTOR,\
+ASSOC_CONT_CLASS_NAME, \
+ARG_VALUE_TYPE, \
+ARG_KEY_TYPE, \
+ARG_ACTUAL_VALUE_TYPE, \
+_KEY_NAME, \
+_VALUE_NAME, \
+_X_KEY_NAME, \
+_X_VALUE_NAME, \
+_INSERT_METHOD_DEFINITION \
+) class \
+ASSOC_CONT_CLASS_NAME\
+{\
+protected:\
+\
+public:\
+       typedef ARG_VALUE_TYPE        value_type;\
+       typedef ARG_KEY_TYPE          key_type;\
+       typedef ARG_ACTUAL_VALUE_TYPE actual_value_type;\
+\
+       typedef value_type*                       pointer;\
+       typedef value_type&                       reference;\
+\
+       typedef const value_type&         const_reference;\
+\
+       typedef FUNCTOR                           key_compare;\
+       typedef key_compare           Compare;\
+\
+protected:\
+\
+       struct tree_node \
+       {\
+               tree_node*  mpParent;\
+               tree_node*  mpLeft;\
+               tree_node*  mpRight;\
+\
+               value_type  mData;\
+       };\
+\
+       typedef tree_node* node_ref_type;\
+\
+       node_ref_type   mpRoot;\
+       node_ref_type   mpLeftMost;\
+       node_ref_type   mpRightMost;\
+\
+       node_ref_type   mpFreeListHead;\
+       int             mKeyIsUnique;\
+\
+       key_compare     mCmpFunctorObj;\
+\
+public:\
+\
+       static inline node_ref_type next( node_ref_type pNode )\
+       {\
+               if ( pNode->mpRight ) \
+               {\
+                       pNode = pNode->mpRight;\
+\
+                       while ( pNode->mpLeft ) pNode = pNode->mpLeft;\
+\
+                       return pNode;\
+               }\
+               else\
+               if ( pNode->mpParent )\
+               {\
+                       if ( pNode == pNode->mpParent->mpLeft )\
+\
+                               return pNode->mpParent;\
+\
+                       pNode = pNode->mpParent;\
+\
+                       node_ref_type prevNode = pNode;\
+                       pNode = pNode->mpParent;\
+\
+                       while(pNode)\
+                       {\
+                               if ( pNode->mpRight &&\
+                                        pNode->mpRight != prevNode\
+                                  ) return pNode;\
+\
+                               prevNode = pNode;\
+                               pNode= pNode->mpParent;\
+                       }\
+\
+                       return 0;\
+               }\
+               else\
+                       return 0;\
+       }\
+\
+       static inline node_ref_type prev( node_ref_type pNode )\
+       {\
+               if ( pNode->mpLeft ) \
+               {\
+                       pNode = pNode->mpLeft;\
+\
+                       while ( pNode->mpRight ) pNode = pNode->mpRight;\
+\
+                       return pNode;\
+               }\
+               else\
+               if ( pNode->mpParent )\
+               {\
+                       if ( pNode == pNode->mpParent->mpRight )\
+                               return pNode->mpParent;\
+\
+                       pNode = pNode->mpParent;\
+\
+                       node_ref_type prevNode = pNode;\
+                       pNode = pNode->mpParent;\
+\
+                       while(pNode)\
+                       {\
+                               if ( pNode->mpLeft &&\
+                                        pNode->mpLeft != prevNode\
+                                  ) return pNode;\
+\
+                               prevNode = pNode;\
+                               pNode= pNode->mpParent;\
+                       }\
+\
+                       return 0;\
+               }\
+               else \
+                       return 0;\
+       }\
+\
+protected:\
+\
+       inline int are_equel( const key_type& x, const key_type& y ) const\
+       {\
+               mCmpFunctorObj(x,y);\
+               return ( !mCmpFunctorObj(x,y) && !mCmpFunctorObj(y,x) );\
+       }\
+\
+       inline int is_less( const key_type& x, const key_type& y ) const\
+       {\
+               return mCmpFunctorObj(x,y);\
+       }\
+\
+       static inline const actual_value_type& value( node_ref_type pNode )\
+       {\
+               return pNode->_VALUE_NAME;\
+       }\
+\
+       static inline const key_type& key( node_ref_type pNode )\
+       {\
+               return pNode->_KEY_NAME;\
+       }\
+\
+       inline node_ref_type AllocNode() \
+       { \
+               if ( mpFreeListHead ) \
+               {\
+                       node_ref_type pFreeNode = mpFreeListHead;\
+                       mpFreeListHead = mpFreeListHead->mpLeft;\
+\
+                       return pFreeNode;\
+               }\
+               else\
+               {\
+                       char* pHeapBlock = new char[sizeof(tree_node)];\
+\
+                       return (node_ref_type)pHeapBlock;\
+               }\
+       }\
+\
+       inline void DestroyFreeList()\
+       {\
+               while ( mpFreeListHead )\
+               {\
+                       node_ref_type tmp = mpFreeListHead;\
+                       mpFreeListHead = mpFreeListHead->mpLeft;\
+\
+                       delete [](char*)tmp;\
+               }\
+       }\
+\
+       inline void RecycleNode( node_ref_type pNode ) \
+       {\
+               pNode->mpLeft = mpFreeListHead;\
+               mpFreeListHead = pNode;\
+       }\
+\
+       inline node_ref_type do_insert(const value_type& x = value_type() )\
+       {\
+               node_ref_type pNewNode = AllocNode();\
+\
+               pNewNode->mpParent = \
+                       pNewNode->mpLeft =\
+                               pNewNode->mpRight = 0;\
+\
+           node_ref_type pCurrent = mpRoot;\
+               node_ref_type pParent = 0;\
+    \
+               while (pCurrent) \
+               {\
+                       if ( mKeyIsUnique && are_equel( _X_KEY_NAME, key(pCurrent) ) )\
+                       {\
+                               RecycleNode(pNewNode);\
+                               return 0;\
+                       }\
+\
+                       pParent = pCurrent;\
+\
+                       pCurrent = is_less( _X_KEY_NAME, key(pCurrent) ) \
+                               ? pCurrent->mpLeft \
+                               : pCurrent->mpRight;\
+               }\
+    \
+               pNewNode->mpParent = pParent;\
+\
+           if(pParent)\
+\
+                       if( is_less(_X_KEY_NAME, key(pParent) ) )\
+            \
+                               pParent->mpLeft = pNewNode;\
+                       else\
+                               pParent->mpRight = pNewNode;\
+                       else\
+                               mpRoot = pNewNode;\
+\
+               new ( &pNewNode->_KEY_NAME   ) key_type(_X_KEY_NAME);\
+               new ( &pNewNode->_VALUE_NAME ) actual_value_type(_X_VALUE_NAME);\
+\
+               if ( prev(pNewNode) == 0 ) mpLeftMost = pNewNode;\
+               if ( next(pNewNode) == 0 ) mpRightMost = pNewNode;\
+\
+               return pNewNode;\
+       }\
+\
+       friend class iterator;\
+\
+public:\
+\
+       class iterator;\
+       class const_iterator;\
+\
+       class iterator \
+       {\
+       public:\
+               node_ref_type mpNode;\
+               friend class CONT_CLASS_NAME;\
+               friend class const_iterator;\
+               friend class const_reverse_iterator;\
+\
+               inline iterator( node_ref_type pNode )\
+               {\
+                       mpNode = pNode;\
+               }\
+       \
+       public:\
+               inline iterator() {}\
+               inline int operator==( const iterator& rhs ) const { return (mpNode == rhs.mpNode); }\
+               inline int operator!=( const iterator& rhs ) const { return (mpNode != rhs.mpNode); }\
+\
+               inline iterator( const iterator& other )\
+               {\
+                       mpNode = other.mpNode;\
+               }\
+\
+               inline const iterator& operator=( const iterator& other )\
+               {\
+                       mpNode = other.mpNode;\
+                       return *this;\
+               }\
+\
+               inline const iterator& operator--() \
+               {\
+                       mpNode = ASSOC_CONT_CLASS_NAME::prev(mpNode);\
+                       return *this;\
+               }\
+\
+               inline iterator operator--(int)\
+               {\
+                       iterator tmp = *this;\
+                       mpNode = ASSOC_CONT_CLASS_NAME::prev(mpNode);\
+                       return tmp;\
+               }\
+\
+               inline const iterator& operator++() \
+               {\
+                       mpNode = ASSOC_CONT_CLASS_NAME::next(mpNode);\
+                       return *this;\
+               }\
+\
+               inline iterator operator++(int)\
+               {\
+                       iterator tmp = *this;\
+                       mpNode = ASSOC_CONT_CLASS_NAME::next(mpNode);\
+                       return tmp;\
+               }\
+\
+               inline reference operator*() const { return mpNode->mData; }\
+       };\
+\
+\
+       class const_iterator \
+       {\
+       public:\
+               node_ref_type mpNode;\
+               friend class CONT_CLASS_NAME;\
+               friend class const_reverse_iterator;\
+\
+               inline const_iterator( node_ref_type pNode )\
+               {\
+                       mpNode = pNode;\
+               }\
+       \
+       public:\
+               inline const_iterator() {}\
+\
+               inline int operator==( const const_iterator& rhs ) const { return (mpNode == rhs.mpNode); }\
+               inline int operator!=( const const_iterator& rhs ) const { return (mpNode != rhs.mpNode); }\
+\
+               inline const_iterator( const iterator& other )\
+               {\
+                       mpNode = other.mpNode;\
+               }\
+\
+               inline const_iterator( const const_iterator& other )\
+               {\
+                       mpNode = other.mpNode;\
+               }\
+\
+               inline const const_iterator& operator=( const const_iterator& other )\
+               {\
+                       mpNode = other.mpNode;\
+                       return *this;\
+               }\
+\
+               inline const const_iterator& operator--() \
+               {\
+                       mpNode = ASSOC_CONT_CLASS_NAME::prev(mpNode);\
+                       return *this;\
+               }\
+\
+               inline const_iterator operator--(int)\
+               {\
+                       const_iterator tmp = *this;\
+                       mpNode = ASSOC_CONT_CLASS_NAME::prev(mpNode);\
+                       return tmp;\
+               }\
+\
+               inline const const_iterator& operator++() \
+               {\
+                       mpNode = ASSOC_CONT_CLASS_NAME::next(mpNode);\
+                       return *this;\
+               }\
+\
+               inline const_iterator operator++(int)\
+               {\
+                       const_iterator tmp = *this;\
+                       mpNode = ASSOC_CONT_CLASS_NAME::next(mpNode);\
+                       return tmp;\
+               }\
+\
+               inline const_reference operator*() const { return mpNode->mData; }\
+       };\
+\
+public:\
+\
+       inline ASSOC_CONT_CLASS_NAME( key_compare cmpFunctorObj = key_compare(),\
+                                                                 int keyIsUnique = ARG_IS_UNIQUE )\
+                       : mpFreeListHead( 0 ),\
+                         mKeyIsUnique( keyIsUnique ),\
+                         mCmpFunctorObj( cmpFunctorObj )\
+       {\
+               mpLeftMost = 0;\
+               mpRightMost = 0;\
+               mpRoot = 0;\
+       }\
+\
+       inline ~ASSOC_CONT_CLASS_NAME() \
+       { \
+               erase( begin(), end() ); \
+\
+               DestroyFreeList();\
+       }\
+\
+       inline iterator begin() { return mpLeftMost; }\
+       inline iterator end()   { return 0; }\
+\
+       inline const_iterator begin() const { return mpLeftMost; }\
+       inline const_iterator end()   const { return 0; }\
+\
+       inline iterator lower_bound( const key_type& x )\
+       { \
+               node_ref_type pCurrent = mpRoot;\
+    \
+               while( pCurrent )\
+               {\
+                       node_ref_type pParent = pCurrent;\
+\
+                       if( are_equel( x, key(pCurrent) ) )\
+                               \
+                               return (pCurrent);\
+                       else\
+                               pCurrent = is_less( x, key(pCurrent) ) \
+                                       ? pCurrent->mpLeft \
+                                       : pCurrent->mpRight;\
+\
+                       if ( !pCurrent ) return (pParent);\
+               }\
+\
+               return begin();\
+       }\
+\
+       inline const_iterator lower_bound( const key_type& x ) const\
+\
+               { return const_iterator( lower_bound(x).mpNode ); }\
+\
+       inline iterator upper_bound( const key_type& x )\
+       {\
+               node_ref_type pCurrent = mpRoot;\
+    \
+               while( pCurrent )\
+               {\
+                       node_ref_type pParent = pCurrent;\
+\
+                       if( are_equel( x, key(pCurrent) ) )\
+                               \
+                               return (pCurrent);\
+                       else\
+                               pCurrent = is_less( x, key(pCurrent) ) \
+                                       ? pCurrent->mpLeft \
+                                       : pCurrent->mpRight;\
+\
+                       if ( !pCurrent ) return next(pParent);\
+               }\
+\
+               return end();\
+       }\
+\
+       inline iterator find( const key_type& x ) const\
+       {\
+               node_ref_type pCurrent = mpRoot;\
+    \
+               while( pCurrent )\
+               {\
+                       if( are_equel( x, key(pCurrent) ) )\
+                               \
+                               return (pCurrent);\
+                       else\
+                               pCurrent = is_less( x, key(pCurrent) ) \
+                                       ? pCurrent->mpLeft \
+                                       : pCurrent->mpRight;\
+               }\
+\
+               return iterator(0);\
+       }\
+\
+       inline actual_value_type& operator[]( const key_type x ) const\
+\
+               { return find(x).mpNode->_VALUE_NAME; }\
+\
+       inline void erase(iterator first, iterator last)\
+       {\
+               if ( first.mpNode == 0 ) return;\
+\
+               while( first != last ) \
+               {\
+                       iterator next = first;\
+                       ++next;\
+                       erase( first );\
+                       first = next;\
+               }\
+       }\
+\
+       inline void erase(iterator position)\
+       {\
+               if ( position.mpNode == 0 ) return;\
+\
+               node_ref_type pZ = position.mpNode;\
+               node_ref_type pX, pY;\
+\
+               if ( pZ == mpLeftMost ) mpLeftMost   = next(pZ);\
+               if ( pZ == mpRightMost ) mpRightMost = prev( pZ );\
+\
+        if ( !pZ->mpLeft || !pZ->mpRight )\
+           \
+            pY = pZ;\
+        else \
+               {\
+            pY = pZ->mpRight;\
+           \
+            while (pY->mpLeft) \
+                               \
+                               pY = pY->mpLeft;\
+        }\
+           \
+        if ( pY->mpLeft)\
+           \
+            pX = pY->mpLeft;\
+        else\
+            pX = pY->mpRight;\
+           \
+        if ( pX ) pX->mpParent = pY->mpParent;\
+           \
+        if (pY->mpParent)\
+           \
+            if (pY == pY->mpParent->mpLeft )\
+           \
+                pY->mpParent->mpLeft = pX;\
+                   else\
+                pY->mpParent->mpRight = pX;\
+        else\
+            mpRoot = pX;\
+           \
+               node_ref_type toRemove = 0;\
+               \
+        if (pY != pZ) {\
+           \
+            pY->mpLeft = pZ->mpLeft;\
+           \
+            if (pY->mpLeft) pY->mpLeft->mpParent = pY;\
+           \
+            pY->mpRight = pZ->mpRight;\
+           \
+            if ( pY->mpRight ) \
+                               \
+                               pY->mpRight->mpParent = pY;\
+           \
+            pY->mpParent = pZ->mpParent;\
+           \
+            if (pZ->mpParent)\
+           \
+                if (pZ == pZ->mpParent->mpLeft)\
+           \
+                    pZ->mpParent->mpLeft = pY;\
+                else\
+                    pZ->mpParent->mpRight = pY;\
+            else\
+                mpRoot = pY;\
+           \
+            toRemove = pZ;\
+        } \
+               else \
+            toRemove = pY;\
+           \
+\
+               RecycleNode( toRemove );\
+       }\
+\
+       _INSERT_METHOD_DEFINITION\
+}
+
+// do not undefine ___WXSTL_COMMA, where associated containers are defined!
+// (it is used as workaround for constraints of C-Preprocessor's nested macros)
+
+#define ___WXSTL_COMMA ,
+
+#define __DEFINE_MAP(ARG_IS_UNIQUE, KEY_TYPE, VAL_TYPE, FUNCTOR ) __DEFINE_ASOC_CLASS( ARG_IS_UNIQUE,\
+FUNCTOR,\
+__WXSTLMAP_##KEY_TYPE##VAL_TYPE##ARG_IS_UNIQUE, \
+struct key_value_pair   { KEY_TYPE first ; \
+                                                 VAL_TYPE second;\
+                                                 key_value_pair() {}\
+                                                 key_value_pair( const KEY_TYPE& key ___WXSTL_COMMA const VAL_TYPE& value ) \
+                                                       : first(key) ___WXSTL_COMMA second( value ) {} \
+                                               } , \
+KEY_TYPE,\
+VAL_TYPE,\
+mData.first, mData.second, x.first, x.second, \
+struct insert_result_iterator\
+{\
+       iterator first;\
+       int      second;\
+};\
+inline insert_result_iterator insert( const value_type& x )\
+{\
+       insert_result_iterator result;\
+\
+       result.first = do_insert(x);\
+       result.second  = ( result.first == end() ) ? 0 : 1;\
+\
+       return result;\
+} )
+
+#define __DEFINE_SET(ARG_IS_UNIQUE, KEY_TYPE, FUNCTOR ) __DEFINE_ASOC_CLASS( ARG_IS_UNIQUE,\
+FUNCTOR,\
+__WXSTLSET_##TYPE##ARG_IS_UNIQUE, \
+KEY_TYPE,\
+KEY_TYPE,\
+KEY_TYPE,\
+mData, mData, x, x, \
+struct insert_result_iterator\
+{\
+       iterator first;\
+       int      second;\
+};\
+inline insert_result_iterator insert( const value_type& x )\
+{\
+       insert_result_iterator result;\
+\
+       result.first = do_insert(x);\
+       result.second  = ( result.first == end() ) ? 0 : 1;\
+\
+       return result;\
+} )
+
+// helper macros to create functor objects for associative containers of the given type
+
+#define LESS_THEN_FUNCTOR(TYPE) struct \
+{ inline int operator()(const TYPE& x, const TYPE& y ) const { return x < y; } }
+
+#define GREATER_THEN_FUNCTOR(TYPE) struct \
+{ inline int operator()(const TYPE& x, const TYPE& y ) const { return x > y; } }
+
+// functor argument should be created using the two above macros 
+// or passing own class with method "operator()(const TYPE&,cosnt TYPE&)" defined in it
+
+#define WXSTL_MAP( KEY_TYPE, VALUE_TYPE, FUNCTOR )      __DEFINE_MAP( 1 ,KEY_TYPE, VALUE_TYPE, FUNCTOR)
+#define WXSTL_MULTIMAP( KEY_TYPE, VALUE_TYPE, FUNCTOR ) __DEFINE_MAP( 0 ,KEY_TYPE, VALUE_TYPE, FUNCTOR)
+#define WXSTL_SET( KEY_TYPE, FUNCTOR )                  __DEFINE_SET( 1 ,KEY_TYPE, FUNCTOR )
+#define WXSTL_MULTISET( KEY_TYPE, FUNCTOR )             __DEFINE_SET( 0 ,KEY_TYPE, FUNCTOR )
+
+#endif
diff --git a/utils/wxPython/modules/lseditor/wxstldefs.h b/utils/wxPython/modules/lseditor/wxstldefs.h
new file mode 100644 (file)
index 0000000..51e680f
--- /dev/null
@@ -0,0 +1,49 @@
+#ifndef __WXSTLDEFS_G__
+#define __WXSTLDEFS_G__
+
+
+#include "config.h"
+
+// defines some very commonly used container types
+// for both template and macro-based configurations
+
+#if defined( wxUSE_TEMPLATE_STL )
+
+       #include <vector>
+        using namespace std;
+    #ifdef WIN32xxx
+       #include <bstring.h>
+       #else
+
+       //#include <strclass.h>
+       //#include <string.h>
+    // For now
+    #include "wx/string.h"
+    #define string wxString
+
+       #endif
+
+#else
+
+       #include "wx/string.h"
+       #include "wxstlvec.h"
+
+       // FOR NOW:: quick n' dirty:
+
+       #define  string wxString
+
+#endif
+
+#if defined( wxUSE_TEMPLATE_STL )
+
+       typedef vector<string>     StrListT;
+       typedef vector<int>        IntListT;
+
+#else
+
+       typedef WXSTL_VECTOR(string)           StrListT;
+       typedef WXSTL_VECTOR_SHALLOW_COPY(int) IntListT;
+
+#endif
+
+#endif
diff --git a/utils/wxPython/modules/lseditor/wxstllst.h b/utils/wxPython/modules/lseditor/wxstllst.h
new file mode 100644 (file)
index 0000000..9bcf331
--- /dev/null
@@ -0,0 +1,555 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        No names yet.
+// Purpose:     Contrib. demo
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     27/09/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleskandars Gluchovas
+// Licence:    wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __WXSTLLST_G__
+#define __WXSTLLST_G__
+
+#include <stddef.h>
+#include <sys/types.h>
+#include <memory.h>
+#include <limits.h>
+#include <new>
+
+// VERSION:: 0.2 (copy-constructor/adign-op added)
+
+// FOR NOW:: class-member operators "new" and "delete"
+//           are ignored by list class, memory allocated 
+//           and freed using global operators
+
+typedef int Type;
+
+
+// the below macro used internally (see actual interface after this macro)
+
+#define __DEFINE_STL_LIST(listClass,Type) class \
+ listClass \
+{\
+public:\
+\
+       typedef Type                      value_type;\
+       typedef value_type*           pointer;\
+       typedef const value_type* const_pointer;\
+       typedef value_type&       reference;\
+       typedef const value_type& const_reference;\
+       typedef size_t                    size_type;\
+       typedef ptrdiff_t                 difference_type;\
+\
+protected:\
+       struct list_node\
+       {\
+               list_node* mpNext;\
+               list_node* mpPrev;\
+               value_type mData;\
+       };\
+\
+       typedef list_node* node_ref_type;\
+\
+       node_ref_type mpFreeListHead;\
+       node_ref_type mpTerminator;\
+       size_type     mSize;\
+\
+       inline node_ref_type AllocNode() \
+       { \
+               if ( mpFreeListHead ) \
+               {\
+                       node_ref_type pFreeNode = mpFreeListHead;\
+                       mpFreeListHead = mpFreeListHead->mpPrev;\
+\
+                       return pFreeNode;\
+               }\
+               else\
+               {\
+                       char* pHeapBlock = new char[sizeof(list_node)];\
+\
+                       return (node_ref_type)pHeapBlock;\
+               }\
+       }\
+\
+       inline void DestroyFreeList()\
+       {\
+               while ( mpFreeListHead )\
+               {\
+                       node_ref_type tmp = mpFreeListHead;\
+                       mpFreeListHead = mpFreeListHead->mpPrev;\
+\
+                       delete [](char*)tmp;\
+               }\
+       }\
+\
+       inline void RecycleNode( node_ref_type pNode ) \
+       {\
+               pNode->mpPrev = mpFreeListHead;\
+               mpFreeListHead = pNode;\
+       }\
+\
+public:\
+\
+       class iterator \
+       {\
+       public:\
+               node_ref_type mpNode;\
+               friend class listClass;\
+               friend class const_iterator;\
+               friend class const_reverse_iterator;\
+\
+       protected:\
+               iterator( node_ref_type pNode )\
+               {\
+                       mpNode = pNode;\
+               }\
+       \
+       public:\
+               iterator() {}\
+               int operator==( const iterator& rhs ) const { return (mpNode == rhs.mpNode); }\
+               int operator!=( const iterator& rhs ) const { return (mpNode != rhs.mpNode); }\
+\
+               inline iterator( const iterator& other )\
+               {\
+                       mpNode = other.mpNode;\
+               }\
+\
+               inline const iterator& operator--() \
+               {\
+                       mpNode = mpNode->mpPrev;\
+                       return *this;\
+               }\
+\
+               inline iterator operator--(int)\
+               {\
+                       iterator tmp = *this;\
+                       mpNode = mpNode->mpPrev;\
+                       return tmp;\
+               }\
+\
+               inline const iterator& operator++() \
+               {\
+                       mpNode = mpNode->mpNext;\
+                       return *this;\
+               }\
+\
+               inline iterator operator++(int)\
+               {\
+                       iterator tmp = *this;\
+                       mpNode = mpNode->mpNext;\
+                       return tmp;\
+               }\
+\
+               inline reference operator*()       const { return mpNode->mData; }\
+       };\
+\
+\
+       class const_iterator \
+       {\
+       protected:\
+               node_ref_type mpNode;\
+               friend class listClass;\
+\
+       protected:\
+               const_iterator( node_ref_type pNode )\
+               {\
+                       mpNode = pNode;\
+               }\
+       \
+       public:\
+               \
+               const_iterator() {}\
+               int operator==( const const_iterator& rhs ) const { return (mpNode == rhs.mpNode); }\
+               int operator!=( const const_iterator& rhs ) const { return (mpNode != rhs.mpNode); }\
+\
+\
+               inline const_iterator( const iterator& other )\
+               {\
+                       mpNode = other.mpNode;\
+               }\
+\
+               inline const const_iterator& operator--() \
+               {\
+                       mpNode = mpNode->mpPrev;\
+                       return *this;\
+               }\
+\
+               inline const_iterator operator--(int)\
+               {\
+                       const_iterator tmp = *this;\
+                       mpNode = mpNode->mpPrev;\
+                       return tmp;\
+               }\
+\
+               inline const const_iterator& operator++() \
+               {\
+                       mpNode = mpNode->mpNext;\
+                       return *this;\
+               }\
+\
+               inline const_iterator operator++(int)\
+               {\
+                       const_iterator tmp = *this;\
+                       mpNode = mpNode->mpNext;\
+                       return tmp;\
+               }\
+\
+               inline const_reference operator*() const { return mpNode->mData; }\
+       };\
+\
+       typedef iterator       OutputIterator;\
+       typedef const_iterator InputIterator;\
+\
+       class reverse_iterator \
+       {\
+       public:\
+               node_ref_type mpNode;\
+               friend class listClass;\
+               friend class const_reverse_iterator;\
+\
+       protected:\
+               reverse_iterator ( node_ref_type pNode )\
+               {\
+                       mpNode = pNode;\
+               }\
+       \
+       public:\
+\
+               reverse_iterator() {}\
+               int operator==( const reverse_iterator& rhs ) const { return (mpNode == rhs.mpNode); }\
+               int operator!=( const reverse_iterator& rhs ) const { return (mpNode != rhs.mpNode); }\
+\
+               inline reverse_iterator( const reverse_iterator& other )\
+               {\
+                       mpNode = other.mpNode;\
+               }\
+\
+               inline const reverse_iterator& operator--() \
+               {\
+                       mpNode = mpNode->mpNext;\
+                       return *this;\
+               }\
+\
+               inline reverse_iterator operator--(int)\
+               {\
+                       reverse_iterator tmp = *this;\
+                       mpNode = mpNode->mpPrev;\
+                       return tmp;\
+               }\
+\
+               inline const reverse_iterator & operator++() \
+               {\
+                       mpNode = mpNode->mpNext;\
+                       return *this;\
+               }\
+\
+               inline reverse_iterator  operator++(int)\
+               {\
+                       reverse_iterator tmp = *this;\
+                       mpNode = mpNode->mpPrev;\
+                       return tmp;\
+               }\
+\
+               inline const_reference operator*() const { return mpNode->mData; }\
+       };\
+\
+\
+       class const_reverse_iterator \
+       {\
+       protected:\
+               node_ref_type mpNode;\
+               friend class listClass;\
+\
+       protected:\
+               const_reverse_iterator( node_ref_type pNode )\
+               {\
+                       mpNode = pNode;\
+               }\
+       \
+       public:\
+\
+               const_reverse_iterator() {}\
+               int operator==( const const_reverse_iterator& rhs ) const { return (mpNode == rhs.mpNode); }\
+               int operator!=( const const_reverse_iterator& rhs ) const { return (mpNode != rhs.mpNode); }\
+\
+               inline const_reverse_iterator( const reverse_iterator& other )\
+               {\
+                       mpNode = other.mpNode;\
+               }\
+\
+               inline const const_reverse_iterator& operator--() \
+               {\
+                       mpNode = mpNode->mpNext;\
+                       return *this;\
+               }\
+\
+               inline const_reverse_iterator operator--(int)\
+               {\
+                       const_reverse_iterator tmp = *this;\
+                       mpNode = mpNode->mpNext;\
+                       return tmp;\
+               }\
+\
+               inline const const_reverse_iterator& operator++() \
+               {\
+                       mpNode = mpNode->mpPrev;\
+                       return *this;\
+               }\
+\
+               inline const_reverse_iterator operator++(int)\
+               {\
+                       const_reverse_iterator tmp = *this;\
+                       mpNode = mpNode->mpPrev;\
+                       return tmp;\
+               }\
+\
+               inline const_reference operator*() const { return mpNode->mData; }\
+       };\
+\
+public:\
+\
+    inline listClass()\
+                       : mpFreeListHead( 0 ),\
+                         mSize(0)\
+       {\
+               mpTerminator = AllocNode();\
+               mpTerminator->mpPrev = mpTerminator->mpNext = mpTerminator;\
+       }\
+\
+       listClass( const listClass& other )\
+       {\
+               mpTerminator = AllocNode();\
+               mpTerminator->mpPrev = mpTerminator->mpNext = mpTerminator;\
+\
+               for( listClass::const_iterator i = other.begin(); i != other.end(); ++i )\
+\
+                       push_back( (*i) );\
+       }\
+\
+       inline const listClass& operator=( const listClass& rhs ) \
+       {\
+               erase( begin(), end() );\
+\
+               for( listClass::const_iterator i = rhs.begin(); i != rhs.end(); ++i )\
+\
+                       push_back( (*i) );\
+\
+               return *this;\
+       }\
+\
+       inline listClass(const_iterator first, const_iterator last)\
+                       : mpFreeListHead( 0 ),\
+                         mSize(0)\
+       \
+               { while( first != last ) push_back( *first++ ); }\
+\
+       inline listClass( size_type n, const value_type& value = value_type() )\
+       \
+               { for( size_t i = 0; i != n; ++n ) push_back( value ); }\
+\
+       inline ~listClass() \
+       { \
+               erase( begin(), end() ); \
+\
+               RecycleNode( mpTerminator );\
+               DestroyFreeList();\
+       }\
+\
+       inline iterator begin() { return iterator(mpTerminator->mpNext); }\
+       \
+       inline const_iterator begin() const \
+               { return const_iterator(mpTerminator->mpNext); }\
+       \
+       inline iterator end() { return iterator(mpTerminator); }\
+\
+       inline const_iterator end() const { return const_iterator(mpTerminator); }\
+\
+       inline reverse_iterator rbegin() \
+               { return reverse_iterator(mpTerminator->mpPrev); }\
+\
+       inline reverse_iterator rend() \
+               { return reverse_iterator(mpTerminator); }\
+\
+       inline const_reverse_iterator rbegin() const\
+               { return const_reverse_iterator(mpTerminator->mpPrev); }\
+\
+       inline const_reverse_iterator  rend() const\
+               { return const_reverse_iterator(mpTerminator); }\
+\
+       inline int empty() const { return (mSize == 0); }\
+\
+       inline size_type size() const { return mSize; }\
+\
+       inline size_type max_size() const { return UINT_MAX/sizeof(list_node); }\
+\
+       inline reference front() { return mpTerminator->mData; }\
+\
+       inline const_reference front() const { return mpTerminator->mData; }\
+\
+       inline reference back() { return mpTerminator->mpPrev->mData; }\
+\
+       inline const_reference back() const { return mpTerminator->mpPrev->mData; }\
+\
+       inline void push_front(const value_type& x) { insert( begin(), x ); }\
+\
+       inline void push_back(const value_type& x) { insert( end(), x ); }\
+\
+       iterator insert(iterator position, const value_type& x = value_type())\
+       {\
+               node_ref_type pNew = AllocNode();\
+\
+               node_ref_type pos = *((node_ref_type*)&position);\
+\
+               pNew->mpNext = pos;\
+               pNew->mpPrev = pos->mpPrev;\
+               pos->mpPrev->mpNext = pNew;\
+               pos->mpPrev  = pNew;\
+\
+               new (&pNew->mData) value_type(x);\
+\
+               ++mSize;\
+\
+               return iterator(pNew);\
+       }\
+\
+       inline void insert(iterator position, const_iterator first, const_iterator last )\
+       {\
+               while( first != last ) insert( position, *first++ );\
+       }\
+\
+       inline void splice( iterator position, listClass& other )\
+       {\
+               if ( other.begin() == other.end() ) return;\
+\
+               node_ref_type pTill = other.mpTerminator->mpPrev;\
+               node_ref_type pFrom = other.begin().mpNode;\
+\
+               mpTerminator->mpPrev->mpNext = pFrom;\
+               pFrom->mpPrev = mpTerminator->mpPrev->mpNext;\
+\
+               pTill->mpNext = mpTerminator;\
+               mpTerminator->mpPrev = pTill;\
+\
+               other.mpTerminator->mpNext = \
+                       other.mpTerminator->mpPrev = other.mpTerminator;\
+\
+               mSize += other.mSize;\
+               other.mSize = 0;\
+       }\
+\
+       inline void splice( iterator position, listClass& other, iterator first, iterator last )\
+       {\
+               if ( first == last ) return;\
+\
+               size_type sz = 0;\
+               iterator tmp = first;\
+               while( tmp != last ) \
+               {\
+                       ++tmp;\
+                       ++sz;\
+               }\
+\
+               mSize += sz;\
+               other.mSize -= sz;\
+\
+               node_ref_type pPos   = position.mpNode;\
+               node_ref_type pFirst = first.mpNode;\
+               node_ref_type pLast  = last.mpNode;\
+               node_ref_type pTill  = last.mpNode->mpPrev;\
+\
+               pPos->mpPrev->mpNext = pFirst;\
+               pPos->mpPrev = pTill;\
+\
+               pFirst->mpPrev->mpNext = last.mpNode;\
+               pLast->mpPrev = pTill;\
+\
+               pFirst->mpPrev = pPos->mpPrev;\
+               pTill->mpNext = pPos;\
+       }\
+\
+       inline void pop_front() { erase( begin() ); }\
+       inline void pop_back()  { erase( --end() );   }\
+       \
+       inline void erase(iterator position)\
+       {\
+               erase( position, ++position );\
+       }\
+       \
+       inline void erase(iterator first, iterator last)\
+       {\
+               node_ref_type firstNode = *((node_ref_type*)&first);\
+               node_ref_type lastNode = *((node_ref_type*)&last);\
+\
+               firstNode->mpPrev->mpNext = lastNode;\
+               lastNode->mpPrev = firstNode->mpPrev;\
+\
+               while( firstNode != lastNode )\
+               {\
+                       node_ref_type next = firstNode->mpNext;\
+\
+                       typedef value_type value_type_local;\
+                       firstNode->mData.value_type_local::~value_type_local();\
+\
+                       RecycleNode( firstNode );\
+\
+                       firstNode = next;\
+\
+                       --mSize;\
+               }\
+       }\
+\
+       inline void remove(const value_type& value)\
+       {\
+               for( iterator i = begin(); i != end(); ++i )\
+               \
+                       if ( (*i) == value ) \
+                       {\
+                               erase( i ); break;\
+                       }\
+       }\
+\
+       void sort()\
+       {\
+               if ( mSize < 2 ) return;\
+\
+               iterator from = begin();\
+               iterator other_end = end();\
+               --other_end;\
+\
+               for( size_type i = 0; i != mSize; ++i )\
+               {\
+                       size_type nSwaps = 0;\
+\
+                       iterator next = begin();\
+                       ++next;\
+\
+                       for( iterator j = begin(); j != other_end;  ++j )\
+                       {\
+\
+                               if ( (*next) < (*j) )\
+                               {\
+                                       value_type tmp = (*j);\
+                                       (*j) = (*next);\
+                                       (*next) = tmp;\
+\
+                                       ++nSwaps;\
+                               }\
+\
+                               ++next;\
+                       }\
+\
+                       if ( !nSwaps) break;\
+\
+                       --other_end;\
+               }\
+       }\
+}
+
+// defines list class with the given element type
+#define WXSTL_LIST(ELEMENT_CLASS)  __DEFINE_STL_LIST(\
+\
+_WXSTL_LIST_##ELEMENT_CLASS, ELEMENT_CLASS )
+
+#endif
\ No newline at end of file
diff --git a/utils/wxPython/modules/lseditor/wxstlvec.h b/utils/wxPython/modules/lseditor/wxstlvec.h
new file mode 100644 (file)
index 0000000..bc6fe50
--- /dev/null
@@ -0,0 +1,857 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        No names yet.
+// Purpose:     Contrib. demo
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     27/09/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleskandars Gluchovas
+// Licence:    wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __WXSTLVEC_G__
+#define __WXSTLVEC_G__
+
+#include <memory.h>
+#include <string.h>  // imports memmove()
+#include <stddef.h>
+#include <sys/types.h>
+#include <limits.h>
+#include <new>
+
+// the below macro used internally (see actual interface after this macro)
+
+#define __DEFINE_STL_VECTOR_DEEP( vectorClass, Type ) class vectorClass {\
+\
+public:\
+       typedef Type              value_type;\
+       typedef value_type*           iterator;\
+       typedef const value_type* const_iterator;\
+       typedef iterator                  pointer;\
+       typedef const iterator    const_pointer;\
+       typedef value_type&       reference;\
+       typedef const value_type& const_reference;\
+       typedef size_t            size_type;\
+       typedef ptrdiff_t         difference_type;\
+\
+       typedef iterator       OutputIterator;\
+       typedef const_iterator InputIterator;\
+\
+protected:\
+\
+       inline void PlacementCopy( const_iterator first, const_iterator last, iterator result )\
+       {\
+               while ( first != last ) \
+                       new (result++) value_type(*first++);\
+       }\
+\
+       inline void ConstructObjects( iterator first, iterator last, const value_type& pattern )\
+       {\
+               while( first != last ) \
+                       new (first++) value_type(pattern);\
+       }\
+\
+       inline void CopyObjects( iterator first, iterator last, iterator result )\
+       {\
+               while( first != last ) \
+                       *result++ = *first++;\
+       }\
+\
+       inline void CopyObjectsBack( iterator first, iterator last, iterator result )\
+       {\
+               result += difference_type(last,first);\
+\
+               while( first != last ) \
+                       *(--result) = *(--last);\
+       }\
+\
+public:\
+\
+       class reverse_iterator \
+       {\
+               friend class vectorClass;\
+               friend class const_reverse_iterator;\
+\
+       public:\
+               iterator mpPos;\
+\
+       public:\
+\
+               reverse_iterator() {}\
+\
+               reverse_iterator ( iterator pPos )\
+               {\
+                       mpPos = pPos;\
+               }\
+       \
+               int operator==( const reverse_iterator& rhs ) const { return (mpPos == rhs.mpPos); }\
+               int operator!=( const reverse_iterator& rhs ) const { return (mpPos != rhs.mpPos); }\
+\
+               inline reverse_iterator( const reverse_iterator& other )\
+               {\
+                       mpPos = other.mpPos;\
+               }\
+\
+               inline const reverse_iterator& operator--() \
+               {\
+                       --mpPos;\
+                       return *this;\
+               }\
+\
+               inline reverse_iterator operator--(int)\
+               {\
+                       reverse_iterator tmp = *this;\
+                       --mpPos;\
+                       return tmp;\
+               }\
+\
+               inline const reverse_iterator & operator++() \
+               {\
+                       ++mpPos;\
+                       return *this;\
+               }\
+\
+               inline reverse_iterator  operator++(int)\
+               {\
+                       reverse_iterator tmp = *this;\
+                       ++mpPos;\
+                       return tmp;\
+               }\
+\
+               inline const_reference operator*() const { return *mpPos; }\
+       };\
+\
+\
+       class const_reverse_iterator \
+       {\
+       protected:\
+               iterator mpPos;\
+       public:\
+\
+               const_reverse_iterator() {}\
+\
+               const_reverse_iterator( const iterator pPos )\
+               {\
+                       mpPos = pPos;\
+               }\
+       \
+               int operator==( const const_reverse_iterator& rhs ) const { return (mpPos == rhs.mpPos); }\
+               int operator!=( const const_reverse_iterator& rhs ) const { return (mpPos != rhs.mpPos); }\
+\
+               inline const_reverse_iterator( const reverse_iterator& other )\
+               {\
+                       mpPos = other.mpPos;\
+               }\
+\
+               inline const const_reverse_iterator& operator--() \
+               {\
+                       --mpPos;\
+                       return *this;\
+               }\
+\
+               inline const_reverse_iterator operator--(int)\
+               {\
+                       const_reverse_iterator tmp = *this;\
+                       --mpPos;\
+                       return tmp;\
+               }\
+\
+               inline const const_reverse_iterator & operator++() \
+               {\
+                       ++mpPos;\
+                       return *this;\
+               }\
+\
+               inline const_reverse_iterator operator++(int)\
+               {\
+                       const_reverse_iterator tmp = *this;\
+                       ++mpPos;\
+                       return tmp;\
+               }\
+\
+               inline const_reference operator*() const { return *mpPos; }\
+       };\
+\
+protected:\
+       \
+       pointer mpStart;\
+       pointer mpEnd;\
+       pointer mpEndOfBuf;\
+\
+protected:\
+\
+       inline void quick_sort(int low, int hi) \
+       {\
+               int pivot_index;\
+               int left, right;\
+\
+               pivot_index = ( !(mpStart[low] < mpStart[low+1])) ? low : (low+1);\
+               value_type pivot_value = mpStart[pivot_index];\
+\
+               left = low; right = hi;\
+               do \
+               {\
+                       while ((left <= hi) && (mpStart[left] < pivot_value)) left++;\
+\
+                   while ((right >= low) && (pivot_value < mpStart[right])) right--;\
+\
+                       if (left <= right) \
+                       {\
+                               value_type tmp = mpStart[left];\
+                               mpStart[left] = mpStart[right];\
+                               mpStart[right] = tmp;\
+\
+                               left++;\
+                               right--;\
+                       }\
+    \
+               } while (left <= right);\
+               if (low < right) quick_sort(low, right);\
+               if (left < hi) quick_sort(left, hi);\
+       }\
+\
+       inline void DestructRange( iterator first, iterator last )\
+       {\
+               typedef value_type value_type_local;\
+\
+               while ( first != last ) \
+               {\
+                       first->value_type_local::~value_type_local();\
+                       ++first;\
+               }\
+       }\
+\
+       inline iterator DoInsert(iterator position, const value_type& x)\
+       {\
+               if ( mpEnd < mpEndOfBuf )\
+               {\
+                       new (mpEnd) value_type(*(mpEnd-1) );\
+           \
+                       CopyObjectsBack( position, mpEnd, position + 1 );\
+           \
+                       *position = x;\
+           \
+                       ++mpEnd;\
+           \
+                       return position;\
+               }\
+           \
+               size_type minBufLen = WXSTL_VECTOR_MIN_BUF_SIZE/sizeof(value_type);\
+           \
+               size_type doubledSize = size()*2;\
+           \
+               size_type newLen = ( doubledSize < minBufLen ) ? minBufLen : doubledSize;\
+           \
+               iterator pNewStart = (iterator)( new char[newLen*sizeof(value_type)] );\
+           \
+               PlacementCopy( mpStart, position, pNewStart );\
+           \
+               iterator atPosition = pNewStart + difference_type( position - mpStart );\
+           \
+               new (atPosition) value_type(x);\
+           \
+               iterator newPos = atPosition;\
+           \
+               ++atPosition;\
+           \
+               if ( mpStart ) \
+               {\
+                       PlacementCopy( position, mpEnd, atPosition );\
+                       DestructRange( mpStart, mpEnd );\
+                       delete [](char*)mpStart;\
+               }\
+           \
+               mpEnd = atPosition + difference_type( mpEnd - position );\
+           \
+               mpStart    = pNewStart;\
+               mpEndOfBuf = pNewStart + newLen;\
+           \
+               return newPos;\
+       }\
+\
+public:\
+\
+       inline vectorClass() : mpStart(0), \
+                                                  mpEnd(0),\
+                                                  mpEndOfBuf(0)\
+       {}\
+\
+       inline vectorClass( const_iterator first, const_iterator last )\
+               : mpStart(0),\
+                 mpEnd(0),\
+                 mpEndOfBuf(0)\
+               \
+               { while( first != last ) push_back( *first++ ); }\
+\
+       inline vectorClass( size_type n, const value_type& value = value_type() )\
+               : mpStart(0),\
+                 mpEnd(0),\
+                 mpEndOfBuf(0)\
+               \
+               { for( size_type i = 0; i != n; ++i ) push_back( value ); }\
+\
+       inline int operator==( const vectorClass& other )\
+       {\
+               size_type sz = size();\
+\
+               if ( sz != other.size() ) return 0;\
+\
+               for( size_type i = 0; i != sz; ++i )\
+\
+                       if ( !( (*this)[i] == other[i] ) ) return 0;\
+\
+               return 1;\
+\
+       }\
+\
+       inline const vectorClass& operator=( const vectorClass& other )\
+       {\
+               if (mpStart) \
+               {\
+                       DestructRange( begin(), end() );\
+                       delete [](char*)mpStart; \
+               }\
+\
+               size_t newLen = difference_type( other.mpEndOfBuf - other.mpStart );\
+\
+               mpStart = (iterator)( new char[newLen*sizeof(value_type)] );\
+\
+               PlacementCopy( other.begin(), other.end(), mpStart );\
+\
+               mpEnd = mpStart + other.size();\
+\
+               mpEndOfBuf = mpStart + newLen;\
+\
+               return *this;\
+       }\
+\
+       inline vectorClass( const vectorClass& other )\
+               : mpStart(0),\
+                 mpEnd(0),\
+                 mpEndOfBuf(0)\
+       {\
+               this->operator=( other );\
+       }\
+\
+       inline ~vectorClass() \
+       { \
+               if (mpStart) \
+               {\
+                       DestructRange( begin(), end() );\
+                       delete [](char*)mpStart; \
+               }\
+       }\
+\
+       inline iterator begin() { return mpStart; }\
+\
+       inline const_iterator begin() const { return mpStart; }\
+\
+       inline iterator end() { return mpEnd; }\
+\
+       inline const_iterator end() const { return mpEnd; }\
+\
+       inline size_type size() const { return (size_type)difference_type(mpEnd-mpStart); }\
+\
+       inline size_type max_size() const { return UINT_MAX/sizeof(value_type); }\
+\
+       inline size_type capacity() const \
+                       { return difference_type(mpEndOfBuf-mpStart)/sizeof(value_type); }\
+\
+       inline int empty() const { return mpStart == mpEnd; }\
+\
+       inline reference operator[](size_type n) { return *(mpStart+n); }\
+\
+       inline const_reference operator[](size_type n) const { return *(mpStart+n); }\
+\
+       inline reference front() { return (*mpStart); }\
+       \
+       inline const_reference front() const { return (*mpStart); }\
+\
+       inline reference back() { return (*(mpEnd-1)); }\
+\
+       inline const_reference back() const { return (*(mpEnd-1)); }\
+\
+       inline void reserve(size_type n) {}\
+\
+       inline void push_back(const value_type& x)\
+       {\
+               if ( mpEnd != mpEndOfBuf ) \
+               {\
+                       new (mpEnd) value_type(x);\
+                       ++mpEnd;\
+               }\
+               else\
+                       DoInsert( mpEnd, x );\
+       }\
+\
+       inline iterator insert(iterator position, const value_type& x = value_type())\
+       {\
+               if ( position == mpEnd && mpEnd != mpEndOfBuf )\
+               {\
+                       new (mpEnd) value_type(x);\
+                       ++mpEnd;\
+                       return (mpEnd-1);\
+               }\
+               else return DoInsert( position, x );\
+       }\
+\
+       inline void pop_back()\
+       {\
+               DestructRange( mpEnd-1, mpEnd );\
+\
+               --mpEnd;\
+       }\
+\
+       inline void erase(iterator first, iterator last)\
+       {\
+               if ( last == mpEnd )\
+               {\
+                       DestructRange( first, last );\
+                       mpEnd = first;\
+                       return;\
+               }\
+           \
+               CopyObjects( last, last + difference_type( mpEnd - last ), first );\
+           \
+               iterator newEnd = mpEnd - difference_type( last - first );\
+               DestructRange( newEnd, mpEnd );\
+           \
+               mpEnd = newEnd;\
+       }\
+\
+       inline void erase( iterator position )\
+       {\
+               erase( position, position + 1 );\
+       }\
+\
+       inline void sort()\
+       {\
+               if ( size() < 2 ) return;\
+               quick_sort( 0, size()-1 );\
+       }\
+}
+
+/////////////////////////////// shallow-copy container ///////////////////////
+
+#define __DEFINE_STL_VECTOR_SHALLOW( vectorClass, Type ) class vectorClass {\
+\
+public:\
+       typedef Type              value_type;\
+       typedef value_type*           iterator;\
+       typedef const value_type* const_iterator;\
+       typedef iterator                  pointer;\
+       typedef const iterator    const_pointer;\
+       typedef value_type&       reference;\
+       typedef const value_type& const_reference;\
+       typedef size_t            size_type;\
+       typedef ptrdiff_t         difference_type;\
+\
+       typedef iterator       OutputIterator;\
+       typedef const_iterator InputIterator;\
+\
+protected:\
+\
+       inline void PlacementCopy( const_iterator first, const_iterator last, iterator result )\
+       {\
+               memcpy(result, first, int(difference_type(last-first)*sizeof(value_type)) );\
+       }\
+\
+       inline void ConstructObjects( iterator first, iterator last, const value_type& pattern )\
+       {\
+                       if ( sizeof(pattern) == 1 )\
+                       \
+                               memset( first, int(difference_type(last-first)/sizeof(value_type)), \
+                                       int(*((char*)&pattern)) );\
+                       else\
+                               while( first != last ) \
+                                       *first++ = pattern;\
+       }\
+\
+       inline void CopyObjects( iterator first, iterator last, iterator result )\
+       {\
+               memcpy(result, first, int(difference_type(last-first)*sizeof(value_type)) );\
+       }\
+\
+       inline void CopyObjectsBack( iterator first, iterator last, iterator result )\
+       {\
+               memmove(result, first, int(difference_type(last-first)*sizeof(value_type)) );\
+       }\
+\
+public:\
+\
+       class reverse_iterator \
+       {\
+               friend class vectorClass;\
+               friend class const_reverse_iterator;\
+\
+       public:\
+               iterator mpPos;\
+\
+       public:\
+\
+               reverse_iterator() {}\
+\
+               reverse_iterator ( iterator pPos )\
+               {\
+                       mpPos = pPos;\
+               }\
+       \
+               int operator==( const reverse_iterator& rhs ) const { return (mpPos == rhs.mpPos); }\
+               int operator!=( const reverse_iterator& rhs ) const { return (mpPos != rhs.mpPos); }\
+\
+               inline reverse_iterator( const reverse_iterator& other )\
+               {\
+                       mpPos = other.mpPos;\
+               }\
+\
+               inline const reverse_iterator& operator--() \
+               {\
+                       --mpPos;\
+                       return *this;\
+               }\
+\
+               inline reverse_iterator operator--(int)\
+               {\
+                       reverse_iterator tmp = *this;\
+                       --mpPos;\
+                       return tmp;\
+               }\
+\
+               inline const reverse_iterator & operator++() \
+               {\
+                       ++mpPos;\
+                       return *this;\
+               }\
+\
+               inline reverse_iterator  operator++(int)\
+               {\
+                       reverse_iterator tmp = *this;\
+                       ++mpPos;\
+                       return tmp;\
+               }\
+\
+               inline const_reference operator*() const { return *mpPos; }\
+       };\
+\
+\
+       class const_reverse_iterator \
+       {\
+       protected:\
+               iterator mpPos;\
+       public:\
+\
+               const_reverse_iterator() {}\
+\
+               const_reverse_iterator( const iterator pPos )\
+               {\
+                       mpPos = pPos;\
+               }\
+       \
+               int operator==( const const_reverse_iterator& rhs ) const { return (mpPos == rhs.mpPos); }\
+               int operator!=( const const_reverse_iterator& rhs ) const { return (mpPos != rhs.mpPos); }\
+\
+               inline const_reverse_iterator( const reverse_iterator& other )\
+               {\
+                       mpPos = other.mpPos;\
+               }\
+\
+               inline const const_reverse_iterator& operator--() \
+               {\
+                       --mpPos;\
+                       return *this;\
+               }\
+\
+               inline const_reverse_iterator operator--(int)\
+               {\
+                       const_reverse_iterator tmp = *this;\
+                       --mpPos;\
+                       return tmp;\
+               }\
+\
+               inline const const_reverse_iterator & operator++() \
+               {\
+                       ++mpPos;\
+                       return *this;\
+               }\
+\
+               inline const_reverse_iterator operator++(int)\
+               {\
+                       const_reverse_iterator tmp = *this;\
+                       ++mpPos;\
+                       return tmp;\
+               }\
+\
+               inline const_reference operator*() const { return *mpPos; }\
+       };\
+\
+protected:\
+       \
+       pointer mpStart;\
+       pointer mpEnd;\
+       pointer mpEndOfBuf;\
+\
+protected:\
+\
+       inline void quick_sort(int low, int hi) \
+       {\
+               int pivot_index;\
+               int left, right;\
+\
+               pivot_index = ( !(mpStart[low] < mpStart[low+1])) ? low : (low+1);\
+               value_type pivot_value = mpStart[pivot_index];\
+\
+               left = low; right = hi;\
+               do \
+               {\
+                       while ((left <= hi) && (mpStart[left] < pivot_value)) left++;\
+\
+                   while ((right >= low) && (pivot_value < mpStart[right])) right--;\
+\
+                       if (left <= right) \
+                       {\
+                               value_type tmp = mpStart[left];\
+                               mpStart[left] = mpStart[right];\
+                               mpStart[right] = tmp;\
+\
+                               left++;\
+                               right--;\
+                       }\
+    \
+               } while (left <= right);\
+               if (low < right) quick_sort(low, right);\
+               if (left < hi) quick_sort(left, hi);\
+       }\
+\
+       inline void DestructRange( iterator first, iterator last )\
+       {\
+       }\
+\
+       inline iterator DoInsert(iterator position, const value_type& x)\
+       {\
+               if ( mpEnd < mpEndOfBuf )\
+               {\
+                       new (mpEnd) value_type(*(mpEnd-1) );\
+           \
+                       CopyObjectsBack( position, mpEnd, position + 1 );\
+           \
+                       *position = x;\
+           \
+                       ++mpEnd;\
+           \
+                       return position;\
+               }\
+           \
+               size_type minBufLen = WXSTL_VECTOR_MIN_BUF_SIZE/sizeof(value_type);\
+           \
+               size_type doubledSize = size()*2;\
+           \
+               size_type newLen = ( doubledSize < minBufLen ) ? minBufLen : doubledSize;\
+           \
+               iterator pNewStart = (iterator)( new char[newLen*sizeof(value_type)] );\
+           \
+               PlacementCopy( mpStart, position, pNewStart );\
+           \
+               iterator atPosition = pNewStart + difference_type( position - mpStart );\
+           \
+               new (atPosition) value_type(x);\
+           \
+               iterator newPos = atPosition;\
+           \
+               ++atPosition;\
+           \
+               if ( mpStart ) \
+               {\
+                       PlacementCopy( position, mpEnd, atPosition );\
+                       DestructRange( mpStart, mpEnd );\
+                       delete [](char*)mpStart;\
+               }\
+           \
+               mpEnd = atPosition + difference_type( mpEnd - position );\
+           \
+               mpStart    = pNewStart;\
+               mpEndOfBuf = pNewStart + newLen;\
+           \
+               return newPos;\
+       }\
+\
+public:\
+\
+       inline vectorClass() : mpStart(0), \
+                                                  mpEnd(0),\
+                                                  mpEndOfBuf(0)\
+       {}\
+\
+       inline vectorClass( const_iterator first, const_iterator last )\
+               : mpStart(0),\
+                 mpEnd(0),\
+                 mpEndOfBuf(0)\
+               \
+               { while( first != last ) push_back( *first++ ); }\
+\
+       inline vectorClass( size_type n, const value_type& value = value_type() )\
+               : mpStart(0),\
+                 mpEnd(0),\
+                 mpEndOfBuf(0)\
+               \
+               { for( size_type i = 0; i != n; ++i ) push_back( value ); }\
+\
+       inline int operator==( const vectorClass& other )\
+       {\
+               size_type sz = size();\
+\
+               if ( sz != other.size() ) return 0;\
+\
+               for( size_type i = 0; i != sz; ++i )\
+\
+                       if ( !( (*this)[i] == other[i] ) ) return 0;\
+\
+               return 1;\
+\
+       }\
+\
+       inline const vectorClass& operator=( const vectorClass& other )\
+       {\
+               if (mpStart) \
+               {\
+                       DestructRange( begin(), end() );\
+                       delete [](char*)mpStart; \
+               }\
+\
+               size_t newLen = difference_type( other.mpEndOfBuf - other.mpStart );\
+\
+               mpStart = (iterator)( new char[newLen*sizeof(value_type)] );\
+\
+               PlacementCopy( other.begin(), other.end(), mpStart );\
+\
+               mpEnd = mpStart + other.size();\
+\
+               mpEndOfBuf = mpStart + newLen;\
+\
+               return *this;\
+       }\
+\
+       inline vectorClass( const vectorClass& other )\
+               : mpStart(0),\
+                 mpEnd(0),\
+                 mpEndOfBuf(0)\
+       {\
+               this->operator=( other );\
+       }\
+\
+       inline ~vectorClass() \
+       { \
+               if (mpStart) \
+               {\
+                       DestructRange( begin(), end() );\
+                       delete [](char*)mpStart; \
+               }\
+       }\
+\
+       inline iterator begin() { return mpStart; }\
+\
+       inline const_iterator begin() const { return mpStart; }\
+\
+       inline iterator end() { return mpEnd; }\
+\
+       inline const_iterator end() const { return mpEnd; }\
+\
+       inline size_type size() const { return (size_type)difference_type(mpEnd-mpStart); }\
+\
+       inline size_type max_size() const { return UINT_MAX/sizeof(value_type); }\
+\
+       inline size_type capacity() const \
+                       { return difference_type(mpEndOfBuf-mpStart)/sizeof(value_type); }\
+\
+       inline int empty() const { return mpStart == mpEnd; }\
+\
+       inline reference operator[](size_type n) { return *(mpStart+n); }\
+\
+       inline const_reference operator[](size_type n) const { return *(mpStart+n); }\
+\
+       inline reference front() { return (*mpStart); }\
+       \
+       inline const_reference front() const { return (*mpStart); }\
+\
+       inline reference back() { return (*(mpEnd-1)); }\
+\
+       inline const_reference back() const { return (*(mpEnd-1)); }\
+\
+       inline void reserve(size_type n) {}\
+\
+       inline void push_back(const value_type& x)\
+       {\
+               if ( mpEnd != mpEndOfBuf ) \
+               {\
+                       new (mpEnd) value_type(x);\
+                       ++mpEnd;\
+               }\
+               else\
+                       DoInsert( mpEnd, x );\
+       }\
+\
+       inline iterator insert(iterator position, const value_type& x = value_type())\
+       {\
+               if ( position == mpEnd && mpEnd != mpEndOfBuf )\
+               {\
+                       new (mpEnd) value_type(x);\
+                       ++mpEnd;\
+                       return (mpEnd-1);\
+               }\
+               else return DoInsert( position, x );\
+       }\
+\
+       inline void pop_back()\
+       {\
+               DestructRange( mpEnd-1, mpEnd );\
+\
+               --mpEnd;\
+       }\
+\
+       inline void erase(iterator first, iterator last)\
+       {\
+               if ( last == mpEnd )\
+               {\
+                       DestructRange( first, last );\
+                       mpEnd = first;\
+                       return;\
+               }\
+           \
+               CopyObjects( last, last + difference_type( mpEnd - last ), first );\
+           \
+               iterator newEnd = mpEnd - difference_type( last - first );\
+               DestructRange( newEnd, mpEnd );\
+           \
+               mpEnd = newEnd;\
+       }\
+\
+       inline void erase( iterator position )\
+       {\
+               erase( position, position + 1 );\
+       }\
+\
+       inline void sort()\
+       {\
+               if ( size() < 2 ) return;\
+               quick_sort( 0, size()-1 );\
+       }\
+}
+
+
+
+// redefine below symbol to change the default allocation unit of vector content buffer
+#define WXSTL_VECTOR_MIN_BUF_SIZE 64
+
+// defines vector class, where objects are copied
+// using "deep-copy" sematics (i.e. by calling their copy constructors)
+
+#define WXSTL_VECTOR(ELEMENT_CLASS) \
+__DEFINE_STL_VECTOR_DEEP(_WXSTL_VECTOR_##ELEMENT_CLASS, ELEMENT_CLASS)
+
+// defines vector class, where objects are copied
+// using "shallow-copy" sematics (i.e. instead of calling
+// their constructors, memcpy() and memmove() are used to copy their raw data)
+
+
+#define WXSTL_VECTOR_SHALLOW_COPY(ELEMENT_CLASS) __DEFINE_STL_VECTOR_SHALLOW(_WXSTL_VECTORSC_##ELEMENT_CLASS, ELEMENT_CLASS)
+
+#endif