diff -Nru scite-2.25/debian/changelog scite-3.0.2/debian/changelog --- scite-2.25/debian/changelog 2012-01-03 03:12:51.000000000 +0000 +++ scite-3.0.2/debian/changelog 2011-12-19 08:41:54.000000000 +0000 @@ -1,8 +1,10 @@ -scite (2.25-1build1) precise; urgency=low +scite (3.0.2-1) unstable; urgency=low - * No-change rebuild to drop spurious libsfgcc1 dependency on armhf. + * new upstream release (closes: #618346) + * move to debhelper 8, drop dpatch + * drop custom desktop file and config customization patches - -- Adam Conrad Fri, 02 Dec 2011 21:20:14 -0700 + -- Michael Vogt Mon, 19 Dec 2011 09:00:56 +0100 scite (2.25-1) unstable; urgency=low diff -Nru scite-2.25/debian/compat scite-3.0.2/debian/compat --- scite-2.25/debian/compat 2012-01-03 03:12:51.000000000 +0000 +++ scite-3.0.2/debian/compat 2011-12-19 08:41:54.000000000 +0000 @@ -1 +1 @@ -5 +8 diff -Nru scite-2.25/debian/control scite-3.0.2/debian/control --- scite-2.25/debian/control 2012-01-03 03:12:51.000000000 +0000 +++ scite-3.0.2/debian/control 2011-12-19 08:41:54.000000000 +0000 @@ -2,7 +2,7 @@ Section: editors Priority: optional Maintainer: Michael Vogt -Build-Depends: debhelper (>= 5.0.0), libgtk2.0-dev, libglib2.0-dev, dpatch +Build-Depends: debhelper (>= 8.0.0), libgtk2.0-dev, libglib2.0-dev Standards-Version: 3.7.2 Vcs-Bzr: http://code.launchpad.net/~mvo/scite/debian-sid diff -Nru scite-2.25/debian/links scite-3.0.2/debian/links --- scite-2.25/debian/links 1970-01-01 00:00:00.000000000 +0000 +++ scite-3.0.2/debian/links 2011-12-19 08:41:54.000000000 +0000 @@ -0,0 +1 @@ +usr/bin/scite usr/bin/SciTE diff -Nru scite-2.25/debian/patches/00list scite-3.0.2/debian/patches/00list --- scite-2.25/debian/patches/00list 2012-01-03 03:12:51.000000000 +0000 +++ scite-3.0.2/debian/patches/00list 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -01_desktop_file.dpatch -02_config.dpatch diff -Nru scite-2.25/debian/patches/01_desktop_file.dpatch scite-3.0.2/debian/patches/01_desktop_file.dpatch --- scite-2.25/debian/patches/01_desktop_file.dpatch 2012-01-03 03:12:51.000000000 +0000 +++ scite-3.0.2/debian/patches/01_desktop_file.dpatch 1970-01-01 00:00:00.000000000 +0000 @@ -1,163 +0,0 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run -## 01_config.dpatch by -## -## All lines beginning with `## DP:' are a description of the patch. -## DP: No description. - -@DPATCH@ -diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' scite-2.25~/scite/gtk/makefile scite-2.25/scite/gtk/makefile ---- scite-2.25~/scite/gtk/makefile 2011-03-17 23:42:00.000000000 +0100 -+++ scite-2.25/scite/gtk/makefile 2011-04-14 12:15:05.601428798 +0200 -@@ -109,7 +109,7 @@ - done - - ifdef gnomeprefix -- $(INSTALL) -m 755 -D SciTE.desktop $(DESTDIR)$(datadir)/applications/SciTE.desktop -+ #$(INSTALL) -m 755 -D SciTE.desktop $(DESTDIR)$(datadir)/applications/SciTE.desktop - $(INSTALL) -m 644 -D Sci48M.png $(DESTDIR)$(pixmapdir)/Sci48M.png - endif - -diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' scite-2.25~/scite/gtk/makefile.rej scite-2.25/scite/gtk/makefile.rej ---- scite-2.25~/scite/gtk/makefile.rej 1970-01-01 01:00:00.000000000 +0100 -+++ scite-2.25/scite/gtk/makefile.rej 2011-04-14 12:14:14.052576354 +0200 -@@ -0,0 +1,14 @@ -+--- scite/gtk/makefile 2004-08-20 10:21:00.000000000 +0200 -++++ tmp/dpep.Px0XCy/scite-1.63/scite/gtk/makefile 2005-05-06 12:29:09.931800784 +0200 -+@@ -123,9 +123,9 @@ -+ -+ ifdef gnomeprefix -+ ifdef GTK2 -+- $(INSTALL) -m 755 -D SciTE.desktop $(DESTDIR)$(datadir)/applications/SciTE.desktop -++# $(INSTALL) -m 755 -D SciTE.desktop $(DESTDIR)$(datadir)/applications/SciTE.desktop -+ else -+- $(INSTALL) -m 755 -D SciTE.desktop $(DESTDIR)$(datadir)/gnome/apps/Applications/SciTE.desktop -++# $(INSTALL) -m 755 -D SciTE.desktop $(DESTDIR)$(datadir)/gnome/apps/Applications/SciTE.desktop -+ endif -+ $(INSTALL) -m 644 -D Sci48M.png $(DESTDIR)$(pixmapdir)/Sci48M.png -+ endif -diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' scite-2.25~/scite/gtk/makefile.~1~ scite-2.25/scite/gtk/makefile.~1~ ---- scite-2.25~/scite/gtk/makefile.~1~ 1970-01-01 01:00:00.000000000 +0100 -+++ scite-2.25/scite/gtk/makefile.~1~ 2011-03-17 23:42:00.000000000 +0100 -@@ -0,0 +1,122 @@ -+# Make file for SciTE on Linux or compatible OS -+# Copyright 1998-2010 by Neil Hodgson -+# The License.txt file describes the conditions under which this software may be distributed. -+# This makefile assumes GCC 4.x is used and changes will be needed to use other compilers. -+# GNU make does not like \r\n line endings so should be saved to CVS in binary form. -+ -+.SUFFIXES: .cxx .o .h .a .c -+ifdef CLANG -+CC = clang -+CCOMP = clang -+else -+CC = g++ -+CCOMP = gcc -+endif -+AR = ar -+ -+# For the Gnome desktop stuff to work, prefix must point to where Gnome thinks it is. -+CONFIGFLAGS:=$(shell pkg-config --cflags gtk+-2.0) -+CONFIGLIB:=$(shell pkg-config --libs gtk+-2.0 gthread-2.0) -+CONFIGTHREADS:= -+gnomeprefix:=$(shell pkg-config --variable=prefix gtk+-2.0 2>/dev/null) -+ifndef prefix -+ifdef gnomeprefix -+ prefix=$(gnomeprefix) -+else -+ prefix=/usr -+endif -+endif -+datadir=$(prefix)/share -+pixmapdir=$(datadir)/pixmaps -+bindir=$(prefix)/bin -+SYSCONF_PATH=$(prefix)/share/scite -+ -+INSTALL=install -+ -+PROG = ../bin/SciTE -+ -+all: $(PROG) -+ -+vpath %.h ../src ../../scintilla/include -+vpath %.cxx ../src -+ -+INCLUDEDIRS=-I ../../scintilla/include -I ../src -+#~ DEPRECATED=-DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -+CXXBASEFLAGS=-W -Wall -Wno-char-subscripts -pedantic -DGTK -DSCI_LEXER -DPIXMAP_PATH=\"$(pixmapdir)\" -DSYSCONF_PATH=\"$(SYSCONF_PATH)\" $(INCLUDEDIRS) $(DEPRECATED) -+ -+ifdef DEBUG -+CXXTFLAGS=-DDEBUG -g $(CXXBASEFLAGS) -+else -+CXXTFLAGS=-DNDEBUG -Os $(CXXBASEFLAGS) -+endif -+ -+ifndef NO_LUA -+LUA_CORE_OBJS = lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \ -+ lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o \ -+ ltable.o ltm.o lundump.o lvm.o lzio.o -+ -+LUA_LIB_OBJS = lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o ltablib.o \ -+ lstrlib.o loadlib.o loslib.o linit.o -+ -+LUA_OBJS = LuaExtension.o $(LUA_CORE_OBJS) $(LUA_LIB_OBJS) -+ -+INCLUDEDIRS=-I ../../scintilla/include -I ../src -I../lua/include -+$(LUA_CORE_OBJS): ../lua/src/*.c -+ $(CCOMP) $(INCLUDEDIRS) -DLUA_USE_POSIX $(CXXTFLAGS) -c ../lua/src/*.c -+$(LUA_LIB_OBJS): ../lua/src/lib/*.c -+ $(CCOMP) $(INCLUDEDIRS) -DLUA_USE_POSIX $(CXXTFLAGS) -c ../lua/src/lib/*.c -+CXXFLAGS=$(CXXTFLAGS) -+else -+CXXFLAGS=$(CXXTFLAGS) -DNO_LUA -+endif -+ -+ifeq ($(shell uname), Darwin) -+CXXFLAGS:=$(CXXFLAGS) -Dunix -+endif -+ -+.cxx.o: -+ $(CC) $(CONFIGFLAGS) $(CXXFLAGS) -c $< -o $@ -+ -+clean: -+ rm -f *.o $(PROG) -+ -+deps: -+ $(CC) -MM $(CONFIGFLAGS) $(CXXFLAGS) *.cxx ../src/*.cxx | sed -e 's/\/usr.* //' | grep [a-zA-Z] >deps.mak -+ -+# make should be run in ../../scintilla/gtk to compile all the lexers. -+COMPLIB=../../scintilla/bin/scintilla.a -+ -+$(PROG): SciTEGTK.o GUIGTK.o Widget.o \ -+FilePath.o SciTEBase.o SciTEBuffers.o SciTEIO.o StringList.o Exporters.o StringHelpers.o \ -+PropSetFile.o MultiplexExtension.o DirectorExtension.o SciTEProps.o StyleWriter.o Utf8_16.o \ -+ JobQueue.o GTKMutex.o IFaceTable.o $(COMPLIB) $(LUA_OBJS) -+ $(CC) `$(CONFIGTHREADS)` -rdynamic -Wl,--as-needed -Wl,--version-script lua.vers -DGTK $^ -o $@ $(CONFIGLIB) -ldl -lstdc++ -+ -+# Automatically generate header dependencies with "make deps" -+include deps.mak -+ -+# The two last install commands will fail if Gnome is not installed or is not at $(prefix). -+# This is OK - just means no SciTE in the Gnome Applications menu -+# Dead: install -D SciTEGTK.properties $(SYSCONF_PATH)/SciTEGlobal.properties -+install: -+ $(INSTALL) -m 755 -d $(DESTDIR)$(bindir) $(DESTDIR)$(SYSCONF_PATH) -+ -+ $(INSTALL) -m 755 $(PROG) $(DESTDIR)$(bindir) -+ -+ for files in ../src/*.properties ../doc/*.html ../doc/SciTEIco.png ../doc/PrintHi.png; \ -+ do \ -+ $(INSTALL) -m 644 $$files $(DESTDIR)$(SYSCONF_PATH); \ -+ done -+ -+ifdef gnomeprefix -+ $(INSTALL) -m 755 -D SciTE.desktop $(DESTDIR)$(datadir)/applications/SciTE.desktop -+ $(INSTALL) -m 644 -D Sci48M.png $(DESTDIR)$(pixmapdir)/Sci48M.png -+endif -+ -+uninstall: -+ rm -f $(DESTDIR)$(bindir)/SciTE -+ rm -rf $(DESTDIR)$(SYSCONF_PATH) -+ifdef gnomeprefix -+ rm -f $(DESTDIR)$(datadir)/applications/SciTE.desktop -+ rm -f $(DESTDIR)$(pixmapdir)/Sci48M.png -+endif diff -Nru scite-2.25/debian/patches/01_desktop_file.patch scite-3.0.2/debian/patches/01_desktop_file.patch --- scite-2.25/debian/patches/01_desktop_file.patch 1970-01-01 00:00:00.000000000 +0000 +++ scite-3.0.2/debian/patches/01_desktop_file.patch 2011-12-19 08:41:54.000000000 +0000 @@ -0,0 +1,155 @@ +--- scite-2.25~/scite/gtk/makefile 2011-03-17 23:42:00.000000000 +0100 ++++ scite-2.25/scite/gtk/makefile 2011-04-14 12:15:05.601428798 +0200 +@@ -109,7 +109,7 @@ + done + + ifdef gnomeprefix +- $(INSTALL) -m 755 -D SciTE.desktop $(DESTDIR)$(datadir)/applications/SciTE.desktop ++ #$(INSTALL) -m 755 -D SciTE.desktop $(DESTDIR)$(datadir)/applications/SciTE.desktop + $(INSTALL) -m 644 -D Sci48M.png $(DESTDIR)$(pixmapdir)/Sci48M.png + endif + +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' scite-2.25~/scite/gtk/makefile.rej scite-2.25/scite/gtk/makefile.rej +--- scite-2.25~/scite/gtk/makefile.rej 1970-01-01 01:00:00.000000000 +0100 ++++ scite-2.25/scite/gtk/makefile.rej 2011-04-14 12:14:14.052576354 +0200 +@@ -0,0 +1,14 @@ ++--- scite/gtk/makefile 2004-08-20 10:21:00.000000000 +0200 +++++ tmp/dpep.Px0XCy/scite-1.63/scite/gtk/makefile 2005-05-06 12:29:09.931800784 +0200 ++@@ -123,9 +123,9 @@ ++ ++ ifdef gnomeprefix ++ ifdef GTK2 ++- $(INSTALL) -m 755 -D SciTE.desktop $(DESTDIR)$(datadir)/applications/SciTE.desktop +++# $(INSTALL) -m 755 -D SciTE.desktop $(DESTDIR)$(datadir)/applications/SciTE.desktop ++ else ++- $(INSTALL) -m 755 -D SciTE.desktop $(DESTDIR)$(datadir)/gnome/apps/Applications/SciTE.desktop +++# $(INSTALL) -m 755 -D SciTE.desktop $(DESTDIR)$(datadir)/gnome/apps/Applications/SciTE.desktop ++ endif ++ $(INSTALL) -m 644 -D Sci48M.png $(DESTDIR)$(pixmapdir)/Sci48M.png ++ endif +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' scite-2.25~/scite/gtk/makefile.~1~ scite-2.25/scite/gtk/makefile.~1~ +--- scite-2.25~/scite/gtk/makefile.~1~ 1970-01-01 01:00:00.000000000 +0100 ++++ scite-2.25/scite/gtk/makefile.~1~ 2011-03-17 23:42:00.000000000 +0100 +@@ -0,0 +1,122 @@ ++# Make file for SciTE on Linux or compatible OS ++# Copyright 1998-2010 by Neil Hodgson ++# The License.txt file describes the conditions under which this software may be distributed. ++# This makefile assumes GCC 4.x is used and changes will be needed to use other compilers. ++# GNU make does not like \r\n line endings so should be saved to CVS in binary form. ++ ++.SUFFIXES: .cxx .o .h .a .c ++ifdef CLANG ++CC = clang ++CCOMP = clang ++else ++CC = g++ ++CCOMP = gcc ++endif ++AR = ar ++ ++# For the Gnome desktop stuff to work, prefix must point to where Gnome thinks it is. ++CONFIGFLAGS:=$(shell pkg-config --cflags gtk+-2.0) ++CONFIGLIB:=$(shell pkg-config --libs gtk+-2.0 gthread-2.0) ++CONFIGTHREADS:= ++gnomeprefix:=$(shell pkg-config --variable=prefix gtk+-2.0 2>/dev/null) ++ifndef prefix ++ifdef gnomeprefix ++ prefix=$(gnomeprefix) ++else ++ prefix=/usr ++endif ++endif ++datadir=$(prefix)/share ++pixmapdir=$(datadir)/pixmaps ++bindir=$(prefix)/bin ++SYSCONF_PATH=$(prefix)/share/scite ++ ++INSTALL=install ++ ++PROG = ../bin/SciTE ++ ++all: $(PROG) ++ ++vpath %.h ../src ../../scintilla/include ++vpath %.cxx ../src ++ ++INCLUDEDIRS=-I ../../scintilla/include -I ../src ++#~ DEPRECATED=-DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED ++CXXBASEFLAGS=-W -Wall -Wno-char-subscripts -pedantic -DGTK -DSCI_LEXER -DPIXMAP_PATH=\"$(pixmapdir)\" -DSYSCONF_PATH=\"$(SYSCONF_PATH)\" $(INCLUDEDIRS) $(DEPRECATED) ++ ++ifdef DEBUG ++CXXTFLAGS=-DDEBUG -g $(CXXBASEFLAGS) ++else ++CXXTFLAGS=-DNDEBUG -Os $(CXXBASEFLAGS) ++endif ++ ++ifndef NO_LUA ++LUA_CORE_OBJS = lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \ ++ lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o \ ++ ltable.o ltm.o lundump.o lvm.o lzio.o ++ ++LUA_LIB_OBJS = lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o ltablib.o \ ++ lstrlib.o loadlib.o loslib.o linit.o ++ ++LUA_OBJS = LuaExtension.o $(LUA_CORE_OBJS) $(LUA_LIB_OBJS) ++ ++INCLUDEDIRS=-I ../../scintilla/include -I ../src -I../lua/include ++$(LUA_CORE_OBJS): ../lua/src/*.c ++ $(CCOMP) $(INCLUDEDIRS) -DLUA_USE_POSIX $(CXXTFLAGS) -c ../lua/src/*.c ++$(LUA_LIB_OBJS): ../lua/src/lib/*.c ++ $(CCOMP) $(INCLUDEDIRS) -DLUA_USE_POSIX $(CXXTFLAGS) -c ../lua/src/lib/*.c ++CXXFLAGS=$(CXXTFLAGS) ++else ++CXXFLAGS=$(CXXTFLAGS) -DNO_LUA ++endif ++ ++ifeq ($(shell uname), Darwin) ++CXXFLAGS:=$(CXXFLAGS) -Dunix ++endif ++ ++.cxx.o: ++ $(CC) $(CONFIGFLAGS) $(CXXFLAGS) -c $< -o $@ ++ ++clean: ++ rm -f *.o $(PROG) ++ ++deps: ++ $(CC) -MM $(CONFIGFLAGS) $(CXXFLAGS) *.cxx ../src/*.cxx | sed -e 's/\/usr.* //' | grep [a-zA-Z] >deps.mak ++ ++# make should be run in ../../scintilla/gtk to compile all the lexers. ++COMPLIB=../../scintilla/bin/scintilla.a ++ ++$(PROG): SciTEGTK.o GUIGTK.o Widget.o \ ++FilePath.o SciTEBase.o SciTEBuffers.o SciTEIO.o StringList.o Exporters.o StringHelpers.o \ ++PropSetFile.o MultiplexExtension.o DirectorExtension.o SciTEProps.o StyleWriter.o Utf8_16.o \ ++ JobQueue.o GTKMutex.o IFaceTable.o $(COMPLIB) $(LUA_OBJS) ++ $(CC) `$(CONFIGTHREADS)` -rdynamic -Wl,--as-needed -Wl,--version-script lua.vers -DGTK $^ -o $@ $(CONFIGLIB) -ldl -lstdc++ ++ ++# Automatically generate header dependencies with "make deps" ++include deps.mak ++ ++# The two last install commands will fail if Gnome is not installed or is not at $(prefix). ++# This is OK - just means no SciTE in the Gnome Applications menu ++# Dead: install -D SciTEGTK.properties $(SYSCONF_PATH)/SciTEGlobal.properties ++install: ++ $(INSTALL) -m 755 -d $(DESTDIR)$(bindir) $(DESTDIR)$(SYSCONF_PATH) ++ ++ $(INSTALL) -m 755 $(PROG) $(DESTDIR)$(bindir) ++ ++ for files in ../src/*.properties ../doc/*.html ../doc/SciTEIco.png ../doc/PrintHi.png; \ ++ do \ ++ $(INSTALL) -m 644 $$files $(DESTDIR)$(SYSCONF_PATH); \ ++ done ++ ++ifdef gnomeprefix ++ $(INSTALL) -m 755 -D SciTE.desktop $(DESTDIR)$(datadir)/applications/SciTE.desktop ++ $(INSTALL) -m 644 -D Sci48M.png $(DESTDIR)$(pixmapdir)/Sci48M.png ++endif ++ ++uninstall: ++ rm -f $(DESTDIR)$(bindir)/SciTE ++ rm -rf $(DESTDIR)$(SYSCONF_PATH) ++ifdef gnomeprefix ++ rm -f $(DESTDIR)$(datadir)/applications/SciTE.desktop ++ rm -f $(DESTDIR)$(pixmapdir)/Sci48M.png ++endif diff -Nru scite-2.25/debian/patches/02_config.dpatch scite-3.0.2/debian/patches/02_config.dpatch --- scite-2.25/debian/patches/02_config.dpatch 2012-01-03 03:12:51.000000000 +0000 +++ scite-3.0.2/debian/patches/02_config.dpatch 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run -## Description: add some description -## Origin/Author: add some origin or author -## Bug: bug URL -## 02_config.dpatch by -## -## All lines beginning with `## DP:' are a description of the patch. -## DP: No description. - -@DPATCH@ -diff -urNad scite-2.03~/scite/src/SciTEGlobal.properties scite-2.03/scite/src/SciTEGlobal.properties ---- scite-2.03~/scite/src/SciTEGlobal.properties 2009-10-20 01:56:05.000000000 +0200 -+++ scite-2.03/scite/src/SciTEGlobal.properties 2010-02-16 21:19:07.666945264 +0100 -@@ -34,12 +34,12 @@ - tabbar.visible=1 - #tabbar.hide.one=1 - #tabbar.multiline=1 --#toolbar.visible=1 -+toolbar.visible=1 - #toolbar.detachable=1 - #toolbar.usestockicons=1 - #menubar.detachable=1 - #undo.redo.lazy=1 --#statusbar.visible=1 -+statusbar.visible=1 - #fileselector.width=800 - #fileselector.height=600 - #fileselector.show.hidden=1 -@@ -238,7 +238,7 @@ - command.scite.help.subsystem=2 - if PLAT_GTK - command.print.*=a2ps "$(FileNameExt)" -- command.scite.help=netscape "file://$(SciteDefaultHome)/SciTEDoc.html" -+ command.scite.help=x-www-browser "file://$(SciteDefaultHome)/SciTEDoc.html" - - # Internationalisation - # Japanese input code page 932 and ShiftJIS character set 128 diff -Nru scite-2.25/debian/patches/02_config.patch scite-3.0.2/debian/patches/02_config.patch --- scite-2.25/debian/patches/02_config.patch 1970-01-01 00:00:00.000000000 +0000 +++ scite-3.0.2/debian/patches/02_config.patch 2011-12-19 08:41:54.000000000 +0000 @@ -0,0 +1,26 @@ +--- scite-2.03~/scite/src/SciTEGlobal.properties 2009-10-20 01:56:05.000000000 +0200 ++++ scite-2.03/scite/src/SciTEGlobal.properties 2010-02-16 21:19:07.666945264 +0100 +@@ -34,12 +34,12 @@ + tabbar.visible=1 + #tabbar.hide.one=1 + #tabbar.multiline=1 +-#toolbar.visible=1 ++toolbar.visible=1 + #toolbar.detachable=1 + #toolbar.usestockicons=1 + #menubar.detachable=1 + #undo.redo.lazy=1 +-#statusbar.visible=1 ++statusbar.visible=1 + #fileselector.width=800 + #fileselector.height=600 + #fileselector.show.hidden=1 +@@ -238,7 +238,7 @@ + command.scite.help.subsystem=2 + if PLAT_GTK + command.print.*=a2ps "$(FileNameExt)" +- command.scite.help=netscape "file://$(SciteDefaultHome)/SciTEDoc.html" ++ command.scite.help=x-www-browser "file://$(SciteDefaultHome)/SciTEDoc.html" + + # Internationalisation + # Japanese input code page 932 and ShiftJIS character set 128 diff -Nru scite-2.25/debian/patches/series scite-3.0.2/debian/patches/series --- scite-2.25/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ scite-3.0.2/debian/patches/series 2011-12-19 08:41:54.000000000 +0000 @@ -0,0 +1,2 @@ +#01_desktop_file.patch +#02_config.patch diff -Nru scite-2.25/debian/rules scite-3.0.2/debian/rules --- scite-2.25/debian/rules 2012-01-03 03:12:51.000000000 +0000 +++ scite-3.0.2/debian/rules 2011-12-19 08:41:54.000000000 +0000 @@ -1,49 +1,21 @@ #!/usr/bin/make -f -# Sample debian/rules that uses debhelper. -# GNU copyright 1997 to 1999 by Joey Hess. -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 +%: + dh $@ -DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) - -ifneq (,$(findstring alpha,$(DEB_HOST_ARCH))) - BUILD_LUA=NO_LUA=1 -endif -ifneq (,$(findstring 64,$(DEB_HOST_ARCH))) - BUILD_LUA=NO_LUA=1 -endif -ifneq (,$(findstring powerpc,$(DEB_HOST_ARCH))) - BUILD_LUA=NO_LUA=1 -endif - -configure: configure-stamp -configure-stamp: - dh_testdir - touch configure-stamp - -build: configure-stamp build-stamp -build-stamp: patch - dh_testdir +override_dh_auto_build: + dh_auto_build cd scintilla/gtk; $(MAKE) GTK2=1 $(BUILD_LUA) cd scite/gtk; $(MAKE) gnomeprefix=/usr GTK2=1 $(BUILD_LUA) - touch build-stamp -clean: unpatch - dh_testdir - dh_testroot - rm -f build-stamp configure-stamp +override_dh_auto_clean: + dh_auto_clean cd scintilla/gtk; $(MAKE) clean rm -f scintilla/bin/scintilla.a cd scite/gtk; $(MAKE) clean - dh_clean - -install: build - dh_testdir - dh_testroot - dh_clean -k - dh_installdirs +override_dh_auto_install: + dh_auto_install cd scite/gtk; $(MAKE) install prefix=../../debian/scite/usr datadir=../../debian/scite/usr/share chmod -x $(CURDIR)/debian/scite/usr/share/scite/* mv $(CURDIR)/debian/scite/usr/bin/SciTE $(CURDIR)/debian/scite/usr/bin/scite @@ -53,39 +25,6 @@ #chmod 644 $(CURDIR)/debian/scite/usr/share/pixmaps/Sci48M.png #chmod 644 $(CURDIR)/debian/scite/usr/share/gnome/apps/Applications/SciTE.desktop -# Build architecture-independent files here. -binary-indep: build install -# We have nothing to do by default. - -# Build architecture-dependent files here. -binary-arch: build install - dh_testdir - dh_testroot - dh_installdocs - dh_installexamples - dh_installmenu - dh_installcron - dh_installman - dh_installinfo +override_dh_installchangelogs: dh_installchangelogs scintilla/doc/ScintillaHistory.html - dh_link - dh_strip - dh_compress - dh_fixperms - dh_installdeb - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb - -patch: patch-stamp -patch-stamp: - dpatch apply-all - touch patch-stamp - -unpatch: - dpatch deapply-all - rm -rf patch-stamp debian/patched -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install configure diff -Nru scite-2.25/debian/source/format scite-3.0.2/debian/source/format --- scite-2.25/debian/source/format 1970-01-01 00:00:00.000000000 +0000 +++ scite-3.0.2/debian/source/format 2012-01-03 03:12:52.000000000 +0000 @@ -0,0 +1 @@ +3.0 (quilt) diff -Nru scite-2.25/scintilla/cocoa/InfoBar.mm scite-3.0.2/scintilla/cocoa/InfoBar.mm --- scite-2.25/scintilla/cocoa/InfoBar.mm 2010-10-27 21:15:45.000000000 +0000 +++ scite-3.0.2/scintilla/cocoa/InfoBar.mm 2011-08-01 02:49:04.000000000 +0000 @@ -46,7 +46,7 @@ //-------------------------------------------------------------------------------------------------- - (void) selectWithFrame: (NSRect) aRect inView: (NSView*) controlView editor: (NSText*) textObj - delegate:(id) anObject start: (int) selStart length: (int) selLength + delegate:(id) anObject start: (NSInteger) selStart length: (NSInteger) selLength { aRect = [self drawingRectForBounds: aRect]; mIsEditingOrSelecting = YES; diff -Nru scite-2.25/scintilla/cocoa/PlatCocoa.h scite-3.0.2/scintilla/cocoa/PlatCocoa.h --- scite-2.25/scintilla/cocoa/PlatCocoa.h 2010-10-27 21:15:45.000000000 +0000 +++ scite-3.0.2/scintilla/cocoa/PlatCocoa.h 2011-09-26 11:41:36.000000000 +0000 @@ -23,6 +23,7 @@ NSRect PRectangleToNSRect(Scintilla::PRectangle& rc); Scintilla::PRectangle NSRectToPRectangle(NSRect& rc); +CFStringEncoding EncodingFromCharacterSet(bool unicode, int characterSet); @interface ScintillaContextMenu : NSMenu { @@ -47,14 +48,17 @@ /** The text layout instance */ QuartzTextLayout* textLayout; + int codePage; + int verticalDeviceResolution; + /** If the surface is a bitmap context, contains a reference to the bitmap data. */ uint8_t* bitmapData; /** If the surface is a bitmap context, stores the dimensions of the bitmap. */ int bitmapWidth; int bitmapHeight; - /** Set the CGContext's fill colour to the specified allocated colour. */ - void FillColour( const ColourAllocated& back ); + /** Set the CGContext's fill colour to the specified desired colour. */ + void FillColour( const ColourDesired& back ); // 24-bit RGB+A bitmap data constants @@ -72,7 +76,7 @@ void Release(); bool Initialised(); - void PenColour(ColourAllocated fore); + void PenColour(ColourDesired fore); /** Returns a CGImageRef that represents the surface. Returns NULL if this is not possible. */ CGImageRef GetImage(); @@ -82,36 +86,36 @@ int DeviceHeightFont(int points); void MoveTo(int x_, int y_); void LineTo(int x_, int y_); - void Polygon(Scintilla::Point *pts, int npts, ColourAllocated fore, ColourAllocated back); - void RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAllocated back); - void FillRectangle(PRectangle rc, ColourAllocated back); + void Polygon(Scintilla::Point *pts, int npts, ColourDesired fore, ColourDesired back); + void RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back); + void FillRectangle(PRectangle rc, ColourDesired back); void FillRectangle(PRectangle rc, Surface &surfacePattern); - void RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back); - void AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill, - ColourAllocated outline, int alphaOutline, int flags); - void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back); + void RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesired back); + void AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fill, int alphaFill, + ColourDesired outline, int alphaOutline, int flags); + void DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage); + void Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back); void Copy(PRectangle rc, Scintilla::Point from, Surface &surfaceSource); - void DrawTextNoClip(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, - ColourAllocated back); - void DrawTextClipped(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, - ColourAllocated back); - void DrawTextTransparent(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore); - void MeasureWidths(Font &font_, const char *s, int len, int *positions); - int WidthText(Font &font_, const char *s, int len); - int WidthChar(Font &font_, char ch); - int Ascent(Font &font_); - int Descent(Font &font_); - int InternalLeading(Font &font_); - int ExternalLeading(Font &font_); - int Height(Font &font_); - int AverageCharWidth(Font &font_); + void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, + ColourDesired back); + void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, + ColourDesired back); + void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore); + void MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions); + XYPOSITION WidthText(Font &font_, const char *s, int len); + XYPOSITION WidthChar(Font &font_, char ch); + XYPOSITION Ascent(Font &font_); + XYPOSITION Descent(Font &font_); + XYPOSITION InternalLeading(Font &font_); + XYPOSITION ExternalLeading(Font &font_); + XYPOSITION Height(Font &font_); + XYPOSITION AverageCharWidth(Font &font_); - int SetPalette(Scintilla::Palette *pal, bool inBackGround); void SetClip(PRectangle rc); void FlushCachedState(); void SetUnicodeMode(bool unicodeMode_); - void SetDBCSMode(int codePage); + void SetDBCSMode(int codePage_); }; // SurfaceImpl class } // Scintilla namespace diff -Nru scite-2.25/scintilla/cocoa/PlatCocoa.mm scite-3.0.2/scintilla/cocoa/PlatCocoa.mm --- scite-2.25/scintilla/cocoa/PlatCocoa.mm 2011-03-17 22:41:24.000000000 +0000 +++ scite-3.0.2/scintilla/cocoa/PlatCocoa.mm 2011-12-08 22:17:01.000000000 +0000 @@ -22,6 +22,7 @@ #include #include #include +#include #include "XPM.h" @@ -91,48 +92,6 @@ ); } -//----------------- Palette ------------------------------------------------------------------------ - -// The Palette implementation is only here because we would get linker errors if not. -// We don't use indexed colors in ScintillaCocoa. - -Scintilla::Palette::Palette() -{ -} - -//-------------------------------------------------------------------------------------------------- - -Scintilla::Palette::~Palette() -{ -} - -//-------------------------------------------------------------------------------------------------- - -void Scintilla::Palette::Release() -{ -} - -//-------------------------------------------------------------------------------------------------- - -/** - * Used to transform a given color, if needed. If the caller tries to find a color that matches the - * desired color then we simply pass it on, as we support the full color space. - */ -void Scintilla::Palette::WantFind(ColourPair &cp, bool want) -{ - if (!want) - cp.allocated.Set(cp.desired.AsLong()); - - // Don't do anything if the caller wants the color it has already set. -} - -//-------------------------------------------------------------------------------------------------- - -void Scintilla::Palette::Allocate(Window& w) -{ - // Nothing to allocate as we don't use palettes. -} - //----------------- Font --------------------------------------------------------------------------- Font::Font(): fid(0) @@ -148,31 +107,24 @@ //-------------------------------------------------------------------------------------------------- +static int FontCharacterSet(Font &f) { + return reinterpret_cast(f.GetID())->getCharacterSet(); +} + /** - * Creates a Quartz 2D font with the given properties. - * TODO: rewrite to use NSFont. + * Creates a CTFontRef with the given properties. */ -void Font::Create(const char *faceName, int characterSet, int size, bool bold, bool italic, - int extraFontFlag) +void Font::Create(const FontParameters &fp) { - // TODO: How should I handle the characterSet request? - Release(); - - QuartzTextStyle* style = new QuartzTextStyle(); - fid = style; - - // Find the font - QuartzFont font(faceName, strlen(faceName)); - - // We set Font, Size, Bold, Italic - QuartzTextSize textSize(size); - QuartzTextBold isBold(bold); - QuartzTextItalic isItalic(italic); - - // Actually set the attributes - QuartzTextStyleAttribute* attributes[] = { &font, &textSize, &isBold, &isItalic }; - style->setAttributes(attributes, sizeof(attributes) / sizeof(*attributes)); - style->setFontFeature(kLigaturesType, kCommonLigaturesOffSelector); + Release(); + + QuartzTextStyle* style = new QuartzTextStyle(); + fid = style; + + // Create the font with attributes + QuartzFont font(fp.faceName, strlen(fp.faceName), fp.size, fp.weight, fp.italic); + CTFontRef fontRef = font.getFontID(); + style->setFontRef(fontRef, fp.characterSet); } //-------------------------------------------------------------------------------------------------- @@ -188,9 +140,19 @@ SurfaceImpl::SurfaceImpl() { - bitmapData = NULL; // Release will try and delete bitmapData if != NULL + unicodeMode = true; + x = 0; + y = 0; gc = NULL; + textLayout = new QuartzTextLayout(NULL); + codePage = 0; + verticalDeviceResolution = 0; + + bitmapData = NULL; // Release will try and delete bitmapData if != NULL + bitmapWidth = 0; + bitmapHeight = 0; + Release(); } @@ -233,7 +195,7 @@ //-------------------------------------------------------------------------------------------------- -void SurfaceImpl::Init(WindowID wid) +void SurfaceImpl::Init(WindowID) { // To be able to draw, the surface must get a CGContext handle. We save the graphics port, // then aquire/release the context on an as-need basis (see above). @@ -246,7 +208,7 @@ //-------------------------------------------------------------------------------------------------- -void SurfaceImpl::Init(SurfaceID sid, WindowID wid) +void SurfaceImpl::Init(SurfaceID sid, WindowID) { Release(); gc = reinterpret_cast(sid); @@ -256,7 +218,7 @@ //-------------------------------------------------------------------------------------------------- -void SurfaceImpl::InitPixMap(int width, int height, Surface* surface_, WindowID wid) +void SurfaceImpl::InitPixMap(int width, int height, Surface* /* surface_ */, WindowID /* wid */) { Release(); @@ -309,7 +271,7 @@ //-------------------------------------------------------------------------------------------------- -void SurfaceImpl::PenColour(ColourAllocated fore) +void SurfaceImpl::PenColour(ColourDesired fore) { if (gc) { @@ -323,7 +285,7 @@ //-------------------------------------------------------------------------------------------------- -void SurfaceImpl::FillColour(const ColourAllocated& back) +void SurfaceImpl::FillColour(const ColourDesired& back) { if (gc) { @@ -353,9 +315,13 @@ const int bitmapBytesPerRow = ((int) bitmapWidth * BYTES_PER_PIXEL); const int bitmapByteCount = (bitmapBytesPerRow * (int) bitmapHeight); + // Make a copy of the bitmap data for the image creation and divorce it + // From the SurfaceImpl lifetime + CFDataRef dataRef = CFDataCreate(kCFAllocatorDefault, bitmapData, bitmapByteCount); + // Create a data provider. - CGDataProviderRef dataProvider = CGDataProviderCreateWithData(NULL, bitmapData, bitmapByteCount, - NULL); + CGDataProviderRef dataProvider = CGDataProviderCreateWithCFData(dataRef); + CGImageRef image = NULL; if (dataProvider != NULL) { @@ -381,6 +347,9 @@ CGDataProviderRelease(dataProvider); dataProvider = NULL; + // Done with the data provider. + CFRelease(dataRef); + return image; } @@ -391,9 +360,13 @@ */ int SurfaceImpl::LogPixelsY() { - NSSize deviceResolution = [[[[NSScreen mainScreen] deviceDescription] - objectForKey: NSDeviceResolution] sizeValue]; - return (int) deviceResolution.height; + if (verticalDeviceResolution == 0) + { + NSSize deviceResolution = [[[[NSScreen mainScreen] deviceDescription] + objectForKey: NSDeviceResolution] sizeValue]; + verticalDeviceResolution = (int) deviceResolution.height; + } + return verticalDeviceResolution; } //-------------------------------------------------------------------------------------------------- @@ -435,8 +408,8 @@ //-------------------------------------------------------------------------------------------------- -void SurfaceImpl::Polygon(Scintilla::Point *pts, int npts, ColourAllocated fore, - ColourAllocated back) +void SurfaceImpl::Polygon(Scintilla::Point *pts, int npts, ColourDesired fore, + ColourDesired back) { // Allocate memory for the array of points. CGPoint *points = new CGPoint[npts]; @@ -457,7 +430,6 @@ // Draw the polygon CGContextAddLines(gc, points, npts); - // TODO: Should the path be automatically closed, or is that the caller's responsability? // Explicitly close the path, so it is closed for stroking AND filling (implicit close = filling only) CGContextClosePath( gc ); CGContextDrawPath( gc, kCGPathFillStroke ); @@ -469,7 +441,7 @@ //-------------------------------------------------------------------------------------------------- -void SurfaceImpl::RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAllocated back) +void SurfaceImpl::RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back) { if (gc) { @@ -480,7 +452,6 @@ // Quartz integer -> float point conversion fun (see comment in SurfaceImpl::LineTo) // We subtract 1 from the Width() and Height() so that all our drawing is within the area defined // by the PRectangle. Otherwise, we draw one pixel too far to the right and bottom. - // TODO: Create some version of PRectangleToCGRect to do this conversion for us? CGContextAddRect( gc, CGRectMake( rc.left + 0.5, rc.top + 0.5, rc.Width() - 1, rc.Height() - 1 ) ); CGContextDrawPath( gc, kCGPathFillStroke ); } @@ -488,11 +459,14 @@ //-------------------------------------------------------------------------------------------------- -void SurfaceImpl::FillRectangle(PRectangle rc, ColourAllocated back) +void SurfaceImpl::FillRectangle(PRectangle rc, ColourDesired back) { if (gc) { FillColour(back); + // Snap rectangle boundaries to nearest int + rc.left = lround(rc.left); + rc.right = lround(rc.right); CGRect rect = PRectangleToCGRect(rc); CGContextFillRect(gc, rect); } @@ -507,6 +481,13 @@ //-------------------------------------------------------------------------------------------------- +void releaseImageRefCallback(CGImageRef pattern) +{ + CGImageRelease(pattern); +} + +//-------------------------------------------------------------------------------------------------- + void SurfaceImpl::FillRectangle(PRectangle rc, Surface &surfacePattern) { SurfaceImpl& patternSurface = static_cast(surfacePattern); @@ -515,12 +496,13 @@ CGImageRef image = patternSurface.GetImage(); if (image == NULL) { - FillRectangle(rc, ColourAllocated(0)); + FillRectangle(rc, ColourDesired(0)); return; } - const CGPatternCallbacks drawImageCallbacks = { 0, - reinterpret_cast(drawImageRefCallback), NULL }; + const CGPatternCallbacks drawImageCallbacks = { 0, + reinterpret_cast(drawImageRefCallback), + reinterpret_cast(releaseImageRefCallback) }; CGPatternRef pattern = CGPatternCreate(image, CGRectMake(0, 0, patternSurface.bitmapWidth, patternSurface.bitmapHeight), @@ -542,7 +524,7 @@ // Unlike the documentation, you MUST pass in a "components" parameter: // For coloured patterns it is the alpha value. - const float alpha = 1.0; + const CGFloat alpha = 1.0; CGContextSetFillPattern( gc, pattern, &alpha ); CGContextFillRect( gc, PRectangleToCGRect( rc ) ); CGContextRestoreGState( gc ); @@ -552,14 +534,16 @@ colorSpace = NULL; CGPatternRelease( pattern ); pattern = NULL; - CGImageRelease( image ); - image = NULL; } /* pattern != NULL */ } -void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back) { - // TODO: Look at the Win32 API to determine what this is supposed to do: +void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesired back) { + // This is only called from the margin marker drawing code for SC_MARK_ROUNDRECT + // The Win32 version does // ::RoundRect(hdc, rc.left + 1, rc.top, rc.right - 1, rc.bottom, 8, 8 ); + // which is a rectangle with rounded corners each having a radius of 4 pixels. + // It would be almost as good just cutting off the corners with lines at + // 45 degrees as is done on GTK+. // Create a rectangle with semicircles at the corners const int MAX_RADIUS = 4; @@ -593,7 +577,6 @@ }; // Align the points in the middle of the pixels - // TODO: Should I include these +0.5 in the array creation code above? for( int i = 0; i < 4*3; ++ i ) { CGPoint* c = (CGPoint*) corners; @@ -619,12 +602,15 @@ CGContextDrawPath( gc, kCGPathFillStroke ); } -void Scintilla::SurfaceImpl::AlphaRectangle(PRectangle rc, int /*cornerSize*/, ColourAllocated fill, int alphaFill, - ColourAllocated /*outline*/, int /*alphaOutline*/, int /*flags*/) +void Scintilla::SurfaceImpl::AlphaRectangle(PRectangle rc, int /*cornerSize*/, ColourDesired fill, int alphaFill, + ColourDesired /*outline*/, int /*alphaOutline*/, int /*flags*/) { if ( gc ) { ColourDesired colour( fill.AsLong() ); - + + // Snap rectangle boundaries to nearest int + rc.left = lround(rc.left); + rc.right = lround(rc.right); // Set the Fill color to match CGContextSetRGBFillColor( gc, colour.GetRed() / 255.0, colour.GetGreen() / 255.0, colour.GetBlue() / 255.0, alphaFill / 255.0 ); CGRect rect = PRectangleToCGRect( rc ); @@ -632,7 +618,74 @@ } } -void SurfaceImpl::Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back) { +static CGImageRef ImageCreateFromRGBA(int width, int height, const unsigned char *pixelsImage, bool invert) { + CGImageRef image = 0; + + // Create an RGB color space. + CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); + if (colorSpace) { + const int bitmapBytesPerRow = ((int) width * 4); + const int bitmapByteCount = (bitmapBytesPerRow * (int) height); + + // Create a data provider. + CGDataProviderRef dataProvider = 0; + unsigned char *pixelsUpsideDown = 0; + if (invert) { + pixelsUpsideDown = new unsigned char[bitmapByteCount]; + + for (int y=0; ysetText (reinterpret_cast(s), len, *reinterpret_cast(font_.GetID())); - - // The Quartz RGB fill color influences the ATSUI color - FillColour(fore); - - // Draw text vertically flipped as OS X uses a coordinate system where +Y is upwards. - textLayout->draw(rc.left, ybase, true); -} + if (unicode) + return kCFStringEncodingUTF8; -//-------------------------------------------------------------------------------------------------- + // Unsupported -> Latin1 as reasonably safe + enum { notSupported = kCFStringEncodingISOLatin1}; + + switch (characterSet) + { + case SC_CHARSET_ANSI: + return kCFStringEncodingISOLatin1; + case SC_CHARSET_DEFAULT: + return kCFStringEncodingISOLatin1; + case SC_CHARSET_BALTIC: + return kCFStringEncodingWindowsBalticRim; + case SC_CHARSET_CHINESEBIG5: + return kCFStringEncodingBig5; + case SC_CHARSET_EASTEUROPE: + return kCFStringEncodingWindowsLatin2; + case SC_CHARSET_GB2312: + return kCFStringEncodingGB_18030_2000; + case SC_CHARSET_GREEK: + return kCFStringEncodingWindowsGreek; + case SC_CHARSET_HANGUL: + return kCFStringEncodingEUC_KR; + case SC_CHARSET_MAC: + return kCFStringEncodingMacRoman; + case SC_CHARSET_OEM: + return kCFStringEncodingISOLatin1; + case SC_CHARSET_RUSSIAN: + return kCFStringEncodingKOI8_R; + case SC_CHARSET_CYRILLIC: + return kCFStringEncodingWindowsCyrillic; + case SC_CHARSET_SHIFTJIS: + return kCFStringEncodingShiftJIS; + case SC_CHARSET_SYMBOL: + return kCFStringEncodingMacSymbol; + case SC_CHARSET_TURKISH: + return kCFStringEncodingWindowsLatin5; + case SC_CHARSET_JOHAB: + return kCFStringEncodingWindowsKoreanJohab; + case SC_CHARSET_HEBREW: + return kCFStringEncodingWindowsHebrew; + case SC_CHARSET_ARABIC: + return kCFStringEncodingWindowsArabic; + case SC_CHARSET_VIETNAMESE: + return kCFStringEncodingWindowsVietnamese; + case SC_CHARSET_THAI: + return kCFStringEncodingISOLatinThai; + case SC_CHARSET_8859_15: + return kCFStringEncodingISOLatin1; + default: + return notSupported; + } +} + +void SurfaceImpl::DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, + ColourDesired fore) +{ + CFStringEncoding encoding = EncodingFromCharacterSet(unicodeMode, FontCharacterSet(font_)); + ColourDesired colour(fore.AsLong()); + CGColorRef color = CGColorCreateGenericRGB(colour.GetRed()/255.0,colour.GetGreen()/255.0,colour.GetBlue()/255.0,1.0); + + QuartzTextStyle* style = reinterpret_cast(font_.GetID()); + style->setCTStyleColor(color); + + CGColorRelease(color); + + textLayout->setText (reinterpret_cast(s), len, encoding, *reinterpret_cast(font_.GetID())); + textLayout->draw(rc.left, ybase); +} + +static size_t utf8LengthFromLead(unsigned char uch) { + if (uch >= (0x80 + 0x40 + 0x20 + 0x10)) { + return 4; + } else if (uch >= (0x80 + 0x40 + 0x20)) { + return 3; + } else if (uch >= (0x80)) { + return 2; + } else { + return 1; + } +} + +//-------------------------------------------------------------------------------------------------- + +void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions) +{ + CFStringEncoding encoding = EncodingFromCharacterSet(unicodeMode, FontCharacterSet(font_)); + textLayout->setText (reinterpret_cast(s), len, encoding, *reinterpret_cast(font_.GetID())); + + CTLineRef mLine = textLayout->getCTLine(); + assert(mLine != NULL); + + if (unicodeMode) { + // Map the widths given for UTF-16 characters back onto the UTF-8 input string + CFIndex fit = textLayout->getStringLength(); + int ui=0; + const unsigned char *us = reinterpret_cast(s); + int i=0; + while (ui 0) + lastPos = positions[i-1]; + while (isetText (reinterpret_cast(buf), len+1, *reinterpret_cast(font_.GetID())); - ATSUGlyphInfoArray* theGlyphInfoArrayPtr; - ByteCount theArraySize; - - // Get the GlyphInfoArray - ATSUTextLayout layout = textLayout->getLayout(); - if ( noErr == ATSUGetGlyphInfo (layout, 0, textLayout->getLength(), &theArraySize, NULL)) - { - theGlyphInfoArrayPtr = (ATSUGlyphInfoArray *) malloc (theArraySize + sizeof(ItemCount) + sizeof(ATSUTextLayout)); - if (theGlyphInfoArrayPtr) - { - if (noErr == ATSUGetGlyphInfo (layout, 0, textLayout->getLength(), &theArraySize, theGlyphInfoArrayPtr)) - { - // do not count the first item, which is at the beginning of the line - for ( UniCharCount unicodePosition = 1, i = 0; i < len && unicodePosition < theGlyphInfoArrayPtr->numGlyphs; unicodePosition ++ ) - { - // The ideal position is the x coordinate of the glyph, relative to the beginning of the line - int position = (int)( theGlyphInfoArrayPtr->glyphs[unicodePosition].idealX + 0.5 ); // These older APIs return float values - unsigned char uch = s[i]; - positions[i++] = position; - - // If we are using unicode (UTF8), map the Unicode position back to the UTF8 characters, - // as 1 unicode character can map to multiple UTF8 characters. - // See: http://www.tbray.org/ongoing/When/200x/2003/04/26/UTF - // Or: http://www.cl.cam.ac.uk/~mgk25/unicode.html - if ( unicodeMode ) - { - unsigned char mask = 0xc0; - int count = 1; - // Add one additonal byte for each extra high order one in the byte - while ( uch >= mask && count < 8 ) - { - positions[i++] = position; - count ++; - mask = mask >> 1 | 0x80; // add an additional one in the highest order position - } - } - } - } - - // Free the GlyphInfoArray - free (theGlyphInfoArrayPtr); - } - } - free (buf); } -int SurfaceImpl::WidthText(Font &font_, const char *s, int len) { +XYPOSITION SurfaceImpl::WidthText(Font &font_, const char *s, int len) { if (font_.GetID()) { - textLayout->setText (reinterpret_cast(s), len, *reinterpret_cast(font_.GetID())); - - // TODO: Maybe I should add some sort of text measurement features to QuartzTextLayout? - unsigned long actualNumberOfBounds = 0; - ATSTrapezoid glyphBounds; - - // We get a single bound, since the text should only require one. If it requires more, there is an issue - if ( ATSUGetGlyphBounds( textLayout->getLayout(), 0, 0, kATSUFromTextBeginning, kATSUToTextEnd, kATSUseDeviceOrigins, 1, &glyphBounds, &actualNumberOfBounds ) != noErr || actualNumberOfBounds != 1 ) - { - Platform::DebugDisplay( "ATSUGetGlyphBounds failed in WidthText" ); - return 0; - } + CFStringEncoding encoding = EncodingFromCharacterSet(unicodeMode, FontCharacterSet(font_)); + textLayout->setText (reinterpret_cast(s), len, encoding, *reinterpret_cast(font_.GetID())); - //Platform::DebugPrintf( "WidthText: \"%*s\" = %ld\n", len, s, Fix2Long( glyphBounds.upperRight.x - glyphBounds.upperLeft.x ) ); - return Fix2Long( glyphBounds.upperRight.x - glyphBounds.upperLeft.x ); + return textLayout->MeasureStringWidth(); } return 1; } -int SurfaceImpl::WidthChar(Font &font_, char ch) { +XYPOSITION SurfaceImpl::WidthChar(Font &font_, char ch) { char str[2] = { ch, '\0' }; if (font_.GetID()) { - textLayout->setText (reinterpret_cast(str), 1, *reinterpret_cast(font_.GetID())); + CFStringEncoding encoding = EncodingFromCharacterSet(unicodeMode, FontCharacterSet(font_)); + textLayout->setText (reinterpret_cast(str), 1, encoding, *reinterpret_cast(font_.GetID())); - // TODO: Maybe I should add some sort of text measurement features to QuartzTextLayout? - unsigned long actualNumberOfBounds = 0; - ATSTrapezoid glyphBounds; - - // We get a single bound, since the text should only require one. If it requires more, there is an issue - if ( ATSUGetGlyphBounds( textLayout->getLayout(), 0, 0, kATSUFromTextBeginning, kATSUToTextEnd, kATSUseDeviceOrigins, 1, &glyphBounds, &actualNumberOfBounds ) != noErr || actualNumberOfBounds != 1 ) - { - Platform::DebugDisplay( "ATSUGetGlyphBounds failed in WidthChar" ); - return 0; - } - - return Fix2Long( glyphBounds.upperRight.x - glyphBounds.upperLeft.x ); + return textLayout->MeasureStringWidth(); } else return 1; } -// Three possible strategies for determining ascent and descent of font: -// 1) Call ATSUGetGlyphBounds with string containing all letters, numbers and punctuation. -// 2) Use the ascent and descent fields of the font. -// 3) Call ATSUGetGlyphBounds with string as 1 but also including accented capitals. -// Smallest values given by 1 and largest by 3 with 2 in between. -// Techniques 1 and 2 sometimes chop off extreme portions of ascenders and -// descenders but are mostly OK except for accented characters which are -// rarely used in code. - // This string contains a good range of characters to test for size. const char sizeString[] = "`~!@#$%^&*()-_=+\\|[]{};:\"\'<,>.?/1234567890" "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; -int SurfaceImpl::Ascent(Font &font_) { +XYPOSITION SurfaceImpl::Ascent(Font &font_) { if (!font_.GetID()) return 1; - ATSUTextMeasurement ascent = reinterpret_cast( font_.GetID() )->getAttribute( kATSUAscentTag ); - return Fix2Long( ascent ); + float ascent = reinterpret_cast( font_.GetID() )->getAscent(); + return ascent + 0.5; + } -int SurfaceImpl::Descent(Font &font_) { +XYPOSITION SurfaceImpl::Descent(Font &font_) { if (!font_.GetID()) return 1; - ATSUTextMeasurement descent = reinterpret_cast( font_.GetID() )->getAttribute( kATSUDescentTag ); - return Fix2Long( descent ); + float descent = reinterpret_cast( font_.GetID() )->getDescent(); + return descent + 0.5; + } -int SurfaceImpl::InternalLeading(Font &) { - // TODO: How do we get EM_Size? - // internal leading = ascent - descent - EM_size +XYPOSITION SurfaceImpl::InternalLeading(Font &) { return 0; } -int SurfaceImpl::ExternalLeading(Font &font_) { +XYPOSITION SurfaceImpl::ExternalLeading(Font &font_) { if (!font_.GetID()) return 1; - ATSUTextMeasurement lineGap = reinterpret_cast( font_.GetID() )->getAttribute( kATSULeadingTag ); - return Fix2Long( lineGap ); + float leading = reinterpret_cast( font_.GetID() )->getLeading(); + return leading + 0.5; + } -int SurfaceImpl::Height(Font &font_) { - return Ascent(font_) + Descent(font_); +XYPOSITION SurfaceImpl::Height(Font &font_) { + + int ht = Ascent(font_) + Descent(font_); + return ht; } -int SurfaceImpl::AverageCharWidth(Font &font_) { +XYPOSITION SurfaceImpl::AverageCharWidth(Font &font_) { if (!font_.GetID()) return 1; @@ -949,34 +1034,6 @@ int width = WidthText( font_, sizeString, sizeStringLength ); return (int) ((width / (float) sizeStringLength) + 0.5); - - /* - ATSUStyle textStyle = reinterpret_cast( font_.GetID() )->getATSUStyle(); - ATSUFontID fontID; - - ByteCount actualSize = 0; - if ( ATSUGetAttribute( textStyle, kATSUFontTag, sizeof( fontID ), &fontID, &actualSize ) != noErr ) - { - Platform::DebugDisplay( "ATSUGetAttribute failed" ); - return 1; - } - - ATSFontMetrics metrics; - memset( &metrics, 0, sizeof( metrics ) ); - if ( ATSFontGetHorizontalMetrics( fontID, kATSOptionFlagsDefault, &metrics ) != noErr ) - { - Platform::DebugDisplay( "ATSFontGetHorizontalMetrics failed in AverageCharWidth" ); - return 1; - } - - printf( "%f %f %f\n", metrics.avgAdvanceWidth * 32, metrics.ascent * 32, metrics.descent * 32 ); - - return (int) (metrics.avgAdvanceWidth + 0.5);*/ -} - -int SurfaceImpl::SetPalette(Scintilla::Palette *, bool) { - // Mac OS X is always true colour (I think) so this doesn't matter - return 0; } void SurfaceImpl::SetClip(PRectangle rc) { @@ -991,27 +1048,38 @@ unicodeMode = unicodeMode_; } -void SurfaceImpl::SetDBCSMode(int codePage) { - // TODO: Implement this for code pages != UTF-8 +void SurfaceImpl::SetDBCSMode(int codePage_) { + if (codePage_ && (codePage_ != SC_CP_UTF8)) + codePage = codePage_; } -Surface *Surface::Allocate() +Surface *Surface::Allocate(int) { return new SurfaceImpl(); } //----------------- Window ------------------------------------------------------------------------- -Window::~Window() { +// Cocoa uses different types for windows and views, so a Window may +// be either an NSWindow or NSView and the code will check the type +// before performing an action. + +Window::~Window() +{ } //-------------------------------------------------------------------------------------------------- void Window::Destroy() { - if (windowRef) + if (wid) { - // not used + id idWin = reinterpret_cast(wid); + if ([idWin isKindOfClass: [NSWindow class]]) + { + NSWindow* win = reinterpret_cast(idWin); + [win release]; + } } wid = 0; } @@ -1026,62 +1094,85 @@ //-------------------------------------------------------------------------------------------------- +static int ScreenMax(NSWindow* win) +{ + NSScreen* screen = [win screen]; + NSRect frame = [screen frame]; + return frame.origin.y + frame.size.height; +} + PRectangle Window::GetPosition() { - NSRect rect= [reinterpret_cast(wid) frame]; - - return PRectangle(NSMinX(rect), NSMinY(rect), NSMaxX(rect), NSMaxY(rect)); + if (wid) + { + NSRect rect; + id idWin = reinterpret_cast(wid); + NSWindow* win; + if ([idWin isKindOfClass: [NSView class]]) + { + // NSView + NSView* view = reinterpret_cast(idWin); + win = [view window]; + rect = [view bounds]; + rect = [view convertRectToBase: rect]; + rect.origin = [win convertBaseToScreen:rect.origin]; + } + else + { + // NSWindow + win = reinterpret_cast(idWin); + rect = [win frame]; + } + int screenHeight = ScreenMax(win); + // Invert screen positions to match Scintilla + return PRectangle( + NSMinX(rect), screenHeight - NSMaxY(rect), + NSMaxX(rect), screenHeight - NSMinY(rect)); + } + else + { + return PRectangle(0, 0, 1, 1); + } } //-------------------------------------------------------------------------------------------------- void Window::SetPosition(PRectangle rc) { - // Moves this view inside the parent view - if ( wid ) + if (wid) { - // Set the frame on the view, the function handles the rest - // CGRect r = PRectangleToCGRect( rc ); - // HIViewSetFrame( reinterpret_cast( wid ), &r ); + id idWin = reinterpret_cast(wid); + if ([idWin isKindOfClass: [NSView class]]) + { + // NSView + // Moves this view inside the parent view + NSRect nsrc = NSMakeRect(rc.left, rc.bottom, rc.Width(), rc.Height()); + NSView* view = reinterpret_cast(idWin); + nsrc.origin = [[view window] convertScreenToBase:nsrc.origin]; + [view setFrame: nsrc]; + } + else + { + // NSWindow + NSWindow* win = reinterpret_cast(idWin); + int screenHeight = ScreenMax(win); + NSRect nsrc = NSMakeRect(rc.left, screenHeight - rc.bottom, + rc.Width(), rc.Height()); + [win setFrame: nsrc display:YES]; + } } } //-------------------------------------------------------------------------------------------------- -void Window::SetPositionRelative(PRectangle rc, Window window) { - // // used to actually move child windows (ie. listbox/calltip) so we have to move - // // the window, not the hiview - // if (windowRef) { - // // we go through some contortions here to get an accurate location for our - // // child windows. This is necessary due to the multiple ways an embedding - // // app may be setup. See SciTest/main.c (GOOD && BAD) for test case. - // WindowRef relativeWindow = GetControlOwner(reinterpret_cast( window.GetID() )); - // WindowRef thisWindow = reinterpret_cast( windowRef ); - // - // Rect portBounds; - // ::GetWindowBounds(relativeWindow, kWindowStructureRgn, &portBounds); - // //fprintf(stderr, "portBounds %d %d %d %d\n", portBounds.left, portBounds.top, portBounds.right, portBounds.bottom); - // PRectangle hbounds = window.GetPosition(); - // //fprintf(stderr, "hbounds %d %d %d %d\n", hbounds.left, hbounds.top, hbounds.right, hbounds.bottom); - // HIViewRef parent = HIViewGetSuperview(reinterpret_cast( window.GetID() )); - // Rect pbounds; - // GetControlBounds(parent, &pbounds); - // //fprintf(stderr, "pbounds %d %d %d %d\n", pbounds.left, pbounds.top, pbounds.right, pbounds.bottom); - // - // PRectangle bounds; - // bounds.top = portBounds.top + pbounds.top + hbounds.top + rc.top; - // bounds.bottom = bounds.top + rc.Height(); - // bounds.left = portBounds.left + pbounds.left + hbounds.left + rc.left; - // bounds.right = bounds.left + rc.Width(); - // //fprintf(stderr, "bounds %d %d %d %d\n", bounds.left, bounds.top, bounds.right, bounds.bottom); - // - // MoveWindow(thisWindow, bounds.left, bounds.top, false); - // SizeWindow(thisWindow, bounds.Width(), bounds.Height(), true); - // - // SetPosition(PRectangle(0,0,rc.Width(),rc.Height())); - // } else { - // SetPosition(rc); - // } +void Window::SetPositionRelative(PRectangle rc, Window window) +{ + PRectangle rcOther = window.GetPosition(); + rc.left += rcOther.left; + rc.right += rcOther.left; + rc.top += rcOther.top; + rc.bottom += rcOther.top; + SetPosition(rc); } //-------------------------------------------------------------------------------------------------- @@ -1096,30 +1187,46 @@ void Window::Show(bool show) { - // if ( wid ) { - // HIViewSetVisible( reinterpret_cast( wid ), show ); - // } - // // this is necessary for calltip/listbox - // if (windowRef) { - // WindowRef thisWindow = reinterpret_cast( windowRef ); - // if (show) { - // ShowWindow( thisWindow ); - // DrawControls( thisWindow ); - // } else - // HideWindow( thisWindow ); - // } + if (wid) + { + id idWin = reinterpret_cast(wid); + if ([idWin isKindOfClass: [NSWindow class]]) + { + NSWindow* win = reinterpret_cast(idWin); + if (show) + { + [win orderFront:nil]; + } + else + { + [win orderOut:nil]; + } + } + } } //-------------------------------------------------------------------------------------------------- /** - * Invalidates the entire window (here an NSView) so it is completely redrawn. + * Invalidates the entire window or view so it is completely redrawn. */ void Window::InvalidateAll() { if (wid) { - NSView* container = reinterpret_cast(wid); + id idWin = reinterpret_cast(wid); + NSView* container; + if ([idWin isKindOfClass: [NSView class]]) + { + container = reinterpret_cast(idWin); + } + else + { + // NSWindow + NSWindow* win = reinterpret_cast(idWin); + container = reinterpret_cast([win contentView]); + container.needsDisplay = YES; + } container.needsDisplay = YES; } } @@ -1127,22 +1234,33 @@ //-------------------------------------------------------------------------------------------------- /** - * Invalidates part of the window (here an NSView) so only this part redrawn. + * Invalidates part of the window or view so only this part redrawn. */ void Window::InvalidateRectangle(PRectangle rc) { if (wid) { - NSView* container = reinterpret_cast(wid); + id idWin = reinterpret_cast(wid); + NSView* container; + if ([idWin isKindOfClass: [NSView class]]) + { + container = reinterpret_cast(idWin); + } + else + { + // NSWindow + NSWindow* win = reinterpret_cast(idWin); + container = reinterpret_cast([win contentView]); + } [container setNeedsDisplayInRect: PRectangleToNSRect(rc)]; } } //-------------------------------------------------------------------------------------------------- -void Window::SetFont(Font &) +void Window::SetFont(Font&) { - // TODO: Do I need to implement this? MSDN: specifies the font that a control is to use when drawing text. + // Implemented on list subclass on Cocoa. } //-------------------------------------------------------------------------------------------------- @@ -1155,26 +1273,82 @@ { if (wid) { - InnerView* container = reinterpret_cast(wid); - [container setCursor: curs]; + id idWin = reinterpret_cast(wid); + if ([idWin isMemberOfClass: [InnerView class]]) + { + InnerView* container = reinterpret_cast(idWin); + [container setCursor: curs]; + } } } //-------------------------------------------------------------------------------------------------- -void Window::SetTitle(const char *s) +void Window::SetTitle(const char* s) { - // WindowRef window = GetControlOwner(reinterpret_cast( wid )); - // CFStringRef title = CFStringCreateWithCString(kCFAllocatorDefault, s, kCFStringEncodingMacRoman); - // SetWindowTitleWithCFString(window, title); - // CFRelease(title); + if (wid) + { + id idWin = reinterpret_cast(wid); + if ([idWin isKindOfClass: [NSWindow class]]) + { + NSWindow* win = reinterpret_cast(idWin); + NSString* sTitle = [NSString stringWithUTF8String:s]; + [win setTitle:sTitle]; + } + } } //-------------------------------------------------------------------------------------------------- PRectangle Window::GetMonitorRect(Point) { - return PRectangle(); + if (wid) + { + id idWin = reinterpret_cast(wid); + if ([idWin isKindOfClass: [NSWindow class]]) + { + NSWindow* win = reinterpret_cast(idWin); + NSScreen* screen = [win screen]; + NSRect rect = [screen frame]; + int screenHeight = rect.origin.y + rect.size.height; + // Invert screen positions to match Scintilla + return PRectangle( + NSMinX(rect), screenHeight - NSMaxY(rect), + NSMaxX(rect), screenHeight - NSMinY(rect)); + } + } + return PRectangle(); +} + +//----------------- ImageFromXPM ------------------------------------------------------------------- + +// Convert an XPM image into an NSImage for use with Cocoa + +static NSImage* ImageFromXPM(XPM* pxpm) +{ + NSImage* img = nil; + if (pxpm) + { + const int width = pxpm->GetWidth(); + const int height = pxpm->GetHeight(); + PRectangle rcxpm(0, 0, width, height); + Surface* surfaceXPM = Surface::Allocate(SC_TECHNOLOGY_DEFAULT); + if (surfaceXPM) + { + surfaceXPM->InitPixMap(width, height, NULL, NULL); + SurfaceImpl* surfaceIXPM = static_cast(surfaceXPM); + CGContextClearRect(surfaceIXPM->GetContext(), CGRectMake(0, 0, width, height)); + pxpm->Draw(surfaceXPM, rcxpm); + img = [[[NSImage alloc] initWithSize:NSZeroSize] autorelease]; + CGImageRef imageRef = surfaceIXPM->GetImage(); + NSBitmapImageRep *bitmapRep = [[NSBitmapImageRep alloc] initWithCGImage: imageRef]; + [img addRepresentation: bitmapRep]; + [bitmapRep release]; + CGImageRelease(imageRef); + delete surfaceXPM; + } + } + return img; } //----------------- ListBox ------------------------------------------------------------------------ @@ -1191,655 +1365,507 @@ //-------------------------------------------------------------------------------------------------- -static const OSType scintillaListBoxType = 'sclb'; - -enum { - kItemsPerContainer = 1, - kIconColumn = 'icon', - kTextColumn = 'text' +struct RowData +{ + int type; + std::string text; + RowData(int type_, const char* text_) : + type(type_), text(text_) + { + } }; -static SInt32 kScrollBarWidth = 0; -class LineData { - int *types; - CFStringRef *strings; - int len; - int maximum; +class LinesData +{ + std::vector lines; public: - LineData() :types(0), strings(0), len(0), maximum(0) {} - ~LineData() { - Clear(); - } - void Clear() { - delete []types; - types = 0; - for (int i=0; i= maximum) { - if (index >= len) { - int lenNew = (index+1) * 2; - int *typesNew = new int[lenNew]; - CFStringRef *stringsNew = new CFStringRef[lenNew]; - for (int i=0; i(lines.size()); + } + void Clear() + { + lines.clear(); + } + void Add(int /* index */, int type, char* str) + { + lines.push_back(RowData(type, str)); + } + int GetType(size_t index) const + { + if (index < lines.size()) + { + return lines[index].type; + } + else + { return 0; } } - CFStringRef GetString(int index) { - if (index < maximum) { - return strings[index]; - } else { + const char* GetString(size_t index) const + { + if (index < lines.size()) + { + return lines[index].text.c_str(); + } + else + { return 0; } } }; +class ListBoxImpl; + +@interface AutoCompletionDataSource : +NSObject +#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 + +#endif +{ + ListBoxImpl* box; +} + +@end + //----------------- ListBoxImpl -------------------------------------------------------------------- +// Map from icon type to an NSImage* +typedef std::map ImageMap; + class ListBoxImpl : public ListBox { private: ControlRef lb; - XPMSet xset; + ImageMap images; int lineHeight; bool unicodeMode; int desiredVisibleRows; unsigned int maxItemWidth; unsigned int aveCharWidth; + unsigned int maxIconWidth; Font font; int maxWidth; - - void InstallDataBrowserCustomCallbacks(); - void ConfigureDataBrowser(); - - static pascal OSStatus WindowEventHandler(EventHandlerCallRef inCallRef, - EventRef inEvent, - void *inUserData ); - EventHandlerRef eventHandler; - -protected: - WindowRef windowRef; - -public: - LineData ld; + + NSTableView* table; + NSScrollView* scroller; + NSTableColumn* colIcon; + NSTableColumn* colText; + AutoCompletionDataSource* ds; + + LinesData ld; CallBackAction doubleClickAction; - void *doubleClickActionData; - + void* doubleClickActionData; + +public: ListBoxImpl() : lb(NULL), lineHeight(10), unicodeMode(false), - desiredVisibleRows(5), maxItemWidth(0), aveCharWidth(8), - doubleClickAction(NULL), doubleClickActionData(NULL) + desiredVisibleRows(5), maxItemWidth(0), aveCharWidth(8), maxIconWidth(0), + doubleClickAction(NULL), doubleClickActionData(NULL) { - if (kScrollBarWidth == 0) - ;//GetThemeMetric(kThemeMetricScrollBarWidth, &kScrollBarWidth); } - - ~ListBoxImpl() {}; - void SetFont(Font &font); - void Create(Window &parent, int ctrlID, Scintilla::Point pt, int lineHeight_, bool unicodeMode_); + ~ListBoxImpl() {} + + // ListBox methods + void SetFont(Font& font); + void Create(Window& parent, int ctrlID, Scintilla::Point pt, int lineHeight_, bool unicodeMode_, int technology_); void SetAverageCharWidth(int width); void SetVisibleRows(int rows); int GetVisibleRows() const; PRectangle GetDesiredRect(); int CaretFromEdge(); void Clear(); - void Append(char *s, int type = -1); + void Append(char* s, int type = -1); int Length(); void Select(int n); int GetSelection(); - int Find(const char *prefix); - void GetValue(int n, char *value, int len); - void Sort(); - void RegisterImage(int type, const char *xpm_data); + int Find(const char* prefix); + void GetValue(int n, char* value, int len); + void RegisterImage(int type, const char* xpm_data); + void RegisterRGBAImage(int type, int width, int height, const unsigned char *pixelsImage); void ClearRegisteredImages(); - void SetDoubleClickAction(CallBackAction action, void *data) { + void SetDoubleClickAction(CallBackAction action, void* data) + { doubleClickAction = action; doubleClickActionData = data; } - - int IconWidth(); - void ShowHideScrollbar(); -#ifdef DB_TABLE_ROW_HEIGHT - void SetRowHeight(DataBrowserItemID itemID); -#endif - - void DrawRow(DataBrowserItemID item, - DataBrowserPropertyID property, - DataBrowserItemState itemState, - const Rect *theRect); - void SetList(const char* list, char separator, char typesep); + + // For access from AutoCompletionDataSource + int Rows(); + NSImage* ImageForRow(NSInteger row); + NSString* TextForRow(NSInteger row); + void DoubleClick(); }; -ListBox *ListBox::Allocate() { - ListBoxImpl *lb = new ListBoxImpl(); - return lb; -} +@implementation AutoCompletionDataSource -void ListBoxImpl::Create(Window &/*parent*/, int /*ctrlID*/, Scintilla::Point /*pt*/, - int lineHeight_, bool unicodeMode_) { - lineHeight = lineHeight_; - unicodeMode = unicodeMode_; - maxWidth = 2000; - - //WindowClass windowClass = kHelpWindowClass; - //WindowAttributes attributes = kWindowNoAttributes; - Rect contentBounds; - WindowRef outWindow; - - contentBounds.top = contentBounds.left = 0; - contentBounds.right = 100; - contentBounds.bottom = lineHeight * desiredVisibleRows; - - //CreateNewWindow(windowClass, attributes, &contentBounds, &outWindow); - - //InstallStandardEventHandler(GetWindowEventTarget(outWindow)); - - //ControlRef root; - //CreateRootControl(outWindow, &root); - - //CreateDataBrowserControl(outWindow, &contentBounds, kDataBrowserListView, &lb); - -#ifdef DB_TABLE_ROW_HEIGHT - // TODO: does not seem to have any effect - //SetDataBrowserTableViewRowHeight(lb, lineHeight); -#endif - - // get rid of the frame, forces databrowser to the full size - // of the window - //Boolean frameAndFocus = false; - //SetControlData(lb, kControlNoPart, kControlDataBrowserIncludesFrameAndFocusTag, - // sizeof(frameAndFocus), &frameAndFocus); - - //ListBoxImpl* lbThis = this; - //SetControlProperty( lb, scintillaListBoxType, 0, sizeof( this ), &lbThis ); - - ConfigureDataBrowser(); - InstallDataBrowserCustomCallbacks(); - - // install event handlers - /* - static const EventTypeSpec kWindowEvents[] = - { - { kEventClassMouse, kEventMouseDown }, - { kEventClassMouse, kEventMouseMoved }, - }; - */ - - eventHandler = NULL; - //InstallWindowEventHandler( outWindow, WindowEventHandler, - // GetEventTypeCount( kWindowEvents ), - // kWindowEvents, this, &eventHandler ); - - wid = lb; - //SetControlVisibility(lb, true, true); - SetControl(lb); - SetWindow(outWindow); +- (void)setBox: (ListBoxImpl*)box_ +{ + box = box_; } -pascal OSStatus ListBoxImpl::WindowEventHandler( - EventHandlerCallRef inCallRef, - EventRef inEvent, - void* inUserData ) +- (void) doubleClick: (id) sender { - - switch (kEventClassMouse /* GetEventClass(inEvent) */) { - case kEventClassMouse: - switch (kEventMouseDown /* GetEventKind(inEvent) */ ) - { - case kEventMouseMoved: - { - //SetThemeCursor( kThemeArrowCursor ); - break; - } - case kEventMouseDown: - { - // we cannot handle the double click from the databrowser notify callback as - // calling doubleClickAction causes the listbox to be destroyed. It is - // safe to do it from this event handler since the destroy event will be queued - // until we're done here. - /* - TCarbonEvent event( inEvent ); - EventMouseButton inMouseButton; - event.GetParameter( kEventParamMouseButton, typeMouseButton, &inMouseButton ); - - UInt32 inClickCount; - event.GetParameter( kEventParamClickCount, &inClickCount ); - if (inMouseButton == kEventMouseButtonPrimary && inClickCount == 2) { - // handle our single mouse click now - ListBoxImpl* listbox = reinterpret_cast( inUserData ); - const WindowRef window = GetControlOwner(listbox->lb); - const HIViewRef rootView = HIViewGetRoot( window ); - HIViewRef targetView = NULL; - HIViewGetViewForMouseEvent( rootView, inEvent, &targetView ); - if ( targetView == listbox->lb ) - { - if (listbox->doubleClickAction != NULL) { - listbox->doubleClickAction(listbox->doubleClickActionData); - } - } - } - */ - } - } +#pragma unused(sender) + if (box) + { + box->DoubleClick(); } - return eventNotHandledErr; } -#ifdef DB_TABLE_ROW_HEIGHT -void ListBoxImpl::SetRowHeight(DataBrowserItemID itemID) +- (id)tableView: (NSTableView*)aTableView objectValueForTableColumn: (NSTableColumn*)aTableColumn row: (NSInteger)rowIndex { - // XXX does not seem to have any effect - //SetDataBrowserTableViewItemRowHeight(lb, itemID, lineHeight); -} -#endif - -void ListBoxImpl::DrawRow(DataBrowserItemID item, - DataBrowserPropertyID property, - DataBrowserItemState itemState, - const Rect *theRect) -{ - Rect row = *theRect; - row.left = 0; - - ColourPair fore; - - if (itemState == kDataBrowserItemIsSelected) { - long systemVersion; - Gestalt( gestaltSystemVersion, &systemVersion ); - // Panther DB starts using kThemeBrushSecondaryHighlightColor for inactive browser hilighting - if ( (systemVersion >= 0x00001030) )//&& (IsControlActive( lb ) == false) ) - ;//SetThemePen( kThemeBrushSecondaryHighlightColor, 32, true ); - else - ; //SetThemePen( kThemeBrushAlternatePrimaryHighlightColor, 32, true ); - - PaintRect(&row); - fore = ColourDesired(0xff,0xff,0xff); +#pragma unused(aTableView) + if (!box) + return nil; + if ([(NSString*)[aTableColumn identifier] isEqualToString: @"icon"]) + { + return box->ImageForRow(rowIndex); } - - int widthPix = xset.GetWidth() + 2; - int pixId = ld.GetType(item - 1); - XPM *pxpm = xset.Get(pixId); - - char s[255]; - GetValue(item - 1, s, 255); - - Surface *surfaceItem = Surface::Allocate(); - if (surfaceItem) { - CGContextRef cgContext; - GrafPtr port; - Rect bounds; - - //GetControlBounds(lb, &bounds); - GetPort( &port ); - QDBeginCGContext( port, &cgContext ); - - CGContextSaveGState( cgContext ); - CGContextTranslateCTM(cgContext, 0, bounds.bottom - bounds.top); - CGContextScaleCTM(cgContext, 1.0, -1.0); - - surfaceItem->Init(cgContext, NULL); - - int left = row.left; - if (pxpm) { - PRectangle rc(left + 1, row.top, - left + 1 + widthPix, row.bottom); - pxpm->Draw(surfaceItem, rc); - } - - // draw the text - PRectangle trc(left + 2 + widthPix, row.top, row.right, row.bottom); - int ascent = surfaceItem->Ascent(font) - surfaceItem->InternalLeading(font); - int ytext = trc.top + ascent + 1; - trc.bottom = ytext + surfaceItem->Descent(font) + 1; - surfaceItem->DrawTextTransparent( trc, font, ytext, s, strlen(s), fore.allocated ); - - CGContextRestoreGState( cgContext ); - QDEndCGContext( port, &cgContext ); - delete surfaceItem; + else { + return box->TextForRow(rowIndex); } } +- (void)tableView: (NSTableView*)aTableView setObjectValue: anObject forTableColumn: (NSTableColumn*)aTableColumn row: (NSInteger)rowIndex +{ +#pragma unused(aTableView) +#pragma unused(anObject) +#pragma unused(aTableColumn) +#pragma unused(rowIndex) +} -pascal void ListBoxDrawItemCallback(ControlRef browser, DataBrowserItemID item, - DataBrowserPropertyID property, - DataBrowserItemState itemState, - const Rect *theRect, SInt16 gdDepth, - Boolean colorDevice) +- (NSInteger)numberOfRowsInTableView: (NSTableView*)aTableView { - if (property != kIconColumn) return; - ListBoxImpl* lbThis = NULL; - //OSStatus err; - //err = GetControlProperty( browser, scintillaListBoxType, 0, sizeof( lbThis ), NULL, &lbThis ); - // adjust our rect - lbThis->DrawRow(item, property, itemState, theRect); - +#pragma unused(aTableView) + if (!box) + return 0; + return box->Rows(); } -void ListBoxImpl::ConfigureDataBrowser() +@end + +ListBox* ListBox::Allocate() { - DataBrowserViewStyle viewStyle; - //DataBrowserSelectionFlags selectionFlags; - //GetDataBrowserViewStyle(lb, &viewStyle); - - //SetDataBrowserHasScrollBars(lb, false, true); - //SetDataBrowserListViewHeaderBtnHeight(lb, 0); - //GetDataBrowserSelectionFlags(lb, &selectionFlags); - //SetDataBrowserSelectionFlags(lb, selectionFlags |= kDataBrowserSelectOnlyOne); - // if you change the hilite style, also change the style in ListBoxDrawItemCallback - //SetDataBrowserTableViewHiliteStyle(lb, kDataBrowserTableViewFillHilite); - - Rect insetRect; - //GetDataBrowserScrollBarInset(lb, &insetRect); - - insetRect.right = kScrollBarWidth - 1; - //SetDataBrowserScrollBarInset(lb, &insetRect); - - switch (viewStyle) - { - case kDataBrowserListView: - { - DataBrowserListViewColumnDesc iconCol; - iconCol.headerBtnDesc.version = kDataBrowserListViewLatestHeaderDesc; - iconCol.headerBtnDesc.minimumWidth = 0; - iconCol.headerBtnDesc.maximumWidth = maxWidth; - iconCol.headerBtnDesc.titleOffset = 0; - iconCol.headerBtnDesc.titleString = NULL; - iconCol.headerBtnDesc.initialOrder = kDataBrowserOrderIncreasing; - - iconCol.headerBtnDesc.btnFontStyle.flags = kControlUseJustMask; - iconCol.headerBtnDesc.btnFontStyle.just = teFlushLeft; - - iconCol.headerBtnDesc.btnContentInfo.contentType = kControlContentTextOnly; - - iconCol.propertyDesc.propertyID = kIconColumn; - iconCol.propertyDesc.propertyType = kDataBrowserCustomType; - iconCol.propertyDesc.propertyFlags = kDataBrowserListViewSelectionColumn; - - //AddDataBrowserListViewColumn(lb, &iconCol, kDataBrowserListViewAppendColumn); - } break; - - } + ListBoxImpl* lb = new ListBoxImpl(); + return lb; } -void ListBoxImpl::InstallDataBrowserCustomCallbacks() +void ListBoxImpl::Create(Window& /*parent*/, int /*ctrlID*/, Scintilla::Point pt, + int lineHeight_, bool unicodeMode_, int) { - /* - DataBrowserCustomCallbacks callbacks; - - callbacks.version = kDataBrowserLatestCustomCallbacks; - verify_noerr(InitDataBrowserCustomCallbacks(&callbacks)); - callbacks.u.v1.drawItemCallback = NewDataBrowserDrawItemUPP(ListBoxDrawItemCallback); - callbacks.u.v1.hitTestCallback = NULL;//NewDataBrowserHitTestUPP(ListBoxHitTestCallback); - callbacks.u.v1.trackingCallback = NULL;//NewDataBrowserTrackingUPP(ListBoxTrackingCallback); - callbacks.u.v1.editTextCallback = NULL; - callbacks.u.v1.dragRegionCallback = NULL; - callbacks.u.v1.acceptDragCallback = NULL; - callbacks.u.v1.receiveDragCallback = NULL; - - SetDataBrowserCustomCallbacks(lb, &callbacks); - */ -} - -void ListBoxImpl::SetFont(Font &font_) { - // Having to do this conversion is LAME - QuartzTextStyle *ts = reinterpret_cast( font_.GetID() ); - ControlFontStyleRec style; - ATSUAttributeValuePtr value; - ATSUFontID fontID; - style.flags = kControlUseFontMask | kControlUseSizeMask | kControlAddToMetaFontMask; - ts->getAttribute( kATSUFontTag, sizeof(fontID), &fontID, NULL ); - ATSUFontIDtoFOND(fontID, &style.font, NULL); - ts->getAttribute( kATSUSizeTag, sizeof(Fixed), &value, NULL ); - style.size = ((SInt16)FixRound((SInt32)value)); - //SetControlFontStyle(lb, &style); - -#ifdef DB_TABLE_ROW_HEIGHT - // XXX this doesn't *stick* - ATSUTextMeasurement ascent = ts->getAttribute( kATSUAscentTag ); - ATSUTextMeasurement descent = ts->getAttribute( kATSUDescentTag ); - lineHeight = Fix2Long( ascent ) + Fix2Long( descent ); - //SetDataBrowserTableViewRowHeight(lb, lineHeight + lineLeading); -#endif - - // !@&^#%$ we cant copy Font, but we need one for our custom drawing - Str255 fontName255; - char fontName[256]; - FMGetFontFamilyName(style.font, fontName255); - - CFStringRef fontNameCF = ::CFStringCreateWithPascalString( kCFAllocatorDefault, fontName255, kCFStringEncodingMacRoman ); - ::CFStringGetCString( fontNameCF, fontName, (CFIndex)255, kCFStringEncodingMacRoman ); - - font.Create((const char *)fontName, 0, style.size, false, false); + lineHeight = lineHeight_; + unicodeMode = unicodeMode_; + maxWidth = 2000; + + NSRect lbRect = NSMakeRect(pt.x,pt.y, 120, lineHeight * desiredVisibleRows); + NSWindow* winLB = [[NSWindow alloc] initWithContentRect: lbRect + styleMask: NSBorderlessWindowMask + backing: NSBackingStoreBuffered + defer: NO]; + [winLB setLevel:NSFloatingWindowLevel]; + [winLB setHasShadow:YES]; + scroller = [NSScrollView alloc]; + NSRect scRect = NSMakeRect(0, 0, lbRect.size.width, lbRect.size.height); + [scroller initWithFrame: scRect]; + [scroller setHasVerticalScroller:YES]; + table = [[NSTableView alloc] initWithFrame: scRect]; + [table setHeaderView:nil]; + [scroller setDocumentView: table]; + colIcon = [[NSTableColumn alloc] initWithIdentifier:@"icon"]; + [colIcon setWidth: 20]; + [colIcon setEditable:NO]; + [colIcon setHidden:YES]; + NSImageCell* imCell = [[[NSImageCell alloc] init] autorelease]; + [colIcon setDataCell:imCell]; + [table addTableColumn:colIcon]; + colText = [[NSTableColumn alloc] initWithIdentifier:@"name"]; + [colText setResizingMask:NSTableColumnAutoresizingMask]; + [colText setEditable:NO]; + [table addTableColumn:colText]; + ds = [[AutoCompletionDataSource alloc] init]; + [ds setBox:this]; + [table setDataSource: ds]; // Weak reference + [scroller setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable]; + [[winLB contentView] addSubview: scroller]; + + [table setTarget:ds]; + [table setDoubleAction:@selector(doubleClick:)]; + wid = winLB; +} + +void ListBoxImpl::SetFont(Font& font_) +{ + font.SetID(font_.GetID()); + // NSCell setFont takes an NSFont* rather than a CTFontRef but they + // are the same thing toll-free bridged. + QuartzTextStyle* style = reinterpret_cast(font_.GetID()); + NSFont *pfont = (NSFont *)style->getFontRef(); + [[colText dataCell] setFont: pfont]; + CGFloat itemHeight = lround([pfont ascender] - [pfont descender]); + [table setRowHeight:itemHeight]; } -void ListBoxImpl::SetAverageCharWidth(int width) { +void ListBoxImpl::SetAverageCharWidth(int width) +{ aveCharWidth = width; } -void ListBoxImpl::SetVisibleRows(int rows) { +void ListBoxImpl::SetVisibleRows(int rows) +{ desiredVisibleRows = rows; } -int ListBoxImpl::GetVisibleRows() const { - // XXX Windows & GTK do this, but it seems incorrect to me. Other logic - // to do with visible rows is essentially the same across platforms. +int ListBoxImpl::GetVisibleRows() const +{ return desiredVisibleRows; - /* - // This would be more correct - int rows = Length(); - if ((rows == 0) || (rows > desiredVisibleRows)) - rows = desiredVisibleRows; - return rows; - */ -} - -PRectangle ListBoxImpl::GetDesiredRect() { - PRectangle rcDesired = GetPosition(); - - // XXX because setting the line height on the table doesnt - // *stick*, we'll have to suffer and just use whatever - // the table desides is the correct height. - UInt16 itemHeight;// = lineHeight; - //GetDataBrowserTableViewRowHeight(lb, &itemHeight); - +} + +PRectangle ListBoxImpl::GetDesiredRect() +{ + PRectangle rcDesired; + rcDesired = GetPosition(); + + // There appears to be an extra pixel above and below the row contents + int itemHeight = [table rowHeight] + 2; + int rows = Length(); if ((rows == 0) || (rows > desiredVisibleRows)) rows = desiredVisibleRows; - - rcDesired.bottom = itemHeight * rows; + + rcDesired.bottom = rcDesired.top + itemHeight * rows; rcDesired.right = rcDesired.left + maxItemWidth + aveCharWidth; - - if (Length() > rows) - rcDesired.right += kScrollBarWidth; - rcDesired.right += IconWidth(); - - // Set the column width - //SetDataBrowserTableViewColumnWidth (lb, UInt16 (rcDesired.right - rcDesired.left)); - return rcDesired; -} -void ListBoxImpl::ShowHideScrollbar() { - int rows = Length(); - if (rows > desiredVisibleRows) { - //SetDataBrowserHasScrollBars(lb, false, true); - } else { - //SetDataBrowserHasScrollBars(lb, false, false); + if (Length() > rows) + { + [scroller setHasVerticalScroller:YES]; + rcDesired.right += [NSScroller scrollerWidth]; } -} + else + { + [scroller setHasVerticalScroller:NO]; + } + rcDesired.right += maxIconWidth; + rcDesired.right += 6; -int ListBoxImpl::IconWidth() { - return xset.GetWidth() + 2; + return rcDesired; } -int ListBoxImpl::CaretFromEdge() { - return 0; +int ListBoxImpl::CaretFromEdge() +{ + if ([colIcon isHidden]) + return 3; + else + return 6 + [colIcon width]; } -void ListBoxImpl::Clear() { - // passing NULL to "items" arg 4 clears the list +void ListBoxImpl::Clear() +{ maxItemWidth = 0; + maxIconWidth = 0; ld.Clear(); - //AddDataBrowserItems (lb, kDataBrowserNoItem, 0, NULL, kDataBrowserItemNoProperty); } -void ListBoxImpl::Append(char *s, int type) { +void ListBoxImpl::Append(char* s, int type) +{ int count = Length(); - CFStringRef r = CFStringCreateWithCString(NULL, s, kTextEncodingMacRoman); - ld.Add(count, type, r); - + ld.Add(count, type, s); + Scintilla::SurfaceImpl surface; - unsigned int width = surface.WidthText (font, s, strlen (s)); + unsigned int width = surface.WidthText(font, s, static_cast(strlen(s))); if (width > maxItemWidth) + { maxItemWidth = width; - - DataBrowserItemID items[1]; - items[0] = count + 1; - //AddDataBrowserItems (lb, kDataBrowserNoItem, 1, items, kDataBrowserItemNoProperty); - ShowHideScrollbar(); + [colText setWidth: maxItemWidth]; + } + ImageMap::iterator it = images.find(type); + if (it != images.end()) + { + NSImage* img = it->second; + if (img) + { + unsigned int widthIcon = img.size.width; + if (widthIcon > maxIconWidth) + { + [colIcon setHidden: NO]; + maxIconWidth = widthIcon; + [colIcon setWidth: maxIconWidth]; + } + } + } } -void ListBoxImpl::SetList(const char* list, char separator, char typesep) { - // XXX copied from PlatGTK, should be in base class +void ListBoxImpl::SetList(const char* list, char separator, char typesep) +{ Clear(); - int count = strlen(list) + 1; - char *words = new char[count]; - if (words) { + size_t count = strlen(list) + 1; + char* words = new char[count]; + if (words) + { memcpy(words, list, count); - char *startword = words; - char *numword = NULL; + char* startword = words; + char* numword = NULL; int i = 0; - for (; words[i]; i++) { - if (words[i] == separator) { + for (; words[i]; i++) + { + if (words[i] == separator) + { words[i] = '\0'; if (numword) *numword = '\0'; Append(startword, numword?atoi(numword + 1):-1); startword = words + i + 1; numword = NULL; - } else if (words[i] == typesep) { + } + else if (words[i] == typesep) + { numword = words + i; } } - if (startword) { + if (startword) + { if (numword) *numword = '\0'; Append(startword, numword?atoi(numword + 1):-1); } delete []words; } + [table reloadData]; +} + +int ListBoxImpl::Length() +{ + return ld.Length(); +} + +void ListBoxImpl::Select(int n) +{ + [table selectRowIndexes:[NSIndexSet indexSetWithIndex:n] byExtendingSelection:NO]; + [table scrollRowToVisible:n]; } -int ListBoxImpl::Length() { - UInt32 numItems = 0; - //GetDataBrowserItemCount(lb, kDataBrowserNoItem, false, kDataBrowserItemAnyState, &numItems); - return (int)numItems; -} - -void ListBoxImpl::Select(int n) { - DataBrowserItemID items[1]; - items[0] = n + 1; - //SetDataBrowserSelectedItems(lb, 1, items, kDataBrowserItemsAssign); - //RevealDataBrowserItem(lb, items[0], kIconColumn, kDataBrowserRevealOnly); - // force update on selection - //Draw1Control(lb); -} - -int ListBoxImpl::GetSelection() { - Handle selectedItems = NewHandle(0); - //GetDataBrowserItems(lb, kDataBrowserNoItem, true, kDataBrowserItemIsSelected, selectedItems); - UInt32 numSelectedItems = GetHandleSize(selectedItems)/sizeof(DataBrowserItemID); - if (numSelectedItems == 0) { - return -1; - } - HLock( selectedItems ); - DataBrowserItemID *individualItem = (DataBrowserItemID*)( *selectedItems ); - DataBrowserItemID selected[numSelectedItems]; - selected[0] = *individualItem; - HUnlock( selectedItems ); - return selected[0] - 1; +int ListBoxImpl::GetSelection() +{ + return static_cast([table selectedRow]); } -int ListBoxImpl::Find(const char *prefix) { +int ListBoxImpl::Find(const char* prefix) +{ int count = Length(); - char s[255]; - for (int i = 0; i < count; i++) { - GetValue(i, s, 255); - if ((s[0] != '\0') && (0 == strncmp(prefix, s, strlen(prefix)))) { + for (int i = 0; i < count; i++) + { + const char* s = ld.GetString(i); + if (s && (s[0] != '\0') && (0 == strncmp(prefix, s, strlen(prefix)))) + { return i; } } return - 1; } -void ListBoxImpl::GetValue(int n, char *value, int len) { - CFStringRef textString = ld.GetString(n); - if (textString == NULL) { +void ListBoxImpl::GetValue(int n, char* value, int len) +{ + const char* textString = ld.GetString(n); + if (textString == NULL) + { value[0] = '\0'; return; } - CFIndex numUniChars = CFStringGetLength( textString ); - - // XXX how do we know the encoding of the listbox? - CFStringEncoding encoding = kCFStringEncodingUTF8; //( IsUnicodeMode() ? kCFStringEncodingUTF8 : kCFStringEncodingASCII); - CFIndex maximumByteLength = CFStringGetMaximumSizeForEncoding( numUniChars, encoding ) + 1; - char* text = new char[maximumByteLength]; - CFIndex usedBufferLength = 0; - CFStringGetBytes( textString, CFRangeMake( 0, numUniChars ), encoding, - '?', false, reinterpret_cast( text ), - maximumByteLength, &usedBufferLength ); - text[usedBufferLength] = '\0'; // null terminate the ASCII/UTF8 string - - if (text && len > 0) { - strncpy(value, text, len); - value[len - 1] = '\0'; - } else { - value[0] = '\0'; + strncpy(value, textString, len); + value[len - 1] = '\0'; +} + +void ListBoxImpl::RegisterImage(int type, const char* xpm_data) +{ + XPM xpm(xpm_data); + NSImage* img = ImageFromXPM(&xpm); + [img retain]; + ImageMap::iterator it=images.find(type); + if (it == images.end()) + { + images[type] = img; + } + else + { + [it->second release]; + it->second = img; } - delete text; } -void ListBoxImpl::Sort() { - // TODO: Implement this - fprintf(stderr, "ListBox::Sort\n"); +void ListBoxImpl::RegisterRGBAImage(int type, int width, int height, const unsigned char *pixelsImage) { + CGImageRef imageRef = ImageCreateFromRGBA(width, height, pixelsImage, false); + NSSize sz = {width, height}; + NSImage *img = [[[NSImage alloc] initWithSize: sz] autorelease]; + NSBitmapImageRep *bitmapRep = [[NSBitmapImageRep alloc] initWithCGImage: imageRef]; + [img addRepresentation: bitmapRep]; + [bitmapRep release]; + CGImageRelease(imageRef); + [img retain]; + ImageMap::iterator it=images.find(type); + if (it == images.end()) + { + images[type] = img; + } + else + { + [it->second release]; + it->second = img; + } } -void ListBoxImpl::RegisterImage(int type, const char *xpm_data) { - xset.Add(type, xpm_data); +void ListBoxImpl::ClearRegisteredImages() +{ + for (ImageMap::iterator it=images.begin(); + it != images.end(); ++it) + { + [it->second release]; + it->second = nil; + } + images.clear(); +} + +int ListBoxImpl::Rows() +{ + return ld.Length(); } -void ListBoxImpl::ClearRegisteredImages() { - xset.Clear(); +NSImage* ListBoxImpl::ImageForRow(NSInteger row) +{ + ImageMap::iterator it = images.find(ld.GetType(row)); + if (it != images.end()) + { + NSImage* img = it->second; + return img; + } + else + { + return nil; + } +} + +NSString* ListBoxImpl::TextForRow(NSInteger row) +{ + const char* textString = ld.GetString(row); + NSString* sTitle; + if (unicodeMode) + sTitle = [NSString stringWithUTF8String:textString]; + else + sTitle = [NSString stringWithCString:textString encoding:NSWindowsCP1252StringEncoding]; + return sTitle; +} + +void ListBoxImpl::DoubleClick() +{ + if (doubleClickAction) + { + doubleClickAction(doubleClickActionData); + } } //----------------- ScintillaContextMenu ----------------------------------------------------------- @@ -1889,7 +1915,7 @@ //-------------------------------------------------------------------------------------------------- -void Menu::Show(Point pt, Window &) +void Menu::Show(Point, Window &) { // Cocoa menus are handled a bit differently. We only create the menu. The framework // takes care to show it properly. @@ -1897,11 +1923,12 @@ //----------------- ElapsedTime -------------------------------------------------------------------- -// TODO: Consider if I should be using GetCurrentEventTime instead of gettimeoday +// ElapsedTime is used for precise performance measurements during development +// and not for anything a user sees. + ElapsedTime::ElapsedTime() { struct timeval curTime; - int retVal; - retVal = gettimeofday( &curTime, NULL ); + gettimeofday( &curTime, NULL ); bigBit = curTime.tv_sec; littleBit = curTime.tv_usec; @@ -1909,8 +1936,7 @@ double ElapsedTime::Duration(bool reset) { struct timeval curTime; - int retVal; - retVal = gettimeofday( &curTime, NULL ); + gettimeofday( &curTime, NULL ); long endBigBit = curTime.tv_sec; long endLittleBit = curTime.tv_usec; double result = 1000000.0 * (endBigBit - bigBit); @@ -1955,7 +1981,8 @@ */ int Platform::DefaultFontSize() { - return [[NSUserDefaults standardUserDefaults] integerForKey: @"NSFixedPitchFontSize"]; + return static_cast([[NSUserDefaults standardUserDefaults] + integerForKey: @"NSFixedPitchFontSize"]); } //-------------------------------------------------------------------------------------------------- @@ -2006,15 +2033,39 @@ bool Platform::IsDBCSLeadByte(int codePage, char ch) { - // No support for DBCS. + // Byte ranges found in Wikipedia articles with relevant search strings in each case + unsigned char uch = static_cast(ch); + switch (codePage) + { + case 932: + // Shift_jis + return ((uch >= 0x81) && (uch <= 0x9F)) || + ((uch >= 0xE0) && (uch <= 0xFC)); + // Lead bytes F0 to FC may be a Microsoft addition. + case 936: + // GBK + return (uch >= 0x81) && (uch <= 0xFE); + case 949: + // Korean Wansung KS C-5601-1987 + return (uch >= 0x81) && (uch <= 0xFE); + case 950: + // Big5 + return (uch >= 0x81) && (uch <= 0xFE); + case 1361: + // Korean Johab KS C-5601-1992 + return + ((uch >= 0x84) && (uch <= 0xD3)) || + ((uch >= 0xD8) && (uch <= 0xDE)) || + ((uch >= 0xE0) && (uch <= 0xF9)); + } return false; } //-------------------------------------------------------------------------------------------------- -int Platform::DBCSCharLength(int codePage, const char* s) +int Platform::DBCSCharLength(int /* codePage */, const char* /* s */) { - // No support for DBCS. + // DBCS no longer uses this. return 1; } @@ -2022,7 +2073,6 @@ int Platform::DBCSCharMaxLength() { - // No support for DBCS. return 2; } @@ -2115,8 +2165,9 @@ * @param modulePath The path to the module to load. * @return A library instance or NULL if the module could not be found or another problem occured. */ -DynamicLibrary* DynamicLibrary::Load(const char* modulePath) +DynamicLibrary* DynamicLibrary::Load(const char* /* modulePath */) { + // Not implemented. return NULL; } diff -Nru scite-2.25/scintilla/cocoa/QuartzTextLayout.h scite-3.0.2/scintilla/cocoa/QuartzTextLayout.h --- scite-2.25/scintilla/cocoa/QuartzTextLayout.h 2010-10-27 21:15:45.000000000 +0000 +++ scite-3.0.2/scintilla/cocoa/QuartzTextLayout.h 2011-08-01 02:49:04.000000000 +0000 @@ -15,127 +15,97 @@ #include "QuartzTextStyle.h" + class QuartzTextLayout { public: /** Create a text layout for drawing on the specified context. */ - QuartzTextLayout( CGContextRef context ) : layout( NULL ), unicode_string( NULL ), unicode_length( 0 ) + QuartzTextLayout( CGContextRef context ) { - OSStatus err = ATSUCreateTextLayout( &layout ); - if (0 != err) - layout = NULL; - + mString = NULL; + mLine = NULL; + stringLength = 0; setContext(context); - - ATSUAttributeTag tag = kATSULineLayoutOptionsTag; - ByteCount size = sizeof( ATSLineLayoutOptions ); - ATSLineLayoutOptions rendering = kATSLineUseDeviceMetrics; //| kATSLineFractDisable | kATSLineUseQDRendering - ATSUAttributeValuePtr valuePtr = &rendering; - err = ATSUSetLayoutControls( layout, 1, &tag, &size, &valuePtr ); } ~QuartzTextLayout() { - if (NULL != layout) - ATSUDisposeTextLayout( layout ); - layout = NULL; - - if ( unicode_string != NULL ) - { - delete[] unicode_string; - unicode_string = NULL; - unicode_length = 0; - } - } - - /** Assign a string to the text layout object. */ - // TODO: Create a UTF8 version - // TODO: Optimise the ASCII version by not copying so much - OSStatus setText( const UInt8* buffer, size_t byteLength, CFStringEncoding encoding ) - { - if (NULL == layout) - return -1; - CFStringRef str = CFStringCreateWithBytes( NULL, buffer, byteLength, encoding, false ); - if (!str) - return -1; - - unicode_length = CFStringGetLength( str ); - if (unicode_string) - delete[] unicode_string; - unicode_string = new UniChar[ unicode_length ]; - CFStringGetCharacters( str, CFRangeMake( 0, unicode_length ), unicode_string ); - - CFRelease( str ); - str = NULL; - - OSStatus err; - err = ATSUSetTextPointerLocation( layout, unicode_string, kATSUFromTextBeginning, kATSUToTextEnd, unicode_length ); - if( err != noErr ) return err; - - // Turn on the default font fallbacks - return ATSUSetTransientFontMatching( layout, true ); - } - - inline void setText( const UInt8* buffer, size_t byteLength, const QuartzTextStyle& r ) - { - this->setText( buffer, byteLength, kCFStringEncodingUTF8 ); - ATSUSetRunStyle( layout, r.getATSUStyle(), 0, unicode_length ); + if ( mString != NULL ) + { + CFRelease(mString); + mString = NULL; + } + if ( mLine != NULL ) + { + CFRelease(mLine); + mLine = NULL; + } } - /** Apply the specified text style on the entire range of text. */ - void setStyle( const QuartzTextStyle& style ) + inline void setText( const UInt8* buffer, size_t byteLength, CFStringEncoding encoding, const QuartzTextStyle& r ) { - ATSUSetRunStyle( layout, style.getATSUStyle(), kATSUFromTextBeginning, kATSUToTextEnd ); + CFStringRef str = CFStringCreateWithBytes( NULL, buffer, byteLength, encoding, false ); + if (!str) + return; + + stringLength = CFStringGetLength(str); + + CFMutableDictionaryRef stringAttribs = r.getCTStyle(); + + if (mString != NULL) + CFRelease(mString); + mString = ::CFAttributedStringCreate(NULL, str, stringAttribs); + + if (mLine != NULL) + CFRelease(mLine); + mLine = ::CTLineCreateWithAttributedString(mString); + + CFRelease( str ); } - /** Draw the text layout into the current CGContext at the specified position, flipping the CGContext's Y axis if required. + /** Draw the text layout into the current CGContext at the specified position. * @param x The x axis position to draw the baseline in the current CGContext. - * @param y The y axis position to draw the baseline in the current CGContext. - * @param flipTextYAxis If true, the CGContext's Y axis will be flipped before drawing the text, and restored afterwards. Use this when drawing in an HIView's CGContext, where the origin is the top left corner. */ - void draw( float x, float y, bool flipTextYAxis = false ) - { - if (NULL == layout || 0 == unicode_length) - return; - if ( flipTextYAxis ) - { - CGContextSaveGState( gc ); - CGContextScaleCTM( gc, 1.0, -1.0 ); - y = -y; - } - - OSStatus err; - err = ATSUDrawText( layout, kATSUFromTextBeginning, kATSUToTextEnd, X2Fix( x ), X2Fix( y ) ); - - if ( flipTextYAxis ) CGContextRestoreGState( gc ); - } - - /** Sets a single text layout control on the ATSUTextLayout object. - * @param tag The control to set. - * @param size The size of the parameter pointed to by value. - * @param value A pointer to the new value for the control. - */ - void setControl( ATSUAttributeTag tag, ByteCount size, ATSUAttributeValuePtr value ) + * @param y The y axis position to draw the baseline in the current CGContext. */ + void draw( float x, float y ) { - ATSUSetLayoutControls( layout, 1, &tag, &size, &value ); - } - - ATSUTextLayout getLayout() { - return layout; + if (mLine == NULL) + return; + + ::CGContextSetTextMatrix(gc, CGAffineTransformMakeScale(1.0, -1.0)); + + // Set the text drawing position. + ::CGContextSetTextPosition(gc, x, y); + + // And finally, draw! + ::CTLineDraw(mLine, gc); + } + + float MeasureStringWidth() + { + if (mLine == NULL) + return 0.0f; + + return ::CTLineGetTypographicBounds(mLine, NULL, NULL, NULL); + } + + CTLineRef getCTLine() { + return mLine; + } + + CFIndex getStringLength() { + return stringLength; } - inline CFIndex getLength() const { return unicode_length; } inline void setContext (CGContextRef context) { gc = context; - if (NULL != layout) - setControl( kATSUCGContextTag, sizeof( gc ), &gc ); } private: - ATSUTextLayout layout; - UniChar* unicode_string; - int unicode_length; CGContextRef gc; + CFAttributedStringRef mString; + CTLineRef mLine; + CFIndex stringLength; }; #endif diff -Nru scite-2.25/scintilla/cocoa/QuartzTextStyleAttribute.h scite-3.0.2/scintilla/cocoa/QuartzTextStyleAttribute.h --- scite-2.25/scintilla/cocoa/QuartzTextStyleAttribute.h 2010-10-27 21:15:45.000000000 +0000 +++ scite-3.0.2/scintilla/cocoa/QuartzTextStyleAttribute.h 2011-09-26 11:41:36.000000000 +0000 @@ -12,131 +12,71 @@ #ifndef _QUARTZ_TEXT_STYLE_ATTRIBUTE_H #define _QUARTZ_TEXT_STYLE_ATTRIBUTE_H -class QuartzTextStyleAttribute -{ -public: - QuartzTextStyleAttribute() {} - virtual ~QuartzTextStyleAttribute() {} - virtual ByteCount getSize() const = 0; - virtual ATSUAttributeValuePtr getValuePtr() = 0; - virtual ATSUAttributeTag getTag() const = 0; -}; - -class QuartzTextSize : public QuartzTextStyleAttribute -{ -public: - QuartzTextSize( float points ) - { - size = X2Fix( points ); - } - - ByteCount getSize() const - { - return sizeof( size ); - } - - ATSUAttributeValuePtr getValuePtr() - { - return &size; - } - - ATSUAttributeTag getTag() const - { - return kATSUSizeTag; - } - -private: - Fixed size; -}; - -class QuartzTextStyleAttributeBoolean : public QuartzTextStyleAttribute -{ -public: - QuartzTextStyleAttributeBoolean( bool newVal ) : value( newVal ) {} - - ByteCount getSize() const - { - return sizeof( value ); - } - ATSUAttributeValuePtr getValuePtr() - { - return &value; - } - - virtual ATSUAttributeTag getTag() const = 0; - -private: - Boolean value; -}; - -class QuartzTextBold : public QuartzTextStyleAttributeBoolean -{ -public: - QuartzTextBold( bool newVal ) : QuartzTextStyleAttributeBoolean( newVal ) {} - ATSUAttributeTag getTag() const - { - return kATSUQDBoldfaceTag; - } -}; - -class QuartzTextItalic : public QuartzTextStyleAttributeBoolean -{ -public: - QuartzTextItalic( bool newVal ) : QuartzTextStyleAttributeBoolean( newVal ) {} - ATSUAttributeTag getTag() const - { - return kATSUQDItalicTag; - } -}; - -class QuartzTextUnderline : public QuartzTextStyleAttributeBoolean -{ -public: - QuartzTextUnderline( bool newVal ) : QuartzTextStyleAttributeBoolean( newVal ) {} - ATSUAttributeTag getTag() const { - return kATSUQDUnderlineTag; - } -}; - -class QuartzFont : public QuartzTextStyleAttribute +class QuartzFont { public: /** Create a font style from a name. */ - QuartzFont( const char* name, int length ) + QuartzFont( const char* name, size_t length, float size, int weight, bool italic ) { assert( name != NULL && length > 0 && name[length] == '\0' ); - // try to create font - OSStatus err = ATSUFindFontFromName( const_cast( name ), length, kFontFullName, (unsigned) kFontNoPlatform, kFontRomanScript, (unsigned) kFontNoLanguage, &fontid ); - // need a fallback if font isn't installed - if( err != noErr || fontid == kATSUInvalidFontID ) - ::ATSUFindFontFromName( "Lucida Grande", 13, kFontFullName, (unsigned) kFontNoPlatform, kFontRomanScript, (unsigned) kFontNoLanguage, &fontid ); - } + CFStringRef fontName = CFStringCreateWithCString(kCFAllocatorDefault, name, kCFStringEncodingMacRoman); + assert(fontName != NULL); + bool bold = weight > SC_WEIGHT_NORMAL; + + if (bold || italic) + { + CTFontSymbolicTraits desiredTrait = 0; + CTFontSymbolicTraits traitMask = 0; + + // if bold was specified, add the trait + if (bold) { + desiredTrait |= kCTFontBoldTrait; + traitMask |= kCTFontBoldTrait; + } + + // if italic was specified, add the trait + if (italic) { + desiredTrait |= kCTFontItalicTrait; + traitMask |= kCTFontItalicTrait; + } + + // create a font and then a copy of it with the sym traits + CTFontRef iFont = ::CTFontCreateWithName(fontName, size, NULL); + fontid = ::CTFontCreateCopyWithSymbolicTraits(iFont, size, NULL, desiredTrait, traitMask); + if (fontid) + { + CFRelease(iFont); + } + else + { + // Traits failed so use base font + fontid = iFont; + } + } + else + { + // create the font, no traits + fontid = ::CTFontCreateWithName(fontName, size, NULL); + } + + if (!fontid) + { + // Failed to create requested font so use font always present + fontid = ::CTFontCreateWithName((CFStringRef)@"Monaco", size, NULL); + } - ByteCount getSize() const - { - return sizeof( fontid ); + CFRelease(fontName); } - ATSUAttributeValuePtr getValuePtr() - { - return &fontid; - } - - ATSUAttributeTag getTag() const - { - return kATSUFontTag; - } - - ATSUFontID getFontID() const + CTFontRef getFontID() { return fontid; } private: - ATSUFontID fontid; + CTFontRef fontid; }; - #endif diff -Nru scite-2.25/scintilla/cocoa/QuartzTextStyle.h scite-3.0.2/scintilla/cocoa/QuartzTextStyle.h --- scite-2.25/scintilla/cocoa/QuartzTextStyle.h 2010-10-27 21:15:45.000000000 +0000 +++ scite-3.0.2/scintilla/cocoa/QuartzTextStyle.h 2011-08-01 02:49:04.000000000 +0000 @@ -15,75 +15,83 @@ public: QuartzTextStyle() { - ATSUCreateStyle( &style ); - } - - ~QuartzTextStyle() - { - if ( style != NULL ) - ATSUDisposeStyle( style ); - style = NULL; - } - - void setAttribute( ATSUAttributeTag tag, ByteCount size, ATSUAttributeValuePtr value ) - { - ATSUSetAttributes( style, 1, &tag, &size, &value ); - } - - void setAttribute( QuartzTextStyleAttribute& attribute ) - { - setAttribute( attribute.getTag(), attribute.getSize(), attribute.getValuePtr() ); - } - - void getAttribute( ATSUAttributeTag tag, ByteCount size, ATSUAttributeValuePtr value, ByteCount* actualSize ) - { - ATSUGetAttribute( style, tag, size, value, actualSize ); - } - - template - T getAttribute( ATSUAttributeTag tag ) - { - T value; - ByteCount actualSize; - ATSUGetAttribute( style, tag, sizeof( T ), &value, &actualSize ); - return value; - } - - // TODO: Is calling this actually faster than calling setAttribute multiple times? - void setAttributes( QuartzTextStyleAttribute* attributes[], int number ) - { - // Create the parallel arrays and initialize them properly - ATSUAttributeTag* tags = new ATSUAttributeTag[ number ]; - ByteCount* sizes = new ByteCount[ number ]; - ATSUAttributeValuePtr* values = new ATSUAttributeValuePtr[ number ]; - - for ( int i = 0; i < number; ++ i ) - { - tags[i] = attributes[i]->getTag(); - sizes[i] = attributes[i]->getSize(); - values[i] = attributes[i]->getValuePtr(); - } - - ATSUSetAttributes( style, number, tags, sizes, values ); - - // Free the arrays that were allocated - delete[] tags; - delete[] sizes; - delete[] values; - } + fontRef = NULL; + styleDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 2, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); - void setFontFeature( ATSUFontFeatureType featureType, ATSUFontFeatureSelector selector ) - { - ATSUSetFontFeatures( style, 1, &featureType, &selector ); + characterSet = 0; } - const ATSUStyle& getATSUStyle() const + ~QuartzTextStyle() { - return style; - } - + if (styleDict != NULL) + { + CFRelease(styleDict); + styleDict = NULL; + } + + if (fontRef) + { + CFRelease(fontRef); + fontRef = NULL; + } + } + + CFMutableDictionaryRef getCTStyle() const + { + return styleDict; + } + + void setCTStyleColor(CGColor* inColor ) + { + CFDictionarySetValue(styleDict, kCTForegroundColorAttributeName, inColor); + } + + float getAscent() const + { + return ::CTFontGetAscent(fontRef); + } + + float getDescent() const + { + return ::CTFontGetDescent(fontRef); + } + + float getLeading() const + { + return ::CTFontGetLeading(fontRef); + } + + void setFontRef(CTFontRef inRef, int characterSet_) + { + fontRef = inRef; + characterSet = characterSet_; + + if (styleDict != NULL) + CFRelease(styleDict); + + styleDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 2, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + + CFDictionaryAddValue(styleDict, kCTFontAttributeName, fontRef); + } + + CTFontRef getFontRef() + { + return fontRef; + } + + int getCharacterSet() + { + return characterSet; + } + private: - ATSUStyle style; + CFMutableDictionaryRef styleDict; + CTFontRef fontRef; + int characterSet; }; #endif diff -Nru scite-2.25/scintilla/cocoa/ScintillaCallTip.h scite-3.0.2/scintilla/cocoa/ScintillaCallTip.h --- scite-2.25/scintilla/cocoa/ScintillaCallTip.h 2010-10-27 21:15:45.000000000 +0000 +++ scite-3.0.2/scintilla/cocoa/ScintillaCallTip.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,63 +0,0 @@ -/* - * ScintillaMacOSX.h - * tutorial - * - * Created by Evan Jones on Sun Sep 01 2002. - * - */ -#ifndef SCINTILLA_CALLTIP_H -#define SCINTILLA_CALLTIP_H - -#include "TView.h" - -#include -#include -#include -#include -#include - -#include "Platform.h" -#include "Scintilla.h" - -static const OSType scintillaCallTipType = 'Scct'; - -namespace Scintilla { - -class ScintillaCallTip : public TView -{ -public: - // Private so ScintillaCallTip objects can not be copied - ScintillaCallTip(const ScintillaCallTip &) : TView( NULL ) {} - ScintillaCallTip &operator=(const ScintillaCallTip &) { return * this; } - ~ScintillaCallTip() {}; - -public: - /** This is the class ID that we've assigned to Scintilla. */ - static const CFStringRef kScintillaCallTipClassID; - static const ControlKind kScintillaCallTipKind; - - ScintillaCallTip( void* windowid ); - - /** Returns the HIView object kind, needed to subclass TView. */ - virtual ControlKind GetKind() { return kScintillaCallTipKind; } - -private: - - virtual ControlPartCode HitTest( const HIPoint& where ); - virtual void Draw( RgnHandle rgn, CGContextRef gc ); - virtual OSStatus MouseDown( HIPoint& location, UInt32 modifiers, EventMouseButton button, UInt32 clickCount ); - virtual OSStatus MouseUp( HIPoint& location, UInt32 modifiers, EventMouseButton button, UInt32 clickCount ); - virtual OSStatus MouseDragged( HIPoint& location, UInt32 modifiers, EventMouseButton button, UInt32 clickCount ); - -public: - static HIViewRef Create(); -private: - static OSStatus Construct( HIViewRef inControl, TView** outView ); - -}; - - -} - - -#endif diff -Nru scite-2.25/scintilla/cocoa/ScintillaCallTip.mm scite-3.0.2/scintilla/cocoa/ScintillaCallTip.mm --- scite-2.25/scintilla/cocoa/ScintillaCallTip.mm 2010-10-27 21:15:45.000000000 +0000 +++ scite-3.0.2/scintilla/cocoa/ScintillaCallTip.mm 1970-01-01 00:00:00.000000000 +0000 @@ -1,117 +0,0 @@ - -#include "ScintillaCocoa.h" -#include "ScintillaCallTip.h" -#include "CallTip.h" - -using namespace Scintilla; - -const CFStringRef ScintillaCallTip::kScintillaCallTipClassID = CFSTR( "org.scintilla.calltip" ); -const ControlKind ScintillaCallTip::kScintillaCallTipKind = { 'ejon', 'Scct' }; - -ScintillaCallTip::ScintillaCallTip( void* windowid ) : - TView( reinterpret_cast( windowid ) ) -{ - ActivateInterface( kMouse ); - // debugPrint = true; -} - -void ScintillaCallTip::Draw( - RgnHandle /*inLimitRgn*/, - CGContextRef inContext ) -{ - // Get a reference to the Scintilla C++ object - CallTip* ctip = NULL; - OSStatus err; - err = GetControlProperty( GetViewRef(), scintillaCallTipType, 0, sizeof( ctip ), NULL, &ctip ); - assert(err == noErr); - if (ctip == NULL) return; - - Rect contentBounds; - GetControlBounds(GetViewRef(), &contentBounds); - - HIRect controlFrame; - HIViewGetFrame( GetViewRef(), &controlFrame ); - - // what is the global pos? - Surface *surfaceWindow = Surface::Allocate(); - if (surfaceWindow) { - surfaceWindow->Init(inContext, GetViewRef()); - ctip->PaintCT(surfaceWindow); - surfaceWindow->Release(); - delete surfaceWindow; - } - -} - -ControlPartCode ScintillaCallTip::HitTest( const HIPoint& where ) -{ - if ( CGRectContainsPoint( Bounds(), where ) ) - return 1; - else - return kControlNoPart; -} - -OSStatus ScintillaCallTip::MouseDown(HIPoint& location, UInt32 /*inKeyModifiers*/, EventMouseButton button, UInt32 /*inClickCount*/ ) -{ - if ( button != kEventMouseButtonPrimary ) return eventNotHandledErr; - CallTip* ctip = NULL; - ScintillaCocoa *sciThis = NULL; - OSStatus err = GetControlProperty( GetViewRef(), scintillaCallTipType, 0, sizeof( ctip ), NULL, &ctip ); - err = GetControlProperty( GetViewRef(), scintillaMacOSType, 0, sizeof( sciThis ), NULL, &sciThis ); - ctip->MouseClick( Scintilla::Point( static_cast( location.x ), static_cast( location.y ) )); - sciThis->CallTipClick(); - return noErr; -} - -OSStatus ScintillaCallTip::MouseUp(HIPoint& /*inMouseLocation*/, UInt32 /*inKeyModifiers*/, EventMouseButton button, UInt32 /*inClickCount*/ ) -{ - if ( button != kEventMouseButtonPrimary ) return eventNotHandledErr; - return noErr; -} - -OSStatus ScintillaCallTip::MouseDragged( HIPoint& location, UInt32 /*modifiers*/, EventMouseButton /*button*/, UInt32 /*clickCount*/ ) -{ - SetThemeCursor( kThemeArrowCursor ); - return noErr; -} - -HIViewRef ScintillaCallTip::Create() -{ - // Register the HIView, if needed - static bool registered = false; - - if ( not registered ) - { - TView::RegisterSubclass( kScintillaCallTipClassID, Construct ); - registered = true; - } - - OSStatus err = noErr; - EventRef event = CreateInitializationEvent(); - assert( event != NULL ); - - HIViewRef control = NULL; - err = HIObjectCreate( kScintillaCallTipClassID, event, reinterpret_cast( &control ) ); - ReleaseEvent( event ); - if ( err == noErr ) { - Platform::DebugPrintf("ScintillaCallTip::Create control %08X\n",control); - return control; - } - return NULL; -} - -OSStatus ScintillaCallTip::Construct( HIViewRef inControl, TView** outView ) -{ - *outView = new ScintillaCallTip( inControl ); - Platform::DebugPrintf("ScintillaCallTip::Construct scintilla %08X\n",*outView); - if ( *outView != NULL ) - return noErr; - else - return memFullErr; -} - -extern "C" { -HIViewRef scintilla_calltip_new() { - return ScintillaCallTip::Create(); -} -} diff -Nru scite-2.25/scintilla/cocoa/ScintillaCocoa.h scite-3.0.2/scintilla/cocoa/ScintillaCocoa.h --- scite-2.25/scintilla/cocoa/ScintillaCocoa.h 2010-10-27 21:15:45.000000000 +0000 +++ scite-3.0.2/scintilla/cocoa/ScintillaCocoa.h 2011-11-15 08:48:41.000000000 +0000 @@ -20,6 +20,7 @@ #include #include +#include #include "ILexer.h" @@ -115,15 +116,20 @@ int scrollSpeed; int scrollTicks; + NSTimer* tickTimer; + NSTimer* idleTimer; + protected: - NSView* ContentView(); PRectangle GetClientRectangle(); Point ConvertPoint(NSPoint point); virtual void Initialise(); virtual void Finalise(); + virtual CaseFolder *CaseFolderForEncoding(); virtual std::string CaseMapString(const std::string &s, int caseMapping); public: + NSView* ContentView(); + ScintillaCocoa(NSView* view); virtual ~ScintillaCocoa(); @@ -140,6 +146,7 @@ bool SetIdle(bool on); void SetMouseCapture(bool on); bool HaveMouseCapture(); + void ScrollText(int linesToMove); void SetVerticalScrollPos(); void SetHorizontalScrollPos(); bool ModifyScrollBars(int nMax, int nPage); @@ -160,6 +167,8 @@ virtual bool CanPaste(); virtual void Paste(); virtual void Paste(bool rectangular); + void CTPaint(void* gc, NSRect rc); + void CallTipMouseDown(NSPoint pt); virtual void CreateCallTipWindow(PRectangle rc); virtual void AddToPopUp(const char *label, int cmd = 0, bool enabled = true); virtual void ClaimSelection(); @@ -199,10 +208,7 @@ virtual NSMenu* CreateContextMenu(NSEvent* event); void HandleCommand(NSInteger command); -// virtual OSStatus ActiveStateChanged(); -// -// virtual void CallTipClick(); - + virtual void ActiveStateChanged(bool isActive); }; diff -Nru scite-2.25/scintilla/cocoa/ScintillaCocoa.mm scite-3.0.2/scintilla/cocoa/ScintillaCocoa.mm --- scite-2.25/scintilla/cocoa/ScintillaCocoa.mm 2011-03-17 22:41:24.000000000 +0000 +++ scite-3.0.2/scintilla/cocoa/ScintillaCocoa.mm 2011-11-15 08:48:41.000000000 +0000 @@ -32,24 +32,31 @@ //-------------------------------------------------------------------------------------------------- // Define keyboard shortcuts (equivalents) the Mac way. -#define SCI_CMD ( SCI_ALT | SCI_CTRL) +#define SCI_CMD ( SCI_CTRL) #define SCI_SCMD ( SCI_CMD | SCI_SHIFT) +#define SCI_SMETA ( SCI_META | SCI_SHIFT) static const KeyToCommand macMapDefault[] = { - {SCK_DOWN, SCI_CMD, SCI_DOCUMENTEND}, - {SCK_UP, SCI_CMD, SCI_DOCUMENTSTART}, - {SCK_LEFT, SCI_CMD, SCI_VCHOME}, - {SCK_LEFT, SCI_SCMD, SCI_VCHOMEEXTEND}, - {SCK_RIGHT, SCI_CMD, SCI_LINEEND}, - {SCK_RIGHT, SCI_SCMD, SCI_LINEENDEXTEND}, + // OS X specific + {SCK_DOWN, SCI_CTRL, SCI_DOCUMENTEND}, + {SCK_DOWN, SCI_CSHIFT, SCI_DOCUMENTENDEXTEND}, + {SCK_UP, SCI_CTRL, SCI_DOCUMENTSTART}, + {SCK_UP, SCI_CSHIFT, SCI_DOCUMENTSTARTEXTEND}, + {SCK_LEFT, SCI_CTRL, SCI_VCHOME}, + {SCK_LEFT, SCI_CSHIFT, SCI_VCHOMEEXTEND}, + {SCK_RIGHT, SCI_CTRL, SCI_LINEEND}, + {SCK_RIGHT, SCI_CSHIFT, SCI_LINEENDEXTEND}, + + // Similar to Windows and GTK+ + // Where equivalent clashes with OS X standard, use Meta instead {SCK_DOWN, SCI_NORM, SCI_LINEDOWN}, {SCK_DOWN, SCI_SHIFT, SCI_LINEDOWNEXTEND}, - {SCK_DOWN, SCI_CTRL, SCI_LINESCROLLDOWN}, + {SCK_DOWN, SCI_META, SCI_LINESCROLLDOWN}, {SCK_DOWN, SCI_ASHIFT, SCI_LINEDOWNRECTEXTEND}, {SCK_UP, SCI_NORM, SCI_LINEUP}, {SCK_UP, SCI_SHIFT, SCI_LINEUPEXTEND}, - {SCK_UP, SCI_CTRL, SCI_LINESCROLLUP}, + {SCK_UP, SCI_META, SCI_LINESCROLLUP}, {SCK_UP, SCI_ASHIFT, SCI_LINEUPRECTEXTEND}, {'[', SCI_CTRL, SCI_PARAUP}, {'[', SCI_CSHIFT, SCI_PARAUPEXTEND}, @@ -58,13 +65,15 @@ {SCK_LEFT, SCI_NORM, SCI_CHARLEFT}, {SCK_LEFT, SCI_SHIFT, SCI_CHARLEFTEXTEND}, {SCK_LEFT, SCI_ALT, SCI_WORDLEFT}, - {SCK_LEFT, SCI_CSHIFT, SCI_WORDLEFTEXTEND}, - {SCK_LEFT, SCI_ASHIFT, SCI_WORDLEFTEXTEND}, + {SCK_LEFT, SCI_META, SCI_WORDLEFT}, + {SCK_LEFT, SCI_SMETA, SCI_WORDLEFTEXTEND}, + {SCK_LEFT, SCI_ASHIFT, SCI_CHARLEFTRECTEXTEND}, {SCK_RIGHT, SCI_NORM, SCI_CHARRIGHT}, {SCK_RIGHT, SCI_SHIFT, SCI_CHARRIGHTEXTEND}, {SCK_RIGHT, SCI_ALT, SCI_WORDRIGHT}, - {SCK_RIGHT, SCI_CSHIFT, SCI_WORDRIGHTEXTEND}, - {SCK_RIGHT, SCI_ASHIFT, SCI_WORDRIGHTEXTEND}, + {SCK_RIGHT, SCI_META, SCI_WORDRIGHT}, + {SCK_RIGHT, SCI_SMETA, SCI_WORDRIGHTEXTEND}, + {SCK_RIGHT, SCI_ASHIFT, SCI_CHARRIGHTRECTEXTEND}, {'/', SCI_CTRL, SCI_WORDPARTLEFT}, {'/', SCI_CSHIFT, SCI_WORDPARTLEFTEXTEND}, {'\\', SCI_CTRL, SCI_WORDPARTRIGHT}, @@ -129,7 +138,7 @@ - (id) init: (void*) target { - [super init]; + self = [super init]; if (self != nil) { mTarget = target; @@ -169,6 +178,7 @@ */ - (void) idleTimerFired: (NSTimer*) timer { +#pragma unused(timer) // Idle timer event. // Post a new idle notification, which gets executed when the run loop is idle. // Since we are coalescing on name and sender there will always be only one actual notification @@ -188,6 +198,7 @@ */ - (void) idleTriggered: (NSNotification*) notification { +#pragma unused(notification) reinterpret_cast(mTarget)->IdleTimerFired(); } @@ -256,25 +267,164 @@ //-------------------------------------------------------------------------------------------------- /** + * Convert a core foundation string into an array of bytes in a particular encoding + */ + +static char *EncodedBytes(CFStringRef cfsRef, CFStringEncoding encoding) { + CFRange rangeAll = {0, CFStringGetLength(cfsRef)}; + CFIndex usedLen = 0; + CFStringGetBytes(cfsRef, rangeAll, encoding, '?', + false, NULL, 0, &usedLen); + + char *buffer = new char[usedLen+1]; + CFStringGetBytes(cfsRef, rangeAll, encoding, '?', + false, (UInt8 *)buffer,usedLen, NULL); + buffer[usedLen] = '\0'; + return buffer; +} + +//-------------------------------------------------------------------------------------------------- + +/** + * Case folders. + */ + +class CaseFolderUTF8 : public CaseFolderTable { +public: + CaseFolderUTF8() { + StandardASCII(); + } + virtual size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) { + if ((lenMixed == 1) && (sizeFolded > 0)) { + folded[0] = mapping[static_cast(mixed[0])]; + return 1; + } else { + CFStringRef cfsVal = CFStringCreateWithBytes(kCFAllocatorDefault, + reinterpret_cast(mixed), + lenMixed, kCFStringEncodingUTF8, false); + + NSString *sMapped = [(NSString *)cfsVal stringByFoldingWithOptions:NSCaseInsensitiveSearch + locale:[NSLocale currentLocale]]; + + const char *cpMapped = [sMapped UTF8String]; + size_t lenMapped = strlen(cpMapped); + if (lenMapped < sizeFolded) { + memcpy(folded, cpMapped, lenMapped); + } else { + lenMapped = 0; + } + CFRelease(cfsVal); + return lenMapped; + } + } +}; + +class CaseFolderDBCS : public CaseFolderTable { + CFStringEncoding encoding; +public: + CaseFolderDBCS(CFStringEncoding encoding_) : encoding(encoding_) { + StandardASCII(); + } + virtual size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) { + if ((lenMixed == 1) && (sizeFolded > 0)) { + folded[0] = mapping[static_cast(mixed[0])]; + return 1; + } else { + CFStringRef cfsVal = CFStringCreateWithBytes(kCFAllocatorDefault, + reinterpret_cast(mixed), + lenMixed, encoding, false); + + NSString *sMapped = [(NSString *)cfsVal stringByFoldingWithOptions:NSCaseInsensitiveSearch + locale:[NSLocale currentLocale]]; + + char *encoded = EncodedBytes((CFStringRef)sMapped, encoding); + + size_t lenMapped = strlen(encoded); + if (lenMapped < sizeFolded) { + memcpy(folded, encoded, lenMapped); + } else { + folded[0] = '\0'; + lenMapped = 1; + } + delete []encoded; + CFRelease(cfsVal); + return lenMapped; + } + // Something failed so return a single NUL byte + folded[0] = '\0'; + return 1; + } +}; + +CaseFolder *ScintillaCocoa::CaseFolderForEncoding() { + if (pdoc->dbcsCodePage == SC_CP_UTF8) { + return new CaseFolderUTF8(); + } else { + CFStringEncoding encoding = EncodingFromCharacterSet(IsUnicodeMode(), + vs.styles[STYLE_DEFAULT].characterSet); + if (pdoc->dbcsCodePage == 0) { + CaseFolderTable *pcf = new CaseFolderTable(); + pcf->StandardASCII(); + // Only for single byte encodings + for (int i=0x80; i<0x100; i++) { + char sCharacter[2] = "A"; + sCharacter[0] = i; + CFStringRef cfsVal = CFStringCreateWithBytes(kCFAllocatorDefault, + reinterpret_cast(sCharacter), + 1, encoding, false); + + NSString *sMapped = [(NSString *)cfsVal stringByFoldingWithOptions:NSCaseInsensitiveSearch + locale:[NSLocale currentLocale]]; + + char *encoded = EncodedBytes((CFStringRef)sMapped, encoding); + + if (strlen(encoded) == 1) { + pcf->SetTranslation(sCharacter[0], encoded[0]); + } + + delete []encoded; + CFRelease(cfsVal); + } + return pcf; + } else { + return new CaseFolderDBCS(encoding); + } + return 0; + } +} + + +//-------------------------------------------------------------------------------------------------- + +/** * Case-fold the given string depending on the specified case mapping type. - * Note: ScintillaCocoa exclusively works with Unicode. We don't even think about adding support for - * obsolete code page stuff. */ std::string ScintillaCocoa::CaseMapString(const std::string &s, int caseMapping) { - NSString* textToConvert = [NSString stringWithUTF8String: s.c_str()]; - std::string result; + CFStringEncoding encoding = EncodingFromCharacterSet(IsUnicodeMode(), + vs.styles[STYLE_DEFAULT].characterSet); + CFStringRef cfsVal = CFStringCreateWithBytes(kCFAllocatorDefault, + reinterpret_cast(s.c_str()), + s.length(), encoding, false); + + NSString *sMapped; switch (caseMapping) { case cmUpper: - result = [[textToConvert uppercaseString] UTF8String]; + sMapped = [(NSString *)cfsVal uppercaseString]; break; case cmLower: - result = [[textToConvert lowercaseString] UTF8String]; + sMapped = [(NSString *)cfsVal lowercaseString]; break; default: - result = s; + sMapped = (NSString *)cfsVal; } + + // Back to encoding + char *encoded = EncodedBytes((CFStringRef)sMapped, encoding); + std::string result(encoded); + delete []encoded; + CFRelease(cfsVal); return result; } @@ -379,7 +529,12 @@ return reinterpret_cast(this); case SCI_GRABFOCUS: - // TODO: implement it + [[ContentView() window] makeFirstResponder:ContentView()]; + break; + + case SCI_SETBUFFEREDDRAW: + // Buffered drawing not supported on Cocoa + bufferedDraw = false; break; case WM_UNICHAR: @@ -388,15 +543,15 @@ // performed. if (IsUnicodeMode()) { - NSString* input = [[NSString stringWithCharacters: (const unichar*) &wParam length: 1] autorelease]; + NSString* input = [NSString stringWithCharacters: (const unichar*) &wParam length: 1]; const char* utf8 = [input UTF8String]; - AddCharUTF((char*) utf8, strlen(utf8), false); + AddCharUTF((char*) utf8, static_cast(strlen(utf8)), false); return 1; } return 0; default: - unsigned int r = ScintillaBase::WndProc(iMessage, wParam, lParam); + sptr_t r = ScintillaBase::WndProc(iMessage, wParam, lParam); return r; } @@ -428,12 +583,11 @@ if (timer.ticking) { // Scintilla ticks = milliseconds - // Using userInfo as flag to distinct between tick and idle timer. - NSTimer* tickTimer = [NSTimer scheduledTimerWithTimeInterval: timer.tickSize / 1000.0 - target: timerTarget - selector: @selector(timerFired:) - userInfo: nil - repeats: YES]; + tickTimer = [NSTimer scheduledTimerWithTimeInterval: timer.tickSize / 1000.0 + target: timerTarget + selector: @selector(timerFired:) + userInfo: nil + repeats: YES]; timer.tickerID = reinterpret_cast(tickTimer); } else @@ -456,11 +610,11 @@ if (idler.state) { // Scintilla ticks = milliseconds - NSTimer* idleTimer = [NSTimer scheduledTimerWithTimeInterval: timer.tickSize / 1000.0 - target: timerTarget - selector: @selector(idleTimerFired:) - userInfo: nil - repeats: YES]; + idleTimer = [NSTimer scheduledTimerWithTimeInterval: timer.tickSize / 1000.0 + target: timerTarget + selector: @selector(idleTimerFired:) + userInfo: nil + repeats: YES]; idler.idlerID = reinterpret_cast(idleTimer); } else @@ -545,76 +699,97 @@ //-------------------------------------------------------------------------------------------------- -void ScintillaCocoa::CreateCallTipWindow(PRectangle rc) -{ -/* - // create a calltip window - if (!ct.wCallTip.Created()) { - WindowClass windowClass = kHelpWindowClass; - WindowAttributes attributes = kWindowNoAttributes; - Rect contentBounds; - WindowRef outWindow; - - // convert PRectangle to Rect - // this adjustment gets the calltip window placed in the correct location relative - // to our editor window - Rect bounds; - OSStatus err; - err = GetWindowBounds( this->GetOwner(), kWindowGlobalPortRgn, &bounds ); - assert( err == noErr ); - contentBounds.top = rc.top + bounds.top; - contentBounds.bottom = rc.bottom + bounds.top; - contentBounds.right = rc.right + bounds.left; - contentBounds.left = rc.left + bounds.left; - - // create our calltip hiview - HIViewRef ctw = scintilla_calltip_new(); - CallTip* objectPtr = &ct; - ScintillaCocoa* sciThis = this; - SetControlProperty( ctw, scintillaMacOSType, 0, sizeof( this ), &sciThis ); - SetControlProperty( ctw, scintillaCallTipType, 0, sizeof( objectPtr ), &objectPtr ); - - CreateNewWindow(windowClass, attributes, &contentBounds, &outWindow); - ControlRef root; - CreateRootControl(outWindow, &root); - - HIViewRef hiroot = HIViewGetRoot (outWindow); - HIViewAddSubview(hiroot, ctw); - - HIRect boundsRect; - HIViewGetFrame(hiroot, &boundsRect); - HIViewSetFrame( ctw, &boundsRect ); - - // bind the size of the calltip to the size of it's container window - HILayoutInfo layout = { - kHILayoutInfoVersionZero, - { - { NULL, kHILayoutBindTop, 0 }, - { NULL, kHILayoutBindLeft, 0 }, - { NULL, kHILayoutBindBottom, 0 }, - { NULL, kHILayoutBindRight, 0 } - }, - { - { NULL, kHILayoutScaleAbsolute, 0 }, - { NULL, kHILayoutScaleAbsolute, 0 } - - }, - { - { NULL, kHILayoutPositionTop, 0 }, - { NULL, kHILayoutPositionLeft, 0 } - } - }; - HIViewSetLayoutInfo(ctw, &layout); - - ct.wCallTip = root; - ct.wDraw = ctw; - ct.wCallTip.SetWindow(outWindow); - HIViewSetVisible(ctw,true); - - } -*/ +void ScintillaCocoa::CTPaint(void* gc, NSRect rc) { +#pragma unused(rc) + Surface *surfaceWindow = Surface::Allocate(SC_TECHNOLOGY_DEFAULT); + if (surfaceWindow) { + surfaceWindow->Init(gc, wMain.GetID()); + surfaceWindow->SetUnicodeMode(SC_CP_UTF8 == ct.codePage); + surfaceWindow->SetDBCSMode(ct.codePage); + ct.PaintCT(surfaceWindow); + surfaceWindow->Release(); + delete surfaceWindow; + } } +@interface CallTipView : NSControl { + ScintillaCocoa *sci; +} + +@end + +@implementation CallTipView + +- (NSView*) initWithFrame: (NSRect) frame { + self = [super initWithFrame: frame]; + + if (self) { + sci = NULL; + } + + return self; +} + +- (void) dealloc { + [super dealloc]; +} + +- (BOOL) isFlipped { + return YES; +} + +- (void) setSci: (ScintillaCocoa *) sci_ { + sci = sci_; +} + +- (void) drawRect: (NSRect) needsDisplayInRect { + if (sci) { + CGContextRef context = (CGContextRef) [[NSGraphicsContext currentContext] graphicsPort]; + sci->CTPaint(context, needsDisplayInRect); + } +} + +- (void) mouseDown: (NSEvent *) event { + if (sci) { + sci->CallTipMouseDown([event locationInWindow]); + } +} + +// On OS X, only the key view should modify the cursor so the calltip can't. +// This view does not become key so resetCursorRects never called. +- (void) resetCursorRects { + //[super resetCursorRects]; + //[self addCursorRect: [self bounds] cursor: [NSCursor arrowCursor]]; +} + +@end + +void ScintillaCocoa::CallTipMouseDown(NSPoint pt) { + NSRect rectBounds = [(NSView *)(ct.wDraw.GetID()) bounds]; + Point location(pt.x, rectBounds.size.height - pt.y); + ct.MouseClick(location); + CallTipClick(); +} + +void ScintillaCocoa::CreateCallTipWindow(PRectangle rc) { + if (!ct.wCallTip.Created()) { + NSRect ctRect = NSMakeRect(rc.top,rc.bottom, rc.Width(), rc.Height()); + NSWindow *callTip = [[NSWindow alloc] initWithContentRect: ctRect + styleMask: NSBorderlessWindowMask + backing: NSBackingStoreBuffered + defer: NO]; + [callTip setLevel:NSFloatingWindowLevel]; + [callTip setHasShadow:YES]; + NSRect ctContent = NSMakeRect(0,0, rc.Width(), rc.Height()); + CallTipView *caption = [[CallTipView alloc] initWithFrame: ctContent]; + [caption setAutoresizingMask: NSViewWidthSizable | NSViewMaxYMargin]; + [caption setSci: this]; + [[callTip contentView] addSubview: caption]; + [callTip orderFront:caption]; + ct.wCallTip = callTip; + ct.wDraw = caption; + } +} void ScintillaCocoa::AddToPopUp(const char *label, int cmd, bool enabled) { @@ -623,15 +798,15 @@ [menu setOwner: this]; [menu setAutoenablesItems: NO]; - if (cmd == 0) + if (cmd == 0) { item = [NSMenuItem separatorItem]; - else - item = [[NSMenuItem alloc] init]; - + } else { + item = [[[NSMenuItem alloc] init] autorelease]; + [item setTitle: [NSString stringWithUTF8String: label]]; + } [item setTarget: menu]; [item setAction: @selector(handleCommand:)]; [item setTag: cmd]; - [item setTitle: [NSString stringWithUTF8String: label]]; [item setEnabled: enabled]; [menu addItem: item]; @@ -661,7 +836,7 @@ // ------------------------------------------------------------------------------------------------- -#pragma segment Drag +#pragma mark Drag /** * Triggered by the tick timer on a regular basis to scroll the content during a drag operation. @@ -722,13 +897,84 @@ CopySelectionRange(&selectedText); SetPasteboardData(pasteboard, selectedText); + // calculate the bounds of the selection + PRectangle client = GetTextRectangle(); + int selStart = sel.RangeMain().Start().Position(); + int selEnd = sel.RangeMain().End().Position(); + int startLine = pdoc->LineFromPosition(selStart); + int endLine = pdoc->LineFromPosition(selEnd); + Point pt; + long startPos, endPos, ep; + Rect rcSel; + + if (startLine==endLine && WndProc(SCI_GETWRAPMODE, 0, 0) != SC_WRAP_NONE) { + // Komodo bug http://bugs.activestate.com/show_bug.cgi?id=87571 + // Scintilla bug https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3040200&group_id=2439 + // If the width on a wrapped-line selection is negative, + // find a better bounding rectangle. + + Point ptStart, ptEnd; + startPos = WndProc(SCI_GETLINESELSTARTPOSITION, startLine, 0); + endPos = WndProc(SCI_GETLINESELENDPOSITION, startLine, 0); + // step back a position if we're counting the newline + ep = WndProc(SCI_GETLINEENDPOSITION, startLine, 0); + if (endPos > ep) endPos = ep; + ptStart = LocationFromPosition(static_cast(startPos)); + ptEnd = LocationFromPosition(static_cast(endPos)); + if (ptStart.y == ptEnd.y) { + // We're just selecting part of one visible line + rcSel.left = ptStart.x; + rcSel.right = ptEnd.x < client.right ? ptEnd.x : client.right; + } else { + // Find the bounding box. + startPos = WndProc(SCI_POSITIONFROMLINE, startLine, 0); + rcSel.left = LocationFromPosition(static_cast(startPos)).x; + rcSel.right = client.right; + } + rcSel.top = ptStart.y; + rcSel.bottom = ptEnd.y + vs.lineHeight; + if (rcSel.bottom > client.bottom) { + rcSel.bottom = client.bottom; + } + } else { + rcSel.top = rcSel.bottom = rcSel.right = rcSel.left = -1; + for (int l = startLine; l <= endLine; l++) { + startPos = WndProc(SCI_GETLINESELSTARTPOSITION, l, 0); + endPos = WndProc(SCI_GETLINESELENDPOSITION, l, 0); + if (endPos == startPos) continue; + // step back a position if we're counting the newline + ep = WndProc(SCI_GETLINEENDPOSITION, l, 0); + if (endPos > ep) endPos = ep; + pt = LocationFromPosition(static_cast(startPos)); // top left of line selection + if (pt.x < rcSel.left || rcSel.left < 0) rcSel.left = pt.x; + if (pt.y < rcSel.top || rcSel.top < 0) rcSel.top = pt.y; + pt = LocationFromPosition(static_cast(endPos)); // top right of line selection + pt.y += vs.lineHeight; // get to the bottom of the line + if (pt.x > rcSel.right || rcSel.right < 0) { + if (pt.x > client.right) + rcSel.right = client.right; + else + rcSel.right = pt.x; + } + if (pt.y > rcSel.bottom || rcSel.bottom < 0) { + if (pt.y > client.bottom) + rcSel.bottom = client.bottom; + else + rcSel.bottom = pt.y; + } + } + } + // must convert to global coordinates for drag regions, but also save the + // image rectangle for further calculations and copy operations + PRectangle localRectangle = PRectangle(rcSel.left, rcSel.top, rcSel.right, rcSel.bottom); + // Prepare drag image. - PRectangle localRectangle = RectangleFromRange(sel.RangeMain().Start().Position(), sel.RangeMain().End().Position()); NSRect selectionRectangle = PRectangleToNSRect(localRectangle); NSView* content = ContentView(); + +#if 1 -#if 0 // TODO: fix initialization of the drag image with CGImageRef. // To get a bitmap of the text we're dragging, we just use Paint on a pixmap surface. SurfaceImpl *sw = new SurfaceImpl(); SurfaceImpl *pixmap = NULL; @@ -740,19 +986,22 @@ pixmap = new SurfaceImpl(); if (pixmap) { - PRectangle client = GetClientRectangle(); PRectangle imageRect = NSRectToPRectangle(selectionRectangle); paintState = painting; - //sw->InitPixMap(client.Width(), client.Height(), NULL, NULL); - sw->InitPixMap(imageRect.Width(), imageRect.Height(), NULL, NULL); + sw->InitPixMap(client.Width(), client.Height(), NULL, NULL); paintingAllText = true; - Paint(sw, imageRect); + // Have to create a new context and make current as text drawing goes + // to the current context, not a passed context. + CGContextRef gcsw = sw->GetContext(); + NSGraphicsContext *nsgc = [NSGraphicsContext graphicsContextWithGraphicsPort: gcsw + flipped: YES]; + [NSGraphicsContext setCurrentContext:nsgc]; + Paint(sw, client); paintState = notPainting; pixmap->InitPixMap(imageRect.Width(), imageRect.Height(), NULL, NULL); CGContextRef gc = pixmap->GetContext(); - // To make Paint() work on a bitmap, we have to flip our coordinates and translate the origin CGContextTranslateCTM(gc, 0, imageRect.Height()); CGContextScaleCTM(gc, 1.0, -1.0); @@ -770,7 +1019,9 @@ NSBitmapImageRep* bitmap = NULL; if (pixmap) { - bitmap = [[[NSBitmapImageRep alloc] initWithCGImage: pixmap->GetImage()] autorelease]; + CGImageRef imagePixmap = pixmap->GetImage(); + bitmap = [[[NSBitmapImageRep alloc] initWithCGImage: imagePixmap] autorelease]; + CGImageRelease(imagePixmap); pixmap->Release(); delete pixmap; } @@ -853,6 +1104,7 @@ */ void ScintillaCocoa::DraggingExited(id info) { +#pragma unused(info) SetDragPosition(SelectionPosition(invalidPosition)); inDragDrop = ddNone; } @@ -896,8 +1148,11 @@ if (selectedText.len == 0) return; - NSString *string; - string = [NSString stringWithUTF8String: selectedText.s]; + CFStringEncoding encoding = EncodingFromCharacterSet(selectedText.codePage == SC_CP_UTF8, + selectedText.characterSet); + CFStringRef cfsVal = CFStringCreateWithBytes(kCFAllocatorDefault, + reinterpret_cast(selectedText.s), + selectedText.len-1, encoding, false); [board declareTypes:[NSArray arrayWithObjects: NSStringPboardType, @@ -907,11 +1162,12 @@ if (selectedText.rectangular) { // This is specific to scintilla, allows us to drag rectangular selections around the document. - [board setString: string forType: ScintillaRecPboardType]; + [board setString: (NSString *)cfsVal forType: ScintillaRecPboardType]; } - [board setString: string forType: NSStringPboardType]; - + [board setString: (NSString *)cfsVal forType: NSStringPboardType]; + + CFRelease(cfsVal); } //-------------------------------------------------------------------------------------------------- @@ -931,9 +1187,26 @@ { if (selectedText != nil) { - char* text = (char*) [data UTF8String]; + CFStringEncoding encoding = EncodingFromCharacterSet(IsUnicodeMode(), + vs.styles[STYLE_DEFAULT].characterSet); + CFRange rangeAll = {0, [data length]}; + CFIndex usedLen = 0; + CFStringGetBytes((CFStringRef)data, rangeAll, encoding, '?', + false, NULL, 0, &usedLen); + + UInt8 *buffer = new UInt8[usedLen]; + + CFStringGetBytes((CFStringRef)data, rangeAll, encoding, '?', + false, buffer,usedLen, NULL); + bool rectangular = bestType == ScintillaRecPboardType; - selectedText->Copy(text, strlen(text) + 1, SC_CP_UTF8, SC_CHARSET_DEFAULT , rectangular, false); + + int len = static_cast(usedLen); + char *dest = Document::TransformLineEnds(&len, (char *)buffer, len, pdoc->eolMode); + + selectedText->Set(dest, len+1, pdoc->dbcsCodePage, + vs.styles[STYLE_DEFAULT].characterSet , rectangular, false); + delete []buffer; } return true; } @@ -976,7 +1249,7 @@ rcPaint = rc; PRectangle rcText = GetTextRectangle(); paintingAllText = rcPaint.Contains(rcText); - Surface *sw = Surface::Allocate(); + Surface *sw = Surface::Allocate(SC_TECHNOLOGY_DEFAULT); if (sw) { sw->Init(gc, wMain.GetID()); @@ -998,6 +1271,51 @@ //-------------------------------------------------------------------------------------------------- /** + * Scrolls the pixels in the window some number of lines. + * Invalidates the pixels scrolled into view. + */ +void ScintillaCocoa::ScrollText(int linesToMove) +{ + // Move those pixels + NSView *content = ContentView(); + + [content lockFocus]; + int diff = vs.lineHeight * linesToMove; + PRectangle textRect = GetTextRectangle(); + // Include margins as they must scroll + textRect.left = 0; + NSRect textRectangle = PRectangleToNSRect(textRect); + NSPoint destPoint = textRectangle.origin; + destPoint.y += diff; + NSCopyBits(0, textRectangle, destPoint); + + // Paint them nice + NSRect redrawRectangle = textRectangle; + if (linesToMove < 0) { + // Repaint bottom + redrawRectangle.origin.y = redrawRectangle.origin.y + redrawRectangle.size.height + diff; + redrawRectangle.size.height = -diff; + } else { + // Repaint top + redrawRectangle.size.height = diff; + } + + [content drawRect: redrawRectangle]; + [content unlockFocus]; + + // If no flush done here then multiple scrolls will get buffered and screen + // will only update a few times a second. + //[[content window] flushWindow]; + // However, doing the flush leads to the caret updating as a separate operation + // which looks bad when scrolling by holding down the down arrow key. + + // Could invalidate instead of synchronous draw but that may not be as smooth + //[content setNeedsDisplayInRect: redrawRectangle]; +} + +//-------------------------------------------------------------------------------------------------- + +/** * Modfies the vertical scroll position to make the current top line show up as such. */ void ScintillaCocoa::SetVerticalScrollPos() @@ -1034,8 +1352,9 @@ */ bool ScintillaCocoa::ModifyScrollBars(int nMax, int nPage) { +#pragma unused(nPage) // Input values are given in lines, not pixels, so we have to convert. - int lineHeight = WndProc(SCI_TEXTHEIGHT, 0, 0); + int lineHeight = static_cast(WndProc(SCI_TEXTHEIGHT, 0, 0)); PRectangle bounds = GetTextRectangle(); ScintillaView* topContainer = TopContainer(); @@ -1154,7 +1473,8 @@ void ScintillaCocoa::NotifyChange() { if (notifyProc != NULL) - notifyProc(notifyObj, WM_COMMAND, (uintptr_t) (SCEN_CHANGE << 16), (uintptr_t) this); + notifyProc(notifyObj, WM_COMMAND, Platform::LongFromTwoShorts(GetCtrlID(), SCEN_CHANGE), + (uintptr_t) this); } //-------------------------------------------------------------------------------------------------- @@ -1162,7 +1482,8 @@ void ScintillaCocoa::NotifyFocus(bool focus) { if (notifyProc != NULL) - notifyProc(notifyObj, WM_COMMAND, (uintptr_t) ((focus ? SCEN_SETFOCUS : SCEN_KILLFOCUS) << 16), (uintptr_t) this); + notifyProc(notifyObj, WM_COMMAND, Platform::LongFromTwoShorts(GetCtrlID(), (focus ? SCEN_SETFOCUS : SCEN_KILLFOCUS)), + (uintptr_t) this); } //-------------------------------------------------------------------------------------------------- @@ -1178,7 +1499,7 @@ if (notifyProc != NULL) { scn.nmhdr.hwndFrom = (void*) this; - scn.nmhdr.idFrom = (unsigned int) wMain.GetID(); + scn.nmhdr.idFrom = GetCtrlID(); notifyProc(notifyObj, WM_NOTIFY, (uintptr_t) 0, (uintptr_t) &scn); } } @@ -1219,6 +1540,7 @@ void ScintillaCocoa::TimerFired(NSTimer* timer) { +#pragma unused(timer) Tick(); DragScroll(); } @@ -1313,16 +1635,20 @@ bool handled = false; // Handle each entry individually. Usually we only have one entry anway. - for (int i = 0; i < input.length; i++) + for (size_t i = 0; i < input.length; i++) { const UniChar originalKey = [input characterAtIndex: i]; UniChar key = KeyTranslate(originalKey); bool consumed = false; // Consumed as command? - // Signal command as control + alt. This leaves us without command + control and command + alt - // but that's what we get when we have a modifier key more than other platforms. - if (KeyDown(key, shift, control || command, alt || command, &consumed)) + // Signal Control as SCMOD_META + int modifierKeys = + (shift ? SCI_SHIFT : 0) | + (command ? SCI_CTRL : 0) | + (alt ? SCI_ALT : 0) | + (control ? SCI_META : 0); + if (KeyDownWithModifiers(key, modifierKeys, &consumed)) handled = true; if (consumed) handled = true; @@ -1338,9 +1664,21 @@ */ int ScintillaCocoa::InsertText(NSString* input) { - const char* utf8 = [input UTF8String]; - AddCharUTF((char*) utf8, strlen(utf8), false); - return true; + CFStringEncoding encoding = EncodingFromCharacterSet(IsUnicodeMode(), + vs.styles[STYLE_DEFAULT].characterSet); + CFRange rangeAll = {0, [input length]}; + CFIndex usedLen = 0; + CFStringGetBytes((CFStringRef)input, rangeAll, encoding, '?', + false, NULL, 0, &usedLen); + + UInt8 *buffer = new UInt8[usedLen]; + + CFStringGetBytes((CFStringRef)input, rangeAll, encoding, '?', + false, buffer,usedLen, NULL); + + AddCharUTF((char*) buffer, static_cast(usedLen), false); + delete []buffer; + return static_cast(usedLen); } //-------------------------------------------------------------------------------------------------- @@ -1362,7 +1700,7 @@ //-------------------------------------------------------------------------------------------------- -void ScintillaCocoa::MouseExited(NSEvent* event) +void ScintillaCocoa::MouseExited(NSEvent* /* event */) { // Nothing to do here. } @@ -1375,9 +1713,9 @@ NSTimeInterval time = [event timestamp]; bool command = ([event modifierFlags] & NSCommandKeyMask) != 0; bool shift = ([event modifierFlags] & NSShiftKeyMask) != 0; - bool control = ([event modifierFlags] & NSControlKeyMask) != 0; + bool alt = ([event modifierFlags] & NSAlternateKeyMask) != 0; - ButtonDown(Point(location.x, location.y), (int) (time * 1000), shift, control, command); + ButtonDown(Point(location.x, location.y), (int) (time * 1000), shift, command, alt); } //-------------------------------------------------------------------------------------------------- @@ -1466,7 +1804,7 @@ /** * Creates and returns a popup menu, which is then displayed by the Cocoa framework. */ -NSMenu* ScintillaCocoa::CreateContextMenu(NSEvent* event) +NSMenu* ScintillaCocoa::CreateContextMenu(NSEvent* /* event */) { // Call ScintillaBase to create the context menu. ContextMenu(Point(0, 0)); @@ -1482,24 +1820,23 @@ */ void ScintillaCocoa::HandleCommand(NSInteger command) { - Command(command); + Command(static_cast(command)); } //-------------------------------------------------------------------------------------------------- -//OSStatus ScintillaCocoa::ActiveStateChanged() -//{ -// // If the window is being deactivated, lose the focus and turn off the ticking -// if ( ! this->IsActive() ) { -// DropCaret(); -// //SetFocusState( false ); -// SetTicking( false ); -// } else { -// ShowCaretAtCurrentPosition(); -// } -// return noErr; -//} -// +void ScintillaCocoa::ActiveStateChanged(bool isActive) +{ + // If the window is being deactivated, lose the focus and turn off the ticking + if (!isActive) { + DropCaret(); + //SetFocusState( false ); + SetTicking( false ); + } else { + ShowCaretAtCurrentPosition(); + } +} + //-------------------------------------------------------------------------------------------------- diff -Nru scite-2.25/scintilla/cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.pbxproj scite-3.0.2/scintilla/cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.pbxproj --- scite-2.25/scintilla/cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.pbxproj 2011-03-17 22:41:24.000000000 +0000 +++ scite-3.0.2/scintilla/cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.pbxproj 2011-12-08 22:17:01.000000000 +0000 @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 45; + objectVersion = 46; objects = { /* Begin PBXBuildFile section */ @@ -157,6 +157,8 @@ 114B6FEB11FA7645004FB6AB /* PropSetSimple.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FE011FA7645004FB6AB /* PropSetSimple.h */; }; 114B6FEC11FA7645004FB6AB /* StyleContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FE111FA7645004FB6AB /* StyleContext.h */; }; 114B6FED11FA7645004FB6AB /* WordList.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FE211FA7645004FB6AB /* WordList.h */; }; + 119FF1BF13C9D1820007CE42 /* QuartzTextStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 119FF1BE13C9D1820007CE42 /* QuartzTextStyle.h */; }; + 11A0A8A1148602DF0018D143 /* LexCoffeeScript.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11A0A8A0148602DF0018D143 /* LexCoffeeScript.cxx */; }; 11BB124D12FF9C1300F6BCF7 /* LexModula.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11BB124C12FF9C1300F6BCF7 /* LexModula.cxx */; }; 11F35FDB12AEFAF100F0236D /* LexA68k.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11F35FDA12AEFAF100F0236D /* LexA68k.cxx */; }; 2744E5A40FC168A100E85C33 /* InfoBar.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E59D0FC168A100E85C33 /* InfoBar.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -173,7 +175,6 @@ 2791F3E00FC1A390009DBCF9 /* ScintillaCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E5A20FC168A100E85C33 /* ScintillaCocoa.h */; settings = {ATTRIBUTES = (Public, ); }; }; 2791F3E30FC1A3AE009DBCF9 /* QuartzTextLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E59F0FC168A100E85C33 /* QuartzTextLayout.h */; settings = {ATTRIBUTES = (Public, ); }; }; 2791F3E40FC1A3AE009DBCF9 /* QuartzTextStyleAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E5A00FC168A100E85C33 /* QuartzTextStyleAttribute.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2791F3E80FC1A3AE009DBCF9 /* ScintillaWidget.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E48A0FC1678600E85C33 /* ScintillaWidget.h */; settings = {ATTRIBUTES = (Public, ); }; }; 27FEF4540FC1B413005E115A /* info_bar_bg.png in Resources */ = {isa = PBXBuildFile; fileRef = 27FEF4510FC1B413005E115A /* info_bar_bg.png */; }; 27FEF4550FC1B413005E115A /* mac_cursor_busy.png in Resources */ = {isa = PBXBuildFile; fileRef = 27FEF4520FC1B413005E115A /* mac_cursor_busy.png */; }; 27FEF4560FC1B413005E115A /* mac_cursor_flipped.png in Resources */ = {isa = PBXBuildFile; fileRef = 27FEF4530FC1B413005E115A /* mac_cursor_flipped.png */; }; @@ -336,12 +337,13 @@ 114B6FE011FA7645004FB6AB /* PropSetSimple.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PropSetSimple.h; path = ../../lexlib/PropSetSimple.h; sourceTree = SOURCE_ROOT; }; 114B6FE111FA7645004FB6AB /* StyleContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StyleContext.h; path = ../../lexlib/StyleContext.h; sourceTree = SOURCE_ROOT; }; 114B6FE211FA7645004FB6AB /* WordList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WordList.h; path = ../../lexlib/WordList.h; sourceTree = SOURCE_ROOT; }; + 119FF1BE13C9D1820007CE42 /* QuartzTextStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QuartzTextStyle.h; path = ../QuartzTextStyle.h; sourceTree = ""; }; + 11A0A8A0148602DF0018D143 /* LexCoffeeScript.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexCoffeeScript.cxx; path = ../../lexers/LexCoffeeScript.cxx; sourceTree = ""; }; 11BB124C12FF9C1300F6BCF7 /* LexModula.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexModula.cxx; path = ../../lexers/LexModula.cxx; sourceTree = SOURCE_ROOT; }; 11F35FDA12AEFAF100F0236D /* LexA68k.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexA68k.cxx; path = ../../lexers/LexA68k.cxx; sourceTree = SOURCE_ROOT; }; 2744E4850FC1678600E85C33 /* Platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Platform.h; path = ../../include/Platform.h; sourceTree = SOURCE_ROOT; }; 2744E4870FC1678600E85C33 /* SciLexer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SciLexer.h; path = ../../include/SciLexer.h; sourceTree = SOURCE_ROOT; }; 2744E4880FC1678600E85C33 /* Scintilla.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Scintilla.h; path = ../../include/Scintilla.h; sourceTree = SOURCE_ROOT; }; - 2744E48A0FC1678600E85C33 /* ScintillaWidget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ScintillaWidget.h; path = ../../include/ScintillaWidget.h; sourceTree = SOURCE_ROOT; }; 2744E59D0FC168A100E85C33 /* InfoBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InfoBar.h; path = ../InfoBar.h; sourceTree = SOURCE_ROOT; }; 2744E59E0FC168A100E85C33 /* PlatCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PlatCocoa.h; path = ../PlatCocoa.h; sourceTree = SOURCE_ROOT; }; 2744E59F0FC168A100E85C33 /* QuartzTextLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QuartzTextLayout.h; path = ../QuartzTextLayout.h; sourceTree = SOURCE_ROOT; }; @@ -454,6 +456,7 @@ 2744E47D0FC1674E00E85C33 /* Lexers */ = { isa = PBXGroup; children = ( + 11A0A8A0148602DF0018D143 /* LexCoffeeScript.cxx */, 11BB124C12FF9C1300F6BCF7 /* LexModula.cxx */, 11F35FDA12AEFAF100F0236D /* LexA68k.cxx */, 114B6EBE11FA7526004FB6AB /* LexAbaqus.cxx */, @@ -630,14 +633,14 @@ 2744E59D0FC168A100E85C33 /* InfoBar.h */, 2744E5AB0FC168B200E85C33 /* InfoBarCommunicator.h */, 2744E59E0FC168A100E85C33 /* PlatCocoa.h */, + 2744E4850FC1678600E85C33 /* Platform.h */, 2744E59F0FC168A100E85C33 /* QuartzTextLayout.h */, + 119FF1BE13C9D1820007CE42 /* QuartzTextStyle.h */, 2744E5A00FC168A100E85C33 /* QuartzTextStyleAttribute.h */, - 2744E5A20FC168A100E85C33 /* ScintillaCocoa.h */, - 2744E5A30FC168A100E85C33 /* ScintillaView.h */, - 2744E4850FC1678600E85C33 /* Platform.h */, 2744E4870FC1678600E85C33 /* SciLexer.h */, 2744E4880FC1678600E85C33 /* Scintilla.h */, - 2744E48A0FC1678600E85C33 /* ScintillaWidget.h */, + 2744E5A20FC168A100E85C33 /* ScintillaCocoa.h */, + 2744E5A30FC168A100E85C33 /* ScintillaView.h */, ); name = "Header Files"; sourceTree = ""; @@ -689,7 +692,6 @@ 2791F3C70FC19F71009DBCF9 /* Platform.h in Headers */, 2791F3C80FC19F71009DBCF9 /* SciLexer.h in Headers */, 2791F3C90FC19F71009DBCF9 /* Scintilla.h in Headers */, - 2791F3E80FC1A3AE009DBCF9 /* ScintillaWidget.h in Headers */, 114B6FA111FA75DB004FB6AB /* ILexer.h in Headers */, 114B6FBD11FA7623004FB6AB /* AutoComplete.h in Headers */, 114B6FBE11FA7623004FB6AB /* CallTip.h in Headers */, @@ -729,6 +731,7 @@ 114B6FEB11FA7645004FB6AB /* PropSetSimple.h in Headers */, 114B6FEC11FA7645004FB6AB /* StyleContext.h in Headers */, 114B6FED11FA7645004FB6AB /* WordList.h in Headers */, + 119FF1BF13C9D1820007CE42 /* QuartzTextStyle.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -759,8 +762,11 @@ /* Begin PBXProject section */ 0867D690FE84028FC02AAC07 /* Project object */ = { isa = PBXProject; + attributes = { + LastUpgradeCheck = 0420; + }; buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "ScintillaFramework" */; - compatibilityVersion = "Xcode 3.1"; + compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( @@ -915,6 +921,7 @@ 114B6F9F11FA75BE004FB6AB /* WordList.cxx in Sources */, 11F35FDB12AEFAF100F0236D /* LexA68k.cxx in Sources */, 11BB124D12FF9C1300F6BCF7 /* LexModula.cxx in Sources */, + 11A0A8A1148602DF0018D143 /* LexCoffeeScript.cxx in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -936,13 +943,13 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; COPY_PHASE_STRIP = NO; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES = ".bzr *.nib *.lproj *.framework *.gch (*) CVS .svn *.xcodeproj *.xcode *.pbproj *.pbxproj"; FRAMEWORK_VERSION = A; GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -951,9 +958,15 @@ SCI_NAMESPACE, SCI_LEXER, ); + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_UNINITIALIZED_AUTOS = NO; + GCC_WARN_UNKNOWN_PRAGMAS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_LABEL = YES; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; PRODUCT_NAME = Scintilla; + SDKROOT = macosx10.6; WRAPPER_EXTENSION = framework; }; name = Debug; @@ -962,6 +975,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -973,9 +987,15 @@ SCI_NAMESPACE, SCI_LEXER, ); + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_UNINITIALIZED_AUTOS = NO; + GCC_WARN_UNKNOWN_PRAGMAS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_LABEL = YES; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; PRODUCT_NAME = Scintilla; + SDKROOT = macosx10.6; WRAPPER_EXTENSION = framework; }; name = Release; @@ -994,8 +1014,7 @@ ../../lexlib, ); ONLY_ACTIVE_ARCH = YES; - PREBINDING = NO; - SDKROOT = macosx10.5; + SDKROOT = macosx10.6; }; name = Debug; }; @@ -1011,8 +1030,7 @@ ../../src, ../../lexlib, ); - PREBINDING = NO; - SDKROOT = macosx10.5; + SDKROOT = macosx10.6; }; name = Release; }; diff -Nru scite-2.25/scintilla/cocoa/ScintillaListBox.h scite-3.0.2/scintilla/cocoa/ScintillaListBox.h --- scite-2.25/scintilla/cocoa/ScintillaListBox.h 2010-10-27 21:15:45.000000000 +0000 +++ scite-3.0.2/scintilla/cocoa/ScintillaListBox.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ - -/* - * ScintillaMacOSX.h - * tutorial - * - * Created by Evan Jones on Sun Sep 01 2002. - * - */ - -#ifndef SCINTILLA_LISTBOX_H -#define SCINTILLA_LISTBOX_H - -#include "TView.h" - -#include -#include -#include -#include -#include - -#include "Platform.h" -#include "Scintilla.h" - -static const OSType scintillaListBoxType = 'sclb'; - -namespace Scintilla { - -class ScintillaListBox : public TView -{ -public: - // Private so ScintillaListBox objects can not be copied - ScintillaListBox(const ScintillaListBox &) : TView( NULL ) {} - ScintillaListBox &operator=(const ScintillaListBox &) { return * this; } - ~ScintillaListBox() {}; - -public: - /** This is the class ID that we've assigned to Scintilla. */ - static const CFStringRef kScintillaListBoxClassID; - static const ControlKind kScintillaListBoxKind; - - ScintillaListBox( void* windowid ); - - /** Returns the HIView object kind, needed to subclass TView. */ - virtual ControlKind GetKind() { return kScintillaListBoxKind; } - -private: - - virtual ControlPartCode HitTest( const HIPoint& where ); - virtual void Draw( RgnHandle rgn, CGContextRef gc ); - virtual OSStatus MouseDown( HIPoint& location, UInt32 modifiers, EventMouseButton button, UInt32 clickCount ); - virtual OSStatus MouseUp( HIPoint& location, UInt32 modifiers, EventMouseButton button, UInt32 clickCount ); - -public: - static HIViewRef Create(); -private: - static OSStatus Construct( HIViewRef inControl, TView** outView ); - -}; - - -} - - -#endif diff -Nru scite-2.25/scintilla/cocoa/ScintillaListBox.mm scite-3.0.2/scintilla/cocoa/ScintillaListBox.mm --- scite-2.25/scintilla/cocoa/ScintillaListBox.mm 2010-10-27 21:15:45.000000000 +0000 +++ scite-3.0.2/scintilla/cocoa/ScintillaListBox.mm 1970-01-01 00:00:00.000000000 +0000 @@ -1,110 +0,0 @@ - -#include "ScintillaCocoa.h" -#include "ScintillaListBox.h" - -using namespace Scintilla; - -const CFStringRef ScintillaListBox::kScintillaListBoxClassID = CFSTR( "org.scintilla.listbox" ); -const ControlKind ScintillaListBox::kScintillaListBoxKind = { 'ejon', 'Sclb' }; - -ScintillaListBox::ScintillaListBox( void* windowid ) : - TView( reinterpret_cast( windowid ) ) -{ - ActivateInterface( kMouse ); - // debugPrint = true; -} - -void ScintillaListBox::Draw( - RgnHandle /*inLimitRgn*/, - CGContextRef inContext ) -{ - Rect contentBounds; - GetControlBounds(GetViewRef(), &contentBounds); - - HIRect controlFrame; - HIViewGetFrame( GetViewRef(), &controlFrame ); - - // what is the global pos? - Surface *surfaceWindow = Surface::Allocate(); - if (surfaceWindow) - { - surfaceWindow->Init(inContext, GetViewRef()); - - // TODO: Implement or find workaround - // ctip->PaintCT(surfaceWindow); - surfaceWindow->Release(); - delete surfaceWindow; - } - -} - -ControlPartCode ScintillaListBox::HitTest( const HIPoint& where ) -{ - if ( CGRectContainsPoint( Bounds(), where ) ) - return 1; - else - return kControlNoPart; -} - -OSStatus ScintillaListBox::MouseDown(HIPoint& location, UInt32 /*inKeyModifiers*/, EventMouseButton button, UInt32 /*inClickCount*/ ) -{ - if ( button != kEventMouseButtonPrimary ) return eventNotHandledErr; - ListBox* ctip = NULL; - ScintillaCocoa *sciThis = NULL; - OSStatus err = GetControlProperty( GetViewRef(), scintillaListBoxType, 0, sizeof( ctip ), NULL, &ctip ); - err = GetControlProperty( GetViewRef(), scintillaMacOSType, 0, sizeof( sciThis ), NULL, &sciThis ); - - // TODO: Implement of find work around. - // ctip->MouseClick( Scintilla::Point( static_cast( location.x ), static_cast( location.y ) )); - - // TODO: still needed? - // sciThis->ListBoxClick(); - return noErr; -} - -OSStatus ScintillaListBox::MouseUp(HIPoint& /*inMouseLocation*/, UInt32 /*inKeyModifiers*/, EventMouseButton button, UInt32 /*inClickCount*/ ) -{ - if ( button != kEventMouseButtonPrimary ) return eventNotHandledErr; - return noErr; -} - -HIViewRef ScintillaListBox::Create() -{ - // Register the HIView, if needed - static bool registered = false; - - if ( not registered ) - { - TView::RegisterSubclass( kScintillaListBoxClassID, Construct ); - registered = true; - } - - OSStatus err = noErr; - EventRef event = CreateInitializationEvent(); - assert( event != NULL ); - - HIViewRef control = NULL; - err = HIObjectCreate( kScintillaListBoxClassID, event, reinterpret_cast( &control ) ); - ReleaseEvent( event ); - if ( err == noErr ) { - Platform::DebugPrintf("ScintillaListBox::Create control %08X\n",control); - return control; - } - return NULL; -} - -OSStatus ScintillaListBox::Construct( HIViewRef inControl, TView** outView ) -{ - *outView = new ScintillaListBox( inControl ); - Platform::DebugPrintf("ScintillaListBox::Construct scintilla %08X\n",*outView); - if ( *outView != NULL ) - return noErr; - else - return memFullErr; -} - -extern "C" { -HIViewRef scintilla_listbox_new() { - return ScintillaListBox::Create(); -} -} diff -Nru scite-2.25/scintilla/cocoa/ScintillaTest/AppController.mm scite-3.0.2/scintilla/cocoa/ScintillaTest/AppController.mm --- scite-2.25/scintilla/cocoa/ScintillaTest/AppController.mm 2011-03-17 22:41:24.000000000 +0000 +++ scite-3.0.2/scintilla/cocoa/ScintillaTest/AppController.mm 2011-09-26 11:41:36.000000000 +0000 @@ -116,7 +116,7 @@ [mEditor setReferenceProperty: SCI_SETKEYWORDS parameter: 7 value: user_keywords]; // Colors and styles for various syntactic elements. First the default style. - [mEditor setStringProperty: SCI_STYLESETFONT parameter: STYLE_DEFAULT value: @"Andale Mono"]; + [mEditor setStringProperty: SCI_STYLESETFONT parameter: STYLE_DEFAULT value: @"Helvetica"]; // [mEditor setStringProperty: SCI_STYLESETFONT parameter: STYLE_DEFAULT value: @"Monospac821 BT"]; // Very pleasing programmer's font. [mEditor setGeneralProperty: SCI_STYLESETSIZE parameter: STYLE_DEFAULT value: 14]; [mEditor setColorProperty: SCI_STYLESETFORE parameter: STYLE_DEFAULT value: [NSColor blackColor]]; @@ -211,6 +211,47 @@ //-------------------------------------------------------------------------------------------------- +/* XPM */ +static const char * box_xpm[] = { + "12 12 2 1", + " c None", + ". c #800000", + " .........", + " . . ..", + " . . . .", + "......... .", + ". . . .", + ". . . ..", + ". . .. .", + "......... .", + ". . . .", + ". . . . ", + ". . .. ", + "......... "}; + + +- (void) showAutocompletion +{ + const char *words = "Babylon-5?1 Battlestar-Galactica Millenium-Falcon?2 Moya?2 Serenity Voyager"; + [mEditor setGeneralProperty: SCI_AUTOCSETIGNORECASE parameter: 1 value:0]; + [mEditor setGeneralProperty: SCI_REGISTERIMAGE parameter: 1 value:(sptr_t)box_xpm]; + const int imSize = 12; + [mEditor setGeneralProperty: SCI_RGBAIMAGESETWIDTH parameter: imSize value:0]; + [mEditor setGeneralProperty: SCI_RGBAIMAGESETHEIGHT parameter: imSize value:0]; + char image[imSize * imSize * 4]; + for (size_t y = 0; y < imSize; y++) { + for (size_t x = 0; x < imSize; x++) { + char *p = image + (y * imSize + x) * 4; + p[0] = 0xFF; + p[1] = 0xA0; + p[2] = 0; + p[3] = x * 23; + } + } + [mEditor setGeneralProperty: SCI_REGISTERRGBAIMAGE parameter: 2 value:(sptr_t)image]; + [mEditor setGeneralProperty: SCI_AUTOCSHOW parameter: 0 value:(sptr_t)words]; +} + - (IBAction) searchText: (id) sender { NSSearchField* searchField = (NSSearchField*) sender; @@ -219,6 +260,8 @@ wholeWord: NO scrollTo: YES wrap: YES]; + if ([[searchField stringValue] isEqualToString: @"XX"]) + [self showAutocompletion]; } @end diff -Nru scite-2.25/scintilla/cocoa/ScintillaTest/ScintillaTest.xcodeproj/project.pbxproj scite-3.0.2/scintilla/cocoa/ScintillaTest/ScintillaTest.xcodeproj/project.pbxproj --- scite-2.25/scintilla/cocoa/ScintillaTest/ScintillaTest.xcodeproj/project.pbxproj 2010-12-07 23:35:46.000000000 +0000 +++ scite-3.0.2/scintilla/cocoa/ScintillaTest/ScintillaTest.xcodeproj/project.pbxproj 2011-10-26 22:24:14.000000000 +0000 @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 45; + objectVersion = 46; objects = { /* Begin PBXBuildFile section */ @@ -190,8 +190,11 @@ /* Begin PBXProject section */ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; + attributes = { + LastUpgradeCheck = 0420; + }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "ScintillaTest" */; - compatibilityVersion = "Xcode 3.1"; + compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( @@ -282,13 +285,10 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; COPY_PHASE_STRIP = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)/../../../../MySQL/Workbench/5.2/ext/scintilla/cocoa/ScintillaFramework/build/Debug\"", - ); + FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -311,11 +311,9 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)/../../../../MySQL/Workbench/5.2/ext/scintilla/cocoa/ScintillaFramework/build/Debug\"", - ); + FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = ScintillaTest_Prefix.pch; @@ -343,8 +341,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ""; - PREBINDING = NO; - SDKROOT = macosx10.5; + SDKROOT = macosx10.6; }; name = Debug; }; @@ -356,8 +353,7 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; OTHER_LDFLAGS = ""; - PREBINDING = NO; - SDKROOT = macosx10.5; + SDKROOT = macosx10.6; }; name = Release; }; diff -Nru scite-2.25/scintilla/cocoa/ScintillaView.h scite-3.0.2/scintilla/cocoa/ScintillaView.h --- scite-2.25/scintilla/cocoa/ScintillaView.h 2011-03-17 22:41:24.000000000 +0000 +++ scite-3.0.2/scintilla/cocoa/ScintillaView.h 2011-11-15 08:48:41.000000000 +0000 @@ -34,9 +34,6 @@ // Set when we are in composition mode and partial input is displayed. NSRange mMarkedTextRange; - - // Caret position when a drag operation started. - int mLastPosition; } - (void) dealloc; @@ -127,6 +124,8 @@ - (void) setLexerProperty: (NSString*) name value: (NSString*) value; - (NSString*) getLexerProperty: (NSString*) name; +- (void) registerNotifyCallback: (intptr_t) windowid value: (Scintilla::SciNotifyFunc) callback; + - (void) setInfoBar: (NSView *) aView top: (BOOL) top; - (void) setStatusText: (NSString*) text; diff -Nru scite-2.25/scintilla/cocoa/ScintillaView.mm scite-3.0.2/scintilla/cocoa/ScintillaView.mm --- scite-2.25/scintilla/cocoa/ScintillaView.mm 2011-03-17 22:41:24.000000000 +0000 +++ scite-3.0.2/scintilla/cocoa/ScintillaView.mm 2011-08-01 02:49:04.000000000 +0000 @@ -114,7 +114,6 @@ [super resetCursorRects]; // We only have one cursor rect: our bounds. - NSRect bounds = [self bounds]; [self addCursorRect: [self bounds] cursor: mCurrentCursor]; [mCurrentCursor setOnMouseEntered: YES]; } @@ -159,6 +158,7 @@ */ - (BOOL) acceptsFirstMouse: (NSEvent *) theEvent { +#pragma unused(theEvent) return YES; } @@ -239,9 +239,15 @@ */ - (void) insertText: (id) aString { - // Remove any previously marked text first. - [self removeMarkedText]; - mOwner.backend->InsertText((NSString*) aString); + // Remove any previously marked text first. + [self removeMarkedText]; + NSString* newText = @""; + if ([aString isKindOfClass:[NSString class]]) + newText = (NSString*) aString; + else if ([aString isKindOfClass:[NSAttributedString class]]) + newText = (NSString*) [aString string]; + + mOwner.backend->InsertText(newText); } //-------------------------------------------------------------------------------------------------- @@ -255,8 +261,8 @@ - (NSRange) selectedRange { - int begin = [mOwner getGeneralProperty: SCI_GETSELECTIONSTART parameter: 0]; - int end = [mOwner getGeneralProperty: SCI_GETSELECTIONEND parameter: 0]; + long begin = [mOwner getGeneralProperty: SCI_GETSELECTIONSTART parameter: 0]; + long end = [mOwner getGeneralProperty: SCI_GETSELECTIONEND parameter: 0]; return NSMakeRange(begin, end - begin); } @@ -274,8 +280,13 @@ { // Since we did not return any valid attribute for marked text (see validAttributesForMarkedText) // we can safely assume the passed in text is an NSString instance. - NSString* newText = (NSString*) aString; - int currentPosition = [mOwner getGeneralProperty: SCI_GETCURRENTPOS parameter: 0]; + NSString* newText = @""; + if ([aString isKindOfClass:[NSString class]]) + newText = (NSString*) aString; + else if ([aString isKindOfClass:[NSAttributedString class]]) + newText = (NSString*) [aString string]; + + long currentPosition = [mOwner getGeneralProperty: SCI_GETCURRENTPOS parameter: 0]; // Replace marked text if there is one. if (mMarkedTextRange.length > 0) @@ -291,10 +302,10 @@ // Note: Scintilla internally works almost always with bytes instead chars, so we need to take // this into account when determining selection ranges and such. std::string raw_text = [newText UTF8String]; - mOwner.backend->InsertText(newText); + int lengthInserted = mOwner.backend->InsertText(newText); mMarkedTextRange.location = currentPosition; - mMarkedTextRange.length = raw_text.size(); + mMarkedTextRange.length = lengthInserted; // Mark the just inserted text. Keep the marked range for later reset. [mOwner setGeneralProperty: SCI_SETINDICATORCURRENT value: INPUT_INDICATOR]; @@ -363,7 +374,8 @@ */ - (void) keyDown: (NSEvent *) theEvent { - mOwner.backend->KeyboardInput(theEvent); + if (mMarkedTextRange.length == 0) + mOwner.backend->KeyboardInput(theEvent); NSArray* events = [NSArray arrayWithObject: theEvent]; [self interpretKeyEvents: events]; } @@ -473,6 +485,7 @@ - (BOOL) prepareForDragOperation: (id ) sender { +#pragma unused(sender) return YES; } @@ -490,7 +503,19 @@ */ - (NSDragOperation) draggingSourceOperationMaskForLocal: (BOOL) flag { - return NSDragOperationCopy | NSDragOperationMove; + return NSDragOperationCopy | NSDragOperationMove | NSDragOperationDelete; +} + +//-------------------------------------------------------------------------------------------------- + +/** + * Finished a drag: may need to delete selection. + */ + +- (void)draggedImage:(NSImage *)image endedAt:(NSPoint)screenPoint operation:(NSDragOperation)operation { + if (operation == NSDragOperationDelete) { + mOwner.backend->WndProc(SCI_CLEAR, 0, 0); + } } //-------------------------------------------------------------------------------------------------- @@ -510,36 +535,43 @@ - (void) selectAll: (id) sender { +#pragma unused(sender) mOwner.backend->SelectAll(); } - (void) deleteBackward: (id) sender { +#pragma unused(sender) mOwner.backend->DeleteBackward(); } - (void) cut: (id) sender { +#pragma unused(sender) mOwner.backend->Cut(); } - (void) copy: (id) sender { +#pragma unused(sender) mOwner.backend->Copy(); } - (void) paste: (id) sender { +#pragma unused(sender) mOwner.backend->Paste(); } - (void) undo: (id) sender { +#pragma unused(sender) mOwner.backend->Undo(); } - (void) redo: (id) sender { +#pragma unused(sender) mOwner.backend->Redo(); } @@ -617,7 +649,7 @@ //-------------------------------------------------------------------------------------------------- /** - * Called by a connected compontent (usually the info bar) if something changed there. + * Called by a connected component (usually the info bar) if something changed there. * * @param type The type of the notification. * @param message Carries the new status message if the type is a status message change. @@ -632,11 +664,13 @@ case IBNZoomChanged: { // Compute point increase/decrease based on default font size. - int fontSize = [self getGeneralProperty: SCI_STYLEGETSIZE parameter: STYLE_DEFAULT]; + long fontSize = [self getGeneralProperty: SCI_STYLEGETSIZE parameter: STYLE_DEFAULT]; int zoom = (int) (fontSize * (value - 1)); [self setGeneralProperty: SCI_SETZOOM value: zoom]; break; } + default: + break; }; } @@ -678,7 +712,8 @@ { // Parent notification. Details are passed as SCNotification structure. SCNotification* scn = reinterpret_cast(lParam); - editor = reinterpret_cast(scn->nmhdr.idFrom).owner; + ScintillaCocoa *psc = reinterpret_cast(scn->nmhdr.hwndFrom); + editor = reinterpret_cast(psc->ContentView()).owner; switch (scn->nmhdr.code) { case SCN_MARGINCLICK: @@ -686,7 +721,7 @@ if (scn->margin == 2) { // Click on the folder margin. Toggle the current line if possible. - int line = [editor getGeneralProperty: SCI_LINEFROMPOSITION parameter: scn->position]; + long line = [editor getGeneralProperty: SCI_LINEFROMPOSITION parameter: scn->position]; [editor setGeneralProperty: SCI_TOGGLEFOLD value: line]; } break; @@ -703,7 +738,7 @@ { // A zoom change happend. Notify info bar if there is one. float zoom = [editor getGeneralProperty: SCI_GETZOOM parameter: 0]; - int fontSize = [editor getGeneralProperty: SCI_STYLEGETSIZE parameter: STYLE_DEFAULT]; + long fontSize = [editor getGeneralProperty: SCI_STYLEGETSIZE parameter: STYLE_DEFAULT]; float factor = (zoom / fontSize) + 1; [editor->mInfoBar notify: IBNZoomChanged message: nil location: NSZeroPoint value: factor]; break; @@ -777,10 +812,21 @@ // Setup a special indicator used in the editor to provide visual feedback for // input composition, depending on language, keyboard etc. - [self setColorProperty: SCI_INDICSETFORE parameter: INPUT_INDICATOR fromHTML: @"#FF9A00"]; + [self setColorProperty: SCI_INDICSETFORE parameter: INPUT_INDICATOR fromHTML: @"#FF0000"]; [self setGeneralProperty: SCI_INDICSETUNDER parameter: INPUT_INDICATOR value: 1]; - [self setGeneralProperty: SCI_INDICSETSTYLE parameter: INPUT_INDICATOR value: INDIC_ROUNDBOX]; + [self setGeneralProperty: SCI_INDICSETSTYLE parameter: INPUT_INDICATOR value: INDIC_PLAIN]; [self setGeneralProperty: SCI_INDICSETALPHA parameter: INPUT_INDICATOR value: 100]; + + NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; + [center addObserver:self + selector:@selector(applicationDidResignActive:) + name:NSApplicationDidResignActiveNotification + object:nil]; + + [center addObserver:self + selector:@selector(applicationDidBecomeActive:) + name:NSApplicationDidBecomeActiveNotification + object:nil]; } return self; } @@ -796,6 +842,20 @@ //-------------------------------------------------------------------------------------------------- +- (void) applicationDidResignActive: (NSNotification *)note { +#pragma unused(note) + mBackend->ActiveStateChanged(false); +} + +//-------------------------------------------------------------------------------------------------- + +- (void) applicationDidBecomeActive: (NSNotification *)note { +#pragma unused(note) + mBackend->ActiveStateChanged(true); +} + +//-------------------------------------------------------------------------------------------------- + - (void) viewDidMoveToWindow { [super viewDidMoveToWindow]; @@ -967,7 +1027,8 @@ - (BOOL) setHorizontalScrollRange: (int) range page: (int) page { BOOL result = NO; - BOOL hideScroller = page >= range; + BOOL hideScroller = (page >= range) || + (mBackend->WndProc(SCI_GETWRAPMODE, 0, 0) != SC_WRAP_NONE); if ([mHorizontalScroller isHidden] != hideScroller) { @@ -1038,7 +1099,7 @@ NSString *result = @""; char *buffer(0); - const int length = mBackend->WndProc(SCI_GETSELTEXT, 0, 0); + const long length = mBackend->WndProc(SCI_GETSELTEXT, 0, 0); if (length > 0) { buffer = new char[length + 1]; @@ -1071,7 +1132,7 @@ NSString *result = @""; char *buffer(0); - const int length = mBackend->WndProc(SCI_GETLENGTH, 0, 0); + const long length = mBackend->WndProc(SCI_GETLENGTH, 0, 0); if (length > 0) { buffer = new char[length + 1]; @@ -1288,7 +1349,7 @@ */ - (NSColor*) getColorProperty: (int) property parameter: (long) parameter { - int color = mBackend->WndProc(property, parameter, 0); + long color = mBackend->WndProc(property, parameter, 0); float red = (color & 0xFF) / 255.0; float green = ((color >> 8) & 0xFF) / 255.0; float blue = ((color >> 16) & 0xFF) / 255.0; @@ -1366,6 +1427,17 @@ //-------------------------------------------------------------------------------------------------- /** + * Sets the notification callback + */ +- (void) registerNotifyCallback: (intptr_t) windowid value: (Scintilla::SciNotifyFunc) callback +{ + mBackend->RegisterNotifyCallback(windowid, callback); +} + + +//-------------------------------------------------------------------------------------------------- + +/** * Sets the new control which is displayed as info bar at the top or bottom of the editor. * Set newBar to nil if you want to hide the bar again. * When aligned to bottom position then the info bar and the horizontal scroller share the available @@ -1432,8 +1504,8 @@ { // The current position is where we start searching. That is either the end of the current // (main) selection or the caret position. That ensures we do proper "search next" too. - int currentPosition = [self getGeneralProperty: SCI_GETCURRENTPOS parameter: 0]; - int length = [self getGeneralProperty: SCI_GETTEXTLENGTH parameter: 0]; + long currentPosition = [self getGeneralProperty: SCI_GETCURRENTPOS parameter: 0]; + long length = [self getGeneralProperty: SCI_GETTEXTLENGTH parameter: 0]; int searchFlags= 0; if (matchCase) @@ -1445,7 +1517,7 @@ ttf.chrg.cpMin = currentPosition; ttf.chrg.cpMax = length; ttf.lpstrText = (char*) [searchText UTF8String]; - int position = mBackend->WndProc(SCI_FINDTEXT, searchFlags, (sptr_t) &ttf); + long position = mBackend->WndProc(SCI_FINDTEXT, searchFlags, (sptr_t) &ttf); if (position < 0 && wrap) { diff -Nru scite-2.25/scintilla/doc/index.html scite-3.0.2/scintilla/doc/index.html --- scite-2.25/scintilla/doc/index.html 2011-03-20 22:45:12.000000000 +0000 +++ scite-3.0.2/scintilla/doc/index.html 2011-12-08 22:17:01.000000000 +0000 @@ -9,7 +9,7 @@ - + @@ -70,9 +70,9 @@ @@ -563,13 +563,10 @@ - + - - - - + @@ -638,6 +635,10 @@
Expand or contract a fold point.Ctrl+Keypad*
Create or delete a bookmark.Ctrl+F2Select to next bookmark.Alt+F2
Go to next bookmark.F2
Select to next bookmark.Alt+F2Select to previous bookmark.Alt+Shift+F2
Find selection.Ctrl+F3Extend rectangular selection to end of line.Alt+Shift+End
+

+ On Windows, a search can be performed in the opposite direction by + using Shift+Enter in the Find or Replace strips or dialogs. +

Abbreviations

@@ -665,8 +666,7 @@ Some simple examples are included in the distributed Abbreviations file.
When expanding, the names don't need to be separated from the previous text. Ie. if you define 'é' as '&eacute;', you can expand it inside a word.
- If a name is the ending of another one, only the shorter will ever be expanded. - Ie. if you define 'ring' and 'gathering', the later will see only the 'ring' part expanded. + When multiple abbreviation names match, the longest matching name will be expanded.

Folding @@ -841,11 +841,18 @@ c:\os\scite\bin\Lua.properties.

+ All of the properties files in a directory can be imported with "import *". + This does not import generic properties files like user properties or abbreviations. + The set of files that are imported can be controlled with the imports.include and imports.exclude + properties. +

+

The 'if' statement takes one argument which is a symbol that may be defined earlier in this property set file or in a base property set. If the symbol evaluates to '0' then the test fails. An empty string or not present symbol evaluates to 0. Into the very top property set - is inserted one of 'PLAT_GTK' with value '1' or 'PLAT_WIN' with value '1'. + is inserted one of 'PLAT_GTK' with value '1', + 'PLAT_WIN' with value '1', or 'PLAT_MAC' with value '1'. If the test succeeds then following indented statements are executed. When a non-indented statement is found the if clause is finished. Only simple set statements are allowed in if clauses. The evaluation of if statements occurs @@ -932,7 +939,7 @@ global properties files. So after changing it, restart SciTE to see the effect. - + buffers.zorder.switching @@ -1023,10 +1030,9 @@ depends on your platform. You can overwrite this behaviour by setting the property to

- LF for UNIX format
- CR for Macintosh format
+ LF for UNIX and OS X format
+ CR for Macintosh format prior to OS X
CRLF for DOS/Windows format
- As you see, Windows combines the best of the other worlds ;-) @@ -1094,13 +1100,19 @@ - tabbar.visible
- tabbar.hide.one + tabbar.visible - Setting tabbar.visible to 1 makes the tab bar visible at start up on Windows. - The buffers property must be set to a value greater than 1 for this option to work. - Setting tabbar.hide.one to 1 hides the tab bar until there is more than one tab. + Setting tabbar.visible to 1 makes the tab bar visible at start up. + The buffers property must be set to a value greater than 1 for this option to work. + + + + + tabbar.hide.one + + + Setting tabbar.hide.one to 1 hides the tab bar until there is more than one tab. @@ -1146,14 +1158,6 @@ Setting pathbar.visible to 1 makes the path bar visible on GTK+. - - - menubar.detachable - - - Setting this to 1 makes the menu bar detachable from the main window. - - undo.redo.lazy @@ -1171,10 +1175,10 @@ Setting this to 1 makes the status bar visible at start up. - + statusbar.number
- statusbar.text.number + statusbar.text.number The statusbar.text.1 option defines the information displayed in the status bar @@ -1187,21 +1191,9 @@ You can also use file properties, which, unlike those above, are not updated on each keystroke: FileName or FileNameExt, FileDate and FileTime and FileAttr. Plus CurrentDate and CurrentTime.
- On Windows only, further texts may be set as statusbar.text.2 .. and these may be + On Windows only, further texts may be set as statusbar.text.2 .. and these may be cycled between by clicking the status bar.
- The statusbar.number option defines how many texts are to be cycled through. - - - - - use.palette - - - Setting this to 1 makes SciTE use a palette to enable it to display more colours on 8 bit - displays. Without this option SciTE will only display with colours already available - which is normally the 20 colour Windows system palette. The downside of turning on this - option is that there will be some flashing as windows are activated. This option has no - effect on GTK+ where a palette is always used. + The statusbar.number option defines how many texts are to be cycled through. @@ -1231,6 +1223,15 @@ unless buffered drawing is on. The default is for drawing to be two phase. + + + technology + + + On Windows Vista or newer, this can be set to 1 to use the Direct2D and DirectWrite APIs + for higher quality antialiased drawing. The default is 0. + + load.on.activate
@@ -1291,6 +1292,34 @@ + background.open.size
+ background.save.size + + + This setting controls whether files are opened and saved without blocking the user interface + while they are being read or written. + Files larger than the given size in bytes will be read or written in the background while + smaller files will be read or written directly and SciTE will not respond until the file access is completed. + The default value is -1 allows background processing for all files. + For saving, the size used is the in-memory size in bytes which will differ from the on-disk size + when the UTF-16 encoding is used. + + + + + temp.files.sync.load + + + Files dropped on SciTE on Windows are normally opened asynchronously + as there may be a long list. However, files dragged from some applications + such as 7-Zip may only exist for a moment in the temporary directory and + be deleted once the drop has occurred.
+ Setting this to 1 makes SciTE open dropped files in the temporary directory + immediately. + + + + quit.on.close.last @@ -1300,6 +1329,28 @@ last buffer is closed.) + + + highlight.current.word + + + When set to 1, all occurrences of the selected word are highlighted with the + colour defined by highlight.current.word.colour. By default, this option is disabled. (See indicators.alpha and indicators.under) + + + + + highlight.current.word.colour
+ highlight.current.word.by.style + + + The option highlight.current.word.colour defines the colour of highlight. + The default value is #A0A000.
+ If the option highlight.current.word.by.style is set, then only words with the same style + are highlighted (e.g. if you select this word in a comment, then only occurrences of words in + comments are selected). + + rectangular.selection.modifier @@ -1496,6 +1547,21 @@ + error.inline
+ style.error.0
+ style.error.1
+ style.error.2
+ style.error.3 + + + To see error messages interspersed with the source code, set error.inline=1.
+ Different visual styles are used for different severities: style.error.0 is the default; + style.error.1 for warnings; style.error.2 for errors; and style.error.3 for fatal errors. + The severity of a message is inferred from finding the text "warning", "error", or "fatal" in the message. + + + + bookmark.fore
bookmark.back
bookmark.alpha @@ -1512,7 +1578,25 @@ If set, then the Mark All command in the Find dialog will draw translucent boxes over - each string found. + each string found. (See indicators.alpha and indicators.under) + + + + + indicators.alpha + + + This property defines the alpha level for indicators (default value is 30). + The alpha value can range from 0 (completely transparent) to 255 (no transparency). + A value out of this range is ignored and the default one is used. + + + + + indicators.under + + + If set, the indicators are drawn under text or over (by default, it is over). @@ -1533,7 +1617,7 @@ Defines a path for the Open Selected Filename command in the File menu. The path is searched if the selected filename doesn't contain an absolute path or the file is not found in the document directory. The - directories in openpath are separated by ';' on Windows and ':' on GTK+.
+ directories in openpath are separated by ';' on Windows and ':' on OS X and GTK+.
An openpath setting may look like:
openpath.*.txt=c:\dos\;f:\;
@@ -1808,10 +1892,6 @@ This option enables folding multi-line comments and explicit fold points when using the C++ lexer. Explicit fold points allows adding extra folding by placing a //{ comment at the start and a //} at the end of a section that should fold. - fold.comment.python - This option enables folding multi-line comments when using the Python lexer. - - fold.cpp.comment.explicit Set this property to 0 to disable folding explicit fold points when fold.comment=1. @@ -1876,12 +1956,20 @@ Allow folding for heredocs in scripts embedded in HTML. The default is off. + fold.perl.at.else + This option enables Perl folding on a "} else {" line of an if statement. + + + fold.perl.comment.explicit + Set to 0 to disable explicit folding. + + fold.perl.package - Enable folding packages when using the Perl lexer. + Set to 0 to disable folding packages when using the Perl lexer. fold.perl.pod - Enable folding Pod blocks when using the Perl lexer. + Set to 0 to disable folding Pod blocks when using the Perl lexer. fold.preprocessor @@ -1892,6 +1980,10 @@ This option enables folding multi-line quoted strings when using the Python lexer. + fold.sql.at.else + This option enables SQL folding on a "ELSE" and "ELSIF" line of an IF statement. + + html.tags.case.sensitive For XML and HTML, setting this property to 1 will make tags match in a case sensitive way which is the expected behaviour for XML and XHTML. @@ -1904,10 +1996,18 @@ Set to 0 to disallow the '$' character in identifiers with the cpp lexer. + lexer.cpp.hashquoted.strings + Set to 1 to enable highlighting of hash-quoted strings. + + lexer.cpp.track.preprocessor Set to 1 to interpret #if/#else/#endif to grey out code that is not active. + lexer.cpp.triplequoted.strings + Set to 1 to enable highlighting of triple-quoted strings. + + lexer.cpp.update.preprocessor Set to 1 to update preprocessor definitions when #define found. @@ -1936,6 +2036,10 @@ For properties files, set to 0 to style all lines that start with whitespace in the default style. This is not suitable for SciTE .properties files which use indentation for flow control but can be used for RFC2822 text where indentation is used for continuation lines. + lexer.python.keywords2.no.sub.identifiers + When enabled, it will not style keywords2 items that are used as a sub-identifier. Example: when set, will not highlight "foo.open" when "open" is a keywords2 item. + + lexer.python.literals.binary Set to 0 to not recognise Python 3 binary and octal literals: 0b1011 0o712. @@ -1956,10 +2060,6 @@ Set to 1 to colourise recognized words with dots (recommended for Oracle PL/SQL objects). - lexer.sql.fold.at.else - This option enables SQL folding on a "ELSE" and "ELSIF"line of an IF statement. - - lexer.sql.numbersign.comment If "lexer.sql.numbersign.comment" property is set to 0 a line beginning with '#' will not be a comment. @@ -2196,7 +2296,6 @@ items out, one per line. These file types appear in the "Files of type:" pull down. The first item is the default, so you may wish to change the first item to include the file types you commonly open.
- On GTK+, this option only works for GTK+ 2.4 or later. @@ -2228,7 +2327,7 @@ save.deletes.first - Causes files to be deleted before being opened for saving. Can be used on Windows + Causes files to be deleted before being opened for saving. Can be used to ensure saving under a different capitalisation changes the files capitalisation rather than silently using the old capitalisation. @@ -2284,10 +2383,7 @@ Setting open.dialog.in.file.directory causes the open dialog to initially display the same directory as the current file. If it is not set then the - system default is used which on Windows XP is the last directory - visited by the open dialog in any instance of SciTE. This is hard - to use with multiple instances of SciTE.
- Some versions of GTK+ may also set an unexpected directory. + system default is used. @@ -2456,8 +2552,8 @@ Setting code.page to 65001 starts Unicode mode and the document is treated as a sequence of characters expressed as UTF-8. Display is performed by converting to the platform's normal Unicode encoding first so characters from any language will be displayed. - Correct glyphs will only be displayed if fonts are chosen that contain the appropriate glyphs. - Tahoma is a good choice on Windows XP.
+ Correct glyphs may only be displayed if fonts are chosen that contain the appropriate glyphs. + The Tahoma font contains a wide range of glyphs so may be a good choice.
This property can not set a single byte character set.
If output.code.page is set then it is used for the output pane which otherwise matches the edit pane. @@ -2489,10 +2585,47 @@ Cyrillic (CP1251 on GTK+)1251 European with Euro (ISO 8859-15)1000 - All of these values except for 1251 and 1000 may work on Windows, but on GTK+ Baltic, Turkish, Thai and Vietnamese - will probably not work. - Please send email if you use one of these settings and it works or doesn't or if you - have information on how to support other languages. + All of these values except for 1251 and 1000 should work on OS X or Windows. + On GTK+ Baltic, Turkish, Thai and Vietnamese will probably not work. + + + + + imports.include
+ imports.exclude + + + These settings control which files are imported by import statements.
+ The imports.include property defines the names of the properties + files that may be imported. Say you are only interested in using + fortran and lisp, then in user properties, you could set
+
+imports.include=fortran lisp +
+ The imports.exclude property is examined only if imports.include is empty or missing. + This property stops the named files from being imported. + + + + + command.discover.properties + + + This property can be used to run a program to determine file encoding and other properties + when a file is loaded.
+ The program should print a list of property=value lines for each property it wants to set. + This is the same format as properties files.
+
+ command.discover.properties=python /home/user/FileDetect.py "$(FilePath)" +
+ A simple Python script that recognises a particular tag that indicates the file is in the Korean code page 949:
+
+import sys
+if "Language:Korean" in open(sys.argv[1]).read():
+        print('code.page=949')
+        print('character.set=129')
+
+
@@ -2648,16 +2781,18 @@ each lexer.
The value of each setting is a set of ',' separated fields, some of which have a subvalue after a ':'. The fields are font, size, fore, back, italics, notitalics, bold, - notbold, eolfilled, noteolfilled, underlined, notunderlined, and case. + notbold, weight, eolfilled, noteolfilled, underlined, notunderlined, and case. The font field has a subvalue which is the name of - the font, the fore and back have colour subvalues, the size field has a numeric size - subvalue, the case field has a subvalue of 'm', 'u', or 'l' for mixed, upper or lower case, - and the bold, italics and eolfilled fields have no subvalue. The value + the font, the fore and back have colour subvalues, + the size field has a (fractional) numeric size subvalue, + the weight field has a numeric size subvalue (1.. 999: 100=light, 400=normal, 700=bold), + the case field has a subvalue of 'm', 'u', or 'l' for mixed, upper or lower case, + and the bold, italics and eolfilled fields have no subvalue. The value "fore:#FF0000,font:Courier,size:14" represents 14 point, red Courier text.
A global style can be set up using style.*.stylenumber. Any style options set in the global style will be inherited by each lexer style unless overridden.
- On GTK+ 2, Pango anti-aliased fonts can be chosen by prefixing the font name with "!", - such as "font:!Sans". + On GTK+, the font name should be prefixed with "!" such as "font:!Sans" to ensure Pango + anti-aliased fonts are used. If this is not done, an older font system will be used which may not work well. @@ -2729,8 +2864,7 @@ These settings choose which commands to execute when the Compile, Build or Go menu items - are selected. The subsystem options determine for Windows whether the tools are run as - command line(0), windowed(1), through ShellExecute(2), or through the director interface(3).
+ are selected. The subsystem options are explained in the subsystem section.
When source files are in a different directory to that they should be built in, the command.build.directory property can be set to change to a particular directory before performing the build. @@ -2855,7 +2989,7 @@ Defines a command to be executed when the help command is invoked or F1 pressed. On Windows, this often uses subsystem 4 as described above. - On Linux, running man or a browser are common ways of displaying help. + On OS X or Linux, running man or a browser are common ways of displaying help. The word at the cursor is copied to $(CurrentWord) and this is often a good argument to the help application. The subsystem property works in the same way as for other commands. @@ -2877,7 +3011,8 @@ command.print.subsystem.filepattern - Defines a command to be executed when print is invoked on GTK+. + Defines a command to be executed when print is invoked on GTK+ 2.x. + On Windows and GTK+ 3.x, printing is performed directly by SciTE. @@ -2888,7 +3023,7 @@ When a command is completed, print the time it took in seconds. - + print.magnification @@ -2899,7 +3034,7 @@ good miniaturisation of text, set print.magnification to -4. - + print.colour.mode @@ -2922,7 +3057,7 @@ This property is only read at start up. - + print.header.format
print.footer.format @@ -2940,7 +3075,7 @@
- + print.header.style
print.footer.style @@ -3118,6 +3253,24 @@ + fold.highlight
+ + + Set to 1 to enable highlight for current folding block (smallest one that contains the caret). + By default, it's disable. Note : The highlight is enabled only when fold.symbols equals + to 2 (round headers) or 3 (square headers). + + + + + fold.highlight.colour
+ + + Define the colour of highlight. The colour by default is red (#FF0000). + + + + title.full.path @@ -3228,6 +3381,26 @@ + indent.python.colon + + + For Python, automatically indent by one level if the previous line ended in a ':' + ignoring comments and whitespace. Otherwise use the same indentation as the previous line. + This property overrides other indentation settings. + + + + + os.x.home.end.keys + + + Chooses the standard OS X behaviour for the Home and End keys which is + to scroll the file to the start or end. This setting takes precedence over + vc.home.key. + + + + vc.home.key @@ -3273,18 +3446,9 @@ fileselector.height - For the GTK+ version determines the initial size of the file - selector dialog invoked by the Open and Save commands. - Setting has no effect on Windows. - - - - - fileselector.show.hidden - - - On GTK+ setting this to 1 makes the file selector dialog - invoked by the Open command show hidden files automatically. + For the GTK+ version determines the initial size of the file + selector dialog invoked by the Open and Save commands. + Setting has no effect on Windows. diff -Nru scite-2.25/scite/doc/SciTEDownload.html scite-3.0.2/scite/doc/SciTEDownload.html --- scite-2.25/scite/doc/SciTEDownload.html 2011-03-20 22:45:33.000000000 +0000 +++ scite-3.0.2/scite/doc/SciTEDownload.html 2011-12-08 22:16:52.000000000 +0000 @@ -30,9 +30,9 @@ @@ -45,7 +45,7 @@ containing very few restrictions.

- Release 2.25 + Release 3.0.2

Source Code @@ -53,8 +53,8 @@ The source code package contains all of the source code for Scintilla and SciTE but no binary executable code and is available in
    -
  • zip format (2100K) commonly used on Windows
  • -
  • tgz format (1880K) commonly used on Linux and compatible operating systems
  • +
  • zip format (2100K) commonly used on Windows
  • +
  • tgz format (1880K) commonly used on Linux and compatible operating systems
Instructions for building on both Windows and Linux are included in the readme file.

@@ -68,13 +68,13 @@ is no longer tested.

- A full download (1000K) includes the SciTE executable, any required DLLs, + A full download (1000K) includes the SciTE executable, any required DLLs, configuration files and documentation. After downloading the file, unzip it, and run SciTE.EXE. The files required to run SciTE are SciTE.EXE, SciLexer.DLL, and SciTEGlobal.properties.

- A single file executable called Sc1 (620K) does not need any DLL or + A single file executable called Sc1 (640K) does not need any DLL or properties files as these are linked into the executable. You may still create properties files if you wish. Sc1.exe has been compressed with the @@ -92,15 +92,16 @@ GTK+ / Linux

- Linux executable for Intel compatible processors + Linux executable for 32-bit Intel compatible processors

- This binary release requires GTK+ 2.8 or later and was tested on Fedora 13. + This binary release requires GTK+ 2.8 or later and was tested on Ubuntu 10.4. If you are using a Linux distribution more than a year old you may need to rebuild SciTE to use your installed version of GTK+. + If the target system is 64-bit, you may also need to build SciTE from source.

- A full download (900K) includes the SciTE executable, + A full download (920K) includes the 32-bit SciTE executable, configuration files and documentation. After downloading the file, gunzip and untar it, and run SciTE. The files required to run SciTE are SciTE which is best located on the path diff -Nru scite-2.25/scite/doc/SciTE.html scite-3.0.2/scite/doc/SciTE.html --- scite-2.25/scite/doc/SciTE.html 2011-03-20 22:45:33.000000000 +0000 +++ scite-3.0.2/scite/doc/SciTE.html 2011-12-08 22:16:52.000000000 +0000 @@ -9,7 +9,7 @@ - +

- + Windows   - + GTK+/Linux