This commit was manufactured by cvs2svn to create tag 'WX_2_2_8'.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/tags/WX_2_2_8@12118 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
17
.cvsignore
@@ -21,10 +21,23 @@ linux-gnu.system.cache
|
||||
*.d
|
||||
*.swp
|
||||
*.swo
|
||||
*.swq
|
||||
Release
|
||||
Debug
|
||||
ReleaseDLL
|
||||
DebugDLL
|
||||
ReleaseDll
|
||||
DebugDll
|
||||
ReleaseUnicode
|
||||
DebugUnicode
|
||||
ReleaseUnicodeDll
|
||||
DebugUnicodeDll
|
||||
BaseRelease
|
||||
BaseDebug
|
||||
BaseReleaseDll
|
||||
BaseDebugDll
|
||||
BaseReleaseUnicode
|
||||
BaseDebugUnicode
|
||||
BaseReleaseUnicodeDll
|
||||
BaseDebugUnicodeDll
|
||||
robert
|
||||
stamp-h.in
|
||||
Makefile
|
||||
|
||||
78
BuildCVS.txt
@@ -2,6 +2,9 @@
|
||||
How to build the sources from CVS
|
||||
------------------------------------------------------------------------
|
||||
|
||||
Please use the install.txt files in docs/gtk, docs/msw, docs/motif, docs/mac
|
||||
etc. alongside these instructions.
|
||||
|
||||
I) Windows using plain makefiles
|
||||
----------------------------------------
|
||||
|
||||
@@ -16,45 +19,30 @@ varaibles and PATH entries.
|
||||
Continue with item c) below.
|
||||
|
||||
|
||||
b) If using the GNU MinGW32 or GNU CygWin32 compilers
|
||||
b) If using the GNU Mingw32 or GNU Cygwin32 compilers
|
||||
|
||||
You'll need the compiler itself which is available from
|
||||
You can get Mingw32 from http://www.mingw.org
|
||||
|
||||
http://www.cygwin.com
|
||||
Cygwin32 is available at http://www.cygwin.com
|
||||
|
||||
When using MingW32 you'll need GNU make which is a part
|
||||
of the CygWin32 toolchain and is also available as a stand
|
||||
alone port without the infamous Cygwin.dll from
|
||||
|
||||
http://agnes.dida.physik.uni-essen.de/~janjaap/mingw32
|
||||
|
||||
The makefile has small problems with Cygwin<69>s tools
|
||||
so it is recommended not to use these (but MingGW32
|
||||
and its make.exe).
|
||||
The makefile might have small problems with Cygwin's tools
|
||||
so it is recommended to use Mingw32 and its toolchain instead
|
||||
if possible.
|
||||
|
||||
-> Set your path so that it includes the directory
|
||||
where your compiler and tools reside
|
||||
|
||||
b-2) Using Mingw32 with gcc-2.95 and Anders Norlander's
|
||||
Win32 headers
|
||||
|
||||
Using the newer gcc-2.95/Noralander header combination
|
||||
will allow you to compile more of the MSW code, such
|
||||
as OLE and Drag-n-Drop.
|
||||
|
||||
Instructions are similar to those for Regular Mingw32 except
|
||||
|
||||
->Get the compiler from
|
||||
ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/mingw32/gcc-2.95/
|
||||
|
||||
->patch the gcc headers with info in wxWin\Mingw32-gcc295.patches.
|
||||
PLEASE APPLY THESE PATCHES BY HAND! There are apparently a few
|
||||
different versions of the headers floating around.
|
||||
|
||||
->Edit wx/src/makeg95.env and set the MINGW32 variable at the top of
|
||||
the file to either 1 (you have Mingw32) or 0 (you have Cygwin32).
|
||||
If using MINGW32, also set the MINGW32VERSION variable
|
||||
appropriately.
|
||||
-> If your are using an old Mingw32 version (gcc-2.95 or older),
|
||||
you might need to fix some headers with the patches contained
|
||||
in the wxWin\Mingw32-gcc295.patches file. PLEASE APPLY THESE
|
||||
PATCHES BY HAND! There are apparently a few different versions
|
||||
of the headers floating around. Note that these patches are
|
||||
not needed if you are using Mingw32 gcc-2.95.2 or newer.
|
||||
|
||||
-> Edit wx/src/makeg95.env and set the MINGW32 variable at the top of
|
||||
the file to either 1 (you have Mingw32) or 0 (you have Cygwin32).
|
||||
If using MINGW32, also set the MINGW32VERSION variable
|
||||
appropiately.
|
||||
|
||||
|
||||
c) Build instructions
|
||||
@@ -64,9 +52,9 @@ c) Build instructions
|
||||
-> Copy c:\wxWin\include\wx\msw\setup0.h
|
||||
to c:\wxWin\include\wx\msw\setup.h
|
||||
-> Edit c:\wxWin\include\wx\msw\setup.h so that
|
||||
most features are enabled (i.e. defined to 1) with
|
||||
most features are enabled (i.e. defined to 1), for example:
|
||||
#define wxUSE_ODBC 0
|
||||
#define wxUSE_SOCKETS 0
|
||||
#define wxUSE_SOCKETS 1
|
||||
#define wxUSE_HTML 1
|
||||
#define wxUSE_THREADS 1
|
||||
#define wxUSE_FS_INET 0
|
||||
@@ -77,14 +65,12 @@ c) Build instructions
|
||||
#define wxUSE_LIBJPEG 1
|
||||
#define wxUSE_LIBPNG 1
|
||||
|
||||
and iostreams ares disabled with
|
||||
and std iostreams are disabled with
|
||||
#define wxUSE_STD_IOSTREAM 0
|
||||
|
||||
note: ODBC and SOCKETS can be 1 for gcc-2.95
|
||||
|
||||
|
||||
-> type: cd c:\wxWin\src\msw
|
||||
-> type: make -f makefile.g95 (if using GNU tools)
|
||||
or type: make -f makefile.vc (if using MS VC++)
|
||||
or type: nmake -f makefile.vc (if using MS VC++)
|
||||
|
||||
|
||||
II) Unix ports
|
||||
@@ -132,6 +118,20 @@ ftp server at ftp://sourceware.cygnus.com/pub/cygwin/.
|
||||
Of course, you can also build the library using plain makefiles (see
|
||||
section I).
|
||||
|
||||
IV) wxBase
|
||||
----------------------------------------
|
||||
|
||||
wxBase is the non GUI part of wxWindows. Currently it can be only built using
|
||||
configure (i.e. under Unix and probably under Win32 with cygwin) and with
|
||||
Visual C++.
|
||||
|
||||
To build it using configure, just add "--disable-gui" argument to it.
|
||||
|
||||
To build wxBase with VC++, use the project files wxBase.dsp and wxBaseDll.dsp
|
||||
included in the CVS. See http://www.wxwindows.org/vadim/wxDocs/buildmsw.html
|
||||
for the instructions on how to generate the project files for the programs
|
||||
using wxBase.
|
||||
|
||||
V) MacOS
|
||||
----------------------------------------
|
||||
|
||||
|
||||
478
Makefile.in
@@ -1,11 +1,12 @@
|
||||
#
|
||||
# File: makefile.unx
|
||||
# Author: Julian Smart, Robert Roebling, Vadim Zeitlin
|
||||
# Author: Julian Smart, Robert Roebling, Vadim Zeitlin, Ron Lee
|
||||
# Created: 1993
|
||||
# Updated: 1999
|
||||
# Updated: 2001
|
||||
# Copyright:(c) 1993, AIAI, University of Edinburgh,
|
||||
# Copyright:(c) 1999, Vadim Zeitlin
|
||||
# Copyright:(c) 1999, Robert Roebling
|
||||
# Copyright:(c) 2001, Ron Lee
|
||||
#
|
||||
# Makefile for libwx_gtk.a, libwx_motif.a and libwx_msw.a
|
||||
|
||||
@@ -15,24 +16,22 @@ include ./src/make.env
|
||||
|
||||
############## override make.env for PIC ##########################
|
||||
|
||||
# Clears all default suffixes
|
||||
.SUFFIXES: .o .cpp .c .cxx
|
||||
%.o : %.c
|
||||
$(CC) -c $(CFLAGS) $(PICFLAGS) @WXMSW_DLL_DEFINES@ -o $@ $<
|
||||
|
||||
.c.o :
|
||||
$(CCC) -c @DEP_INFO_FLAGS@ $(CFLAGS) $(PICFLAGS) -o $@ $<
|
||||
%.o : %.cpp
|
||||
$(CXX) -c $(CXXFLAGS) $(PICFLAGS) @WXMSW_DLL_DEFINES@ -o $@ $<
|
||||
|
||||
.cpp.o :
|
||||
$(CC) -c @DEP_INFO_FLAGS@ $(CPPFLAGS) $(PICFLAGS) -o $@ $<
|
||||
|
||||
.cxx.o :
|
||||
$(CC) -c @DEP_INFO_FLAGS@ $(CPPFLAGS) $(PICFLAGS) -o $@ $<
|
||||
%.o : %.cxx
|
||||
$(CXX) -c $(CXXFLAGS) $(PICFLAGS) @WXMSW_DLL_DEFINES@ -o $@ $<
|
||||
|
||||
########################### Paths #################################
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
|
||||
VP1 = @top_srcdir@/src/common
|
||||
VP2 = @top_srcdir@/src/@TOOLKIT_DIR@
|
||||
VP1 = @TOOLKIT_VPATH@
|
||||
VP2 = @top_srcdir@/src/common
|
||||
VP3 = @top_srcdir@/src/motif/xmcombo
|
||||
VP4 = @top_srcdir@/src/generic
|
||||
VP5 = @top_srcdir@/src/unix
|
||||
@@ -42,52 +41,51 @@ VP8 = @top_srcdir@/src/jpeg
|
||||
VP9 = @top_srcdir@/src/tiff
|
||||
VP10 = @top_srcdir@/src/zlib
|
||||
VP11 = @top_srcdir@/src/iodbc
|
||||
VP12 = @top_srcdir@/src/msw/ole
|
||||
|
||||
FTVP01 = @top_srcdir@/src/freetype/unix
|
||||
FTVP02 = @top_srcdir@/src/freetype/autohint
|
||||
FTVP03 = @top_srcdir@/src/freetype/base
|
||||
FTVP04 = @top_srcdir@/src/freetype/cff
|
||||
FTVP05 = @top_srcdir@/src/freetype/cid
|
||||
FTVP06 = @top_srcdir@/src/freetype/macfond
|
||||
FTVP07 = @top_srcdir@/src/freetype/otlayout
|
||||
FTVP08 = @top_srcdir@/src/freetype/psnames
|
||||
FTVP09 = @top_srcdir@/src/freetype/raster1
|
||||
FTVP10 = @top_srcdir@/src/freetype/sfnt
|
||||
FTVP11 = @top_srcdir@/src/freetype/smooth
|
||||
FTVP12 = @top_srcdir@/src/freetype/truetype
|
||||
FTVP13 = @top_srcdir@/src/freetype/type1
|
||||
FTVP14 = @top_srcdir@/src/freetype/type1z
|
||||
FTVP15 = @top_srcdir@/src/freetype/winfonts
|
||||
|
||||
VP13 = $(FTVP01)@PATH_IFS@$(FTVP02)@PATH_IFS@$(FTVP03)@PATH_IFS@$(FTVP04)@PATH_IFS@$(FTVP05)@PATH_IFS@$(FTVP06)@PATH_IFS@$(FTVP07)@PATH_IFS@$(FTVP08)@PATH_IFS@
|
||||
VP14 = $(FTVP09)@PATH_IFS@$(FTVP10)@PATH_IFS@$(FTVP11)@PATH_IFS@$(FTVP12)@PATH_IFS@$(FTVP13)@PATH_IFS@$(FTVP14)@PATH_IFS@$(FTVP15)@PATH_IFS@
|
||||
|
||||
# the comment at the end of the next line is needed because otherwise autoconf
|
||||
# would remove this line completely - it contains a built-in hack to remove
|
||||
# any VPATH assignment not containing ':'
|
||||
VPATH = $(VP1)@PATH_IFS@$(VP2)@PATH_IFS@$(VP3)@PATH_IFS@$(VP4)@PATH_IFS@$(VP5)@PATH_IFS@$(VP6)@PATH_IFS@$(VP7)@PATH_IFS@$(VP8)@PATH_IFS@$(VP9)@PATH_IFS@$(VP10)@PATH_IFS@$(VP11) # ':' for autoconf
|
||||
VPATH = $(VP1)@PATH_IFS@$(VP2)@PATH_IFS@$(VP3)@PATH_IFS@$(VP4)@PATH_IFS@$(VP5)@PATH_IFS@$(VP6)@PATH_IFS@$(VP7)@PATH_IFS@$(VP8)@PATH_IFS@$(VP9)@PATH_IFS@$(VP10)@PATH_IFS@$(VP11)@PATH_IFS@$(VP12)@PATH_IFS@$(VP13)@PATH_IFS@$(VP14) # ':' for autoconf
|
||||
|
||||
top_srcdir = @top_srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
localedir = $(datadir)/locale
|
||||
|
||||
top_builddir = .
|
||||
build_libdir = $(top_builddir)/lib
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
# my autoconf doesn't set this
|
||||
#INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
# maybe do an additional chmod if needed?
|
||||
INSTALL_SCRIPT = @INSTALL@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_alias = @build_alias@
|
||||
build_triplet = @build@
|
||||
host_alias = @host_alias@
|
||||
@@ -116,25 +114,39 @@ GTKDIR = $(WXDIR)/src/gtk
|
||||
MOTIFDIR = $(WXDIR)/src/motif
|
||||
MSWDIR = $(WXDIR)/src/msw
|
||||
PMDIR = $(WXDIR)/src/os2
|
||||
MACDIR = $(WXDIR)/src/mac
|
||||
ODBCDIR = $(WXDIR)/src/iodbc
|
||||
FTDIR = $(WXDIR)/src/freetype
|
||||
INCDIR = $(WXDIR)/include
|
||||
SAMPDIR = $(WXDIR)/samples
|
||||
DEMODIR = $(WXDIR)/demos
|
||||
UTILSDIR = $(WXDIR)/utils
|
||||
MISCDIR = $(WXDIR)/misc
|
||||
|
||||
DOCDIR = $(WXDIR)/docs
|
||||
DOCDIR = $(WXDIR)/docs
|
||||
INTLDIR = $(WXDIR)/locale
|
||||
|
||||
########################## Archive name ###############################
|
||||
|
||||
WXARCHIVE = @DISTDIR@-$(WX_MAJOR_VERSION_NUMBER).$(WX_MINOR_VERSION_NUMBER).$(WX_RELEASE_NUMBER).tgz
|
||||
WXGLARCHIVE = @DISTDIR@-gl-$(WX_MAJOR_VERSION_NUMBER).$(WX_MINOR_VERSION_NUMBER).$(WX_RELEASE_NUMBER).tgz
|
||||
WXSAMPLES = wx$(TOOLKIT)-samples-$(WX_MAJOR_VERSION_NUMBER).$(WX_MINOR_VERSION_NUMBER).$(WX_RELEASE_NUMBER).tgz
|
||||
WXDEMOS = wx$(TOOLKIT)-demos-$(WX_MAJOR_VERSION_NUMBER).$(WX_MINOR_VERSION_NUMBER).$(WX_RELEASE_NUMBER).tgz
|
||||
# append a version suffix x.y.z to all file names
|
||||
VER_SUFFIX=$(WX_MAJOR_VERSION_NUMBER).$(WX_MINOR_VERSION_NUMBER).$(WX_RELEASE_NUMBER)
|
||||
WXARCHIVE = @DISTDIR@-$(VER_SUFFIX).tar.gz
|
||||
WXGLARCHIVE = @DISTDIR@-gl-$(VER_SUFFIX).tar.gz
|
||||
WXSAMPLES = wx$(TOOLKIT)-samples-$(VER_SUFFIX).tar.gz
|
||||
WXDEMOS = wx$(TOOLKIT)-demos-$(VER_SUFFIX).tar.gz
|
||||
|
||||
WXARCHIVE_BZIP = @DISTDIR@-$(VER_SUFFIX).tar.bz2
|
||||
WXGLARCHIVE_BZIP = @DISTDIR@-gl-$(VER_SUFFIX).tar.bz2
|
||||
WXSAMPLES_BZIP = wx$(TOOLKIT)-samples-$(VER_SUFFIX).tar.bz2
|
||||
WXDEMOS_BZIP = wx$(TOOLKIT)-demos-$(VER_SUFFIX).tar.bz2
|
||||
|
||||
DISTDIR = ./_dist_dir/@DISTDIR@
|
||||
|
||||
|
||||
############################## Files ##################################
|
||||
|
||||
WX_LINGUAS = `cd $(top_srcdir)/locale && ls *.mo 2> /dev/null | sed -n 's/\.mo//p'`
|
||||
|
||||
# this line will include a file which defines ALL_SOURCES, ALL_OBJECTS,
|
||||
# ALL_DEPFILES and ALL_HEADERS variables with the complete list of .cpp, .o,
|
||||
# .d and .h/.inl files for the current toolkit
|
||||
@@ -146,7 +158,6 @@ HEADERS = $(ALL_HEADERS)
|
||||
# for the objects and depfiles, we might be bulding only part of them
|
||||
# depending on configure arguments, so select a subset of ALL
|
||||
OBJECTS = @ALL_OBJECTS@
|
||||
DEPFILES = @ALL_DEPFILES@
|
||||
|
||||
# the object files of sublibraries (we assume that they don't change [often],
|
||||
# so we don't generate these lists with tmake but embed them here)
|
||||
@@ -183,6 +194,24 @@ PNGOBJS = \
|
||||
pngget.o \
|
||||
pngset.o
|
||||
|
||||
FREETYPEOBJS = \
|
||||
ftsystem.o \
|
||||
autohint.o \
|
||||
ftbase.o \
|
||||
ftdebug.o \
|
||||
ftglyph.o \
|
||||
ftinit.o \
|
||||
ftmm.o \
|
||||
cff.o \
|
||||
type1cid.o \
|
||||
psnames.o \
|
||||
psmodule.o \
|
||||
raster1.o \
|
||||
sfnt.o \
|
||||
smooth.o \
|
||||
truetype.o \
|
||||
type1z.o \
|
||||
winfnt.o
|
||||
|
||||
JPEGOBJS = \
|
||||
jcomapi.o \
|
||||
@@ -286,65 +315,43 @@ IODBCOBJS = \
|
||||
|
||||
############################## Rules ##################################
|
||||
|
||||
BURNT_LIBRARY_NAME = @BURNT_LIBRARY_NAME@
|
||||
BURNT_LIBRARY_NAME_GL = @BURNT_LIBRARY_NAME_GL@
|
||||
SONAME_FLAGS = @SONAME_FLAGS@
|
||||
SONAME_FLAGS_GL = @SONAME_FLAGS_GL@
|
||||
|
||||
all: @WX_ALL@
|
||||
|
||||
@WX_LIBRARY_NAME_STATIC@: $(OBJECTS)
|
||||
@$(INSTALL) -d ./lib
|
||||
$(AR) $(AROPTIONS) ./lib/$@ $(OBJECTS)
|
||||
$(RANLIB) ./lib/$@
|
||||
$(build_libdir)/@WX_LIBRARY_NAME_STATIC@: $(OBJECTS)
|
||||
@$(INSTALL) -d $(build_libdir)
|
||||
$(AR) $(AROPTIONS) $@ $(OBJECTS)
|
||||
$(RANLIB) $@
|
||||
|
||||
@WX_LIBRARY_NAME_STATIC_GL@: glcanvas.o
|
||||
@$(INSTALL) -d ./lib
|
||||
$(AR) $(AROPTIONS) ./lib/$@ glcanvas.o
|
||||
$(RANLIB) ./lib/$@
|
||||
$(build_libdir)/@WX_LIBRARY_NAME_STATIC_GL@: glcanvas.o
|
||||
@$(INSTALL) -d $(build_libdir)
|
||||
$(AR) $(AROPTIONS) $@ glcanvas.o
|
||||
$(RANLIB) $@
|
||||
|
||||
@WX_LIBRARY_NAME_SHARED@: $(OBJECTS)
|
||||
@$(INSTALL) -d ./lib
|
||||
$(SHARED_LD) ./lib/$@ $(BURNT_LIBRARY_NAME) $(OBJECTS) $(EXTRALIBS)
|
||||
|
||||
@WX_LIBRARY_NAME_SHARED_GL@: glcanvas.o
|
||||
@$(INSTALL) -d ./lib
|
||||
$(SHARED_LD) ./lib/$@ $(BURNT_LIBRARY_NAME_GL) glcanvas.o $(EXTRALIBS)
|
||||
|
||||
CREATE_LINKS: @WX_LIBRARY_NAME_SHARED@
|
||||
@$(RM) ./lib/@WX_LIBRARY_LINK1@
|
||||
@$(RM) ./lib/@WX_LIBRARY_LINK2@
|
||||
@$(RM) ./lib/@WX_LIBRARY_LINK3@
|
||||
cd lib \
|
||||
$(build_libdir)/@WX_LIBRARY_NAME_SHARED@: $(OBJECTS)
|
||||
@$(INSTALL) -d $(build_libdir)
|
||||
$(SHARED_LD) $@ $(SONAME_FLAGS) $(OBJECTS) $(EXTRALIBS)
|
||||
|
||||
$(build_libdir)/@WX_LIBRARY_NAME_SHARED_GL@: glcanvas.o $(build_libdir)/@WX_LIBRARY_NAME_SHARED@
|
||||
@$(INSTALL) -d $(build_libdir)
|
||||
$(SHARED_LD) $@ $(SONAME_FLAGS_GL) glcanvas.o -L$(build_libdir) @WXCONFIG_LIBS@ $(EXTRALIBS) $(OPENGLLIBS)
|
||||
|
||||
$(build_libdir)/@WX_LIBRARY_LINK1@: $(build_libdir)/@WX_LIBRARY_NAME_SHARED@
|
||||
@$(RM) $(build_libdir)/@WX_LIBRARY_LINK1@
|
||||
@$(RM) $(build_libdir)/@WX_LIBRARY_LINK2@
|
||||
cd $(build_libdir) \
|
||||
&& $(LN_S) @WX_TARGET_LIBRARY@ @WX_LIBRARY_LINK1@ \
|
||||
&& $(LN_S) @WX_TARGET_LIBRARY@ @WX_LIBRARY_LINK2@ \
|
||||
&& $(LN_S) @WX_TARGET_LIBRARY@ @WX_LIBRARY_LINK3@
|
||||
|
||||
CREATE_LINKS_GL: @WX_LIBRARY_NAME_SHARED_GL@
|
||||
@$(RM) ./lib/@WX_LIBRARY_LINK1_GL@
|
||||
@$(RM) ./lib/@WX_LIBRARY_LINK2_GL@
|
||||
@$(RM) ./lib/@WX_LIBRARY_LINK3_GL@
|
||||
cd lib \
|
||||
&& $(LN_S) @WX_TARGET_LIBRARY@ @WX_LIBRARY_LINK2@
|
||||
|
||||
$(build_libdir)/@WX_LIBRARY_LINK1_GL@: $(build_libdir)/@WX_LIBRARY_NAME_SHARED_GL@
|
||||
@$(RM) $(build_libdir)/@WX_LIBRARY_LINK1_GL@
|
||||
@$(RM) $(build_libdir)/@WX_LIBRARY_LINK2_GL@
|
||||
cd $(build_libdir) \
|
||||
&& $(LN_S) @WX_TARGET_LIBRARY_GL@ @WX_LIBRARY_LINK1_GL@ \
|
||||
&& $(LN_S) @WX_TARGET_LIBRARY_GL@ @WX_LIBRARY_LINK2_GL@ \
|
||||
&& $(LN_S) @WX_TARGET_LIBRARY_GL@ @WX_LIBRARY_LINK3_GL@
|
||||
|
||||
CREATE_INSTALLED_LINKS: preinstall
|
||||
$(RM) $(libdir)/@WX_LIBRARY_LINK1@
|
||||
$(RM) $(libdir)/@WX_LIBRARY_LINK2@
|
||||
$(RM) $(libdir)/@WX_LIBRARY_LINK3@
|
||||
cd $(libdir) \
|
||||
&& $(LN_S) @WX_LIBRARY_NAME_SHARED@ @WX_LIBRARY_LINK1@ \
|
||||
&& $(LN_S) @WX_LIBRARY_NAME_SHARED@ @WX_LIBRARY_LINK2@ \
|
||||
&& $(LN_S) @WX_LIBRARY_NAME_SHARED@ @WX_LIBRARY_LINK3@
|
||||
|
||||
CREATE_INSTALLED_LINKS_GL: preinstall_gl
|
||||
$(RM) $(libdir)/@WX_LIBRARY_LINK1_GL@
|
||||
$(RM) $(libdir)/@WX_LIBRARY_LINK2_GL@
|
||||
$(RM) $(libdir)/@WX_LIBRARY_LINK3_GL@
|
||||
cd $(libdir) \
|
||||
&& $(LN_S) @WX_LIBRARY_NAME_SHARED_GL@ @WX_LIBRARY_LINK1_GL@ \
|
||||
&& $(LN_S) @WX_LIBRARY_NAME_SHARED_GL@ @WX_LIBRARY_LINK2_GL@ \
|
||||
&& $(LN_S) @WX_LIBRARY_NAME_SHARED_GL@ @WX_LIBRARY_LINK3_GL@
|
||||
|
||||
&& $(LN_S) @WX_TARGET_LIBRARY_GL@ @WX_LIBRARY_LINK2_GL@
|
||||
|
||||
$(OBJECTS): $(WXDIR)/include/wx/defs.h $(WXDIR)/include/wx/object.h
|
||||
|
||||
parser.o: parser.c lexer.c
|
||||
@@ -368,7 +375,22 @@ lexer.c: $(COMMDIR)/lexer.l
|
||||
sed -e "s/unput/PROIO_unput/g" > lexer.c
|
||||
@$(RM) @LEX_STEM@.c
|
||||
|
||||
-include $(DEPFILES)
|
||||
-include $(OBJECTS:.o=.d)
|
||||
|
||||
|
||||
CREATE_INSTALLED_LINKS: preinstall
|
||||
$(RM) $(libdir)/@WX_LIBRARY_LINK1@
|
||||
$(RM) $(libdir)/@WX_LIBRARY_LINK2@
|
||||
cd $(libdir) \
|
||||
&& $(LN_S) @WX_LIBRARY_NAME_SHARED@ @WX_LIBRARY_LINK1@ \
|
||||
&& $(LN_S) @WX_LIBRARY_NAME_SHARED@ @WX_LIBRARY_LINK2@
|
||||
|
||||
CREATE_INSTALLED_LINKS_GL: preinstall_gl
|
||||
$(RM) $(libdir)/@WX_LIBRARY_LINK1_GL@
|
||||
$(RM) $(libdir)/@WX_LIBRARY_LINK2_GL@
|
||||
cd $(libdir) \
|
||||
&& $(LN_S) @WX_LIBRARY_NAME_SHARED_GL@ @WX_LIBRARY_LINK1_GL@ \
|
||||
&& $(LN_S) @WX_LIBRARY_NAME_SHARED_GL@ @WX_LIBRARY_LINK2_GL@
|
||||
|
||||
afminstall: preinstall
|
||||
$(INSTALL) -d $(datadir)
|
||||
@@ -380,7 +402,7 @@ afminstall: preinstall
|
||||
|
||||
# this is the real install target: copies the library, wx-config and the
|
||||
# headers to the installation directory
|
||||
preinstall: $(top_builddir)/lib/@WX_TARGET_LIBRARY@ $(top_builddir)/wx@TOOLKIT_DIR@-config
|
||||
preinstall: $(top_builddir)/lib/@WX_TARGET_LIBRARY@ $(top_builddir)/wx@TOOLCHAIN_NAME@-config
|
||||
@echo " "
|
||||
@echo " Installing wxWindows..."
|
||||
@echo " "
|
||||
@@ -389,20 +411,27 @@ preinstall: $(top_builddir)/lib/@WX_TARGET_LIBRARY@ $(top_builddir)/wx@TOOLKIT_D
|
||||
$(INSTALL) -d $(bindir)
|
||||
$(INSTALL) -d $(libdir)
|
||||
|
||||
$(INSTALL_SCRIPT) $(top_builddir)/wx@TOOLKIT_DIR@-config $(bindir)/wx@TOOLKIT_DIR@-config
|
||||
cd $(bindir) && rm -f wx-config && $(LN_S) wx@TOOLKIT_DIR@-config wx-config
|
||||
$(INSTALL_SCRIPT) $(top_builddir)/wx@TOOLCHAIN_NAME@-config $(bindir)/wx@TOOLCHAIN_NAME@-config
|
||||
cd $(bindir) && rm -f wx-config && $(LN_S) wx@TOOLCHAIN_NAME@-config wx-config
|
||||
$(INSTALL_PROGRAM) $(top_builddir)/lib/@WX_TARGET_LIBRARY@ $(libdir)/@WX_TARGET_LIBRARY@
|
||||
@# this installs the import library for a MSW DLL
|
||||
@# remember: for wxMSW DLL WX_LIBRARY_NAME_STATIC is the
|
||||
@# import livraru name
|
||||
@if test "@TOOLKIT_DIR@" = "msw" -a "@WX_LIBRARY_NAME_STATIC@" != "@WX_TARGET_LIBRARY@"; then $(INSTALL_PROGRAM) $(top_builddir)/lib/@WX_LIBRARY_NAME_STATIC@ $(libdir)/@WX_LIBRARY_NAME_STATIC@; fi
|
||||
|
||||
$(INSTALL) -d $(libdir)/wx
|
||||
$(INSTALL) -d $(libdir)/wx/include
|
||||
$(INSTALL) -d $(libdir)/wx/include/wx
|
||||
$(INSTALL) -d $(libdir)/wx/include/wx/@TOOLKIT_DIR@
|
||||
$(INSTALL_DATA) $(top_builddir)/include/wx/@TOOLKIT_DIR@/setup.h $(libdir)/wx/include/wx/@TOOLKIT_DIR@/setup.h
|
||||
|
||||
$(INSTALL) -d $(libdir)/wx/include/@TOOLCHAIN_NAME@
|
||||
$(INSTALL) -d $(libdir)/wx/include/@TOOLCHAIN_NAME@/wx
|
||||
$(INSTALL_DATA) $(top_builddir)/lib/wx/include/@TOOLCHAIN_NAME@/wx/setup.h $(libdir)/wx/include/@TOOLCHAIN_NAME@/wx/setup.h
|
||||
|
||||
$(INSTALL) -d $(includedir)/wx
|
||||
@# FIXME: This will erroneously install a wx/base dir for wxBase..
|
||||
@if test "$(USE_GUI)" = 1; then $(INSTALL) -d $(includedir)/wx/@TOOLKIT_DIR@; fi
|
||||
@if test "$(USE_GUI)" = 1; then $(INSTALL) -d $(includedir)/wx/html; fi
|
||||
@if test "$(USE_GUI)" = 1; then $(INSTALL) -d $(includedir)/wx/generic; fi
|
||||
@if test "@TOOLKIT_DIR@" = "msw"; then $(INSTALL) -d $(includedir)/wx/msw/ole; fi
|
||||
|
||||
$(INSTALL) -d $(includedir)/wx/protocol
|
||||
$(INSTALL) -d $(includedir)/wx/unix
|
||||
@list='$(HEADERS)'; for p in $$list; do \
|
||||
@@ -410,6 +439,14 @@ preinstall: $(top_builddir)/lib/@WX_TARGET_LIBRARY@ $(top_builddir)/wx@TOOLKIT_D
|
||||
echo "$(INSTALL_DATA) $(top_srcdir)/include/wx/$$p $(includedir)/wx/$$p"; \
|
||||
done
|
||||
|
||||
$(INSTALL) -d $(localedir)
|
||||
@for p in $(WX_LINGUAS); do \
|
||||
$(INSTALL) -d $(localedir)/$$p; \
|
||||
$(INSTALL) -d $(localedir)/$$p/LC_MESSAGES; \
|
||||
$(INSTALL_DATA) $(top_srcdir)/locale/$$p.mo $(localedir)/$$p/LC_MESSAGES/wxstd.mo; \
|
||||
echo "$(INSTALL_DATA) $(top_srcdir)/locale/$$p.mo $(localedir)/$$p/LC_MESSAGES/wxstd.mo"; \
|
||||
done
|
||||
|
||||
preinstall_gl: $(top_builddir)/lib/@WX_TARGET_LIBRARY_GL@
|
||||
@echo " "
|
||||
@echo " Installing wxWindows OpenGl add-on..."
|
||||
@@ -438,16 +475,14 @@ uninstall:
|
||||
@$(RM) $(libdir)/@WX_TARGET_LIBRARY@
|
||||
@$(RM) $(libdir)/@WX_LIBRARY_LINK1@
|
||||
@$(RM) $(libdir)/@WX_LIBRARY_LINK2@
|
||||
@$(RM) $(libdir)/@WX_LIBRARY_LINK3@
|
||||
@echo " Removing GL library..."
|
||||
@$(RM) $(libdir)/@WX_TARGET_LIBRARY_GL@
|
||||
@$(RM) $(libdir)/@WX_LIBRARY_LINK1_GL@
|
||||
@$(RM) $(libdir)/@WX_LIBRARY_LINK2_GL@
|
||||
@$(RM) $(libdir)/@WX_LIBRARY_LINK3_GL@
|
||||
@echo " Removing helper files..."
|
||||
@$(RM) $(libdir)/wx/include/wx/@TOOLKIT_DIR@/setup.h
|
||||
@$(RM) $(libdir)/wx/include/@TOOLCHAIN_NAME@/wx/setup.h
|
||||
@$(RM) $(bindir)/wx-config
|
||||
@$(RM) $(bindir)/wx@TOOLKIT_DIR@-config
|
||||
@$(RM) $(bindir)/wx@TOOLCHAIN_NAME@-config
|
||||
@$(RM) $(datadir)/wx/afm/*
|
||||
@$(RM) $(datadir)/wx/gs_afm/*
|
||||
# FIXME: wxBase doesnt install these next 3 dirs.
|
||||
@@ -458,9 +493,16 @@ uninstall:
|
||||
@list='$(HEADERS)'; for p in $$list; do \
|
||||
$(RM) $(includedir)/wx/$$p; \
|
||||
done
|
||||
@echo " Removing i18n files..."
|
||||
@-for p in $(WX_LINGUAS); do \
|
||||
$(RM) $(localedir)/$$p/LC_MESSAGES/wxstd.mo; \
|
||||
rmdir $(localedir)/$$p/LC_MESSAGES; \
|
||||
rmdir $(localedir)/$$p; \
|
||||
done
|
||||
@echo " Removing directories..."
|
||||
@if test -d $(libdir)/wx/include/wx/@TOOLKIT_DIR@; then rmdir $(libdir)/wx/include/wx/@TOOLKIT_DIR@; fi
|
||||
@if test -d $(libdir)/wx/include/wx; then rmdir $(libdir)/wx/include/wx; fi
|
||||
@-rmdir $(localedir)
|
||||
@if test -d $(libdir)/wx/include/@TOOLCHAIN_NAME@/wx; then rmdir $(libdir)/wx/include/@TOOLCHAIN_NAME@/wx; fi
|
||||
@if test -d $(libdir)/wx/include/@TOOLCHAIN_NAME@; then rmdir $(libdir)/wx/include/@TOOLCHAIN_NAME@; fi
|
||||
@if test -d $(libdir)/wx/include; then rmdir $(libdir)/wx/include; fi
|
||||
@if test -d $(libdir)/wx; then rmdir $(libdir)/wx; fi
|
||||
@if test -d $(includedir)/wx/gtk; then rmdir $(includedir)/wx/gtk; fi
|
||||
@@ -505,6 +547,7 @@ ALL_DIST: distclean
|
||||
# but is not used when building wxBase distribution
|
||||
ALL_GUI_DIST: ALL_DIST
|
||||
cp $(WXDIR)/wx$(TOOLKIT).spec $(DISTDIR)
|
||||
cp $(WXDIR)/wxBase.spec $(DISTDIR)
|
||||
cp $(DOCDIR)/$(TOOLKITDIR)/install.txt $(DISTDIR)/INSTALL.txt
|
||||
cp $(DOCDIR)/$(TOOLKITDIR)/changes.txt $(DISTDIR)/CHANGES.txt
|
||||
cp $(DOCDIR)/$(TOOLKITDIR)/readme.txt $(DISTDIR)/README.txt
|
||||
@@ -577,13 +620,13 @@ BASE_DIST: ALL_DIST
|
||||
cp $(WXDIR)/@PORT_FILES@ $(DISTDIR)/@PORT_FILES@
|
||||
cp $(WXDIR)/@RPM_FILES@ $(DISTDIR)/@RPM_FILES@
|
||||
cp $(WXDIR)/@RPM_SPEC@ $(DISTDIR)/@RPM_SPEC@
|
||||
cp $(WXDIR)/wxBase.dsp $(DISTDIR)
|
||||
cp $(DOCDIR)/install.txt $(DISTDIR)/INSTALL.txt
|
||||
cp $(WXDIR)/wxBase*.ds[pw] $(DISTDIR)
|
||||
cp $(DOCDIR)/changes.txt $(DISTDIR)/CHANGES.txt
|
||||
cp $(DOCDIR)/readme.txt $(DISTDIR)/README.txt
|
||||
cp $(DOCDIR)/todo.txt $(DISTDIR)/TODO.txt
|
||||
cp $(SRCDIR)/*.in $(DISTDIR)/src
|
||||
cp $(WXDIR)/src/common/unzip.h $(DISTDIR)/src/common/unzip.h
|
||||
cp $(WXDIR)/src/common/*.inc $(DISTDIR)/src/common
|
||||
cp $(WXDIR)/src/common/base.rc $(DISTDIR)/src/common
|
||||
cp $(WXDIR)/src/common/unzip.h $(DISTDIR)/src/common
|
||||
list='$(HEADERS)'; for p in $$list; do \
|
||||
cp $(WXDIR)/include/wx/$$p $(DISTDIR)/include/wx/$$p; \
|
||||
done
|
||||
@@ -591,8 +634,18 @@ BASE_DIST: ALL_DIST
|
||||
cp $(WXDIR)/src/$$p $(DISTDIR)/src/$$p; \
|
||||
done
|
||||
|
||||
mkdir $(DISTDIR)/samples
|
||||
cp $(SAMPDIR)/Makefile.in $(DISTDIR)/samples
|
||||
cp $(SAMPDIR)/configure $(DISTDIR)/samples
|
||||
cp $(SAMPDIR)/configure.in $(DISTDIR)/samples
|
||||
|
||||
mkdir $(DISTDIR)/samples/console
|
||||
cp $(SAMPDIR)/console/Makefile.in $(DISTDIR)/samples/console
|
||||
cp $(SAMPDIR)/console/makefile.unx $(DISTDIR)/samples/console
|
||||
cp $(SAMPDIR)/console/console.cpp $(DISTDIR)/samples/console
|
||||
cp $(SAMPDIR)/console/testdata.fc $(DISTDIR)/samples/console
|
||||
|
||||
GTK_DIST: ALL_GUI_DIST
|
||||
cp $(WXDIR)/wxGTK.spec $(DISTDIR)
|
||||
cp $(INCDIR)/wx/gtk/*.h $(DISTDIR)/include/wx/gtk
|
||||
cp $(INCDIR)/wx/gtk/*.xpm $(DISTDIR)/include/wx/gtk
|
||||
cp $(GTKDIR)/*.cpp $(DISTDIR)/src/gtk
|
||||
@@ -612,17 +665,30 @@ MOTIF_DIST: ALL_GUI_DIST
|
||||
cp $(MOTIFDIR)/xmcombo/*.h $(DISTDIR)/src/motif/xmcombo
|
||||
cp $(MOTIFDIR)/xmcombo/copying.txt $(DISTDIR)/src/motif/xmcombo
|
||||
|
||||
MACX_DIST: ALL_GUI_DIST
|
||||
echo "Apple Mac OS X specific distribution not complete"
|
||||
|
||||
MSW_DIST: ALL_GUI_DIST
|
||||
cp $(WXDIR)/wxWINE.spec $(DISTDIR)
|
||||
mkdir $(DISTDIR)/include/wx/msw/ctl3d
|
||||
mkdir $(DISTDIR)/include/wx/msw/gnuwin32
|
||||
mkdir $(DISTDIR)/include/wx/msw/gnuwin32/gl
|
||||
mkdir $(DISTDIR)/include/wx/msw/ole
|
||||
cp $(INCDIR)/wx/msw/*.h $(DISTDIR)/include/wx/msw
|
||||
cp $(INCDIR)/wx/msw/*.cur $(DISTDIR)/include/wx/msw
|
||||
cp $(INCDIR)/wx/msw/*.ico $(DISTDIR)/include/wx/msw
|
||||
cp $(INCDIR)/wx/msw/*.bmp $(DISTDIR)/include/wx/msw
|
||||
cp $(INCDIR)/wx/msw/*.rc $(DISTDIR)/include/wx/msw
|
||||
cp $(INCDIR)/wx/msw/ctl3d/*.h $(DISTDIR)/include/wx/msw/ctl3d
|
||||
cp $(INCDIR)/wx/msw/gnuwin32/*.h $(DISTDIR)/include/wx/msw/gnuwin32
|
||||
cp $(INCDIR)/wx/msw/gnuwin32/gl/*.h $(DISTDIR)/include/wx/msw/gnuwin32/gl
|
||||
cp $(INCDIR)/wx/msw/gnuwin32/gl/*.def $(DISTDIR)/include/wx/msw/gnuwin32/gl
|
||||
cp $(INCDIR)/wx/msw/ole/*.h $(DISTDIR)/include/wx/msw/ole
|
||||
|
||||
mkdir $(DISTDIR)/src/msw/ole
|
||||
cp $(MSWDIR)/*.cpp $(DISTDIR)/src/msw
|
||||
cp $(MSWDIR)/*.c $(DISTDIR)/src/msw
|
||||
cp $(MSWDIR)/*.def $(DISTDIR)/src/msw
|
||||
mkdir $(DISTDIR)/src/msw/ole
|
||||
cp $(MSWDIR)/ole/*.cpp $(DISTDIR)/src/msw/ole
|
||||
|
||||
DEMOS_DIST: ALL_GUI_DIST
|
||||
@@ -630,9 +696,9 @@ DEMOS_DIST: ALL_GUI_DIST
|
||||
cp $(DEMODIR)/Makefile.in $(DISTDIR)/demos
|
||||
cp $(DEMODIR)/configure $(DISTDIR)/demos
|
||||
cp $(DEMODIR)/configure.in $(DISTDIR)/demos
|
||||
|
||||
|
||||
cp -R $(DEMODIR)/dbbrowse $(DISTDIR)/demos/dbbrowse
|
||||
|
||||
|
||||
mkdir $(DISTDIR)/demos/bombs
|
||||
cp $(DEMODIR)/bombs/Makefile.in $(DISTDIR)/demos/bombs
|
||||
cp $(DEMODIR)/bombs/makefile.unx $(DISTDIR)/demos/bombs
|
||||
@@ -640,7 +706,7 @@ DEMOS_DIST: ALL_GUI_DIST
|
||||
cp $(DEMODIR)/bombs/*.h $(DISTDIR)/demos/bombs
|
||||
cp $(DEMODIR)/bombs/*.xpm $(DISTDIR)/demos/bombs
|
||||
cp $(DEMODIR)/bombs/readme.txt $(DISTDIR)/demos/bombs
|
||||
|
||||
|
||||
mkdir $(DISTDIR)/demos/forty
|
||||
cp $(DEMODIR)/forty/Makefile.in $(DISTDIR)/demos/forty
|
||||
cp $(DEMODIR)/forty/makefile.unx $(DISTDIR)/demos/forty
|
||||
@@ -648,7 +714,7 @@ DEMOS_DIST: ALL_GUI_DIST
|
||||
cp $(DEMODIR)/forty/*.cpp $(DISTDIR)/demos/forty
|
||||
cp $(DEMODIR)/forty/*.xpm $(DISTDIR)/demos/forty
|
||||
cp $(DEMODIR)/forty/*.xbm $(DISTDIR)/demos/forty
|
||||
|
||||
|
||||
mkdir $(DISTDIR)/demos/life
|
||||
mkdir $(DISTDIR)/demos/life/bitmaps
|
||||
cp $(DEMODIR)/life/Makefile.in $(DISTDIR)/demos/life
|
||||
@@ -657,8 +723,9 @@ DEMOS_DIST: ALL_GUI_DIST
|
||||
cp $(DEMODIR)/life/*.h $(DISTDIR)/demos/life
|
||||
cp $(DEMODIR)/life/*.xpm $(DISTDIR)/demos/life
|
||||
cp $(DEMODIR)/life/*.inc $(DISTDIR)/demos/life
|
||||
cp $(DEMODIR)/life/*.lif $(DISTDIR)/demos/life
|
||||
cp $(DEMODIR)/life/bitmaps/*.xpm $(DISTDIR)/demos/life/bitmaps
|
||||
|
||||
|
||||
mkdir $(DISTDIR)/demos/poem
|
||||
cp $(DEMODIR)/poem/Makefile.in $(DISTDIR)/demos/poem
|
||||
cp $(DEMODIR)/poem/makefile.unx $(DISTDIR)/demos/poem
|
||||
@@ -667,12 +734,12 @@ DEMOS_DIST: ALL_GUI_DIST
|
||||
cp $(DEMODIR)/poem/*.xpm $(DISTDIR)/demos/poem
|
||||
cp $(DEMODIR)/poem/*.dat $(DISTDIR)/demos/poem
|
||||
cp $(DEMODIR)/poem/*.txt $(DISTDIR)/demos/poem
|
||||
|
||||
|
||||
mkdir $(DISTDIR)/demos/fractal
|
||||
cp $(DEMODIR)/fractal/Makefile.in $(DISTDIR)/demos/fractal
|
||||
cp $(DEMODIR)/fractal/makefile.unx $(DISTDIR)/demos/fractal
|
||||
cp $(DEMODIR)/fractal/*.cpp $(DISTDIR)/demos/fractal
|
||||
|
||||
|
||||
SAMPLES_DIST: ALL_GUI_DIST
|
||||
mkdir $(DISTDIR)/samples
|
||||
cp $(SAMPDIR)/Makefile.in $(DISTDIR)/samples
|
||||
@@ -860,8 +927,10 @@ SAMPLES_DIST: ALL_GUI_DIST
|
||||
cp $(SAMPDIR)/internat/*.po $(DISTDIR)/samples/internat
|
||||
cp $(SAMPDIR)/internat/fr/*.mo $(DISTDIR)/samples/internat/fr
|
||||
cp $(SAMPDIR)/internat/de/*.mo $(DISTDIR)/samples/internat/de
|
||||
cp $(SAMPDIR)/internat/ru/*.mo $(DISTDIR)/samples/internat/de
|
||||
cp $(SAMPDIR)/internat/fr/*.po $(DISTDIR)/samples/internat/fr
|
||||
cp $(SAMPDIR)/internat/de/*.po $(DISTDIR)/samples/internat/de
|
||||
cp $(SAMPDIR)/internat/ru/*.po $(DISTDIR)/samples/internat/de
|
||||
|
||||
mkdir $(DISTDIR)/samples/ipc
|
||||
cp $(SAMPDIR)/ipc/Makefile.in $(DISTDIR)/samples/ipc
|
||||
@@ -966,11 +1035,6 @@ SAMPLES_DIST: ALL_GUI_DIST
|
||||
cp $(SAMPDIR)/opengl/isosurf/*.h $(DISTDIR)/samples/opengl/isosurf
|
||||
cp $(SAMPDIR)/opengl/isosurf/*.gz $(DISTDIR)/samples/opengl/isosurf
|
||||
|
||||
mkdir $(DISTDIR)/samples/plot
|
||||
cp $(SAMPDIR)/plot/Makefile.in $(DISTDIR)/samples/plot
|
||||
cp $(SAMPDIR)/plot/makefile.unx $(DISTDIR)/samples/plot
|
||||
cp $(SAMPDIR)/plot/*.cpp $(DISTDIR)/samples/plot
|
||||
|
||||
mkdir $(DISTDIR)/samples/png
|
||||
cp $(SAMPDIR)/png/Makefile.in $(DISTDIR)/samples/png
|
||||
cp $(SAMPDIR)/png/makefile.unx $(DISTDIR)/samples/png
|
||||
@@ -1144,6 +1208,12 @@ MISC_DIST: ALL_GUI_DIST
|
||||
mkdir $(DISTDIR)/misc/gs_afm
|
||||
cp $(MISCDIR)/gs_afm/*.afm $(DISTDIR)/misc/gs_afm
|
||||
|
||||
INTL_DIST:
|
||||
mkdir $(DISTDIR)/locale
|
||||
cp $(INTLDIR)/Makefile $(DISTDIR)/locale
|
||||
cp $(INTLDIR)/*.po $(DISTDIR)/locale
|
||||
-cp $(INTLDIR)/*.mo $(DISTDIR)/locale
|
||||
|
||||
MANUAL_DIST:
|
||||
mkdir $(DISTDIR)/docs
|
||||
mkdir $(DISTDIR)/docs/latex
|
||||
@@ -1158,53 +1228,113 @@ MANUAL_DIST:
|
||||
# those files needed for the Debian source package.
|
||||
# see utils/wxPython/distrib for scripts to make a proper wxPython dist.
|
||||
PYTHON_DIST:
|
||||
mkdir $(DISTDIR)/utils/wxPython
|
||||
mkdir $(DISTDIR)/utils/wxPython/demo
|
||||
mkdir $(DISTDIR)/utils/wxPython/demo/bitmaps
|
||||
mkdir $(DISTDIR)/utils/wxPython/demo/data
|
||||
mkdir $(DISTDIR)/utils/wxPython/distrib
|
||||
mkdir $(DISTDIR)/utils/wxPython/lib
|
||||
mkdir $(DISTDIR)/utils/wxPython/lib/editor
|
||||
mkdir $(DISTDIR)/utils/wxPython/lib/sizers
|
||||
mkdir $(DISTDIR)/utils/wxPython/modules
|
||||
mkdir $(DISTDIR)/utils/wxPython/modules/html
|
||||
mkdir $(DISTDIR)/utils/wxPython/modules/utils
|
||||
mkdir $(DISTDIR)/utils/wxPython/modules/utils/gtk
|
||||
mkdir $(DISTDIR)/utils/wxPython/src
|
||||
mkdir $(DISTDIR)/utils/wxPython/src/gtk
|
||||
mkdir $(DISTDIR)/wxPython
|
||||
mkdir $(DISTDIR)/wxPython/contrib
|
||||
mkdir $(DISTDIR)/wxPython/contrib/glcanvas
|
||||
mkdir $(DISTDIR)/wxPython/contrib/glcanvas/gtk
|
||||
mkdir $(DISTDIR)/wxPython/contrib/ogl
|
||||
mkdir $(DISTDIR)/wxPython/contrib/stc
|
||||
mkdir $(DISTDIR)/wxPython/demo
|
||||
mkdir $(DISTDIR)/wxPython/demo/bitmaps
|
||||
mkdir $(DISTDIR)/wxPython/demo/data
|
||||
mkdir $(DISTDIR)/wxPython/src
|
||||
mkdir $(DISTDIR)/wxPython/src/gtk
|
||||
mkdir $(DISTDIR)/wxPython/wxPython
|
||||
mkdir $(DISTDIR)/wxPython/wxPython/lib
|
||||
mkdir $(DISTDIR)/wxPython/wxPython/lib/editor
|
||||
mkdir $(DISTDIR)/wxPython/wxPython/lib/sizers
|
||||
|
||||
cp $(UTILSDIR)/wxPython/*.txt $(DISTDIR)/utils/wxPython
|
||||
-cp $(UTILSDIR)/wxPython/demo/* $(DISTDIR)/utils/wxPython/demo
|
||||
-cp $(UTILSDIR)/wxPython/demo/bitmaps/* $(DISTDIR)/utils/wxPython/demo/bitmaps
|
||||
-cp $(UTILSDIR)/wxPython/demo/data/* $(DISTDIR)/utils/wxPython/demo/data
|
||||
cp $(UTILSDIR)/wxPython/distrib/build.py $(DISTDIR)/utils/wxPython/distrib
|
||||
cp $(UTILSDIR)/wxPython/lib/*.py $(DISTDIR)/utils/wxPython/lib
|
||||
cp $(UTILSDIR)/wxPython/lib/editor/*.py $(DISTDIR)/utils/wxPython/lib/editor
|
||||
cp $(UTILSDIR)/wxPython/lib/sizers/*.py $(DISTDIR)/utils/wxPython/lib/sizers
|
||||
-cp $(UTILSDIR)/wxPython/modules/html/* $(DISTDIR)/utils/wxPython/modules/html
|
||||
-cp $(UTILSDIR)/wxPython/modules/utils/* $(DISTDIR)/utils/wxPython/modules/utils
|
||||
cp $(UTILSDIR)/wxPython/modules/utils/gtk/utils.* $(DISTDIR)/utils/wxPython/modules/utils/gtk
|
||||
-cp $(UTILSDIR)/wxPython/src/* $(DISTDIR)/utils/wxPython/src
|
||||
cp $(UTILSDIR)/wxPython/src/gtk/*.py $(DISTDIR)/utils/wxPython/src/gtk
|
||||
cp $(UTILSDIR)/wxPython/src/gtk/*.cpp $(DISTDIR)/utils/wxPython/src/gtk
|
||||
cp $(WXDIR)/wxPython/*.txt $(DISTDIR)/wxPython
|
||||
cp $(WXDIR)/wxPython/*.py $(DISTDIR)/wxPython
|
||||
cp $(WXDIR)/wxPython/setup.cfg $(DISTDIR)/wxPython
|
||||
cp $(WXDIR)/wxPython/MANIFEST.in $(DISTDIR)/wxPython
|
||||
-cp $(WXDIR)/wxPython/contrib/glcanvas/* $(DISTDIR)/wxPython/contrib/glcanvas
|
||||
cp $(WXDIR)/wxPython/contrib/glcanvas/gtk/glcanvas.* $(DISTDIR)/wxPython/contrib/glcanvas/gtk
|
||||
-cp $(WXDIR)/wxPython/contrib/ogl/* $(DISTDIR)/wxPython/contrib/ogl
|
||||
-cp $(WXDIR)/wxPython/contrib/stc/* $(DISTDIR)/wxPython/contrib/stc
|
||||
-cp $(WXDIR)/wxPython/demo/* $(DISTDIR)/wxPython/demo
|
||||
-cp $(WXDIR)/wxPython/demo/bitmaps/* $(DISTDIR)/wxPython/demo/bitmaps
|
||||
-cp $(WXDIR)/wxPython/demo/data/* $(DISTDIR)/wxPython/demo/data
|
||||
-cp $(WXDIR)/wxPython/src/* $(DISTDIR)/wxPython/src
|
||||
cp $(WXDIR)/wxPython/src/gtk/*.py $(DISTDIR)/wxPython/src/gtk
|
||||
cp $(WXDIR)/wxPython/src/gtk/*.cpp $(DISTDIR)/wxPython/src/gtk
|
||||
cp $(WXDIR)/wxPython/wxPython/lib/*.py $(DISTDIR)/wxPython/wxPython/lib
|
||||
cp $(WXDIR)/wxPython/wxPython/lib/editor/*.py $(DISTDIR)/wxPython/wxPython/lib/editor
|
||||
|
||||
distclean:
|
||||
$(RM) -r _dist_dir
|
||||
|
||||
dist: @GUIDIST@
|
||||
# VZ: the -only targets allow to do "make dist bzip-dist-only" without copying
|
||||
# the files twice
|
||||
dist-only:
|
||||
@echo "*** Creating wxWindows distribution in $(DISTDIR)..."
|
||||
cd _dist_dir; tar ch @DISTDIR@ | gzip -f9 > $(WXARCHIVE); mv $(WXARCHIVE) ..
|
||||
@cd _dist_dir; \
|
||||
mv @DISTDIR@ @DISTDIR@-$(VER_SUFFIX); \
|
||||
tar ch @DISTDIR@-$(VER_SUFFIX) | gzip -f9 > ../$(WXARCHIVE); \
|
||||
mv @DISTDIR@-$(VER_SUFFIX) @DISTDIR@
|
||||
@if test "$(USE_GUI)" = 1; then \
|
||||
cd $(DISTDIR); \
|
||||
mv samples wxSamples; \
|
||||
tar ch wxSamples | gzip -f9 > ../../$(WXSAMPLES); \
|
||||
mv wxSamples samples; \
|
||||
mv demos wxDemos; \
|
||||
tar ch wxDemos | gzip -f9 > ../../$(WXDEMOS); \
|
||||
mv wxDemos demos; \
|
||||
mv samples wxSamples-$(VER_SUFFIX); \
|
||||
echo "*** Creating wxSamples archive..."; \
|
||||
tar ch wxSamples-$(VER_SUFFIX) | gzip -f9 > ../../$(WXSAMPLES); \
|
||||
mv wxSamples-$(VER_SUFFIX) samples; \
|
||||
mv demos wxDemos-$(VER_SUFFIX); \
|
||||
echo "*** Creating wxDemos archive..."; \
|
||||
tar ch wxDemos-$(VER_SUFFIX) | gzip -f9 > ../../$(WXDEMOS); \
|
||||
mv wxDemos-$(VER_SUFFIX) demos; \
|
||||
fi
|
||||
|
||||
debian-dist: @GUIDIST@ MANUAL_DIST PYTHON_DIST
|
||||
dist: @GUIDIST@
|
||||
cp $(WXDIR)/src/files.lst $(DISTDIR)/src/
|
||||
@echo "*** Creating wxWindows distribution in $(DISTDIR)..."
|
||||
@cd _dist_dir; \
|
||||
mv @DISTDIR@ @DISTDIR@-$(VER_SUFFIX); \
|
||||
tar ch @DISTDIR@-$(VER_SUFFIX) | gzip -f9 > ../$(WXARCHIVE); \
|
||||
mv @DISTDIR@-$(VER_SUFFIX) @DISTDIR@
|
||||
@if test "$(USE_GUI)" = 1; then \
|
||||
cd $(DISTDIR); \
|
||||
mv samples wxSamples-$(VER_SUFFIX); \
|
||||
echo "*** Creating wxSamples archive..."; \
|
||||
tar ch wxSamples-$(VER_SUFFIX) | gzip -f9 > ../../$(WXSAMPLES); \
|
||||
mv wxSamples-$(VER_SUFFIX) samples; \
|
||||
mv demos wxDemos-$(VER_SUFFIX); \
|
||||
echo "*** Creating wxDemos archive..."; \
|
||||
tar ch wxDemos-$(VER_SUFFIX) | gzip -f9 > ../../$(WXDEMOS); \
|
||||
mv wxDemos-$(VER_SUFFIX) demos; \
|
||||
fi
|
||||
|
||||
bzip-dist-only:
|
||||
@echo "*** Creating wxWindows distribution in $(DISTDIR)..."
|
||||
@cd _dist_dir; tar ch @DISTDIR@ | bzip2 -f9 > $(WXARCHIVE_BZIP); mv $(WXARCHIVE_BZIP) ..
|
||||
@if test "$(USE_GUI)" = 1; then \
|
||||
cd $(DISTDIR); \
|
||||
mv samples wxSamples-${VER_SUFFIX}; \
|
||||
echo "*** Creating wxSamples archive..."; \
|
||||
tar ch wxSamples-${VER_SUFFIX} | bzip2 -f9 > ../../$(WXSAMPLES_BZIP); \
|
||||
mv wxSamples-${VER_SUFFIX} samples; \
|
||||
mv demos wxDemos-${VER_SUFFIX}; \
|
||||
echo "*** Creating wxDemos archive..."; \
|
||||
tar ch wxDemos-${VER_SUFFIX} | bzip2 -f9 > ../../$(WXDEMOS_BZIP); \
|
||||
mv wxDemos-${VER_SUFFIX} demos; \
|
||||
fi
|
||||
|
||||
bzip-dist: @GUIDIST@
|
||||
cp $(WXDIR)/src/files.lst $(DISTDIR)/src/
|
||||
@echo "*** Creating wxWindows distribution in $(DISTDIR)..."
|
||||
cd _dist_dir; tar ch @DISTDIR@ | bzip2 -f9 > $(WXARCHIVE_BZIP); mv $(WXARCHIVE_BZIP) ..
|
||||
@if test "$(USE_GUI)" = 1; then \
|
||||
cd $(DISTDIR); \
|
||||
mv samples wxSamples-${VER_SUFFIX}; \
|
||||
echo "*** Creating wxSamples archive..."; \
|
||||
tar ch wxSamples-${VER_SUFFIX} | bzip2 -f9 > ../../$(WXSAMPLES_BZIP); \
|
||||
mv wxSamples-${VER_SUFFIX} samples; \
|
||||
mv demos wxDemos-${VER_SUFFIX}; \
|
||||
echo "*** Creating wxDemos archive..."; \
|
||||
tar ch wxDemos-${VER_SUFFIX} | bzip2 -f9 > ../../$(WXDEMOS_BZIP); \
|
||||
mv wxDemos-${VER_SUFFIX} demos; \
|
||||
fi
|
||||
|
||||
debian-dist: debian-native-dist debian-msw-dirs MSW_DIST
|
||||
mkdir $(DISTDIR)/debian
|
||||
-cp $(WXDIR)/debian/* $(DISTDIR)/debian
|
||||
cp $(WXDIR)/src/files.lst $(DISTDIR)/src/
|
||||
@@ -1212,14 +1342,32 @@ debian-dist: @GUIDIST@ MANUAL_DIST PYTHON_DIST
|
||||
cp $(DOCDIR)/licendoc.txt $(DISTDIR)/docs
|
||||
cp $(DOCDIR)/preamble.txt $(DISTDIR)/docs
|
||||
rm -f $(DISTDIR)/*.spec
|
||||
|
||||
@# now prune away a lot of the crap included by using cp -R
|
||||
@# in other dist targets. Ugly and hardly portable but it
|
||||
@# will run on any Debian box and that's enough for now.
|
||||
|
||||
find $(DISTDIR) \( -name "CVS" -o -name "*.dsp" -o -name "*.dsw" -o -name "*.hh*" -o \
|
||||
\( -name "makefile.*" -a ! -name "makefile.unx" \) \) \
|
||||
-print0 | xargs -0 rm -rf
|
||||
|
||||
rm -rf $(WXDIR)/../wxwindows$(WX_MAJOR_VERSION_NUMBER).$(WX_MINOR_VERSION_NUMBER)-$(WX_MAJOR_VERSION_NUMBER).$(WX_MINOR_VERSION_NUMBER).$(WX_RELEASE_NUMBER)
|
||||
mv $(DISTDIR) $(WXDIR)/../wxwindows$(WX_MAJOR_VERSION_NUMBER).$(WX_MINOR_VERSION_NUMBER)-$(WX_MAJOR_VERSION_NUMBER).$(WX_MINOR_VERSION_NUMBER).$(WX_RELEASE_NUMBER)
|
||||
|
||||
debian-native-dist: @GUIDIST@ MANUAL_DIST PYTHON_DIST
|
||||
|
||||
debian-msw-dirs:
|
||||
mkdir $(DISTDIR)/include/wx/msw
|
||||
mkdir $(DISTDIR)/src/msw
|
||||
cp $(WXDIR)/src/msw/files.lst $(DISTDIR)/src/msw
|
||||
|
||||
|
||||
clean:
|
||||
$(RM) *.o
|
||||
$(RM) *.d
|
||||
$(RM) parser.c
|
||||
$(RM) lexer.c
|
||||
$(RM) -r ./lib/*
|
||||
$(RM) -r ./lib/wx/*
|
||||
$(RM) ./lib/lib*
|
||||
|
||||
cleanall: clean
|
||||
|
||||
878
config.guess
vendored
588
config.sub
vendored
@@ -1,6 +1,10 @@
|
||||
#! /bin/sh
|
||||
# Configuration validation subroutine script, version 1.1.
|
||||
# Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc.
|
||||
# Configuration validation subroutine script.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2001-09-07'
|
||||
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
# can handle that machine. It does not imply ALL GNU software can.
|
||||
@@ -25,6 +29,8 @@
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Please send patches to <config-patches@gnu.org>.
|
||||
#
|
||||
# Configuration subroutine to validate and canonicalize a configuration type.
|
||||
# Supply the specified configuration type as an argument.
|
||||
# If it is invalid, we print an error message on stderr and exit with code 1.
|
||||
@@ -45,30 +51,73 @@
|
||||
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||
# It is wrong to echo any other type of specification.
|
||||
|
||||
if [ x$1 = x ]
|
||||
then
|
||||
echo Configuration name missing. 1>&2
|
||||
echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
|
||||
echo "or $0 ALIAS" 1>&2
|
||||
echo where ALIAS is a recognized configuration type. 1>&2
|
||||
exit 1
|
||||
fi
|
||||
me=`echo "$0" | sed -e 's,.*/,,'`
|
||||
|
||||
# First pass through any local machine types.
|
||||
case $1 in
|
||||
*local*)
|
||||
echo $1
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
usage="\
|
||||
Usage: $0 [OPTION] CPU-MFR-OPSYS
|
||||
$0 [OPTION] ALIAS
|
||||
|
||||
Canonicalize a configuration name.
|
||||
|
||||
Operation modes:
|
||||
-h, --help print this help, then exit
|
||||
-t, --time-stamp print date of last modification, then exit
|
||||
-v, --version print version number, then exit
|
||||
|
||||
Report bugs and patches to <config-patches@gnu.org>."
|
||||
|
||||
version="\
|
||||
GNU config.sub ($timestamp)
|
||||
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
|
||||
help="
|
||||
Try \`$me --help' for more information."
|
||||
|
||||
# Parse command line
|
||||
while test $# -gt 0 ; do
|
||||
case $1 in
|
||||
--time-stamp | --time* | -t )
|
||||
echo "$timestamp" ; exit 0 ;;
|
||||
--version | -v )
|
||||
echo "$version" ; exit 0 ;;
|
||||
--help | --h* | -h )
|
||||
echo "$usage"; exit 0 ;;
|
||||
-- ) # Stop option processing
|
||||
shift; break ;;
|
||||
- ) # Use stdin as input.
|
||||
break ;;
|
||||
-* )
|
||||
echo "$me: invalid option $1$help"
|
||||
exit 1 ;;
|
||||
|
||||
*local*)
|
||||
# First pass through any local machine types.
|
||||
echo $1
|
||||
exit 0;;
|
||||
|
||||
* )
|
||||
break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
case $# in
|
||||
0) echo "$me: missing argument$help" >&2
|
||||
exit 1;;
|
||||
1) ;;
|
||||
*) echo "$me: too many arguments$help" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
|
||||
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
|
||||
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||
case $maybe_os in
|
||||
linux-gnu*)
|
||||
nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*)
|
||||
os=-$maybe_os
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||
;;
|
||||
@@ -94,15 +143,33 @@ case $os in
|
||||
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
||||
-apple)
|
||||
-apple | -axis)
|
||||
os=
|
||||
basic_machine=$1
|
||||
;;
|
||||
-sim | -cisco | -oki | -wec | -winbond)
|
||||
os=
|
||||
basic_machine=$1
|
||||
;;
|
||||
-scout)
|
||||
;;
|
||||
-wrs)
|
||||
os=-vxworks
|
||||
basic_machine=$1
|
||||
;;
|
||||
-chorusos*)
|
||||
os=-chorusos
|
||||
basic_machine=$1
|
||||
;;
|
||||
-chorusrdb)
|
||||
os=-chorusrdb
|
||||
basic_machine=$1
|
||||
;;
|
||||
-hiux*)
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
-sco5)
|
||||
os=sco3.2v5
|
||||
os=-sco3.2v5
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco4)
|
||||
@@ -121,6 +188,9 @@ case $os in
|
||||
os=-sco3.2v2
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-udk*)
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-isc)
|
||||
os=-isc2.2
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
@@ -143,26 +213,60 @@ case $os in
|
||||
-psos*)
|
||||
os=-psos
|
||||
;;
|
||||
-mint | -mint[0-9]*)
|
||||
basic_machine=m68k-atari
|
||||
os=-mint
|
||||
;;
|
||||
esac
|
||||
|
||||
# Decode aliases for certain CPU-COMPANY combinations.
|
||||
case $basic_machine in
|
||||
# Recognize the basic CPU types without company name.
|
||||
# Some are omitted here because they have special meanings below.
|
||||
tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
|
||||
| arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \
|
||||
| 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 | hppa2.0 \
|
||||
| alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \
|
||||
| i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \
|
||||
| mips64 | mipsel | mips64el | mips64orion | mips64orionel \
|
||||
| mipstx39 | mipstx39el \
|
||||
| sparc | sparclet | sparclite | sparc64 | v850)
|
||||
1750a | 580 \
|
||||
| a29k \
|
||||
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
|
||||
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
|
||||
| c4x | clipper \
|
||||
| d10v | d30v | dsp16xx \
|
||||
| fr30 \
|
||||
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
||||
| i370 | i860 | i960 | ia64 \
|
||||
| m32r | m68000 | m68k | m88k | mcore \
|
||||
| mips16 | mips64 | mips64el | mips64orion | mips64orionel \
|
||||
| mips64vr4100 | mips64vr4100el | mips64vr4300 \
|
||||
| mips64vr4300el | mips64vr5000 | mips64vr5000el \
|
||||
| mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \
|
||||
| mipsisa32 \
|
||||
| mn10200 | mn10300 \
|
||||
| ns16k | ns32k \
|
||||
| openrisc \
|
||||
| pdp10 | pdp11 | pj | pjl \
|
||||
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
|
||||
| pyramid \
|
||||
| s390 | s390x \
|
||||
| sh | sh[34] | sh[34]eb | shbe | shle \
|
||||
| sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \
|
||||
| stormy16 | strongarm \
|
||||
| tahoe | thumb | tic80 | tron \
|
||||
| v850 \
|
||||
| we32k \
|
||||
| x86 | xscale \
|
||||
| z8k)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
m6811 | m68hc11 | m6812 | m68hc12)
|
||||
# Motorola 68HC11/12.
|
||||
basic_machine=$basic_machine-unknown
|
||||
os=-none
|
||||
;;
|
||||
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
|
||||
;;
|
||||
|
||||
# We use `pc' rather than `unknown'
|
||||
# because (1) that's what they normally are, and
|
||||
# (2) the word "unknown" tends to confuse beginning users.
|
||||
i[34567]86)
|
||||
i*86 | x86_64)
|
||||
basic_machine=$basic_machine-pc
|
||||
;;
|
||||
# Object if more than one company name word.
|
||||
@@ -171,27 +275,64 @@ case $basic_machine in
|
||||
exit 1
|
||||
;;
|
||||
# Recognize the basic CPU types with company name.
|
||||
vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \
|
||||
| m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
|
||||
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
|
||||
| power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \
|
||||
| xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* \
|
||||
| alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \
|
||||
| ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \
|
||||
| sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
|
||||
| sparc64-* | mips64-* | mipsel-* \
|
||||
| mips64el-* | mips64orion-* | mips64orionel-* \
|
||||
| mipstx39-* | mipstx39el-* \
|
||||
| f301-*)
|
||||
580-* \
|
||||
| a29k-* \
|
||||
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
|
||||
| alphapca5[67]-* | arc-* \
|
||||
| arm-* | armbe-* | armle-* | armv*-* \
|
||||
| bs2000-* \
|
||||
| c[123]* | c30-* | [cjt]90-* | c54x-* \
|
||||
| clipper-* | cray2-* | cydra-* \
|
||||
| d10v-* | d30v-* \
|
||||
| elxsi-* \
|
||||
| f30[01]-* | f700-* | fr30-* | fx80-* \
|
||||
| h8300-* | h8500-* \
|
||||
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
||||
| i*86-* | i860-* | i960-* | ia64-* \
|
||||
| m32r-* \
|
||||
| m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \
|
||||
| m88110-* | m88k-* | mcore-* \
|
||||
| mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \
|
||||
| mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \
|
||||
| mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \
|
||||
| mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \
|
||||
| none-* | np1-* | ns16k-* | ns32k-* \
|
||||
| orion-* \
|
||||
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
|
||||
| pyramid-* \
|
||||
| romp-* | rs6000-* \
|
||||
| s390-* | s390x-* \
|
||||
| sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \
|
||||
| sparc-* | sparc64-* | sparc86x-* | sparclite-* \
|
||||
| sparcv9-* | sparcv9b-* | stormy16-* | strongarm-* | sv1-* \
|
||||
| t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \
|
||||
| v850-* | vax-* \
|
||||
| we32k-* \
|
||||
| x86-* | x86_64-* | xmp-* | xps100-* | xscale-* \
|
||||
| ymp-* \
|
||||
| z8k-*)
|
||||
;;
|
||||
# Recognize the various machine names and aliases which stand
|
||||
# for a CPU type and a company and sometimes even an OS.
|
||||
386bsd)
|
||||
basic_machine=i386-unknown
|
||||
os=-bsd
|
||||
;;
|
||||
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
|
||||
basic_machine=m68000-att
|
||||
;;
|
||||
3b*)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
a29khif)
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
;;
|
||||
adobe68k)
|
||||
basic_machine=m68010-adobe
|
||||
os=-scout
|
||||
;;
|
||||
alliant | fx80)
|
||||
basic_machine=fx80-alliant
|
||||
;;
|
||||
@@ -207,20 +348,24 @@ case $basic_machine in
|
||||
os=-sysv
|
||||
;;
|
||||
amiga | amiga-*)
|
||||
basic_machine=m68k-cbm
|
||||
basic_machine=m68k-unknown
|
||||
;;
|
||||
amigaos | amigados)
|
||||
basic_machine=m68k-cbm
|
||||
basic_machine=m68k-unknown
|
||||
os=-amigaos
|
||||
;;
|
||||
amigaunix | amix)
|
||||
basic_machine=m68k-cbm
|
||||
basic_machine=m68k-unknown
|
||||
os=-sysv4
|
||||
;;
|
||||
apollo68)
|
||||
basic_machine=m68k-apollo
|
||||
os=-sysv
|
||||
;;
|
||||
apollo68bsd)
|
||||
basic_machine=m68k-apollo
|
||||
os=-bsd
|
||||
;;
|
||||
aux)
|
||||
basic_machine=m68k-apple
|
||||
os=-aux
|
||||
@@ -257,13 +402,16 @@ case $basic_machine in
|
||||
basic_machine=cray2-cray
|
||||
os=-unicos
|
||||
;;
|
||||
[ctj]90-cray)
|
||||
basic_machine=c90-cray
|
||||
[cjt]90)
|
||||
basic_machine=${basic_machine}-cray
|
||||
os=-unicos
|
||||
;;
|
||||
crds | unos)
|
||||
basic_machine=m68k-crds
|
||||
;;
|
||||
cris | cris-* | etrax*)
|
||||
basic_machine=cris-axis
|
||||
;;
|
||||
da30 | da30-*)
|
||||
basic_machine=m68k-da30
|
||||
;;
|
||||
@@ -297,6 +445,10 @@ case $basic_machine in
|
||||
encore | umax | mmax)
|
||||
basic_machine=ns32k-encore
|
||||
;;
|
||||
es1800 | OSE68k | ose68k | ose | OSE)
|
||||
basic_machine=m68k-ericsson
|
||||
os=-ose
|
||||
;;
|
||||
fx2800)
|
||||
basic_machine=i860-alliant
|
||||
;;
|
||||
@@ -307,6 +459,10 @@ case $basic_machine in
|
||||
basic_machine=tron-gmicro
|
||||
os=-sysv
|
||||
;;
|
||||
go32)
|
||||
basic_machine=i386-pc
|
||||
os=-go32
|
||||
;;
|
||||
h3050r* | hiux*)
|
||||
basic_machine=hppa1.1-hitachi
|
||||
os=-hiuxwe2
|
||||
@@ -315,6 +471,14 @@ case $basic_machine in
|
||||
basic_machine=h8300-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
h8300xray)
|
||||
basic_machine=h8300-hitachi
|
||||
os=-xray
|
||||
;;
|
||||
h8500hms)
|
||||
basic_machine=h8500-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
harris)
|
||||
basic_machine=m88k-harris
|
||||
os=-sysv3
|
||||
@@ -330,13 +494,30 @@ case $basic_machine in
|
||||
basic_machine=m68k-hp
|
||||
os=-hpux
|
||||
;;
|
||||
hp3k9[0-9][0-9] | hp9[0-9][0-9])
|
||||
basic_machine=hppa1.0-hp
|
||||
;;
|
||||
hp9k2[0-9][0-9] | hp9k31[0-9])
|
||||
basic_machine=m68000-hp
|
||||
;;
|
||||
hp9k3[2-9][0-9])
|
||||
basic_machine=m68k-hp
|
||||
;;
|
||||
hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
|
||||
hp9k6[0-9][0-9] | hp6[0-9][0-9])
|
||||
basic_machine=hppa1.0-hp
|
||||
;;
|
||||
hp9k7[0-79][0-9] | hp7[0-79][0-9])
|
||||
basic_machine=hppa1.1-hp
|
||||
;;
|
||||
hp9k78[0-9] | hp78[0-9])
|
||||
# FIXME: really hppa2.0-hp
|
||||
basic_machine=hppa1.1-hp
|
||||
;;
|
||||
hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
|
||||
# FIXME: really hppa2.0-hp
|
||||
basic_machine=hppa1.1-hp
|
||||
;;
|
||||
hp9k8[0-9][13679] | hp8[0-9][13679])
|
||||
basic_machine=hppa1.1-hp
|
||||
;;
|
||||
hp9k8[0-9][0-9] | hp8[0-9][0-9])
|
||||
@@ -345,27 +526,42 @@ case $basic_machine in
|
||||
hppa-next)
|
||||
os=-nextstep3
|
||||
;;
|
||||
hppaosf)
|
||||
basic_machine=hppa1.1-hp
|
||||
os=-osf
|
||||
;;
|
||||
hppro)
|
||||
basic_machine=hppa1.1-hp
|
||||
os=-proelf
|
||||
;;
|
||||
i370-ibm* | ibm*)
|
||||
basic_machine=i370-ibm
|
||||
os=-mvs
|
||||
;;
|
||||
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
|
||||
i[34567]86v32)
|
||||
i*86v32)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv32
|
||||
;;
|
||||
i[34567]86v4*)
|
||||
i*86v4*)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv4
|
||||
;;
|
||||
i[34567]86v)
|
||||
i*86v)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv
|
||||
;;
|
||||
i[34567]86sol2)
|
||||
i*86sol2)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-solaris2
|
||||
;;
|
||||
i386mach)
|
||||
basic_machine=i386-mach
|
||||
os=-mach
|
||||
;;
|
||||
i386-vsta | vsta)
|
||||
basic_machine=i386-unknown
|
||||
os=-vsta
|
||||
;;
|
||||
iris | iris4d)
|
||||
basic_machine=mips-sgi
|
||||
case $os in
|
||||
@@ -391,9 +587,17 @@ case $basic_machine in
|
||||
basic_machine=ns32k-utek
|
||||
os=-sysv
|
||||
;;
|
||||
mingw32)
|
||||
basic_machine=i386-pc
|
||||
os=-mingw32
|
||||
;;
|
||||
miniframe)
|
||||
basic_machine=m68000-convergent
|
||||
;;
|
||||
*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
|
||||
basic_machine=m68k-atari
|
||||
os=-mint
|
||||
;;
|
||||
mipsel*-linux*)
|
||||
basic_machine=mipsel-unknown
|
||||
os=-linux-gnu
|
||||
@@ -408,10 +612,34 @@ case $basic_machine in
|
||||
mips3*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
|
||||
;;
|
||||
mmix*)
|
||||
basic_machine=mmix-knuth
|
||||
os=-mmixware
|
||||
;;
|
||||
monitor)
|
||||
basic_machine=m68k-rom68k
|
||||
os=-coff
|
||||
;;
|
||||
msdos)
|
||||
basic_machine=i386-pc
|
||||
os=-msdos
|
||||
;;
|
||||
mvs)
|
||||
basic_machine=i370-ibm
|
||||
os=-mvs
|
||||
;;
|
||||
ncr3000)
|
||||
basic_machine=i486-ncr
|
||||
os=-sysv4
|
||||
;;
|
||||
netbsd386)
|
||||
basic_machine=i386-unknown
|
||||
os=-netbsd
|
||||
;;
|
||||
netwinder)
|
||||
basic_machine=armv4l-rebel
|
||||
os=-linux
|
||||
;;
|
||||
news | news700 | news800 | news900)
|
||||
basic_machine=m68k-sony
|
||||
os=-newsos
|
||||
@@ -424,6 +652,10 @@ case $basic_machine in
|
||||
basic_machine=mips-sony
|
||||
os=-newsos
|
||||
;;
|
||||
necv70)
|
||||
basic_machine=v70-nec
|
||||
os=-sysv
|
||||
;;
|
||||
next | m*-next )
|
||||
basic_machine=m68k-next
|
||||
case $os in
|
||||
@@ -449,9 +681,32 @@ case $basic_machine in
|
||||
basic_machine=i960-intel
|
||||
os=-nindy
|
||||
;;
|
||||
mon960)
|
||||
basic_machine=i960-intel
|
||||
os=-mon960
|
||||
;;
|
||||
nonstopux)
|
||||
basic_machine=mips-compaq
|
||||
os=-nonstopux
|
||||
;;
|
||||
np1)
|
||||
basic_machine=np1-gould
|
||||
;;
|
||||
nsr-tandem)
|
||||
basic_machine=nsr-tandem
|
||||
;;
|
||||
op50n-* | op60c-*)
|
||||
basic_machine=hppa1.1-oki
|
||||
os=-proelf
|
||||
;;
|
||||
OSE68000 | ose68000)
|
||||
basic_machine=m68000-ericsson
|
||||
os=-ose
|
||||
;;
|
||||
os68k)
|
||||
basic_machine=m68k-none
|
||||
os=-os68k
|
||||
;;
|
||||
pa-hitachi)
|
||||
basic_machine=hppa1.1-hitachi
|
||||
os=-hiuxwe2
|
||||
@@ -469,28 +724,28 @@ case $basic_machine in
|
||||
pc532 | pc532-*)
|
||||
basic_machine=ns32k-pc532
|
||||
;;
|
||||
pentium | p5 | k5 | nexen)
|
||||
pentium | p5 | k5 | k6 | nexgen)
|
||||
basic_machine=i586-pc
|
||||
;;
|
||||
pentiumpro | p6 | k6 | 6x86)
|
||||
pentiumpro | p6 | 6x86 | athlon)
|
||||
basic_machine=i686-pc
|
||||
;;
|
||||
pentiumii | pentium2)
|
||||
basic_machine=i786-pc
|
||||
basic_machine=i686-pc
|
||||
;;
|
||||
pentium-* | p5-* | k5-* | nexen-*)
|
||||
pentium-* | p5-* | k5-* | k6-* | nexgen-*)
|
||||
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentiumpro-* | p6-* | k6-* | 6x86-*)
|
||||
pentiumpro-* | p6-* | 6x86-* | athlon-*)
|
||||
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentiumii-* | pentium2-*)
|
||||
basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pn)
|
||||
basic_machine=pn-gould
|
||||
;;
|
||||
power) basic_machine=rs6000-ibm
|
||||
power) basic_machine=power-ibm
|
||||
;;
|
||||
ppc) basic_machine=powerpc-unknown
|
||||
;;
|
||||
@@ -502,15 +757,37 @@ case $basic_machine in
|
||||
ppcle-* | powerpclittle-*)
|
||||
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ppc64) basic_machine=powerpc64-unknown
|
||||
;;
|
||||
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ppc64le | powerpc64little | ppc64-le | powerpc64-little)
|
||||
basic_machine=powerpc64le-unknown
|
||||
;;
|
||||
ppc64le-* | powerpc64little-*)
|
||||
basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ps2)
|
||||
basic_machine=i386-ibm
|
||||
;;
|
||||
pw32)
|
||||
basic_machine=i586-unknown
|
||||
os=-pw32
|
||||
;;
|
||||
rom68k)
|
||||
basic_machine=m68k-rom68k
|
||||
os=-coff
|
||||
;;
|
||||
rm[46]00)
|
||||
basic_machine=mips-siemens
|
||||
;;
|
||||
rtpc | rtpc-*)
|
||||
basic_machine=romp-ibm
|
||||
;;
|
||||
sa29200)
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
;;
|
||||
sequent)
|
||||
basic_machine=i386-sequent
|
||||
;;
|
||||
@@ -518,6 +795,10 @@ case $basic_machine in
|
||||
basic_machine=sh-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
sparclite-wrs)
|
||||
basic_machine=sparclite-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
sps7)
|
||||
basic_machine=m68k-bull
|
||||
os=-sysv2
|
||||
@@ -525,6 +806,13 @@ case $basic_machine in
|
||||
spur)
|
||||
basic_machine=spur-unknown
|
||||
;;
|
||||
st2000)
|
||||
basic_machine=m68k-tandem
|
||||
;;
|
||||
stratus)
|
||||
basic_machine=i860-stratus
|
||||
os=-sysv4
|
||||
;;
|
||||
sun2)
|
||||
basic_machine=m68000-sun
|
||||
;;
|
||||
@@ -565,10 +853,22 @@ case $basic_machine in
|
||||
sun386 | sun386i | roadrunner)
|
||||
basic_machine=i386-sun
|
||||
;;
|
||||
sv1)
|
||||
basic_machine=sv1-cray
|
||||
os=-unicos
|
||||
;;
|
||||
symmetry)
|
||||
basic_machine=i386-sequent
|
||||
os=-dynix
|
||||
;;
|
||||
t3e)
|
||||
basic_machine=t3e-cray
|
||||
os=-unicos
|
||||
;;
|
||||
tic54x | c54x*)
|
||||
basic_machine=tic54x-unknown
|
||||
os=-coff
|
||||
;;
|
||||
tx39)
|
||||
basic_machine=mipstx39-unknown
|
||||
;;
|
||||
@@ -586,6 +886,10 @@ case $basic_machine in
|
||||
basic_machine=a29k-nyu
|
||||
os=-sym1
|
||||
;;
|
||||
v810 | necv810)
|
||||
basic_machine=v810-nec
|
||||
os=-none
|
||||
;;
|
||||
vaxv)
|
||||
basic_machine=vax-dec
|
||||
os=-sysv
|
||||
@@ -609,6 +913,18 @@ case $basic_machine in
|
||||
basic_machine=a29k-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
w65*)
|
||||
basic_machine=w65-wdc
|
||||
os=-none
|
||||
;;
|
||||
w89k-*)
|
||||
basic_machine=hppa1.1-winbond
|
||||
os=-proelf
|
||||
;;
|
||||
windows32)
|
||||
basic_machine=i386-pc
|
||||
os=-windows32-msvcrt
|
||||
;;
|
||||
xmp)
|
||||
basic_machine=xmp-cray
|
||||
os=-unicos
|
||||
@@ -616,6 +932,10 @@ case $basic_machine in
|
||||
xps | xps100)
|
||||
basic_machine=xps100-honeywell
|
||||
;;
|
||||
z8k-*-coff)
|
||||
basic_machine=z8k-unknown
|
||||
os=-sim
|
||||
;;
|
||||
none)
|
||||
basic_machine=none-none
|
||||
os=-none
|
||||
@@ -623,6 +943,15 @@ case $basic_machine in
|
||||
|
||||
# Here we handle the default manufacturer of certain CPU types. It is in
|
||||
# some cases the only manufacturer, in others, it is the most popular.
|
||||
w89k)
|
||||
basic_machine=hppa1.1-winbond
|
||||
;;
|
||||
op50n)
|
||||
basic_machine=hppa1.1-oki
|
||||
;;
|
||||
op60c)
|
||||
basic_machine=hppa1.1-oki
|
||||
;;
|
||||
mips)
|
||||
if [ x$os = x-linux-gnu ]; then
|
||||
basic_machine=mips-unknown
|
||||
@@ -639,13 +968,20 @@ case $basic_machine in
|
||||
vax)
|
||||
basic_machine=vax-dec
|
||||
;;
|
||||
pdp10)
|
||||
# there are many clones, so DEC is not a safe bet
|
||||
basic_machine=pdp10-unknown
|
||||
;;
|
||||
pdp11)
|
||||
basic_machine=pdp11-dec
|
||||
;;
|
||||
we32k)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
sparc)
|
||||
sh3 | sh4 | sh3eb | sh4eb)
|
||||
basic_machine=sh-unknown
|
||||
;;
|
||||
sparc | sparcv9 | sparcv9b)
|
||||
basic_machine=sparc-sun
|
||||
;;
|
||||
cydra)
|
||||
@@ -657,6 +993,19 @@ case $basic_machine in
|
||||
orion105)
|
||||
basic_machine=clipper-highlevel
|
||||
;;
|
||||
mac | mpw | mac-mpw)
|
||||
basic_machine=m68k-apple
|
||||
;;
|
||||
pmac | pmac-mpw)
|
||||
basic_machine=powerpc-apple
|
||||
;;
|
||||
c4x*)
|
||||
basic_machine=c4x-none
|
||||
os=-coff
|
||||
;;
|
||||
*-unknown)
|
||||
# Make sure to match an already-canonicalized machine name.
|
||||
;;
|
||||
*)
|
||||
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
||||
exit 1
|
||||
@@ -710,13 +1059,37 @@ case $os in
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
|
||||
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
|
||||
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -linux-gnu* | -uxpv* | -beos*)
|
||||
| -chorusos* | -chorusrdb* \
|
||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
|
||||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
||||
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
|
||||
| -os2* | -vos*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-qnx*)
|
||||
case $basic_machine in
|
||||
x86-* | i*86-*)
|
||||
;;
|
||||
*)
|
||||
os=-nto$os
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
-nto*)
|
||||
os=-nto-qnx
|
||||
;;
|
||||
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
|
||||
| -windows* | -osx | -abug | -netware* | -os9* | -beos* \
|
||||
| -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
|
||||
;;
|
||||
-mac*)
|
||||
os=`echo $os | sed -e 's|mac|macos|'`
|
||||
;;
|
||||
-linux*)
|
||||
os=`echo $os | sed -e 's|linux|linux-gnu|'`
|
||||
;;
|
||||
@@ -726,6 +1099,12 @@ case $os in
|
||||
-sunos6*)
|
||||
os=`echo $os | sed -e 's|sunos6|solaris3|'`
|
||||
;;
|
||||
-opened*)
|
||||
os=-openedition
|
||||
;;
|
||||
-wince*)
|
||||
os=-wince
|
||||
;;
|
||||
-osfrose*)
|
||||
os=-osfrose
|
||||
;;
|
||||
@@ -741,12 +1120,18 @@ case $os in
|
||||
-acis*)
|
||||
os=-aos
|
||||
;;
|
||||
-386bsd)
|
||||
os=-bsd
|
||||
;;
|
||||
-ctix* | -uts*)
|
||||
os=-sysv
|
||||
;;
|
||||
-ns2 )
|
||||
os=-nextstep2
|
||||
;;
|
||||
-nsk*)
|
||||
os=-nsk
|
||||
;;
|
||||
# Preserve the version number of sinix5.
|
||||
-sinix5.*)
|
||||
os=`echo $os | sed -e 's|sinix|sysv|'`
|
||||
@@ -772,9 +1157,18 @@ case $os in
|
||||
# This must come after -sysvr4.
|
||||
-sysv*)
|
||||
;;
|
||||
-ose*)
|
||||
os=-ose
|
||||
;;
|
||||
-es1800*)
|
||||
os=-ose
|
||||
;;
|
||||
-xenix)
|
||||
os=-xenix
|
||||
;;
|
||||
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
|
||||
os=-mint
|
||||
;;
|
||||
-none)
|
||||
;;
|
||||
*)
|
||||
@@ -800,9 +1194,15 @@ case $basic_machine in
|
||||
*-acorn)
|
||||
os=-riscix1.2
|
||||
;;
|
||||
arm*-rebel)
|
||||
os=-linux
|
||||
;;
|
||||
arm*-semi)
|
||||
os=-aout
|
||||
;;
|
||||
pdp10-*)
|
||||
os=-tops20
|
||||
;;
|
||||
pdp11-*)
|
||||
os=-none
|
||||
;;
|
||||
@@ -821,6 +1221,15 @@ case $basic_machine in
|
||||
# default.
|
||||
# os=-sunos4
|
||||
;;
|
||||
m68*-cisco)
|
||||
os=-aout
|
||||
;;
|
||||
mips*-cisco)
|
||||
os=-elf
|
||||
;;
|
||||
mips*-*)
|
||||
os=-elf
|
||||
;;
|
||||
*-tti) # must be before sparc entry or we get the wrong os.
|
||||
os=-sysv3
|
||||
;;
|
||||
@@ -833,6 +1242,15 @@ case $basic_machine in
|
||||
*-ibm)
|
||||
os=-aix
|
||||
;;
|
||||
*-wec)
|
||||
os=-proelf
|
||||
;;
|
||||
*-winbond)
|
||||
os=-proelf
|
||||
;;
|
||||
*-oki)
|
||||
os=-proelf
|
||||
;;
|
||||
*-hp)
|
||||
os=-hpux
|
||||
;;
|
||||
@@ -893,9 +1311,21 @@ case $basic_machine in
|
||||
*-masscomp)
|
||||
os=-rtu
|
||||
;;
|
||||
f301-fujitsu)
|
||||
f30[01]-fujitsu | f700-fujitsu)
|
||||
os=-uxpv
|
||||
;;
|
||||
*-rom68k)
|
||||
os=-coff
|
||||
;;
|
||||
*-*bug)
|
||||
os=-coff
|
||||
;;
|
||||
*-apple)
|
||||
os=-macos
|
||||
;;
|
||||
*-atari*)
|
||||
os=-mint
|
||||
;;
|
||||
*)
|
||||
os=-none
|
||||
;;
|
||||
@@ -917,9 +1347,15 @@ case $basic_machine in
|
||||
-aix*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-beos*)
|
||||
vendor=be
|
||||
;;
|
||||
-hpux*)
|
||||
vendor=hp
|
||||
;;
|
||||
-mpeix*)
|
||||
vendor=hp
|
||||
;;
|
||||
-hiux*)
|
||||
vendor=hitachi
|
||||
;;
|
||||
@@ -935,7 +1371,7 @@ case $basic_machine in
|
||||
-genix*)
|
||||
vendor=ns
|
||||
;;
|
||||
-mvs*)
|
||||
-mvs* | -opened*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-ptx*)
|
||||
@@ -947,9 +1383,29 @@ case $basic_machine in
|
||||
-aux*)
|
||||
vendor=apple
|
||||
;;
|
||||
-hms*)
|
||||
vendor=hitachi
|
||||
;;
|
||||
-mpw* | -macos*)
|
||||
vendor=apple
|
||||
;;
|
||||
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
|
||||
vendor=atari
|
||||
;;
|
||||
-vos*)
|
||||
vendor=stratus
|
||||
;;
|
||||
esac
|
||||
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
|
||||
;;
|
||||
esac
|
||||
|
||||
echo $basic_machine$os
|
||||
exit 0
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "timestamp='"
|
||||
# time-stamp-format: "%:y-%02m-%02d"
|
||||
# time-stamp-end: "'"
|
||||
# End:
|
||||
|
||||
1057
configure.in
@@ -3,11 +3,11 @@
|
||||
#
|
||||
|
||||
all:
|
||||
cd src; make
|
||||
cd src; $(MAKE)
|
||||
|
||||
clean:
|
||||
cd src; make clean
|
||||
cd samples; make clean
|
||||
cd src; $(MAKE) clean
|
||||
cd samples; $(MAKE) clean
|
||||
|
||||
samples:
|
||||
cd samples; make
|
||||
cd samples; $(MAKE)
|
||||
|
||||
6
contrib/configure
vendored
@@ -819,6 +819,9 @@ trap 'rm -fr `echo "
|
||||
src/stc/Makefile
|
||||
samples/Makefile
|
||||
samples/mmedia/Makefile
|
||||
samples/ogl/Makefile
|
||||
samples/ogl/ogledit/Makefile
|
||||
samples/ogl/studio/Makefile
|
||||
samples/stc/Makefile
|
||||
" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
|
||||
EOF
|
||||
@@ -905,6 +908,9 @@ CONFIG_FILES=\${CONFIG_FILES-"Makefile
|
||||
src/stc/Makefile
|
||||
samples/Makefile
|
||||
samples/mmedia/Makefile
|
||||
samples/ogl/Makefile
|
||||
samples/ogl/ogledit/Makefile
|
||||
samples/ogl/studio/Makefile
|
||||
samples/stc/Makefile
|
||||
"}
|
||||
EOF
|
||||
|
||||
@@ -44,5 +44,8 @@ AC_OUTPUT([
|
||||
src/stc/Makefile
|
||||
samples/Makefile
|
||||
samples/mmedia/Makefile
|
||||
samples/ogl/Makefile
|
||||
samples/ogl/ogledit/Makefile
|
||||
samples/ogl/studio/Makefile
|
||||
samples/stc/Makefile
|
||||
])
|
||||
|
||||
5
contrib/docs/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
html
|
||||
htmlhelp
|
||||
pdf
|
||||
winhelp
|
||||
htb
|
||||
|
Before Width: | Height: | Size: 225 B After Width: | Height: | Size: 978 B |
|
Before Width: | Height: | Size: 231 B After Width: | Height: | Size: 996 B |
|
Before Width: | Height: | Size: 164 B After Width: | Height: | Size: 959 B |
@@ -1,5 +1,5 @@
|
||||
[OPTIONS]
|
||||
BMROOT=d:\wx2\wxwind~1\docs\latex\ogl ; Assume that bitmaps are where the source is
|
||||
BMROOT=d:\wx2\wxwind~1\contrib\docs\latex\ogl ; Assume that bitmaps are where the source is
|
||||
TITLE=OGL Manual
|
||||
CONTENTS=Contents
|
||||
COMPRESS=HIGH
|
||||
|
||||
|
Before Width: | Height: | Size: 137 B After Width: | Height: | Size: 998 B |
@@ -1,12 +1,10 @@
|
||||
#
|
||||
# Makefile : Builds wxWindows utils for Unix.
|
||||
#
|
||||
# $Id$
|
||||
|
||||
CONTRIB_SAMPLES=mmedia ogl stc
|
||||
|
||||
all:
|
||||
cd mmedia; make
|
||||
cd stc; make
|
||||
@for d in $(CONTRIB_SAMPLES); do (cd $$d && $(MAKE)); done
|
||||
|
||||
clean:
|
||||
cd mmedia; make clean
|
||||
cd stc; make clean
|
||||
@for d in $(CONTRIB_SAMPLES); do (cd $$d && $(MAKE) clean); done
|
||||
|
||||
|
||||
235
contrib/samples/mmedia/MMboardVC.dsp
Normal file
@@ -0,0 +1,235 @@
|
||||
# Microsoft Developer Studio Project File - Name="MMboardVC" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 5.00
|
||||
# (Actually, generated by MakeProject, (c) Julian Smart, 1998)
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=MMboardVC - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "MMboardVC.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "MMboardVC.mak" CFG="MMboardVC - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "MMboardVC - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "MMboardVC - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "MMboardVC - Win32 Debug DLL" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "MMboardVC - Win32 Release DLL" (based on "Win32 (x86) Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "MMboardVC - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../../include" /I "../../../contrib/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD BASE RSC /l 0x809 /d "NDEBUG"
|
||||
# ADD RSC /l 0x809 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx.lib xpm.lib png.lib zlib.lib jpeg.lib tiff.lib mmedia.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib,libci.lib,msvcrtd.lib" /out:"Release/mmboard.exe" /libpath:"../../../lib" /libpath:"../../../contrib/lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "MMboardVC - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../../../include" /I "../../../contrib/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /Yu"wx/wxprec.h" /FD /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||
# ADD RSC /l 0x809 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxd.lib xpmd.lib pngd.lib zlibd.lib jpegd.lib tiffd.lib mmediad.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib,libcid.lib,msvcrt.lib" /out:"Debug/mmboard.exe" /pdbtype:sept /libpath:"../../../lib" /libpath:"../../../contrib/lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "MMboardVC - Win32 Debug DLL"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "DebugDLL"
|
||||
# PROP BASE Intermediate_Dir "DebugDLL"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "DebugDLL"
|
||||
# PROP Intermediate_Dir "DebugDLL"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../../../include" /I "../../../contrib/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D WXUSINGDLL=1 /Yu"wx/wxprec.h" /FD /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||
# ADD RSC /l 0x809 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx22_8d.lib mmediad.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /out:"DebugDLL/mmboard.exe" /pdbtype:sept /libpath:"../../../lib" /libpath:"../../../contrib/lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "MMboardVC - Win32 Release DLL"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "ReleaseDLL"
|
||||
# PROP BASE Intermediate_Dir "ReleaseDLL"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "ReleaseDLL"
|
||||
# PROP Intermediate_Dir "ReleaseDLL"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../../include" /I "../../../contrib/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D WXUSINGDLL=1 /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD BASE RSC /l 0x809 /d "NDEBUG"
|
||||
# ADD RSC /l 0x809 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx22_8.lib mmedia.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /out:"ReleaseDLL/mmboard.exe" /libpath:"../../../lib" /libpath:"../../../contrib/lib"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "MMboardVC - Win32 Release"
|
||||
# Name "MMboardVC - Win32 Debug"
|
||||
# Name "MMboardVC - Win32 Debug DLL"
|
||||
# Name "MMboardVC - Win32 Release DLL"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\mmboard.cpp
|
||||
|
||||
!IF "$(CFG)" == "MMboardVC - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "MMboardVC - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "MMboardVC - Win32 Debug DLL"
|
||||
|
||||
# SUBTRACT BASE CPP /YX /Yc /Yu
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "MMboardVC - Win32 Release DLL"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\mmboard.h
|
||||
|
||||
!IF "$(CFG)" == "MMboardVC - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "MMboardVC - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "MMboardVC - Win32 Debug DLL"
|
||||
|
||||
# SUBTRACT BASE CPP /YX /Yc /Yu
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "MMboardVC - Win32 Release DLL"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\mmbman.cpp
|
||||
|
||||
!IF "$(CFG)" == "MMboardVC - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "MMboardVC - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "MMboardVC - Win32 Debug DLL"
|
||||
|
||||
# SUBTRACT BASE CPP /YX /Yc /Yu
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "MMboardVC - Win32 Release DLL"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\mmbman.h
|
||||
|
||||
!IF "$(CFG)" == "MMboardVC - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "MMboardVC - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "MMboardVC - Win32 Debug DLL"
|
||||
|
||||
# SUBTRACT BASE CPP /YX /Yc /Yu
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "MMboardVC - Win32 Release DLL"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\mmboard.rc
|
||||
# ADD BASE RSC /l 0x809
|
||||
# ADD RSC /l 0x809 /i "../../../include" /i "../../../contrib/include"
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
29
contrib/samples/mmedia/MMboardVC.dsw
Normal file
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 5.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "MMboardVC"=.\MMboardVC.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
#
|
||||
# File: makefile.unx
|
||||
# Author: Julian Smart
|
||||
# Created: 1998
|
||||
# Updated:
|
||||
# Copyright: (c) 1998 Julian Smart
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile for minimal example (UNIX).
|
||||
# Makefile for mmedia sample.
|
||||
# $Id$
|
||||
|
||||
top_srcdir = @top_srcdir@/..
|
||||
top_builddir = ../../..
|
||||
@@ -17,25 +9,8 @@ PROGRAM=mmboard
|
||||
|
||||
OBJECTS=mmboard.o mmbman.o
|
||||
|
||||
EXTRA_LIBS= $(top_builddir)/contrib/src/mmedia/libmmedia.@WX_TARGET_LIBRARY_TYPE@ @ESD_LINK@
|
||||
APPEXTRALIBS=$(top_builddir)/lib/libmmedia.@WX_TARGET_LIBRARY_TYPE@ @ESD_LINK@
|
||||
APPEXTRADEFS=-I$(top_srcdir)/contrib/include
|
||||
|
||||
# the comment at the end of the next line is needed because otherwise autoconf
|
||||
# would remove this line completely - it contains a built-in hack to remove
|
||||
# any VPATH assignment not containing ':'
|
||||
VPATH = @PATH_IFS@$(top_srcdir)/contrib/samples/mmedia # ':' for autoconf
|
||||
include $(top_builddir)/src/makeprog.env
|
||||
|
||||
include ../../../src/make.env
|
||||
|
||||
.SUFFIXES: .o .cpp .c
|
||||
|
||||
.cpp.o:
|
||||
$(CC) -c $(CPPFLAGS) $(EXTRA_CPPFLAGS) -o $@ $<
|
||||
|
||||
all: $(PROGRAM)
|
||||
|
||||
clean:
|
||||
rm -f *.o $(PROGRAM)
|
||||
|
||||
mmboard: $(OBJECTS)
|
||||
$(CC) $(LDFLAGS) -o mmboard $(OBJECTS) $(EXTRA_LIBS) $(LDLIBS) $(top_builddir)/lib/@WX_TARGET_LIBRARY@
|
||||
|
||||
12
contrib/samples/ogl/Makefile.in
Normal file
@@ -0,0 +1,12 @@
|
||||
#
|
||||
# Makefile : Builds wxWindows utils for Unix.
|
||||
#
|
||||
|
||||
OGL_SAMPLES=ogledit studio
|
||||
|
||||
all:
|
||||
@for d in $(OGL_SAMPLES); do (cd $$d && $(MAKE)); done
|
||||
|
||||
clean:
|
||||
@for d in $(OGL_SAMPLES); do (cd $$d && $(MAKE) clean); done
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
#
|
||||
# File: Makefile
|
||||
# Author: Julian Smart
|
||||
# Created: 1999
|
||||
# Updated:
|
||||
# Copyright: (c) 2000 Julian Smart
|
||||
#
|
||||
# Makefile for OGL demo (GTK version)
|
||||
#
|
||||
# This makefile requires wxWindows/GTK to be
|
||||
# installed (possibly using "make install")
|
||||
# on your system.
|
||||
#
|
||||
|
||||
CPP = gcc -g
|
||||
CC = gcc
|
||||
WXCONFIG=../../../../wx-config
|
||||
WXINCLUDE=-I../../../../include -I../../../include
|
||||
WXLIB=-L../../../../lib -L../../../src/ogl
|
||||
|
||||
OBJECTS=ogledit.o palette.o doc.o view.o
|
||||
|
||||
ogledit: $(OBJECTS)
|
||||
$(CPP) -o ogledit $(OBJECTS) `$(WXCONFIG) --libs` $(WXLIB) -logl
|
||||
|
||||
ogledit.o: ogledit.cpp
|
||||
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c ogledit.cpp
|
||||
|
||||
palette.o: palette.cpp
|
||||
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c palette.cpp
|
||||
|
||||
doc.o: doc.cpp
|
||||
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c doc.cpp
|
||||
|
||||
view.o: view.cpp
|
||||
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c view.cpp
|
||||
|
||||
clean:
|
||||
rm -f *.o ogledit
|
||||
16
contrib/samples/ogl/ogledit/Makefile.in
Normal file
@@ -0,0 +1,16 @@
|
||||
# Makefile for OGLEdit example.
|
||||
# $Id$
|
||||
|
||||
top_srcdir = @top_srcdir@/..
|
||||
top_builddir = ../../../..
|
||||
program_dir = contrib/samples/ogl/ogledit
|
||||
|
||||
PROGRAM=ogledit
|
||||
|
||||
OBJECTS=$(PROGRAM).o doc.o view.o palette.o
|
||||
|
||||
APPEXTRALIBS=$(top_builddir)/lib/libogl.@WX_TARGET_LIBRARY_TYPE@
|
||||
APPEXTRADEFS=-I$(top_srcdir)/contrib/include
|
||||
|
||||
include $(top_builddir)/src/makeprog.env
|
||||
|
||||
315
contrib/samples/ogl/ogledit/OGLEditVC.dsp
Normal file
@@ -0,0 +1,315 @@
|
||||
# Microsoft Developer Studio Project File - Name="OGLEditVC" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 5.00
|
||||
# (Actually, generated by MakeProject, (c) Julian Smart, 1998)
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=OGLEditVC - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "OGLEditVC.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "OGLEditVC.mak" CFG="OGLEditVC - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "OGLEditVC - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "OGLEditVC - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "OGLEditVC - Win32 Debug DLL" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "OGLEditVC - Win32 Release DLL" (based on "Win32 (x86) Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "OGLEditVC - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../../../include" /I "../../../../contrib/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD BASE RSC /l 0x809 /d "NDEBUG"
|
||||
# ADD RSC /l 0x809 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx.lib xpm.lib png.lib zlib.lib jpeg.lib tiff.lib ogl.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib,libci.lib,msvcrtd.lib" /out:"Release/ogledit.exe" /libpath:"../../../../lib" /libpath:"../../../../contrib/lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "OGLEditVC - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../../../../include" /I "../../../../contrib/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /Yu"wx/wxprec.h" /FD /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||
# ADD RSC /l 0x809 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxd.lib xpmd.lib pngd.lib zlibd.lib jpegd.lib tiffd.lib ogld.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib,libcid.lib,msvcrt.lib" /out:"Debug/ogledit.exe" /pdbtype:sept /libpath:"../../../../lib" /libpath:"../../../../contrib/lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "OGLEditVC - Win32 Debug DLL"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "DebugDLL"
|
||||
# PROP BASE Intermediate_Dir "DebugDLL"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "DebugDLL"
|
||||
# PROP Intermediate_Dir "DebugDLL"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../../../../include" /I "../../../../contrib/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D WXUSINGDLL=1 /Yu"wx/wxprec.h" /FD /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||
# ADD RSC /l 0x809 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx22_8d.lib ogld.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /out:"DebugDLL/ogledit.exe" /pdbtype:sept /libpath:"../../../../lib" /libpath:"../../../../contrib/lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "OGLEditVC - Win32 Release DLL"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "ReleaseDLL"
|
||||
# PROP BASE Intermediate_Dir "ReleaseDLL"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "ReleaseDLL"
|
||||
# PROP Intermediate_Dir "ReleaseDLL"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../../../include" /I "../../../../contrib/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D WXUSINGDLL=1 /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD BASE RSC /l 0x809 /d "NDEBUG"
|
||||
# ADD RSC /l 0x809 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx22_8.lib ogl.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /out:"ReleaseDLL/ogledit.exe" /libpath:"../../../../lib" /libpath:"../../../../contrib/lib"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "OGLEditVC - Win32 Release"
|
||||
# Name "OGLEditVC - Win32 Debug"
|
||||
# Name "OGLEditVC - Win32 Debug DLL"
|
||||
# Name "OGLEditVC - Win32 Release DLL"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ogledit.cpp
|
||||
|
||||
!IF "$(CFG)" == "OGLEditVC - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "OGLEditVC - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "OGLEditVC - Win32 Debug DLL"
|
||||
|
||||
# SUBTRACT BASE CPP /YX /Yc /Yu
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "OGLEditVC - Win32 Release DLL"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\doc.cpp
|
||||
|
||||
!IF "$(CFG)" == "OGLEditVC - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "OGLEditVC - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "OGLEditVC - Win32 Debug DLL"
|
||||
|
||||
# SUBTRACT BASE CPP /YX /Yc /Yu
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "OGLEditVC - Win32 Release DLL"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\palette.cpp
|
||||
|
||||
!IF "$(CFG)" == "OGLEditVC - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "OGLEditVC - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "OGLEditVC - Win32 Debug DLL"
|
||||
|
||||
# SUBTRACT BASE CPP /YX /Yc /Yu
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "OGLEditVC - Win32 Release DLL"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\view.cpp
|
||||
|
||||
!IF "$(CFG)" == "OGLEditVC - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "OGLEditVC - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "OGLEditVC - Win32 Debug DLL"
|
||||
|
||||
# SUBTRACT BASE CPP /YX /Yc /Yu
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "OGLEditVC - Win32 Release DLL"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\doc.h
|
||||
|
||||
!IF "$(CFG)" == "OGLEditVC - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "OGLEditVC - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "OGLEditVC - Win32 Debug DLL"
|
||||
|
||||
# SUBTRACT BASE CPP /YX /Yc /Yu
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "OGLEditVC - Win32 Release DLL"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ogledit.h
|
||||
|
||||
!IF "$(CFG)" == "OGLEditVC - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "OGLEditVC - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "OGLEditVC - Win32 Debug DLL"
|
||||
|
||||
# SUBTRACT BASE CPP /YX /Yc /Yu
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "OGLEditVC - Win32 Release DLL"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\palette.h
|
||||
|
||||
!IF "$(CFG)" == "OGLEditVC - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "OGLEditVC - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "OGLEditVC - Win32 Debug DLL"
|
||||
|
||||
# SUBTRACT BASE CPP /YX /Yc /Yu
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "OGLEditVC - Win32 Release DLL"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\view.h
|
||||
|
||||
!IF "$(CFG)" == "OGLEditVC - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "OGLEditVC - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "OGLEditVC - Win32 Debug DLL"
|
||||
|
||||
# SUBTRACT BASE CPP /YX /Yc /Yu
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "OGLEditVC - Win32 Release DLL"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ogledit.rc
|
||||
# ADD BASE RSC /l 0x809
|
||||
# ADD RSC /l 0x809 /i "../../../../include" /i "../../../../contrib/include"
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
29
contrib/samples/ogl/ogledit/OGLEditVC.dsw
Normal file
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 5.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "OGLEditVC"=.\OGLEditVC.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
@@ -1,20 +1,39 @@
|
||||
#
|
||||
# File: makefile.unx
|
||||
# File: Makefile
|
||||
# Author: Julian Smart
|
||||
# Created: 1998
|
||||
# Created: 1999
|
||||
# Updated:
|
||||
# Copyright: (c) 1998 Julian Smart
|
||||
# Copyright: (c) 2000 Julian Smart
|
||||
#
|
||||
# "%W% %G%"
|
||||
# Makefile for OGL demo (GTK version)
|
||||
#
|
||||
# This makefile requires wxWindows/GTK to be
|
||||
# installed (possibly using "make install")
|
||||
# on your system.
|
||||
#
|
||||
# Makefile for OGLEdit example (UNIX).
|
||||
|
||||
PROGRAM=ogledit
|
||||
CPP = gcc -g
|
||||
CC = gcc
|
||||
WXCONFIG=../../../../wx-config
|
||||
WXINCLUDE=-I../../../../include -I../../../include
|
||||
WXLIB=-L../../../../lib -L../../../src/ogl
|
||||
|
||||
OBJECTS=$(PROGRAM).o doc.o view.o palette.o
|
||||
OBJECTS=ogledit.o palette.o doc.o view.o
|
||||
|
||||
# EXTRACPPFLAGS=-I$(WXDIR)/contrib/include
|
||||
EXTRALDLIBS=-logl$(GUISUFFIX)
|
||||
ogledit: $(OBJECTS)
|
||||
$(CPP) -o ogledit $(OBJECTS) `$(WXCONFIG) --libs` $(WXLIB) -logl
|
||||
|
||||
include ../../../../src/makeprog.env
|
||||
ogledit.o: ogledit.cpp
|
||||
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c ogledit.cpp
|
||||
|
||||
palette.o: palette.cpp
|
||||
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c palette.cpp
|
||||
|
||||
doc.o: doc.cpp
|
||||
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c doc.cpp
|
||||
|
||||
view.o: view.cpp
|
||||
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c view.cpp
|
||||
|
||||
clean:
|
||||
rm -f *.o ogledit
|
||||
|
||||
@@ -292,7 +292,7 @@ void MyCanvas::OnLeftClick(double x, double y, int keys)
|
||||
}
|
||||
if (info)
|
||||
{
|
||||
view->GetDocument()->GetCommandProcessor()->Submit(new DiagramCommand(info->GetClassName(), OGLEDIT_ADD_SHAPE, (DiagramDocument *)view->GetDocument(), info,
|
||||
view->GetDocument()->GetCommandProcessor()->Submit(new DiagramCommand((char*) info->GetClassName(), OGLEDIT_ADD_SHAPE, (DiagramDocument *)view->GetDocument(), info,
|
||||
x, y));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
#
|
||||
# File: Makefile
|
||||
# Author: Julian Smart
|
||||
# Created: 1999
|
||||
# Updated:
|
||||
# Copyright: (c) 2000 Julian Smart
|
||||
#
|
||||
# Makefile for OGL demo (GTK version)
|
||||
#
|
||||
# This makefile requires wxWindows/GTK to be
|
||||
# installed (possibly using "make install")
|
||||
# on your system.
|
||||
#
|
||||
|
||||
CPP = gcc -g
|
||||
CC = gcc
|
||||
WXCONFIG=../../../../wx-config
|
||||
WXINCLUDE=-I../../../../include -I../../../include
|
||||
WXLIB=-L../../../../lib -L../../../src/ogl
|
||||
|
||||
OBJECTS=studio.o cspalette.o csprint.o dialogs.o doc.o mainfrm.o project.o shapes.o symbols.o view.o
|
||||
|
||||
studio: $(OBJECTS)
|
||||
$(CPP) -o studio $(OBJECTS) `$(WXCONFIG) --libs` $(WXLIB) -logl
|
||||
|
||||
studio.o: studio.cpp
|
||||
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c studio.cpp
|
||||
|
||||
cspalette.o: cspalette.cpp
|
||||
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c cspalette.cpp
|
||||
|
||||
doc.o: doc.cpp
|
||||
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c doc.cpp
|
||||
|
||||
view.o: view.cpp
|
||||
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c view.cpp
|
||||
|
||||
dialogs.o: dialogs.cpp
|
||||
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c dialogs.cpp
|
||||
|
||||
mainfrm.o: mainfrm.cpp
|
||||
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c mainfrm.cpp
|
||||
|
||||
project.o: project.cpp
|
||||
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c project.cpp
|
||||
|
||||
shapes.o: shapes.cpp
|
||||
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c shapes.cpp
|
||||
|
||||
symbols.o: symbols.cpp
|
||||
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c symbols.cpp
|
||||
|
||||
csprint.o: csprint.cpp
|
||||
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c csprint.cpp
|
||||
|
||||
clean:
|
||||
rm -f *.o studio
|
||||
19
contrib/samples/ogl/studio/Makefile.in
Normal file
@@ -0,0 +1,19 @@
|
||||
# Makefile for OGL Studio.
|
||||
# $Id$
|
||||
|
||||
top_srcdir = @top_srcdir@/..
|
||||
top_builddir = ../../../..
|
||||
program_dir = contrib/samples/ogl/studio
|
||||
|
||||
PROGRAM=studio
|
||||
|
||||
DATAFILES=studio_resources.wxr
|
||||
|
||||
OBJECTS=$(PROGRAM).o doc.o shapes.o symbols.o view.o cspalette.o\
|
||||
mainfrm.o project.o dialogs.o csprint.o
|
||||
|
||||
APPEXTRALIBS=$(top_builddir)/lib/libogl.@WX_TARGET_LIBRARY_TYPE@
|
||||
APPEXTRADEFS=-I$(top_srcdir)/contrib/include -I$(top_srcdir)/$(program_dir)/bitmaps
|
||||
|
||||
include $(top_builddir)/src/makeprog.env
|
||||
|
||||
391
contrib/samples/ogl/studio/StudioVC.dsp
Normal file
@@ -0,0 +1,391 @@
|
||||
# Microsoft Developer Studio Project File - Name="StudioVC" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=StudioVC - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "StudioVC.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "StudioVC.mak" CFG="StudioVC - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "StudioVC - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "StudioVC - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "StudioVC - Win32 Debug DLL" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "StudioVC - Win32 Release DLL" (based on "Win32 (x86) Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "StudioVC - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../../../include" /I "../../../../contrib/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD BASE RSC /l 0x809 /d "NDEBUG"
|
||||
# ADD RSC /l 0x809 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx.lib xpm.lib png.lib zlib.lib jpeg.lib tiff.lib ogl.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /nodefaultlib:"msvcrtd.lib" /out:"Release/studio.exe" /libpath:"../../../../lib" /libpath:"../../../../contrib/lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../../../include" /I "../../../../contrib/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /Yu"wx/wxprec.h" /FD /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||
# ADD RSC /l 0x809 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxd.lib xpmd.lib pngd.lib zlibd.lib jpegd.lib tiffd.lib ogld.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrt.lib" /out:"Debug/studio.exe" /pdbtype:sept /libpath:"../../../../lib" /libpath:"../../../../contrib/lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Debug DLL"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "DebugDLL"
|
||||
# PROP BASE Intermediate_Dir "DebugDLL"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "DebugDLL"
|
||||
# PROP Intermediate_Dir "DebugDLL"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../../../include" /I "../../../../contrib/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D WXUSINGDLL=1 /Yu"wx/wxprec.h" /FD /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||
# ADD RSC /l 0x809 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx22_8d.lib ogld.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /out:"DebugDLL/studio.exe" /pdbtype:sept /libpath:"../../../../lib" /libpath:"../../../../contrib/lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Release DLL"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "ReleaseDLL"
|
||||
# PROP BASE Intermediate_Dir "ReleaseDLL"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "ReleaseDLL"
|
||||
# PROP Intermediate_Dir "ReleaseDLL"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../../../include" /I "../../../../contrib/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D WXUSINGDLL=1 /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD BASE RSC /l 0x809 /d "NDEBUG"
|
||||
# ADD RSC /l 0x809 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx22_8.lib ogl.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /out:"ReleaseDLL/studio.exe" /libpath:"../../../../lib" /libpath:"../../../../contrib/lib"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "StudioVC - Win32 Release"
|
||||
# Name "StudioVC - Win32 Debug"
|
||||
# Name "StudioVC - Win32 Debug DLL"
|
||||
# Name "StudioVC - Win32 Release DLL"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cspalette.cpp
|
||||
|
||||
!IF "$(CFG)" == "StudioVC - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Debug DLL"
|
||||
|
||||
# SUBTRACT BASE CPP /YX /Yc /Yu
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Release DLL"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cspalette.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\csprint.cpp
|
||||
|
||||
!IF "$(CFG)" == "StudioVC - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Debug DLL"
|
||||
|
||||
# SUBTRACT BASE CPP /YX /Yc /Yu
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Release DLL"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\dialogs.cpp
|
||||
|
||||
!IF "$(CFG)" == "StudioVC - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Debug DLL"
|
||||
|
||||
# SUBTRACT BASE CPP /YX /Yc /Yu
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Release DLL"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\dialogs.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\doc.cpp
|
||||
|
||||
!IF "$(CFG)" == "StudioVC - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Debug DLL"
|
||||
|
||||
# SUBTRACT BASE CPP /YX /Yc /Yu
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Release DLL"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\doc.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\mainfrm.cpp
|
||||
|
||||
!IF "$(CFG)" == "StudioVC - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Debug DLL"
|
||||
|
||||
# SUBTRACT BASE CPP /YX /Yc /Yu
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Release DLL"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\mainfrm.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\project.cpp
|
||||
|
||||
!IF "$(CFG)" == "StudioVC - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Debug DLL"
|
||||
|
||||
# SUBTRACT BASE CPP /YX /Yc /Yu
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Release DLL"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\project.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\shapes.cpp
|
||||
|
||||
!IF "$(CFG)" == "StudioVC - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Debug DLL"
|
||||
|
||||
# SUBTRACT BASE CPP /YX /Yc /Yu
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Release DLL"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\shapes.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\studio.cpp
|
||||
|
||||
!IF "$(CFG)" == "StudioVC - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Debug DLL"
|
||||
|
||||
# SUBTRACT BASE CPP /YX /Yc /Yu
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Release DLL"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\studio.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\studio.rc
|
||||
# ADD BASE RSC /l 0x809
|
||||
# ADD RSC /l 0x809 /i "../../../../include" /i "../../../../contrib/include"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\symbols.cpp
|
||||
|
||||
!IF "$(CFG)" == "StudioVC - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Debug DLL"
|
||||
|
||||
# SUBTRACT BASE CPP /YX /Yc /Yu
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Release DLL"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\symbols.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\view.cpp
|
||||
|
||||
!IF "$(CFG)" == "StudioVC - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Debug DLL"
|
||||
|
||||
# SUBTRACT BASE CPP /YX /Yc /Yu
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "StudioVC - Win32 Release DLL"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\view.h
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
29
contrib/samples/ogl/studio/StudioVC.dsw
Normal file
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "StudioVC"=.\StudioVC.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
@@ -1,39 +1,57 @@
|
||||
#
|
||||
# File: makefile.unx
|
||||
# File: Makefile
|
||||
# Author: Julian Smart
|
||||
# Created: 1998
|
||||
# Created: 1999
|
||||
# Updated:
|
||||
# Copyright: (c) 1998 Julian Smart
|
||||
# Copyright: (c) 2000 Julian Smart
|
||||
#
|
||||
# "%W% %G%"
|
||||
# Makefile for OGL demo (GTK version)
|
||||
#
|
||||
# This makefile requires wxWindows/GTK to be
|
||||
# installed (possibly using "make install")
|
||||
# on your system.
|
||||
#
|
||||
# Makefile for OGL Studio (UNIX).
|
||||
|
||||
PROGRAM=studio
|
||||
CPP = gcc -g
|
||||
CC = gcc
|
||||
WXCONFIG=../../../../wx-config
|
||||
WXINCLUDE=-I../../../../include -I../../../include
|
||||
WXLIB=-L../../../../lib -L../../../src/ogl
|
||||
|
||||
OBJECTS=$(PROGRAM).o doc.o shapes.o symbols.o view.o cspalette.o\
|
||||
mainfrm.o project.o dialogs.o csprint.o
|
||||
OBJECTS=studio.o cspalette.o csprint.o dialogs.o doc.o mainfrm.o project.o shapes.o symbols.o view.o
|
||||
|
||||
EXTRACPPFLAGS=-I$(WXDIR)/utils/ogl/src -I./bitmaps
|
||||
EXTRALDLIBS=-logl$(GUISUFFIX)
|
||||
studio: $(OBJECTS)
|
||||
$(CPP) -o studio $(OBJECTS) `$(WXCONFIG) --libs` $(WXLIB) -logl
|
||||
|
||||
#WXDIR=/home/jacs/wx2
|
||||
studio.o: studio.cpp
|
||||
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c studio.cpp
|
||||
|
||||
include $(WXDIR)/src/makeprog.env
|
||||
cspalette.o: cspalette.cpp
|
||||
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c cspalette.cpp
|
||||
|
||||
cleanogl:
|
||||
cd $(WXDIR)/utils/ogl/src; make -f makefile.unx cleanmotif
|
||||
doc.o: doc.cpp
|
||||
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c doc.cpp
|
||||
|
||||
ogl:
|
||||
cd $(WXDIR)/utils/ogl/src; make -f makefile.unx motif
|
||||
view.o: view.cpp
|
||||
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c view.cpp
|
||||
|
||||
wx:
|
||||
cd $(WXDIR)/src/motif; make -f makefile.unx motif
|
||||
dialogs.o: dialogs.cpp
|
||||
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c dialogs.cpp
|
||||
|
||||
cleanwx:
|
||||
cd $(WXDIR)/src/motif; make -f makefile.unx cleanmotif
|
||||
mainfrm.o: mainfrm.cpp
|
||||
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c mainfrm.cpp
|
||||
|
||||
cleanall: cleanmotif cleanogl cleanwx
|
||||
project.o: project.cpp
|
||||
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c project.cpp
|
||||
|
||||
makeall: wx ogl motif
|
||||
shapes.o: shapes.cpp
|
||||
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c shapes.cpp
|
||||
|
||||
symbols.o: symbols.cpp
|
||||
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c symbols.cpp
|
||||
|
||||
csprint.o: csprint.cpp
|
||||
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c csprint.cpp
|
||||
|
||||
clean:
|
||||
rm -f *.o studio
|
||||
|
||||
@@ -13,9 +13,9 @@ PROGRAM=stctest
|
||||
|
||||
OBJECTS=$(PROGRAM).o
|
||||
|
||||
APPEXTRALIBS=$(top_builddir)/contrib/src/stc/libstc.@WX_TARGET_LIBRARY_TYPE@
|
||||
APPEXTRALIBS=$(top_builddir)/lib/libstc.@WX_TARGET_LIBRARY_TYPE@
|
||||
APPEXTRADEFS=-I$(top_srcdir)/contrib/include
|
||||
|
||||
DATAFILES=stctest.cpp
|
||||
|
||||
include ../../../src/makeprog.env
|
||||
include $(top_builddir)/src/makeprog.env
|
||||
|
||||
175
contrib/samples/stc/StcTestVC.dsp
Normal file
@@ -0,0 +1,175 @@
|
||||
# Microsoft Developer Studio Project File - Name="StcTestVC" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 5.00
|
||||
# (Actually, generated by MakeProject, (c) Julian Smart, 1998)
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=StcTestVC - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "StcTestVC.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "StcTestVC.mak" CFG="StcTestVC - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "StcTestVC - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "StcTestVC - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "StcTestVC - Win32 Debug DLL" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "StcTestVC - Win32 Release DLL" (based on "Win32 (x86) Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "StcTestVC - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../../include" /I "../../../contrib/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD BASE RSC /l 0x809 /d "NDEBUG"
|
||||
# ADD RSC /l 0x809 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx.lib xpm.lib png.lib zlib.lib jpeg.lib tiff.lib stc.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib,libci.lib,msvcrtd.lib" /out:"Release/stctest.exe" /libpath:"../../../lib" /libpath:"../../../contrib/lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StcTestVC - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../../../include" /I "../../../contrib/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /Yu"wx/wxprec.h" /FD /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||
# ADD RSC /l 0x809 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxd.lib xpmd.lib pngd.lib zlibd.lib jpegd.lib tiffd.lib stcd.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib,libcid.lib,msvcrt.lib" /out:"Debug/stctest.exe" /pdbtype:sept /libpath:"../../../lib" /libpath:"../../../contrib/lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StcTestVC - Win32 Debug DLL"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "DebugDLL"
|
||||
# PROP BASE Intermediate_Dir "DebugDLL"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "DebugDLL"
|
||||
# PROP Intermediate_Dir "DebugDLL"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../../../include" /I "../../../contrib/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D WXUSINGDLL=1 /Yu"wx/wxprec.h" /FD /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||
# ADD RSC /l 0x809 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx22_8d.lib stcd.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /out:"DebugDLL/stctest.exe" /pdbtype:sept /libpath:"../../../lib" /libpath:"../../../contrib/lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StcTestVC - Win32 Release DLL"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "ReleaseDLL"
|
||||
# PROP BASE Intermediate_Dir "ReleaseDLL"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "ReleaseDLL"
|
||||
# PROP Intermediate_Dir "ReleaseDLL"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../../include" /I "../../../contrib/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D WXUSINGDLL=1 /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD BASE RSC /l 0x809 /d "NDEBUG"
|
||||
# ADD RSC /l 0x809 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx22_8.lib stc.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /out:"ReleaseDLL/stctest.exe" /libpath:"../../../lib" /libpath:"../../../contrib/lib"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "StcTestVC - Win32 Release"
|
||||
# Name "StcTestVC - Win32 Debug"
|
||||
# Name "StcTestVC - Win32 Debug DLL"
|
||||
# Name "StcTestVC - Win32 Release DLL"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\stctest.cpp
|
||||
|
||||
!IF "$(CFG)" == "StcTestVC - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StcTestVC - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "StcTestVC - Win32 Debug DLL"
|
||||
|
||||
# SUBTRACT BASE CPP /YX /Yc /Yu
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "StcTestVC - Win32 Release DLL"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\stctest.rc
|
||||
# ADD BASE RSC /l 0x809
|
||||
# ADD RSC /l 0x809 /i "../../../include" /i "../../../contrib/include"
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
29
contrib/samples/stc/StcTestVC.dsw
Normal file
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 5.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "StcTestVC"=.\StcTestVC.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
@@ -165,7 +165,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
ed->EmptyUndoBuffer();
|
||||
|
||||
ed->SetLexer(wxSTC_LEX_CPP);
|
||||
ed->SetKeywords(0,
|
||||
ed->SetKeyWords(0,
|
||||
"asm auto bool break case catch char class const "
|
||||
"const_cast continue default delete do double "
|
||||
"dynamic_cast else enum explicit export extern "
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
#
|
||||
# Makefile : Builds wxWindows contrib src for Unix.
|
||||
#
|
||||
# $Id$
|
||||
|
||||
CONTRIB_SUBDIRS=ogl mmedia stc
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#
|
||||
# $Id$
|
||||
|
||||
top_srcdir = @top_srcdir@
|
||||
top_srcdir = @top_srcdir@/..
|
||||
top_builddir = ../../..
|
||||
libsrc_dir = contrib/src/mmedia
|
||||
|
||||
TARGET_LIBNAME=libmmedia
|
||||
|
||||
@@ -9,17 +10,20 @@ LIBVERSION_CURRENT=1
|
||||
LIBVERSION_REVISION=0
|
||||
LIBVERSION_AGE=0
|
||||
|
||||
HEADER_PATH=$(top_srcdir)/contrib/include/wx
|
||||
HEADER_SUBDIR=mmedia
|
||||
|
||||
HEADERS=cdbase.h cdunix.h cdwin.h sndaiff.h sndbase.h sndcodec.h \
|
||||
sndcpcm.h sndesd.h sndfile.h sndg72x.h sndmsad.h sndoss.h \
|
||||
sndpcm.h sndulaw.h sndwav.h sndwin.h vidbase.h vidwin.h \
|
||||
vidxanm.h
|
||||
|
||||
OBJECTS=cdbase.o cdwin.o g711.o g721.o g723_24.o \
|
||||
g723_40.o g72x.o sndaiff.o sndbase.o sndcodec.o \
|
||||
sndcpcm.o sndfile.o sndg72x.o sndpcm.o sndulaw.o \
|
||||
sndwav.o sndwin.o vidbase.o vidwin.o vidxanm.o sndoss.o sndesd.o
|
||||
|
||||
# the comment at the end of the next line is needed because otherwise autoconf
|
||||
# would remove this line completely - it contains a built-in hack to remove
|
||||
# any VPATH assignment not containing ':'
|
||||
VPATH = :$(top_srcdir)/src/mmedia # ':' for autoconf
|
||||
|
||||
APPEXTRADEFS=-I$(top_srcdir)/include
|
||||
APPEXTRADEFS=-I$(top_srcdir)/contrib/include
|
||||
|
||||
include $(top_builddir)/src/makelib.env
|
||||
|
||||
|
||||
@@ -312,8 +312,19 @@ FAIL_WITH(s->Write(&signature, 4).LastWrite() != 4, wxSOUND_INVSTRM);
|
||||
|
||||
delete frmt;
|
||||
}
|
||||
|
||||
|
||||
#if defined(__ALPHA__) || defined(__IA64__)
|
||||
// FIXME:
|
||||
// Linux Alpha spits passing size_t to a wxDataOutputStream, since it
|
||||
// appears to be an unsigned long type there.
|
||||
// This is a bandaid for 2.2 to get it to build there until we fix it
|
||||
// more sensibly.
|
||||
|
||||
data << (unsigned int)( fmt_data.GetSize() +
|
||||
m_sndformat->GetBytesFromTime(time) );
|
||||
#else
|
||||
data << (fmt_data.GetSize() + m_sndformat->GetBytesFromTime(time));
|
||||
#endif
|
||||
|
||||
// We, finally, copy the header block to the output stream
|
||||
{
|
||||
|
||||
@@ -18,8 +18,10 @@
|
||||
#include <wx/wx.h>
|
||||
#endif
|
||||
|
||||
#ifdef __WXGTK__
|
||||
// Pizza !
|
||||
#include <wx/gtk/win_gtk.h>
|
||||
#endif
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Intrinsic.h>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#
|
||||
# $Id$
|
||||
|
||||
top_srcdir = @top_srcdir@
|
||||
top_srcdir = @top_srcdir@/..
|
||||
top_builddir = ../../..
|
||||
libsrc_dir = contrib/src/ogl
|
||||
|
||||
TARGET_LIBNAME=libogl
|
||||
|
||||
@@ -9,14 +10,17 @@ LIBVERSION_CURRENT=1
|
||||
LIBVERSION_REVISION=0
|
||||
LIBVERSION_AGE=0
|
||||
|
||||
OBJECTS=basic.o bmpshape.o composit.o divided.o lines.o misc.o \
|
||||
basic2.o canvas.o constrnt.o drawn.o mfutils.o ogldiag.o
|
||||
HEADER_PATH=$(top_srcdir)/contrib/include/wx
|
||||
HEADER_SUBDIR=ogl
|
||||
|
||||
# the comment at the end of the next line is needed because otherwise autoconf
|
||||
# would remove this line completely - it contains a built-in hack to remove
|
||||
# any VPATH assignment not containing ':'
|
||||
VPATH = :$(top_srcdir)/src/ogl # ':' for autoconf
|
||||
HEADERS=basic.h basicp.h bmpshape.h canvas.h composit.h constrnt.h \
|
||||
divided.h drawn.h drawnp.h lines.h linesp.h mfutils.h misc.h \
|
||||
ogl.h ogldiag.h
|
||||
|
||||
APPEXTRADEFS=-I$(top_srcdir)/include
|
||||
OBJECTS=basic.o bmpshape.o composit.o divided.o lines.o misc.o \
|
||||
basic2.o canvas.o constrnt.o drawn.o mfutils.o ogldiag.o
|
||||
|
||||
APPEXTRADEFS=-I$(top_srcdir)/contrib/include
|
||||
|
||||
include $(top_builddir)/src/makelib.env
|
||||
|
||||
|
||||
@@ -132,7 +132,8 @@ DOCSOURCES=$(LOCALDOCDIR)\ogl.tex \
|
||||
$(LOCALDOCDIR)\topics.tex $(LOCALDOCDIR)\sample.tex
|
||||
|
||||
html: $(DOCDIR)\html\ogl\ogl.htm
|
||||
htmlhelp: $(DOCDIR)\html\ogl\ogl.chm
|
||||
htmlhelp: $(DOCDIR)\htmlhelp\ogl.chm
|
||||
htb: $(DOCDIR)\htb\ogl.htb
|
||||
hlp: $(DOCDIR)\winhelp\ogl.hlp
|
||||
pdfrtf: $(DOCDIR)\pdf\ogl.rtf
|
||||
ps: $(DOCDIR)\ps\ogl.ps
|
||||
@@ -166,16 +167,27 @@ $(DOCDIR)\html\ogl\ogl.htm: $(DOCSOURCES)
|
||||
copy *.gif $(DOCDIR)\html\ogl
|
||||
-start $(WAITFLAG) tex2rtf $(LOCALDOCDIR)\ogl.tex $(DOCDIR)\html\ogl\ogl.htm -twice -html
|
||||
-erase $(DOCDIR)\html\ogl\*.con
|
||||
-erase *.con
|
||||
-erase *.con
|
||||
-erase $(DOCDIR)\html\ogl\*.ref
|
||||
cd $(THISDIR)
|
||||
|
||||
|
||||
$(DOCDIR)\html\ogl\ogl.chm: $(DOCDIR)\html\ogl\ogl.htm $(DOCDIR)\html\ogl\ogl.hhp
|
||||
$(DOCDIR)\htmlhelp\ogl.chm: $(DOCDIR)\html\ogl\ogl.htm $(DOCDIR)\html\ogl\ogl.hhp
|
||||
cd $(DOCDIR)\html\ogl
|
||||
-hhc ogl.hhp
|
||||
move ogl.chm $(DOCDIR)\htmlhelp\ogl.chm
|
||||
cd $(THISDIR)
|
||||
|
||||
# An htb file is a zip file containing the .htm, .gif, .hhp, .hhc and .hhk
|
||||
# files, renamed to htb.
|
||||
# This can then be used with e.g. helpview.
|
||||
# Optionally, a cached version of the .hhp file can be generated with hhp2cached.
|
||||
$(DOCDIR)\htb\ogl.htb: $(DOCDIR)\html\ogl\ogl.htm
|
||||
cd $(DOCDIR)\html\ogl
|
||||
-erase /Y ogl.zip ogl.htb
|
||||
zip32 ogl.zip *.htm *.gif *.hhp *.hhc *.hhk
|
||||
-mkdir $(DOCDIR)\htb
|
||||
move ogl.zip $(DOCDIR)\htb\ogl.htb
|
||||
cd $(THISDIR)
|
||||
|
||||
$(LOCALDOCDIR)\ogl.dvi: $(DOCSOURCES)
|
||||
cd $(LOCALDOCDIR)
|
||||
@@ -193,4 +205,3 @@ $(WXDIR)\docs\ps\ogl.ps: $(LOCALDOCDIR)\ogl.dvi
|
||||
move ogl.ps $(WXDIR)\docs\ps\ogl.ps
|
||||
cd $(THISDIR)
|
||||
|
||||
|
||||
|
||||
@@ -5,12 +5,11 @@
|
||||
# Version: $Id$
|
||||
###############################################################################
|
||||
|
||||
top_srcdir = @top_srcdir@
|
||||
top_srcdir = @top_srcdir@/..
|
||||
top_builddir = ../../..
|
||||
|
||||
this_dir = $(top_srcdir)/src/stc
|
||||
scintilla_dir=$(this_dir)/scintilla
|
||||
VPATH=$(this_dir)@PATH_IFS@$(scintilla_dir)/src # ':' for autoconf
|
||||
scintilla_dir = $(top_srcdir)/contrib/src/stc/scintilla
|
||||
libsrc_dir = contrib/src/stc@PATH_IFS@$(scintilla_dir)/src
|
||||
|
||||
TARGET_LIBNAME=libstc
|
||||
|
||||
@@ -18,23 +17,40 @@ LIBVERSION_CURRENT=1
|
||||
LIBVERSION_REVISION=0
|
||||
LIBVERSION_AGE=0
|
||||
|
||||
HEADER_PATH=$(top_srcdir)/contrib/include/wx
|
||||
HEADER_SUBDIR=stc
|
||||
|
||||
HEADERS=stc.h
|
||||
|
||||
OBJECTS=PlatWX.o ScintillaWX.o stc.o \
|
||||
Accessor.o \
|
||||
AutoComplete.o \
|
||||
DocumentAccessor.o \
|
||||
LexCPP.o \
|
||||
LexHTML.o \
|
||||
LexLua.o \
|
||||
LexOthers.o \
|
||||
LexPerl.o \
|
||||
LexPython.o \
|
||||
LexSQL.o \
|
||||
LexVB.o \
|
||||
UniConversion.o \
|
||||
WindowAccessor.o \
|
||||
AutoComplete.o \
|
||||
CallTip.o \
|
||||
CellBuffer.o \
|
||||
ContractionState.o \
|
||||
CellBuffer.o \
|
||||
ContractionState.o \
|
||||
Document.o \
|
||||
Editor.o \
|
||||
Editor.o \
|
||||
Indicator.o \
|
||||
KeyMap.o \
|
||||
KeyMap.o \
|
||||
KeyWords.o \
|
||||
LineMarker.o \
|
||||
LineMarker.o \
|
||||
PropSet.o \
|
||||
ScintillaBase.o \
|
||||
ScintillaBase.o \
|
||||
Style.o \
|
||||
ViewStyle.o
|
||||
|
||||
APPEXTRADEFS=-D__WX__ -DSCI_LEXER -I$(scintilla_dir)/src -I$(scintilla_dir)/include -I$(top_srcdir)/include
|
||||
ViewStyle.o \
|
||||
PosRegExp.o \
|
||||
|
||||
|
||||
APPEXTRADEFS=-D__WX__ -DSCI_LEXER -I$(scintilla_dir)/src -I$(scintilla_dir)/include -I$(top_srcdir)/contrib/include
|
||||
|
||||
include $(top_builddir)/src/makelib.env
|
||||
|
||||
@@ -4,17 +4,23 @@
|
||||
// Robin Dunn <robin@aldunn.com>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include "Platform.h"
|
||||
#include "wx/stc/stc.h"
|
||||
|
||||
|
||||
#ifdef __WXGTK__
|
||||
#include <gtk/gtk.h>
|
||||
#endif
|
||||
|
||||
Point Point::FromLong(long lpoint) {
|
||||
return Point(lpoint & 0xFFFF, lpoint >> 32);
|
||||
return Point(lpoint & 0xFFFF, lpoint >> 16);
|
||||
}
|
||||
|
||||
wxRect wxRectFromPRectangle(PRectangle prc) {
|
||||
wxRect rc(prc.left, prc.top,
|
||||
prc.right-prc.left+1, prc.bottom-prc.top+1);
|
||||
prc.right-prc.left, prc.bottom-prc.top);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -105,14 +111,15 @@ Font::Font() {
|
||||
Font::~Font() {
|
||||
}
|
||||
|
||||
void Font::Create(const char *faceName, int size, bool bold, bool italic) {
|
||||
void Font::Create(const char *faceName, int characterSet, int size, bool bold, bool italic) {
|
||||
Release();
|
||||
id = new wxFont(size,
|
||||
wxDEFAULT,
|
||||
italic ? wxITALIC : wxNORMAL,
|
||||
bold ? wxBOLD : wxNORMAL,
|
||||
false,
|
||||
faceName);
|
||||
faceName,
|
||||
wxFONTENCODING_DEFAULT);
|
||||
}
|
||||
|
||||
|
||||
@@ -181,13 +188,21 @@ void Surface::BrushColor(Colour back) {
|
||||
}
|
||||
|
||||
void Surface::SetFont(Font &font_) {
|
||||
hdc->SetFont(*font_.GetID());
|
||||
if (font_.GetID()) {
|
||||
hdc->SetFont(*font_.GetID());
|
||||
}
|
||||
}
|
||||
|
||||
int Surface::LogPixelsY() {
|
||||
return hdc->GetPPI().y;
|
||||
}
|
||||
|
||||
|
||||
int Surface::DeviceHeightFont(int points) {
|
||||
return points * LogPixelsY() / 72;
|
||||
}
|
||||
|
||||
|
||||
void Surface::MoveTo(int x_, int y_) {
|
||||
x = x_;
|
||||
y = y_;
|
||||
@@ -232,7 +247,7 @@ void Surface::FillRectangle(PRectangle rc, Surface &surfacePattern) {
|
||||
void Surface::RoundedRectangle(PRectangle rc, Colour fore, Colour back) {
|
||||
PenColour(fore);
|
||||
BrushColor(back);
|
||||
hdc->DrawRoundedRectangle(wxRectFromPRectangle(rc), 8);
|
||||
hdc->DrawRoundedRectangle(wxRectFromPRectangle(rc), 4);
|
||||
}
|
||||
|
||||
void Surface::Ellipse(PRectangle rc, Colour fore, Colour back) {
|
||||
@@ -242,7 +257,8 @@ void Surface::Ellipse(PRectangle rc, Colour fore, Colour back) {
|
||||
}
|
||||
|
||||
void Surface::Copy(PRectangle rc, Point from, Surface &surfaceSource) {
|
||||
hdc->Blit(rc.left, rc.top, rc.Width(), rc.Height(),
|
||||
wxRect r = wxRectFromPRectangle(rc);
|
||||
hdc->Blit(r.x, r.y, r.width, r.height,
|
||||
surfaceSource.hdc, from.x, from.y, wxCOPY);
|
||||
}
|
||||
|
||||
@@ -344,7 +360,8 @@ void Surface::SetClip(PRectangle rc) {
|
||||
hdc->SetClippingRegion(wxRectFromPRectangle(rc));
|
||||
}
|
||||
|
||||
|
||||
void Surface::FlushCachedState() {
|
||||
}
|
||||
|
||||
Window::~Window() {
|
||||
}
|
||||
@@ -365,7 +382,8 @@ PRectangle Window::GetPosition() {
|
||||
}
|
||||
|
||||
void Window::SetPosition(PRectangle rc) {
|
||||
id->SetSize(rc.left, rc.top, rc.Width(), rc.Height());
|
||||
wxRect r = wxRectFromPRectangle(rc);
|
||||
id->SetSize(r);
|
||||
}
|
||||
|
||||
void Window::SetPositionRelative(PRectangle rc, Window) {
|
||||
@@ -374,7 +392,7 @@ void Window::SetPositionRelative(PRectangle rc, Window) {
|
||||
|
||||
PRectangle Window::GetClientPosition() {
|
||||
wxSize sz = id->GetClientSize();
|
||||
return PRectangle(0, 0, sz.x - 1, sz.y - 1);
|
||||
return PRectangle(0, 0, sz.x, sz.y);
|
||||
}
|
||||
|
||||
void Window::Show(bool show) {
|
||||
@@ -386,7 +404,8 @@ void Window::InvalidateAll() {
|
||||
}
|
||||
|
||||
void Window::InvalidateRectangle(PRectangle rc) {
|
||||
id->Refresh(false, &wxRectFromPRectangle(rc));
|
||||
wxRect r = wxRectFromPRectangle(rc);
|
||||
id->Refresh(false, &r);
|
||||
}
|
||||
|
||||
void Window::SetFont(Font &font) {
|
||||
@@ -432,6 +451,76 @@ void Window::SetTitle(const char *s) {
|
||||
}
|
||||
|
||||
|
||||
class wxSTCListBox : public wxListBox {
|
||||
public:
|
||||
wxSTCListBox(wxWindow* parent, wxWindowID id)
|
||||
: wxListBox(parent, id, wxDefaultPosition, wxDefaultSize,
|
||||
0, NULL, wxLB_SINGLE | wxLB_SORT | wxSIMPLE_BORDER)
|
||||
{}
|
||||
|
||||
void OnFocus(wxFocusEvent& event) {
|
||||
GetParent()->SetFocus();
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
#ifdef __WXGTK__
|
||||
void DoSetFirstItem(int n);
|
||||
#endif
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
BEGIN_EVENT_TABLE(wxSTCListBox, wxListBox)
|
||||
EVT_SET_FOCUS(wxSTCListBox::OnFocus)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __WXGTK__
|
||||
// This can be removed after 2.2.2 I think
|
||||
void wxSTCListBox::DoSetFirstItem( int n )
|
||||
{
|
||||
wxCHECK_RET( m_list, wxT("invalid listbox") );
|
||||
|
||||
if (gdk_pointer_is_grabbed () && GTK_WIDGET_HAS_GRAB (m_list))
|
||||
return;
|
||||
|
||||
// terribly efficient
|
||||
const gchar *vadjustment_key = "gtk-vadjustment";
|
||||
guint vadjustment_key_id = g_quark_from_static_string (vadjustment_key);
|
||||
|
||||
GtkAdjustment *adjustment =
|
||||
(GtkAdjustment*) gtk_object_get_data_by_id (GTK_OBJECT (m_list), vadjustment_key_id);
|
||||
wxCHECK_RET( adjustment, wxT("invalid listbox code") );
|
||||
|
||||
GList *target = g_list_nth( m_list->children, n );
|
||||
wxCHECK_RET( target, wxT("invalid listbox index") );
|
||||
|
||||
GtkWidget *item = GTK_WIDGET(target->data);
|
||||
wxCHECK_RET( item, wxT("invalid listbox code") );
|
||||
|
||||
// find the last item before this one which is already realized
|
||||
size_t nItemsBefore;
|
||||
for ( nItemsBefore = 0; item && (item->allocation.y == -1); nItemsBefore++ )
|
||||
{
|
||||
target = target->prev;
|
||||
if ( !target )
|
||||
{
|
||||
// nothing we can do if there are no allocated items yet
|
||||
return;
|
||||
}
|
||||
|
||||
item = GTK_WIDGET(target->data);
|
||||
}
|
||||
|
||||
gtk_adjustment_set_value(adjustment,
|
||||
item->allocation.y +
|
||||
nItemsBefore*item->allocation.height);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
ListBox::ListBox() {
|
||||
}
|
||||
@@ -440,8 +529,32 @@ ListBox::~ListBox() {
|
||||
}
|
||||
|
||||
void ListBox::Create(Window &parent, int ctrlID) {
|
||||
id = new wxListBox(parent.id, ctrlID, wxDefaultPosition, wxDefaultSize,
|
||||
0, NULL, wxLB_SINGLE | wxLB_SORT);
|
||||
id = new wxSTCListBox(parent.id, ctrlID);
|
||||
// id = new wxListBox(parent.id, ctrlID, wxDefaultPosition, wxDefaultSize,
|
||||
// 0, NULL, wxLB_SINGLE | wxLB_SORT | wxSIMPLE_BORDER);
|
||||
}
|
||||
|
||||
PRectangle ListBox::GetDesiredRect() {
|
||||
wxSize sz = ((wxListBox*)id)->GetBestSize();
|
||||
PRectangle rc;
|
||||
rc.top = 0;
|
||||
rc.left = 0;
|
||||
if (sz.x > 150) // TODO: A better way to determine these max sizes
|
||||
sz.x = 150;
|
||||
if (sz.y > 100)
|
||||
sz.y = 100;
|
||||
rc.right = sz.x;
|
||||
rc.bottom = sz.y;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
void ListBox::SetAverageCharWidth(int width) {
|
||||
aveCharWidth = width;
|
||||
}
|
||||
|
||||
void ListBox::SetFont(Font &font) {
|
||||
Window::SetFont(font);
|
||||
}
|
||||
|
||||
void ListBox::Clear() {
|
||||
@@ -458,6 +571,13 @@ int ListBox::Length() {
|
||||
|
||||
void ListBox::Select(int n) {
|
||||
((wxListBox*)id)->SetSelection(n);
|
||||
#ifdef __WXGTK__
|
||||
if (n > 4)
|
||||
n = n - 4;
|
||||
else
|
||||
n = 1;
|
||||
((wxListBox*)id)->SetFirstItem(n);
|
||||
#endif
|
||||
}
|
||||
|
||||
int ListBox::GetSelection() {
|
||||
@@ -465,7 +585,14 @@ int ListBox::GetSelection() {
|
||||
}
|
||||
|
||||
int ListBox::Find(const char *prefix) {
|
||||
return ((wxListBox*)id)->FindString(prefix);
|
||||
if (prefix) {
|
||||
for (int x=0; x < ((wxListBox*)id)->Number(); x++) {
|
||||
wxString text = ((wxListBox*)id)->GetString(x);
|
||||
if (text.StartsWith(prefix))
|
||||
return x;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void ListBox::GetValue(int n, char *value, int len) {
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include "ScintillaWX.h"
|
||||
#include "wx/stc/stc.h"
|
||||
|
||||
@@ -60,6 +62,29 @@ void wxSTCDropTarget::OnLeave() {
|
||||
}
|
||||
|
||||
|
||||
class wxSTCCallTip : public wxWindow {
|
||||
public:
|
||||
wxSTCCallTip(wxWindow* parent, int ID, CallTip* ct)
|
||||
: wxWindow(parent, ID)
|
||||
{
|
||||
m_ct = ct;
|
||||
}
|
||||
|
||||
void OnPaint(wxPaintEvent& evt) {
|
||||
wxPaintDC dc(this);
|
||||
Surface surfaceWindow;
|
||||
surfaceWindow.Init(&dc);
|
||||
m_ct->PaintCT(&surfaceWindow);
|
||||
surfaceWindow.Release();
|
||||
}
|
||||
|
||||
CallTip* m_ct;
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
BEGIN_EVENT_TABLE(wxSTCCallTip, wxWindow)
|
||||
EVT_PAINT(wxSTCCallTip::OnPaint)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Constructor/Destructor
|
||||
@@ -193,9 +218,8 @@ void ScintillaWX::NotifyParent(SCNotification scn) {
|
||||
void ScintillaWX::Copy() {
|
||||
if (currentPos != anchor) {
|
||||
char* text = CopySelectionRange();
|
||||
textDO.SetText(text);
|
||||
wxTheClipboard->Open();
|
||||
wxTheClipboard->SetData(&textDO);
|
||||
wxTheClipboard->SetData(new wxTextDataObject(text));
|
||||
wxTheClipboard->Close();
|
||||
}
|
||||
}
|
||||
@@ -236,7 +260,7 @@ bool ScintillaWX::CanPaste() {
|
||||
}
|
||||
|
||||
void ScintillaWX::CreateCallTipWindow(PRectangle) {
|
||||
ct.wCallTip = new wxWindow(wDraw.GetID(), -1);
|
||||
ct.wCallTip = new wxSTCCallTip(wDraw.GetID(), -1, &ct);
|
||||
ct.wDraw = ct.wCallTip;
|
||||
}
|
||||
|
||||
@@ -249,8 +273,6 @@ void ScintillaWX::AddToPopUp(const char *label, int cmd, bool enabled) {
|
||||
|
||||
if (!enabled)
|
||||
popup.GetID()->Enable(cmd, enabled);
|
||||
|
||||
// TODO: need to create event handler mappings for the cmd ID
|
||||
}
|
||||
|
||||
|
||||
@@ -259,18 +281,18 @@ void ScintillaWX::ClaimSelection() {
|
||||
}
|
||||
|
||||
|
||||
LRESULT ScintillaWX::DefWndProc(UINT /*iMessage*/, WPARAM /*wParam*/, LPARAM /*lParam*/) {
|
||||
long ScintillaWX::DefWndProc(unsigned int /*iMessage*/, unsigned long /*wParam*/, long /*lParam*/) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT ScintillaWX::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
|
||||
switch (iMessage) {
|
||||
case EM_CANPASTE:
|
||||
return CanPaste();
|
||||
default:
|
||||
long ScintillaWX::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
|
||||
// switch (iMessage) {
|
||||
// case EM_CANPASTE:
|
||||
// return CanPaste();
|
||||
// default:
|
||||
return ScintillaBase::WndProc(iMessage, wParam, lParam);
|
||||
}
|
||||
return 0;
|
||||
// }
|
||||
// return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -293,6 +315,11 @@ void ScintillaWX::DoPaint(wxDC* dc, wxRect rect) {
|
||||
FullPaint();
|
||||
}
|
||||
paintState = notPainting;
|
||||
#ifdef __WXGTK__
|
||||
// On wxGTK the editor window paints can overwrite the listbox...
|
||||
if (ac.Active())
|
||||
((wxWindow*)ac.lb.GetID())->Refresh(TRUE);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -384,10 +411,36 @@ void ScintillaWX::DoButtonMove(Point pt) {
|
||||
|
||||
|
||||
void ScintillaWX::DoAddChar(char ch) {
|
||||
//bool acActiveBeforeCharAdded = ac.Active();
|
||||
AddChar(ch);
|
||||
//if (acActiveBeforeCharAdded)
|
||||
// AutoCompleteChanged(ch);
|
||||
}
|
||||
|
||||
int ScintillaWX::DoKeyDown(int key, bool shift, bool ctrl, bool alt) {
|
||||
switch (key) {
|
||||
case WXK_DOWN: key = SCK_DOWN; break;
|
||||
case WXK_UP: key = SCK_UP; break;
|
||||
case WXK_LEFT: key = SCK_LEFT; break;
|
||||
case WXK_RIGHT: key = SCK_RIGHT; break;
|
||||
case WXK_HOME: key = SCK_HOME; break;
|
||||
case WXK_END: key = SCK_END; break;
|
||||
case WXK_PRIOR: key = SCK_PRIOR; break;
|
||||
case WXK_NEXT: key = SCK_NEXT; break;
|
||||
case WXK_DELETE: key = SCK_DELETE; break;
|
||||
case WXK_INSERT: key = SCK_INSERT; break;
|
||||
case WXK_ESCAPE: key = SCK_ESCAPE; break;
|
||||
case WXK_BACK: key = SCK_BACK; break;
|
||||
case WXK_TAB: key = SCK_TAB; break;
|
||||
case WXK_RETURN: key = SCK_RETURN; break;
|
||||
case WXK_ADD: key = SCK_ADD; break;
|
||||
case WXK_SUBTRACT: key = SCK_SUBTRACT; break;
|
||||
case WXK_DIVIDE: key = SCK_DIVIDE; break;
|
||||
case WXK_CONTROL: key = 0; break;
|
||||
case WXK_ALT: key = 0; break;
|
||||
case WXK_SHIFT: key = 0; break;
|
||||
}
|
||||
|
||||
return KeyDown(key, shift, ctrl, alt);
|
||||
}
|
||||
|
||||
@@ -401,6 +454,9 @@ void ScintillaWX::DoContextMenu(Point pt) {
|
||||
ContextMenu(pt);
|
||||
}
|
||||
|
||||
void ScintillaWX::DoOnListBox() {
|
||||
AutoCompleteCompleted();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
@@ -434,11 +490,15 @@ void ScintillaWX::DoDragLeave() {
|
||||
void ScintillaWX::FullPaint() {
|
||||
paintState = painting;
|
||||
rcPaint = GetTextRectangle();
|
||||
paintingAllText = true;
|
||||
wxClientDC dc(wMain.GetID());
|
||||
Surface surfaceWindow;
|
||||
surfaceWindow.Init(&dc);
|
||||
Paint(&surfaceWindow, rcPaint);
|
||||
surfaceWindow.Release();
|
||||
|
||||
// wMain.GetID()->Refresh(FALSE);
|
||||
|
||||
paintState = notPainting;
|
||||
}
|
||||
|
||||
|
||||
@@ -97,8 +97,12 @@ public:
|
||||
virtual void AddToPopUp(const char *label, int cmd = 0, bool enabled = true);
|
||||
virtual void ClaimSelection();
|
||||
|
||||
virtual LRESULT DefWndProc(UINT iMessage, WPARAM wParam, LPARAM lParam);
|
||||
virtual LRESULT WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam);
|
||||
virtual long DefWndProc(unsigned int iMessage,
|
||||
unsigned long wParam,
|
||||
long lParam);
|
||||
virtual long WndProc(unsigned int iMessage,
|
||||
unsigned long wParam,
|
||||
long lParam);
|
||||
|
||||
virtual void NotifyChange();
|
||||
virtual void NotifyParent(SCNotification scn);
|
||||
@@ -126,6 +130,7 @@ public:
|
||||
|
||||
void DoCommand(int ID);
|
||||
void DoContextMenu(Point pt);
|
||||
void DoOnListBox();
|
||||
|
||||
|
||||
// helpers
|
||||
@@ -139,7 +144,6 @@ private:
|
||||
bool capturedMouse;
|
||||
wxStyledTextCtrl* stc;
|
||||
|
||||
wxTextDataObject textDO;
|
||||
wxSTCDropTarget* dropTarget;
|
||||
wxDragResult dragResult;
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Microsoft Developer Studio Project File - Name="StcVC" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 5.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
@@ -22,11 +22,9 @@ CFG=StcVC - Win32 Debug
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "StcVC - Win32 Release"
|
||||
|
||||
@@ -40,11 +38,12 @@ RSC=rc.exe
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
RSC=rc.exe
|
||||
# ADD BASE RSC /l 0x809
|
||||
# ADD RSC /l 0x809
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../../include" /I "../../include" /I "scintilla/include" /I "scintilla/src" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D "__WX__" /D "SCI_LEXER" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x809
|
||||
# ADD RSC /l 0x809
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
@@ -64,11 +63,12 @@ LIB32=link.exe -lib
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
RSC=rc.exe
|
||||
# ADD BASE RSC /l 0x809
|
||||
# ADD RSC /l 0x809
|
||||
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /I "../../../include" /I "../../include" /I "scintilla/include" /I "scintilla/src" /D "_DEBUG" /D DEBUG=1 /D "__WXDEBUG__" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D "__WX__" /D "SCI_LEXER" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x809
|
||||
# ADD RSC /l 0x809
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
@@ -179,6 +179,34 @@ SOURCE=.\scintilla\src\KeyWords.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\scintilla\src\LexCPP.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\scintilla\src\LexHTML.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\scintilla\src\LexOthers.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\scintilla\src\LexPerl.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\scintilla\src\LexPython.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\scintilla\src\LexSQL.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\scintilla\src\LexVB.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\scintilla\src\LineMarker.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
684
contrib/src/stc/gen_iface.py
Normal file
@@ -0,0 +1,684 @@
|
||||
#!/bin/env python
|
||||
#----------------------------------------------------------------------------
|
||||
# Name: gen_iface.py
|
||||
# Purpose: Generate stc.h and stc.cpp from the info in Scintilla.iface
|
||||
#
|
||||
# Author: Robin Dunn
|
||||
#
|
||||
# Created: 5-Sept-2000
|
||||
# RCS-ID: $Id$
|
||||
# Copyright: (c) 2000 by Total Control Software
|
||||
# Licence: wxWindows license
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
||||
import sys, string, re
|
||||
from fileinput import FileInput
|
||||
|
||||
|
||||
IFACE = './scintilla/include/Scintilla.iface'
|
||||
H_TEMPLATE = './stc.h.in'
|
||||
CPP_TEMPLATE = './stc.cpp.in'
|
||||
H_DEST = '../../include/wx/stc/stc.h' # './stc_test.h' #
|
||||
CPP_DEST = './stc.cpp' #'./stc_test.cpp'
|
||||
|
||||
|
||||
# Value prefixes to convert
|
||||
valPrefixes = [('SCI_', ''),
|
||||
('SC_', ''),
|
||||
('SCN_', None), # just toss these...
|
||||
('SCEN_', None),
|
||||
('SCE_', ''),
|
||||
('SCLEX_', 'LEX_'),
|
||||
('SCK_', 'KEY_'),
|
||||
('SCFIND_', 'FIND_'),
|
||||
('SCWS_', 'WS_'),
|
||||
]
|
||||
|
||||
# Message funcion values that should have a CMD_ constant as well
|
||||
cmdValues = [ (2300, 2350), 2011, 2013, (2176, 2180) ]
|
||||
|
||||
|
||||
# Map some generic typenames to wx types, using return value syntax
|
||||
retTypeMap = {
|
||||
'position': 'int',
|
||||
'string': 'wxString',
|
||||
'colour': 'wxColour',
|
||||
}
|
||||
|
||||
# Map some generic typenames to wx types, using parameter syntax
|
||||
paramTypeMap = {
|
||||
'position': 'int',
|
||||
'string': 'const wxString&',
|
||||
'colour': 'const wxColour&',
|
||||
'keymod': 'int',
|
||||
}
|
||||
|
||||
# Map of method info that needs tweaked. Either the name needs changed, or
|
||||
# the method definition/implementation. Tuple items are:
|
||||
#
|
||||
# 1. New method name. None to skip the method, 0 to leave the
|
||||
# default name.
|
||||
# 2. Method definition for the .h file, 0 to leave alone
|
||||
# 3. Method implementation for the .cpp file, 0 to leave alone.
|
||||
# 4. tuple of Doc string lines, or 0 to leave alone.
|
||||
#
|
||||
methodOverrideMap = {
|
||||
'AddText' : (0,
|
||||
'void %s(const wxString& text);',
|
||||
|
||||
'''void %s(const wxString& text) {
|
||||
SendMsg(%s, text.Len(), (long)text.c_str());''',
|
||||
0),
|
||||
|
||||
'AddStyledText' : (0,
|
||||
'void %s(const wxString& text);',
|
||||
|
||||
'''void %s(const wxString& text) {
|
||||
SendMsg(%s, text.Len(), (long)text.c_str());''',
|
||||
0),
|
||||
|
||||
'GetViewWS' : ( 'GetViewWhiteSpace', 0, 0, 0),
|
||||
'SetViewWS' : ( 'SetViewWhiteSpace', 0, 0, 0),
|
||||
|
||||
'GetStyledText' : (0,
|
||||
'wxString %s(int startPos, int endPos);',
|
||||
|
||||
'''wxString %s(int startPos, int endPos) {
|
||||
wxString text;
|
||||
int len = endPos - startPos;
|
||||
TextRange tr;
|
||||
tr.lpstrText = text.GetWriteBuf(len*2+1);
|
||||
tr.chrg.cpMin = startPos;
|
||||
tr.chrg.cpMax = endPos;
|
||||
SendMsg(%s, 0, (long)&tr);
|
||||
text.UngetWriteBuf(len*2);
|
||||
return text;''',
|
||||
|
||||
('Retrieve a buffer of cells.',)),
|
||||
|
||||
|
||||
'PositionFromPoint' : (0,
|
||||
'int %s(wxPoint pt);',
|
||||
|
||||
'''int %s(wxPoint pt) {
|
||||
return SendMsg(%s, pt.x, pt.y);''',
|
||||
|
||||
0),
|
||||
|
||||
'GetCurLine' : (0,
|
||||
'wxString %s(int* OUTPUT=NULL);',
|
||||
|
||||
'''wxString %s(int* linePos) {
|
||||
wxString text;
|
||||
int len = LineLength(GetCurrentLine());
|
||||
char* buf = text.GetWriteBuf(len+1);
|
||||
|
||||
int pos = SendMsg(%s, len, (long)buf);
|
||||
text.UngetWriteBuf();
|
||||
if (linePos) *linePos = pos;
|
||||
|
||||
return text;''',
|
||||
|
||||
0),
|
||||
|
||||
'SetUsePalette' : (None, 0,0,0),
|
||||
|
||||
'MarkerSetFore' : ('MarkerSetForeground', 0, 0, 0),
|
||||
'MarkerSetBack' : ('MarkerSetBackground', 0, 0, 0),
|
||||
|
||||
'MarkerDefine' : (0,
|
||||
'''void %s(int markerNumber, int markerSymbol,
|
||||
const wxColour& foreground = wxNullColour,
|
||||
const wxColour& background = wxNullColour);''',
|
||||
|
||||
'''void %s(int markerNumber, int markerSymbol,
|
||||
const wxColour& foreground,
|
||||
const wxColour& background) {
|
||||
|
||||
SendMsg(%s, markerNumber, markerSymbol);
|
||||
if (foreground.Ok())
|
||||
MarkerSetForeground(markerNumber, foreground);
|
||||
if (background.Ok())
|
||||
MarkerSetBackground(markerNumber, background);''',
|
||||
|
||||
('Set the symbol used for a particular marker number,',
|
||||
'and optionally the for and background colours.')),
|
||||
|
||||
'SetMarginTypeN' : ('SetMarginType', 0, 0, 0),
|
||||
'GetMarginTypeN' : ('GetMarginType', 0, 0, 0),
|
||||
'SetMarginWidthN' : ('SetMarginWidth', 0, 0, 0),
|
||||
'GetMarginWidthN' : ('GetMarginWidth', 0, 0, 0),
|
||||
'SetMarginMaskN' : ('SetMarginMask', 0, 0, 0),
|
||||
'GetMarginMaskN' : ('GetMarginMask', 0, 0, 0),
|
||||
'SetMarginSensitiveN' : ('SetMarginSensitive', 0, 0, 0),
|
||||
'GetMarginSensitiveN' : ('GetMarginSensitive', 0, 0, 0),
|
||||
|
||||
'StyleSetFore' : ('StyleSetForeground', 0, 0, 0),
|
||||
'StyleSetBack' : ('StyleSetBackground', 0, 0, 0),
|
||||
'SetSelFore' : ('SetSelForeground', 0, 0, 0),
|
||||
'SetSelBack' : ('SetSelBackground', 0, 0, 0),
|
||||
'SetCaretFore' : ('SetCaretForeground', 0, 0, 0),
|
||||
'StyleSetFont' : ('StyleSetFaceName', 0, 0, 0),
|
||||
|
||||
# need to fix this to map between wx and scintilla encoding flags, leave it out for now...
|
||||
'StyleSetCharacterSet' : (None, 0, 0, 0),
|
||||
|
||||
'AssignCmdKey' : ('CmdKeyAssign',
|
||||
'void %s(int key, int modifiers, int cmd);',
|
||||
|
||||
'''void %s(int key, int modifiers, int cmd) {
|
||||
SendMsg(%s, MAKELONG(key, modifiers), cmd);''',
|
||||
|
||||
0),
|
||||
|
||||
'ClearCmdKey' : ('CmdKeyClear',
|
||||
'void %s(int key, int modifiers);',
|
||||
|
||||
'''void %s(int key, int modifiers) {
|
||||
SendMsg(%s, MAKELONG(key, modifiers));''',
|
||||
|
||||
0),
|
||||
|
||||
'ClearAllCmdKeys' : ('CmdKeyClearAll', 0, 0, 0),
|
||||
|
||||
|
||||
'SetStylingEx' : ('SetStyleBytes',
|
||||
'void %s(int length, char* styleBytes);',
|
||||
|
||||
'''void %s(int length, char* styleBytes) {
|
||||
SendMsg(%s, length, (long)styleBytes);''',
|
||||
|
||||
0),
|
||||
|
||||
|
||||
'IndicSetStyle' : ('IndicatorSetStyle', 0, 0, 0),
|
||||
'IndicGetStyle' : ('IndicatorGetStyle', 0, 0, 0),
|
||||
'IndicSetFore' : ('IndicatorSetForeground', 0, 0, 0),
|
||||
'IndicGetFore' : ('IndicatorGetForeground', 0, 0, 0),
|
||||
|
||||
'AutoCShow' : ('AutoCompShow', 0, 0, 0),
|
||||
'AutoCCancel' : ('AutoCompCancel', 0, 0, 0),
|
||||
'AutoCActive' : ('AutoCompActive', 0, 0, 0),
|
||||
'AutoCPosStart' : ('AutoCompPosStart', 0, 0, 0),
|
||||
'AutoCComplete' : ('AutoCompComplete', 0, 0, 0),
|
||||
'AutoCStops' : ('AutoCompStops', 0, 0, 0),
|
||||
'AutoCSetSeparator' : ('AutoCompSetSeparator', 0, 0, 0),
|
||||
'AutoCGetSeparator' : ('AutoCompGetSeparator', 0, 0, 0),
|
||||
'AutoCSelect' : ('AutoCompSelect', 0, 0, 0),
|
||||
'AutoCSetCancelAtStart' : ('AutoCompSetCancelAtStart', 0, 0, 0),
|
||||
'AutoCGetCancelAtStart' : ('AutoCompGetCancelAtStart', 0, 0, 0),
|
||||
'AutoCSetFillUps' : ('AutoCompSetFillUps', 0, 0, 0),
|
||||
'AutoCSetChooseSingle' : ('AutoCompSetChooseSingle', 0, 0, 0),
|
||||
'AutoCGetChooseSingle' : ('AutoCompGetChooseSingle', 0, 0, 0),
|
||||
'AutoCSetIgnoreCase' : ('AutoCompSetIgnoreCase', 0, 0, 0),
|
||||
'AutoCGetIgnoreCase' : ('AutoCompGetIgnoreCase', 0, 0, 0),
|
||||
|
||||
'SetHScrollBar' : ('SetUseHorizontalScrollBar', 0, 0, 0),
|
||||
'GetHScrollBar' : ('GetUseHorizontalScrollBar', 0, 0, 0),
|
||||
|
||||
'GetCaretFore' : ('GetCaretForeground', 0, 0, 0),
|
||||
|
||||
'GetUsePalette' : (None, 0, 0, 0),
|
||||
|
||||
'FindText' : (0,
|
||||
'''int %s(int minPos, int maxPos,
|
||||
const wxString& text,
|
||||
bool caseSensitive, bool wholeWord);''',
|
||||
'''int %s(int minPos, int maxPos,
|
||||
const wxString& text,
|
||||
bool caseSensitive, bool wholeWord) {
|
||||
TextToFind ft;
|
||||
int flags = 0;
|
||||
|
||||
flags |= caseSensitive ? SCFIND_MATCHCASE : 0;
|
||||
flags |= wholeWord ? SCFIND_WHOLEWORD : 0;
|
||||
ft.chrg.cpMin = minPos;
|
||||
ft.chrg.cpMax = maxPos;
|
||||
ft.lpstrText = (char*)text.c_str();
|
||||
|
||||
return SendMsg(%s, flags, (long)&ft);''',
|
||||
0),
|
||||
|
||||
'FormatRange' : (0,
|
||||
'''int %s(bool doDraw,
|
||||
int startPos,
|
||||
int endPos,
|
||||
wxDC* draw,
|
||||
wxDC* target, // Why does it use two? Can they be the same?
|
||||
wxRect renderRect,
|
||||
wxRect pageRect);''',
|
||||
''' int %s(bool doDraw,
|
||||
int startPos,
|
||||
int endPos,
|
||||
wxDC* draw,
|
||||
wxDC* target, // Why does it use two? Can they be the same?
|
||||
wxRect renderRect,
|
||||
wxRect pageRect) {
|
||||
RangeToFormat fr;
|
||||
|
||||
fr.hdc = draw;
|
||||
fr.hdcTarget = target;
|
||||
fr.rc.top = renderRect.GetTop();
|
||||
fr.rc.left = renderRect.GetLeft();
|
||||
fr.rc.right = renderRect.GetRight();
|
||||
fr.rc.bottom = renderRect.GetBottom();
|
||||
fr.rcPage.top = pageRect.GetTop();
|
||||
fr.rcPage.left = pageRect.GetLeft();
|
||||
fr.rcPage.right = pageRect.GetRight();
|
||||
fr.rcPage.bottom = pageRect.GetBottom();
|
||||
fr.chrg.cpMin = startPos;
|
||||
fr.chrg.cpMax = endPos;
|
||||
|
||||
return SendMsg(%s, doDraw, (long)&fr);''',
|
||||
0),
|
||||
|
||||
|
||||
'GetLine' : (0,
|
||||
'wxString %s(int line);',
|
||||
|
||||
'''wxString %s(int line) {
|
||||
wxString text;
|
||||
int len = LineLength(line);
|
||||
char* buf = text.GetWriteBuf(len+1);
|
||||
|
||||
int pos = SendMsg(%s, line, (long)buf);
|
||||
text.UngetWriteBuf();
|
||||
|
||||
return text;''',
|
||||
|
||||
('Retrieve the contents of a line.',)),
|
||||
|
||||
'SetSel' : ('SetSelection', 0, 0, 0),
|
||||
'GetSelText' : ('GetSelectedText',
|
||||
'wxString %s();',
|
||||
|
||||
'''wxString %s() {
|
||||
wxString text;
|
||||
int start;
|
||||
int end;
|
||||
|
||||
GetSelection(&start, &end);
|
||||
int len = end - start;
|
||||
char* buff = text.GetWriteBuf(len+1);
|
||||
|
||||
SendMsg(%s, 0, (long)buff);
|
||||
text.UngetWriteBuf();
|
||||
return text;''',
|
||||
|
||||
('Retrieve the selected text.',)),
|
||||
|
||||
'GetTextRange' : (0,
|
||||
'wxString %s(int startPos, int endPos);',
|
||||
|
||||
'''wxString %s(int startPos, int endPos) {
|
||||
wxString text;
|
||||
int len = endPos - startPos;
|
||||
char* buff = text.GetWriteBuf(len+1);
|
||||
TextRange tr;
|
||||
tr.lpstrText = buff;
|
||||
tr.chrg.cpMin = startPos;
|
||||
tr.chrg.cpMax = endPos;
|
||||
|
||||
SendMsg(%s, 0, (long)&tr);
|
||||
text.UngetWriteBuf();
|
||||
return text;''',
|
||||
|
||||
('Retrieve a range of text.',)),
|
||||
|
||||
'PointXFromPosition' : (None, 0, 0, 0),
|
||||
'PointYFromPosition' : (None, 0, 0, 0),
|
||||
|
||||
'ScrollCaret' : ('EnsureCaretVisible', 0, 0, 0),
|
||||
'ReplaceSel' : ('ReplaceSelection', 0, 0, 0),
|
||||
'Null' : (None, 0, 0, 0),
|
||||
|
||||
'GetText' : (0,
|
||||
'wxString %s();',
|
||||
|
||||
'''wxString %s() {
|
||||
wxString text;
|
||||
int len = GetTextLength()+1;
|
||||
char* buff = text.GetWriteBuf(len+1);
|
||||
|
||||
SendMsg(%s, len, (long)buff);
|
||||
buff[len] = 0;
|
||||
text.UngetWriteBuf();
|
||||
return text;''',
|
||||
|
||||
('Retrieve all the text in the document.', )),
|
||||
|
||||
'GetDirectFunction' : (None, 0, 0, 0),
|
||||
'GetDirectPointer' : (None, 0, 0, 0),
|
||||
|
||||
'CallTipPosStart' : ('CallTipPosAtStart', 0, 0, 0),
|
||||
'CallTipSetHlt' : ('CallTipSetHighlight', 0, 0, 0),
|
||||
'CallTipSetBack' : ('CallTipSetBackground', 0, 0, 0),
|
||||
|
||||
|
||||
# Remove all methods that are key commands since they can be
|
||||
# executed with CmdKeyExecute
|
||||
'LineDown' : (None, 0, 0, 0),
|
||||
'LineDownExtend' : (None, 0, 0, 0),
|
||||
'LineUp' : (None, 0, 0, 0),
|
||||
'LineUpExtend' : (None, 0, 0, 0),
|
||||
'CharLeft' : (None, 0, 0, 0),
|
||||
'CharLeftExtend' : (None, 0, 0, 0),
|
||||
'CharRight' : (None, 0, 0, 0),
|
||||
'CharRightExtend' : (None, 0, 0, 0),
|
||||
'WordLeft' : (None, 0, 0, 0),
|
||||
'WordLeftExtend' : (None, 0, 0, 0),
|
||||
'WordRight' : (None, 0, 0, 0),
|
||||
'WordRightExtend' : (None, 0, 0, 0),
|
||||
'Home' : (None, 0, 0, 0),
|
||||
'HomeExtend' : (None, 0, 0, 0),
|
||||
'LineEnd' : (None, 0, 0, 0),
|
||||
'LineEndExtend' : (None, 0, 0, 0),
|
||||
'DocumentStart' : (None, 0, 0, 0),
|
||||
'DocumentStartExtend' : (None, 0, 0, 0),
|
||||
'DocumentEnd' : (None, 0, 0, 0),
|
||||
'DocumentEndExtend' : (None, 0, 0, 0),
|
||||
'PageUp' : (None, 0, 0, 0),
|
||||
'PageUpExtend' : (None, 0, 0, 0),
|
||||
'PageDown' : (None, 0, 0, 0),
|
||||
'PageDownExtend' : (None, 0, 0, 0),
|
||||
'EditToggleOvertype' : (None, 0, 0, 0),
|
||||
'Cancel' : (None, 0, 0, 0),
|
||||
'DeleteBack' : (None, 0, 0, 0),
|
||||
'Tab' : (None, 0, 0, 0),
|
||||
'BackTab' : (None, 0, 0, 0),
|
||||
'NewLine' : (None, 0, 0, 0),
|
||||
'FormFeed' : (None, 0, 0, 0),
|
||||
'VCHome' : (None, 0, 0, 0),
|
||||
'VCHomeExtend' : (None, 0, 0, 0),
|
||||
'ZoomIn' : (None, 0, 0, 0),
|
||||
'ZoomOut' : (None, 0, 0, 0),
|
||||
'DelWordLeft' : (None, 0, 0, 0),
|
||||
'DelWordRight' : (None, 0, 0, 0),
|
||||
'LineCut' : (None, 0, 0, 0),
|
||||
'LineDelete' : (None, 0, 0, 0),
|
||||
'LineTranspose' : (None, 0, 0, 0),
|
||||
'LowerCase' : (None, 0, 0, 0),
|
||||
'UpperCase' : (None, 0, 0, 0),
|
||||
'LineScrollDown' : (None, 0, 0, 0),
|
||||
'LineScrollUp' : (None, 0, 0, 0),
|
||||
|
||||
|
||||
'GetDocPointer' : (0,
|
||||
'void* %s();',
|
||||
'''void* %s() {
|
||||
return (void*)SendMsg(%s);''',
|
||||
0),
|
||||
|
||||
'SetDocPointer' : (0,
|
||||
'void %s(void* docPointer);',
|
||||
'''void %s(void* docPointer) {
|
||||
SendMsg(%s, (long)docPointer);''',
|
||||
0),
|
||||
|
||||
'CreateDocument' : (0,
|
||||
'void* %s();',
|
||||
'''void* %s() {
|
||||
return (void*)SendMsg(%s);''',
|
||||
0),
|
||||
|
||||
'AddRefDocument' : (0,
|
||||
'void %s(void* docPointer);',
|
||||
'''void %s(void* docPointer) {
|
||||
SendMsg(%s, (long)docPointer);''',
|
||||
0),
|
||||
|
||||
'ReleaseDocument' : (0,
|
||||
'void %s(void* docPointer);',
|
||||
'''void %s(void* docPointer) {
|
||||
SendMsg(%s, (long)docPointer);''',
|
||||
0),
|
||||
|
||||
'GrabFocus' : (None, 0, 0, 0),
|
||||
|
||||
'' : ('', 0, 0, 0),
|
||||
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
def processIface(iface, h_tmplt, cpp_tmplt, h_dest, cpp_dest):
|
||||
curDocStrings = []
|
||||
values = []
|
||||
methods = []
|
||||
|
||||
# parse iface file
|
||||
fi = FileInput(iface)
|
||||
for line in fi:
|
||||
line = line[:-1]
|
||||
if line[:2] == '##' or line == '':
|
||||
#curDocStrings = []
|
||||
continue
|
||||
|
||||
op = line[:4]
|
||||
if line[:2] == '# ': # a doc string
|
||||
curDocStrings.append(line[2:])
|
||||
|
||||
elif op == 'val ':
|
||||
parseVal(line[4:], values, curDocStrings)
|
||||
curDocStrings = []
|
||||
|
||||
elif op == 'fun ' or op == 'set ' or op == 'get ':
|
||||
parseFun(line[4:], methods, curDocStrings, values)
|
||||
curDocStrings = []
|
||||
|
||||
elif op == 'cat ':
|
||||
if string.strip(line[4:]) == 'Deprecated':
|
||||
break # skip the rest of the file
|
||||
|
||||
elif op == 'evt ':
|
||||
pass
|
||||
|
||||
else:
|
||||
print '***** Unknown line type: ', line
|
||||
|
||||
|
||||
# process templates
|
||||
data = {}
|
||||
data['VALUES'] = processVals(values)
|
||||
defs, imps = processMethods(methods)
|
||||
data['METHOD_DEFS'] = defs
|
||||
data['METHOD_IMPS'] = imps
|
||||
|
||||
# get template text
|
||||
h_text = open(h_tmplt).read()
|
||||
cpp_text = open(cpp_tmplt).read()
|
||||
|
||||
# do the substitutions
|
||||
h_text = h_text % data
|
||||
cpp_text = cpp_text % data
|
||||
|
||||
# write out destination files
|
||||
open(h_dest, 'w').write(h_text)
|
||||
open(cpp_dest, 'w').write(cpp_text)
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
def processVals(values):
|
||||
text = []
|
||||
for name, value, docs in values:
|
||||
if docs:
|
||||
text.append('')
|
||||
for x in docs:
|
||||
text.append('// ' + x)
|
||||
text.append('#define %s %s' % (name, value))
|
||||
return string.join(text, '\n')
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
def processMethods(methods):
|
||||
defs = []
|
||||
imps = []
|
||||
|
||||
for retType, name, number, param1, param2, docs in methods:
|
||||
retType = retTypeMap.get(retType, retType)
|
||||
params = makeParamString(param1, param2)
|
||||
|
||||
name, theDef, theImp, docs = checkMethodOverride(name, number, docs)
|
||||
|
||||
if name is None:
|
||||
continue
|
||||
|
||||
# Build the method definition for the .h file
|
||||
if docs:
|
||||
defs.append('')
|
||||
for x in docs:
|
||||
defs.append(' // ' + x)
|
||||
if not theDef:
|
||||
theDef = ' %s %s(%s);' % (retType, name, params)
|
||||
defs.append(theDef)
|
||||
|
||||
# Build the method implementation string
|
||||
if docs:
|
||||
imps.append('')
|
||||
for x in docs:
|
||||
imps.append('// ' + x)
|
||||
if not theImp:
|
||||
theImp = '%s wxStyledTextCtrl::%s(%s) {\n ' % (retType, name, params)
|
||||
|
||||
if retType == 'wxColour':
|
||||
theImp = theImp + 'long c = '
|
||||
elif retType != 'void':
|
||||
theImp = theImp + 'return '
|
||||
theImp = theImp + 'SendMsg(%s, %s, %s)' % (number,
|
||||
makeArgString(param1),
|
||||
makeArgString(param2))
|
||||
if retType == 'bool':
|
||||
theImp = theImp + ' != 0'
|
||||
if retType == 'wxColour':
|
||||
theImp = theImp + ';\n return wxColourFromLong(c)'
|
||||
|
||||
theImp = theImp + ';\n}'
|
||||
imps.append(theImp)
|
||||
|
||||
|
||||
return string.join(defs, '\n'), string.join(imps, '\n')
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
def checkMethodOverride(name, number, docs):
|
||||
theDef = theImp = None
|
||||
if methodOverrideMap.has_key(name):
|
||||
item = methodOverrideMap[name]
|
||||
|
||||
if item[0] != 0:
|
||||
name = item[0]
|
||||
if item[1] != 0:
|
||||
theDef = ' ' + (item[1] % name)
|
||||
if item[2] != 0:
|
||||
theImp = item[2] % ('wxStyledTextCtrl::'+name, number) + '\n}'
|
||||
if item[3] != 0:
|
||||
docs = item[3]
|
||||
|
||||
return name, theDef, theImp, docs
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
def makeArgString(param):
|
||||
if not param:
|
||||
return '0'
|
||||
|
||||
typ, name = param
|
||||
|
||||
if typ == 'string':
|
||||
return '(long)%s.c_str()' % name
|
||||
if typ == 'colour':
|
||||
return 'wxColourAsLong(%s)' % name
|
||||
|
||||
return name
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
def makeParamString(param1, param2):
|
||||
def doOne(param):
|
||||
if param:
|
||||
aType = paramTypeMap.get(param[0], param[0])
|
||||
return aType + ' ' + param[1]
|
||||
else:
|
||||
return ''
|
||||
|
||||
st = doOne(param1)
|
||||
if st and param2:
|
||||
st = st + ', '
|
||||
st = st + doOne(param2)
|
||||
return st
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
def parseVal(line, values, docs):
|
||||
name, val = string.split(line, '=')
|
||||
|
||||
# remove prefixes such as SCI, etc.
|
||||
for old, new in valPrefixes:
|
||||
lo = len(old)
|
||||
if name[:lo] == old:
|
||||
if new is None:
|
||||
return
|
||||
name = new + name[lo:]
|
||||
|
||||
# add it to the list
|
||||
values.append( ('wxSTC_' + name, val, docs) )
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
funregex = re.compile(r'\s*([a-zA-Z0-9_]+)' # <ws>return type
|
||||
'\s+([a-zA-Z0-9_]+)=' # <ws>name=
|
||||
'([0-9]+)' # number
|
||||
'\(([ a-zA-Z0-9_]*),' # (param,
|
||||
'([ a-zA-Z0-9_]*)\)') # param)
|
||||
|
||||
def parseFun(line, methods, docs, values):
|
||||
def parseParam(param):
|
||||
param = string.strip(param)
|
||||
if param == '':
|
||||
param = None
|
||||
else:
|
||||
param = tuple(string.split(param))
|
||||
return param
|
||||
|
||||
mo = funregex.match(line)
|
||||
if mo is None:
|
||||
print "***** Line doesn't match! : " + line
|
||||
|
||||
retType, name, number, param1, param2 = mo.groups()
|
||||
|
||||
param1 = parseParam(param1)
|
||||
param2 = parseParam(param2)
|
||||
|
||||
# Special case. For the key command functionss we want a value defined too
|
||||
num = string.atoi(number)
|
||||
for v in cmdValues:
|
||||
if (type(v) == type(()) and v[0] <= num < v[1]) or v == num:
|
||||
parseVal('CMD_%s=%s' % (string.upper(name), number), values, ())
|
||||
|
||||
#if retType == 'void' and not param1 and not param2:
|
||||
|
||||
methods.append( (retType, name, number, param1, param2, tuple(docs)) )
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
||||
def main(args):
|
||||
# TODO: parse command line args to replace default input/output files???
|
||||
|
||||
# Now just do it
|
||||
processIface(IFACE, H_TEMPLATE, CPP_TEMPLATE, H_DEST, CPP_DEST)
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(sys.argv)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# File: makefile.b32
|
||||
# Author: Julian Smart
|
||||
# Created: 1999
|
||||
# Updated:
|
||||
# Updated:
|
||||
# Copyright:
|
||||
#
|
||||
# Makefile : Builds wxMMedia library for 32-bit BC++
|
||||
@@ -21,25 +21,38 @@ STCEXTRACPPFLAGS=-D__WX__ -DSCI_LEXER -I$(SCINTILLA)/include -I$(S)
|
||||
LIBTARGET=$(WXDIR)\contrib\lib\stc.lib
|
||||
|
||||
OBJECTS = \
|
||||
Accessor.obj \
|
||||
Accessor.obj \
|
||||
AutoComplete.obj \
|
||||
CallTip.obj \
|
||||
CellBuffer.obj \
|
||||
ContractionState.obj\
|
||||
Document.obj \
|
||||
CallTip.obj \
|
||||
CellBuffer.obj \
|
||||
ContractionState.obj \
|
||||
Document.obj \
|
||||
DocumentAccessor.obj \
|
||||
Editor.obj \
|
||||
Indicator.obj \
|
||||
Indicator.obj \
|
||||
KeyMap.obj \
|
||||
KeyWords.obj \
|
||||
LineMarker.obj \
|
||||
PropSet.obj \
|
||||
KeyWords.obj \
|
||||
LexCPP.obj \
|
||||
LexHTML.obj \
|
||||
LexLua.obj \
|
||||
LexOthers.obj \
|
||||
LexPerl.obj \
|
||||
LexPython.obj \
|
||||
LexSQL.obj \
|
||||
LexVB.obj \
|
||||
LineMarker.obj \
|
||||
PropSet.obj \
|
||||
PosRegExp.obj \
|
||||
ScintillaBase.obj \
|
||||
Style.obj \
|
||||
ViewStyle.obj \
|
||||
UniConversion.obj \
|
||||
ViewStyle.obj \
|
||||
WindowAccessor.obj \
|
||||
\
|
||||
PlatWX.obj \
|
||||
ScintillaWX.obj \
|
||||
stc.obj \
|
||||
ScintillaWX.obj \
|
||||
stc.obj \
|
||||
|
||||
|
||||
!include $(WXDIR)\src\makelib.b32
|
||||
|
||||
|
||||
@@ -25,6 +25,18 @@ OBJECTS = \
|
||||
$(S)/ScintillaBase.$(OBJSUFF) \
|
||||
$(S)/Style.$(OBJSUFF) \
|
||||
$(S)/ViewStyle.$(OBJSUFF) \
|
||||
$(S)/LexCPP.$(OBJSUFF) \
|
||||
$(S)/LexHTML.$(OBJSUFF) \
|
||||
$(S)/LexLua.$(OBJSUFF) \
|
||||
$(S)/LexOthers.$(OBJSUFF) \
|
||||
$(S)/LexPerl.$(OBJSUFF) \
|
||||
$(S)/LexPython.$(OBJSUFF) \
|
||||
$(S)/LexSQL.$(OBJSUFF) \
|
||||
$(S)/LexVB.$(OBJSUFF) \
|
||||
$(S)/DocumentAccessor.$(OBJSUFF)\
|
||||
$(S)/UniConversion.$(OBJSUFF) \
|
||||
$(S)/WindowAccessor.$(OBJSUFF) \
|
||||
$(S)/PosRegExp.$(OBJSUFF) \
|
||||
PlatWX.$(OBJSUFF) \
|
||||
ScintillaWX.$(OBJSUFF) \
|
||||
stc.$(OBJSUFF)
|
||||
|
||||
@@ -15,21 +15,32 @@ NOPCH=1
|
||||
!include $(WXDIR)\src\makevc.env
|
||||
|
||||
OBJECTS = \
|
||||
$(D)\Accessor.obj \
|
||||
$(D)\AutoComplete.obj \
|
||||
$(D)\CallTip.obj \
|
||||
$(D)\CellBuffer.obj \
|
||||
$(D)\ContractionState.obj\
|
||||
$(D)\Document.obj \
|
||||
$(D)\DocumentAccessor.obj\
|
||||
$(D)\Editor.obj \
|
||||
$(D)\Indicator.obj \
|
||||
$(D)\KeyMap.obj \
|
||||
$(D)\KeyWords.obj \
|
||||
$(D)\LexCPP.obj \
|
||||
$(D)\LexHTML.obj \
|
||||
$(D)\LexLua.obj \
|
||||
$(D)\LexOthers.obj \
|
||||
$(D)\LexPerl.obj \
|
||||
$(D)\LexPython.obj \
|
||||
$(D)\LexSQL.obj \
|
||||
$(D)\LexVB.obj \
|
||||
$(D)\LineMarker.obj \
|
||||
$(D)\PosRegExp.obj \
|
||||
$(D)\PropSet.obj \
|
||||
$(D)\ScintillaBase.obj \
|
||||
$(D)\Style.obj \
|
||||
$(D)\UniConversion.obj \
|
||||
$(D)\ViewStyle.obj \
|
||||
$(D)\WindowAccessor.obj \
|
||||
\
|
||||
$(D)\PlatWX.obj \
|
||||
$(D)\ScintillaWX.obj \
|
||||
|
||||
@@ -3,5 +3,5 @@ scintilla/include directories from the Scintilla/SCiTE source
|
||||
distribution. All other code needed to implement Scintilla on top of
|
||||
wxWindows is located in the directory above this one.
|
||||
|
||||
The current version of the Scintilla code is somewhere between 1.22
|
||||
and 1.23, (from their CVS.)
|
||||
The current version of the Scintilla code is 1.32
|
||||
|
||||
|
||||
@@ -3,26 +3,30 @@
|
||||
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
enum { wsSpace = 1, wsTab = 2, wsSpaceTab = 4, wsInconsistent=8};
|
||||
|
||||
class Accessor;
|
||||
|
||||
typedef bool (*PFNIsCommentLeader)(Accessor &styler, int pos, int len);
|
||||
|
||||
// Interface to data in a Scintilla
|
||||
class Accessor {
|
||||
protected:
|
||||
// bufferSize is a trade off between time taken to copy the characters and SendMessage overhead
|
||||
enum {extremePosition=0x7FFFFFFF};
|
||||
// bufferSize is a trade off between time taken to copy the characters and retrieval overhead
|
||||
// slopSize positions the buffer before the desired position in case there is some backtracking
|
||||
enum {bufferSize=4000, slopSize=bufferSize/8};
|
||||
char buf[bufferSize+1];
|
||||
WindowID id;
|
||||
PropSet &props;
|
||||
int startPos;
|
||||
int endPos;
|
||||
int lenDoc;
|
||||
int offset; // Optional but including an offset makes GCC generate better code
|
||||
void Fill(int position);
|
||||
int codePage;
|
||||
|
||||
virtual bool InternalIsLeadByte(char ch)=0;
|
||||
virtual void Fill(int position)=0;
|
||||
public:
|
||||
Accessor(WindowID id_, PropSet &props_, int offset_=0) :
|
||||
id(id_), props(props_), startPos(0x7FFFFFFF), endPos(0),
|
||||
lenDoc(-1), offset(offset_) {
|
||||
}
|
||||
Accessor() : startPos(extremePosition), endPos(0), codePage(0) {}
|
||||
virtual ~Accessor() {}
|
||||
char operator[](int position) {
|
||||
position += offset;
|
||||
if (position < startPos || position >= endPos) {
|
||||
Fill(position);
|
||||
}
|
||||
@@ -30,7 +34,6 @@ public:
|
||||
}
|
||||
char SafeGetCharAt(int position, char chDefault=' ') {
|
||||
// Safe version of operator[], returning a defined value for invalid position
|
||||
position += offset;
|
||||
if (position < startPos || position >= endPos) {
|
||||
Fill(position);
|
||||
if (position < startPos || position >= endPos) {
|
||||
@@ -40,37 +43,28 @@ public:
|
||||
}
|
||||
return buf[position - startPos];
|
||||
}
|
||||
char StyleAt(int position);
|
||||
int GetLine(int position);
|
||||
int LineStart(int line);
|
||||
int LevelAt(int line);
|
||||
int Length();
|
||||
void Flush() {
|
||||
startPos = 0x7FFFFFFF;
|
||||
lenDoc = -1;
|
||||
bool IsLeadByte(char ch) {
|
||||
return codePage && InternalIsLeadByte(ch);
|
||||
}
|
||||
int GetLineState(int line);
|
||||
int SetLineState(int line, int state);
|
||||
PropSet &GetPropSet() { return props; }
|
||||
};
|
||||
|
||||
class StylingContext : public Accessor {
|
||||
char styleBuf[bufferSize];
|
||||
int validLen;
|
||||
char chFlags;
|
||||
char chWhile;
|
||||
unsigned int startSeg;
|
||||
public:
|
||||
StylingContext(WindowID id_, PropSet &props_, int offset_=0) :
|
||||
Accessor(id_,props_,offset_), validLen(0), chFlags(0) {}
|
||||
void StartAt(unsigned int start, char chMask=31);
|
||||
void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; };
|
||||
void ColourSegment(unsigned int start, unsigned int end, int chAttr);
|
||||
unsigned int GetStartSegment() { return startSeg; }
|
||||
void StartSegment(unsigned int pos);
|
||||
void ColourTo(unsigned int pos, int chAttr);
|
||||
int GetLine(int position);
|
||||
void SetLevel(int line, int level);
|
||||
void Flush();
|
||||
void SetCodePage(int codePage_) { codePage = codePage_; }
|
||||
|
||||
virtual char StyleAt(int position)=0;
|
||||
virtual int GetLine(int position)=0;
|
||||
virtual int LineStart(int line)=0;
|
||||
virtual int LevelAt(int line)=0;
|
||||
virtual int Length()=0;
|
||||
virtual void Flush()=0;
|
||||
virtual int GetLineState(int line)=0;
|
||||
virtual int SetLineState(int line, int state)=0;
|
||||
virtual int GetPropertyInt(const char *key, int defaultValue=0)=0;
|
||||
|
||||
// Style setting
|
||||
virtual void StartAt(unsigned int start, char chMask=31)=0;
|
||||
virtual void SetFlags(char chFlags_, char chWhile_)=0;
|
||||
virtual unsigned int GetStartSegment()=0;
|
||||
virtual void StartSegment(unsigned int pos)=0;
|
||||
virtual void ColourTo(unsigned int pos, int chAttr)=0;
|
||||
virtual void SetLevel(int line, int level)=0;
|
||||
virtual int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0)=0;
|
||||
};
|
||||
|
||||
|
||||
@@ -3,6 +3,39 @@
|
||||
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
void ColouriseDoc(int codePage, int startPos, int lengthDoc, int initStyle,
|
||||
int language, WordList *keywordlists[], StylingContext &styler);
|
||||
typedef void (*LexerFunction)(unsigned int startPos, int lengthDoc, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler);
|
||||
|
||||
class LexerModule {
|
||||
static LexerModule *base;
|
||||
LexerModule *next;
|
||||
int language;
|
||||
LexerFunction fn;
|
||||
public:
|
||||
LexerModule(int language_, LexerFunction fn_);
|
||||
static void Colourise(unsigned int startPos, int lengthDoc, int initStyle,
|
||||
int language, WordList *keywordlists[], Accessor &styler);
|
||||
};
|
||||
|
||||
inline bool iswordchar(char ch) {
|
||||
return isalnum(ch) || ch == '.' || ch == '_';
|
||||
}
|
||||
|
||||
inline bool iswordstart(char ch) {
|
||||
return isalnum(ch) || ch == '_';
|
||||
}
|
||||
|
||||
inline bool isoperator(char ch) {
|
||||
if (isalnum(ch))
|
||||
return false;
|
||||
// '.' left out as it is used to make up numbers
|
||||
if (ch == '%' || ch == '^' || ch == '&' || ch == '*' ||
|
||||
ch == '(' || ch == ')' || ch == '-' || ch == '+' ||
|
||||
ch == '=' || ch == '|' || ch == '{' || ch == '}' ||
|
||||
ch == '[' || ch == ']' || ch == ':' || ch == ';' ||
|
||||
ch == '<' || ch == '>' || ch == ',' || ch == '/' ||
|
||||
ch == '?' || ch == '!' || ch == '.' || ch == '~')
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#pragma warning(disable: 4800 4244 4309)
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <richedit.h>
|
||||
#endif
|
||||
|
||||
@@ -79,12 +80,6 @@ typedef wxWindow* WindowID;
|
||||
typedef wxMenu* MenuID;
|
||||
#endif
|
||||
|
||||
#if PLAT_GTK || PLAT_WX
|
||||
#define SHIFT_PRESSED 1
|
||||
#define LEFT_CTRL_PRESSED 2
|
||||
#define LEFT_ALT_PRESSED 4
|
||||
#endif
|
||||
|
||||
// Point is exactly the same as the Win32 POINT and GTK+ GdkPoint so can be used interchangeably
|
||||
|
||||
class Point {
|
||||
@@ -198,6 +193,7 @@ public:
|
||||
};
|
||||
|
||||
class Font {
|
||||
protected:
|
||||
FontID id;
|
||||
#if PLAT_WX
|
||||
int ascent;
|
||||
@@ -207,18 +203,21 @@ class Font {
|
||||
Font &operator=(const Font &) { id=0; return *this; }
|
||||
public:
|
||||
Font();
|
||||
~Font();
|
||||
virtual ~Font();
|
||||
|
||||
void Create(const char *faceName, int size, bool bold=false, bool italic=false);
|
||||
void Release();
|
||||
virtual void Create(const char *faceName, int characterSet, int size, bool bold, bool italic);
|
||||
virtual void Release();
|
||||
|
||||
FontID GetID() { return id; }
|
||||
// Alias another font - caller guarantees not to Release
|
||||
void SetID(FontID id_) { id = id_; }
|
||||
friend class Surface;
|
||||
};
|
||||
|
||||
// A surface abstracts a place to draw
|
||||
class Surface {
|
||||
private:
|
||||
bool unicodeMode;
|
||||
#if PLAT_GTK
|
||||
GdkDrawable *drawable;
|
||||
GdkGC *gc;
|
||||
@@ -266,6 +265,7 @@ public:
|
||||
bool Initialised();
|
||||
void PenColour(Colour fore);
|
||||
int LogPixelsY();
|
||||
int DeviceHeightFont(int points);
|
||||
void MoveTo(int x_, int y_);
|
||||
void LineTo(int x_, int y_);
|
||||
void Polygon(Point *pts, int npts, Colour fore, Colour back);
|
||||
@@ -290,6 +290,11 @@ public:
|
||||
|
||||
int SetPalette(Palette *pal, bool inBackGround);
|
||||
void SetClip(PRectangle rc);
|
||||
void FlushCachedState();
|
||||
|
||||
void SetUnicodeMode(bool unicodeMode_) {
|
||||
unicodeMode=unicodeMode_;
|
||||
}
|
||||
};
|
||||
|
||||
// Class to hide the details of window manipulation
|
||||
@@ -300,6 +305,7 @@ protected:
|
||||
WindowID id;
|
||||
public:
|
||||
Window() : id(0) {}
|
||||
Window(const Window &source) : id(source.id) {}
|
||||
virtual ~Window();
|
||||
Window &operator=(WindowID id_) {
|
||||
id = id_;
|
||||
@@ -316,7 +322,7 @@ public:
|
||||
void Show(bool show=true);
|
||||
void InvalidateAll();
|
||||
void InvalidateRectangle(PRectangle rc);
|
||||
void SetFont(Font &font);
|
||||
virtual void SetFont(Font &font);
|
||||
enum Cursor { cursorText, cursorArrow, cursorUp, cursorWait, cursorHoriz, cursorVert, cursorReverseArrow };
|
||||
void SetCursor(Cursor curs);
|
||||
void SetTitle(const char *s);
|
||||
@@ -333,14 +339,17 @@ class ListBox : public Window {
|
||||
WindowID scroller;
|
||||
int current;
|
||||
#endif
|
||||
int desiredVisibleRows;
|
||||
unsigned int maxItemCharacters;
|
||||
unsigned int aveCharWidth;
|
||||
public:
|
||||
ListBox();
|
||||
virtual ~ListBox();
|
||||
ListBox &operator=(WindowID id_) {
|
||||
id = id_;
|
||||
return *this;
|
||||
}
|
||||
void Create(Window &parent, int ctrlID);
|
||||
virtual void SetFont(Font &font);
|
||||
void SetAverageCharWidth(int width);
|
||||
void SetVisibleRows(int rows);
|
||||
PRectangle GetDesiredRect();
|
||||
void Clear();
|
||||
void Append(char *s);
|
||||
int Length();
|
||||
@@ -385,6 +394,16 @@ public:
|
||||
// These are utility functions not really tied to a platform
|
||||
static int Minimum(int a, int b);
|
||||
static int Maximum(int a, int b);
|
||||
// Next three assume 16 bit shorts and 32 bit longs
|
||||
static long LongFromTwoShorts(short a,short b) {
|
||||
return (a) | ((b) << 16);
|
||||
}
|
||||
static short HighShortFromLong(long x) {
|
||||
return static_cast<short>(x >> 16);
|
||||
}
|
||||
static short LowShortFromLong(long x) {
|
||||
return static_cast<short>(x & 0xffff);
|
||||
}
|
||||
static void DebugPrintf(const char *format, ...);
|
||||
static int Clamp(int val, int minVal, int maxVal);
|
||||
};
|
||||
|
||||
138
contrib/src/stc/scintilla/include/PosRegExp.h
Normal file
@@ -0,0 +1,138 @@
|
||||
#ifndef POSREGEXP_H
|
||||
#define POSREGEXP_H
|
||||
|
||||
#define MatchesNum 0x10
|
||||
|
||||
enum EOps
|
||||
{
|
||||
ReBlockOps = 0x1000,
|
||||
ReMul, // *
|
||||
RePlus, // +
|
||||
ReQuest, // ?
|
||||
ReNGMul, // *?
|
||||
ReNGPlus, // +?
|
||||
ReNGQuest, // ??
|
||||
ReRangeN, // {n,}
|
||||
ReRangeNM, // {n,m}
|
||||
ReNGRangeN, // {n,}?
|
||||
ReNGRangeNM, // {n,m}?
|
||||
ReOr, // |
|
||||
ReBehind = 0x1100, // ?#n
|
||||
ReNBehind = 0x1200, // ?~n
|
||||
ReAhead = 0x1300, // ?=
|
||||
ReNAhead = 0x1400, // ?!
|
||||
|
||||
ReSymbolOps = 0x2000,
|
||||
ReEmpty,
|
||||
ReSymb, // a b \W \s ...
|
||||
ReEnum, // []
|
||||
ReNEnum, // [^]
|
||||
ReBrackets, // (...)
|
||||
ReBkTrace = 0x2100, // \yN
|
||||
ReBkBrack = 0x2200 // \N
|
||||
};
|
||||
|
||||
enum ESymbols
|
||||
{
|
||||
ReAnyChr = 0x4000, // .
|
||||
ReSoL, // ^
|
||||
ReEoL, // $
|
||||
ReDigit, // \d
|
||||
ReNDigit, // \D
|
||||
ReWordSymb, // \w
|
||||
ReNWordSymb, // \W
|
||||
ReWSpace, // \s
|
||||
ReNWSpace, // \S
|
||||
ReUCase, // \u
|
||||
ReNUCase , // \l
|
||||
ReWBound, // \b
|
||||
ReNWBound, // \B
|
||||
RePreNW, // \c
|
||||
ReStart, // \m
|
||||
ReEnd, // \M
|
||||
|
||||
ReChr = 0x0 // Char in Lower Byte
|
||||
};
|
||||
enum ETempSymb
|
||||
{
|
||||
ReTemp = 0x7000,
|
||||
ReLBrack, ReRBrack,
|
||||
ReEnumS, ReEnumE, ReNEnumS,
|
||||
ReRangeS, ReRangeE, ReNGRangeE, ReFrToEnum
|
||||
};
|
||||
|
||||
#define BackSlash '\\'
|
||||
|
||||
typedef union SCharData
|
||||
{
|
||||
int IArr[8];
|
||||
char CArr[32];
|
||||
void SetBit(unsigned char Bit);
|
||||
void ClearBit(unsigned char Bit);
|
||||
bool GetBit(unsigned char Bit);
|
||||
} *PCharData;
|
||||
|
||||
typedef struct SRegInfo
|
||||
{
|
||||
SRegInfo();
|
||||
~SRegInfo();
|
||||
|
||||
EOps Op;
|
||||
union{
|
||||
SRegInfo *Param;
|
||||
int Symb;
|
||||
PCharData ChrClass;
|
||||
}un;
|
||||
int s,e;
|
||||
SRegInfo *Parent;
|
||||
SRegInfo *Next;
|
||||
} *PRegInfo;
|
||||
|
||||
typedef struct SMatches
|
||||
{
|
||||
int s[MatchesNum];
|
||||
int e[MatchesNum];
|
||||
int CurMatch;
|
||||
} *PMatches;
|
||||
|
||||
typedef class PosRegExp
|
||||
{
|
||||
PRegInfo Info;
|
||||
PMatches BkTrace;
|
||||
bool NoCase,Extend,NoMoves;
|
||||
bool Error;
|
||||
int *Exprn;
|
||||
int posParse;
|
||||
int posEnd,posStart;
|
||||
int posBkStr;
|
||||
int FirstChar;
|
||||
|
||||
bool SetExprLow(const char *Expr);
|
||||
bool SetStructs(PRegInfo &Info,int st,int end);
|
||||
void Optimize();
|
||||
bool CheckSymb(int Symb,bool Inc);
|
||||
bool LowParse(PRegInfo Re);
|
||||
bool LowParseRe(PRegInfo &Next);
|
||||
bool LowCheckNext(PRegInfo Re);
|
||||
bool ParseRe(int posStr);
|
||||
bool QuickCheck();
|
||||
public:
|
||||
PMatches Matches;
|
||||
int Ok, CurMatch;
|
||||
|
||||
void *param;
|
||||
char (*CharAt)(int pos, void *param);
|
||||
|
||||
PosRegExp();
|
||||
~PosRegExp();
|
||||
|
||||
bool isok();
|
||||
bool SetNoMoves(bool Moves);
|
||||
bool SetBkTrace(int posStr,PMatches Trace);
|
||||
bool SetExpr(const char *Expr);
|
||||
bool Parse(int posStr, int posStop, PMatches Mtch);
|
||||
bool Parse(int posStr,int posSol, int posEol, PMatches Mtch, int Moves = -1);
|
||||
bool Evaluate(char *Expr, int posStr, PMatches Mtch, char **Res);
|
||||
} *PPosRegExp;
|
||||
|
||||
#endif /* POSREGEXP_H */
|
||||
@@ -8,44 +8,92 @@
|
||||
|
||||
bool EqualCaseInsensitive(const char *a, const char *b);
|
||||
|
||||
#if PLAT_WIN
|
||||
#define strcasecmp stricmp
|
||||
#define strncasecmp strnicmp
|
||||
#endif
|
||||
|
||||
#ifdef __WXMSW__
|
||||
#define strcasecmp stricmp
|
||||
#define strncasecmp strnicmp
|
||||
#endif
|
||||
|
||||
// Define another string class.
|
||||
// While it would be 'better' to use std::string, that doubles the executable size.
|
||||
|
||||
inline char *StringDup(const char *s) {
|
||||
inline char *StringDup(const char *s, int len=-1) {
|
||||
if (!s)
|
||||
return 0;
|
||||
char *sNew = new char[strlen(s) + 1];
|
||||
if (sNew)
|
||||
strcpy(sNew, s);
|
||||
if (len == -1)
|
||||
len = strlen(s);
|
||||
char *sNew = new char[len + 1];
|
||||
if (sNew) {
|
||||
strncpy(sNew, s, len);
|
||||
sNew[len] = '\0';
|
||||
}
|
||||
return sNew;
|
||||
}
|
||||
|
||||
class SString {
|
||||
char *s;
|
||||
int ssize;
|
||||
public:
|
||||
typedef const char* const_iterator;
|
||||
typedef int size_type;
|
||||
static size_type npos;
|
||||
const char* begin(void) const {
|
||||
return s;
|
||||
}
|
||||
const char* end(void) const {
|
||||
return &s[ssize];
|
||||
}
|
||||
size_type size(void) const {
|
||||
if (s)
|
||||
return ssize;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
SString &assign(const char* sother, int size_ = -1) {
|
||||
char *t = s;
|
||||
s = StringDup(sother,size_);
|
||||
ssize = (s) ? strlen(s) : 0;
|
||||
delete []t;
|
||||
return *this;
|
||||
}
|
||||
SString &assign(const SString& sother, int size_ = -1) {
|
||||
return assign(sother.s,size_);
|
||||
}
|
||||
SString &assign(const_iterator ibeg, const_iterator iend) {
|
||||
return assign(ibeg,iend - ibeg);
|
||||
}
|
||||
SString() {
|
||||
s = 0;
|
||||
ssize = 0;
|
||||
}
|
||||
SString(const SString &source) {
|
||||
s = StringDup(source.s);
|
||||
ssize = (s) ? strlen(s) : 0;
|
||||
}
|
||||
SString(const char *s_) {
|
||||
s = StringDup(s_);
|
||||
ssize = (s) ? strlen(s) : 0;
|
||||
}
|
||||
SString(int i) {
|
||||
char number[100];
|
||||
sprintf(number, "%0d", i);
|
||||
//itoa(i, number, 10);
|
||||
s = StringDup(number);
|
||||
ssize = (s) ? strlen(s) : 0;
|
||||
}
|
||||
~SString() {
|
||||
delete []s;
|
||||
s = 0;
|
||||
ssize = 0;
|
||||
}
|
||||
SString &operator=(const SString &source) {
|
||||
if (this != &source) {
|
||||
delete []s;
|
||||
s = StringDup(source.s);
|
||||
ssize = (s) ? strlen(s) : 0;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -56,6 +104,9 @@ public:
|
||||
return false;
|
||||
return strcmp(s, other.s) == 0;
|
||||
}
|
||||
bool operator!=(const SString &other) const {
|
||||
return !operator==(other);
|
||||
}
|
||||
bool operator==(const char *sother) const {
|
||||
if ((s == 0) && (sother == 0))
|
||||
return true;
|
||||
@@ -63,6 +114,9 @@ public:
|
||||
return false;
|
||||
return strcmp(s, sother) == 0;
|
||||
}
|
||||
bool operator!=(const char *sother) const {
|
||||
return !operator==(sother);
|
||||
}
|
||||
const char *c_str() const {
|
||||
if (s)
|
||||
return s;
|
||||
@@ -75,106 +129,116 @@ public:
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
char operator[](int i) {
|
||||
char operator[](int i) const {
|
||||
if (s)
|
||||
return s[i];
|
||||
else
|
||||
return '\0';
|
||||
}
|
||||
SString &operator +=(const char *sother) {
|
||||
return append(sother,-1);
|
||||
}
|
||||
SString &operator +=(const SString &sother) {
|
||||
return append(sother.s,sother.ssize);
|
||||
}
|
||||
SString &operator +=(char ch) {
|
||||
return append(&ch,1);
|
||||
}
|
||||
SString &append(const char* sother, int lenOther) {
|
||||
int len = length();
|
||||
int lenOther = strlen(sother);
|
||||
if(lenOther < 0)
|
||||
lenOther = strlen(sother);
|
||||
char *sNew = new char[len + lenOther + 1];
|
||||
if (sNew) {
|
||||
if (s)
|
||||
memcpy(sNew, s, len);
|
||||
memcpy(sNew + len, sother, lenOther);
|
||||
strncpy(&sNew[len], sother, lenOther);
|
||||
sNew[len + lenOther] = '\0';
|
||||
delete []s;
|
||||
s = sNew;
|
||||
ssize = (s) ? strlen(s) : 0;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
int value() {
|
||||
int value() const {
|
||||
if (s)
|
||||
return atoi(s);
|
||||
else
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
void substitute(char find, char replace) {
|
||||
char *t = s;
|
||||
while (t) {
|
||||
t = strchr(t, find);
|
||||
if (t)
|
||||
*t = replace;
|
||||
}
|
||||
}
|
||||
// I don't think this really belongs here -- Neil
|
||||
void correctPath() {
|
||||
#ifdef unix
|
||||
substitute('\\', '/');
|
||||
#else
|
||||
substitute('/', '\\');
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
struct Property {
|
||||
unsigned int hash;
|
||||
char *key;
|
||||
char *val;
|
||||
Property *next;
|
||||
Property() : hash(0), key(0), val(0), next(0) {}
|
||||
};
|
||||
|
||||
class PropSet {
|
||||
private:
|
||||
char **vals;
|
||||
int size;
|
||||
int used;
|
||||
enum { hashRoots=31 };
|
||||
Property *props[hashRoots];
|
||||
public:
|
||||
PropSet *superPS;
|
||||
PropSet();
|
||||
~PropSet();
|
||||
void EnsureCanAddEntry();
|
||||
void Set(const char *key, const char *val);
|
||||
void Set(char *keyval);
|
||||
SString Get(const char *key);
|
||||
SString GetExpanded(const char *key);
|
||||
SString Expand(const char *withvars);
|
||||
int GetInt(const char *key, int defaultValue=0);
|
||||
SString GetWild(const char *keybase, const char *filename);
|
||||
SString GetNewExpand(const char *keybase, const char *filename);
|
||||
void Clear();
|
||||
void ReadFromMemory(const char *data, int len);
|
||||
void Read(const char *filename);
|
||||
};
|
||||
|
||||
// This is a fixed length list of strings suitable for display in combo boxes
|
||||
// as a memory of user entries
|
||||
template<int sz>
|
||||
class EntryMemory {
|
||||
SString entries[sz];
|
||||
public:
|
||||
void Insert(SString s) {
|
||||
for (int i=0;i<sz;i++) {
|
||||
if (entries[i] == s) {
|
||||
for (int j=i;j>0;j--) {
|
||||
entries[j] = entries[j-1];
|
||||
}
|
||||
entries[0] = s;
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (int k=sz-1;k>0;k--) {
|
||||
entries[k] = entries[k-1];
|
||||
}
|
||||
entries[0] = s;
|
||||
}
|
||||
int Length() const {
|
||||
int len = 0;
|
||||
for (int i=0;i<sz;i++)
|
||||
if (entries[i].length())
|
||||
len++;
|
||||
return len;
|
||||
}
|
||||
SString At(int n) const {
|
||||
return entries[n];
|
||||
}
|
||||
void ReadFromMemory(const char *data, int len, const char *directoryForImports=0);
|
||||
void Read(const char *filename, const char *directoryForImports);
|
||||
};
|
||||
|
||||
class WordList {
|
||||
public:
|
||||
// Each word contains at least one character - a empty word acts as sentinal at the end.
|
||||
char **words;
|
||||
char **wordsNoCase;
|
||||
char *list;
|
||||
int len;
|
||||
bool onlyLineEnds; // Delimited by any white space or only line ends
|
||||
bool sorted;
|
||||
int starts[256];
|
||||
WordList(bool onlyLineEnds_ = false) :
|
||||
words(0), list(0), len(0), onlyLineEnds(onlyLineEnds_) {}
|
||||
WordList(bool onlyLineEnds_ = false) :
|
||||
words(0), wordsNoCase(0), list(0), len(0), onlyLineEnds(onlyLineEnds_), sorted(false) {}
|
||||
~WordList() { Clear(); }
|
||||
operator bool() { return list; }
|
||||
operator bool() { return words ? true : false; }
|
||||
const char *operator[](int ind) { return words[ind]; }
|
||||
void Clear();
|
||||
void Set(const char *s);
|
||||
char *Allocate(int size);
|
||||
void SetFromAllocated();
|
||||
bool InList(const char *s);
|
||||
const char *GetNearestWord(const char *wordStart, int searchLen = -1, bool ignoreCase = false);
|
||||
char *GetNearestWords(const char *wordStart, int searchLen = -1, bool ignoreCase = false);
|
||||
};
|
||||
|
||||
inline bool nonFuncChar(char ch) {
|
||||
return strchr("\t\n\r !\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~", ch) != NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,11 +3,15 @@
|
||||
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
// Most of this file is automatically generated from the Scintilla.iface interface definition
|
||||
// file which contains any comments about the definitions. HFacer.py does the generation.
|
||||
|
||||
#ifndef SCILEXER_H
|
||||
#define SCILEXER_H
|
||||
|
||||
// SciLexer features - not in standard Scintilla
|
||||
|
||||
//++Autogenerated -- start of section automatically generated from Scintilla.iface
|
||||
#define SCLEX_CONTAINER 0
|
||||
#define SCLEX_NULL 1
|
||||
#define SCLEX_PYTHON 2
|
||||
@@ -21,8 +25,10 @@
|
||||
#define SCLEX_ERRORLIST 10
|
||||
#define SCLEX_MAKEFILE 11
|
||||
#define SCLEX_BATCH 12
|
||||
|
||||
// Lexical states for SCLEX_PYTHON
|
||||
#define SCLEX_XCODE 13
|
||||
#define SCLEX_LATEX 14
|
||||
#define SCLEX_LUA 15
|
||||
#define SCLEX_DIFF 16
|
||||
#define SCE_P_DEFAULT 0
|
||||
#define SCE_P_COMMENTLINE 1
|
||||
#define SCE_P_NUMBER 2
|
||||
@@ -35,8 +41,8 @@
|
||||
#define SCE_P_DEFNAME 9
|
||||
#define SCE_P_OPERATOR 10
|
||||
#define SCE_P_IDENTIFIER 11
|
||||
|
||||
// Lexical states for SCLEX_CPP, SCLEX_VB
|
||||
#define SCE_P_COMMENTBLOCK 12
|
||||
#define SCE_P_STRINGEOL 13
|
||||
#define SCE_C_DEFAULT 0
|
||||
#define SCE_C_COMMENT 1
|
||||
#define SCE_C_COMMENTLINE 2
|
||||
@@ -45,13 +51,12 @@
|
||||
#define SCE_C_WORD 5
|
||||
#define SCE_C_STRING 6
|
||||
#define SCE_C_CHARACTER 7
|
||||
#define SCE_C_PUNTUATION 8
|
||||
#define SCE_C_UUID 8
|
||||
#define SCE_C_PREPROCESSOR 9
|
||||
#define SCE_C_OPERATOR 10
|
||||
#define SCE_C_IDENTIFIER 11
|
||||
#define SCE_C_STRINGEOL 12
|
||||
|
||||
// Lexical states for SCLEX_HTML, SCLEX_xML
|
||||
#define SCE_C_VERBATIM 13
|
||||
#define SCE_H_DEFAULT 0
|
||||
#define SCE_H_TAG 1
|
||||
#define SCE_H_TAGUNKNOWN 2
|
||||
@@ -63,51 +68,90 @@
|
||||
#define SCE_H_OTHER 8
|
||||
#define SCE_H_COMMENT 9
|
||||
#define SCE_H_ENTITY 10
|
||||
// Embedded Javascript
|
||||
#define SCE_HJ_START 11
|
||||
#define SCE_HJ_DEFAULT 12
|
||||
#define SCE_HJ_COMMENT 13
|
||||
#define SCE_HJ_COMMENTLINE 14
|
||||
#define SCE_HJ_COMMENTDOC 15
|
||||
#define SCE_HJ_NUMBER 16
|
||||
#define SCE_HJ_WORD 17
|
||||
#define SCE_HJ_KEYWORD 18
|
||||
#define SCE_HJ_DOUBLESTRING 19
|
||||
#define SCE_HJ_SINGLESTRING 20
|
||||
#define SCE_HJ_SYMBOLS 21
|
||||
#define SCE_HJ_STRINGEOL 28
|
||||
// XML and ASP
|
||||
#define SCE_H_TAGEND 22
|
||||
#define SCE_H_XMLSTART 23
|
||||
#define SCE_H_XMLEND 24
|
||||
#define SCE_H_SCRIPT 25
|
||||
#define SCE_H_ASP 26
|
||||
#define SCE_H_ASPAT 27
|
||||
// Embedded VBScript
|
||||
#define SCE_HB_START 40
|
||||
#define SCE_HB_DEFAULT 41
|
||||
#define SCE_HB_COMMENTLINE 42
|
||||
#define SCE_HB_NUMBER 43
|
||||
#define SCE_HB_WORD 44
|
||||
#define SCE_HB_STRING 45
|
||||
#define SCE_HB_IDENTIFIER 46
|
||||
#define SCE_HB_STRINGEOL 47
|
||||
// Embedded Python
|
||||
#define SCE_HP_START 50
|
||||
#define SCE_HP_DEFAULT 51
|
||||
#define SCE_HP_COMMENTLINE 52
|
||||
#define SCE_HP_NUMBER 53
|
||||
#define SCE_HP_STRING 54
|
||||
#define SCE_HP_CHARACTER 55
|
||||
#define SCE_HP_WORD 56
|
||||
#define SCE_HP_TRIPLE 57
|
||||
#define SCE_HP_TRIPLEDOUBLE 58
|
||||
#define SCE_HP_CLASSNAME 59
|
||||
#define SCE_HP_DEFNAME 60
|
||||
#define SCE_HP_OPERATOR 61
|
||||
#define SCE_HP_IDENTIFIER 62
|
||||
|
||||
// Lexical states for SCLEX_PERL
|
||||
#define SCE_H_TAGEND 11
|
||||
#define SCE_H_XMLSTART 12
|
||||
#define SCE_H_XMLEND 13
|
||||
#define SCE_H_SCRIPT 14
|
||||
#define SCE_H_ASP 15
|
||||
#define SCE_H_ASPAT 16
|
||||
#define SCE_H_CDATA 17
|
||||
#define SCE_H_QUESTION 18
|
||||
#define SCE_H_VALUE 19
|
||||
#define SCE_HJ_START 40
|
||||
#define SCE_HJ_DEFAULT 41
|
||||
#define SCE_HJ_COMMENT 42
|
||||
#define SCE_HJ_COMMENTLINE 43
|
||||
#define SCE_HJ_COMMENTDOC 44
|
||||
#define SCE_HJ_NUMBER 45
|
||||
#define SCE_HJ_WORD 46
|
||||
#define SCE_HJ_KEYWORD 47
|
||||
#define SCE_HJ_DOUBLESTRING 48
|
||||
#define SCE_HJ_SINGLESTRING 49
|
||||
#define SCE_HJ_SYMBOLS 50
|
||||
#define SCE_HJ_STRINGEOL 51
|
||||
#define SCE_HJA_START 55
|
||||
#define SCE_HJA_DEFAULT 56
|
||||
#define SCE_HJA_COMMENT 57
|
||||
#define SCE_HJA_COMMENTLINE 58
|
||||
#define SCE_HJA_COMMENTDOC 59
|
||||
#define SCE_HJA_NUMBER 60
|
||||
#define SCE_HJA_WORD 61
|
||||
#define SCE_HJA_KEYWORD 62
|
||||
#define SCE_HJA_DOUBLESTRING 63
|
||||
#define SCE_HJA_SINGLESTRING 64
|
||||
#define SCE_HJA_SYMBOLS 65
|
||||
#define SCE_HJA_STRINGEOL 66
|
||||
#define SCE_HB_START 70
|
||||
#define SCE_HB_DEFAULT 71
|
||||
#define SCE_HB_COMMENTLINE 72
|
||||
#define SCE_HB_NUMBER 73
|
||||
#define SCE_HB_WORD 74
|
||||
#define SCE_HB_STRING 75
|
||||
#define SCE_HB_IDENTIFIER 76
|
||||
#define SCE_HB_STRINGEOL 77
|
||||
#define SCE_HBA_START 80
|
||||
#define SCE_HBA_DEFAULT 81
|
||||
#define SCE_HBA_COMMENTLINE 82
|
||||
#define SCE_HBA_NUMBER 83
|
||||
#define SCE_HBA_WORD 84
|
||||
#define SCE_HBA_STRING 85
|
||||
#define SCE_HBA_IDENTIFIER 86
|
||||
#define SCE_HBA_STRINGEOL 87
|
||||
#define SCE_HP_START 90
|
||||
#define SCE_HP_DEFAULT 91
|
||||
#define SCE_HP_COMMENTLINE 92
|
||||
#define SCE_HP_NUMBER 93
|
||||
#define SCE_HP_STRING 94
|
||||
#define SCE_HP_CHARACTER 95
|
||||
#define SCE_HP_WORD 96
|
||||
#define SCE_HP_TRIPLE 97
|
||||
#define SCE_HP_TRIPLEDOUBLE 98
|
||||
#define SCE_HP_CLASSNAME 99
|
||||
#define SCE_HP_DEFNAME 100
|
||||
#define SCE_HP_OPERATOR 101
|
||||
#define SCE_HP_IDENTIFIER 102
|
||||
#define SCE_HPA_START 105
|
||||
#define SCE_HPA_DEFAULT 106
|
||||
#define SCE_HPA_COMMENTLINE 107
|
||||
#define SCE_HPA_NUMBER 108
|
||||
#define SCE_HPA_STRING 109
|
||||
#define SCE_HPA_CHARACTER 110
|
||||
#define SCE_HPA_WORD 111
|
||||
#define SCE_HPA_TRIPLE 112
|
||||
#define SCE_HPA_TRIPLEDOUBLE 113
|
||||
#define SCE_HPA_CLASSNAME 114
|
||||
#define SCE_HPA_DEFNAME 115
|
||||
#define SCE_HPA_OPERATOR 116
|
||||
#define SCE_HPA_IDENTIFIER 117
|
||||
#define SCE_HPHP_DEFAULT 118
|
||||
#define SCE_HPHP_HSTRING 119
|
||||
#define SCE_HPHP_SIMPLESTRING 120
|
||||
#define SCE_HPHP_WORD 121
|
||||
#define SCE_HPHP_NUMBER 122
|
||||
#define SCE_HPHP_VARIABLE 123
|
||||
#define SCE_HPHP_COMMENT 124
|
||||
#define SCE_HPHP_COMMENTLINE 125
|
||||
#define SCE_HPHP_STRINGEOL 126
|
||||
#define SCE_PL_DEFAULT 0
|
||||
#define SCE_PL_HERE 1
|
||||
#define SCE_PL_COMMENTLINE 2
|
||||
@@ -130,5 +174,31 @@
|
||||
#define SCE_PL_LONGQUOTE 19
|
||||
#define SCE_PL_BACKTICKS 20
|
||||
#define SCE_PL_DATASECTION 21
|
||||
|
||||
#define SCE_L_DEFAULT 0
|
||||
#define SCE_L_COMMAND 1
|
||||
#define SCE_L_TAG 2
|
||||
#define SCE_L_MATH 3
|
||||
#define SCE_L_COMMENT 4
|
||||
#define SCE_LUA_DEFAULT 0
|
||||
#define SCE_LUA_COMMENT 1
|
||||
#define SCE_LUA_COMMENTLINE 2
|
||||
#define SCE_LUA_COMMENTDOC 3
|
||||
#define SCE_LUA_NUMBER 4
|
||||
#define SCE_LUA_WORD 5
|
||||
#define SCE_LUA_STRING 6
|
||||
#define SCE_LUA_CHARACTER 7
|
||||
#define SCE_LUA_LITERALSTRING 8
|
||||
#define SCE_LUA_PREPROCESSOR 9
|
||||
#define SCE_LUA_OPERATOR 10
|
||||
#define SCE_LUA_IDENTIFIER 11
|
||||
#define SCE_LUA_STRINGEOL 12
|
||||
#define SCE_ERR_DEFAULT 0
|
||||
#define SCE_ERR_PYTHON 1
|
||||
#define SCE_ERR_GCC 2
|
||||
#define SCE_ERR_MS 3
|
||||
#define SCE_ERR_CMD 4
|
||||
#define SCE_ERR_BORLAND 5
|
||||
#define SCE_ERR_PERL 6
|
||||
//--Autogenerated -- end of section automatically generated from Scintilla.iface
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,117 +3,74 @@
|
||||
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
// Most of this file is automatically generated from the Scintilla.iface interface definition
|
||||
// file which contains any comments about the definitions. HFacer.py does the generation.
|
||||
|
||||
#ifndef SCINTILLA_H
|
||||
#define SCINTILLA_H
|
||||
|
||||
// Compile-time configuration options
|
||||
#define MACRO_SUPPORT 1 // Comment out to remove macro hooks
|
||||
|
||||
#if PLAT_GTK
|
||||
#include <gdk/gdk.h>
|
||||
#include <gtk/gtkvbox.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#if PLAT_WIN
|
||||
#ifdef STATIC_BUILD
|
||||
void Scintilla_RegisterClasses(HINSTANCE hInstance);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define SCINTILLA(obj) GTK_CHECK_CAST (obj, scintilla_get_type (), ScintillaObject)
|
||||
#define SCINTILLA_CLASS(klass) GTK_CHECK_CLASS_CAS T (klass, scintilla_get_type (), ScintillaClass)
|
||||
#define IS_SCINTILLA(obj) GTK_CHECK_TYPE (obj, scintilla_get_type ())
|
||||
typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wParam, long lParam);
|
||||
|
||||
typedef struct _ScintillaObject ScintillaObject;
|
||||
typedef struct _ScintillaClass ScintillaClass;
|
||||
|
||||
struct _ScintillaObject
|
||||
{
|
||||
GtkFixed vbox;
|
||||
void *pscin;
|
||||
};
|
||||
|
||||
struct _ScintillaClass
|
||||
{
|
||||
GtkFixedClass parent_class;
|
||||
|
||||
void (* command) (ScintillaObject *ttt);
|
||||
void (* notify) (ScintillaObject *ttt);
|
||||
};
|
||||
|
||||
guint scintilla_get_type (void);
|
||||
GtkWidget* scintilla_new (void);
|
||||
void scintilla_set_id (ScintillaObject *sci,int id);
|
||||
long scintilla_send_message (ScintillaObject *sci,int iMessage,int wParam,int lParam);
|
||||
|
||||
#include "WinDefs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if PLAT_WX
|
||||
#include "WinDefs.h"
|
||||
#endif
|
||||
|
||||
// Both GTK and Windows
|
||||
|
||||
#define INVALID_POSITION -1
|
||||
|
||||
// Define start of Scintilla messages to be greater than all edit (EM_*) messages
|
||||
// as many EM_ messages can be used.
|
||||
//++Autogenerated -- start of section automatically generated from Scintilla.iface
|
||||
#define INVALID_POSITION -1
|
||||
#define SCI_START 2000
|
||||
#define SCI_OPTIONAL_START 3000
|
||||
#define SCI_LEXER_START 4000
|
||||
|
||||
#define SCI_ADDTEXT SCI_START + 1
|
||||
#define SCI_ADDSTYLEDTEXT SCI_START + 2
|
||||
#define SCI_INSERTTEXT SCI_START + 3
|
||||
#define SCI_CLEARALL SCI_START + 4
|
||||
#define SCI_GETLENGTH SCI_START + 6
|
||||
#define SCI_GETCHARAT SCI_START + 7
|
||||
#define SCI_GETCURRENTPOS SCI_START + 8
|
||||
#define SCI_GETANCHOR SCI_START + 9
|
||||
#define SCI_GETSTYLEAT SCI_START + 10
|
||||
|
||||
#define SCI_REDO SCI_START + 11
|
||||
#define SCI_SETUNDOCOLLECTION SCI_START + 12
|
||||
#define SCI_SELECTALL SCI_START + 13
|
||||
#define SCI_SETSAVEPOINT SCI_START + 14
|
||||
#define SCI_GETSTYLEDTEXT SCI_START + 15
|
||||
#define SCI_CANREDO SCI_START + 16
|
||||
#define SCI_MARKERLINEFROMHANDLE SCI_START + 17
|
||||
#define SCI_MARKERDELETEHANDLE SCI_START + 18
|
||||
|
||||
#define SC_UNDOCOLLECT_NONE 0
|
||||
#define SC_UNDOCOLLECT_AUTOSTART 1
|
||||
|
||||
#define SCI_GETVIEWWS SCI_START + 20
|
||||
#define SCI_SETVIEWWS SCI_START + 21
|
||||
#define SCI_CHANGEPOSITION SCI_START + 22
|
||||
#define SCI_GOTOLINE SCI_START + 24
|
||||
#define SCI_GOTOPOS SCI_START + 25
|
||||
#define SCI_SETANCHOR SCI_START + 26
|
||||
#define SCI_GETCURLINE SCI_START + 27
|
||||
#define SCI_GETENDSTYLED SCI_START + 28
|
||||
#define SCI_CONVERTEOLS SCI_START + 29
|
||||
|
||||
#define SCI_GETEOLMODE SCI_START + 30
|
||||
#define SCI_SETEOLMODE SCI_START + 31
|
||||
|
||||
#define SCI_ADDTEXT 2001
|
||||
#define SCI_ADDSTYLEDTEXT 2002
|
||||
#define SCI_INSERTTEXT 2003
|
||||
#define SCI_CLEARALL 2004
|
||||
#define SCI_CLEARDOCUMENTSTYLE 2005
|
||||
#define SCI_GETLENGTH 2006
|
||||
#define SCI_GETCHARAT 2007
|
||||
#define SCI_GETCURRENTPOS 2008
|
||||
#define SCI_GETANCHOR 2009
|
||||
#define SCI_GETSTYLEAT 2010
|
||||
#define SCI_REDO 2011
|
||||
#define SCI_SETUNDOCOLLECTION 2012
|
||||
#define SCI_SELECTALL 2013
|
||||
#define SCI_SETSAVEPOINT 2014
|
||||
#define SCI_GETSTYLEDTEXT 2015
|
||||
#define SCI_CANREDO 2016
|
||||
#define SCI_MARKERLINEFROMHANDLE 2017
|
||||
#define SCI_MARKERDELETEHANDLE 2018
|
||||
#define SCI_GETUNDOCOLLECTION 2019
|
||||
#define SCWS_INVISIBLE 0
|
||||
#define SCWS_VISIBLEALWAYS 1
|
||||
#define SCWS_VISIBLEAFTERINDENT 2
|
||||
#define SCI_GETVIEWWS 2020
|
||||
#define SCI_SETVIEWWS 2021
|
||||
#define SCI_POSITIONFROMPOINT 2022
|
||||
#define SCI_GOTOLINE 2024
|
||||
#define SCI_GOTOPOS 2025
|
||||
#define SCI_SETANCHOR 2026
|
||||
#define SCI_GETCURLINE 2027
|
||||
#define SCI_GETENDSTYLED 2028
|
||||
#define SCI_CONVERTEOLS 2029
|
||||
#define SC_EOL_CRLF 0
|
||||
#define SC_EOL_CR 1
|
||||
#define SC_EOL_LF 2
|
||||
|
||||
#define SCI_STARTSTYLING SCI_START + 32
|
||||
#define SCI_SETSTYLING SCI_START + 33
|
||||
|
||||
#define SCI_SETBUFFEREDDRAW SCI_START + 35
|
||||
#define SCI_SETTABWIDTH SCI_START + 36
|
||||
#define SCI_SETCODEPAGE SCI_START + 37
|
||||
#define SCI_SETUSEPALETTE SCI_START + 39
|
||||
|
||||
#define SCI_GETEOLMODE 2030
|
||||
#define SCI_SETEOLMODE 2031
|
||||
#define SCI_STARTSTYLING 2032
|
||||
#define SCI_SETSTYLING 2033
|
||||
#define SCI_GETBUFFEREDDRAW 2034
|
||||
#define SCI_SETBUFFEREDDRAW 2035
|
||||
#define SCI_SETTABWIDTH 2036
|
||||
#define SCI_GETTABWIDTH 2121
|
||||
#define SC_CP_UTF8 65001
|
||||
#define SCI_SETCODEPAGE 2037
|
||||
#define SCI_SETUSEPALETTE 2039
|
||||
#define MARKER_MAX 31
|
||||
|
||||
#define SC_MARK_CIRCLE 0
|
||||
#define SC_MARK_ROUNDRECT 1
|
||||
#define SC_MARK_ARROW 2
|
||||
@@ -123,217 +80,296 @@ extern "C" {
|
||||
#define SC_MARK_ARROWDOWN 6
|
||||
#define SC_MARK_MINUS 7
|
||||
#define SC_MARK_PLUS 8
|
||||
|
||||
#define SCI_MARKERDEFINE SCI_START + 40
|
||||
#define SCI_MARKERSETFORE SCI_START + 41
|
||||
#define SCI_MARKERSETBACK SCI_START + 42
|
||||
#define SCI_MARKERADD SCI_START + 43
|
||||
#define SCI_MARKERDELETE SCI_START + 44
|
||||
#define SCI_MARKERDELETEALL SCI_START + 45
|
||||
#define SCI_MARKERGET SCI_START + 46
|
||||
#define SCI_MARKERNEXT SCI_START + 47
|
||||
#define SCI_MARKERPREVIOUS SCI_START + 48
|
||||
|
||||
#define SC_MARKNUM_FOLDER 30
|
||||
#define SC_MARKNUM_FOLDEROPEN 31
|
||||
|
||||
#define SC_MASK_FOLDERS ((1<<SC_MARKNUM_FOLDER) | (1<<SC_MARKNUM_FOLDEROPEN))
|
||||
|
||||
#define SCI_MARKERDEFINE 2040
|
||||
#define SCI_MARKERSETFORE 2041
|
||||
#define SCI_MARKERSETBACK 2042
|
||||
#define SCI_MARKERADD 2043
|
||||
#define SCI_MARKERDELETE 2044
|
||||
#define SCI_MARKERDELETEALL 2045
|
||||
#define SCI_MARKERGET 2046
|
||||
#define SCI_MARKERNEXT 2047
|
||||
#define SCI_MARKERPREVIOUS 2048
|
||||
#define SC_MARGIN_SYMBOL 0
|
||||
#define SC_MARGIN_NUMBER 1
|
||||
|
||||
#define SCI_SETMARGINTYPEN SCI_START + 240
|
||||
#define SCI_GETMARGINTYPEN SCI_START + 241
|
||||
#define SCI_SETMARGINWIDTHN SCI_START + 242
|
||||
#define SCI_GETMARGINWIDTHN SCI_START + 243
|
||||
#define SCI_SETMARGINMASKN SCI_START + 244
|
||||
#define SCI_GETMARGINMASKN SCI_START + 245
|
||||
#define SCI_SETMARGINSENSITIVEN SCI_START + 246
|
||||
#define SCI_GETMARGINSENSITIVEN SCI_START + 247
|
||||
|
||||
#define SCI_SETMARGINTYPEN 2240
|
||||
#define SCI_GETMARGINTYPEN 2241
|
||||
#define SCI_SETMARGINWIDTHN 2242
|
||||
#define SCI_GETMARGINWIDTHN 2243
|
||||
#define SCI_SETMARGINMASKN 2244
|
||||
#define SCI_GETMARGINMASKN 2245
|
||||
#define SCI_SETMARGINSENSITIVEN 2246
|
||||
#define SCI_GETMARGINSENSITIVEN 2247
|
||||
#define STYLE_DEFAULT 32
|
||||
#define STYLE_LINENUMBER 33
|
||||
#define STYLE_BRACELIGHT 34
|
||||
#define STYLE_BRACEBAD 35
|
||||
#define STYLE_CONTROLCHAR 36
|
||||
#define STYLE_MAX 63
|
||||
|
||||
#define SCI_STYLECLEARALL SCI_START + 50
|
||||
#define SCI_STYLESETFORE SCI_START + 51
|
||||
#define SCI_STYLESETBACK SCI_START + 52
|
||||
#define SCI_STYLESETBOLD SCI_START + 53
|
||||
#define SCI_STYLESETITALIC SCI_START + 54
|
||||
#define SCI_STYLESETSIZE SCI_START + 55
|
||||
#define SCI_STYLESETFONT SCI_START + 56
|
||||
#define SCI_STYLESETEOLFILLED SCI_START + 57
|
||||
#define SCI_STYLERESETDEFAULT SCI_START + 58
|
||||
|
||||
#define SCI_SETSELFORE SCI_START + 67
|
||||
#define SCI_SETSELBACK SCI_START + 68
|
||||
#define SCI_SETCARETFORE SCI_START + 69
|
||||
|
||||
#define SCI_ASSIGNCMDKEY SCI_START + 70
|
||||
#define SCI_CLEARCMDKEY SCI_START + 71
|
||||
#define SCI_CLEARALLCMDKEYS SCI_START + 72
|
||||
|
||||
#define SCI_SETSTYLINGEX SCI_START + 73
|
||||
|
||||
#define SCI_GETCARETPERIOD SCI_START + 75
|
||||
#define SCI_SETCARETPERIOD SCI_START + 76
|
||||
#define SCI_SETWORDCHARS SCI_START + 77
|
||||
|
||||
#define SCI_BEGINUNDOACTION SCI_START + 78
|
||||
#define SCI_ENDUNDOACTION SCI_START + 79
|
||||
|
||||
#define STYLE_INDENTGUIDE 37
|
||||
#define STYLE_MAX 127
|
||||
#define SC_CHARSET_ANSI 0
|
||||
#define SC_CHARSET_DEFAULT 1
|
||||
#define SC_CHARSET_BALTIC 186
|
||||
#define SC_CHARSET_CHINESEBIG5 136
|
||||
#define SC_CHARSET_EASTEUROPE 238
|
||||
#define SC_CHARSET_GB2312 134
|
||||
#define SC_CHARSET_GREEK 161
|
||||
#define SC_CHARSET_HANGUL 129
|
||||
#define SC_CHARSET_MAC 77
|
||||
#define SC_CHARSET_OEM 255
|
||||
#define SC_CHARSET_RUSSIAN 204
|
||||
#define SC_CHARSET_SHIFTJIS 128
|
||||
#define SC_CHARSET_SYMBOL 2
|
||||
#define SC_CHARSET_TURKISH 162
|
||||
#define SC_CHARSET_JOHAB 130
|
||||
#define SC_CHARSET_HEBREW 177
|
||||
#define SC_CHARSET_ARABIC 178
|
||||
#define SC_CHARSET_VIETNAMESE 163
|
||||
#define SC_CHARSET_THAI 222
|
||||
#define SCI_STYLECLEARALL 2050
|
||||
#define SCI_STYLESETFORE 2051
|
||||
#define SCI_STYLESETBACK 2052
|
||||
#define SCI_STYLESETBOLD 2053
|
||||
#define SCI_STYLESETITALIC 2054
|
||||
#define SCI_STYLESETSIZE 2055
|
||||
#define SCI_STYLESETFONT 2056
|
||||
#define SCI_STYLESETEOLFILLED 2057
|
||||
#define SCI_STYLERESETDEFAULT 2058
|
||||
#define SCI_STYLESETUNDERLINE 2059
|
||||
#define SCI_STYLESETCHARACTERSET 2066
|
||||
#define SCI_SETSELFORE 2067
|
||||
#define SCI_SETSELBACK 2068
|
||||
#define SCI_SETCARETFORE 2069
|
||||
#define SCI_ASSIGNCMDKEY 2070
|
||||
#define SCI_CLEARCMDKEY 2071
|
||||
#define SCI_CLEARALLCMDKEYS 2072
|
||||
#define SCI_SETSTYLINGEX 2073
|
||||
#define SCI_STYLESETVISIBLE 2074
|
||||
#define SCI_GETCARETPERIOD 2075
|
||||
#define SCI_SETCARETPERIOD 2076
|
||||
#define SCI_SETWORDCHARS 2077
|
||||
#define SCI_BEGINUNDOACTION 2078
|
||||
#define SCI_ENDUNDOACTION 2079
|
||||
#define INDIC_MAX 7
|
||||
|
||||
#define INDIC_PLAIN 0
|
||||
#define INDIC_SQUIGGLE 1
|
||||
#define INDIC_TT 2
|
||||
|
||||
#define INDIC_DIAGONAL 3
|
||||
#define INDIC_STRIKE 4
|
||||
#define INDIC0_MASK 32
|
||||
#define INDIC1_MASK 64
|
||||
#define INDIC2_MASK 128
|
||||
#define INDICS_MASK (INDIC0_MASK | INDIC1_MASK | INDIC2_MASK)
|
||||
|
||||
#define SCI_INDICSETSTYLE SCI_START + 80
|
||||
#define SCI_INDICGETSTYLE SCI_START + 81
|
||||
#define SCI_INDICSETFORE SCI_START + 82
|
||||
#define SCI_INDICGETFORE SCI_START + 83
|
||||
|
||||
#define SCI_SETSTYLEBITS SCI_START + 90
|
||||
#define SCI_GETSTYLEBITS SCI_START + 91
|
||||
#define SCI_SETLINESTATE SCI_START + 92
|
||||
#define SCI_GETLINESTATE SCI_START + 93
|
||||
#define SCI_GETMAXLINESTATE SCI_START + 94
|
||||
|
||||
#define SCI_AUTOCSHOW SCI_START + 100
|
||||
#define SCI_AUTOCCANCEL SCI_START + 101
|
||||
#define SCI_AUTOCACTIVE SCI_START + 102
|
||||
#define SCI_AUTOCPOSSTART SCI_START + 103
|
||||
#define SCI_AUTOCCOMPLETE SCI_START + 104
|
||||
#define SCI_AUTOCSTOPS SCI_START + 105
|
||||
|
||||
#define SCI_CALLTIPSHOW SCI_START + 200
|
||||
#define SCI_CALLTIPCANCEL SCI_START + 201
|
||||
#define SCI_CALLTIPACTIVE SCI_START + 202
|
||||
#define SCI_CALLTIPPOSSTART SCI_START + 203
|
||||
#define SCI_CALLTIPSETHLT SCI_START + 204
|
||||
#define SCI_CALLTIPSETBACK SCI_START + 205
|
||||
|
||||
#define INDICS_MASK INDIC0_MASK | INDIC1_MASK | INDIC2_MASK
|
||||
#define SCI_INDICSETSTYLE 2080
|
||||
#define SCI_INDICGETSTYLE 2081
|
||||
#define SCI_INDICSETFORE 2082
|
||||
#define SCI_INDICGETFORE 2083
|
||||
#define SCI_SETSTYLEBITS 2090
|
||||
#define SCI_GETSTYLEBITS 2091
|
||||
#define SCI_SETLINESTATE 2092
|
||||
#define SCI_GETLINESTATE 2093
|
||||
#define SCI_GETMAXLINESTATE 2094
|
||||
#define SCI_AUTOCSHOW 2100
|
||||
#define SCI_AUTOCCANCEL 2101
|
||||
#define SCI_AUTOCACTIVE 2102
|
||||
#define SCI_AUTOCPOSSTART 2103
|
||||
#define SCI_AUTOCCOMPLETE 2104
|
||||
#define SCI_AUTOCSTOPS 2105
|
||||
#define SCI_AUTOCSETSEPARATOR 2106
|
||||
#define SCI_AUTOCGETSEPARATOR 2107
|
||||
#define SCI_AUTOCSELECT 2108
|
||||
#define SCI_AUTOCSETCANCELATSTART 2110
|
||||
#define SCI_AUTOCGETCANCELATSTART 2111
|
||||
#define SCI_AUTOCSETFILLUPS 2112
|
||||
#define SCI_AUTOCSETCHOOSESINGLE 2113
|
||||
#define SCI_AUTOCGETCHOOSESINGLE 2114
|
||||
#define SCI_AUTOCSETIGNORECASE 2115
|
||||
#define SCI_AUTOCGETIGNORECASE 2116
|
||||
#define SCI_SETINDENT 2122
|
||||
#define SCI_GETINDENT 2123
|
||||
#define SCI_SETUSETABS 2124
|
||||
#define SCI_GETUSETABS 2125
|
||||
#define SCI_SETLINEINDENTATION 2126
|
||||
#define SCI_GETLINEINDENTATION 2127
|
||||
#define SCI_GETLINEINDENTPOSITION 2128
|
||||
#define SCI_GETCOLUMN 2129
|
||||
#define SCI_SETHSCROLLBAR 2130
|
||||
#define SCI_GETHSCROLLBAR 2131
|
||||
#define SCI_SETINDENTATIONGUIDES 2132
|
||||
#define SCI_GETINDENTATIONGUIDES 2133
|
||||
#define SCI_SETHIGHLIGHTGUIDE 2134
|
||||
#define SCI_GETHIGHLIGHTGUIDE 2135
|
||||
#define SCI_GETLINEENDPOSITION 2136
|
||||
#define SCI_GETCODEPAGE 2137
|
||||
#define SCI_GETCARETFORE 2138
|
||||
#define SCI_GETUSEPALETTE 2139
|
||||
#define SCI_GETREADONLY 2140
|
||||
#define SCI_SETCURRENTPOS 2141
|
||||
#define SCI_SETSELECTIONSTART 2142
|
||||
#define SCI_GETSELECTIONSTART 2143
|
||||
#define SCI_SETSELECTIONEND 2144
|
||||
#define SCI_GETSELECTIONEND 2145
|
||||
#define SCI_SETPRINTMAGNIFICATION 2146
|
||||
#define SCI_GETPRINTMAGNIFICATION 2147
|
||||
#define SC_PRINT_NORMAL 0
|
||||
#define SC_PRINT_INVERTLIGHT 1
|
||||
#define SC_PRINT_BLACKONWHITE 2
|
||||
#define SCI_SETPRINTCOLOURMODE 2148
|
||||
#define SCI_GETPRINTCOLOURMODE 2149
|
||||
#define SCFIND_DOWN 1
|
||||
#define SCFIND_WHOLEWORD 2
|
||||
#define SCFIND_MATCHCASE 4
|
||||
#define SCFIND_WORDSTART 0x00100000
|
||||
#define SCFIND_REGEXP 0x00200000
|
||||
#define SCI_FINDTEXT 2150
|
||||
#define SCI_FORMATRANGE 2151
|
||||
#define SCI_GETFIRSTVISIBLELINE 2152
|
||||
#define SCI_GETLINE 2153
|
||||
#define SCI_GETLINECOUNT 2154
|
||||
#define SCI_SETMARGINLEFT 2155
|
||||
#define SCI_GETMARGINLEFT 2156
|
||||
#define SCI_SETMARGINRIGHT 2157
|
||||
#define SCI_GETMARGINRIGHT 2158
|
||||
#define SCI_GETMODIFY 2159
|
||||
#define SCI_SETSEL 2160
|
||||
#define SCI_GETSELTEXT 2161
|
||||
#define SCI_GETTEXTRANGE 2162
|
||||
#define SCI_HIDESELECTION 2163
|
||||
#define SCI_POINTXFROMPOSITION 2164
|
||||
#define SCI_POINTYFROMPOSITION 2165
|
||||
#define SCI_LINEFROMPOSITION 2166
|
||||
#define SCI_POSITIONFROMLINE 2167
|
||||
#define SCI_LINESCROLL 2168
|
||||
#define SCI_SCROLLCARET 2169
|
||||
#define SCI_REPLACESEL 2170
|
||||
#define SCI_SETREADONLY 2171
|
||||
#define SCI_NULL 2172
|
||||
#define SCI_CANPASTE 2173
|
||||
#define SCI_CANUNDO 2174
|
||||
#define SCI_EMPTYUNDOBUFFER 2175
|
||||
#define SCI_UNDO 2176
|
||||
#define SCI_CUT 2177
|
||||
#define SCI_COPY 2178
|
||||
#define SCI_PASTE 2179
|
||||
#define SCI_CLEAR 2180
|
||||
#define SCI_SETTEXT 2181
|
||||
#define SCI_GETTEXT 2182
|
||||
#define SCI_GETTEXTLENGTH 2183
|
||||
#define SCI_GETDIRECTFUNCTION 2184
|
||||
#define SCI_GETDIRECTPOINTER 2185
|
||||
#define SCI_SETOVERTYPE 2186
|
||||
#define SCI_GETOVERTYPE 2187
|
||||
#define SCI_CALLTIPSHOW 2200
|
||||
#define SCI_CALLTIPCANCEL 2201
|
||||
#define SCI_CALLTIPACTIVE 2202
|
||||
#define SCI_CALLTIPPOSSTART 2203
|
||||
#define SCI_CALLTIPSETHLT 2204
|
||||
#define SCI_CALLTIPSETBACK 2205
|
||||
#define SCI_VISIBLEFROMDOCLINE 2220
|
||||
#define SCI_DOCLINEFROMVISIBLE 2221
|
||||
#define SC_FOLDLEVELBASE 0x400
|
||||
#define SC_FOLDLEVELWHITEFLAG 0x1000
|
||||
#define SC_FOLDLEVELHEADERFLAG 0x2000
|
||||
#define SC_FOLDLEVELNUMBERMASK 0x0FFF
|
||||
|
||||
#define SCI_VISIBLEFROMDOCLINE SCI_START + 220
|
||||
#define SCI_DOCLINEFROMVISIBLE SCI_START + 221
|
||||
#define SCI_SETFOLDLEVEL SCI_START + 222
|
||||
#define SCI_GETFOLDLEVEL SCI_START + 223
|
||||
#define SCI_GETLASTCHILD SCI_START + 224
|
||||
#define SCI_GETFOLDPARENT SCI_START + 225
|
||||
#define SCI_SHOWLINES SCI_START + 226
|
||||
#define SCI_HIDELINES SCI_START + 227
|
||||
#define SCI_GETLINEVISIBLE SCI_START + 228
|
||||
#define SCI_SETFOLDEXPANDED SCI_START + 229
|
||||
#define SCI_GETFOLDEXPANDED SCI_START + 230
|
||||
#define SCI_TOGGLEFOLD SCI_START + 231
|
||||
#define SCI_ENSUREVISIBLE SCI_START + 232
|
||||
#define SCI_SETFOLDFLAGS SCI_START + 233
|
||||
|
||||
// Key messages
|
||||
#define SCI_LINEDOWN SCI_START + 300
|
||||
#define SCI_LINEDOWNEXTEND SCI_START + 301
|
||||
#define SCI_LINEUP SCI_START + 302
|
||||
#define SCI_LINEUPEXTEND SCI_START + 303
|
||||
#define SCI_CHARLEFT SCI_START + 304
|
||||
#define SCI_CHARLEFTEXTEND SCI_START + 305
|
||||
#define SCI_CHARRIGHT SCI_START + 306
|
||||
#define SCI_CHARRIGHTEXTEND SCI_START + 307
|
||||
#define SCI_WORDLEFT SCI_START + 308
|
||||
#define SCI_WORDLEFTEXTEND SCI_START + 309
|
||||
#define SCI_WORDRIGHT SCI_START + 310
|
||||
#define SCI_WORDRIGHTEXTEND SCI_START + 311
|
||||
#define SCI_HOME SCI_START + 312
|
||||
#define SCI_HOMEEXTEND SCI_START + 313
|
||||
#define SCI_LINEEND SCI_START + 314
|
||||
#define SCI_LINEENDEXTEND SCI_START + 315
|
||||
#define SCI_DOCUMENTSTART SCI_START + 316
|
||||
#define SCI_DOCUMENTSTARTEXTEND SCI_START + 317
|
||||
#define SCI_DOCUMENTEND SCI_START + 318
|
||||
#define SCI_DOCUMENTENDEXTEND SCI_START + 319
|
||||
#define SCI_PAGEUP SCI_START + 320
|
||||
#define SCI_PAGEUPEXTEND SCI_START + 321
|
||||
#define SCI_PAGEDOWN SCI_START + 322
|
||||
#define SCI_PAGEDOWNEXTEND SCI_START + 323
|
||||
#define SCI_EDITTOGGLEOVERTYPE SCI_START + 324
|
||||
#define SCI_CANCEL SCI_START + 325
|
||||
#define SCI_DELETEBACK SCI_START + 326
|
||||
#define SCI_TAB SCI_START + 327
|
||||
#define SCI_BACKTAB SCI_START + 328
|
||||
#define SCI_NEWLINE SCI_START + 329
|
||||
#define SCI_FORMFEED SCI_START + 330
|
||||
#define SCI_VCHOME SCI_START + 331
|
||||
#define SCI_VCHOMEEXTEND SCI_START + 332
|
||||
#define SCI_ZOOMIN SCI_START + 333
|
||||
#define SCI_ZOOMOUT SCI_START + 334
|
||||
#define SCI_DELWORDLEFT SCI_START + 335
|
||||
#define SCI_DELWORDRIGHT SCI_START + 336
|
||||
|
||||
#define SCI_LINELENGTH SCI_START + 350
|
||||
#define SCI_BRACEHIGHLIGHT SCI_START + 351
|
||||
#define SCI_BRACEBADLIGHT SCI_START + 352
|
||||
#define SCI_BRACEMATCH SCI_START + 353
|
||||
#define SCI_GETVIEWEOL SCI_START + 355
|
||||
#define SCI_SETVIEWEOL SCI_START + 356
|
||||
#define SCI_GETDOCPOINTER SCI_START + 357
|
||||
#define SCI_SETDOCPOINTER SCI_START + 358
|
||||
#define SCI_SETMODEVENTMASK SCI_START + 359
|
||||
|
||||
#define SCI_SETFOLDLEVEL 2222
|
||||
#define SCI_GETFOLDLEVEL 2223
|
||||
#define SCI_GETLASTCHILD 2224
|
||||
#define SCI_GETFOLDPARENT 2225
|
||||
#define SCI_SHOWLINES 2226
|
||||
#define SCI_HIDELINES 2227
|
||||
#define SCI_GETLINEVISIBLE 2228
|
||||
#define SCI_SETFOLDEXPANDED 2229
|
||||
#define SCI_GETFOLDEXPANDED 2230
|
||||
#define SCI_TOGGLEFOLD 2231
|
||||
#define SCI_ENSUREVISIBLE 2232
|
||||
#define SCI_SETFOLDFLAGS 2233
|
||||
#define SCI_LINEDOWN 2300
|
||||
#define SCI_LINEDOWNEXTEND 2301
|
||||
#define SCI_LINEUP 2302
|
||||
#define SCI_LINEUPEXTEND 2303
|
||||
#define SCI_CHARLEFT 2304
|
||||
#define SCI_CHARLEFTEXTEND 2305
|
||||
#define SCI_CHARRIGHT 2306
|
||||
#define SCI_CHARRIGHTEXTEND 2307
|
||||
#define SCI_WORDLEFT 2308
|
||||
#define SCI_WORDLEFTEXTEND 2309
|
||||
#define SCI_WORDRIGHT 2310
|
||||
#define SCI_WORDRIGHTEXTEND 2311
|
||||
#define SCI_HOME 2312
|
||||
#define SCI_HOMEEXTEND 2313
|
||||
#define SCI_LINEEND 2314
|
||||
#define SCI_LINEENDEXTEND 2315
|
||||
#define SCI_DOCUMENTSTART 2316
|
||||
#define SCI_DOCUMENTSTARTEXTEND 2317
|
||||
#define SCI_DOCUMENTEND 2318
|
||||
#define SCI_DOCUMENTENDEXTEND 2319
|
||||
#define SCI_PAGEUP 2320
|
||||
#define SCI_PAGEUPEXTEND 2321
|
||||
#define SCI_PAGEDOWN 2322
|
||||
#define SCI_PAGEDOWNEXTEND 2323
|
||||
#define SCI_EDITTOGGLEOVERTYPE 2324
|
||||
#define SCI_CANCEL 2325
|
||||
#define SCI_DELETEBACK 2326
|
||||
#define SCI_TAB 2327
|
||||
#define SCI_BACKTAB 2328
|
||||
#define SCI_NEWLINE 2329
|
||||
#define SCI_FORMFEED 2330
|
||||
#define SCI_VCHOME 2331
|
||||
#define SCI_VCHOMEEXTEND 2332
|
||||
#define SCI_ZOOMIN 2333
|
||||
#define SCI_ZOOMOUT 2334
|
||||
#define SCI_DELWORDLEFT 2335
|
||||
#define SCI_DELWORDRIGHT 2336
|
||||
#define SCI_LINECUT 2337
|
||||
#define SCI_LINEDELETE 2338
|
||||
#define SCI_LINETRANSPOSE 2339
|
||||
#define SCI_LOWERCASE 2340
|
||||
#define SCI_UPPERCASE 2341
|
||||
#define SCI_LINESCROLLDOWN 2342
|
||||
#define SCI_LINESCROLLUP 2343
|
||||
#define SCI_LINELENGTH 2350
|
||||
#define SCI_BRACEHIGHLIGHT 2351
|
||||
#define SCI_BRACEBADLIGHT 2352
|
||||
#define SCI_BRACEMATCH 2353
|
||||
#define SCI_GETVIEWEOL 2355
|
||||
#define SCI_SETVIEWEOL 2356
|
||||
#define SCI_GETDOCPOINTER 2357
|
||||
#define SCI_SETDOCPOINTER 2358
|
||||
#define SCI_SETMODEVENTMASK 2359
|
||||
#define EDGE_NONE 0
|
||||
#define EDGE_LINE 1
|
||||
#define EDGE_BACKGROUND 2
|
||||
|
||||
#define SCI_GETEDGECOLUMN SCI_START + 360
|
||||
#define SCI_SETEDGECOLUMN SCI_START + 361
|
||||
#define SCI_GETEDGEMODE SCI_START + 362
|
||||
#define SCI_SETEDGEMODE SCI_START + 363
|
||||
#define SCI_GETEDGECOLOUR SCI_START + 364
|
||||
#define SCI_SETEDGECOLOUR SCI_START + 365
|
||||
|
||||
#define SCI_SEARCHANCHOR SCI_START + 366
|
||||
#define SCI_SEARCHNEXT SCI_START + 367
|
||||
#define SCI_SEARCHPREV SCI_START + 368
|
||||
|
||||
#define CARET_SLOP 0x01 // Show caret within N lines of edge when it's scrolled to view
|
||||
#define CARET_CENTER 0x02 // Center caret on screen when it's scrolled to view
|
||||
#define CARET_STRICT 0x04 // OR this with CARET_CENTER to reposition even when visible, or
|
||||
// OR this with CARET_SLOP to reposition whenever outside slop border
|
||||
|
||||
#define SCI_SETCARETPOLICY SCI_START + 369
|
||||
|
||||
// GTK+ Specific
|
||||
#define SCI_GRABFOCUS SCI_START + 400
|
||||
|
||||
// Optional module for macro recording
|
||||
#ifdef MACRO_SUPPORT
|
||||
typedef void (tMacroRecorder)(UINT iMessage, WPARAM wParam, LPARAM lParam,
|
||||
void *userData);
|
||||
#define SCI_STARTRECORD SCI_OPTIONAL_START + 1
|
||||
#define SCI_STOPRECORD SCI_OPTIONAL_START + 2
|
||||
#endif
|
||||
|
||||
#define SCI_SETLEXER SCI_LEXER_START + 1
|
||||
#define SCI_GETLEXER SCI_LEXER_START + 2
|
||||
#define SCI_COLOURISE SCI_LEXER_START + 3
|
||||
#define SCI_SETPROPERTY SCI_LEXER_START + 4
|
||||
#define SCI_SETKEYWORDS SCI_LEXER_START + 5
|
||||
|
||||
// Notifications
|
||||
|
||||
// Type of modification and the action which caused the modification
|
||||
// These are defined as a bit mask to make it easy to specify which notifications are wanted.
|
||||
// One bit is set from each of SC_MOD_* and SC_PERFORMED_*.
|
||||
#define SCI_GETEDGECOLUMN 2360
|
||||
#define SCI_SETEDGECOLUMN 2361
|
||||
#define SCI_GETEDGEMODE 2362
|
||||
#define SCI_SETEDGEMODE 2363
|
||||
#define SCI_GETEDGECOLOUR 2364
|
||||
#define SCI_SETEDGECOLOUR 2365
|
||||
#define SCI_SEARCHANCHOR 2366
|
||||
#define SCI_SEARCHNEXT 2367
|
||||
#define SCI_SEARCHPREV 2368
|
||||
#define CARET_SLOP 0x01
|
||||
#define CARET_CENTER 0x02
|
||||
#define CARET_STRICT 0x04
|
||||
#define SCI_SETCARETPOLICY 2369
|
||||
#define SCI_LINESONSCREEN 2370
|
||||
#define SCI_USEPOPUP 2371
|
||||
#define SCI_SELECTIONISRECTANGLE 2372
|
||||
#define SCI_SETZOOM 2373
|
||||
#define SCI_GETZOOM 2374
|
||||
#define SCI_CREATEDOCUMENT 2375
|
||||
#define SCI_ADDREFDOCUMENT 2376
|
||||
#define SCI_RELEASEDOCUMENT 2377
|
||||
#define SCI_GETMODEVENTMASK 2378
|
||||
#define SCI_GRABFOCUS 2400
|
||||
#define SCI_STARTRECORD 3001
|
||||
#define SCI_STOPRECORD 3002
|
||||
#define SCI_SETLEXER 4001
|
||||
#define SCI_GETLEXER 4002
|
||||
#define SCI_COLOURISE 4003
|
||||
#define SCI_SETPROPERTY 4004
|
||||
#define SCI_SETKEYWORDS 4005
|
||||
#define SC_MOD_INSERTTEXT 0x1
|
||||
#define SC_MOD_DELETETEXT 0x2
|
||||
#define SC_MOD_CHANGESTYLE 0x4
|
||||
@@ -342,11 +378,101 @@ typedef void (tMacroRecorder)(UINT iMessage, WPARAM wParam, LPARAM lParam,
|
||||
#define SC_PERFORMED_UNDO 0x20
|
||||
#define SC_PERFORMED_REDO 0x40
|
||||
#define SC_LASTSTEPINUNDOREDO 0x100
|
||||
#define SC_MOD_CHANGEMARKER 0x200
|
||||
#define SC_MOD_BEFOREINSERT 0x400
|
||||
#define SC_MOD_BEFOREDELETE 0x800
|
||||
#define SC_MODEVENTMASKALL 0xF77
|
||||
#define SCEN_CHANGE 768
|
||||
#define SCEN_SETFOCUS 512
|
||||
#define SCEN_KILLFOCUS 256
|
||||
#define SCK_DOWN 300
|
||||
#define SCK_UP 301
|
||||
#define SCK_LEFT 302
|
||||
#define SCK_RIGHT 303
|
||||
#define SCK_HOME 304
|
||||
#define SCK_END 305
|
||||
#define SCK_PRIOR 306
|
||||
#define SCK_NEXT 307
|
||||
#define SCK_DELETE 308
|
||||
#define SCK_INSERT 309
|
||||
#define SCK_ESCAPE 7
|
||||
#define SCK_BACK 8
|
||||
#define SCK_TAB 9
|
||||
#define SCK_RETURN 13
|
||||
#define SCK_ADD 310
|
||||
#define SCK_SUBTRACT 311
|
||||
#define SCK_DIVIDE 312
|
||||
#define SCMOD_SHIFT 1
|
||||
#define SCMOD_CTRL 2
|
||||
#define SCMOD_ALT 4
|
||||
#define SCN_STYLENEEDED 2000
|
||||
#define SCN_CHARADDED 2001
|
||||
#define SCN_SAVEPOINTREACHED 2002
|
||||
#define SCN_SAVEPOINTLEFT 2003
|
||||
#define SCN_MODIFYATTEMPTRO 2004
|
||||
#define SCN_KEY 2005
|
||||
#define SCN_DOUBLECLICK 2006
|
||||
#define SCN_UPDATEUI 2007
|
||||
#define SCN_CHECKBRACE 2007
|
||||
#define SCN_MODIFIED 2008
|
||||
#define SCN_MACRORECORD 2009
|
||||
#define SCN_MARGINCLICK 2010
|
||||
#define SCN_NEEDSHOWN 2011
|
||||
#define SCN_POSCHANGED 2012
|
||||
//--Autogenerated -- end of section automatically generated from Scintilla.iface
|
||||
|
||||
#define SC_MODEVENTMASKALL 0x377
|
||||
// Optional module for macro recording
|
||||
#ifdef MACRO_SUPPORT
|
||||
typedef void (tMacroRecorder)(unsigned int iMessage, unsigned long wParam,
|
||||
long lParam, void *userData);
|
||||
#endif
|
||||
|
||||
// These structures are defined to be exactly the same shape as the Win32
|
||||
// CHARRANGE, TEXTRANGE, FINDTEXTEX, FORMATRANGE, and NMHDR structs.
|
||||
// So older code that treats Scintilla as a RichEdit will work.
|
||||
|
||||
struct CharacterRange {
|
||||
long cpMin;
|
||||
long cpMax;
|
||||
};
|
||||
|
||||
struct TextRange {
|
||||
CharacterRange chrg;
|
||||
char *lpstrText;
|
||||
};
|
||||
|
||||
struct TextToFind {
|
||||
CharacterRange chrg;
|
||||
char *lpstrText;
|
||||
CharacterRange chrgText;
|
||||
};
|
||||
|
||||
#ifdef PLATFORM_H
|
||||
|
||||
// This structure is used in printing and requires some of the graphics types
|
||||
// from Platform.h. Not needed by most client code.
|
||||
|
||||
struct RangeToFormat {
|
||||
SurfaceID hdc;
|
||||
SurfaceID hdcTarget;
|
||||
PRectangle rc;
|
||||
PRectangle rcPage;
|
||||
CharacterRange chrg;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
struct NotifyHeader {
|
||||
// hwndFrom is really an environment specifc window handle or pointer
|
||||
// but most clients of Scintilla.h do not have this type visible.
|
||||
//WindowID hwndFrom;
|
||||
void *hwndFrom;
|
||||
unsigned int idFrom;
|
||||
unsigned int code;
|
||||
};
|
||||
|
||||
struct SCNotification {
|
||||
NMHDR nmhdr;
|
||||
NotifyHeader nmhdr;
|
||||
int position; // SCN_STYLENEEDED, SCN_MODIFIED
|
||||
int ch; // SCN_CHARADDED, SCN_KEY
|
||||
int modifiers; // SCN_KEY
|
||||
@@ -365,28 +491,7 @@ struct SCNotification {
|
||||
int margin; // SCN_MARGINCLICK
|
||||
};
|
||||
|
||||
#define SCN_STYLENEEDED 2000
|
||||
#define SCN_CHARADDED 2001
|
||||
#define SCN_SAVEPOINTREACHED 2002
|
||||
#define SCN_SAVEPOINTLEFT 2003
|
||||
#define SCN_MODIFYATTEMPTRO 2004
|
||||
// GTK+ Specific to work around focus and accelerator problems:
|
||||
#define SCN_KEY 2005
|
||||
#define SCN_DOUBLECLICK 2006
|
||||
#define SCN_UPDATEUI 2007
|
||||
// The old name for SCN_UPDATEUI:
|
||||
#define SCN_CHECKBRACE 2007
|
||||
#define SCN_MODIFIED 2008
|
||||
// Optional module for macro recording
|
||||
#ifdef MACRO_SUPPORT
|
||||
#define SCN_MACRORECORD 2009
|
||||
#endif
|
||||
#define SCN_MARGINCLICK 2010
|
||||
#define SCN_NEEDSHOWN 2011
|
||||
|
||||
#ifdef STATIC_BUILD
|
||||
void Scintilla_RegisterClasses(HINSTANCE hInstance);
|
||||
#endif
|
||||
#define SC_MASK_FOLDERS ((1<<SC_MARKNUM_FOLDER) | (1<<SC_MARKNUM_FOLDEROPEN))
|
||||
|
||||
// Deprecation section listing all API features that are deprecated and will
|
||||
// will be removed completely in a future version.
|
||||
@@ -394,21 +499,9 @@ void Scintilla_RegisterClasses(HINSTANCE hInstance);
|
||||
|
||||
#ifdef INCLUDE_DEPRECATED_FEATURES
|
||||
|
||||
// Default style settings. These are deprecated and will be removed in a future version.
|
||||
#define SCI_SETFORE SCI_START + 60
|
||||
#define SCI_SETBACK SCI_START + 61
|
||||
#define SCI_SETBOLD SCI_START + 62
|
||||
#define SCI_SETITALIC SCI_START + 63
|
||||
#define SCI_SETSIZE SCI_START + 64
|
||||
#define SCI_SETFONT SCI_START + 65
|
||||
|
||||
#define SCI_APPENDUNDOSTARTACTION SCI_START + 74
|
||||
|
||||
#define SC_UNDOCOLLECT_MANUALSTART 2
|
||||
|
||||
// Deprecated in release 1.22
|
||||
#define SCI_SETMARGINWIDTH SCI_START + 34
|
||||
#define SCI_SETLINENUMBERWIDTH SCI_START + 38
|
||||
// Deprecated in 1.27
|
||||
#define SC_UNDOCOLLECT_NONE 0
|
||||
#define SC_UNDOCOLLECT_AUTOSTART 1
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
1452
contrib/src/stc/scintilla/include/Scintilla.iface
Normal file
46
contrib/src/stc/scintilla/include/ScintillaWidget.h
Normal file
@@ -0,0 +1,46 @@
|
||||
// Scintilla source code edit control
|
||||
// ScintillaWidget.h - definition of Scintilla widget for GTK+
|
||||
// Only needed by GTK+ code but is harmless on other platforms.
|
||||
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
#ifndef SCINTILLAWIDGET_H
|
||||
#define SCINTILLAWIDGET_H
|
||||
|
||||
#if PLAT_GTK
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define SCINTILLA(obj) GTK_CHECK_CAST (obj, scintilla_get_type (), ScintillaObject)
|
||||
#define SCINTILLA_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, scintilla_get_type (), ScintillaClass)
|
||||
#define IS_SCINTILLA(obj) GTK_CHECK_TYPE (obj, scintilla_get_type ())
|
||||
|
||||
typedef struct _ScintillaObject ScintillaObject;
|
||||
typedef struct _ScintillaClass ScintillaClass;
|
||||
|
||||
struct _ScintillaObject {
|
||||
GtkFixed vbox;
|
||||
void *pscin;
|
||||
};
|
||||
|
||||
struct _ScintillaClass {
|
||||
GtkFixedClass parent_class;
|
||||
|
||||
void (* command) (ScintillaObject *ttt);
|
||||
void (* notify) (ScintillaObject *ttt);
|
||||
};
|
||||
|
||||
guint scintilla_get_type (void);
|
||||
GtkWidget* scintilla_new (void);
|
||||
void scintilla_set_id (ScintillaObject *sci,int id);
|
||||
long scintilla_send_message (ScintillaObject *sci,int iMessage,int wParam,int lParam);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -16,93 +16,47 @@
|
||||
#define LPSTR char *
|
||||
#define LONG long
|
||||
|
||||
//#if 0
|
||||
/* RTF control */
|
||||
#define EM_CANPASTE (1074)
|
||||
#define EM_CANUNDO (198)
|
||||
#define EM_CHARFROMPOS (215)
|
||||
#define EM_DISPLAYBAND (1075)
|
||||
#define EM_EMPTYUNDOBUFFER (205)
|
||||
#define EM_EXGETSEL (1076)
|
||||
#define EM_EXLIMITTEXT (1077)
|
||||
#define EM_EXLINEFROMCHAR (1078)
|
||||
#define EM_EXSETSEL (1079)
|
||||
#define EM_FINDTEXT (1080)
|
||||
#define EM_FINDTEXTEX (1103)
|
||||
#define EM_FINDWORDBREAK (1100)
|
||||
#define EM_FMTLINES (200)
|
||||
#define EM_FORMATRANGE (1081)
|
||||
#define EM_GETCHARFORMAT (1082)
|
||||
#define EM_GETEVENTMASK (1083)
|
||||
#define EM_GETFIRSTVISIBLELINE (206)
|
||||
#define EM_GETHANDLE (189)
|
||||
#define EM_GETLIMITTEXT (213)
|
||||
#define EM_GETLINE (196)
|
||||
#define EM_GETLINECOUNT (186)
|
||||
#define EM_GETMARGINS (212)
|
||||
#define EM_GETMODIFY (184)
|
||||
#define EM_GETIMECOLOR (1129)
|
||||
#define EM_GETIMEOPTIONS (1131)
|
||||
#define EM_GETOPTIONS (1102)
|
||||
#define EM_GETOLEINTERFACE (1084)
|
||||
#define EM_GETPARAFORMAT (1085)
|
||||
#define EM_GETPASSWORDCHAR (210)
|
||||
#define EM_GETPUNCTUATION (1125)
|
||||
#define EM_GETRECT (178)
|
||||
#define EM_GETSEL (176)
|
||||
#define EM_GETSELTEXT (1086)
|
||||
#define EM_GETTEXTRANGE (1099)
|
||||
#define EM_GETTHUMB (190)
|
||||
#define EM_GETWORDBREAKPROC (209)
|
||||
#define EM_GETWORDBREAKPROCEX (1104)
|
||||
#define EM_GETWORDWRAPMODE (1127)
|
||||
#define EM_HIDESELECTION (1087)
|
||||
#define EM_LIMITTEXT (197)
|
||||
#define EM_LINEFROMCHAR (201)
|
||||
#define EM_LINEINDEX (187)
|
||||
#define EM_LINELENGTH (193)
|
||||
#define EM_LINESCROLL (182)
|
||||
#define EM_PASTESPECIAL (1088)
|
||||
#define EM_POSFROMCHAR (214)
|
||||
#define EM_REPLACESEL (194)
|
||||
#define EM_REQUESTRESIZE (1089)
|
||||
#define EM_SCROLL (181)
|
||||
#define EM_SCROLLCARET (183)
|
||||
#define EM_SELECTIONTYPE (1090)
|
||||
#define EM_SETBKGNDCOLOR (1091)
|
||||
#define EM_SETCHARFORMAT (1092)
|
||||
#define EM_SETEVENTMASK (1093)
|
||||
#define EM_SETHANDLE (188)
|
||||
#define EM_SETIMECOLOR (1128)
|
||||
#define EM_SETIMEOPTIONS (1130)
|
||||
#define EM_SETLIMITTEXT (197)
|
||||
#define EM_SETMARGINS (211)
|
||||
#define EM_SETMODIFY (185)
|
||||
#define EM_SETOLECALLBACK (1094)
|
||||
#define EM_SETOPTIONS (1101)
|
||||
#define EM_SETPARAFORMAT (1095)
|
||||
#define EM_SETPASSWORDCHAR (204)
|
||||
#define EM_SETPUNCTUATION (1124)
|
||||
#define EM_SETREADONLY (207)
|
||||
#define EM_SETRECT (179)
|
||||
#define EM_SETRECTNP (180)
|
||||
#define EM_SETSEL (177)
|
||||
#define EM_SETTABSTOPS (203)
|
||||
#define EM_SETTARGETDEVICE (1096)
|
||||
#define EM_SETWORDBREAKPROC (208)
|
||||
#define EM_SETWORDBREAKPROCEX (1105)
|
||||
#define EM_SETWORDWRAPMODE (1126)
|
||||
#define EM_STREAMIN (1097)
|
||||
#define EM_STREAMOUT (1098)
|
||||
#define EM_UNDO (199)
|
||||
|
||||
#define WM_NULL (0)
|
||||
#define WM_CLEAR (771)
|
||||
#define WM_COMMAND (273)
|
||||
#define WM_COPY (769)
|
||||
#define WM_CUT (768)
|
||||
#define WM_GETTEXT (13)
|
||||
#define WM_GETTEXTLENGTH (14)
|
||||
#define WM_NOTIFY (78)
|
||||
#define WM_PASTE (770)
|
||||
#define WM_SETTEXT (12)
|
||||
#define WM_UNDO (772)
|
||||
@@ -115,6 +69,9 @@
|
||||
#define EC_RIGHTMARGIN 2
|
||||
#define EC_USEFONTINFO 0xffff
|
||||
|
||||
//#endif
|
||||
|
||||
#if 0
|
||||
#if PLAT_GTK
|
||||
#define VK_DOWN GDK_Down
|
||||
#define VK_UP GDK_Up
|
||||
@@ -132,6 +89,7 @@
|
||||
#define VK_RETURN GDK_Return
|
||||
#define VK_ADD GDK_KP_Add
|
||||
#define VK_SUBTRACT GDK_KP_Subtract
|
||||
#define VK_DIVIDE GDK_KP_Divide
|
||||
#endif
|
||||
|
||||
#if PLAT_WX
|
||||
@@ -151,12 +109,18 @@
|
||||
#define VK_RETURN WXK_RETURN
|
||||
#define VK_ADD WXK_ADD
|
||||
#define VK_SUBTRACT WXK_SUBTRACT
|
||||
//TODO:
|
||||
#define VK_DIVIDE WXK_DIVIDE
|
||||
#endif
|
||||
|
||||
#define SHIFT_PRESSED 1
|
||||
#define LEFT_CTRL_PRESSED 2
|
||||
#define LEFT_ALT_PRESSED 4
|
||||
|
||||
// Are these needed any more
|
||||
#define LPSTR char *
|
||||
#define LONG long
|
||||
#define LPDWORD (long *)
|
||||
#endif
|
||||
|
||||
/* SELCHANGE structure */
|
||||
#define SEL_EMPTY (0)
|
||||
@@ -165,15 +129,6 @@
|
||||
#define SEL_MULTICHAR (4)
|
||||
#define SEL_MULTIOBJECT (8)
|
||||
|
||||
/* FINDREPLACE structure */
|
||||
#define FR_MATCHCASE (0x4)
|
||||
#define FR_WHOLEWORD (0x2)
|
||||
#define FR_DOWN (0x1)
|
||||
|
||||
#define SHIFT_PRESSED 1
|
||||
#define LEFT_CTRL_PRESSED 2
|
||||
#define LEFT_ALT_PRESSED 4
|
||||
|
||||
struct RECT {
|
||||
LONG left;
|
||||
LONG top;
|
||||
@@ -181,6 +136,15 @@ struct RECT {
|
||||
LONG bottom;
|
||||
};
|
||||
|
||||
/* FINDREPLACE structure */
|
||||
|
||||
#define FR_MATCHCASE (0x4)
|
||||
#define FR_WHOLEWORD (0x2)
|
||||
#define FR_DOWN (0x1)
|
||||
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
struct CHARRANGE {
|
||||
LONG cpMin;
|
||||
LONG cpMax;
|
||||
@@ -210,9 +174,10 @@ struct FORMATRANGE {
|
||||
RECT rcPage;
|
||||
CHARRANGE chrg;
|
||||
};
|
||||
#endif
|
||||
|
||||
#define MAKELONG(a, b) ((a) | ((b) << 16))
|
||||
#define LOWORD(x) (x & 0xffff)
|
||||
#define HIWORD(x) (x >> 16)
|
||||
//#define MAKELONG(a, b) ((a) | ((b) << 16))
|
||||
//#define LOWORD(x) (x & 0xffff)
|
||||
//#define HIWORD(x) (x >> 16)
|
||||
|
||||
#endif
|
||||
|
||||
47
contrib/src/stc/scintilla/include/WindowAccessor.h
Normal file
@@ -0,0 +1,47 @@
|
||||
// WindowAccessor.h - implementation of BufferAccess and StylingAccess on a Scintilla rapid easy access to contents of a Scintilla
|
||||
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
class WindowAccessor : public Accessor {
|
||||
// Private so WindowAccessor objects can not be copied
|
||||
WindowAccessor(const WindowAccessor &source) : Accessor(), props(source.props) {}
|
||||
WindowAccessor &operator=(const WindowAccessor &) { return *this; }
|
||||
protected:
|
||||
WindowID id;
|
||||
PropSet &props;
|
||||
int lenDoc;
|
||||
|
||||
char styleBuf[bufferSize];
|
||||
int validLen;
|
||||
char chFlags;
|
||||
char chWhile;
|
||||
unsigned int startSeg;
|
||||
|
||||
bool InternalIsLeadByte(char ch);
|
||||
void Fill(int position);
|
||||
public:
|
||||
WindowAccessor(WindowID id_, PropSet &props_) :
|
||||
Accessor(), id(id_), props(props_),
|
||||
lenDoc(-1), validLen(0), chFlags(0), chWhile(0) {
|
||||
}
|
||||
~WindowAccessor();
|
||||
char StyleAt(int position);
|
||||
int GetLine(int position);
|
||||
int LineStart(int line);
|
||||
int LevelAt(int line);
|
||||
int Length();
|
||||
void Flush();
|
||||
int GetLineState(int line);
|
||||
int SetLineState(int line, int state);
|
||||
int GetPropertyInt(const char *key, int defaultValue=0) {
|
||||
return props.GetInt(key, defaultValue);
|
||||
}
|
||||
|
||||
void StartAt(unsigned int start, char chMask=31);
|
||||
void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; };
|
||||
unsigned int GetStartSegment() { return startSeg; }
|
||||
void StartSegment(unsigned int pos);
|
||||
void ColourTo(unsigned int pos, int chAttr);
|
||||
void SetLevel(int line, int level);
|
||||
int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0);
|
||||
};
|
||||
@@ -1,112 +0,0 @@
|
||||
// SciTE - Scintilla based Text Editor
|
||||
// Accessor.cxx - rapid easy access to contents of a Scintilla
|
||||
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "Platform.h"
|
||||
|
||||
#include "PropSet.h"
|
||||
#include "Accessor.h"
|
||||
#include "Scintilla.h"
|
||||
|
||||
void Accessor::Fill(int position) {
|
||||
if (lenDoc == -1)
|
||||
lenDoc = Platform::SendScintilla(id, WM_GETTEXTLENGTH, 0, 0);
|
||||
startPos = position - slopSize;
|
||||
if (startPos + bufferSize > lenDoc)
|
||||
startPos = lenDoc - bufferSize;
|
||||
if (startPos < 0)
|
||||
startPos = 0;
|
||||
endPos = startPos + bufferSize;
|
||||
if (endPos > lenDoc)
|
||||
endPos = lenDoc;
|
||||
|
||||
TEXTRANGE tr = {{startPos, endPos}, buf};
|
||||
Platform::SendScintilla(id, EM_GETTEXTRANGE, 0, reinterpret_cast<LPARAM>(&tr));
|
||||
}
|
||||
|
||||
char Accessor::StyleAt(int position) {
|
||||
return static_cast<char>(Platform::SendScintilla(
|
||||
id, SCI_GETSTYLEAT, position, 0));
|
||||
}
|
||||
|
||||
int Accessor::GetLine(int position) {
|
||||
return Platform::SendScintilla(id, EM_LINEFROMCHAR, position, 0);
|
||||
}
|
||||
|
||||
int Accessor::LineStart(int line) {
|
||||
return Platform::SendScintilla(id, EM_LINEINDEX, line, 0);
|
||||
}
|
||||
|
||||
int Accessor::LevelAt(int line) {
|
||||
return Platform::SendScintilla(id, SCI_GETFOLDLEVEL, line, 0);
|
||||
}
|
||||
|
||||
int Accessor::Length() {
|
||||
if (lenDoc == -1)
|
||||
lenDoc = Platform::SendScintilla(id, WM_GETTEXTLENGTH, 0, 0);
|
||||
return lenDoc;
|
||||
}
|
||||
|
||||
int Accessor::GetLineState(int line) {
|
||||
return Platform::SendScintilla(id, SCI_GETLINESTATE, line);
|
||||
}
|
||||
|
||||
int Accessor::SetLineState(int line, int state) {
|
||||
return Platform::SendScintilla(id, SCI_SETLINESTATE, line, state);
|
||||
}
|
||||
|
||||
void StylingContext::StartAt(unsigned int start, char chMask) {
|
||||
Platform::SendScintilla(id, SCI_STARTSTYLING, start, chMask);
|
||||
}
|
||||
|
||||
void StylingContext::ColourSegment(unsigned int start, unsigned int end, int chAttr) {
|
||||
// Only perform styling if non empty range
|
||||
if (end != start - 1) {
|
||||
if (end < start) {
|
||||
Platform::DebugPrintf("Bad colour positions %d - %d\n", start, end);
|
||||
}
|
||||
|
||||
if (validLen + (end - start + 1) >= bufferSize)
|
||||
Flush();
|
||||
if (validLen + (end - start + 1) >= bufferSize) {
|
||||
// Too big for buffer so send directly
|
||||
Platform::SendScintilla(id, SCI_SETSTYLING, end - start + 1, chAttr);
|
||||
} else {
|
||||
if (chAttr != chWhile)
|
||||
chFlags = 0;
|
||||
chAttr |= chFlags;
|
||||
for (unsigned int i = start; i <= end; i++) {
|
||||
styleBuf[validLen++] = chAttr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void StylingContext::StartSegment(unsigned int pos) {
|
||||
startSeg = pos;
|
||||
}
|
||||
|
||||
void StylingContext::ColourTo(unsigned int pos, int chAttr) {
|
||||
ColourSegment(startSeg, pos, chAttr);
|
||||
startSeg = pos+1;
|
||||
}
|
||||
|
||||
int StylingContext::GetLine(int position) {
|
||||
return Platform::SendScintilla(id, EM_LINEFROMCHAR, position, 0);
|
||||
}
|
||||
|
||||
void StylingContext::SetLevel(int line, int level) {
|
||||
Platform::SendScintilla(id, SCI_SETFOLDLEVEL, line, level);
|
||||
}
|
||||
|
||||
void StylingContext::Flush() {
|
||||
if (validLen > 0) {
|
||||
Platform::SendScintilla(id, SCI_SETSTYLINGEX, validLen,
|
||||
reinterpret_cast<LPARAM>(styleBuf));
|
||||
validLen = 0;
|
||||
}
|
||||
}
|
||||
@@ -10,11 +10,16 @@
|
||||
|
||||
#include "AutoComplete.h"
|
||||
|
||||
AutoComplete::AutoComplete() {
|
||||
lb = 0;
|
||||
active = false;
|
||||
posStart = 0;
|
||||
strcpy(stopChars, "");
|
||||
AutoComplete::AutoComplete() :
|
||||
active(false),
|
||||
separator(' '),
|
||||
ignoreCase(false),
|
||||
chooseSingle(false),
|
||||
posStart(0),
|
||||
startLen(0),
|
||||
cancelAtStartPos(true) {
|
||||
stopChars[0] = '\0';
|
||||
fillUpChars[0] = '\0';
|
||||
}
|
||||
|
||||
AutoComplete::~AutoComplete() {
|
||||
@@ -44,8 +49,24 @@ bool AutoComplete::IsStopChar(char ch) {
|
||||
return ch && strchr(stopChars, ch);
|
||||
}
|
||||
|
||||
int AutoComplete::SetList(const char *list) {
|
||||
int maxStrLen = 12;
|
||||
void AutoComplete::SetFillUpChars(const char *fillUpChars_) {
|
||||
strncpy(fillUpChars, fillUpChars_, sizeof(fillUpChars));
|
||||
fillUpChars[sizeof(fillUpChars) - 1] = '\0';
|
||||
}
|
||||
|
||||
bool AutoComplete::IsFillUpChar(char ch) {
|
||||
return ch && strchr(fillUpChars, ch);
|
||||
}
|
||||
|
||||
void AutoComplete::SetSeparator(char separator_) {
|
||||
separator = separator_;
|
||||
}
|
||||
|
||||
char AutoComplete::GetSeparator() {
|
||||
return separator;
|
||||
}
|
||||
|
||||
void AutoComplete::SetList(const char *list) {
|
||||
lb.Clear();
|
||||
char *words = new char[strlen(list) + 1];
|
||||
if (words) {
|
||||
@@ -53,21 +74,18 @@ int AutoComplete::SetList(const char *list) {
|
||||
char *startword = words;
|
||||
int i = 0;
|
||||
for (; words && words[i]; i++) {
|
||||
if (words[i] == ' ') {
|
||||
if (words[i] == separator) {
|
||||
words[i] = '\0';
|
||||
lb.Append(startword);
|
||||
maxStrLen = Platform::Maximum(maxStrLen, strlen(startword));
|
||||
startword = words + i + 1;
|
||||
}
|
||||
}
|
||||
if (startword) {
|
||||
lb.Append(startword);
|
||||
maxStrLen = Platform::Maximum(maxStrLen, strlen(startword));
|
||||
}
|
||||
delete []words;
|
||||
}
|
||||
lb.Sort();
|
||||
return maxStrLen;
|
||||
}
|
||||
|
||||
void AutoComplete::Show() {
|
||||
@@ -78,7 +96,6 @@ void AutoComplete::Show() {
|
||||
void AutoComplete::Cancel() {
|
||||
if (lb.Created()) {
|
||||
lb.Destroy();
|
||||
lb = 0;
|
||||
active = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,10 +9,16 @@
|
||||
class AutoComplete {
|
||||
bool active;
|
||||
char stopChars[256];
|
||||
char fillUpChars[256];
|
||||
char separator;
|
||||
public:
|
||||
bool ignoreCase;
|
||||
bool chooseSingle;
|
||||
ListBox lb;
|
||||
int posStart;
|
||||
int startLen;
|
||||
// Should autocompletion be canceled if editor's currentPos <= startPos?
|
||||
bool cancelAtStartPos;
|
||||
|
||||
AutoComplete();
|
||||
~AutoComplete();
|
||||
@@ -27,8 +33,16 @@ public:
|
||||
void SetStopChars(const char *stopChars_);
|
||||
bool IsStopChar(char ch);
|
||||
|
||||
// The list string contains a sequence of words separated by spaces
|
||||
int SetList(const char *list);
|
||||
// The fillup chars are characters which, when typed, fill up the selected word
|
||||
void SetFillUpChars(const char *fillUpChars_);
|
||||
bool IsFillUpChar(char ch);
|
||||
|
||||
// The separator character is used when interpreting the list in SetList
|
||||
void SetSeparator(char separator_);
|
||||
char GetSeparator();
|
||||
|
||||
// The list string contains a sequence of words separated by the separator character
|
||||
void SetList(const char *list);
|
||||
|
||||
void Show();
|
||||
void Cancel();
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "Platform.h"
|
||||
|
||||
#include "Scintilla.h"
|
||||
#include "CallTip.h"
|
||||
|
||||
CallTip::CallTip() {
|
||||
@@ -117,7 +118,7 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn,
|
||||
Surface surfaceMeasure;
|
||||
surfaceMeasure.Init();
|
||||
int deviceHeight = (size * surfaceMeasure.LogPixelsY()) / 72;
|
||||
font.Create(faceName, deviceHeight);
|
||||
font.Create(faceName, SC_CHARSET_DEFAULT, deviceHeight, false, false);
|
||||
if (val)
|
||||
delete []val;
|
||||
val = new char[strlen(defn) + 1];
|
||||
|
||||
@@ -6,13 +6,14 @@
|
||||
#ifndef CALLTIP_H
|
||||
#define CALLTIP_H
|
||||
|
||||
const char callClassName[] = "CallTip";
|
||||
|
||||
class CallTip {
|
||||
int startHighlight;
|
||||
int endHighlight;
|
||||
char *val;
|
||||
Font font;
|
||||
// Private so CallTip objects can not be copied
|
||||
CallTip(const CallTip &) {}
|
||||
CallTip &operator=(const CallTip &) { return *this; }
|
||||
public:
|
||||
Window wCallTip;
|
||||
Window wDraw;
|
||||
|
||||
@@ -88,7 +88,7 @@ void MarkerHandleSet::RemoveHandle(int handle) {
|
||||
if (mhn->handle == handle) {
|
||||
*pmhn = mhn->next;
|
||||
delete mhn;
|
||||
return;
|
||||
return ;
|
||||
}
|
||||
pmhn = &((*pmhn)->next);
|
||||
}
|
||||
@@ -101,7 +101,7 @@ void MarkerHandleSet::RemoveNumber(int markerNum) {
|
||||
if (mhn->number == markerNum) {
|
||||
*pmhn = mhn->next;
|
||||
delete mhn;
|
||||
return;
|
||||
return ;
|
||||
}
|
||||
pmhn = &((*pmhn)->next);
|
||||
}
|
||||
@@ -119,7 +119,11 @@ void MarkerHandleSet::CombineWith(MarkerHandleSet *other) {
|
||||
LineVector::LineVector() {
|
||||
linesData = 0;
|
||||
lines = 0;
|
||||
size = 0;
|
||||
levels = 0;
|
||||
sizeLevels = 0;
|
||||
handleCurrent = 1;
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
@@ -161,6 +165,7 @@ void LineVector::Expand(int sizeNew) {
|
||||
Platform::DebugPrintf("No memory available\n");
|
||||
// TODO: Blow up
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void LineVector::ExpandLevels(int sizeNew) {
|
||||
@@ -180,6 +185,13 @@ void LineVector::ExpandLevels(int sizeNew) {
|
||||
Platform::DebugPrintf("No memory available\n");
|
||||
// TODO: Blow up
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void LineVector::ClearLevels() {
|
||||
delete []levels;
|
||||
levels = 0;
|
||||
sizeLevels = 0;
|
||||
}
|
||||
|
||||
void LineVector::InsertValue(int pos, int value) {
|
||||
@@ -191,11 +203,23 @@ void LineVector::InsertValue(int pos, int value) {
|
||||
}
|
||||
}
|
||||
lines++;
|
||||
for (int i = lines + 1; i > pos; i--) {
|
||||
for (int i = lines; i > pos; i--) {
|
||||
linesData[i] = linesData[i - 1];
|
||||
}
|
||||
linesData[pos].startPosition = value;
|
||||
linesData[pos].handleSet = 0;
|
||||
if (levels) {
|
||||
for (int j = lines; j > pos; j--) {
|
||||
levels[j] = levels[j - 1];
|
||||
}
|
||||
if (pos == 0) {
|
||||
levels[pos] = SC_FOLDLEVELBASE;
|
||||
} else if (pos == (lines - 1)) { // Last line will not be a folder
|
||||
levels[pos] = SC_FOLDLEVELBASE;
|
||||
} else {
|
||||
levels[pos] = levels[pos - 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LineVector::SetValue(int pos, int value) {
|
||||
@@ -221,6 +245,15 @@ void LineVector::Remove(int pos) {
|
||||
for (int i = pos; i < lines; i++) {
|
||||
linesData[i] = linesData[i + 1];
|
||||
}
|
||||
if (levels) {
|
||||
// Level information merges back onto previous line
|
||||
int posAbove = pos - 1;
|
||||
if (posAbove < 0)
|
||||
posAbove = 0;
|
||||
for (int j = posAbove; j < lines; j++) {
|
||||
levels[j] = levels[j + 1];
|
||||
}
|
||||
}
|
||||
lines--;
|
||||
}
|
||||
|
||||
@@ -233,9 +266,8 @@ int LineVector::LineFromPosition(int pos) {
|
||||
return lines - 1;
|
||||
int lower = 0;
|
||||
int upper = lines;
|
||||
int middle = 0;
|
||||
do {
|
||||
middle = (upper + lower + 1) / 2; // Round high
|
||||
int middle = (upper + lower + 1) / 2; // Round high
|
||||
if (pos < linesData[middle].startPosition) {
|
||||
upper = middle - 1;
|
||||
} else {
|
||||
@@ -260,11 +292,12 @@ int LineVector::AddMark(int line, int markerNum) {
|
||||
}
|
||||
|
||||
void LineVector::MergeMarkers(int pos) {
|
||||
if (linesData[pos].handleSet || linesData[pos + 1].handleSet) {
|
||||
if (linesData[pos].handleSet && linesData[pos + 1].handleSet) {
|
||||
linesData[pos].handleSet->CombineWith(linesData[pos].handleSet);
|
||||
linesData[pos].handleSet = 0;
|
||||
}
|
||||
if (linesData[pos + 1].handleSet != NULL) {
|
||||
if (linesData[pos].handleSet == NULL )
|
||||
linesData[pos].handleSet = new MarkerHandleSet;
|
||||
linesData[pos].handleSet->CombineWith(linesData[pos + 1].handleSet);
|
||||
delete linesData[pos + 1].handleSet;
|
||||
linesData[pos + 1].handleSet = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -316,12 +349,13 @@ Action::~Action() {
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void Action::Create(actionType at_, int position_, char *data_, int lenData_) {
|
||||
void Action::Create(actionType at_, int position_, char *data_, int lenData_, bool mayCoalesce_) {
|
||||
delete []data;
|
||||
position = position_;
|
||||
at = at_;
|
||||
data = data_;
|
||||
lenData = lenData_;
|
||||
mayCoalesce = mayCoalesce_;
|
||||
}
|
||||
|
||||
void Action::Destroy() {
|
||||
@@ -336,12 +370,207 @@ void Action::Grab(Action *source) {
|
||||
at = source->at;
|
||||
data = source->data;
|
||||
lenData = source->lenData;
|
||||
mayCoalesce = source->mayCoalesce;
|
||||
|
||||
// Ownership of source data transferred to this
|
||||
source->position = 0;
|
||||
source->at = startAction;
|
||||
source->data = 0;
|
||||
source->lenData = 0;
|
||||
source->mayCoalesce = true;
|
||||
}
|
||||
|
||||
// The undo history stores a sequence of user operations that represent the user's view of the
|
||||
// commands executed on the text.
|
||||
// Each user operation contains a sequence of text insertion and text deletion actions.
|
||||
// All the user operations are stored in a list of individual actions with 'start' actions used
|
||||
// as delimiters between user operations.
|
||||
// Initially there is one start action in the history.
|
||||
// As each action is performed, it is recorded in the history. The action may either become
|
||||
// part of the current user operation or may start a new user operation. If it is to be part of the
|
||||
// current operation, then it overwrites the current last action. If it is to be part of a new
|
||||
// operation, it is appended after the current last action.
|
||||
// After writing the new action, a new start action is appended at the end of the history.
|
||||
// The decision of whether to start a new user operation is based upon two factors. If a
|
||||
// compound operation has been explicitly started by calling BeginUndoAction and no matching
|
||||
// EndUndoAction (these calls nest) has been called, then the action is coalesced into the current
|
||||
// operation. If there is no outstanding BeginUndoAction call then a new operation is started
|
||||
// unless it looks as if the new action is caused by the user typing or deleting a stream of text.
|
||||
// Sequences that look like typing or deletion are coalesced into a single user operation.
|
||||
|
||||
UndoHistory::UndoHistory() {
|
||||
|
||||
lenActions = 100;
|
||||
actions = new Action[lenActions];
|
||||
maxAction = 0;
|
||||
currentAction = 0;
|
||||
undoSequenceDepth = 0;
|
||||
savePoint = 0;
|
||||
|
||||
actions[currentAction].Create(startAction);
|
||||
}
|
||||
|
||||
UndoHistory::~UndoHistory() {
|
||||
delete []actions;
|
||||
actions = 0;
|
||||
}
|
||||
|
||||
void UndoHistory::EnsureUndoRoom() {
|
||||
//Platform::DebugPrintf("%% %d action %d %d %d\n", at, position, length, currentAction);
|
||||
if (currentAction >= 2) {
|
||||
// Have to test that there is room for 2 more actions in the array
|
||||
// as two actions may be created by this function
|
||||
if (currentAction >= (lenActions - 2)) {
|
||||
// Run out of undo nodes so extend the array
|
||||
int lenActionsNew = lenActions * 2;
|
||||
Action *actionsNew = new Action[lenActionsNew];
|
||||
if (!actionsNew)
|
||||
return ;
|
||||
for (int act = 0; act <= currentAction; act++)
|
||||
actionsNew[act].Grab(&actions[act]);
|
||||
delete []actions;
|
||||
lenActions = lenActionsNew;
|
||||
actions = actionsNew;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UndoHistory::AppendAction(actionType at, int position, char *data, int lengthData) {
|
||||
EnsureUndoRoom();
|
||||
//Platform::DebugPrintf("%% %d action %d %d %d\n", at, position, lengthData, currentAction);
|
||||
//Platform::DebugPrintf("^ %d action %d %d\n", actions[currentAction - 1].at,
|
||||
// actions[currentAction - 1].position, actions[currentAction - 1].lenData);
|
||||
if (currentAction >= 1) {
|
||||
if (0 == undoSequenceDepth) {
|
||||
// Top level actions may not always be coalesced
|
||||
Action &actPrevious = actions[currentAction - 1];
|
||||
// See if current action can be coalesced into previous action
|
||||
// Will work if both are inserts or deletes and position is same
|
||||
if (at != actPrevious.at) {
|
||||
currentAction++;
|
||||
} else if (currentAction == savePoint) {
|
||||
currentAction++;
|
||||
} else if ((at == removeAction) &&
|
||||
((position + lengthData * 2) != actPrevious.position)) {
|
||||
// Removals must be at same position to coalesce
|
||||
currentAction++;
|
||||
} else if ((at == insertAction) &&
|
||||
(position != (actPrevious.position + actPrevious.lenData*2))) {
|
||||
// Insertions must be immediately after to coalesce
|
||||
currentAction++;
|
||||
} else {
|
||||
//Platform::DebugPrintf("action coalesced\n");
|
||||
}
|
||||
|
||||
} else {
|
||||
// Actions not at top level are always coalesced unless this is after return to top level
|
||||
if (!actions[currentAction].mayCoalesce)
|
||||
currentAction++;
|
||||
}
|
||||
} else {
|
||||
currentAction++;
|
||||
}
|
||||
actions[currentAction].Create(at, position, data, lengthData);
|
||||
currentAction++;
|
||||
actions[currentAction].Create(startAction);
|
||||
maxAction = currentAction;
|
||||
}
|
||||
|
||||
void UndoHistory::BeginUndoAction() {
|
||||
EnsureUndoRoom();
|
||||
if (undoSequenceDepth == 0) {
|
||||
if (actions[currentAction].at != startAction) {
|
||||
currentAction++;
|
||||
actions[currentAction].Create(startAction);
|
||||
maxAction = currentAction;
|
||||
}
|
||||
actions[currentAction].mayCoalesce = false;
|
||||
}
|
||||
undoSequenceDepth++;
|
||||
}
|
||||
|
||||
void UndoHistory::EndUndoAction() {
|
||||
EnsureUndoRoom();
|
||||
undoSequenceDepth--;
|
||||
if (0 == undoSequenceDepth) {
|
||||
if (actions[currentAction].at != startAction) {
|
||||
currentAction++;
|
||||
actions[currentAction].Create(startAction);
|
||||
maxAction = currentAction;
|
||||
}
|
||||
actions[currentAction].mayCoalesce = false;
|
||||
}
|
||||
}
|
||||
|
||||
void UndoHistory::DropUndoSequence() {
|
||||
undoSequenceDepth = 0;
|
||||
}
|
||||
|
||||
void UndoHistory::DeleteUndoHistory() {
|
||||
for (int i = 1; i < maxAction; i++)
|
||||
actions[i].Destroy();
|
||||
maxAction = 0;
|
||||
currentAction = 0;
|
||||
actions[currentAction].Create(startAction);
|
||||
savePoint = 0;
|
||||
}
|
||||
|
||||
void UndoHistory::SetSavePoint() {
|
||||
savePoint = currentAction;
|
||||
}
|
||||
|
||||
bool UndoHistory::IsSavePoint() const {
|
||||
return savePoint == currentAction;
|
||||
}
|
||||
|
||||
bool UndoHistory::CanUndo() const {
|
||||
return (currentAction > 0) && (maxAction > 0);
|
||||
}
|
||||
|
||||
int UndoHistory::StartUndo() {
|
||||
// Drop any trailing startAction
|
||||
if (actions[currentAction].at == startAction && currentAction > 0)
|
||||
currentAction--;
|
||||
|
||||
// Count the steps in this action
|
||||
int act = currentAction;
|
||||
while (actions[act].at != startAction && act > 0) {
|
||||
act--;
|
||||
}
|
||||
return currentAction - act;
|
||||
}
|
||||
|
||||
const Action &UndoHistory::GetUndoStep() const {
|
||||
return actions[currentAction];
|
||||
}
|
||||
|
||||
void UndoHistory::CompletedUndoStep() {
|
||||
currentAction--;
|
||||
}
|
||||
|
||||
bool UndoHistory::CanRedo() const {
|
||||
return maxAction > currentAction;
|
||||
}
|
||||
|
||||
int UndoHistory::StartRedo() {
|
||||
// Drop any leading startAction
|
||||
if (actions[currentAction].at == startAction && currentAction < maxAction)
|
||||
currentAction++;
|
||||
|
||||
// Count the steps in this action
|
||||
int act = currentAction;
|
||||
while (actions[act].at != startAction && act < maxAction) {
|
||||
act++;
|
||||
}
|
||||
return act - currentAction;
|
||||
}
|
||||
|
||||
const Action &UndoHistory::GetRedoStep() const {
|
||||
return actions[currentAction];
|
||||
}
|
||||
|
||||
void UndoHistory::CompletedRedoStep() {
|
||||
currentAction++;
|
||||
}
|
||||
|
||||
CellBuffer::CellBuffer(int initialLength) {
|
||||
@@ -352,28 +581,17 @@ CellBuffer::CellBuffer(int initialLength) {
|
||||
gaplen = initialLength;
|
||||
part2body = body + gaplen;
|
||||
readOnly = false;
|
||||
|
||||
lenActions = 100;
|
||||
actions = new Action[lenActions];
|
||||
maxAction = 0;
|
||||
currentAction = 0;
|
||||
collectingUndo = undoCollectAutoStart;
|
||||
undoSequenceDepth = 0;
|
||||
savePoint = 0;
|
||||
|
||||
actions[currentAction].Create(startAction);
|
||||
collectingUndo = true;
|
||||
}
|
||||
|
||||
CellBuffer::~CellBuffer() {
|
||||
delete []body;
|
||||
body = 0;
|
||||
delete []actions;
|
||||
actions = 0;
|
||||
}
|
||||
|
||||
void CellBuffer::GapTo(int position) {
|
||||
if (position == part1len)
|
||||
return;
|
||||
return ;
|
||||
if (position < part1len) {
|
||||
int diff = part1len - position;
|
||||
//Platform::DebugPrintf("Move gap backwards to %d diff = %d part1len=%d length=%d \n", position,diff, part1len, length);
|
||||
@@ -405,6 +623,7 @@ void CellBuffer::RoomFor(int insertionLength) {
|
||||
size = newSize;
|
||||
//Platform::DebugPrintf("end need room %d %d - size=%d length=%d\n", gaplen, insertionLength,size,length);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// To make it easier to write code that uses ByteAt, a position outside the range of the buffer
|
||||
@@ -429,16 +648,16 @@ void CellBuffer::SetByteAt(int position, char ch) {
|
||||
|
||||
if (position < 0) {
|
||||
//Platform::DebugPrintf("Bad position %d\n",position);
|
||||
return;
|
||||
return ;
|
||||
}
|
||||
if (position >= length + 11) {
|
||||
Platform::DebugPrintf("Very Bad position %d of %d\n", position, length);
|
||||
//exit(2);
|
||||
return;
|
||||
return ;
|
||||
}
|
||||
if (position >= length) {
|
||||
//Platform::DebugPrintf("Bad position %d of %d\n",position,length);
|
||||
return;
|
||||
return ;
|
||||
}
|
||||
|
||||
if (position < part1len) {
|
||||
@@ -454,20 +673,20 @@ char CellBuffer::CharAt(int position) {
|
||||
|
||||
void CellBuffer::GetCharRange(char *buffer, int position, int lengthRetrieve) {
|
||||
if (lengthRetrieve < 0)
|
||||
return;
|
||||
return ;
|
||||
if (position < 0)
|
||||
return;
|
||||
return ;
|
||||
int bytePos = position * 2;
|
||||
if ((bytePos + lengthRetrieve * 2) > length) {
|
||||
Platform::DebugPrintf("Bad GetCharRange %d for %d of %d\n",bytePos,
|
||||
lengthRetrieve, length);
|
||||
return;
|
||||
Platform::DebugPrintf("Bad GetCharRange %d for %d of %d\n", bytePos,
|
||||
lengthRetrieve, length);
|
||||
return ;
|
||||
}
|
||||
GapTo(0); // Move the buffer so its easy to subscript into it
|
||||
char *pb = part2body + bytePos;
|
||||
while (lengthRetrieve--) {
|
||||
*buffer++ = *pb;
|
||||
pb +=2;
|
||||
pb += 2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -486,7 +705,7 @@ const char *CellBuffer::InsertString(int position, char *s, int insertLength) {
|
||||
for (int i = 0; i < insertLength / 2; i++) {
|
||||
data[i] = s[i * 2];
|
||||
}
|
||||
AppendAction(insertAction, position, data, insertLength / 2);
|
||||
uh.AppendAction(insertAction, position, data, insertLength / 2);
|
||||
}
|
||||
|
||||
BasicInsertString(position, s, insertLength);
|
||||
@@ -502,9 +721,9 @@ void CellBuffer::InsertCharStyle(int position, char ch, char style) {
|
||||
}
|
||||
|
||||
bool CellBuffer::SetStyleAt(int position, char style, char mask) {
|
||||
char curVal = ByteAt(position*2 + 1);
|
||||
char curVal = ByteAt(position * 2 + 1);
|
||||
if ((curVal & mask) != style) {
|
||||
SetByteAt(position*2 + 1, (curVal & ~mask) | style);
|
||||
SetByteAt(position*2 + 1, static_cast<char>((curVal & ~mask) | style));
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -517,7 +736,7 @@ bool CellBuffer::SetStyleFor(int position, int lengthStyle, char style, char mas
|
||||
while (lengthStyle--) {
|
||||
char curVal = ByteAt(bytePos);
|
||||
if ((curVal & mask) != style) {
|
||||
SetByteAt(bytePos, (curVal & ~mask) | style);
|
||||
SetByteAt(bytePos, static_cast<char>((curVal & ~mask) | style));
|
||||
changed = true;
|
||||
}
|
||||
bytePos += 2;
|
||||
@@ -525,48 +744,6 @@ bool CellBuffer::SetStyleFor(int position, int lengthStyle, char style, char mas
|
||||
return changed;
|
||||
}
|
||||
|
||||
void CellBuffer::EnsureUndoRoom() {
|
||||
//Platform::DebugPrintf("%% %d action %d %d %d\n", at, position, length, currentAction);
|
||||
if (currentAction >= 2) {
|
||||
// Have to test that there is room for 2 more actions in the array
|
||||
// as two actions may be created by this function
|
||||
if (currentAction >= (lenActions - 2)) {
|
||||
// Run out of undo nodes so extend the array
|
||||
int lenActionsNew = lenActions * 2;
|
||||
Action *actionsNew = new Action[lenActionsNew];
|
||||
if (!actionsNew)
|
||||
return;
|
||||
for (int act = 0; act <= currentAction; act++)
|
||||
actionsNew[act].Grab(&actions[act]);
|
||||
delete []actions;
|
||||
lenActions = lenActionsNew;
|
||||
actions = actionsNew;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CellBuffer::AppendAction(actionType at, int position, char *data, int lengthData) {
|
||||
EnsureUndoRoom();
|
||||
//Platform::DebugPrintf("%% %d action %d %d %d\n", at, position, lengthData, currentAction);
|
||||
if (currentAction >= 2) {
|
||||
// See if current action can be coalesced into previous action
|
||||
// Will work if both are inserts or deletes and position is same or two different
|
||||
if ((at != actions[currentAction - 1].at) || (abs(position - actions[currentAction - 1].position) > 2)) {
|
||||
currentAction++;
|
||||
} else if (currentAction == savePoint) {
|
||||
currentAction++;
|
||||
}
|
||||
} else {
|
||||
currentAction++;
|
||||
}
|
||||
actions[currentAction].Create(at, position, data, lengthData);
|
||||
if ((collectingUndo == undoCollectAutoStart) && (0 == undoSequenceDepth)) {
|
||||
currentAction++;
|
||||
actions[currentAction].Create(startAction);
|
||||
}
|
||||
maxAction = currentAction;
|
||||
}
|
||||
|
||||
const char *CellBuffer::DeleteChars(int position, int deleteLength) {
|
||||
// InsertString and DeleteChars are the bottleneck though which all changes occur
|
||||
char *data = 0;
|
||||
@@ -577,7 +754,7 @@ const char *CellBuffer::DeleteChars(int position, int deleteLength) {
|
||||
for (int i = 0; i < deleteLength / 2; i++) {
|
||||
data[i] = ByteAt(position + i * 2);
|
||||
}
|
||||
AppendAction(removeAction, position, data, deleteLength / 2);
|
||||
uh.AppendAction(removeAction, position, data, deleteLength / 2);
|
||||
}
|
||||
|
||||
BasicDeleteChars(position, deleteLength);
|
||||
@@ -616,11 +793,11 @@ void CellBuffer::SetReadOnly(bool set) {
|
||||
}
|
||||
|
||||
void CellBuffer::SetSavePoint() {
|
||||
savePoint = currentAction;
|
||||
uh.SetSavePoint();
|
||||
}
|
||||
|
||||
bool CellBuffer::IsSavePoint() {
|
||||
return savePoint == currentAction;
|
||||
return uh.IsSavePoint();
|
||||
}
|
||||
|
||||
int CellBuffer::AddMark(int line, int markerNum) {
|
||||
@@ -661,7 +838,7 @@ int CellBuffer::LineFromHandle(int markerHandle) {
|
||||
void CellBuffer::BasicInsertString(int position, char *s, int insertLength) {
|
||||
//Platform::DebugPrintf("Inserting at %d for %d\n", position, insertLength);
|
||||
if (insertLength == 0)
|
||||
return;
|
||||
return ;
|
||||
RoomFor(insertLength);
|
||||
GapTo(position);
|
||||
|
||||
@@ -721,7 +898,7 @@ void CellBuffer::BasicInsertString(int position, char *s, int insertLength) {
|
||||
void CellBuffer::BasicDeleteChars(int position, int deleteLength) {
|
||||
//Platform::DebugPrintf("Deleting at %d for %d\n", position, deleteLength);
|
||||
if (deleteLength == 0)
|
||||
return;
|
||||
return ;
|
||||
|
||||
if ((position == 0) && (deleteLength == length)) {
|
||||
// If whole buffer is being deleted, faster to reinitialise lines data
|
||||
@@ -753,6 +930,7 @@ void CellBuffer::BasicDeleteChars(int position, int deleteLength) {
|
||||
ignoreNL = true; // First \n is not real deletion
|
||||
}
|
||||
|
||||
|
||||
char ch = chNext;
|
||||
for (int i = 0; i < deleteLength; i += 2) {
|
||||
chNext = ' ';
|
||||
@@ -770,6 +948,7 @@ void CellBuffer::BasicDeleteChars(int position, int deleteLength) {
|
||||
ignoreNL = false; // Further \n are not real deletions
|
||||
}
|
||||
|
||||
|
||||
ch = chNext;
|
||||
}
|
||||
// May have to fix up end if last deletion causes cr to be next to lf
|
||||
@@ -790,9 +969,9 @@ void CellBuffer::BasicDeleteChars(int position, int deleteLength) {
|
||||
part2body = body + gaplen;
|
||||
}
|
||||
|
||||
undoCollectionType CellBuffer::SetUndoCollection(undoCollectionType collectUndo) {
|
||||
bool CellBuffer::SetUndoCollection(bool collectUndo) {
|
||||
collectingUndo = collectUndo;
|
||||
undoSequenceDepth = 0;
|
||||
uh.DropUndoSequence();
|
||||
return collectingUndo;
|
||||
}
|
||||
|
||||
@@ -800,116 +979,72 @@ bool CellBuffer::IsCollectingUndo() {
|
||||
return collectingUndo;
|
||||
}
|
||||
|
||||
void CellBuffer::AppendUndoStartAction() {
|
||||
EnsureUndoRoom();
|
||||
// Finish any currently active undo sequence
|
||||
undoSequenceDepth = 0;
|
||||
if (actions[currentAction].at != startAction) {
|
||||
undoSequenceDepth++;
|
||||
currentAction++;
|
||||
actions[currentAction].Create(startAction);
|
||||
maxAction = currentAction;
|
||||
}
|
||||
}
|
||||
|
||||
void CellBuffer::BeginUndoAction() {
|
||||
EnsureUndoRoom();
|
||||
if (undoSequenceDepth == 0) {
|
||||
if (actions[currentAction].at != startAction) {
|
||||
currentAction++;
|
||||
actions[currentAction].Create(startAction);
|
||||
maxAction = currentAction;
|
||||
}
|
||||
}
|
||||
undoSequenceDepth++;
|
||||
uh.BeginUndoAction();
|
||||
}
|
||||
|
||||
void CellBuffer::EndUndoAction() {
|
||||
EnsureUndoRoom();
|
||||
undoSequenceDepth--;
|
||||
if (0 == undoSequenceDepth) {
|
||||
if (actions[currentAction].at != startAction) {
|
||||
currentAction++;
|
||||
actions[currentAction].Create(startAction);
|
||||
maxAction = currentAction;
|
||||
}
|
||||
}
|
||||
uh.EndUndoAction();
|
||||
}
|
||||
|
||||
void CellBuffer::DeleteUndoHistory() {
|
||||
for (int i = 1; i < maxAction; i++)
|
||||
actions[i].Destroy();
|
||||
maxAction = 0;
|
||||
currentAction = 0;
|
||||
savePoint = 0;
|
||||
uh.DeleteUndoHistory();
|
||||
}
|
||||
|
||||
bool CellBuffer::CanUndo() {
|
||||
return (!readOnly) && ((currentAction > 0) && (maxAction > 0));
|
||||
return (!readOnly) && (uh.CanUndo());
|
||||
}
|
||||
|
||||
int CellBuffer::StartUndo() {
|
||||
// Drop any trailing startAction
|
||||
if (actions[currentAction].at == startAction && currentAction > 0)
|
||||
currentAction--;
|
||||
|
||||
// Count the steps in this action
|
||||
int act = currentAction;
|
||||
while (actions[act].at != startAction && act > 0) {
|
||||
act--;
|
||||
}
|
||||
return currentAction - act;
|
||||
return uh.StartUndo();
|
||||
}
|
||||
|
||||
const Action &CellBuffer::UndoStep() {
|
||||
const Action &actionStep = actions[currentAction];
|
||||
const Action &CellBuffer::GetUndoStep() const {
|
||||
return uh.GetUndoStep();
|
||||
}
|
||||
|
||||
void CellBuffer::PerformUndoStep() {
|
||||
const Action &actionStep = uh.GetUndoStep();
|
||||
if (actionStep.at == insertAction) {
|
||||
BasicDeleteChars(actionStep.position, actionStep.lenData*2);
|
||||
} else if (actionStep.at == removeAction) {
|
||||
char *styledData = new char[actionStep.lenData * 2];
|
||||
for (int i = 0; i < actionStep.lenData; i++) {
|
||||
styledData[i*2] = actionStep.data[i];
|
||||
styledData[i*2+1] = 0;
|
||||
styledData[i*2 + 1] = 0;
|
||||
}
|
||||
BasicInsertString(actionStep.position, styledData, actionStep.lenData*2);
|
||||
delete []styledData;
|
||||
}
|
||||
currentAction--;
|
||||
return actionStep;
|
||||
uh.CompletedUndoStep();
|
||||
}
|
||||
|
||||
bool CellBuffer::CanRedo() {
|
||||
return (!readOnly) && (maxAction > currentAction);
|
||||
return (!readOnly) && (uh.CanRedo());
|
||||
}
|
||||
|
||||
int CellBuffer::StartRedo() {
|
||||
// Drop any leading startAction
|
||||
if (actions[currentAction].at == startAction && currentAction < maxAction)
|
||||
currentAction++;
|
||||
|
||||
// Count the steps in this action
|
||||
int act = currentAction;
|
||||
while (actions[act].at != startAction && act < maxAction) {
|
||||
act++;
|
||||
}
|
||||
return act - currentAction;
|
||||
return uh.StartRedo();
|
||||
}
|
||||
|
||||
const Action &CellBuffer::RedoStep() {
|
||||
const Action &actionStep = actions[currentAction];
|
||||
const Action &CellBuffer::GetRedoStep() const {
|
||||
return uh.GetRedoStep();
|
||||
}
|
||||
|
||||
void CellBuffer::PerformRedoStep() {
|
||||
const Action &actionStep = uh.GetRedoStep();
|
||||
if (actionStep.at == insertAction) {
|
||||
char *styledData = new char[actionStep.lenData * 2];
|
||||
for (int i = 0; i < actionStep.lenData; i++) {
|
||||
styledData[i*2] = actionStep.data[i];
|
||||
styledData[i*2+1] = 0;
|
||||
styledData[i*2 + 1] = 0;
|
||||
}
|
||||
BasicInsertString(actionStep.position, styledData, actionStep.lenData*2);
|
||||
delete []styledData;
|
||||
} else if (actionStep.at == removeAction) {
|
||||
BasicDeleteChars(actionStep.position, actionStep.lenData*2);
|
||||
}
|
||||
currentAction++;
|
||||
return actionStep;
|
||||
uh.CompletedRedoStep();
|
||||
}
|
||||
|
||||
int CellBuffer::SetLineState(int line, int state) {
|
||||
@@ -925,7 +1060,7 @@ int CellBuffer::GetLineState(int line) {
|
||||
int CellBuffer::GetMaxLineState() {
|
||||
return lineStates.Length();
|
||||
}
|
||||
|
||||
|
||||
int CellBuffer::SetLevel(int line, int level) {
|
||||
int prev = 0;
|
||||
if ((line >= 0) && (line < lv.lines)) {
|
||||
@@ -948,3 +1083,6 @@ int CellBuffer::GetLevel(int line) {
|
||||
}
|
||||
}
|
||||
|
||||
void CellBuffer::ClearLevels() {
|
||||
lv.ClearLevels();
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ public:
|
||||
|
||||
void Expand(int sizeNew);
|
||||
void ExpandLevels(int sizeNew=-1);
|
||||
void ClearLevels();
|
||||
void InsertValue(int pos, int value);
|
||||
void SetValue(int pos, int value);
|
||||
void Remove(int pos);
|
||||
@@ -79,15 +80,52 @@ public:
|
||||
int position;
|
||||
char *data;
|
||||
int lenData;
|
||||
bool mayCoalesce;
|
||||
|
||||
Action();
|
||||
~Action();
|
||||
void Create(actionType at_, int position_=0, char *data_=0, int lenData_=0);
|
||||
void Create(actionType at_, int position_=0, char *data_=0, int lenData_=0, bool mayCoalesce_=true);
|
||||
void Destroy();
|
||||
void Grab(Action *source);
|
||||
};
|
||||
|
||||
enum undoCollectionType { undoCollectNone, undoCollectAutoStart, undoCollectManualStart };
|
||||
class UndoHistory {
|
||||
Action *actions;
|
||||
int lenActions;
|
||||
int maxAction;
|
||||
int currentAction;
|
||||
int undoSequenceDepth;
|
||||
int savePoint;
|
||||
|
||||
void EnsureUndoRoom();
|
||||
|
||||
public:
|
||||
UndoHistory();
|
||||
~UndoHistory();
|
||||
|
||||
void AppendAction(actionType at, int position, char *data, int length);
|
||||
|
||||
void BeginUndoAction();
|
||||
void EndUndoAction();
|
||||
void DropUndoSequence();
|
||||
void DeleteUndoHistory();
|
||||
|
||||
// The save point is a marker in the undo stack where the container has stated that
|
||||
// the buffer was saved. Undo and redo can move over the save point.
|
||||
void SetSavePoint();
|
||||
bool IsSavePoint() const;
|
||||
|
||||
// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is
|
||||
// called that many times. Similarly for redo.
|
||||
bool CanUndo() const;
|
||||
int StartUndo();
|
||||
const Action &GetUndoStep() const;
|
||||
void CompletedUndoStep();
|
||||
bool CanRedo() const;
|
||||
int StartRedo();
|
||||
const Action &GetRedoStep() const;
|
||||
void CompletedRedoStep();
|
||||
};
|
||||
|
||||
// Holder for an expandable array of characters that supports undo and line markers
|
||||
// Based on article "Data Structures in a Bit-Mapped Text Editor"
|
||||
@@ -102,24 +140,16 @@ private:
|
||||
char *part2body;
|
||||
bool readOnly;
|
||||
|
||||
Action *actions;
|
||||
int lenActions;
|
||||
int maxAction;
|
||||
int currentAction;
|
||||
undoCollectionType collectingUndo;
|
||||
int undoSequenceDepth;
|
||||
int savePoint;
|
||||
bool collectingUndo;
|
||||
UndoHistory uh;
|
||||
|
||||
LineVector lv;
|
||||
|
||||
SVector<int, 4000> lineStates;
|
||||
SVector lineStates;
|
||||
|
||||
void GapTo(int position);
|
||||
void RoomFor(int insertionLength);
|
||||
|
||||
void EnsureUndoRoom();
|
||||
void AppendAction(actionType at, int position, char *data, int length);
|
||||
|
||||
inline char ByteAt(int position);
|
||||
void SetByteAt(int position, char ch);
|
||||
|
||||
@@ -143,7 +173,7 @@ public:
|
||||
|
||||
// Setting styles for positions outside the range of the buffer is safe and has no effect.
|
||||
// True is returned if the style of a character changed.
|
||||
bool SetStyleAt(int position, char style, char mask=(char)0xff);
|
||||
bool SetStyleAt(int position, char style, char mask='\377');
|
||||
bool SetStyleFor(int position, int length, char style, char mask);
|
||||
|
||||
const char *DeleteChars(int position, int deleteLength);
|
||||
@@ -168,21 +198,22 @@ public:
|
||||
void BasicInsertString(int position, char *s, int insertLength);
|
||||
void BasicDeleteChars(int position, int deleteLength);
|
||||
|
||||
undoCollectionType SetUndoCollection(undoCollectionType collectUndo);
|
||||
bool SetUndoCollection(bool collectUndo);
|
||||
bool IsCollectingUndo();
|
||||
void AppendUndoStartAction();
|
||||
void BeginUndoAction();
|
||||
void EndUndoAction();
|
||||
void DeleteUndoHistory();
|
||||
|
||||
// To perform an undo, StartUndo is called to retreive the number of steps, then UndoStep is
|
||||
// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is
|
||||
// called that many times. Similarly for redo.
|
||||
bool CanUndo();
|
||||
int StartUndo();
|
||||
const Action &UndoStep();
|
||||
const Action &GetUndoStep() const;
|
||||
void PerformUndoStep();
|
||||
bool CanRedo();
|
||||
int StartRedo();
|
||||
const Action &RedoStep();
|
||||
const Action &GetRedoStep() const;
|
||||
void PerformRedoStep();
|
||||
|
||||
int SetLineState(int line, int state);
|
||||
int GetLineState(int line);
|
||||
@@ -190,6 +221,7 @@ public:
|
||||
|
||||
int SetLevel(int line, int level);
|
||||
int GetLevel(int line);
|
||||
void ClearLevels();
|
||||
};
|
||||
|
||||
#define CELL_SIZE 2
|
||||
|
||||
@@ -30,7 +30,6 @@ void ContractionState::MakeValid() const {
|
||||
if (!valid) {
|
||||
// Could be cleverer by keeping the index of the last still valid entry
|
||||
// rather than invalidating all.
|
||||
int linePrev = -1;
|
||||
int lineDisplay = 0;
|
||||
for (int line=0; line<linesInDoc; line++) {
|
||||
lines[line].displayLine = lineDisplay;
|
||||
@@ -108,12 +107,12 @@ void ContractionState::InsertLines(int lineDoc, int lineCount) {
|
||||
return;
|
||||
}
|
||||
//Platform::DebugPrintf("InsertLine[%d] = %d\n", lineDoc);
|
||||
if ((linesInDoc + 2) >= size) {
|
||||
Grow(size + growSize);
|
||||
if ((linesInDoc + lineCount + 2) >= size) {
|
||||
Grow(linesInDoc + lineCount + growSize);
|
||||
}
|
||||
linesInDoc += lineCount;
|
||||
linesInDisplay += lineCount;
|
||||
for (int i = linesInDoc + 1; i >= lineDoc + lineCount; i--) {
|
||||
for (int i = linesInDoc; i >= lineDoc + lineCount; i--) {
|
||||
lines[i].visible = lines[i - lineCount].visible;
|
||||
lines[i].expanded = lines[i - lineCount].expanded;
|
||||
}
|
||||
@@ -130,16 +129,18 @@ void ContractionState::DeleteLines(int lineDoc, int lineCount) {
|
||||
linesInDisplay -= lineCount;
|
||||
return;
|
||||
}
|
||||
int delta = 0;
|
||||
for (int d=0;d<lineCount;d++)
|
||||
int deltaDisplayed = 0;
|
||||
for (int d=0;d<lineCount;d++) {
|
||||
if (lines[lineDoc+d].visible)
|
||||
delta--;
|
||||
deltaDisplayed--;
|
||||
}
|
||||
for (int i = lineDoc; i < linesInDoc-lineCount; i++) {
|
||||
lines[i].visible = lines[i + lineCount].visible;
|
||||
if (i != 0) // Line zero is always visible
|
||||
lines[i].visible = lines[i + lineCount].visible;
|
||||
lines[i].expanded = lines[i + lineCount].expanded;
|
||||
}
|
||||
linesInDoc -= lineCount;
|
||||
linesInDisplay += delta;
|
||||
linesInDisplay += deltaDisplayed;
|
||||
valid = false;
|
||||
}
|
||||
|
||||
@@ -154,8 +155,12 @@ bool ContractionState::GetVisible(int lineDoc) const {
|
||||
}
|
||||
|
||||
bool ContractionState::SetVisible(int lineDocStart, int lineDocEnd, bool visible) {
|
||||
if (lineDocStart == 0)
|
||||
lineDocStart++;
|
||||
if (lineDocStart > lineDocEnd)
|
||||
return false;
|
||||
if (size == 0) {
|
||||
Grow(lineDocEnd + growSize);
|
||||
Grow(linesInDoc + growSize);
|
||||
}
|
||||
// TODO: modify docLine members to mirror displayLine
|
||||
int delta = 0;
|
||||
@@ -166,12 +171,6 @@ bool ContractionState::SetVisible(int lineDocStart, int lineDocEnd, bool visible
|
||||
delta += visible ? 1 : -1;
|
||||
lines[line].visible = visible;
|
||||
}
|
||||
lines[line].displayLine += delta;
|
||||
}
|
||||
if (delta != 0) {
|
||||
for (int line=lineDocEnd+1; line <= linesInDoc; line++) {
|
||||
lines[line].displayLine += delta;
|
||||
}
|
||||
}
|
||||
}
|
||||
linesInDisplay += delta;
|
||||
@@ -191,7 +190,7 @@ bool ContractionState::GetExpanded(int lineDoc) const {
|
||||
|
||||
bool ContractionState::SetExpanded(int lineDoc, bool expanded) {
|
||||
if (size == 0) {
|
||||
Grow(lineDoc + growSize);
|
||||
Grow(linesInDoc + growSize);
|
||||
}
|
||||
if ((lineDoc >= 0) && (lineDoc < linesInDoc)) {
|
||||
if (lines[lineDoc].expanded != expanded) {
|
||||
@@ -201,3 +200,9 @@ bool ContractionState::SetExpanded(int lineDoc, bool expanded) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void ContractionState::ShowAll() {
|
||||
delete []lines;
|
||||
lines = 0;
|
||||
size = 0;
|
||||
}
|
||||
|
||||
@@ -42,9 +42,11 @@ public:
|
||||
|
||||
bool GetVisible(int lineDoc) const;
|
||||
bool SetVisible(int lineDocStart, int lineDocEnd, bool visible);
|
||||
|
||||
|
||||
bool GetExpanded(int lineDoc) const;
|
||||
bool SetExpanded(int lineDoc, bool expanded);
|
||||
|
||||
void ShowAll();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -32,7 +32,10 @@ Document::Document() {
|
||||
}
|
||||
endStyled = 0;
|
||||
enteredCount = 0;
|
||||
enteredReadOnlyCount = 0;
|
||||
tabInChars = 8;
|
||||
indentInChars = 0;
|
||||
useTabs = true;
|
||||
watchers = 0;
|
||||
lenWatchers = 0;
|
||||
}
|
||||
@@ -51,7 +54,7 @@ int Document::AddRef() {
|
||||
return refCount++;
|
||||
}
|
||||
|
||||
// Decrease reference count and return its provius value.
|
||||
// Decrease reference count and return its previous value.
|
||||
// Delete the document if reference count reaches zero.
|
||||
int Document::Release() {
|
||||
int curRefCount = --refCount;
|
||||
@@ -65,26 +68,54 @@ void Document::SetSavePoint() {
|
||||
NotifySavePoint(true);
|
||||
}
|
||||
|
||||
int Document::AddMark(int line, int markerNum) {
|
||||
int prev = cb.AddMark(line, markerNum);
|
||||
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0);
|
||||
NotifyModified(mh);
|
||||
return prev;
|
||||
}
|
||||
|
||||
void Document::DeleteMark(int line, int markerNum) {
|
||||
cb.DeleteMark(line, markerNum);
|
||||
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0);
|
||||
NotifyModified(mh);
|
||||
}
|
||||
|
||||
void Document::DeleteMarkFromHandle(int markerHandle) {
|
||||
cb.DeleteMarkFromHandle(markerHandle);
|
||||
DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
|
||||
NotifyModified(mh);
|
||||
}
|
||||
|
||||
void Document::DeleteAllMarks(int markerNum) {
|
||||
cb.DeleteAllMarks(markerNum);
|
||||
DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
|
||||
NotifyModified(mh);
|
||||
}
|
||||
|
||||
int Document::LineStart(int line) {
|
||||
return cb.LineStart(line);
|
||||
}
|
||||
|
||||
int Document::LineEnd(int line) {
|
||||
if (line == LinesTotal() - 1) {
|
||||
return LineStart(line + 1);
|
||||
} else {
|
||||
int position = LineStart(line + 1) - 1;
|
||||
// When line terminator is CR+LF, may need to go back one more
|
||||
if ((position > LineStart(line)) && (cb.CharAt(position - 1) == '\r')) {
|
||||
position--;
|
||||
}
|
||||
return position;
|
||||
}
|
||||
}
|
||||
|
||||
int Document::LineFromPosition(int pos) {
|
||||
return cb.LineFromPosition(pos);
|
||||
}
|
||||
|
||||
int Document::LineEndPosition(int position) {
|
||||
int line = LineFromPosition(position);
|
||||
if (line == LinesTotal() - 1) {
|
||||
position = LineStart(line + 1);
|
||||
} else {
|
||||
position = LineStart(line + 1) - 1;
|
||||
// When line terminator is CR+LF, may need to go back one more
|
||||
if ((position > LineStart(line)) && (cb.CharAt(position - 1) == '\r')) {
|
||||
position--;
|
||||
}
|
||||
}
|
||||
return position;
|
||||
return LineEnd(LineFromPosition(position));
|
||||
}
|
||||
|
||||
int Document::VCHomePosition(int position) {
|
||||
@@ -124,7 +155,10 @@ int Document::GetLastChild(int lineParent, int level) {
|
||||
level = GetLevel(lineParent) & SC_FOLDLEVELNUMBERMASK;
|
||||
int maxLine = LinesTotal();
|
||||
int lineMaxSubord = lineParent;
|
||||
while ((lineMaxSubord < maxLine-1) && IsSubordinate(level, GetLevel(lineMaxSubord+1))) {
|
||||
while (lineMaxSubord < maxLine-1) {
|
||||
EnsureStyledTo(LineStart(lineMaxSubord+2));
|
||||
if (!IsSubordinate(level, GetLevel(lineMaxSubord+1)))
|
||||
break;
|
||||
lineMaxSubord++;
|
||||
}
|
||||
if (lineMaxSubord > lineParent) {
|
||||
@@ -167,27 +201,58 @@ bool Document::IsCrLf(int pos) {
|
||||
return (cb.CharAt(pos) == '\r') && (cb.CharAt(pos + 1) == '\n');
|
||||
}
|
||||
|
||||
bool Document::IsDBCS(int pos) {
|
||||
#if PLAT_WIN
|
||||
bool Document::IsDBCS(int pos) {
|
||||
if (dbcsCodePage) {
|
||||
// Anchor DBCS calculations at start of line because start of line can
|
||||
// not be a DBCS trail byte.
|
||||
int startLine = pos;
|
||||
while (startLine > 0 && cb.CharAt(startLine) != '\r' && cb.CharAt(startLine) != '\n')
|
||||
startLine--;
|
||||
while (startLine <= pos) {
|
||||
if (IsDBCSLeadByteEx(dbcsCodePage, cb.CharAt(startLine))) {
|
||||
if (SC_CP_UTF8 == dbcsCodePage) {
|
||||
unsigned char ch = static_cast<unsigned char>(cb.CharAt(pos));
|
||||
return ch >= 0x80;
|
||||
} else {
|
||||
// Anchor DBCS calculations at start of line because start of line can
|
||||
// not be a DBCS trail byte.
|
||||
int startLine = pos;
|
||||
while (startLine > 0 && cb.CharAt(startLine) != '\r' && cb.CharAt(startLine) != '\n')
|
||||
startLine--;
|
||||
while (startLine <= pos) {
|
||||
if (IsDBCSLeadByteEx(dbcsCodePage, cb.CharAt(startLine))) {
|
||||
startLine++;
|
||||
if (startLine >= pos)
|
||||
return true;
|
||||
}
|
||||
startLine++;
|
||||
if (startLine >= pos)
|
||||
return true;
|
||||
}
|
||||
startLine++;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
// PLAT_GTK or PLAT_WX
|
||||
// TODO: support DBCS under GTK+ and WX
|
||||
bool Document::IsDBCS(int) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
int Document::LenChar(int pos) {
|
||||
if (IsCrLf(pos)) {
|
||||
return 2;
|
||||
} else if (SC_CP_UTF8 == dbcsCodePage) {
|
||||
unsigned char ch = static_cast<unsigned char>(cb.CharAt(pos));
|
||||
if (ch < 0x80)
|
||||
return 1;
|
||||
int len = 2;
|
||||
if (ch >= (0x80+0x40+0x20))
|
||||
len = 3;
|
||||
int lengthDoc = Length();
|
||||
if ((pos + len) > lengthDoc)
|
||||
return lengthDoc-pos;
|
||||
else
|
||||
return len;
|
||||
} else if (IsDBCS(pos)) {
|
||||
return 2;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Normalise a position so that it is not halfway through a two byte character.
|
||||
@@ -221,29 +286,41 @@ int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) {
|
||||
|
||||
#if PLAT_WIN
|
||||
if (dbcsCodePage) {
|
||||
// Anchor DBCS calculations at start of line because start of line can
|
||||
// not be a DBCS trail byte.
|
||||
int startLine = pos;
|
||||
while (startLine > 0 && cb.CharAt(startLine) != '\r' && cb.CharAt(startLine) != '\n')
|
||||
startLine--;
|
||||
bool atLeadByte = false;
|
||||
while (startLine < pos) {
|
||||
if (atLeadByte)
|
||||
atLeadByte = false;
|
||||
else if (IsDBCSLeadByteEx(dbcsCodePage, cb.CharAt(startLine)))
|
||||
atLeadByte = true;
|
||||
else
|
||||
atLeadByte = false;
|
||||
startLine++;
|
||||
//Platform::DebugPrintf("DBCS %s\n", atlead ? "D" : "-");
|
||||
}
|
||||
if (SC_CP_UTF8 == dbcsCodePage) {
|
||||
unsigned char ch = static_cast<unsigned char>(cb.CharAt(pos));
|
||||
while ((pos > 0) && (pos < Length()) && (ch >= 0x80) && (ch < (0x80 + 0x40))) {
|
||||
// ch is a trail byte
|
||||
if (moveDir > 0)
|
||||
pos++;
|
||||
else
|
||||
pos--;
|
||||
ch = static_cast<unsigned char>(cb.CharAt(pos));
|
||||
}
|
||||
} else {
|
||||
// Anchor DBCS calculations at start of line because start of line can
|
||||
// not be a DBCS trail byte.
|
||||
int startLine = pos;
|
||||
while (startLine > 0 && cb.CharAt(startLine) != '\r' && cb.CharAt(startLine) != '\n')
|
||||
startLine--;
|
||||
bool atLeadByte = false;
|
||||
while (startLine < pos) {
|
||||
if (atLeadByte)
|
||||
atLeadByte = false;
|
||||
else if (IsDBCSLeadByteEx(dbcsCodePage, cb.CharAt(startLine)))
|
||||
atLeadByte = true;
|
||||
else
|
||||
atLeadByte = false;
|
||||
startLine++;
|
||||
//Platform::DebugPrintf("DBCS %s\n", atlead ? "D" : "-");
|
||||
}
|
||||
|
||||
if (atLeadByte) {
|
||||
// Position is between a lead byte and a trail byte
|
||||
if (moveDir > 0)
|
||||
return pos + 1;
|
||||
else
|
||||
return pos - 1;
|
||||
if (atLeadByte) {
|
||||
// Position is between a lead byte and a trail byte
|
||||
if (moveDir > 0)
|
||||
return pos + 1;
|
||||
else
|
||||
return pos - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -261,41 +338,62 @@ void Document::ModifiedAt(int pos) {
|
||||
|
||||
// Unlike Undo, Redo, and InsertStyledString, the pos argument is a cell number not a char number
|
||||
void Document::DeleteChars(int pos, int len) {
|
||||
if ((pos + len) > Length())
|
||||
return;
|
||||
if (cb.IsReadOnly() && enteredReadOnlyCount==0) {
|
||||
enteredReadOnlyCount++;
|
||||
NotifyModifyAttempt();
|
||||
enteredReadOnlyCount--;
|
||||
}
|
||||
if (enteredCount == 0) {
|
||||
enteredCount++;
|
||||
if (cb.IsReadOnly())
|
||||
NotifyModifyAttempt();
|
||||
if (!cb.IsReadOnly()) {
|
||||
NotifyModified(
|
||||
DocModification(
|
||||
SC_MOD_BEFOREDELETE | SC_PERFORMED_USER,
|
||||
pos, len,
|
||||
0, 0));
|
||||
int prevLinesTotal = LinesTotal();
|
||||
bool startSavePoint = cb.IsSavePoint();
|
||||
const char *text = cb.DeleteChars(pos*2, len * 2);
|
||||
if (startSavePoint && cb.IsCollectingUndo())
|
||||
NotifySavePoint(!startSavePoint);
|
||||
ModifiedAt(pos);
|
||||
int modFlags = SC_MOD_DELETETEXT | SC_PERFORMED_USER;
|
||||
DocModification mh(modFlags, pos, len, LinesTotal() - prevLinesTotal, text);
|
||||
NotifyModified(mh);
|
||||
NotifyModified(
|
||||
DocModification(
|
||||
SC_MOD_DELETETEXT | SC_PERFORMED_USER,
|
||||
pos, len,
|
||||
LinesTotal() - prevLinesTotal, text));
|
||||
}
|
||||
enteredCount--;
|
||||
}
|
||||
}
|
||||
|
||||
void Document::InsertStyledString(int position, char *s, int insertLength) {
|
||||
if (cb.IsReadOnly() && enteredReadOnlyCount==0) {
|
||||
enteredReadOnlyCount++;
|
||||
NotifyModifyAttempt();
|
||||
enteredReadOnlyCount--;
|
||||
}
|
||||
if (enteredCount == 0) {
|
||||
enteredCount++;
|
||||
if (cb.IsReadOnly())
|
||||
NotifyModifyAttempt();
|
||||
if (!cb.IsReadOnly()) {
|
||||
NotifyModified(
|
||||
DocModification(
|
||||
SC_MOD_BEFOREINSERT | SC_PERFORMED_USER,
|
||||
position / 2, insertLength / 2,
|
||||
0, 0));
|
||||
int prevLinesTotal = LinesTotal();
|
||||
bool startSavePoint = cb.IsSavePoint();
|
||||
const char *text = cb.InsertString(position, s, insertLength);
|
||||
if (startSavePoint && cb.IsCollectingUndo())
|
||||
NotifySavePoint(!startSavePoint);
|
||||
ModifiedAt(position / 2);
|
||||
|
||||
int modFlags = SC_MOD_INSERTTEXT | SC_PERFORMED_USER;
|
||||
DocModification mh(modFlags, position / 2, insertLength / 2, LinesTotal() - prevLinesTotal, text);
|
||||
NotifyModified(mh);
|
||||
NotifyModified(
|
||||
DocModification(
|
||||
SC_MOD_INSERTTEXT | SC_PERFORMED_USER,
|
||||
position / 2, insertLength / 2,
|
||||
LinesTotal() - prevLinesTotal, text));
|
||||
}
|
||||
enteredCount--;
|
||||
}
|
||||
@@ -307,9 +405,18 @@ int Document::Undo() {
|
||||
enteredCount++;
|
||||
bool startSavePoint = cb.IsSavePoint();
|
||||
int steps = cb.StartUndo();
|
||||
//Platform::DebugPrintf("Steps=%d\n", steps);
|
||||
for (int step=0; step<steps; step++) {
|
||||
int prevLinesTotal = LinesTotal();
|
||||
const Action &action = cb.UndoStep();
|
||||
const Action &action = cb.GetUndoStep();
|
||||
if (action.at == removeAction) {
|
||||
NotifyModified(DocModification(
|
||||
SC_MOD_BEFOREINSERT | SC_PERFORMED_UNDO, action));
|
||||
} else {
|
||||
NotifyModified(DocModification(
|
||||
SC_MOD_BEFOREDELETE | SC_PERFORMED_UNDO, action));
|
||||
}
|
||||
cb.PerformUndoStep();
|
||||
int cellPosition = action.position / 2;
|
||||
ModifiedAt(cellPosition);
|
||||
newPos = cellPosition;
|
||||
@@ -344,10 +451,17 @@ int Document::Redo() {
|
||||
int steps = cb.StartRedo();
|
||||
for (int step=0; step<steps; step++) {
|
||||
int prevLinesTotal = LinesTotal();
|
||||
const Action &action = cb.RedoStep();
|
||||
int cellPosition = action.position / 2;
|
||||
ModifiedAt(cellPosition);
|
||||
newPos = cellPosition;
|
||||
const Action &action = cb.GetRedoStep();
|
||||
if (action.at == insertAction) {
|
||||
NotifyModified(DocModification(
|
||||
SC_MOD_BEFOREINSERT | SC_PERFORMED_REDO, action));
|
||||
} else {
|
||||
NotifyModified(DocModification(
|
||||
SC_MOD_BEFOREDELETE | SC_PERFORMED_REDO, action));
|
||||
}
|
||||
cb.PerformRedoStep();
|
||||
ModifiedAt(action.position / 2);
|
||||
newPos = action.position / 2;
|
||||
|
||||
int modFlags = SC_PERFORMED_REDO;
|
||||
if (action.at == insertAction) {
|
||||
@@ -358,7 +472,8 @@ int Document::Redo() {
|
||||
}
|
||||
if (step == steps-1)
|
||||
modFlags |= SC_LASTSTEPINUNDOREDO;
|
||||
NotifyModified(DocModification(modFlags, cellPosition, action.lenData,
|
||||
NotifyModified(
|
||||
DocModification(modFlags, action.position / 2, action.lenData,
|
||||
LinesTotal() - prevLinesTotal, action.data));
|
||||
}
|
||||
|
||||
@@ -395,14 +510,13 @@ void Document::InsertString(int position, const char *s, int insertLength) {
|
||||
}
|
||||
}
|
||||
|
||||
void Document::ChangeChar(int pos, char ch) {
|
||||
DeleteChars(pos, 1);
|
||||
InsertChar(pos, ch);
|
||||
}
|
||||
|
||||
void Document::DelChar(int pos) {
|
||||
if (IsCrLf(pos)) {
|
||||
DeleteChars(pos, 2);
|
||||
} else if (IsDBCS(pos)) {
|
||||
DeleteChars(pos, 2);
|
||||
} else if (pos < Length()) {
|
||||
DeleteChars(pos, 1);
|
||||
}
|
||||
DeleteChars(pos, LenChar(pos));
|
||||
}
|
||||
|
||||
int Document::DelCharBack(int pos) {
|
||||
@@ -411,6 +525,10 @@ int Document::DelCharBack(int pos) {
|
||||
} else if (IsCrLf(pos - 2)) {
|
||||
DeleteChars(pos - 2, 2);
|
||||
return pos - 2;
|
||||
} else if (SC_CP_UTF8 == dbcsCodePage) {
|
||||
int startChar = MovePositionOutsideChar(pos-1, -1, false);
|
||||
DeleteChars(startChar, pos - startChar);
|
||||
return startChar;
|
||||
} else if (IsDBCS(pos - 1)) {
|
||||
DeleteChars(pos - 2, 2);
|
||||
return pos - 2;
|
||||
@@ -420,27 +538,101 @@ int Document::DelCharBack(int pos) {
|
||||
}
|
||||
}
|
||||
|
||||
static bool isindentchar(char ch) {
|
||||
return (ch == ' ') || (ch == '\t');
|
||||
}
|
||||
|
||||
static int NextTab(int pos, int tabSize) {
|
||||
return ((pos / tabSize) + 1) * tabSize;
|
||||
}
|
||||
|
||||
static void CreateIndentation(char *linebuf, int length, int indent, int tabSize, bool insertSpaces) {
|
||||
length--; // ensure space for \0
|
||||
if (!insertSpaces) {
|
||||
while ((indent >= tabSize) && (length > 0)) {
|
||||
*linebuf++ = '\t';
|
||||
indent -= tabSize;
|
||||
length--;
|
||||
}
|
||||
}
|
||||
while ((indent > 0) && (length > 0)) {
|
||||
*linebuf++ = ' ';
|
||||
indent--;
|
||||
length--;
|
||||
}
|
||||
*linebuf = '\0';
|
||||
}
|
||||
|
||||
int Document::GetLineIndentation(int line) {
|
||||
int indent = 0;
|
||||
if ((line >= 0) && (line < LinesTotal())) {
|
||||
int lineStart = LineStart(line);
|
||||
int length = Length();
|
||||
for (int i=lineStart;i<length;i++) {
|
||||
char ch = cb.CharAt(i);
|
||||
if (ch == ' ')
|
||||
indent++;
|
||||
else if (ch == '\t')
|
||||
indent = NextTab(indent, tabInChars);
|
||||
else
|
||||
return indent;
|
||||
}
|
||||
}
|
||||
return indent;
|
||||
}
|
||||
|
||||
void Document::SetLineIndentation(int line, int indent) {
|
||||
int indentOfLine = GetLineIndentation(line);
|
||||
if (indent < 0)
|
||||
indent = 0;
|
||||
if (indent != indentOfLine) {
|
||||
char linebuf[1000];
|
||||
CreateIndentation(linebuf, sizeof(linebuf), indent, tabInChars, !useTabs);
|
||||
int thisLineStart = LineStart(line);
|
||||
int indentPos = GetLineIndentPosition(line);
|
||||
DeleteChars(thisLineStart, indentPos - thisLineStart);
|
||||
InsertString(thisLineStart, linebuf);
|
||||
}
|
||||
}
|
||||
|
||||
int Document::GetLineIndentPosition(int line) {
|
||||
if (line < 0)
|
||||
return 0;
|
||||
int pos = LineStart(line);
|
||||
int length = Length();
|
||||
while ((pos < length) && isindentchar(cb.CharAt(pos))) {
|
||||
pos++;
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
int Document::GetColumn(int pos) {
|
||||
int column = 0;
|
||||
int line = LineFromPosition(pos);
|
||||
if ((line >= 0) && (line < LinesTotal())) {
|
||||
for (int i=LineStart(line);i<pos;i++) {
|
||||
char ch = cb.CharAt(i);
|
||||
if (ch == '\t')
|
||||
column = NextTab(column, tabInChars);
|
||||
else if (ch == '\r')
|
||||
return column;
|
||||
else if (ch == '\n')
|
||||
return column;
|
||||
else
|
||||
column++;
|
||||
}
|
||||
}
|
||||
return column;
|
||||
}
|
||||
|
||||
void Document::Indent(bool forwards, int lineBottom, int lineTop) {
|
||||
if (forwards) {
|
||||
// Indent by a tab
|
||||
for (int line = lineBottom; line >= lineTop; line--) {
|
||||
InsertChar(LineStart(line), '\t');
|
||||
}
|
||||
} else {
|
||||
// Dedent - suck white space off the front of the line to dedent by equivalent of a tab
|
||||
for (int line = lineBottom; line >= lineTop; line--) {
|
||||
int ispc = 0;
|
||||
while (ispc < tabInChars && cb.CharAt(LineStart(line) + ispc) == ' ')
|
||||
ispc++;
|
||||
int posStartLine = LineStart(line);
|
||||
if (ispc == tabInChars) {
|
||||
DeleteChars(posStartLine, ispc);
|
||||
} else if (cb.CharAt(posStartLine + ispc) == '\t') {
|
||||
DeleteChars(posStartLine, ispc + 1);
|
||||
} else { // Hit a non-white
|
||||
DeleteChars(posStartLine, ispc);
|
||||
}
|
||||
}
|
||||
// Dedent - suck white space off the front of the line to dedent by equivalent of a tab
|
||||
for (int line = lineBottom; line >= lineTop; line--) {
|
||||
int indentOfLine = GetLineIndentation(line);
|
||||
if (forwards)
|
||||
SetLineIndentation(line, indentOfLine + IndentSize());
|
||||
else
|
||||
SetLineIndentation(line, indentOfLine - IndentSize());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -485,6 +677,8 @@ void Document::ConvertLineEnds(int eolModeSet) {
|
||||
}
|
||||
|
||||
bool Document::IsWordChar(unsigned char ch) {
|
||||
if ((SC_CP_UTF8 == dbcsCodePage) && (ch >0x80))
|
||||
return true;
|
||||
return wordchars[ch];
|
||||
}
|
||||
|
||||
@@ -523,25 +717,29 @@ int Document::NextWordStart(int pos, int delta) {
|
||||
return pos;
|
||||
}
|
||||
|
||||
bool Document::IsWordAt(int start, int end) {
|
||||
int lengthDoc = Length();
|
||||
if (start > 0) {
|
||||
char ch = CharAt(start - 1);
|
||||
if (IsWordChar(ch))
|
||||
return false;
|
||||
}
|
||||
if (end < lengthDoc - 1) {
|
||||
char ch = CharAt(end);
|
||||
if (IsWordChar(ch))
|
||||
return false;
|
||||
bool Document::IsWordStartAt(int pos) {
|
||||
if (pos > 0) {
|
||||
return !IsWordChar(CharAt(pos - 1));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Document::IsWordEndAt(int pos) {
|
||||
if (pos < Length() - 1) {
|
||||
return !IsWordChar(CharAt(pos));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Document::IsWordAt(int start, int end) {
|
||||
return IsWordStartAt(start) && IsWordEndAt(end);
|
||||
}
|
||||
|
||||
// Find text in document, supporting both forward and backward
|
||||
// searches (just pass minPos > maxPos to do a backward search)
|
||||
// Has not been tested with backwards DBCS searches yet.
|
||||
long Document::FindText(int minPos, int maxPos, const char *s, bool caseSensitive, bool word) {
|
||||
long Document::FindText(int minPos, int maxPos, const char *s,
|
||||
bool caseSensitive, bool word, bool wordStart) {
|
||||
bool forward = minPos <= maxPos;
|
||||
int increment = forward ? 1 : -1;
|
||||
|
||||
@@ -551,16 +749,14 @@ long Document::FindText(int minPos, int maxPos, const char *s, bool caseSensitiv
|
||||
|
||||
// Compute actual search ranges needed
|
||||
int lengthFind = strlen(s);
|
||||
int endSearch = 0;
|
||||
int endSearch = endPos;
|
||||
if (startPos <= endPos) {
|
||||
endSearch = endPos - lengthFind + 1;
|
||||
} else {
|
||||
endSearch = endPos;
|
||||
}
|
||||
//Platform::DebugPrintf("Find %d %d %s %d\n", startPos, endPos, ft->lpstrText, lengthFind);
|
||||
char firstChar = s[0];
|
||||
if (!caseSensitive)
|
||||
firstChar = toupper(firstChar);
|
||||
firstChar = static_cast<char>(toupper(firstChar));
|
||||
int pos = startPos;
|
||||
while (forward ? (pos < endSearch) : (pos >= endSearch)) {
|
||||
char ch = CharAt(pos);
|
||||
@@ -573,8 +769,10 @@ long Document::FindText(int minPos, int maxPos, const char *s, bool caseSensitiv
|
||||
found = false;
|
||||
}
|
||||
if (found) {
|
||||
if ((!word) || IsWordAt(pos, pos + lengthFind))
|
||||
return pos;
|
||||
if ((!word && !wordStart) ||
|
||||
word && IsWordAt(pos, pos + lengthFind) ||
|
||||
wordStart && IsWordStartAt(pos))
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -586,8 +784,10 @@ long Document::FindText(int minPos, int maxPos, const char *s, bool caseSensitiv
|
||||
found = false;
|
||||
}
|
||||
if (found) {
|
||||
if ((!word) || IsWordAt(pos, pos + lengthFind))
|
||||
return pos;
|
||||
if (!(word && wordStart) ||
|
||||
word && IsWordAt(pos, pos + lengthFind) ||
|
||||
wordStart && IsWordStartAt(pos))
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -605,6 +805,25 @@ int Document::LinesTotal() {
|
||||
return cb.Lines();
|
||||
}
|
||||
|
||||
void Document::ChangeCase(Range r, bool makeUpperCase) {
|
||||
for (int pos=r.start; pos<r.end; pos++) {
|
||||
char ch = CharAt(pos);
|
||||
if (dbcsCodePage && IsDBCS(pos)) {
|
||||
pos += LenChar(pos);
|
||||
} else {
|
||||
if (makeUpperCase) {
|
||||
if (islower(ch)) {
|
||||
ChangeChar(pos, static_cast<char>(toupper(ch)));
|
||||
}
|
||||
} else {
|
||||
if (isupper(ch)) {
|
||||
ChangeChar(pos, static_cast<char>(tolower(ch)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Document::SetWordChars(unsigned char *chars) {
|
||||
int ch;
|
||||
for (ch = 0; ch < 256; ch++) {
|
||||
@@ -671,6 +890,13 @@ void Document::SetStyles(int length, char *styles) {
|
||||
}
|
||||
}
|
||||
|
||||
bool Document::EnsureStyledTo(int pos) {
|
||||
// Ask the watchers to style, and stop as soon as one responds.
|
||||
for (int i = 0; pos > GetEndStyled() && i < lenWatchers; i++)
|
||||
watchers[i].watcher->NotifyStyleNeeded(this, watchers[i].userData, pos);
|
||||
return pos <= GetEndStyled();
|
||||
}
|
||||
|
||||
bool Document::AddWatcher(DocWatcher *watcher, void *userData) {
|
||||
for (int i = 0; i < lenWatchers; i++) {
|
||||
if ((watchers[i].watcher == watcher) &&
|
||||
|
||||
@@ -74,9 +74,10 @@ private:
|
||||
CellBuffer cb;
|
||||
bool wordchars[256];
|
||||
int stylingPos;
|
||||
int stylingMask;
|
||||
char stylingMask;
|
||||
int endStyled;
|
||||
int enteredCount;
|
||||
int enteredReadOnlyCount;
|
||||
|
||||
WatcherWithUserData *watchers;
|
||||
int lenWatchers;
|
||||
@@ -86,8 +87,11 @@ public:
|
||||
int stylingBitsMask;
|
||||
|
||||
int eolMode;
|
||||
// dbcsCodePage can also be SC_CP_UTF8 to enable UTF-8 mode
|
||||
int dbcsCodePage;
|
||||
int tabInChars;
|
||||
int indentInChars;
|
||||
bool useTabs;
|
||||
|
||||
Document();
|
||||
virtual ~Document();
|
||||
@@ -98,6 +102,7 @@ public:
|
||||
int LineFromPosition(int pos);
|
||||
int ClampPositionIntoDocument(int pos);
|
||||
bool IsCrLf(int pos);
|
||||
int LenChar(int pos);
|
||||
int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true);
|
||||
|
||||
// Gateways to modifying document
|
||||
@@ -108,21 +113,28 @@ public:
|
||||
bool CanUndo() { return cb.CanUndo(); }
|
||||
bool CanRedo() { return cb.CanRedo(); }
|
||||
void DeleteUndoHistory() { cb.DeleteUndoHistory(); }
|
||||
undoCollectionType SetUndoCollection(undoCollectionType collectUndo) {
|
||||
bool SetUndoCollection(bool collectUndo) {
|
||||
return cb.SetUndoCollection(collectUndo);
|
||||
}
|
||||
void AppendUndoStartAction() { cb.AppendUndoStartAction(); }
|
||||
bool IsCollectingUndo() { return cb.IsCollectingUndo(); }
|
||||
void BeginUndoAction() { cb.BeginUndoAction(); }
|
||||
void EndUndoAction() { cb.EndUndoAction(); }
|
||||
void SetSavePoint();
|
||||
bool IsSavePoint() { return cb.IsSavePoint(); }
|
||||
|
||||
int GetLineIndentation(int line);
|
||||
void SetLineIndentation(int line, int indent);
|
||||
int GetLineIndentPosition(int line);
|
||||
int GetColumn(int position);
|
||||
void Indent(bool forwards, int lineBottom, int lineTop);
|
||||
void ConvertLineEnds(int eolModeSet);
|
||||
void SetReadOnly(bool set) { cb.SetReadOnly(set); }
|
||||
bool IsReadOnly() { return cb.IsReadOnly(); }
|
||||
|
||||
void InsertChar(int pos, char ch);
|
||||
void InsertString(int position, const char *s);
|
||||
void InsertString(int position, const char *s, int insertLength);
|
||||
void ChangeChar(int pos, char ch);
|
||||
void DelChar(int pos);
|
||||
int DelCharBack(int pos);
|
||||
|
||||
@@ -132,17 +144,19 @@ public:
|
||||
}
|
||||
char StyleAt(int position) { return cb.StyleAt(position); }
|
||||
int GetMark(int line) { return cb.GetMark(line); }
|
||||
int AddMark(int line, int markerNum) { return cb.AddMark(line, markerNum); }
|
||||
void DeleteMark(int line, int markerNum) { cb.DeleteMark(line, markerNum); }
|
||||
void DeleteMarkFromHandle(int markerHandle) { cb.DeleteMarkFromHandle(markerHandle); }
|
||||
void DeleteAllMarks(int markerNum) { cb.DeleteAllMarks(markerNum); }
|
||||
int AddMark(int line, int markerNum);
|
||||
void DeleteMark(int line, int markerNum);
|
||||
void DeleteMarkFromHandle(int markerHandle);
|
||||
void DeleteAllMarks(int markerNum);
|
||||
int LineFromHandle(int markerHandle) { return cb.LineFromHandle(markerHandle); }
|
||||
int LineStart(int line);
|
||||
int LineEnd(int line);
|
||||
int LineEndPosition(int position);
|
||||
int VCHomePosition(int position);
|
||||
|
||||
int SetLevel(int line, int level);
|
||||
int GetLevel(int line) { return cb.GetLevel(line); }
|
||||
void ClearLevels() { cb.ClearLevels(); }
|
||||
int GetLastChild(int lineParent, int level=-1);
|
||||
int GetFoldParent(int line);
|
||||
|
||||
@@ -150,16 +164,20 @@ public:
|
||||
int ExtendWordSelect(int pos, int delta);
|
||||
int NextWordStart(int pos, int delta);
|
||||
int Length() { return cb.Length(); }
|
||||
long FindText(int minPos, int maxPos, const char *s, bool caseSensitive, bool word);
|
||||
long FindText(WORD iMessage,WPARAM wParam,LPARAM lParam);
|
||||
long FindText(int minPos, int maxPos, const char *s,
|
||||
bool caseSensitive, bool word, bool wordStart);
|
||||
long FindText(int iMessage, unsigned long wParam, long lParam);
|
||||
int LinesTotal();
|
||||
|
||||
void ChangeCase(Range r, bool makeUpperCase);
|
||||
|
||||
void SetWordChars(unsigned char *chars);
|
||||
void SetStylingBits(int bits);
|
||||
void StartStyling(int position, char mask);
|
||||
void SetStyleFor(int length, char style);
|
||||
void SetStyles(int length, char *styles);
|
||||
int GetEndStyled() { return endStyled; }
|
||||
bool EnsureStyledTo(int pos);
|
||||
|
||||
int SetLineState(int line, int state) { return cb.SetLineState(line, state); }
|
||||
int GetLineState(int line) { return cb.GetLineState(line); }
|
||||
@@ -173,12 +191,16 @@ public:
|
||||
private:
|
||||
bool IsDBCS(int pos);
|
||||
bool IsWordChar(unsigned char ch);
|
||||
bool IsWordStartAt(int pos);
|
||||
bool IsWordEndAt(int pos);
|
||||
bool IsWordAt(int start, int end);
|
||||
void ModifiedAt(int pos);
|
||||
|
||||
|
||||
void NotifyModifyAttempt();
|
||||
void NotifySavePoint(bool atSavePoint);
|
||||
void NotifyModified(DocModification mh);
|
||||
|
||||
int IndentSize() { return indentInChars ? indentInChars : tabInChars; }
|
||||
};
|
||||
|
||||
// To optimise processing of document modifications by DocWatchers, a hint is passed indicating the
|
||||
@@ -205,6 +227,16 @@ public:
|
||||
line(0),
|
||||
foldLevelNow(0),
|
||||
foldLevelPrev(0) {}
|
||||
|
||||
DocModification(int modificationType_, const Action &act, int linesAdded_=0) :
|
||||
modificationType(modificationType_),
|
||||
position(act.position / 2),
|
||||
length(act.lenData),
|
||||
linesAdded(linesAdded_),
|
||||
text(act.data),
|
||||
line(0),
|
||||
foldLevelNow(0),
|
||||
foldLevelPrev(0) {}
|
||||
};
|
||||
|
||||
// A class that wants to receive notifications from a Document must be derived from DocWatcher
|
||||
@@ -217,6 +249,7 @@ public:
|
||||
virtual void NotifySavePoint(Document *doc, void *userData, bool atSavePoint) = 0;
|
||||
virtual void NotifyModified(Document *doc, DocModification mh, void *userData) = 0;
|
||||
virtual void NotifyDeleted(Document *doc, void *userData) = 0;
|
||||
virtual void NotifyStyleNeeded(Document *doc, void *userData, int endPos) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
176
contrib/src/stc/scintilla/src/DocumentAccessor.cxx
Normal file
@@ -0,0 +1,176 @@
|
||||
// SciTE - Scintilla based Text Editor
|
||||
// Accessor.cxx - rapid easy access to contents of a Scintilla
|
||||
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "Platform.h"
|
||||
|
||||
#include "PropSet.h"
|
||||
#include "SVector.h"
|
||||
#include "Accessor.h"
|
||||
#include "DocumentAccessor.h"
|
||||
#include "CellBuffer.h"
|
||||
#include "Scintilla.h"
|
||||
#include "Document.h"
|
||||
|
||||
DocumentAccessor::~DocumentAccessor() {
|
||||
}
|
||||
|
||||
#if PLAT_WIN
|
||||
bool DocumentAccessor::InternalIsLeadByte(char ch) {
|
||||
if (SC_CP_UTF8 == codePage)
|
||||
// For lexing, all characters >= 0x80 are treated the
|
||||
// same so none is considered a lead byte.
|
||||
return false;
|
||||
else
|
||||
return IsDBCSLeadByteEx(codePage, ch);
|
||||
}
|
||||
#else
|
||||
// PLAT_GTK or PLAT_WX
|
||||
// TODO: support DBCS under GTK+ and WX
|
||||
bool DocumentAccessor::InternalIsLeadByte(char) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
void DocumentAccessor::Fill(int position) {
|
||||
if (lenDoc == -1)
|
||||
lenDoc = pdoc->Length();
|
||||
startPos = position - slopSize;
|
||||
if (startPos + bufferSize > lenDoc)
|
||||
startPos = lenDoc - bufferSize;
|
||||
if (startPos < 0)
|
||||
startPos = 0;
|
||||
endPos = startPos + bufferSize;
|
||||
if (endPos > lenDoc)
|
||||
endPos = lenDoc;
|
||||
|
||||
pdoc->GetCharRange(buf, startPos, endPos-startPos);
|
||||
buf[endPos-startPos] = '\0';
|
||||
}
|
||||
|
||||
char DocumentAccessor::StyleAt(int position) {
|
||||
return pdoc->StyleAt(position);
|
||||
}
|
||||
|
||||
int DocumentAccessor::GetLine(int position) {
|
||||
return pdoc->LineFromPosition(position);
|
||||
}
|
||||
|
||||
int DocumentAccessor::LineStart(int line) {
|
||||
return pdoc->LineStart(line);
|
||||
}
|
||||
|
||||
int DocumentAccessor::LevelAt(int line) {
|
||||
return pdoc->GetLevel(line);
|
||||
}
|
||||
|
||||
int DocumentAccessor::Length() {
|
||||
if (lenDoc == -1)
|
||||
lenDoc = pdoc->Length();
|
||||
return lenDoc;
|
||||
}
|
||||
|
||||
int DocumentAccessor::GetLineState(int line) {
|
||||
return pdoc->GetLineState(line);
|
||||
}
|
||||
|
||||
int DocumentAccessor::SetLineState(int line, int state) {
|
||||
return pdoc->SetLineState(line, state);
|
||||
}
|
||||
|
||||
void DocumentAccessor::StartAt(unsigned int start, char chMask) {
|
||||
pdoc->StartStyling(start, chMask);
|
||||
}
|
||||
|
||||
void DocumentAccessor::StartSegment(unsigned int pos) {
|
||||
startSeg = pos;
|
||||
}
|
||||
|
||||
void DocumentAccessor::ColourTo(unsigned int pos, int chAttr) {
|
||||
// Only perform styling if non empty range
|
||||
if (pos != startSeg - 1) {
|
||||
if (pos < startSeg) {
|
||||
Platform::DebugPrintf("Bad colour positions %d - %d\n", startSeg, pos);
|
||||
}
|
||||
|
||||
if (validLen + (pos - startSeg + 1) >= bufferSize)
|
||||
Flush();
|
||||
if (validLen + (pos - startSeg + 1) >= bufferSize) {
|
||||
// Too big for buffer so send directly
|
||||
pdoc->SetStyleFor(pos - startSeg + 1, static_cast<char>(chAttr));
|
||||
} else {
|
||||
if (chAttr != chWhile)
|
||||
chFlags = 0;
|
||||
chAttr |= chFlags;
|
||||
for (unsigned int i = startSeg; i <= pos; i++) {
|
||||
styleBuf[validLen++] = static_cast<char>(chAttr);
|
||||
}
|
||||
}
|
||||
}
|
||||
startSeg = pos+1;
|
||||
}
|
||||
|
||||
void DocumentAccessor::SetLevel(int line, int level) {
|
||||
pdoc->SetLevel(line, level);
|
||||
}
|
||||
|
||||
void DocumentAccessor::Flush() {
|
||||
startPos = extremePosition;
|
||||
lenDoc = -1;
|
||||
if (validLen > 0) {
|
||||
pdoc->SetStyles(validLen, styleBuf);
|
||||
validLen = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int DocumentAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) {
|
||||
int end = Length();
|
||||
int spaceFlags = 0;
|
||||
|
||||
// Determines the indentation level of the current line and also checks for consistent
|
||||
// indentation compared to the previous line.
|
||||
// Indentation is judged consistent when the indentation whitespace of each line lines
|
||||
// the same or the indentation of one line is a prefix of the other.
|
||||
|
||||
int pos = LineStart(line);
|
||||
char ch = (*this)[pos];
|
||||
int indent = 0;
|
||||
bool inPrevPrefix = line > 0;
|
||||
int posPrev = inPrevPrefix ? LineStart(line-1) : 0;
|
||||
while ((ch == ' ' || ch == '\t') && (pos < end)) {
|
||||
if (inPrevPrefix) {
|
||||
char chPrev = (*this)[posPrev++];
|
||||
if (chPrev == ' ' || chPrev == '\t') {
|
||||
if (chPrev != ch)
|
||||
spaceFlags |= wsInconsistent;
|
||||
} else {
|
||||
inPrevPrefix = false;
|
||||
}
|
||||
}
|
||||
if (ch == ' ') {
|
||||
spaceFlags |= wsSpace;
|
||||
indent++;
|
||||
} else { // Tab
|
||||
spaceFlags |= wsTab;
|
||||
if (spaceFlags & wsSpace)
|
||||
spaceFlags |= wsSpaceTab;
|
||||
indent = (indent / 8 + 1) * 8;
|
||||
}
|
||||
ch = (*this)[++pos];
|
||||
}
|
||||
|
||||
*flags = spaceFlags;
|
||||
indent += SC_FOLDLEVELBASE;
|
||||
// if completely empty line or the start of a comment...
|
||||
if (isspace(ch) || (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)) )
|
||||
return indent | SC_FOLDLEVELWHITEFLAG;
|
||||
else
|
||||
return indent;
|
||||
}
|
||||
|
||||
49
contrib/src/stc/scintilla/src/DocumentAccessor.h
Normal file
@@ -0,0 +1,49 @@
|
||||
// DocumentAccessor.h - implementation of BufferAccess and StylingAccess on a Scintilla rapid easy access to contents of a Scintilla
|
||||
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
class Document;
|
||||
|
||||
class DocumentAccessor : public Accessor {
|
||||
// Private so DocumentAccessor objects can not be copied
|
||||
DocumentAccessor(const DocumentAccessor &source) : Accessor(), props(source.props) {}
|
||||
DocumentAccessor &operator=(const DocumentAccessor &) { return *this; }
|
||||
protected:
|
||||
Document *pdoc;
|
||||
PropSet &props;
|
||||
int lenDoc;
|
||||
|
||||
char styleBuf[bufferSize];
|
||||
int validLen;
|
||||
char chFlags;
|
||||
char chWhile;
|
||||
unsigned int startSeg;
|
||||
|
||||
bool InternalIsLeadByte(char ch);
|
||||
void Fill(int position);
|
||||
public:
|
||||
DocumentAccessor(Document *pdoc_, PropSet &props_) :
|
||||
Accessor(), pdoc(pdoc_), props(props_),
|
||||
lenDoc(-1), validLen(0), chFlags(0), chWhile(0) {
|
||||
}
|
||||
~DocumentAccessor();
|
||||
char StyleAt(int position);
|
||||
int GetLine(int position);
|
||||
int LineStart(int line);
|
||||
int LevelAt(int line);
|
||||
int Length();
|
||||
void Flush();
|
||||
int GetLineState(int line);
|
||||
int SetLineState(int line, int state);
|
||||
int GetPropertyInt(const char *key, int defaultValue=0) {
|
||||
return props.GetInt(key, defaultValue);
|
||||
}
|
||||
|
||||
void StartAt(unsigned int start, char chMask=31);
|
||||
void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; };
|
||||
unsigned int GetStartSegment() { return startSeg; }
|
||||
void StartSegment(unsigned int pos);
|
||||
void ColourTo(unsigned int pos, int chAttr);
|
||||
void SetLevel(int line, int level);
|
||||
int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0);
|
||||
};
|
||||
@@ -31,13 +31,21 @@ public:
|
||||
// Drawing is only performed for maxLineLength characters on each line.
|
||||
enum {maxLineLength = 4000};
|
||||
int numCharsInLine;
|
||||
char chars[maxLineLength];
|
||||
char styles[maxLineLength];
|
||||
char indicators[maxLineLength];
|
||||
int positions[maxLineLength];
|
||||
int xHighlightGuide;
|
||||
bool highlightColumn;
|
||||
int selStart;
|
||||
int selEnd;
|
||||
int edgeColumn;
|
||||
char chars[maxLineLength+1];
|
||||
char styles[maxLineLength+1];
|
||||
char indicators[maxLineLength+1];
|
||||
int positions[maxLineLength+1];
|
||||
};
|
||||
|
||||
class Editor : public DocWatcher {
|
||||
// Private so Editor objects can not be copied
|
||||
Editor(const Editor &) : DocWatcher() {}
|
||||
Editor &operator=(const Editor &) { return *this; }
|
||||
protected: // ScintillaBase subclass needs access to much of Editor
|
||||
|
||||
// On GTK+, Scintilla is a container widget holding two scroll bars and a drawing area
|
||||
@@ -51,6 +59,8 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
bool stylesValid;
|
||||
ViewStyle vs;
|
||||
Palette palette;
|
||||
int printMagnification;
|
||||
int printColourMode;
|
||||
|
||||
bool hideSelection;
|
||||
bool inOverstrike;
|
||||
@@ -61,13 +71,16 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
|
||||
int xOffset; // Horizontal scrolled amount in pixels
|
||||
int xCaretMargin; // Ensure this many pixels visible on both sides of caret
|
||||
bool horizontalScrollBarVisible;
|
||||
|
||||
Surface pixmapLine;
|
||||
Surface pixmapSelMargin;
|
||||
Surface pixmapSelPattern;
|
||||
Surface pixmapIndentGuide;
|
||||
Surface pixmapIndentGuideHighlight;
|
||||
// Intellimouse support - currently only implemented for Windows
|
||||
unsigned int ucWheelScrollLines;
|
||||
short cWheelDelta; //wheel delta from roll
|
||||
int cWheelDelta; //wheel delta from roll
|
||||
|
||||
KeyMap kmap;
|
||||
|
||||
@@ -94,8 +107,8 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
bool needUpdateUI;
|
||||
Position braces[2];
|
||||
int bracesMatchStyle;
|
||||
int highlightGuideColumn;
|
||||
|
||||
int edgeState;
|
||||
int theEdge;
|
||||
|
||||
enum { notPainting, painting, paintAbandoned } paintState;
|
||||
@@ -110,12 +123,15 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
enum { selStream, selRectangle, selRectangleFixed } selType;
|
||||
int xStartSelect;
|
||||
int xEndSelect;
|
||||
bool primarySelection;
|
||||
|
||||
int caretPolicy;
|
||||
int caretSlop;
|
||||
|
||||
int searchAnchor;
|
||||
|
||||
int displayPopupMenu;
|
||||
|
||||
#ifdef MACRO_SUPPORT
|
||||
int recordingMacro;
|
||||
#endif
|
||||
@@ -162,6 +178,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
void SetSelection(int currentPos_, int anchor_);
|
||||
void SetSelection(int currentPos_);
|
||||
void SetEmptySelection(int currentPos_);
|
||||
int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true);
|
||||
int MovePositionTo(int newPos, bool extend = false);
|
||||
int MovePositionSoVisible(int pos, int moveDir);
|
||||
void SetLastXChosen();
|
||||
@@ -169,6 +186,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
void ScrollTo(int line);
|
||||
virtual void ScrollText(int linesToMove);
|
||||
void HorizontalScrollTo(int xPos);
|
||||
void MoveCaretInsideView();
|
||||
void EnsureCaretVisible(bool useMargin=true);
|
||||
void ShowCaretAtCurrentPosition();
|
||||
void DropCaret();
|
||||
@@ -176,20 +194,23 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
|
||||
void PaintSelMargin(Surface *surface, PRectangle &rc);
|
||||
void LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout &ll);
|
||||
void DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int xStart,
|
||||
void DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart,
|
||||
PRectangle rcLine, LineLayout &ll);
|
||||
void Paint(Surface *surfaceWindow, PRectangle rcArea);
|
||||
long FormatRange(bool draw, FORMATRANGE *pfr);
|
||||
long FormatRange(bool draw, RangeToFormat *pfr);
|
||||
|
||||
virtual void SetVerticalScrollPos() = 0;
|
||||
virtual void SetHorizontalScrollPos() = 0;
|
||||
virtual bool ModifyScrollBars(int nMax, int nPage) = 0;
|
||||
virtual void ReconfigureScrollBars();
|
||||
void SetScrollBarsTo(PRectangle rsClient);
|
||||
void SetScrollBars();
|
||||
|
||||
virtual void AddChar(char ch);
|
||||
void AddChar(char ch);
|
||||
virtual void AddCharUTF(char *s, unsigned int len);
|
||||
void ClearSelection();
|
||||
void ClearAll();
|
||||
void ClearDocumentStyle();
|
||||
void Cut();
|
||||
void PasteRectangular(int pos, const char *ptr, int len);
|
||||
virtual void Copy() = 0;
|
||||
@@ -205,8 +226,9 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
virtual void NotifyChange() = 0;
|
||||
virtual void NotifyFocus(bool focus);
|
||||
virtual void NotifyParent(SCNotification scn) = 0;
|
||||
virtual void NotifyStyleNeeded(int endStyleNeeded);
|
||||
virtual void NotifyStyleToNeeded(int endStyleNeeded);
|
||||
void NotifyChar(char ch);
|
||||
void NotifyMove(int position);
|
||||
void NotifySavePoint(bool isSavePoint);
|
||||
void NotifyModifyAttempt();
|
||||
virtual void NotifyDoubleClick(Point pt, bool shift);
|
||||
@@ -218,24 +240,29 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
void NotifySavePoint(Document *document, void *userData, bool atSavePoint);
|
||||
void NotifyModified(Document *document, DocModification mh, void *userData);
|
||||
void NotifyDeleted(Document *document, void *userData);
|
||||
void NotifyStyleNeeded(Document *doc, void *userData, int endPos);
|
||||
|
||||
|
||||
#ifdef MACRO_SUPPORT
|
||||
void NotifyMacroRecord(UINT iMessage, WPARAM wParam, LPARAM lParam);
|
||||
void NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long lParam);
|
||||
#endif
|
||||
|
||||
void PageMove(int direction, bool extend=false);
|
||||
virtual int KeyCommand(UINT iMessage);
|
||||
void ChangeCaseOfSelection(bool makeUpperCase);
|
||||
void LineTranspose();
|
||||
virtual void CancelModes();
|
||||
virtual int KeyCommand(unsigned int iMessage);
|
||||
virtual int KeyDefault(int /* key */, int /*modifiers*/);
|
||||
int KeyDown(int key, bool shift, bool ctrl, bool alt);
|
||||
|
||||
bool GetWhitespaceVisible();
|
||||
void SetWhitespaceVisible(bool view);
|
||||
int GetWhitespaceVisible();
|
||||
void SetWhitespaceVisible(int view);
|
||||
|
||||
void Indent(bool forwards);
|
||||
|
||||
long FindText(UINT iMessage,WPARAM wParam,LPARAM lParam);
|
||||
long FindText(unsigned int iMessage, unsigned long wParam, long lParam);
|
||||
void SearchAnchor();
|
||||
long SearchText(UINT iMessage,WPARAM wParam,LPARAM lParam);
|
||||
long SearchText(unsigned int iMessage, unsigned long wParam, long lParam);
|
||||
void GoToLine(int lineNo);
|
||||
|
||||
char *CopyRange(int start, int end);
|
||||
@@ -269,11 +296,11 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
void ToggleContraction(int line);
|
||||
void EnsureLineVisible(int line);
|
||||
|
||||
virtual LRESULT DefWndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) = 0;
|
||||
virtual long DefWndProc(unsigned int iMessage, unsigned long wParam, long lParam) = 0;
|
||||
|
||||
public:
|
||||
// Public so scintilla_send_message can use it
|
||||
virtual LRESULT WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam);
|
||||
virtual long WndProc(unsigned int iMessage, unsigned long wParam, long lParam);
|
||||
// Public so scintilla_set_id can use it
|
||||
int ctrlID;
|
||||
};
|
||||
|
||||
@@ -37,6 +37,22 @@ void Indicator::Draw(Surface *surface, PRectangle &rc) {
|
||||
surface->MoveTo(x-3, ymid);
|
||||
surface->LineTo(x-3, ymid+2);
|
||||
}
|
||||
} else if (style == INDIC_DIAGONAL) {
|
||||
int x = rc.left;
|
||||
while (x < rc.right) {
|
||||
surface->MoveTo(x, rc.top+2);
|
||||
int endX = x+3;
|
||||
int endY = rc.top - 1;
|
||||
if (endX > rc.right) {
|
||||
endY += endX - rc.right;
|
||||
endX = rc.right;
|
||||
}
|
||||
surface->LineTo(endX, endY);
|
||||
x += 4;
|
||||
}
|
||||
} else if (style == INDIC_STRIKE) {
|
||||
surface->MoveTo(rc.left, rc.top - 4);
|
||||
surface->LineTo(rc.right, rc.top - 4);
|
||||
} else { // Either INDIC_PLAIN or unknown
|
||||
surface->MoveTo(rc.left, ymid);
|
||||
surface->LineTo(rc.right, ymid);
|
||||
|
||||
@@ -28,7 +28,7 @@ void KeyMap::Clear() {
|
||||
alloc = 0;
|
||||
}
|
||||
|
||||
void KeyMap::AssignCmdKey(int key, int modifiers, UINT msg) {
|
||||
void KeyMap::AssignCmdKey(int key, int modifiers, unsigned int msg) {
|
||||
if ((len+1) >= alloc) {
|
||||
KeyToCommand *ktcNew = new KeyToCommand[alloc + 5];
|
||||
if (!ktcNew)
|
||||
@@ -51,7 +51,7 @@ void KeyMap::AssignCmdKey(int key, int modifiers, UINT msg) {
|
||||
len++;
|
||||
}
|
||||
|
||||
UINT KeyMap::Find(int key, int modifiers) {
|
||||
unsigned int KeyMap::Find(int key, int modifiers) {
|
||||
for (int i=0; i < len; i++) {
|
||||
if ((key == kmap[i].key) && (modifiers == kmap[i].modifiers)) {
|
||||
return kmap[i].msg;
|
||||
@@ -61,51 +61,61 @@ UINT KeyMap::Find(int key, int modifiers) {
|
||||
}
|
||||
|
||||
KeyToCommand KeyMap::MapDefault[] = {
|
||||
VK_DOWN, SCI_NORM, SCI_LINEDOWN,
|
||||
VK_DOWN, SCI_SHIFT, SCI_LINEDOWNEXTEND,
|
||||
VK_UP, SCI_NORM, SCI_LINEUP,
|
||||
VK_UP, SCI_SHIFT, SCI_LINEUPEXTEND,
|
||||
VK_LEFT, SCI_NORM, SCI_CHARLEFT,
|
||||
VK_LEFT, SCI_SHIFT, SCI_CHARLEFTEXTEND,
|
||||
VK_LEFT, SCI_CTRL, SCI_WORDLEFT,
|
||||
VK_LEFT, SCI_CSHIFT, SCI_WORDLEFTEXTEND,
|
||||
VK_RIGHT, SCI_NORM, SCI_CHARRIGHT,
|
||||
VK_RIGHT, SCI_SHIFT, SCI_CHARRIGHTEXTEND,
|
||||
VK_RIGHT, SCI_CTRL, SCI_WORDRIGHT,
|
||||
VK_RIGHT, SCI_CSHIFT, SCI_WORDRIGHTEXTEND,
|
||||
VK_HOME, SCI_NORM, SCI_VCHOME,
|
||||
VK_HOME, SCI_SHIFT, SCI_VCHOMEEXTEND,
|
||||
VK_HOME, SCI_CTRL, SCI_DOCUMENTSTART,
|
||||
VK_HOME, SCI_CSHIFT, SCI_DOCUMENTSTARTEXTEND,
|
||||
VK_END, SCI_NORM, SCI_LINEEND,
|
||||
VK_END, SCI_SHIFT, SCI_LINEENDEXTEND,
|
||||
VK_END, SCI_CTRL, SCI_DOCUMENTEND,
|
||||
VK_END, SCI_CSHIFT, SCI_DOCUMENTENDEXTEND,
|
||||
VK_PRIOR, SCI_NORM, SCI_PAGEUP,
|
||||
VK_PRIOR, SCI_SHIFT, SCI_PAGEUPEXTEND,
|
||||
VK_NEXT, SCI_NORM, SCI_PAGEDOWN,
|
||||
VK_NEXT, SCI_SHIFT, SCI_PAGEDOWNEXTEND,
|
||||
VK_DELETE, SCI_NORM, WM_CLEAR,
|
||||
VK_DELETE, SCI_SHIFT, WM_CUT,
|
||||
VK_DELETE, SCI_CTRL, SCI_DELWORDRIGHT,
|
||||
VK_INSERT, SCI_NORM, SCI_EDITTOGGLEOVERTYPE,
|
||||
VK_INSERT, SCI_SHIFT, WM_PASTE,
|
||||
VK_INSERT, SCI_CTRL, WM_COPY,
|
||||
VK_ESCAPE, SCI_NORM, SCI_CANCEL,
|
||||
VK_BACK, SCI_NORM, SCI_DELETEBACK,
|
||||
VK_BACK, SCI_CTRL, SCI_DELWORDLEFT,
|
||||
'Z', SCI_CTRL, WM_UNDO,
|
||||
'Y', SCI_CTRL, SCI_REDO,
|
||||
'X', SCI_CTRL, WM_CUT,
|
||||
'C', SCI_CTRL, WM_COPY,
|
||||
'V', SCI_CTRL, WM_PASTE,
|
||||
'A', SCI_CTRL, SCI_SELECTALL,
|
||||
VK_TAB, SCI_NORM, SCI_TAB,
|
||||
VK_TAB, SCI_SHIFT, SCI_BACKTAB,
|
||||
VK_RETURN, SCI_NORM, SCI_NEWLINE,
|
||||
'L', SCI_CTRL, SCI_FORMFEED,
|
||||
VK_ADD, SCI_CTRL, SCI_ZOOMIN,
|
||||
VK_SUBTRACT, SCI_CTRL, SCI_ZOOMOUT,
|
||||
0,0,0,
|
||||
{SCK_DOWN, SCI_NORM, SCI_LINEDOWN},
|
||||
{SCK_DOWN, SCI_SHIFT, SCI_LINEDOWNEXTEND},
|
||||
{SCK_DOWN, SCI_CTRL, SCI_LINESCROLLDOWN},
|
||||
{SCK_UP, SCI_NORM, SCI_LINEUP},
|
||||
{SCK_UP, SCI_SHIFT, SCI_LINEUPEXTEND},
|
||||
{SCK_UP, SCI_CTRL, SCI_LINESCROLLUP},
|
||||
{SCK_LEFT, SCI_NORM, SCI_CHARLEFT},
|
||||
{SCK_LEFT, SCI_SHIFT, SCI_CHARLEFTEXTEND},
|
||||
{SCK_LEFT, SCI_CTRL, SCI_WORDLEFT},
|
||||
{SCK_LEFT, SCI_CSHIFT, SCI_WORDLEFTEXTEND},
|
||||
{SCK_RIGHT, SCI_NORM, SCI_CHARRIGHT},
|
||||
{SCK_RIGHT, SCI_SHIFT, SCI_CHARRIGHTEXTEND},
|
||||
{SCK_RIGHT, SCI_CTRL, SCI_WORDRIGHT},
|
||||
{SCK_RIGHT, SCI_CSHIFT, SCI_WORDRIGHTEXTEND},
|
||||
{SCK_HOME, SCI_NORM, SCI_VCHOME},
|
||||
{SCK_HOME, SCI_SHIFT, SCI_VCHOMEEXTEND},
|
||||
{SCK_HOME, SCI_CTRL, SCI_DOCUMENTSTART},
|
||||
{SCK_HOME, SCI_CSHIFT, SCI_DOCUMENTSTARTEXTEND},
|
||||
{SCK_END, SCI_NORM, SCI_LINEEND},
|
||||
{SCK_END, SCI_SHIFT, SCI_LINEENDEXTEND},
|
||||
{SCK_END, SCI_CTRL, SCI_DOCUMENTEND},
|
||||
{SCK_END, SCI_CSHIFT, SCI_DOCUMENTENDEXTEND},
|
||||
{SCK_PRIOR, SCI_NORM, SCI_PAGEUP},
|
||||
{SCK_PRIOR, SCI_SHIFT, SCI_PAGEUPEXTEND},
|
||||
{SCK_NEXT, SCI_NORM, SCI_PAGEDOWN},
|
||||
{SCK_NEXT, SCI_SHIFT, SCI_PAGEDOWNEXTEND},
|
||||
{SCK_DELETE, SCI_NORM, SCI_CLEAR},
|
||||
{SCK_DELETE, SCI_SHIFT, SCI_CUT},
|
||||
{SCK_DELETE, SCI_CTRL, SCI_DELWORDRIGHT},
|
||||
{SCK_INSERT, SCI_NORM, SCI_EDITTOGGLEOVERTYPE},
|
||||
{SCK_INSERT, SCI_SHIFT, SCI_PASTE},
|
||||
{SCK_INSERT, SCI_CTRL, SCI_COPY},
|
||||
{SCK_ESCAPE, SCI_NORM, SCI_CANCEL},
|
||||
{SCK_BACK, SCI_NORM, SCI_DELETEBACK},
|
||||
{SCK_BACK, SCI_SHIFT, SCI_DELETEBACK},
|
||||
{SCK_BACK, SCI_CTRL, SCI_DELWORDLEFT},
|
||||
{SCK_BACK, SCI_ALT, SCI_UNDO},
|
||||
{'Z', SCI_CTRL, SCI_UNDO},
|
||||
{'Y', SCI_CTRL, SCI_REDO},
|
||||
{'X', SCI_CTRL, SCI_CUT},
|
||||
{'C', SCI_CTRL, SCI_COPY},
|
||||
{'V', SCI_CTRL, SCI_PASTE},
|
||||
{'A', SCI_CTRL, SCI_SELECTALL},
|
||||
{SCK_TAB, SCI_NORM, SCI_TAB},
|
||||
{SCK_TAB, SCI_SHIFT, SCI_BACKTAB},
|
||||
{SCK_RETURN, SCI_NORM, SCI_NEWLINE},
|
||||
{SCK_ADD, SCI_CTRL, SCI_ZOOMIN},
|
||||
{SCK_SUBTRACT, SCI_CTRL, SCI_ZOOMOUT},
|
||||
{SCK_DIVIDE, SCI_CTRL, SCI_SETZOOM},
|
||||
//'L', SCI_CTRL, SCI_FORMFEED,
|
||||
{'L', SCI_CTRL, SCI_LINECUT},
|
||||
{'L', SCI_CSHIFT, SCI_LINEDELETE},
|
||||
{'T', SCI_CTRL, SCI_LINETRANSPOSE},
|
||||
{'U', SCI_CTRL, SCI_LOWERCASE},
|
||||
{'U', SCI_CSHIFT, SCI_UPPERCASE},
|
||||
{0,0,0},
|
||||
};
|
||||
|
||||
|
||||
@@ -7,16 +7,17 @@
|
||||
#define KEYTOCOMMAND_H
|
||||
|
||||
#define SCI_NORM 0
|
||||
#define SCI_SHIFT SHIFT_PRESSED
|
||||
#define SCI_CTRL LEFT_CTRL_PRESSED
|
||||
#define SCI_ALT LEFT_ALT_PRESSED
|
||||
#define SCI_SHIFT SCMOD_SHIFT
|
||||
#define SCI_CTRL SCMOD_CTRL
|
||||
#define SCI_ALT SCMOD_ALT
|
||||
#define SCI_CSHIFT (SCI_CTRL | SCI_SHIFT)
|
||||
#define SCI_ASHIFT (SCI_ALT | SCI_SHIFT)
|
||||
|
||||
class KeyToCommand {
|
||||
public:
|
||||
int key;
|
||||
int modifiers;
|
||||
UINT msg;
|
||||
unsigned int msg;
|
||||
};
|
||||
|
||||
class KeyMap {
|
||||
@@ -28,8 +29,8 @@ public:
|
||||
KeyMap();
|
||||
~KeyMap();
|
||||
void Clear();
|
||||
void AssignCmdKey(int key, int modifiers, UINT msg);
|
||||
UINT Find(int key, int modifiers); // 0 returned on failure
|
||||
void AssignCmdKey(int key, int modifiers, unsigned int msg);
|
||||
unsigned int Find(int key, int modifiers); // 0 returned on failure
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
262
contrib/src/stc/scintilla/src/LexCPP.cxx
Normal file
@@ -0,0 +1,262 @@
|
||||
// SciTE - Scintilla based Text Editor
|
||||
// LexCPP.cxx - lexer for C++, C, Java, and Javascript
|
||||
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "Platform.h"
|
||||
|
||||
#include "PropSet.h"
|
||||
#include "Accessor.h"
|
||||
#include "KeyWords.h"
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
static bool classifyWordCpp(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
|
||||
char s[100];
|
||||
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
|
||||
s[i] = styler[start + i];
|
||||
s[i + 1] = '\0';
|
||||
}
|
||||
bool wordIsUUID = false;
|
||||
char chAttr = SCE_C_IDENTIFIER;
|
||||
if (isdigit(s[0]) || (s[0] == '.'))
|
||||
chAttr = SCE_C_NUMBER;
|
||||
else {
|
||||
if (keywords.InList(s)) {
|
||||
chAttr = SCE_C_WORD;
|
||||
wordIsUUID = strcmp(s, "uuid") == 0;
|
||||
}
|
||||
}
|
||||
styler.ColourTo(end, chAttr);
|
||||
return wordIsUUID;
|
||||
}
|
||||
|
||||
static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
|
||||
WordList &keywords = *keywordlists[0];
|
||||
|
||||
styler.StartAt(startPos);
|
||||
|
||||
bool fold = styler.GetPropertyInt("fold");
|
||||
bool stylingWithinPreprocessor = styler.GetPropertyInt("styling.within.preprocessor");
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||
int levelCurrent = levelPrev;
|
||||
|
||||
int state = initStyle;
|
||||
if (state == SCE_C_STRINGEOL) // Does not leak onto next line
|
||||
state = SCE_C_DEFAULT;
|
||||
char chPrev = ' ';
|
||||
char chNext = styler[startPos];
|
||||
unsigned int lengthDoc = startPos + length;
|
||||
int visibleChars = 0;
|
||||
styler.StartSegment(startPos);
|
||||
bool lastWordWasUUID = false;
|
||||
for (unsigned int i = startPos; i < lengthDoc; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
|
||||
if ((ch == '\r' && chNext != '\n') || (ch == '\n')) {
|
||||
// Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
|
||||
// Avoid triggering two times on Dos/Win
|
||||
// End of line
|
||||
if (state == SCE_C_STRINGEOL) {
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_C_DEFAULT;
|
||||
}
|
||||
if (fold) {
|
||||
int lev = levelPrev;
|
||||
if (visibleChars == 0)
|
||||
lev |= SC_FOLDLEVELWHITEFLAG;
|
||||
if ((levelCurrent > levelPrev) && (visibleChars > 0))
|
||||
lev |= SC_FOLDLEVELHEADERFLAG;
|
||||
styler.SetLevel(lineCurrent, lev);
|
||||
lineCurrent++;
|
||||
levelPrev = levelCurrent;
|
||||
}
|
||||
visibleChars = 0;
|
||||
}
|
||||
if (!isspace(ch))
|
||||
visibleChars++;
|
||||
|
||||
if (styler.IsLeadByte(ch)) {
|
||||
chNext = styler.SafeGetCharAt(i + 2);
|
||||
chPrev = ' ';
|
||||
i += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (state == SCE_C_DEFAULT) {
|
||||
if (ch == '@' && chNext == '\"') {
|
||||
styler.ColourTo(i-1, state);
|
||||
state = SCE_C_VERBATIM;
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
} else if (iswordstart(ch) || (ch == '@')) {
|
||||
styler.ColourTo(i-1, state);
|
||||
if (lastWordWasUUID) {
|
||||
state = SCE_C_UUID;
|
||||
lastWordWasUUID = false;
|
||||
} else {
|
||||
state = SCE_C_IDENTIFIER;
|
||||
}
|
||||
} else if (ch == '/' && chNext == '*') {
|
||||
styler.ColourTo(i-1, state);
|
||||
if (styler.SafeGetCharAt(i + 2) == '*')
|
||||
state = SCE_C_COMMENTDOC;
|
||||
else
|
||||
state = SCE_C_COMMENT;
|
||||
} else if (ch == '/' && chNext == '/') {
|
||||
styler.ColourTo(i-1, state);
|
||||
state = SCE_C_COMMENTLINE;
|
||||
} else if (ch == '\"') {
|
||||
styler.ColourTo(i-1, state);
|
||||
state = SCE_C_STRING;
|
||||
} else if (ch == '\'') {
|
||||
styler.ColourTo(i-1, state);
|
||||
state = SCE_C_CHARACTER;
|
||||
} else if (ch == '#' && visibleChars == 1) {
|
||||
// Preprocessor commands are alone on their line
|
||||
styler.ColourTo(i-1, state);
|
||||
state = SCE_C_PREPROCESSOR;
|
||||
// Skip whitespace between # and preprocessor word
|
||||
do {
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
} while (isspace(ch) && (i < lengthDoc));
|
||||
} else if (isoperator(ch)) {
|
||||
styler.ColourTo(i-1, state);
|
||||
styler.ColourTo(i, SCE_C_OPERATOR);
|
||||
if ((ch == '{') || (ch == '}')) {
|
||||
levelCurrent += (ch == '{') ? 1 : -1;
|
||||
}
|
||||
}
|
||||
} else if (state == SCE_C_IDENTIFIER) {
|
||||
if (!iswordchar(ch)) {
|
||||
lastWordWasUUID = classifyWordCpp(styler.GetStartSegment(), i - 1, keywords, styler);
|
||||
state = SCE_C_DEFAULT;
|
||||
if (ch == '/' && chNext == '*') {
|
||||
if (styler.SafeGetCharAt(i + 2) == '*')
|
||||
state = SCE_C_COMMENTDOC;
|
||||
else
|
||||
state = SCE_C_COMMENT;
|
||||
} else if (ch == '/' && chNext == '/') {
|
||||
state = SCE_C_COMMENTLINE;
|
||||
} else if (ch == '\"') {
|
||||
state = SCE_C_STRING;
|
||||
} else if (ch == '\'') {
|
||||
state = SCE_C_CHARACTER;
|
||||
} else if (isoperator(ch)) {
|
||||
styler.ColourTo(i, SCE_C_OPERATOR);
|
||||
if ((ch == '{') || (ch == '}')) {
|
||||
levelCurrent += (ch == '{') ? 1 : -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (state == SCE_C_PREPROCESSOR) {
|
||||
if (stylingWithinPreprocessor) {
|
||||
if (isspace(ch)) {
|
||||
styler.ColourTo(i-1, state);
|
||||
state = SCE_C_DEFAULT;
|
||||
}
|
||||
} else {
|
||||
if ((ch == '\r' || ch == '\n') && !(chPrev == '\\' || chPrev == '\r')) {
|
||||
styler.ColourTo(i-1, state);
|
||||
state = SCE_C_DEFAULT;
|
||||
}
|
||||
}
|
||||
} else if (state == SCE_C_COMMENT) {
|
||||
if (ch == '/' && chPrev == '*') {
|
||||
if (((i > styler.GetStartSegment() + 2) || (
|
||||
(initStyle == SCE_C_COMMENT) &&
|
||||
(styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) {
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_C_DEFAULT;
|
||||
}
|
||||
}
|
||||
} else if (state == SCE_C_COMMENTDOC) {
|
||||
if (ch == '/' && chPrev == '*') {
|
||||
if (((i > styler.GetStartSegment() + 2) || (
|
||||
(initStyle == SCE_C_COMMENTDOC) &&
|
||||
(styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) {
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_C_DEFAULT;
|
||||
}
|
||||
}
|
||||
} else if (state == SCE_C_COMMENTLINE) {
|
||||
if (ch == '\r' || ch == '\n') {
|
||||
styler.ColourTo(i-1, state);
|
||||
state = SCE_C_DEFAULT;
|
||||
}
|
||||
} else if (state == SCE_C_STRING) {
|
||||
if (ch == '\\') {
|
||||
if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
} else if (ch == '\"') {
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_C_DEFAULT;
|
||||
} else if (chNext == '\r' || chNext == '\n') {
|
||||
styler.ColourTo(i-1, SCE_C_STRINGEOL);
|
||||
state = SCE_C_STRINGEOL;
|
||||
}
|
||||
} else if (state == SCE_C_CHARACTER) {
|
||||
if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
|
||||
styler.ColourTo(i-1, SCE_C_STRINGEOL);
|
||||
state = SCE_C_STRINGEOL;
|
||||
} else if (ch == '\\') {
|
||||
if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
} else if (ch == '\'') {
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_C_DEFAULT;
|
||||
}
|
||||
} else if (state == SCE_C_VERBATIM) {
|
||||
if (ch == '\"') {
|
||||
if (chNext == '\"') {
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
} else {
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_C_DEFAULT;
|
||||
}
|
||||
}
|
||||
} else if (state == SCE_C_UUID) {
|
||||
if (ch == '\r' || ch == '\n' || ch == ')') {
|
||||
styler.ColourTo(i-1, state);
|
||||
if (ch == ')')
|
||||
styler.ColourTo(i, SCE_C_OPERATOR);
|
||||
state = SCE_C_DEFAULT;
|
||||
}
|
||||
}
|
||||
}
|
||||
chPrev = ch;
|
||||
}
|
||||
styler.ColourTo(lengthDoc - 1, state);
|
||||
|
||||
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
|
||||
if (fold) {
|
||||
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
|
||||
//styler.SetLevel(lineCurrent, levelCurrent | flagsNext);
|
||||
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
LexerModule lmCPP(SCLEX_CPP, ColouriseCppDoc);
|
||||
1151
contrib/src/stc/scintilla/src/LexHTML.cxx
Normal file
298
contrib/src/stc/scintilla/src/LexLua.cxx
Normal file
@@ -0,0 +1,298 @@
|
||||
// LexLua.cxx - lexer for Lua language
|
||||
// Written by Paul Winwood
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "Platform.h"
|
||||
|
||||
#include "PropSet.h"
|
||||
#include "Accessor.h"
|
||||
#include "KeyWords.h"
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
static void classifyWordLua(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler)
|
||||
{
|
||||
char s[100];
|
||||
bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.');
|
||||
|
||||
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++)
|
||||
{
|
||||
s[i] = styler[start + i];
|
||||
s[i + 1] = '\0';
|
||||
}
|
||||
|
||||
char chAttr = SCE_LUA_IDENTIFIER;
|
||||
|
||||
if (wordIsNumber)
|
||||
chAttr = SCE_LUA_NUMBER;
|
||||
else
|
||||
{
|
||||
if (keywords.InList(s))
|
||||
{
|
||||
chAttr = SCE_LUA_WORD;
|
||||
}
|
||||
}
|
||||
styler.ColourTo(end, chAttr);
|
||||
}
|
||||
|
||||
static void ColouriseLuaDoc(unsigned int startPos,
|
||||
int length,
|
||||
int initStyle,
|
||||
WordList *keywordlists[],
|
||||
Accessor &styler)
|
||||
{
|
||||
|
||||
WordList &keywords = *keywordlists[0];
|
||||
|
||||
styler.StartAt(startPos);
|
||||
styler.GetLine(startPos);
|
||||
|
||||
int state = initStyle;
|
||||
char chPrev = ' ';
|
||||
char chNext = styler[startPos];
|
||||
unsigned int lengthDoc = startPos + length;
|
||||
bool firstChar = true;
|
||||
int literalString = 0;
|
||||
|
||||
styler.StartSegment(startPos);
|
||||
for (unsigned int i = startPos; i <= lengthDoc; i++)
|
||||
{
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
|
||||
if (styler.IsLeadByte(ch))
|
||||
{
|
||||
chNext = styler.SafeGetCharAt(i + 2);
|
||||
chPrev = ' ';
|
||||
i += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (state == SCE_LUA_STRINGEOL)
|
||||
{
|
||||
if (ch != '\r' && ch != '\n')
|
||||
{
|
||||
styler.ColourTo(i-1, state);
|
||||
state = SCE_LUA_DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
if (state == SCE_LUA_LITERALSTRING && ch == '[' && chNext == '[')
|
||||
{
|
||||
literalString++;
|
||||
}
|
||||
else
|
||||
if (state == SCE_LUA_DEFAULT)
|
||||
{
|
||||
if (ch == '-' && chNext == '-')
|
||||
{
|
||||
styler.ColourTo(i-1, state);
|
||||
state = SCE_LUA_COMMENTLINE;
|
||||
}
|
||||
else
|
||||
if (ch == '[' && chNext == '[')
|
||||
{
|
||||
state = SCE_LUA_LITERALSTRING;
|
||||
literalString = 1;
|
||||
}
|
||||
else
|
||||
if (iswordstart(ch))
|
||||
{
|
||||
styler.ColourTo(i-1, state);
|
||||
state = SCE_LUA_WORD;
|
||||
}
|
||||
else
|
||||
if (ch == '\"')
|
||||
{
|
||||
styler.ColourTo(i-1, state);
|
||||
state = SCE_LUA_STRING;
|
||||
}
|
||||
else
|
||||
if (ch == '\'')
|
||||
{
|
||||
styler.ColourTo(i-1, state);
|
||||
state = SCE_LUA_CHARACTER;
|
||||
}
|
||||
else
|
||||
if (ch == '$' && firstChar)
|
||||
{
|
||||
styler.ColourTo(i-1, state);
|
||||
state = SCE_LUA_PREPROCESSOR;
|
||||
}
|
||||
else
|
||||
if (isoperator(ch))
|
||||
{
|
||||
styler.ColourTo(i-1, state);
|
||||
styler.ColourTo(i, SCE_LUA_OPERATOR);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (state == SCE_LUA_WORD)
|
||||
{
|
||||
if (!iswordchar(ch))
|
||||
{
|
||||
classifyWordLua(styler.GetStartSegment(), i - 1, keywords, styler);
|
||||
state = SCE_LUA_DEFAULT;
|
||||
if (ch == '[' && chNext == '[')
|
||||
{
|
||||
literalString = 1;
|
||||
state = SCE_LUA_LITERALSTRING;
|
||||
}
|
||||
else
|
||||
if (ch == '-' && chNext == '-')
|
||||
{
|
||||
state = SCE_LUA_COMMENTLINE;
|
||||
}
|
||||
else
|
||||
if (ch == '\"')
|
||||
{
|
||||
state = SCE_LUA_STRING;
|
||||
}
|
||||
else
|
||||
if (ch == '\'')
|
||||
{
|
||||
state = SCE_LUA_CHARACTER;
|
||||
}
|
||||
else
|
||||
if (ch == '$' && firstChar)
|
||||
{
|
||||
state = SCE_LUA_PREPROCESSOR;
|
||||
}
|
||||
else
|
||||
if (isoperator(ch))
|
||||
{
|
||||
styler.ColourTo(i, SCE_LUA_OPERATOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (state == SCE_LUA_LITERALSTRING)
|
||||
{
|
||||
if (ch == ']' && (chPrev == ']') && (--literalString == 0))
|
||||
{
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_LUA_DEFAULT;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (state == SCE_LUA_PREPROCESSOR)
|
||||
{
|
||||
if ((ch == '\r' || ch == '\n') && (chPrev != '\\'))
|
||||
{
|
||||
styler.ColourTo(i-1, state);
|
||||
state = SCE_LUA_DEFAULT;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (state == SCE_LUA_COMMENTLINE)
|
||||
{
|
||||
if (ch == '\r' || ch == '\n')
|
||||
{
|
||||
styler.ColourTo(i-1, state);
|
||||
state = SCE_LUA_DEFAULT;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (state == SCE_LUA_STRING)
|
||||
{
|
||||
if ((ch == '\r' || ch == '\n') && (chPrev != '\\'))
|
||||
{
|
||||
styler.ColourTo(i-1, state);
|
||||
state = SCE_LUA_STRINGEOL;
|
||||
}
|
||||
else
|
||||
if (ch == '\\')
|
||||
{
|
||||
if (chNext == '\"' || chNext == '\\')
|
||||
{
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (ch == '\"')
|
||||
{
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_LUA_DEFAULT;
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (state == SCE_LUA_CHARACTER)
|
||||
{
|
||||
if ((ch == '\r' || ch == '\n') && (chPrev != '\\'))
|
||||
{
|
||||
styler.ColourTo(i-1, state);
|
||||
state = SCE_LUA_STRINGEOL;
|
||||
}
|
||||
else
|
||||
if (ch == '\\')
|
||||
{
|
||||
if (chNext == '\'' || chNext == '\\')
|
||||
{
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (ch == '\'')
|
||||
{
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_LUA_DEFAULT;
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (state == SCE_LUA_DEFAULT)
|
||||
{
|
||||
if (ch == '-' && chNext == '-')
|
||||
{
|
||||
state = SCE_LUA_COMMENTLINE;
|
||||
}
|
||||
else
|
||||
if (ch == '\"')
|
||||
{
|
||||
state = SCE_LUA_STRING;
|
||||
}
|
||||
else
|
||||
if (ch == '\'')
|
||||
{
|
||||
state = SCE_LUA_CHARACTER;
|
||||
}
|
||||
else
|
||||
if (ch == '$' && firstChar)
|
||||
{
|
||||
state = SCE_LUA_PREPROCESSOR;
|
||||
}
|
||||
else
|
||||
if (iswordstart(ch))
|
||||
{
|
||||
state = SCE_LUA_WORD;
|
||||
}
|
||||
else
|
||||
if (isoperator(ch))
|
||||
{
|
||||
styler.ColourTo(i, SCE_LUA_OPERATOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
chPrev = ch;
|
||||
firstChar = (ch == '\r' || ch == '\n');
|
||||
}
|
||||
styler.ColourTo(lengthDoc - 1, state);
|
||||
}
|
||||
|
||||
LexerModule lmLua(SCLEX_LUA, ColouriseLuaDoc);
|
||||
351
contrib/src/stc/scintilla/src/LexOthers.cxx
Normal file
@@ -0,0 +1,351 @@
|
||||
// SciTE - Scintilla based Text Editor
|
||||
// LexOthers.cxx - lexers for properties files, batch files, make files and error lists
|
||||
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "Platform.h"
|
||||
|
||||
#include "PropSet.h"
|
||||
#include "Accessor.h"
|
||||
#include "KeyWords.h"
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
static void ColouriseBatchLine(char *lineBuffer, int endLine, Accessor &styler) {
|
||||
if (0 == strncmp(lineBuffer, "REM", 3)) {
|
||||
styler.ColourTo(endLine, 1);
|
||||
} else if (0 == strncmp(lineBuffer, "rem", 3)) {
|
||||
styler.ColourTo(endLine, 1);
|
||||
} else if (0 == strncmp(lineBuffer, "SET", 3)) {
|
||||
styler.ColourTo(endLine, 2);
|
||||
} else if (0 == strncmp(lineBuffer, "set", 3)) {
|
||||
styler.ColourTo(endLine, 2);
|
||||
} else if (lineBuffer[0] == ':') {
|
||||
styler.ColourTo(endLine, 3);
|
||||
} else {
|
||||
styler.ColourTo(endLine, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void ColouriseBatchDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
|
||||
char lineBuffer[1024];
|
||||
styler.StartAt(startPos);
|
||||
styler.StartSegment(startPos);
|
||||
unsigned int linePos = 0;
|
||||
for (unsigned int i = startPos; i < startPos + length; i++) {
|
||||
lineBuffer[linePos++] = styler[i];
|
||||
if (styler[i] == '\r' || styler[i] == '\n' || (linePos >= sizeof(lineBuffer) - 1)) {
|
||||
ColouriseBatchLine(lineBuffer, i, styler);
|
||||
linePos = 0;
|
||||
}
|
||||
}
|
||||
if (linePos > 0)
|
||||
ColouriseBatchLine(lineBuffer, startPos + length, styler);
|
||||
}
|
||||
|
||||
static void ColouriseDiffLine(char *lineBuffer, int endLine, Accessor &styler) {
|
||||
// It is needed to remember the current state to recognize starting
|
||||
// comment lines before the first "diff " or "--- ". If a real
|
||||
// difference starts then each line starting with ' ' is a whitespace
|
||||
// otherwise it is considered a comment (Only in..., Binary file...)
|
||||
if (0 == strncmp(lineBuffer, "diff ", 3)) {
|
||||
styler.ColourTo(endLine, 2);
|
||||
} else if (0 == strncmp(lineBuffer, "--- ", 3)) {
|
||||
styler.ColourTo(endLine, 3);
|
||||
} else if (0 == strncmp(lineBuffer, "+++ ", 3)) {
|
||||
styler.ColourTo(endLine, 3);
|
||||
} else if (lineBuffer[0] == '@') {
|
||||
styler.ColourTo(endLine, 4);
|
||||
} else if (lineBuffer[0] == '-') {
|
||||
styler.ColourTo(endLine, 5);
|
||||
} else if (lineBuffer[0] == '+') {
|
||||
styler.ColourTo(endLine, 6);
|
||||
} else if (lineBuffer[0] != ' ') {
|
||||
styler.ColourTo(endLine, 1);
|
||||
} else {
|
||||
styler.ColourTo(endLine, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void ColouriseDiffDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
|
||||
char lineBuffer[1024];
|
||||
styler.StartAt(startPos);
|
||||
styler.StartSegment(startPos);
|
||||
unsigned int linePos = 0;
|
||||
for (unsigned int i = startPos; i < startPos + length; i++) {
|
||||
lineBuffer[linePos++] = styler[i];
|
||||
if (styler[i] == '\r' || styler[i] == '\n' || (linePos >= sizeof(lineBuffer) - 1)) {
|
||||
ColouriseDiffLine(lineBuffer, i, styler);
|
||||
linePos = 0;
|
||||
}
|
||||
}
|
||||
if (linePos > 0)
|
||||
ColouriseDiffLine(lineBuffer, startPos + length, styler);
|
||||
}
|
||||
|
||||
static void ColourisePropsLine(char *lineBuffer, int lengthLine, int startLine, int endPos, Accessor &styler) {
|
||||
int i = 0;
|
||||
while (isspace(lineBuffer[i]) && (i < lengthLine)) // Skip initial spaces
|
||||
i++;
|
||||
if (lineBuffer[i] == '#' || lineBuffer[i] == '!' || lineBuffer[i] == ';') {
|
||||
styler.ColourTo(endPos, 1);
|
||||
} else if (lineBuffer[i] == '[') {
|
||||
styler.ColourTo(endPos, 2);
|
||||
} else if (lineBuffer[i] == '@') {
|
||||
styler.ColourTo(startLine+i, 4);
|
||||
if (lineBuffer[++i] == '=')
|
||||
styler.ColourTo(startLine+i, 3);
|
||||
styler.ColourTo(endPos, 0);
|
||||
} else {
|
||||
while (lineBuffer[i] != '=' && (i < lengthLine)) // Search the '=' character
|
||||
i++;
|
||||
if (lineBuffer[i] == '=') {
|
||||
styler.ColourTo(startLine+i-1, 0);
|
||||
styler.ColourTo(startLine+i, 3);
|
||||
styler.ColourTo(endPos, 0);
|
||||
} else {
|
||||
styler.ColourTo(endPos, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ColourisePropsDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
|
||||
char lineBuffer[1024];
|
||||
styler.StartAt(startPos);
|
||||
styler.StartSegment(startPos);
|
||||
unsigned int linePos = 0;
|
||||
int startLine = startPos;
|
||||
for (unsigned int i = startPos; i <= startPos + length; i++) {
|
||||
lineBuffer[linePos++] = styler[i];
|
||||
if ((styler[i] == '\r' && styler.SafeGetCharAt(i+1) != '\n') ||
|
||||
styler[i] == '\n' ||
|
||||
(linePos >= sizeof(lineBuffer) - 1)) {
|
||||
lineBuffer[linePos] = '\0';
|
||||
ColourisePropsLine(lineBuffer, linePos, startLine, i, styler);
|
||||
linePos = 0;
|
||||
startLine = i+1;
|
||||
}
|
||||
}
|
||||
if (linePos > 0)
|
||||
ColourisePropsLine(lineBuffer, linePos, startLine, startPos + length, styler);
|
||||
}
|
||||
|
||||
static void ColouriseMakeLine(char *lineBuffer, int lengthLine, int endPos, Accessor &styler) {
|
||||
int i = 0;
|
||||
while (isspace(lineBuffer[i]) && (i < lengthLine))
|
||||
i++;
|
||||
if (lineBuffer[i] == '#' || lineBuffer[i] == '!') {
|
||||
styler.ColourTo(endPos, 1);
|
||||
} else {
|
||||
styler.ColourTo(endPos, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void ColouriseMakeDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
|
||||
char lineBuffer[1024];
|
||||
styler.StartAt(startPos);
|
||||
styler.StartSegment(startPos);
|
||||
unsigned int linePos = 0;
|
||||
for (unsigned int i = startPos; i <= startPos + length; i++) {
|
||||
lineBuffer[linePos++] = styler[i];
|
||||
if (styler[i] == '\r' || styler[i] == '\n' || (linePos >= sizeof(lineBuffer) - 1)) {
|
||||
ColouriseMakeLine(lineBuffer, linePos, i, styler);
|
||||
linePos = 0;
|
||||
}
|
||||
}
|
||||
if (linePos > 0)
|
||||
ColouriseMakeLine(lineBuffer, linePos, startPos + length, styler);
|
||||
}
|
||||
|
||||
static void ColouriseErrorListLine(char *lineBuffer, int lengthLine, int endPos, Accessor &styler) {
|
||||
if (lineBuffer[0] == '>') {
|
||||
// Command or return status
|
||||
styler.ColourTo(endPos, SCE_ERR_CMD);
|
||||
} else if (strstr(lineBuffer, "File \"") && strstr(lineBuffer, ", line ")) {
|
||||
styler.ColourTo(endPos, SCE_ERR_PYTHON);
|
||||
} else if (0 == strncmp(lineBuffer, "Error ", strlen("Error "))) {
|
||||
// Borland error message
|
||||
styler.ColourTo(endPos, SCE_ERR_BORLAND);
|
||||
} else if (0 == strncmp(lineBuffer, "Warning ", strlen("Warning "))) {
|
||||
// Borland warning message
|
||||
styler.ColourTo(endPos, SCE_ERR_BORLAND);
|
||||
} else if (strstr(lineBuffer, " at " ) &&
|
||||
strstr(lineBuffer, " at " ) < lineBuffer+lengthLine &&
|
||||
strstr(lineBuffer, " line ") &&
|
||||
strstr(lineBuffer, " line ") < lineBuffer+lengthLine) {
|
||||
// perl error message
|
||||
styler.ColourTo(endPos, SCE_ERR_PERL);
|
||||
} else {
|
||||
// Look for <filename>:<line>:message
|
||||
// Look for <filename>(line)message
|
||||
// Look for <filename>(line,pos)message
|
||||
int state = 0;
|
||||
for (int i = 0; i < lengthLine; i++) {
|
||||
if (state == 0 && lineBuffer[i] == ':' && isdigit(lineBuffer[i + 1])) {
|
||||
state = 1;
|
||||
} else if (state == 0 && lineBuffer[i] == '(') {
|
||||
state = 10;
|
||||
} else if (state == 1 && isdigit(lineBuffer[i])) {
|
||||
state = 2;
|
||||
} else if (state == 2 && lineBuffer[i] == ':') {
|
||||
state = 3;
|
||||
break;
|
||||
} else if (state == 2 && !isdigit(lineBuffer[i])) {
|
||||
state = 99;
|
||||
} else if (state == 10 && isdigit(lineBuffer[i])) {
|
||||
state = 11;
|
||||
} else if (state == 11 && lineBuffer[i] == ',') {
|
||||
state = 14;
|
||||
} else if (state == 11 && lineBuffer[i] == ')') {
|
||||
state = 12;
|
||||
} else if (state == 12 && lineBuffer[i] == ':') {
|
||||
state = 13;
|
||||
} else if (state == 14 && lineBuffer[i] == ')') {
|
||||
state = 15;
|
||||
break;
|
||||
} else if (((state == 11) || (state == 14)) && !((lineBuffer[i] == ' ') || isdigit(lineBuffer[i]))) {
|
||||
state = 99;
|
||||
}
|
||||
}
|
||||
if (state == 3) {
|
||||
styler.ColourTo(endPos, SCE_ERR_GCC);
|
||||
} else if ((state == 13) || (state == 14) || (state == 15)) {
|
||||
styler.ColourTo(endPos, SCE_ERR_MS);
|
||||
} else {
|
||||
styler.ColourTo(endPos, SCE_ERR_DEFAULT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ColouriseErrorListDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
|
||||
char lineBuffer[1024];
|
||||
styler.StartAt(startPos);
|
||||
styler.StartSegment(startPos);
|
||||
unsigned int linePos = 0;
|
||||
for (unsigned int i = startPos; i <= startPos + length; i++) {
|
||||
lineBuffer[linePos++] = styler[i];
|
||||
if (styler[i] == '\r' || styler[i] == '\n' || (linePos >= sizeof(lineBuffer) - 1)) {
|
||||
ColouriseErrorListLine(lineBuffer, linePos, i, styler);
|
||||
linePos = 0;
|
||||
}
|
||||
}
|
||||
if (linePos > 0)
|
||||
ColouriseErrorListLine(lineBuffer, linePos, startPos + length, styler);
|
||||
}
|
||||
|
||||
static int isSpecial(char s) {
|
||||
|
||||
return (s == '\\') || (s == ',') || (s == ';') || (s == '\'') || (s == ' ') ||
|
||||
(s == '\"') || (s == '`') || (s == '^') || (s == '~');
|
||||
}
|
||||
|
||||
static int isTag(int start, Accessor &styler) {
|
||||
|
||||
char s[6];
|
||||
unsigned int i = 0, e=1;
|
||||
while (i < 5 && e) {
|
||||
s[i] = styler[start + i];
|
||||
i++;
|
||||
e = styler[start + i] != '{';
|
||||
}
|
||||
s[i] = '\0';
|
||||
return (strcmp(s, "begin") == 0) || (strcmp(s, "end") == 0);
|
||||
}
|
||||
|
||||
static void ColouriseLatexDoc(unsigned int startPos, int length, int initStyle,
|
||||
WordList *[], Accessor &styler) {
|
||||
|
||||
styler.StartAt(startPos);
|
||||
|
||||
int state = initStyle;
|
||||
char chNext = styler[startPos];
|
||||
styler.StartSegment(startPos);
|
||||
int lengthDoc = startPos + length;
|
||||
|
||||
for (int i = startPos; i < lengthDoc; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
|
||||
if (styler.IsLeadByte(ch)) {
|
||||
chNext = styler.SafeGetCharAt(i + 2);
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
switch(state) {
|
||||
case SCE_L_DEFAULT :
|
||||
switch(ch) {
|
||||
case '\\' :
|
||||
styler.ColourTo(i - 1, state);
|
||||
if (isSpecial(styler[i + 1])) {
|
||||
styler.ColourTo(i + 1, SCE_L_COMMAND);
|
||||
i++;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
else {
|
||||
if (isTag(i+1, styler))
|
||||
state = SCE_L_TAG;
|
||||
else
|
||||
state = SCE_L_COMMAND;
|
||||
}
|
||||
break;
|
||||
case '$' :
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_L_MATH;
|
||||
if (chNext == '$') {
|
||||
i++;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
break;
|
||||
case '%' :
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_L_COMMENT;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case SCE_L_COMMAND :
|
||||
if (chNext == '[' || chNext == '{' || chNext == '}' ||
|
||||
chNext == ' ' || chNext == '\r' || chNext == '\n') {
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_L_DEFAULT;
|
||||
i++;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
break;
|
||||
case SCE_L_TAG :
|
||||
if (ch == '}') {
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_L_DEFAULT;
|
||||
}
|
||||
break;
|
||||
case SCE_L_MATH :
|
||||
if (ch == '$') {
|
||||
if (chNext == '$') {
|
||||
i++;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_L_DEFAULT;
|
||||
}
|
||||
break;
|
||||
case SCE_L_COMMENT :
|
||||
if (ch == '\r' || ch == '\n') {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_L_DEFAULT;
|
||||
}
|
||||
}
|
||||
}
|
||||
styler.ColourTo(lengthDoc, state);
|
||||
}
|
||||
|
||||
LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc);
|
||||
LexerModule lmDiff(SCLEX_DIFF, ColouriseDiffDoc);
|
||||
LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc);
|
||||
LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc);
|
||||
LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc);
|
||||
LexerModule lmLatex(SCLEX_LATEX, ColouriseLatexDoc);
|
||||
508
contrib/src/stc/scintilla/src/LexPerl.cxx
Normal file
@@ -0,0 +1,508 @@
|
||||
// SciTE - Scintilla based Text Editor
|
||||
// LexPerl.cxx - lexer for subset of Perl
|
||||
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "Platform.h"
|
||||
|
||||
#include "PropSet.h"
|
||||
#include "Accessor.h"
|
||||
#include "KeyWords.h"
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
inline bool isPerlOperator(char ch) {
|
||||
if (isalnum(ch))
|
||||
return false;
|
||||
// '.' left out as it is used to make up numbers
|
||||
if (ch == '%' || ch == '^' || ch == '&' || ch == '*' || ch == '\\' ||
|
||||
ch == '(' || ch == ')' || ch == '-' || ch == '+' ||
|
||||
ch == '=' || ch == '|' || ch == '{' || ch == '}' ||
|
||||
ch == '[' || ch == ']' || ch == ':' || ch == ';' ||
|
||||
ch == '<' || ch == '>' || ch == ',' || ch == '/' ||
|
||||
ch == '?' || ch == '!' || ch == '.' || ch == '~')
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static int classifyWordPerl(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
|
||||
char s[100];
|
||||
bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.');
|
||||
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
|
||||
s[i] = styler[start + i];
|
||||
s[i + 1] = '\0';
|
||||
}
|
||||
char chAttr = SCE_PL_IDENTIFIER;
|
||||
if (wordIsNumber)
|
||||
chAttr = SCE_PL_NUMBER;
|
||||
else {
|
||||
if (keywords.InList(s))
|
||||
chAttr = SCE_PL_WORD;
|
||||
}
|
||||
styler.ColourTo(end, chAttr);
|
||||
return chAttr;
|
||||
}
|
||||
|
||||
static bool isEndVar(char ch) {
|
||||
return !isalnum(ch) && ch != '#' && ch != '$' &&
|
||||
ch != '_' && ch != '\'';
|
||||
}
|
||||
|
||||
static bool isMatch(Accessor &styler, int lengthDoc, int pos, const char *val) {
|
||||
if ((pos + static_cast<int>(strlen(val))) >= lengthDoc) {
|
||||
return false;
|
||||
}
|
||||
while (*val) {
|
||||
if (*val != styler[pos++]) {
|
||||
return false;
|
||||
}
|
||||
val++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static char opposite(char ch) {
|
||||
if (ch == '(')
|
||||
return ')';
|
||||
if (ch == '[')
|
||||
return ']';
|
||||
if (ch == '{')
|
||||
return '}';
|
||||
if (ch == '<')
|
||||
return '>';
|
||||
return ch;
|
||||
}
|
||||
|
||||
static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler) {
|
||||
|
||||
// Lexer for perl often has to backtrack to start of current style to determine
|
||||
// which characters are being used as quotes, how deeply nested is the
|
||||
// start position and what the termination string is for here documents
|
||||
|
||||
WordList &keywords = *keywordlists[0];
|
||||
|
||||
char sooked[100];
|
||||
int quotes = 0;
|
||||
char quoteDown = 'd';
|
||||
char quoteUp = 'd';
|
||||
int quoteRep = 1;
|
||||
int sookedpos = 0;
|
||||
bool preferRE = true;
|
||||
sooked[sookedpos] = '\0';
|
||||
int state = initStyle;
|
||||
int lengthDoc = startPos + length;
|
||||
// If in a long distance lexical state, seek to the beginning to find quote characters
|
||||
if (state == SCE_PL_HERE || state == SCE_PL_REGEX ||
|
||||
state == SCE_PL_REGSUBST || state == SCE_PL_LONGQUOTE) {
|
||||
while ((startPos > 1) && (styler.StyleAt(startPos - 1) == state)) {
|
||||
startPos--;
|
||||
}
|
||||
state = SCE_PL_DEFAULT;
|
||||
}
|
||||
styler.StartAt(startPos);
|
||||
char chPrev = styler.SafeGetCharAt(startPos - 1);
|
||||
char chNext = styler[startPos];
|
||||
styler.StartSegment(startPos);
|
||||
for (int i = startPos; i < lengthDoc; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
char chNext2 = styler.SafeGetCharAt(i + 2);
|
||||
|
||||
if (styler.IsLeadByte(ch)) {
|
||||
chNext = styler.SafeGetCharAt(i + 2);
|
||||
chPrev = ' ';
|
||||
i += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (state == SCE_PL_DEFAULT) {
|
||||
if (iswordstart(ch)) {
|
||||
styler.ColourTo(i - 1, state);
|
||||
if (ch == 's' && !isalnum(chNext)) {
|
||||
state = SCE_PL_REGSUBST;
|
||||
quotes = 0;
|
||||
quoteUp = '\0';
|
||||
quoteDown = '\0';
|
||||
quoteRep = 2;
|
||||
} else if (ch == 'm' && !isalnum(chNext)) {
|
||||
state = SCE_PL_REGEX;
|
||||
quotes = 0;
|
||||
quoteUp = '\0';
|
||||
quoteDown = '\0';
|
||||
quoteRep = 1;
|
||||
} else if (ch == 't' && chNext == 'r' && !isalnum(chNext2)) {
|
||||
state = SCE_PL_REGSUBST;
|
||||
quotes = 0;
|
||||
quoteUp = '\0';
|
||||
quoteDown = '\0';
|
||||
quoteRep = 2;
|
||||
i++;
|
||||
chNext = chNext2;
|
||||
} else if (ch == 'q' && (chNext == 'q' || chNext == 'r' || chNext == 'w' || chNext == 'x') && !isalnum(chNext2)) {
|
||||
state = SCE_PL_LONGQUOTE;
|
||||
i++;
|
||||
chNext = chNext2;
|
||||
quotes = 0;
|
||||
quoteUp = '\0';
|
||||
quoteDown = '\0';
|
||||
quoteRep = 1;
|
||||
} else {
|
||||
state = SCE_PL_WORD;
|
||||
preferRE = false;
|
||||
}
|
||||
} else if (ch == '#') {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_PL_COMMENTLINE;
|
||||
} else if (ch == '\"') {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_PL_STRING;
|
||||
} else if (ch == '\'') {
|
||||
if (chPrev == '&') {
|
||||
// Archaic call
|
||||
styler.ColourTo(i, state);
|
||||
} else {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_PL_CHARACTER;
|
||||
}
|
||||
} else if (ch == '`') {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_PL_BACKTICKS;
|
||||
} else if (ch == '$') {
|
||||
preferRE = false;
|
||||
styler.ColourTo(i - 1, state);
|
||||
if (isalnum(chNext) || chNext == '#' || chNext == '$' || chNext == '_') {
|
||||
state = SCE_PL_SCALAR;
|
||||
} else if (chNext != '{' && chNext != '[') {
|
||||
styler.ColourTo(i, SCE_PL_SCALAR);
|
||||
i++;
|
||||
ch = ' ';
|
||||
chNext = ' ';
|
||||
} else {
|
||||
styler.ColourTo(i, SCE_PL_SCALAR);
|
||||
}
|
||||
} else if (ch == '@') {
|
||||
preferRE = false;
|
||||
styler.ColourTo(i - 1, state);
|
||||
if (isalpha(chNext) || chNext == '#' || chNext == '$' || chNext == '_') {
|
||||
state = SCE_PL_ARRAY;
|
||||
} else if (chNext != '{' && chNext != '[') {
|
||||
styler.ColourTo(i, SCE_PL_ARRAY);
|
||||
i++;
|
||||
ch = ' ';
|
||||
} else {
|
||||
styler.ColourTo(i, SCE_PL_ARRAY);
|
||||
}
|
||||
} else if (ch == '%') {
|
||||
preferRE = false;
|
||||
styler.ColourTo(i - 1, state);
|
||||
if (isalpha(chNext) || chNext == '#' || chNext == '$' || chNext == '_') {
|
||||
state = SCE_PL_HASH;
|
||||
} else if (chNext != '{' && chNext != '[') {
|
||||
styler.ColourTo(i, SCE_PL_HASH);
|
||||
i++;
|
||||
ch = ' ';
|
||||
} else {
|
||||
styler.ColourTo(i, SCE_PL_HASH);
|
||||
}
|
||||
} else if (ch == '*') {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_PL_SYMBOLTABLE;
|
||||
} else if (ch == '/' && preferRE) {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_PL_REGEX;
|
||||
quoteUp = '/';
|
||||
quoteDown = '/';
|
||||
quotes = 1;
|
||||
quoteRep = 1;
|
||||
} else if (ch == '<' && chNext == '<') {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_PL_HERE;
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = chNext2;
|
||||
quotes = 0;
|
||||
sookedpos = 0;
|
||||
sooked[sookedpos] = '\0';
|
||||
} else if (ch == '=' && (chPrev == '\r' || chPrev == '\n') && isalpha(chNext)) {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_PL_POD;
|
||||
quotes = 0;
|
||||
sookedpos = 0;
|
||||
sooked[sookedpos] = '\0';
|
||||
} else if (isPerlOperator(ch)) {
|
||||
if (ch == ')' || ch == ']')
|
||||
preferRE = false;
|
||||
else
|
||||
preferRE = true;
|
||||
styler.ColourTo(i - 1, state);
|
||||
styler.ColourTo(i, SCE_PL_OPERATOR);
|
||||
}
|
||||
} else if (state == SCE_PL_WORD) {
|
||||
if (!iswordchar(ch) && ch != '\'') { // Archaic Perl has quotes inside names
|
||||
if (isMatch(styler, lengthDoc, styler.GetStartSegment(), "__DATA__")) {
|
||||
styler.ColourTo(i, SCE_PL_DATASECTION);
|
||||
state = SCE_PL_DATASECTION;
|
||||
} else if (isMatch(styler, lengthDoc, styler.GetStartSegment(), "__END__")) {
|
||||
styler.ColourTo(i, SCE_PL_DATASECTION);
|
||||
state = SCE_PL_DATASECTION;
|
||||
} else {
|
||||
if (classifyWordPerl(styler.GetStartSegment(), i - 1, keywords, styler) == SCE_PL_WORD)
|
||||
preferRE = true;
|
||||
state = SCE_PL_DEFAULT;
|
||||
if (ch == '#') {
|
||||
state = SCE_PL_COMMENTLINE;
|
||||
} else if (ch == '\"') {
|
||||
state = SCE_PL_STRING;
|
||||
} else if (ch == '\'') {
|
||||
state = SCE_PL_CHARACTER;
|
||||
} else if (ch == '<' && chNext == '<') {
|
||||
state = SCE_PL_HERE;
|
||||
quotes = 0;
|
||||
sookedpos = 0;
|
||||
sooked[sookedpos] = '\0';
|
||||
} else if (isPerlOperator(ch)) {
|
||||
if (ch == ')' || ch == ']')
|
||||
preferRE = false;
|
||||
else
|
||||
preferRE = true;
|
||||
styler.ColourTo(i, SCE_PL_OPERATOR);
|
||||
state = SCE_PL_DEFAULT;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (state == SCE_PL_COMMENTLINE) {
|
||||
if (ch == '\r' || ch == '\n') {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_PL_DEFAULT;
|
||||
}
|
||||
} else if (state == SCE_PL_HERE) {
|
||||
if ((isalnum(ch) || ch == '_') && quotes < 2) {
|
||||
sooked[sookedpos++] = ch;
|
||||
sooked[sookedpos] = '\0';
|
||||
if (quotes == 0)
|
||||
quotes = 1;
|
||||
} else {
|
||||
quotes++;
|
||||
}
|
||||
if ((quotes > 1) &&
|
||||
(chPrev == '\n' || chPrev == '\r') &&
|
||||
isMatch(styler, lengthDoc, i, sooked)) {
|
||||
i += sookedpos;
|
||||
chNext = styler.SafeGetCharAt(i);
|
||||
if (chNext == '\n' || chNext == '\r') {
|
||||
styler.ColourTo(i - 1, SCE_PL_HERE);
|
||||
state = SCE_PL_DEFAULT;
|
||||
}
|
||||
ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
} else if (state == SCE_PL_STRING) {
|
||||
if (ch == '\\') {
|
||||
if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
} else if (ch == '\"') {
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_PL_DEFAULT;
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
} else if (state == SCE_PL_CHARACTER) {
|
||||
if (ch == '\\') {
|
||||
if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
} else if (ch == '\'') {
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_PL_DEFAULT;
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
} else if (state == SCE_PL_BACKTICKS) {
|
||||
if (ch == '`') {
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_PL_DEFAULT;
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
} else if (state == SCE_PL_POD) {
|
||||
if (ch == '=' && (chPrev == '\r' || chPrev == '\n')) {
|
||||
if (isMatch(styler, lengthDoc, i, "=cut")) {
|
||||
styler.ColourTo(i - 1 + 4, state);
|
||||
i += 4;
|
||||
state = SCE_PL_DEFAULT;
|
||||
ch = styler.SafeGetCharAt(i);
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
}
|
||||
} else if (state == SCE_PL_SCALAR) {
|
||||
if (isEndVar(ch)) {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_PL_DEFAULT;
|
||||
}
|
||||
} else if (state == SCE_PL_ARRAY) {
|
||||
if (isEndVar(ch)) {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_PL_DEFAULT;
|
||||
}
|
||||
} else if (state == SCE_PL_HASH) {
|
||||
if (isEndVar(ch)) {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_PL_DEFAULT;
|
||||
}
|
||||
} else if (state == SCE_PL_SYMBOLTABLE) {
|
||||
if (isEndVar(ch)) {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_PL_DEFAULT;
|
||||
}
|
||||
} else if (state == SCE_PL_REF) {
|
||||
if (isEndVar(ch)) {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_PL_DEFAULT;
|
||||
}
|
||||
} else if (state == SCE_PL_REGEX) {
|
||||
if (!quoteUp && !isspace(ch)) {
|
||||
quoteUp = ch;
|
||||
quoteDown = opposite(ch);
|
||||
quotes++;
|
||||
} else {
|
||||
if (ch == quoteDown && chPrev != '\\') {
|
||||
quotes--;
|
||||
if (quotes == 0) {
|
||||
quoteRep--;
|
||||
if (quoteUp == quoteDown) {
|
||||
quotes++;
|
||||
}
|
||||
}
|
||||
if (!isalpha(chNext)) {
|
||||
if (quoteRep <= 0) {
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_PL_DEFAULT;
|
||||
ch = ' ';
|
||||
}
|
||||
}
|
||||
} else if (ch == quoteUp && chPrev != '\\') {
|
||||
quotes++;
|
||||
} else if (!isalpha(chNext)) {
|
||||
if (quoteRep <= 0) {
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_PL_DEFAULT;
|
||||
ch = ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (state == SCE_PL_REGSUBST) {
|
||||
if (!quoteUp && !isspace(ch)) {
|
||||
quoteUp = ch;
|
||||
quoteDown = opposite(ch);
|
||||
quotes++;
|
||||
} else {
|
||||
if (quotes == 0 && quoteRep == 1) {
|
||||
/* We matched something like s(...) or tr{...}
|
||||
* and are looking for the next matcher characters,
|
||||
* which could be either bracketed ({...}) or non-bracketed
|
||||
* (/.../).
|
||||
*
|
||||
* Number-signs are problematic. If they occur after
|
||||
* the close of the first part, treat them like
|
||||
* a quoteUp char, even if they actually start comments.
|
||||
*
|
||||
* If we find an alnum, we end the regsubst, and punt.
|
||||
*
|
||||
* Eric Promislow ericp@activestate.com Aug 9,2000
|
||||
*/
|
||||
if (isspace(ch)) {
|
||||
// Keep going
|
||||
} else if (isalnum(ch)) {
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_PL_DEFAULT;
|
||||
ch = ' ';
|
||||
} else {
|
||||
quoteUp = ch;
|
||||
quoteDown = opposite(ch);
|
||||
quotes++;
|
||||
}
|
||||
} else if (ch == quoteDown && chPrev != '\\') {
|
||||
quotes--;
|
||||
if (quotes == 0) {
|
||||
quoteRep--;
|
||||
}
|
||||
if (!isalpha(chNext)) {
|
||||
if (quoteRep <= 0) {
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_PL_DEFAULT;
|
||||
ch = ' ';
|
||||
}
|
||||
}
|
||||
if (quoteUp == quoteDown) {
|
||||
quotes++;
|
||||
}
|
||||
} else if (ch == quoteUp && chPrev != '\\') {
|
||||
quotes++;
|
||||
} else if (!isalpha(chNext)) {
|
||||
if (quoteRep <= 0) {
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_PL_DEFAULT;
|
||||
ch = ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (state == SCE_PL_LONGQUOTE) {
|
||||
if (!quoteDown && !isspace(ch)) {
|
||||
quoteUp = ch;
|
||||
quoteDown = opposite(quoteUp);
|
||||
quotes++;
|
||||
} else if (ch == quoteDown) {
|
||||
quotes--;
|
||||
if (quotes == 0) {
|
||||
quoteRep--;
|
||||
if (quoteRep <= 0) {
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_PL_DEFAULT;
|
||||
ch = ' ';
|
||||
}
|
||||
if (quoteUp == quoteDown) {
|
||||
quotes++;
|
||||
}
|
||||
}
|
||||
} else if (ch == quoteUp) {
|
||||
quotes++;
|
||||
}
|
||||
}
|
||||
|
||||
if (state == SCE_PL_DEFAULT) { // One of the above succeeded
|
||||
if (ch == '#') {
|
||||
state = SCE_PL_COMMENTLINE;
|
||||
} else if (ch == '\"') {
|
||||
state = SCE_PL_STRING;
|
||||
} else if (ch == '\'') {
|
||||
state = SCE_PL_CHARACTER;
|
||||
} else if (iswordstart(ch)) {
|
||||
state = SCE_PL_WORD;
|
||||
preferRE = false;
|
||||
} else if (isoperator(ch)) {
|
||||
styler.ColourTo(i, SCE_PL_OPERATOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
chPrev = ch;
|
||||
}
|
||||
styler.ColourTo(lengthDoc, state);
|
||||
}
|
||||
|
||||
LexerModule lmPerl(SCLEX_PERL, ColourisePerlDoc);
|
||||
281
contrib/src/stc/scintilla/src/LexPython.cxx
Normal file
@@ -0,0 +1,281 @@
|
||||
// SciTE - Scintilla based Text Editor
|
||||
// LexPython.cxx - lexer for Python
|
||||
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "Platform.h"
|
||||
|
||||
#include "PropSet.h"
|
||||
#include "Accessor.h"
|
||||
#include "KeyWords.h"
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
static void ClassifyWordPy(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord) {
|
||||
char s[100];
|
||||
bool wordIsNumber = isdigit(styler[start]);
|
||||
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
|
||||
s[i] = styler[start + i];
|
||||
s[i + 1] = '\0';
|
||||
}
|
||||
char chAttr = SCE_P_IDENTIFIER;
|
||||
if (0 == strcmp(prevWord, "class"))
|
||||
chAttr = SCE_P_CLASSNAME;
|
||||
else if (0 == strcmp(prevWord, "def"))
|
||||
chAttr = SCE_P_DEFNAME;
|
||||
else if (wordIsNumber)
|
||||
chAttr = SCE_P_NUMBER;
|
||||
else if (keywords.InList(s))
|
||||
chAttr = SCE_P_WORD;
|
||||
// make sure that dot-qualifiers inside the word are lexed correct
|
||||
else for (unsigned int i = 0; i < end - start + 1; i++) {
|
||||
if (styler[start + i] == '.') {
|
||||
styler.ColourTo(start + i - 1, chAttr);
|
||||
styler.ColourTo(start + i, SCE_P_OPERATOR);
|
||||
}
|
||||
}
|
||||
styler.ColourTo(end, chAttr);
|
||||
strcpy(prevWord, s);
|
||||
}
|
||||
|
||||
static bool IsPyComment(Accessor &styler, int pos, int len) {
|
||||
return len>0 && styler[pos]=='#';
|
||||
}
|
||||
|
||||
static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler) {
|
||||
|
||||
int lengthDoc = startPos + length;
|
||||
|
||||
// Backtrack to previous line in case need to fix its fold status or tab whinging
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
if (startPos > 0) {
|
||||
if (lineCurrent > 0) {
|
||||
lineCurrent--;
|
||||
startPos = styler.LineStart(lineCurrent);
|
||||
if (startPos == 0)
|
||||
initStyle = SCE_P_DEFAULT;
|
||||
else
|
||||
initStyle = styler.StyleAt(startPos-1);
|
||||
}
|
||||
}
|
||||
|
||||
// Python uses a different mask because bad indentation is marked by oring with 32
|
||||
styler.StartAt(startPos, 127);
|
||||
|
||||
WordList &keywords = *keywordlists[0];
|
||||
|
||||
bool fold = styler.GetPropertyInt("fold");
|
||||
int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level");
|
||||
char prevWord[200];
|
||||
prevWord[0] = '\0';
|
||||
if (length == 0)
|
||||
return ;
|
||||
int spaceFlags = 0;
|
||||
|
||||
int state = initStyle & 31;
|
||||
|
||||
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
|
||||
if ((state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE))
|
||||
indentCurrent |= SC_FOLDLEVELWHITEFLAG;
|
||||
|
||||
char chPrev = ' ';
|
||||
char chPrev2 = ' ';
|
||||
char chNext = styler[startPos];
|
||||
styler.StartSegment(startPos);
|
||||
bool atStartLine = true;
|
||||
for (int i = startPos; i < lengthDoc; i++) {
|
||||
|
||||
if (atStartLine) {
|
||||
char chBad = static_cast<char>(64);
|
||||
char chGood = static_cast<char>(0);
|
||||
char chFlags = chGood;
|
||||
if (whingeLevel == 1) {
|
||||
chFlags = (spaceFlags & wsInconsistent) ? chBad : chGood;
|
||||
} else if (whingeLevel == 2) {
|
||||
chFlags = (spaceFlags & wsSpaceTab) ? chBad : chGood;
|
||||
} else if (whingeLevel == 3) {
|
||||
chFlags = (spaceFlags & wsSpace) ? chBad : chGood;
|
||||
} else if (whingeLevel == 4) {
|
||||
chFlags = (spaceFlags & wsTab) ? chBad : chGood;
|
||||
}
|
||||
styler.SetFlags(chFlags, static_cast<char>(state));
|
||||
atStartLine = false;
|
||||
}
|
||||
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
char chNext2 = styler.SafeGetCharAt(i + 2);
|
||||
|
||||
if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc)) {
|
||||
if ((state == SCE_P_DEFAULT) || (state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE)) {
|
||||
// Perform colourisation of white space and triple quoted strings at end of each line to allow
|
||||
// tab marking to work inside white space and triple quoted strings
|
||||
styler.ColourTo(i, state);
|
||||
}
|
||||
|
||||
int lev = indentCurrent;
|
||||
int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsPyComment);
|
||||
if ((state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE))
|
||||
indentNext |= SC_FOLDLEVELWHITEFLAG;
|
||||
if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) {
|
||||
// Only non whitespace lines can be headers
|
||||
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) {
|
||||
lev |= SC_FOLDLEVELHEADERFLAG;
|
||||
} else if (indentNext & SC_FOLDLEVELWHITEFLAG) {
|
||||
// Line after is blank so check the next - maybe should continue further?
|
||||
int spaceFlags2 = 0;
|
||||
int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsPyComment);
|
||||
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) {
|
||||
lev |= SC_FOLDLEVELHEADERFLAG;
|
||||
}
|
||||
}
|
||||
}
|
||||
indentCurrent = indentNext;
|
||||
if (fold) {
|
||||
styler.SetLevel(lineCurrent, lev);
|
||||
}
|
||||
lineCurrent++;
|
||||
atStartLine = true;
|
||||
}
|
||||
|
||||
if (styler.IsLeadByte(ch)) {
|
||||
chNext = styler.SafeGetCharAt(i + 2);
|
||||
chPrev = ' ';
|
||||
chPrev2 = ' ';
|
||||
i += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (state == SCE_P_STRINGEOL) {
|
||||
if (ch != '\r' && ch != '\n') {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_P_DEFAULT;
|
||||
}
|
||||
}
|
||||
if (state == SCE_P_DEFAULT) {
|
||||
if (iswordstart(ch)) {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_P_WORD;
|
||||
} else if (ch == '#') {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE;
|
||||
} else if (ch == '\"') {
|
||||
styler.ColourTo(i - 1, state);
|
||||
if (chNext == '\"' && chNext2 == '\"') {
|
||||
i += 2;
|
||||
state = SCE_P_TRIPLEDOUBLE;
|
||||
ch = ' ';
|
||||
chPrev = ' ';
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
} else {
|
||||
state = SCE_P_STRING;
|
||||
}
|
||||
} else if (ch == '\'') {
|
||||
styler.ColourTo(i - 1, state);
|
||||
if (chNext == '\'' && chNext2 == '\'') {
|
||||
i += 2;
|
||||
state = SCE_P_TRIPLE;
|
||||
ch = ' ';
|
||||
chPrev = ' ';
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
} else {
|
||||
state = SCE_P_CHARACTER;
|
||||
}
|
||||
} else if (isoperator(ch)) {
|
||||
styler.ColourTo(i - 1, state);
|
||||
styler.ColourTo(i, SCE_P_OPERATOR);
|
||||
}
|
||||
} else if (state == SCE_P_WORD) {
|
||||
if (!iswordchar(ch)) {
|
||||
ClassifyWordPy(styler.GetStartSegment(), i - 1, keywords, styler, prevWord);
|
||||
state = SCE_P_DEFAULT;
|
||||
if (ch == '#') {
|
||||
state = chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE;
|
||||
} else if (ch == '\"') {
|
||||
if (chNext == '\"' && chNext2 == '\"') {
|
||||
i += 2;
|
||||
state = SCE_P_TRIPLEDOUBLE;
|
||||
ch = ' ';
|
||||
chPrev = ' ';
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
} else {
|
||||
state = SCE_P_STRING;
|
||||
}
|
||||
} else if (ch == '\'') {
|
||||
if (chNext == '\'' && chNext2 == '\'') {
|
||||
i += 2;
|
||||
state = SCE_P_TRIPLE;
|
||||
ch = ' ';
|
||||
chPrev = ' ';
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
} else {
|
||||
state = SCE_P_CHARACTER;
|
||||
}
|
||||
} else if (isoperator(ch)) {
|
||||
styler.ColourTo(i, SCE_P_OPERATOR);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (state == SCE_P_COMMENTLINE || state == SCE_P_COMMENTBLOCK) {
|
||||
if (ch == '\r' || ch == '\n') {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_P_DEFAULT;
|
||||
}
|
||||
} else if (state == SCE_P_STRING) {
|
||||
if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_P_STRINGEOL;
|
||||
} else if (ch == '\\') {
|
||||
if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
} else if (ch == '\"') {
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_P_DEFAULT;
|
||||
}
|
||||
} else if (state == SCE_P_CHARACTER) {
|
||||
if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_P_STRINGEOL;
|
||||
} else if (ch == '\\') {
|
||||
if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
} else if (ch == '\'') {
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_P_DEFAULT;
|
||||
}
|
||||
} else if (state == SCE_P_TRIPLE) {
|
||||
if (ch == '\'' && chPrev == '\'' && chPrev2 == '\'') {
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_P_DEFAULT;
|
||||
}
|
||||
} else if (state == SCE_P_TRIPLEDOUBLE) {
|
||||
if (ch == '\"' && chPrev == '\"' && chPrev2 == '\"') {
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_P_DEFAULT;
|
||||
}
|
||||
}
|
||||
}
|
||||
chPrev2 = chPrev;
|
||||
chPrev = ch;
|
||||
}
|
||||
if (state == SCE_P_WORD) {
|
||||
ClassifyWordPy(styler.GetStartSegment(), lengthDoc, keywords, styler, prevWord);
|
||||
} else {
|
||||
styler.ColourTo(lengthDoc, state);
|
||||
}
|
||||
}
|
||||
|
||||
LexerModule lmPython(SCLEX_PYTHON, ColourisePyDoc);
|
||||
156
contrib/src/stc/scintilla/src/LexSQL.cxx
Normal file
@@ -0,0 +1,156 @@
|
||||
// SciTE - Scintilla based Text Editor
|
||||
// LexSQL.cxx - lexer for SQL
|
||||
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "Platform.h"
|
||||
|
||||
#include "PropSet.h"
|
||||
#include "Accessor.h"
|
||||
#include "KeyWords.h"
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
static void classifyWordSQL(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
|
||||
char s[100];
|
||||
bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.');
|
||||
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
|
||||
s[i] = static_cast<char>(toupper(styler[start + i]));
|
||||
s[i + 1] = '\0';
|
||||
}
|
||||
char chAttr = SCE_C_IDENTIFIER;
|
||||
if (wordIsNumber)
|
||||
chAttr = SCE_C_NUMBER;
|
||||
else {
|
||||
if (keywords.InList(s))
|
||||
chAttr = SCE_C_WORD;
|
||||
}
|
||||
styler.ColourTo(end, chAttr);
|
||||
}
|
||||
|
||||
static void ColouriseSQLDoc(unsigned int startPos, int length,
|
||||
int initStyle, WordList *keywordlists[], Accessor &styler) {
|
||||
|
||||
WordList &keywords = *keywordlists[0];
|
||||
|
||||
styler.StartAt(startPos);
|
||||
|
||||
bool fold = styler.GetPropertyInt("fold");
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
int spaceFlags = 0;
|
||||
|
||||
int state = initStyle;
|
||||
char chPrev = ' ';
|
||||
char chNext = styler[startPos];
|
||||
styler.StartSegment(startPos);
|
||||
unsigned int lengthDoc = startPos + length;
|
||||
for (unsigned int i = startPos; i < lengthDoc; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
|
||||
if ((ch == '\r' && chNext != '\n') || (ch == '\n')) {
|
||||
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags);
|
||||
int lev = indentCurrent;
|
||||
if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) {
|
||||
// Only non whitespace lines can be headers
|
||||
int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags);
|
||||
if (indentCurrent < (indentNext & ~SC_FOLDLEVELWHITEFLAG)) {
|
||||
lev |= SC_FOLDLEVELHEADERFLAG;
|
||||
}
|
||||
}
|
||||
if (fold) {
|
||||
styler.SetLevel(lineCurrent, lev);
|
||||
}
|
||||
}
|
||||
|
||||
if (styler.IsLeadByte(ch)) {
|
||||
chNext = styler.SafeGetCharAt(i + 2);
|
||||
chPrev = ' ';
|
||||
i += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (state == SCE_C_DEFAULT) {
|
||||
if (iswordstart(ch)) {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_C_WORD;
|
||||
} else if (ch == '/' && chNext == '*') {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_C_COMMENT;
|
||||
} else if (ch == '-' && chNext == '-') {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_C_COMMENTLINE;
|
||||
} else if (ch == '\'') {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_C_STRING;
|
||||
} else if (isoperator(ch)) {
|
||||
styler.ColourTo(i - 1, state);
|
||||
styler.ColourTo(i, SCE_C_OPERATOR);
|
||||
}
|
||||
} else if (state == SCE_C_WORD) {
|
||||
if (!iswordchar(ch)) {
|
||||
classifyWordSQL(styler.GetStartSegment(), i - 1, keywords, styler);
|
||||
state = SCE_C_DEFAULT;
|
||||
if (ch == '/' && chNext == '*') {
|
||||
state = SCE_C_COMMENT;
|
||||
} else if (ch == '-' && chNext == '-') {
|
||||
state = SCE_C_COMMENTLINE;
|
||||
} else if (ch == '\'') {
|
||||
state = SCE_C_STRING;
|
||||
} else if (isoperator(ch)) {
|
||||
styler.ColourTo(i, SCE_C_OPERATOR);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (state == SCE_C_COMMENT) {
|
||||
if (ch == '/' && chPrev == '*') {
|
||||
if (((i > (styler.GetStartSegment() + 2)) || ((initStyle == SCE_C_COMMENT) &&
|
||||
(styler.GetStartSegment() == startPos)))) {
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_C_DEFAULT;
|
||||
}
|
||||
}
|
||||
} else if (state == SCE_C_COMMENTLINE) {
|
||||
if (ch == '\r' || ch == '\n') {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_C_DEFAULT;
|
||||
}
|
||||
} else if (state == SCE_C_STRING) {
|
||||
if (ch == '\'') {
|
||||
if ( chNext == '\'' ) {
|
||||
i++;
|
||||
} else {
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_C_DEFAULT;
|
||||
i++;
|
||||
}
|
||||
ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
}
|
||||
if (state == SCE_C_DEFAULT) { // One of the above succeeded
|
||||
if (ch == '/' && chNext == '*') {
|
||||
state = SCE_C_COMMENT;
|
||||
} else if (ch == '-' && chNext == '-') {
|
||||
state = SCE_C_COMMENTLINE;
|
||||
} else if (ch == '\'') {
|
||||
state = SCE_C_STRING;
|
||||
} else if (iswordstart(ch)) {
|
||||
state = SCE_C_WORD;
|
||||
} else if (isoperator(ch)) {
|
||||
styler.ColourTo(i, SCE_C_OPERATOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
chPrev = ch;
|
||||
}
|
||||
styler.ColourTo(lengthDoc - 1, state);
|
||||
}
|
||||
|
||||
LexerModule lmSQL(SCLEX_SQL, ColouriseSQLDoc);
|
||||
139
contrib/src/stc/scintilla/src/LexVB.cxx
Normal file
@@ -0,0 +1,139 @@
|
||||
// SciTE - Scintilla based Text Editor
|
||||
// LexVB.cxx - lexer for Visual Basic and VBScript
|
||||
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "Platform.h"
|
||||
|
||||
#include "PropSet.h"
|
||||
#include "Accessor.h"
|
||||
#include "KeyWords.h"
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
static int classifyWordVB(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
|
||||
|
||||
char s[100];
|
||||
bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.') ||
|
||||
(styler[start] == '&' && tolower(styler[start+1]) == 'h');
|
||||
unsigned int i;
|
||||
for (i = 0; i < end - start + 1 && i < 30; i++) {
|
||||
s[i] = static_cast<char>(tolower(styler[start + i]));
|
||||
}
|
||||
s[i] = '\0';
|
||||
char chAttr = SCE_C_DEFAULT;
|
||||
if (wordIsNumber)
|
||||
chAttr = SCE_C_NUMBER;
|
||||
else {
|
||||
if (strcmp(s, "rem") == 0)
|
||||
chAttr = SCE_C_COMMENTLINE;
|
||||
else if (keywords.InList(s))
|
||||
chAttr = SCE_C_WORD;
|
||||
}
|
||||
styler.ColourTo(end, chAttr);
|
||||
if (chAttr == SCE_C_COMMENTLINE)
|
||||
return SCE_C_COMMENTLINE;
|
||||
else
|
||||
return SCE_C_DEFAULT;
|
||||
}
|
||||
|
||||
static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler) {
|
||||
|
||||
WordList &keywords = *keywordlists[0];
|
||||
|
||||
styler.StartAt(startPos);
|
||||
|
||||
int visibleChars = 0;
|
||||
int state = initStyle;
|
||||
char chNext = styler[startPos];
|
||||
styler.StartSegment(startPos);
|
||||
int lengthDoc = startPos + length;
|
||||
for (int i = startPos; i < lengthDoc; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
|
||||
if (styler.IsLeadByte(ch)) {
|
||||
chNext = styler.SafeGetCharAt(i + 2);
|
||||
i += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ch == '\r' || ch == '\n') {
|
||||
// End of line
|
||||
if (state == SCE_C_COMMENTLINE || state == SCE_C_PREPROCESSOR) {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_C_DEFAULT;
|
||||
}
|
||||
visibleChars = 0;
|
||||
}
|
||||
if (!isspace(ch))
|
||||
visibleChars++;
|
||||
|
||||
if (state == SCE_C_DEFAULT) {
|
||||
if (iswordstart(ch)) {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_C_WORD;
|
||||
} else if (ch == '\'') {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_C_COMMENTLINE;
|
||||
} else if (ch == '\"') {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_C_STRING;
|
||||
} else if (ch == '#' && visibleChars == 1) {
|
||||
// Preprocessor commands are alone on their line
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_C_PREPROCESSOR;
|
||||
} else if (ch == '&' && tolower(chNext) == 'h') {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_C_WORD;
|
||||
} else if (isoperator(ch)) {
|
||||
styler.ColourTo(i - 1, state);
|
||||
styler.ColourTo(i, SCE_C_OPERATOR);
|
||||
}
|
||||
} else if (state == SCE_C_WORD) {
|
||||
if (!iswordchar(ch)) {
|
||||
state = classifyWordVB(styler.GetStartSegment(), i - 1, keywords, styler);
|
||||
if (state == SCE_C_DEFAULT) {
|
||||
if (ch == '\'') {
|
||||
state = SCE_C_COMMENTLINE;
|
||||
} else if (ch == '\"') {
|
||||
state = SCE_C_STRING;
|
||||
} else if (isoperator(ch)) {
|
||||
styler.ColourTo(i - 1, state);
|
||||
styler.ColourTo(i, SCE_C_OPERATOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (state == SCE_C_STRING) {
|
||||
// VB doubles quotes to preserve them
|
||||
if (ch == '\"') {
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_C_DEFAULT;
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
}
|
||||
if (state == SCE_C_DEFAULT) { // One of the above succeeded
|
||||
if (ch == '\'') {
|
||||
state = SCE_C_COMMENTLINE;
|
||||
} else if (ch == '\"') {
|
||||
state = SCE_C_STRING;
|
||||
} else if (iswordstart(ch)) {
|
||||
state = SCE_C_WORD;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
styler.ColourTo(lengthDoc, state);
|
||||
}
|
||||
|
||||
LexerModule lmVB(SCLEX_VB, ColouriseVBDoc);
|
||||
@@ -51,20 +51,6 @@ void LineMarker::Draw(Surface *surface, PRectangle &rc) {
|
||||
|
||||
} else if (markType == SC_MARK_PLUS) {
|
||||
int armSize = dimOn2-2;
|
||||
Point xpts[] = {
|
||||
Point(centreX - armSize, centreY),
|
||||
Point(centreX, centreY),
|
||||
Point(centreX, centreY - armSize),
|
||||
Point(centreX, centreY - armSize),
|
||||
Point(centreX, centreY),
|
||||
Point(centreX + armSize, centreY),
|
||||
Point(centreX + armSize, centreY),
|
||||
Point(centreX, centreY),
|
||||
Point(centreX, centreY + armSize),
|
||||
Point(centreX, centreY + armSize),
|
||||
Point(centreX, centreY),
|
||||
Point(centreX - armSize, centreY),
|
||||
};
|
||||
Point pts[] = {
|
||||
Point(centreX - armSize, centreY - 1),
|
||||
Point(centreX - 1, centreY - 1),
|
||||
@@ -90,12 +76,6 @@ void LineMarker::Draw(Surface *surface, PRectangle &rc) {
|
||||
Point(centreX + armSize, centreY +1),
|
||||
Point(centreX - armSize, centreY + 1),
|
||||
};
|
||||
Point xpts[] = {
|
||||
Point(centreX - armSize, centreY),
|
||||
Point(centreX + armSize, centreY),
|
||||
Point(centreX + armSize, centreY),
|
||||
Point(centreX - armSize, centreY),
|
||||
};
|
||||
surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]),
|
||||
fore.allocated, back.allocated);
|
||||
|
||||
|
||||
1181
contrib/src/stc/scintilla/src/PosRegExp.cxx
Normal file
@@ -24,9 +24,22 @@ bool EqualCaseInsensitive(const char *a, const char *b) {
|
||||
#endif
|
||||
}
|
||||
|
||||
SString::size_type SString::npos = -1;
|
||||
|
||||
inline unsigned int HashString(const char *s) {
|
||||
unsigned int ret = 0;
|
||||
while (*s) {
|
||||
ret <<= 4;
|
||||
ret ^= *s;
|
||||
s++;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Get a line of input. If end of line escaped with '\\' then continue reading.
|
||||
static bool GetFullLine(const char *&fpc, int &lenData, char *s, int len) {
|
||||
bool continuation = true;
|
||||
s[0] = '\0';
|
||||
while ((len > 1) && lenData > 0) {
|
||||
char ch = *fpc;
|
||||
fpc++;
|
||||
@@ -38,7 +51,7 @@ static bool GetFullLine(const char *&fpc, int &lenData, char *s, int len) {
|
||||
fpc++;
|
||||
lenData--;
|
||||
}
|
||||
*s++ = '\0';
|
||||
*s = '\0';
|
||||
return true;
|
||||
}
|
||||
} else if ((ch == '\\') && (lenData > 0) && ((*fpc == '\r') || (*fpc == '\n'))) {
|
||||
@@ -46,6 +59,7 @@ static bool GetFullLine(const char *&fpc, int &lenData, char *s, int len) {
|
||||
} else {
|
||||
continuation = false;
|
||||
*s++ = ch;
|
||||
*s = '\0';
|
||||
len--;
|
||||
}
|
||||
}
|
||||
@@ -54,47 +68,39 @@ static bool GetFullLine(const char *&fpc, int &lenData, char *s, int len) {
|
||||
|
||||
PropSet::PropSet() {
|
||||
superPS = 0;
|
||||
size = 10;
|
||||
used = 0;
|
||||
vals = new char * [size];
|
||||
for (int root=0; root < hashRoots; root++)
|
||||
props[root] = 0;
|
||||
}
|
||||
|
||||
PropSet::~PropSet() {
|
||||
superPS = 0;
|
||||
Clear();
|
||||
delete []vals;
|
||||
}
|
||||
|
||||
void PropSet::EnsureCanAddEntry() {
|
||||
if (used >= size - 2) {
|
||||
int newsize = size + 10;
|
||||
char **newvals = new char * [newsize];
|
||||
|
||||
for (int i = 0; i < used; i++) {
|
||||
newvals[i] = vals[i];
|
||||
}
|
||||
delete []vals;
|
||||
vals = newvals;
|
||||
size = newsize;
|
||||
}
|
||||
}
|
||||
|
||||
void PropSet::Set(const char *key, const char *val) {
|
||||
EnsureCanAddEntry();
|
||||
for (int i = 0; i < used; i += 2) {
|
||||
if (EqualCaseInsensitive(vals[i], key)) {
|
||||
unsigned int hash = HashString(key);
|
||||
for (Property *p=props[hash % hashRoots]; p; p=p->next) {
|
||||
if ((hash == p->hash) && (0 == strcmp(p->key, key))) {
|
||||
// Replace current value
|
||||
delete [](vals[i + 1]);
|
||||
vals[i + 1] = StringDup(val);
|
||||
delete [](p->val);
|
||||
p->val = StringDup(val);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Not found
|
||||
vals[used++] = StringDup(key);
|
||||
vals[used++] = StringDup(val);
|
||||
Property *pNew = new Property;
|
||||
if (pNew) {
|
||||
pNew->hash = HashString(key);
|
||||
pNew->key = StringDup(key);
|
||||
pNew->val = StringDup(val);
|
||||
pNew->next = props[hash % hashRoots];
|
||||
props[hash % hashRoots] = pNew;
|
||||
}
|
||||
}
|
||||
|
||||
void PropSet::Set(char *keyval) {
|
||||
while (isspace(*keyval))
|
||||
keyval++;
|
||||
char *eqat = strchr(keyval, '=');
|
||||
if (eqat) {
|
||||
*eqat = '\0';
|
||||
@@ -104,11 +110,12 @@ void PropSet::Set(char *keyval) {
|
||||
}
|
||||
|
||||
SString PropSet::Get(const char *key) {
|
||||
for (int i = 0; i < used; i += 2) {
|
||||
if (EqualCaseInsensitive(vals[i], key)) {
|
||||
return vals[i + 1];
|
||||
}
|
||||
}
|
||||
unsigned int hash = HashString(key);
|
||||
for (Property *p=props[hash % hashRoots]; p; p=p->next) {
|
||||
if ((hash == p->hash) && (0 == strcmp(p->key, key))) {
|
||||
return p->val;
|
||||
}
|
||||
}
|
||||
if (superPS) {
|
||||
// Failed here, so try in base property set
|
||||
return superPS->Get(key);
|
||||
@@ -117,17 +124,47 @@ SString PropSet::Get(const char *key) {
|
||||
}
|
||||
}
|
||||
|
||||
SString PropSet::GetExpanded(const char *key) {
|
||||
SString val = Get(key);
|
||||
return Expand(val.c_str());
|
||||
}
|
||||
|
||||
SString PropSet::Expand(const char *withvars) {
|
||||
char *base = StringDup(withvars);
|
||||
char *cpvar = strstr(base, "$(");
|
||||
while (cpvar) {
|
||||
char *cpendvar = strchr(cpvar, ')');
|
||||
if (cpendvar) {
|
||||
int lenvar = cpendvar - cpvar - 2; // Subtract the $()
|
||||
char *var = StringDup(cpvar+2, lenvar);
|
||||
SString val = GetExpanded(var);
|
||||
int newlenbase = strlen(base) + val.length() - lenvar;
|
||||
char *newbase = new char[newlenbase];
|
||||
strncpy(newbase, base, cpvar - base);
|
||||
strcpy(newbase + (cpvar - base), val.c_str());
|
||||
strcpy(newbase + (cpvar - base) + val.length(), cpendvar + 1);
|
||||
delete []var;
|
||||
delete []base;
|
||||
base = newbase;
|
||||
}
|
||||
cpvar = strstr(base, "$(");
|
||||
}
|
||||
SString sret = base;
|
||||
delete []base;
|
||||
return sret;
|
||||
}
|
||||
|
||||
int PropSet::GetInt(const char *key, int defaultValue) {
|
||||
SString val = Get(key);
|
||||
if (val.length())
|
||||
return Get(key).value();
|
||||
return val.value();
|
||||
else
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
bool isprefix(const char *target, const char *prefix) {
|
||||
inline bool isprefix(const char *target, const char *prefix) {
|
||||
while (*target && *prefix) {
|
||||
if (toupper(*target) != toupper(*prefix))
|
||||
if (*target != *prefix)
|
||||
return false;
|
||||
target++;
|
||||
prefix++;
|
||||
@@ -144,64 +181,63 @@ bool issuffix(const char *target, const char *suffix) {
|
||||
if (lensuffix > lentarget)
|
||||
return false;
|
||||
for (int i = lensuffix - 1; i >= 0; i--) {
|
||||
if (toupper(target[i + lentarget - lensuffix]) != toupper(suffix[i]))
|
||||
if (target[i + lentarget - lensuffix] != suffix[i])
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
SString PropSet::GetWild(const char *keybase, const char *filename) {
|
||||
for (int i = 0; i < used; i += 2) {
|
||||
if (isprefix(vals[i], keybase)) {
|
||||
char *orgkeyfile = vals[i] + strlen(keybase);
|
||||
char *keyfile = NULL;
|
||||
for (int root=0; root < hashRoots; root++) {
|
||||
for (Property *p=props[root]; p; p=p->next) {
|
||||
if (isprefix(p->key, keybase)) {
|
||||
char *orgkeyfile = p->key + strlen(keybase);
|
||||
char *keyfile = NULL;
|
||||
|
||||
if (strstr(orgkeyfile, "$(") == orgkeyfile) {
|
||||
char *cpendvar = strchr(orgkeyfile, ')');
|
||||
if (cpendvar) {
|
||||
int lenvar = cpendvar - orgkeyfile - 2; // Subtract the $()
|
||||
char *var = static_cast<char *>(malloc(lenvar + 1));
|
||||
strncpy(var, orgkeyfile + 2, lenvar);
|
||||
var[lenvar] = '\0';
|
||||
SString s = Get(var);
|
||||
free(var);
|
||||
keyfile = strdup(s.c_str());
|
||||
}
|
||||
}
|
||||
char *keyptr = keyfile;
|
||||
if (strstr(orgkeyfile, "$(") == orgkeyfile) {
|
||||
char *cpendvar = strchr(orgkeyfile, ')');
|
||||
if (cpendvar) {
|
||||
*cpendvar = '\0';
|
||||
SString s = Get(orgkeyfile + 2);
|
||||
*cpendvar= ')';
|
||||
keyfile = strdup(s.c_str());
|
||||
}
|
||||
}
|
||||
char *keyptr = keyfile;
|
||||
|
||||
if (keyfile == NULL)
|
||||
keyfile = orgkeyfile;
|
||||
if (keyfile == NULL)
|
||||
keyfile = orgkeyfile;
|
||||
|
||||
for (; ; ) {
|
||||
char *del = strchr(keyfile, ';');
|
||||
if (del == NULL)
|
||||
del = keyfile + strlen(keyfile);
|
||||
char delchr = *del;
|
||||
*del = '\0';
|
||||
if (*keyfile == '*') {
|
||||
if (issuffix(filename, keyfile + 1)) {
|
||||
*del = delchr;
|
||||
free(keyptr);
|
||||
return vals[i + 1];
|
||||
}
|
||||
} else if (EqualCaseInsensitive(keyfile, filename)) {
|
||||
*del = delchr;
|
||||
free(keyptr);
|
||||
return vals[i + 1];
|
||||
}
|
||||
if (delchr == '\0')
|
||||
break;
|
||||
*del = delchr;
|
||||
keyfile = del + 1;
|
||||
}
|
||||
free(keyptr);
|
||||
for (; ; ) {
|
||||
char *del = strchr(keyfile, ';');
|
||||
if (del == NULL)
|
||||
del = keyfile + strlen(keyfile);
|
||||
char delchr = *del;
|
||||
*del = '\0';
|
||||
if (*keyfile == '*') {
|
||||
if (issuffix(filename, keyfile + 1)) {
|
||||
*del = delchr;
|
||||
free(keyptr);
|
||||
return p->val;
|
||||
}
|
||||
} else if (0 == strcmp(keyfile, filename)) {
|
||||
*del = delchr;
|
||||
free(keyptr);
|
||||
return p->val;
|
||||
}
|
||||
if (delchr == '\0')
|
||||
break;
|
||||
*del = delchr;
|
||||
keyfile = del + 1;
|
||||
}
|
||||
free(keyptr);
|
||||
|
||||
if (EqualCaseInsensitive(vals[i], keybase)) {
|
||||
return vals[i + 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (0 == strcmp(p->key, keybase)) {
|
||||
return p->val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (superPS) {
|
||||
// Failed here, so try in base property set
|
||||
return superPS->GetWild(keybase, filename);
|
||||
@@ -217,9 +253,7 @@ SString PropSet::GetNewExpand(const char *keybase, const char *filename) {
|
||||
char *cpendvar = strchr(cpvar, ')');
|
||||
if (cpendvar) {
|
||||
int lenvar = cpendvar - cpvar - 2; // Subtract the $()
|
||||
char *var = new char[lenvar + 1];
|
||||
strncpy(var, cpvar + 2, lenvar);
|
||||
var[lenvar] = '\0';
|
||||
char *var = StringDup(cpvar+2, lenvar);
|
||||
SString val = GetWild(var, filename);
|
||||
int newlenbase = strlen(base) + val.length() - lenvar;
|
||||
char *newbase = new char[newlenbase];
|
||||
@@ -238,33 +272,54 @@ SString PropSet::GetNewExpand(const char *keybase, const char *filename) {
|
||||
}
|
||||
|
||||
void PropSet::Clear() {
|
||||
for (int i = 0; i < used; i++) {
|
||||
delete [](vals[i]);
|
||||
vals[i] = 0;
|
||||
}
|
||||
used = 0;
|
||||
for (int root=0; root < hashRoots; root++) {
|
||||
Property *p=props[root];
|
||||
while (p) {
|
||||
Property *pNext=p->next;
|
||||
p->hash = 0;
|
||||
delete p->key;
|
||||
p->key = 0;
|
||||
delete p->val;
|
||||
p->val = 0;
|
||||
delete p;
|
||||
p = pNext;
|
||||
}
|
||||
props[root] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void PropSet::ReadFromMemory(const char *data, int len) {
|
||||
if (len > 0) {
|
||||
const char *pd = data;
|
||||
char linebuf[60000];
|
||||
while (GetFullLine(pd, len, linebuf, sizeof(linebuf))) {
|
||||
if (isalpha(linebuf[0]))
|
||||
Set(linebuf);
|
||||
void PropSet::ReadFromMemory(const char *data, int len, const char *directoryForImports) {
|
||||
const char *pd = data;
|
||||
char linebuf[60000];
|
||||
bool ifIsTrue = true;
|
||||
while (len > 0) {
|
||||
GetFullLine(pd, len, linebuf, sizeof(linebuf));
|
||||
if (isalpha(linebuf[0])) // If clause ends with first non-indented line
|
||||
ifIsTrue = true;
|
||||
if (isprefix(linebuf, "if ")) {
|
||||
const char *expr = linebuf + strlen("if") + 1;
|
||||
ifIsTrue = GetInt(expr);
|
||||
} else if (isprefix(linebuf, "import ") && directoryForImports) {
|
||||
char importPath[1024];
|
||||
strcpy(importPath, directoryForImports);
|
||||
strcat(importPath, linebuf + strlen("import") + 1);
|
||||
strcat(importPath, ".properties");
|
||||
Read(importPath,directoryForImports);
|
||||
} else if (isalpha(linebuf[0])) {
|
||||
Set(linebuf);
|
||||
} else if (isspace(linebuf[0]) && ifIsTrue) {
|
||||
Set(linebuf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PropSet::Read(const char *filename) {
|
||||
//printf("Opening properties <%s>\n", filename);
|
||||
Clear();
|
||||
void PropSet::Read(const char *filename, const char *directoryForImports) {
|
||||
char propsData[60000];
|
||||
FILE *rcfile = fopen(filename, "rb");
|
||||
if (rcfile) {
|
||||
int lenFile = fread(propsData, 1, sizeof(propsData), rcfile);
|
||||
fclose(rcfile);
|
||||
ReadFromMemory(propsData, lenFile);
|
||||
ReadFromMemory(propsData, lenFile, directoryForImports);
|
||||
} else {
|
||||
//printf("Could not open <%s>\n", filename);
|
||||
}
|
||||
@@ -280,7 +335,8 @@ static bool iswordsep(char ch, bool onlyLineEnds) {
|
||||
|
||||
// Creates an array that points into each word in the string and puts \0 terminators
|
||||
// after each word.
|
||||
static char **ArrayFromWordList(char *wordlist, bool onlyLineEnds = false) {
|
||||
static char **ArrayFromWordList(char *wordlist, int *len, bool onlyLineEnds = false) {
|
||||
#if 1
|
||||
char prev = '\n';
|
||||
int words = 0;
|
||||
for (int j = 0; wordlist[j]; j++) {
|
||||
@@ -292,8 +348,8 @@ static char **ArrayFromWordList(char *wordlist, bool onlyLineEnds = false) {
|
||||
if (keywords) {
|
||||
words = 0;
|
||||
prev = '\0';
|
||||
int len = strlen(wordlist);
|
||||
for (int k = 0; k < len; k++) {
|
||||
int slen = strlen(wordlist);
|
||||
for (int k = 0; k < slen; k++) {
|
||||
if (!iswordsep(wordlist[k], onlyLineEnds)) {
|
||||
if (!prev) {
|
||||
keywords[words] = &wordlist[k];
|
||||
@@ -304,25 +360,69 @@ static char **ArrayFromWordList(char *wordlist, bool onlyLineEnds = false) {
|
||||
}
|
||||
prev = wordlist[k];
|
||||
}
|
||||
keywords[words] = &wordlist[len];
|
||||
keywords[words] = &wordlist[slen];
|
||||
*len = words;
|
||||
} else {
|
||||
*len = 0;
|
||||
}
|
||||
#else
|
||||
int words = 0; // length of the returned buffer of pointers
|
||||
#undef APICHUNK // how many pointers will be pre-allocated (to avoid buffer reallocation on each new pointer)
|
||||
#define APICHUNK 256
|
||||
int size = APICHUNK; // real size of the returned buffer of pointers
|
||||
char **keywords; // buffer for the pointers returned
|
||||
int slen = strlen(wordlist); //length of the buffer with api file
|
||||
keywords = (char**) malloc((size + 1) * sizeof (*keywords));
|
||||
words = 0;
|
||||
for (int k = 0;;) {
|
||||
while (iswordsep(wordlist[k], onlyLineEnds))
|
||||
wordlist[k++] = '\0';
|
||||
if (k >= slen)
|
||||
break;
|
||||
if (words >= size) {
|
||||
do
|
||||
size += APICHUNK;
|
||||
while (size <= words);
|
||||
keywords = (char**) realloc(keywords, (size + 1) * sizeof (*keywords));
|
||||
}
|
||||
keywords[words++] = wordlist + k;
|
||||
do
|
||||
if (k < slen)
|
||||
k++;
|
||||
else
|
||||
goto out;
|
||||
while (!iswordsep(wordlist[k], onlyLineEnds));
|
||||
}
|
||||
out:
|
||||
keywords[words] = wordlist + slen;
|
||||
*len = words;
|
||||
#endif
|
||||
return keywords;
|
||||
}
|
||||
|
||||
void WordList::Clear() {
|
||||
if (words) {
|
||||
delete []words;
|
||||
delete []list;
|
||||
#if 1
|
||||
delete []words;
|
||||
#else
|
||||
free(words);
|
||||
#endif
|
||||
free(wordsNoCase);
|
||||
}
|
||||
words = 0;
|
||||
wordsNoCase = 0;
|
||||
list = 0;
|
||||
len = 0;
|
||||
sorted = false;
|
||||
}
|
||||
|
||||
void WordList::Set(const char *s) {
|
||||
len = 0;
|
||||
list = StringDup(s);
|
||||
words = ArrayFromWordList(list, onlyLineEnds);
|
||||
sorted = false;
|
||||
words = ArrayFromWordList(list, &len, onlyLineEnds);
|
||||
wordsNoCase = (char**) malloc ((len + 1) * sizeof (*wordsNoCase));
|
||||
memcpy(wordsNoCase, words, (len + 1) * sizeof (*words));
|
||||
}
|
||||
|
||||
char *WordList::Allocate(int size) {
|
||||
@@ -332,46 +432,36 @@ char *WordList::Allocate(int size) {
|
||||
}
|
||||
|
||||
void WordList::SetFromAllocated() {
|
||||
len = 0;
|
||||
words = ArrayFromWordList(list, onlyLineEnds);
|
||||
sorted = false;
|
||||
words = ArrayFromWordList(list, &len, onlyLineEnds);
|
||||
wordsNoCase = (char**) malloc ((len + 1) * sizeof (*wordsNoCase));
|
||||
memcpy(wordsNoCase, words, (len + 1) * sizeof (*words));
|
||||
}
|
||||
|
||||
// Shell sort based upon public domain C implementation by Raymond Gardner 1991
|
||||
// Used here because of problems with mingw qsort.
|
||||
static void SortWordList(char **words, unsigned int len) {
|
||||
unsigned int gap = len / 2;
|
||||
|
||||
while (gap > 0) {
|
||||
unsigned int i = gap;
|
||||
while (i < len) {
|
||||
unsigned int j = i;
|
||||
char **a = words + j;
|
||||
do {
|
||||
j -= gap;
|
||||
char **b = a;
|
||||
a -= gap;
|
||||
if (strcmp(*a, *b) > 0) {
|
||||
char *tmp = *a;
|
||||
*a = *b;
|
||||
*b = tmp;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} while (j >= gap);
|
||||
i++;
|
||||
}
|
||||
gap = gap / 2;
|
||||
}
|
||||
int cmpString(const void *a1, const void *a2) {
|
||||
// Can't work out the correct incantation to use modern casts here
|
||||
return strcmp(*(char**)(a1), *(char**)(a2));
|
||||
}
|
||||
|
||||
int cmpStringNoCase(const void *a1, const void *a2) {
|
||||
// Can't work out the correct incantation to use modern casts here
|
||||
return strcasecmp(*(char**)(a1), *(char**)(a2));
|
||||
}
|
||||
|
||||
static void SortWordList(char **words, char **wordsNoCase, unsigned int len) {
|
||||
qsort(reinterpret_cast<void*>(words), len, sizeof(*words),
|
||||
cmpString);
|
||||
qsort(reinterpret_cast<void*>(wordsNoCase), len, sizeof(*wordsNoCase),
|
||||
cmpStringNoCase);
|
||||
}
|
||||
|
||||
bool WordList::InList(const char *s) {
|
||||
if (0 == words)
|
||||
return false;
|
||||
if (len == 0) {
|
||||
for (int i = 0; words[i][0]; i++)
|
||||
len++;
|
||||
SortWordList(words, len);
|
||||
for (int k = 0; k < (sizeof(starts) / sizeof(starts[0])); k++)
|
||||
if (!sorted) {
|
||||
sorted = true;
|
||||
SortWordList(words, wordsNoCase, len);
|
||||
for (unsigned int k = 0; k < (sizeof(starts) / sizeof(starts[0])); k++)
|
||||
starts[k] = -1;
|
||||
for (int l = len - 1; l >= 0; l--) {
|
||||
unsigned char indexChar = words[l][0];
|
||||
@@ -397,3 +487,256 @@ bool WordList::InList(const char *s) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an element (complete) of the wordlist array which has the beginning
|
||||
* the same as the passed string. The length of the word to compare is passed
|
||||
* too. Letter case can be ignored or preserved (default).
|
||||
*/
|
||||
const char *WordList::GetNearestWord(const char *wordStart, int searchLen /*= -1*/, bool ignoreCase /*= false*/) {
|
||||
int start = 0; // lower bound of the api array block to search
|
||||
int end = len - 1; // upper bound of the api array block to search
|
||||
int pivot; // index of api array element just being compared
|
||||
int cond; // comparison result (in the sense of strcmp() result)
|
||||
const char *word; // api array element just being compared
|
||||
|
||||
if (0 == words)
|
||||
return NULL;
|
||||
if (!sorted) {
|
||||
sorted = true;
|
||||
SortWordList(words, wordsNoCase, len);
|
||||
}
|
||||
if (ignoreCase)
|
||||
while (start <= end) { // binary searching loop
|
||||
pivot = (start + end) >> 1;
|
||||
word = wordsNoCase[pivot];
|
||||
cond = strncasecmp(wordStart, word, searchLen);
|
||||
if (!cond && nonFuncChar(word[searchLen])) // maybe there should be a "non-word character" test here?
|
||||
return word; // result must not be freed with free()
|
||||
else if (cond < 0)
|
||||
end = pivot - 1;
|
||||
else if (cond > 0)
|
||||
start = pivot + 1;
|
||||
}
|
||||
else // preserve the letter case
|
||||
while (start <= end) { // binary searching loop
|
||||
pivot = (start + end) >> 1;
|
||||
word = words[pivot];
|
||||
cond = strncmp(wordStart, word, searchLen);
|
||||
if (!cond && nonFuncChar(word[searchLen])) // maybe there should be a "non-word character" test here?
|
||||
return word; // result must not be freed with free()
|
||||
else if (cond >= 0)
|
||||
start = pivot + 1;
|
||||
else if (cond < 0)
|
||||
end = pivot - 1;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns elements (first words of them) of the wordlist array which have
|
||||
* the beginning the same as the passed string. The length of the word to
|
||||
* compare is passed too. Letter case can be ignored or preserved (default).
|
||||
* If there are more words meeting the condition they are returned all of
|
||||
* them in the ascending order separated with spaces.
|
||||
*
|
||||
* NOTE: returned buffer has to be freed with a free() call.
|
||||
*/
|
||||
char *WordList::GetNearestWords(const char *wordStart, int searchLen /*= -1*/, bool ignoreCase /*= false*/) {
|
||||
int wordlen; // length of the word part (before the '(' brace) of the api array element
|
||||
int length = 0; // length of the returned buffer of words (string)
|
||||
int newlength; // length of the new buffer before the reallocating itself
|
||||
#undef WORDCHUNK // how many characters will be pre-allocated (to avoid buffer reallocation on each new word)
|
||||
#define WORDCHUNK 100
|
||||
int size = WORDCHUNK; // real size of the returned buffer of words
|
||||
char *buffer; // buffer for the words returned
|
||||
int start = 0; // lower bound of the api array block to search
|
||||
int end = len - 1; // upper bound of the api array block to search
|
||||
int pivot; // index of api array element just being compared
|
||||
int cond; // comparison result (in the sense of strcmp() result)
|
||||
int oldpivot; // pivot storage to be able to browse the api array upwards and then downwards
|
||||
const char *word; // api array element just being compared
|
||||
const char *brace; // position of the opening brace in the api array element just being compared
|
||||
|
||||
if (0 == words)
|
||||
return NULL;
|
||||
if (!sorted) {
|
||||
sorted = true;
|
||||
SortWordList(words, wordsNoCase, len);
|
||||
}
|
||||
buffer = (char*) malloc(size);
|
||||
*buffer = '\0';
|
||||
if (ignoreCase)
|
||||
while (start <= end) { // binary searching loop
|
||||
pivot = (start + end) >> 1;
|
||||
word = wordsNoCase[pivot];
|
||||
cond = strncasecmp(wordStart, word, searchLen);
|
||||
if (!cond) {
|
||||
oldpivot = pivot;
|
||||
do { // browse sequentially the rest after the hit
|
||||
brace = strchr(word, '(');
|
||||
if (brace)
|
||||
do
|
||||
if (--brace < word)
|
||||
break;
|
||||
while (isspace(*brace));
|
||||
else {
|
||||
brace = word + strlen(word);
|
||||
do
|
||||
if (--brace < word)
|
||||
break;
|
||||
while (isspace(*brace));
|
||||
}
|
||||
wordlen = brace - word + 1;
|
||||
newlength = length + wordlen; // stretch the buffer
|
||||
if (length)
|
||||
newlength++;
|
||||
if (newlength >= size) {
|
||||
do
|
||||
size += WORDCHUNK;
|
||||
while (size <= newlength);
|
||||
buffer = (char*) realloc(buffer, size);
|
||||
}
|
||||
if (length) // append a new entry
|
||||
buffer[length++] = ' ';
|
||||
memcpy(buffer + length, word, wordlen);
|
||||
length = newlength;
|
||||
buffer[length] = '\0';
|
||||
if (++pivot > end)
|
||||
break;
|
||||
word = wordsNoCase[pivot];
|
||||
} while (!strncasecmp(wordStart, word, searchLen));
|
||||
|
||||
pivot = oldpivot;
|
||||
for (;;) { // browse sequentially the rest before the hit
|
||||
if (--pivot < start)
|
||||
break;
|
||||
word = wordsNoCase[pivot];
|
||||
if (strncasecmp(wordStart, word, searchLen))
|
||||
break;
|
||||
brace = strchr(word, '(');
|
||||
if (brace)
|
||||
do
|
||||
if (--brace < word)
|
||||
break;
|
||||
while (isspace(*brace));
|
||||
else {
|
||||
brace = word + strlen(word);
|
||||
do
|
||||
if (--brace < word)
|
||||
break;
|
||||
while (isspace(*brace));
|
||||
}
|
||||
wordlen = brace - word + 1;
|
||||
newlength = length + wordlen; // stretch the buffer
|
||||
if (length)
|
||||
newlength++;
|
||||
if (newlength >= size)
|
||||
{
|
||||
do
|
||||
size += WORDCHUNK;
|
||||
while (size <= newlength);
|
||||
buffer = (char*) realloc(buffer, size);
|
||||
}
|
||||
if (length) // append a new entry
|
||||
buffer[length++] = ' ';
|
||||
memcpy(buffer + length, word, wordlen);
|
||||
length = newlength;
|
||||
buffer[length] = '\0';
|
||||
}
|
||||
return buffer; // result has to be freed with free()
|
||||
}
|
||||
else if (cond < 0)
|
||||
end = pivot - 1;
|
||||
else if (cond > 0)
|
||||
start = pivot + 1;
|
||||
}
|
||||
else // preserve the letter case
|
||||
while (start <= end) { // binary searching loop
|
||||
pivot = (start + end) >> 1;
|
||||
word = words[pivot];
|
||||
cond = strncmp(wordStart, word, searchLen);
|
||||
if (!cond) {
|
||||
oldpivot = pivot;
|
||||
do { // browse sequentially the rest after the hit
|
||||
brace = strchr(word, '(');
|
||||
if (brace)
|
||||
do
|
||||
if (--brace < word)
|
||||
break;
|
||||
while (isspace(*brace));
|
||||
else {
|
||||
brace = word + strlen(word);
|
||||
do
|
||||
if (--brace < word)
|
||||
break;
|
||||
while (isspace(*brace));
|
||||
}
|
||||
wordlen = brace - word + 1;
|
||||
newlength = length + wordlen; // stretch the buffer
|
||||
if (length)
|
||||
newlength++;
|
||||
if (newlength >= size)
|
||||
{
|
||||
do
|
||||
size += WORDCHUNK;
|
||||
while (size <= newlength);
|
||||
buffer = (char*) realloc(buffer, size);
|
||||
}
|
||||
if (length) // append a new entry
|
||||
buffer[length++] = ' ';
|
||||
memcpy(buffer + length, word, wordlen);
|
||||
length = newlength;
|
||||
buffer[length] = '\0';
|
||||
if (++pivot > end)
|
||||
break;
|
||||
word = words[pivot];
|
||||
} while (!strncmp(wordStart, word, searchLen));
|
||||
|
||||
pivot = oldpivot;
|
||||
for (;;) { // browse sequentially the rest before the hit
|
||||
if (--pivot < start)
|
||||
break;
|
||||
word = words[pivot];
|
||||
if (strncmp(wordStart, word, searchLen))
|
||||
break;
|
||||
brace = strchr(word, '(');
|
||||
if (brace)
|
||||
do
|
||||
if (--brace < word)
|
||||
break;
|
||||
while (isspace(*brace));
|
||||
else {
|
||||
brace = word + strlen(word);
|
||||
do
|
||||
if (--brace < word)
|
||||
break;
|
||||
while (isspace(*brace));
|
||||
}
|
||||
wordlen = brace - word + 1;
|
||||
newlength = length + wordlen; // stretch the buffer
|
||||
if (length)
|
||||
newlength++;
|
||||
if (newlength >= size)
|
||||
{
|
||||
do
|
||||
size += WORDCHUNK;
|
||||
while (size <= newlength);
|
||||
buffer = (char*) realloc(buffer, size);
|
||||
}
|
||||
if (length) // append a new entry
|
||||
buffer[length++] = ' ';
|
||||
memcpy(buffer + length, word, wordlen);
|
||||
length = newlength;
|
||||
buffer[length] = '\0';
|
||||
}
|
||||
return buffer; // result has to be freed with free()
|
||||
}
|
||||
else if (cond < 0)
|
||||
end = pivot - 1;
|
||||
else if (cond > 0)
|
||||
start = pivot + 1;
|
||||
}
|
||||
free(buffer);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -6,13 +6,12 @@
|
||||
#ifndef SVECTOR_H
|
||||
#define SVECTOR_H
|
||||
|
||||
// A simple expandable vector.
|
||||
// T must support assignment.
|
||||
// A simple expandable integer vector.
|
||||
// Storage not allocated for elements until an element is used.
|
||||
// This makes it very lightweight unless used so is a good match for optional features.
|
||||
template<class T, int sizeIncrement>
|
||||
|
||||
class SVector {
|
||||
T *v;
|
||||
int *v;
|
||||
unsigned int size; // Number of elements allocated
|
||||
unsigned int len; // Number of elements in vector
|
||||
bool allocFailure; // A memory allocation call has failed
|
||||
@@ -20,19 +19,23 @@ class SVector {
|
||||
// Internally allocate more elements than the user wants to avoid
|
||||
// thrashng the memory allocator
|
||||
void SizeTo(int newSize) {
|
||||
if (newSize < sizeIncrement)
|
||||
newSize += sizeIncrement;
|
||||
if (newSize < 4000)
|
||||
newSize += 4000;
|
||||
else
|
||||
newSize = (newSize * 3) / 2;
|
||||
T* newv = new T[newSize];
|
||||
int* newv = new int[newSize];
|
||||
if (!newv) {
|
||||
allocFailure = true;
|
||||
return;
|
||||
}
|
||||
size = newSize;
|
||||
for (int i=0; i<len; i++) {
|
||||
unsigned int i=0;
|
||||
for (; i<len; i++) {
|
||||
newv[i] = v[i];
|
||||
}
|
||||
for (; i<size; i++) {
|
||||
newv[i] = 0;
|
||||
}
|
||||
delete []v;
|
||||
v = newv;
|
||||
}
|
||||
@@ -79,7 +82,7 @@ public:
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
T &operator[](unsigned int i) {
|
||||
int &operator[](unsigned int i) {
|
||||
if (i >= len) {
|
||||
if (i >= size) {
|
||||
SizeTo(i);
|
||||
@@ -94,13 +97,13 @@ public:
|
||||
size = 0;
|
||||
len = 0;
|
||||
}
|
||||
void SetLength(int newLen) {
|
||||
if (newLen > len) {
|
||||
if (newLen >= size) {
|
||||
SizeTo(newLen);
|
||||
void SetLength(unsigned int newLength) {
|
||||
if (newLength > len) {
|
||||
if (newLength >= size) {
|
||||
SizeTo(newLength);
|
||||
}
|
||||
}
|
||||
len = newLen;
|
||||
len = newLength;
|
||||
}
|
||||
int Length() const {
|
||||
return len;
|
||||
|
||||
@@ -11,10 +11,12 @@
|
||||
#include "Platform.h"
|
||||
|
||||
#include "Scintilla.h"
|
||||
#include "PropSet.h"
|
||||
#ifdef SCI_LEXER
|
||||
#include "SciLexer.h"
|
||||
#include "PropSet.h"
|
||||
#include "Accessor.h"
|
||||
#include "WindowAccessor.h"
|
||||
#include "DocumentAccessor.h"
|
||||
#include "KeyWords.h"
|
||||
#endif
|
||||
#include "ContractionState.h"
|
||||
@@ -39,9 +41,15 @@ ScintillaBase::ScintillaBase() {
|
||||
#endif
|
||||
}
|
||||
|
||||
ScintillaBase::~ScintillaBase() {}
|
||||
ScintillaBase::~ScintillaBase() {
|
||||
#ifdef SCI_LEXER
|
||||
for (int wl=0;wl<numWordLists;wl++)
|
||||
delete keyWordLists[wl];
|
||||
#endif
|
||||
}
|
||||
|
||||
void ScintillaBase::Finalise() {
|
||||
Editor::Finalise();
|
||||
popup.Destroy();
|
||||
}
|
||||
|
||||
@@ -50,11 +58,12 @@ void ScintillaBase::RefreshColourPalette(Palette &pal, bool want) {
|
||||
ct.RefreshColourPalette(pal, want);
|
||||
}
|
||||
|
||||
void ScintillaBase::AddChar(char ch) {
|
||||
void ScintillaBase::AddCharUTF(char *s, unsigned int len) {
|
||||
bool acActiveBeforeCharAdded = ac.Active();
|
||||
Editor::AddChar(ch);
|
||||
if (!acActiveBeforeCharAdded || !ac.IsFillUpChar(*s))
|
||||
Editor::AddCharUTF(s, len);
|
||||
if (acActiveBeforeCharAdded)
|
||||
AutoCompleteChanged(ch);
|
||||
AutoCompleteChanged(s[0]);
|
||||
}
|
||||
|
||||
void ScintillaBase::Command(int cmdId) {
|
||||
@@ -68,7 +77,7 @@ void ScintillaBase::Command(int cmdId) {
|
||||
break;
|
||||
|
||||
case idcmdUndo:
|
||||
WndProc(WM_UNDO, 0, 0);
|
||||
WndProc(SCI_UNDO, 0, 0);
|
||||
break;
|
||||
|
||||
case idcmdRedo:
|
||||
@@ -76,19 +85,19 @@ void ScintillaBase::Command(int cmdId) {
|
||||
break;
|
||||
|
||||
case idcmdCut:
|
||||
WndProc(WM_CUT, 0, 0);
|
||||
WndProc(SCI_CUT, 0, 0);
|
||||
break;
|
||||
|
||||
case idcmdCopy:
|
||||
WndProc(WM_COPY, 0, 0);
|
||||
WndProc(SCI_COPY, 0, 0);
|
||||
break;
|
||||
|
||||
case idcmdPaste:
|
||||
WndProc(WM_PASTE, 0, 0);
|
||||
WndProc(SCI_PASTE, 0, 0);
|
||||
break;
|
||||
|
||||
case idcmdDelete:
|
||||
WndProc(WM_CLEAR, 0, 0);
|
||||
WndProc(SCI_CLEAR, 0, 0);
|
||||
break;
|
||||
|
||||
case idcmdSelectAll:
|
||||
@@ -97,7 +106,7 @@ void ScintillaBase::Command(int cmdId) {
|
||||
}
|
||||
}
|
||||
|
||||
int ScintillaBase::KeyCommand(UINT iMessage) {
|
||||
int ScintillaBase::KeyCommand(unsigned int iMessage) {
|
||||
// Most key commands cancel autocompletion mode
|
||||
if (ac.Active()) {
|
||||
switch (iMessage) {
|
||||
@@ -128,6 +137,9 @@ int ScintillaBase::KeyCommand(UINT iMessage) {
|
||||
case SCI_TAB:
|
||||
AutoCompleteCompleted();
|
||||
return 0;
|
||||
case SCI_NEWLINE:
|
||||
AutoCompleteCompleted();
|
||||
return 0;
|
||||
|
||||
default:
|
||||
ac.Cancel();
|
||||
@@ -155,15 +167,30 @@ int ScintillaBase::KeyCommand(UINT iMessage) {
|
||||
}
|
||||
|
||||
void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
|
||||
//Platform::DebugPrintf("AutoCOmplete %s\n", list);
|
||||
//Platform::DebugPrintf("AutoComplete %s\n", list);
|
||||
ct.CallTipCancel();
|
||||
|
||||
if (ac.chooseSingle) {
|
||||
if (list && !strchr(list, ac.GetSeparator())) {
|
||||
if (ac.ignoreCase) {
|
||||
SetEmptySelection(currentPos - lenEntered);
|
||||
pdoc->DeleteChars(currentPos, lenEntered);
|
||||
SetEmptySelection(currentPos);
|
||||
pdoc->InsertString(currentPos, list);
|
||||
SetEmptySelection(currentPos + strlen(list));
|
||||
} else {
|
||||
SetEmptySelection(currentPos);
|
||||
pdoc->InsertString(currentPos, list + lenEntered);
|
||||
SetEmptySelection(currentPos + strlen(list + lenEntered));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
ac.Start(wDraw, idAutoComplete, currentPos, lenEntered);
|
||||
|
||||
PRectangle rcClient = GetClientRectangle();
|
||||
Point pt = LocationFromPosition(currentPos-lenEntered);
|
||||
|
||||
//Platform::DebugPrintf("Auto complete %x\n", lbAutoComplete);
|
||||
int heightLB = 100;
|
||||
int widthLB = 100;
|
||||
if (pt.x >= rcClient.right - widthLB) {
|
||||
@@ -186,16 +213,18 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
|
||||
rcac.right = rcac.left + widthLB;
|
||||
rcac.bottom = Platform::Minimum(rcac.top + heightLB, rcClient.bottom);
|
||||
ac.lb.SetPositionRelative(rcac, wMain);
|
||||
ac.lb.SetFont(vs.styles[0].font);
|
||||
ac.lb.SetFont(vs.styles[STYLE_DEFAULT].font);
|
||||
ac.lb.SetAverageCharWidth(vs.styles[STYLE_DEFAULT].aveCharWidth);
|
||||
|
||||
int maxStrLen = ac.SetList(list);
|
||||
ac.SetList(list);
|
||||
|
||||
// Fiddle the position of the list so it is right next to the target and wide enough for all its strings
|
||||
PRectangle rcList = ac.lb.GetPosition();
|
||||
PRectangle rcList = ac.lb.GetDesiredRect();
|
||||
int heightAlloced = rcList.bottom - rcList.top;
|
||||
widthLB = Platform::Maximum(widthLB, rcList.right - rcList.left);
|
||||
// Make an allowance for large strings in list
|
||||
rcList.left = pt.x - 5;
|
||||
rcList.right = rcList.left + Platform::Maximum(widthLB, maxStrLen * 8 + 16);
|
||||
rcList.right = rcList.left + widthLB;
|
||||
if (pt.y >= rcClient.bottom - heightLB && // Wont fit below.
|
||||
pt.y >= (rcClient.bottom + rcClient.top) / 2) { // and there is more room above.
|
||||
rcList.top = pt.y - heightAlloced;
|
||||
@@ -204,8 +233,10 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
|
||||
}
|
||||
rcList.bottom = rcList.top + heightAlloced;
|
||||
ac.lb.SetPositionRelative(rcList, wMain);
|
||||
//lbAutoComplete.SetPosition(rcList);
|
||||
ac.Show();
|
||||
if (lenEntered != 0) {
|
||||
AutoCompleteMoveToCurrentWord();
|
||||
}
|
||||
}
|
||||
|
||||
void ScintillaBase::AutoCompleteCancel() {
|
||||
@@ -216,36 +247,63 @@ void ScintillaBase::AutoCompleteMove(int delta) {
|
||||
ac.Move(delta);
|
||||
}
|
||||
|
||||
void ScintillaBase::AutoCompleteMoveToCurrentWord() {
|
||||
char wordCurrent[1000];
|
||||
int i;
|
||||
int startWord = ac.posStart - ac.startLen;
|
||||
for (i = startWord; i < currentPos; i++)
|
||||
wordCurrent[i - startWord] = pdoc->CharAt(i);
|
||||
wordCurrent[i - startWord] = '\0';
|
||||
ac.Select(wordCurrent);
|
||||
}
|
||||
|
||||
void ScintillaBase::AutoCompleteChanged(char ch) {
|
||||
if (currentPos <= ac.posStart) {
|
||||
if (ac.IsFillUpChar(ch)) {
|
||||
AutoCompleteCompleted(ch);
|
||||
} else if (currentPos <= ac.posStart - ac.startLen) {
|
||||
ac.Cancel();
|
||||
} else if (ac.cancelAtStartPos && currentPos <= ac.posStart) {
|
||||
ac.Cancel();
|
||||
} else if (ac.IsStopChar(ch)) {
|
||||
ac.Cancel();
|
||||
} else {
|
||||
char wordCurrent[1000];
|
||||
int i;
|
||||
int startWord = ac.posStart - ac.startLen;
|
||||
for (i = startWord; i < currentPos; i++)
|
||||
wordCurrent[i - startWord] = pdoc->CharAt(i);
|
||||
wordCurrent[i - startWord] = '\0';
|
||||
ac.Select(wordCurrent);
|
||||
AutoCompleteMoveToCurrentWord();
|
||||
}
|
||||
}
|
||||
|
||||
void ScintillaBase::AutoCompleteCompleted() {
|
||||
void ScintillaBase::AutoCompleteCompleted(char fillUp/*='\0'*/) {
|
||||
int item = ac.lb.GetSelection();
|
||||
char selected[200];
|
||||
char selected[1000];
|
||||
if (item != -1) {
|
||||
ac.lb.GetValue(item, selected, sizeof(selected));
|
||||
}
|
||||
ac.Cancel();
|
||||
if (currentPos != ac.posStart) {
|
||||
pdoc->DeleteChars(ac.posStart, currentPos - ac.posStart);
|
||||
}
|
||||
SetEmptySelection(ac.posStart);
|
||||
if (item != -1) {
|
||||
pdoc->InsertString(currentPos, selected + ac.startLen);
|
||||
SetEmptySelection(currentPos + strlen(selected + ac.startLen));
|
||||
|
||||
if (ac.ignoreCase) {
|
||||
if (currentPos != ac.posStart) {
|
||||
pdoc->DeleteChars(ac.posStart, currentPos - ac.posStart);
|
||||
}
|
||||
SetEmptySelection(ac.posStart - ac.startLen);
|
||||
pdoc->DeleteChars(ac.posStart - ac.startLen, ac.startLen);
|
||||
if (item != -1) {
|
||||
SString piece = selected;
|
||||
if (fillUp)
|
||||
piece += fillUp;
|
||||
pdoc->InsertString(currentPos, piece.c_str());
|
||||
SetEmptySelection(currentPos + piece.length());
|
||||
}
|
||||
} else {
|
||||
if (currentPos != ac.posStart) {
|
||||
pdoc->DeleteChars(ac.posStart, currentPos - ac.posStart);
|
||||
}
|
||||
SetEmptySelection(ac.posStart);
|
||||
if (item != -1) {
|
||||
SString piece = selected + ac.startLen;
|
||||
if (fillUp)
|
||||
piece += fillUp;
|
||||
pdoc->InsertString(currentPos, piece.c_str());
|
||||
SetEmptySelection(currentPos + piece.length());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,16 +314,21 @@ void ScintillaBase::ContextMenu(Point pt) {
|
||||
AddToPopUp("");
|
||||
AddToPopUp("Cut", idcmdCut, currentPos != anchor);
|
||||
AddToPopUp("Copy", idcmdCopy, currentPos != anchor);
|
||||
AddToPopUp("Paste", idcmdPaste, WndProc(EM_CANPASTE, 0, 0));
|
||||
AddToPopUp("Paste", idcmdPaste, WndProc(SCI_CANPASTE, 0, 0));
|
||||
AddToPopUp("Delete", idcmdDelete, currentPos != anchor);
|
||||
AddToPopUp("");
|
||||
AddToPopUp("Select All", idcmdSelectAll);
|
||||
popup.Show(pt, wMain);
|
||||
}
|
||||
|
||||
void ScintillaBase::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt) {
|
||||
void ScintillaBase::CancelModes() {
|
||||
AutoCompleteCancel();
|
||||
ct.CallTipCancel();
|
||||
Editor::CancelModes();
|
||||
}
|
||||
|
||||
void ScintillaBase::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt) {
|
||||
CancelModes();
|
||||
Editor::ButtonDown(pt, curTime, shift, ctrl, alt);
|
||||
}
|
||||
|
||||
@@ -276,33 +339,33 @@ void ScintillaBase::Colourise(int start, int end) {
|
||||
end = lengthDoc;
|
||||
int len = end - start;
|
||||
|
||||
PropSet props;
|
||||
|
||||
StylingContext styler(wMain.GetID(), props);
|
||||
//WindowAccessor styler(wMain.GetID(), props);
|
||||
DocumentAccessor styler(pdoc, props);
|
||||
|
||||
int styleStart = 0;
|
||||
if (start > 0)
|
||||
styleStart = styler.StyleAt(start - 1);
|
||||
|
||||
ColouriseDoc(pdoc->dbcsCodePage, start, len, styleStart, lexLanguage, keyWordLists, styler);
|
||||
styler.SetCodePage(pdoc->dbcsCodePage);
|
||||
|
||||
LexerModule::Colourise(start, len, styleStart, lexLanguage, keyWordLists, styler);
|
||||
styler.Flush();
|
||||
}
|
||||
#endif
|
||||
|
||||
void ScintillaBase::NotifyStyleNeeded(int endStyleNeeded) {
|
||||
void ScintillaBase::NotifyStyleToNeeded(int endStyleNeeded) {
|
||||
#ifdef SCI_LEXER
|
||||
if (lexLanguage != SCLEX_CONTAINER) {
|
||||
int endStyled = Platform::SendScintilla(wMain.GetID(), SCI_GETENDSTYLED, 0, 0);
|
||||
int lineEndStyled = Platform::SendScintilla(wMain.GetID(), EM_LINEFROMCHAR, endStyled, 0);
|
||||
endStyled = Platform::SendScintilla(wMain.GetID(), EM_LINEINDEX, lineEndStyled, 0);
|
||||
int lineEndStyled = Platform::SendScintilla(wMain.GetID(), SCI_LINEFROMPOSITION, endStyled, 0);
|
||||
endStyled = Platform::SendScintilla(wMain.GetID(), SCI_POSITIONFROMLINE, lineEndStyled, 0);
|
||||
Colourise(endStyled, endStyleNeeded);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
Editor::NotifyStyleNeeded(endStyleNeeded);
|
||||
Editor::NotifyStyleToNeeded(endStyleNeeded);
|
||||
}
|
||||
|
||||
LRESULT ScintillaBase::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
|
||||
long ScintillaBase::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
|
||||
switch (iMessage) {
|
||||
case SCI_AUTOCSHOW:
|
||||
AutoCompleteStart(wParam, reinterpret_cast<const char *>(lParam));
|
||||
@@ -322,16 +385,52 @@ LRESULT ScintillaBase::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
|
||||
AutoCompleteCompleted();
|
||||
break;
|
||||
|
||||
case SCI_AUTOCSETSEPARATOR:
|
||||
ac.SetSeparator(static_cast<char>(wParam));
|
||||
break;
|
||||
|
||||
case SCI_AUTOCGETSEPARATOR:
|
||||
return ac.GetSeparator();
|
||||
|
||||
case SCI_AUTOCSTOPS:
|
||||
ac.SetStopChars(reinterpret_cast<char *>(lParam));
|
||||
break;
|
||||
|
||||
case SCI_AUTOCSELECT:
|
||||
ac.Select(reinterpret_cast<char *>(lParam));
|
||||
break;
|
||||
|
||||
case SCI_AUTOCSETCANCELATSTART:
|
||||
ac.cancelAtStartPos = wParam;
|
||||
break;
|
||||
|
||||
case SCI_AUTOCGETCANCELATSTART:
|
||||
return ac.cancelAtStartPos;
|
||||
|
||||
case SCI_AUTOCSETFILLUPS:
|
||||
ac.SetFillUpChars(reinterpret_cast<char *>(lParam));
|
||||
break;
|
||||
|
||||
case SCI_AUTOCSETCHOOSESINGLE:
|
||||
ac.chooseSingle = wParam;
|
||||
break;
|
||||
|
||||
case SCI_AUTOCGETCHOOSESINGLE:
|
||||
return ac.chooseSingle;
|
||||
|
||||
case SCI_AUTOCSETIGNORECASE:
|
||||
ac.ignoreCase = wParam;
|
||||
break;
|
||||
|
||||
case SCI_AUTOCGETIGNORECASE:
|
||||
return ac.ignoreCase;
|
||||
|
||||
case SCI_CALLTIPSHOW: {
|
||||
AutoCompleteCancel();
|
||||
if (!ct.wCallTip.Created()) {
|
||||
PRectangle rc = ct.CallTipStart(currentPos, LocationFromPosition(wParam),
|
||||
reinterpret_cast<char *>(lParam),
|
||||
vs.styles[0].fontName, vs.styles[0].size);
|
||||
vs.styles[STYLE_DEFAULT].fontName, vs.styles[STYLE_DEFAULT].size);
|
||||
// If the call-tip window would be out of the client
|
||||
// space, adjust so it displays above the text.
|
||||
PRectangle rcClient = GetClientRectangle();
|
||||
@@ -377,6 +476,7 @@ LRESULT ScintillaBase::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
|
||||
|
||||
case SCI_COLOURISE:
|
||||
Colourise(wParam, lParam);
|
||||
Redraw();
|
||||
break;
|
||||
|
||||
case SCI_SETPROPERTY:
|
||||
@@ -385,7 +485,7 @@ LRESULT ScintillaBase::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
|
||||
break;
|
||||
|
||||
case SCI_SETKEYWORDS:
|
||||
if ((wParam >= 0) && (wParam < numWordLists)) {
|
||||
if (wParam < numWordLists) {
|
||||
keyWordLists[wParam]->Clear();
|
||||
keyWordLists[wParam]->Set(reinterpret_cast<const char *>(lParam));
|
||||
}
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
#define SCINTILLABASE_H
|
||||
|
||||
class ScintillaBase : public Editor {
|
||||
// Private so ScintillaBase objects can not be copied
|
||||
ScintillaBase(const ScintillaBase &) : Editor() {}
|
||||
ScintillaBase &operator=(const ScintillaBase &) { return *this; }
|
||||
protected:
|
||||
// Enumeration of commands and child windows
|
||||
enum {
|
||||
@@ -42,15 +45,17 @@ protected:
|
||||
|
||||
virtual void RefreshColourPalette(Palette &pal, bool want);
|
||||
|
||||
virtual void AddChar(char ch);
|
||||
virtual void AddCharUTF(char *s, unsigned int len);
|
||||
void Command(int cmdId);
|
||||
virtual int KeyCommand(UINT iMessage);
|
||||
virtual void CancelModes();
|
||||
virtual int KeyCommand(unsigned int iMessage);
|
||||
|
||||
void AutoCompleteStart(int lenEntered, const char *list);
|
||||
void AutoCompleteCancel();
|
||||
void AutoCompleteMove(int delta);
|
||||
void AutoCompleteChanged(char ch=0);
|
||||
void AutoCompleteCompleted();
|
||||
void AutoCompleteCompleted(char fillUp='\0');
|
||||
void AutoCompleteMoveToCurrentWord();
|
||||
|
||||
virtual void CreateCallTipWindow(PRectangle rc) = 0;
|
||||
|
||||
@@ -59,10 +64,10 @@ protected:
|
||||
|
||||
virtual void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt);
|
||||
|
||||
virtual void NotifyStyleNeeded(int endStyleNeeded);
|
||||
virtual void NotifyStyleToNeeded(int endStyleNeeded);
|
||||
public:
|
||||
// Public so scintilla_send_message can use it
|
||||
virtual LRESULT WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam);
|
||||
virtual long WndProc(unsigned int iMessage, unsigned long wParam, long lParam);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,49 +7,111 @@
|
||||
|
||||
#include "Platform.h"
|
||||
|
||||
#include "Scintilla.h"
|
||||
#include "Style.h"
|
||||
|
||||
Style::Style() {
|
||||
Clear();
|
||||
aliasOfDefaultFont = true;
|
||||
Clear(Colour(0,0,0), Colour(0xff,0xff,0xff),
|
||||
Platform::DefaultFontSize(), 0, SC_CHARSET_DEFAULT,
|
||||
false, false, false, false, true);
|
||||
}
|
||||
|
||||
Style::Style(const Style &source) {
|
||||
Clear(Colour(0,0,0), Colour(0xff,0xff,0xff),
|
||||
0, 0, 0,
|
||||
false, false, false, false, true);
|
||||
fore.desired = source.fore.desired;
|
||||
back.desired = source.back.desired;
|
||||
characterSet = source.characterSet;
|
||||
bold = source.bold;
|
||||
italic = source.italic;
|
||||
size = source.size;
|
||||
eolFilled = source.eolFilled;
|
||||
underline = source.underline;
|
||||
visible = source.visible;
|
||||
}
|
||||
|
||||
Style::~Style() {
|
||||
font.Release();
|
||||
if (aliasOfDefaultFont)
|
||||
font.SetID(0);
|
||||
else
|
||||
font.Release();
|
||||
aliasOfDefaultFont = false;
|
||||
}
|
||||
|
||||
Style &Style::operator=(const Style &source) {
|
||||
if (this == &source)
|
||||
return *this;
|
||||
Clear();
|
||||
Clear(Colour(0,0,0), Colour(0xff,0xff,0xff),
|
||||
0, 0, SC_CHARSET_DEFAULT,
|
||||
false, false, false, false, true);
|
||||
fore.desired = source.fore.desired;
|
||||
back.desired = source.back.desired;
|
||||
characterSet = source.characterSet;
|
||||
bold = source.bold;
|
||||
italic = source.italic;
|
||||
size = source.size;
|
||||
strcpy(fontName, source.fontName);
|
||||
eolFilled = source.eolFilled;
|
||||
underline = source.underline;
|
||||
visible = source.visible;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Style::Clear(Colour fore_, Colour back_, int size_, const char *fontName_,
|
||||
bool bold_, bool italic_, bool eolFilled_) {
|
||||
void Style::Clear(Colour fore_, Colour back_, int size_,
|
||||
const char *fontName_, int characterSet_,
|
||||
bool bold_, bool italic_, bool eolFilled_, bool underline_, bool visible_) {
|
||||
fore.desired = fore_;
|
||||
back.desired = back_;
|
||||
characterSet = characterSet_;
|
||||
bold = bold_;
|
||||
italic = italic_;
|
||||
size = size_;
|
||||
strcpy(fontName, fontName_);
|
||||
fontName = fontName_;
|
||||
eolFilled = eolFilled_;
|
||||
font.Release();
|
||||
underline = underline_;
|
||||
visible = visible_;
|
||||
if (aliasOfDefaultFont)
|
||||
font.SetID(0);
|
||||
else
|
||||
font.Release();
|
||||
aliasOfDefaultFont = false;
|
||||
}
|
||||
|
||||
void Style::Realise(Surface &surface, int zoomLevel) {
|
||||
bool Style::EquivalentFontTo(const Style *other) const {
|
||||
if (bold != other->bold ||
|
||||
italic != other->italic ||
|
||||
size != other->size ||
|
||||
characterSet != other->characterSet)
|
||||
return false;
|
||||
if (fontName == other->fontName)
|
||||
return true;
|
||||
if (!fontName)
|
||||
return false;
|
||||
if (!other->fontName)
|
||||
return false;
|
||||
return strcmp(fontName, other->fontName) == 0;
|
||||
}
|
||||
|
||||
void Style::Realise(Surface &surface, int zoomLevel, Style *defaultStyle) {
|
||||
int sizeZoomed = size + zoomLevel;
|
||||
if (sizeZoomed <= 2) // Hangs if sizeZoomed <= 1
|
||||
sizeZoomed = 2;
|
||||
|
||||
int deviceHeight = (sizeZoomed * surface.LogPixelsY()) / 72;
|
||||
font.Create(fontName, deviceHeight, bold, italic);
|
||||
|
||||
if (aliasOfDefaultFont)
|
||||
font.SetID(0);
|
||||
else
|
||||
font.Release();
|
||||
int deviceHeight = surface.DeviceHeightFont(sizeZoomed);
|
||||
aliasOfDefaultFont = defaultStyle &&
|
||||
(EquivalentFontTo(defaultStyle) || !fontName);
|
||||
if (aliasOfDefaultFont) {
|
||||
font.SetID(defaultStyle->font.GetID());
|
||||
} else if (fontName) {
|
||||
font.Create(fontName, characterSet, deviceHeight, bold, italic);
|
||||
} else {
|
||||
font.SetID(0);
|
||||
}
|
||||
|
||||
ascent = surface.Ascent(font);
|
||||
descent = surface.Descent(font);
|
||||
|
||||
@@ -10,11 +10,15 @@ class Style {
|
||||
public:
|
||||
ColourPair fore;
|
||||
ColourPair back;
|
||||
bool aliasOfDefaultFont;
|
||||
bool bold;
|
||||
bool italic;
|
||||
int size;
|
||||
char fontName[100];
|
||||
const char *fontName;
|
||||
int characterSet;
|
||||
bool eolFilled;
|
||||
bool underline;
|
||||
bool visible;
|
||||
|
||||
Font font;
|
||||
unsigned int lineHeight;
|
||||
@@ -25,13 +29,15 @@ public:
|
||||
unsigned int spaceWidth;
|
||||
|
||||
Style();
|
||||
Style(const Style &source);
|
||||
~Style();
|
||||
Style &operator=(const Style &source);
|
||||
void Clear(Colour fore_=Colour(0,0,0), Colour back_=Colour(0xff,0xff,0xff),
|
||||
int size_=Platform::DefaultFontSize(),
|
||||
const char *fontName_=Platform::DefaultFont(),
|
||||
bool bold_=false, bool italic_=false, bool eolFilled_=false);
|
||||
void Realise(Surface &surface, int zoomLevel);
|
||||
void Clear(Colour fore_, Colour back_,
|
||||
int size_,
|
||||
const char *fontName_, int characterSet_,
|
||||
bool bold_, bool italic_, bool eolFilled_, bool underline_, bool visible_);
|
||||
bool EquivalentFontTo(const Style *other) const;
|
||||
void Realise(Surface &surface, int zoomLevel, Style *defaultStyle=0);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
77
contrib/src/stc/scintilla/src/UniConversion.cxx
Normal file
@@ -0,0 +1,77 @@
|
||||
// UniConversion.h - functions to handle UFT-8 and UCS-2 strings
|
||||
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "UniConversion.h"
|
||||
|
||||
unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen) {
|
||||
unsigned int len = 0;
|
||||
for (unsigned int i = 0; i < tlen && uptr[i]; i++) {
|
||||
unsigned int uch = uptr[i];
|
||||
if (uch < 0x80)
|
||||
len++;
|
||||
else if (uch < 0x800)
|
||||
len+=2;
|
||||
else
|
||||
len +=3;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
void UTF8FromUCS2(const wchar_t *uptr, unsigned int tlen, char *putf, unsigned int len) {
|
||||
int k = 0;
|
||||
for (unsigned int i = 0; i < tlen && uptr[i]; i++) {
|
||||
unsigned int uch = uptr[i];
|
||||
if (uch < 0x80) {
|
||||
putf[k++] = static_cast<char>(uch);
|
||||
} else if (uch < 0x800) {
|
||||
putf[k++] = static_cast<char>(0xC0 | (uch >> 6));
|
||||
putf[k++] = static_cast<char>(0x80 | (uch & 0x3f));
|
||||
} else {
|
||||
putf[k++] = static_cast<char>(0xE0 | (uch >> 12));
|
||||
putf[k++] = static_cast<char>(0x80 | ((uch >> 6) & 0x3f));
|
||||
putf[k++] = static_cast<char>(0x80 | (uch & 0x3f));
|
||||
}
|
||||
}
|
||||
putf[len] = '\0';
|
||||
}
|
||||
|
||||
unsigned int UCS2Length(const char *s, unsigned int len) {
|
||||
unsigned int ulen = 0;
|
||||
for (unsigned int i=0;i<len;i++) {
|
||||
unsigned char ch = static_cast<unsigned char>(s[i]);
|
||||
if ((ch < 0x80) || (ch > (0x80 + 0x40)))
|
||||
ulen++;
|
||||
}
|
||||
return ulen;
|
||||
}
|
||||
|
||||
unsigned int UCS2FromUTF8(const char *s, unsigned int len, wchar_t *tbuf, unsigned int tlen) {
|
||||
#ifdef USE_API
|
||||
return ::MultiByteToWideChar(CP_UTF8, 0, s, len, tbuf, tlen);
|
||||
#else
|
||||
unsigned int ui=0;
|
||||
const unsigned char *us = reinterpret_cast<const unsigned char *>(s);
|
||||
unsigned int i=0;
|
||||
while ((i<len) && (ui<tlen)) {
|
||||
unsigned char ch = us[i++];
|
||||
if (ch < 0x80) {
|
||||
tbuf[ui] = ch;
|
||||
} else if (ch < 0x80 + 0x40 + 0x20) {
|
||||
tbuf[ui] = static_cast<wchar_t>((ch & 0x1F) << 6);
|
||||
ch = us[i++];
|
||||
tbuf[ui] = static_cast<wchar_t>(tbuf[ui] + (ch & 0x7F));
|
||||
} else {
|
||||
tbuf[ui] = static_cast<wchar_t>((ch & 0xF) << 12);
|
||||
ch = us[i++];
|
||||
tbuf[ui] = static_cast<wchar_t>(tbuf[ui] + ((ch & 0x7F) << 6));
|
||||
ch = us[i++];
|
||||
tbuf[ui] = static_cast<wchar_t>(tbuf[ui] + (ch & 0x7F));
|
||||
}
|
||||
ui++;
|
||||
}
|
||||
return ui;
|
||||
#endif
|
||||
}
|
||||