Compare commits

..

1 Commits

Author SHA1 Message Date
Bryan Petty
1cedeb5c04 This commit was manufactured by cvs2svn to create tag 'old_debug'.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/tags/old_debug@217 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
1998-07-10 10:39:48 +00:00
2010 changed files with 334589 additions and 32818 deletions

167
Makefile Normal file
View File

@@ -0,0 +1,167 @@
# Top-level Makefile for wxGTK by Wolfram Gloger
# based on the version for wx-Xt by Martin Sperl
SHELL=/bin/sh
#if DIRS are defind make only executes in these diretories
all::
@if test "x$(DIRS)" = x; then \
for i in src samples utils user; do \
echo "entering directory $$i building $@"; \
(cd $$i; ${MAKE} -k $@); \
done; \
else \
for i in $(DIRS) xxx; do \
if test "$$i" != xxx; then \
echo "entering directory $$i building $@"; \
(cd $$i; ${MAKE} -k $@); \
fi; \
done; \
fi
# what to do if a target is not understood:
# pass it on to all the children...
.DEFAULT::
@if test "x$(DIRS)" = x; then \
for i in src samples utils user; do \
echo "entering directory $$i building $@"; \
(cd $$i; ${MAKE} -k $@); \
done; \
else \
for i in $(DIRS) xxx; do \
if test "$$i" != xxx; then \
echo "entering directory $$i building $@"; \
(cd $$i; ${MAKE} -k $@); \
fi; \
done; \
fi
src::
@echo "entering directory src building all"
@cd src; ${MAKE} all
samples::
@echo "entering directory samples building all"
@cd samples; ${MAKE} all
utils::
@echo "entering directory utils building all"
@cd utils; ${MAKE} all
user::
@echo "entering directory user building all"
@cd user; ${MAKE} all
# the following ones recreate all Makefiles.
makefiles:: recreate
Makefiles:: recreate
recreate::
@src/gtk/setup/general/createall
# the following ones define what needs to be done to distribute the
# library and its components
distribute:: distrib
distrib:: distrib_base distrib_user join_utils join_samples
distrib_samples::
@echo "entering directory samples creating distribution files"
@(cd samples; ${MAKE} -k distrib)
distrib_user::
@echo "entering directory user creating distribution files"
@(cd user; ${MAKE} -k distrib)
distrib_utils::
@echo "entering directory utils creating distribution files"
@(cd utils; ${MAKE} -k distrib)
join_utils:: distrib_utils
@$(MAKE) join \
BASEDIR=utils \
FILES=`echo distrib/utils/*.tgz `
join_samples:: distrib_samples
@$(MAKE) join \
BASEDIR=samples \
FILES=`echo distrib/samples/*.tgz `
join_user:: distrib_user
@$(MAKE) join \
BASEDIR=user \
FILES=`echo distrib/user/*.tgz `
join::
@# needed are BASEDIR and FILES
@if test "x$$BASEDIR" = x; then\
echo "BASEDIR not specified.";\
exit -1;\
fi
@if test "x$$FILES" != x ; then \
echo "putting all seperate distribution files:";\
echo "$$FILES";\
echo "into distrib/$(BASEDIR).tgz";\
src/gtk/setup/general/jointar $(BASEDIR) $$FILES distrib/$(BASEDIR).tgz; \
else \
echo "Nothing to join - deleting..."; \
echo "This may be the case, if you have not specified FILES."\
rm -f distrib/$(BASEDIR).tgz; \
fi
distrib_base::
@if test ! -d distrib ; then mkdir distrib; fi;
@if test ! -f system.list ; then \
echo "dummy" > system.list;\
fi
@(curr=`pwd`; direc=`basename $$curr`;\
(cd ..; \
echo creating distrib/$$direc.tar from the current directory;\
tar -cf /tmp/$$direc.tar \
$$direc/COPYING\
$$direc/INSTALL\
$$direc/Makefile\
$$direc/template.mak\
$$direc/configure\
$$direc/configure.in\
$$direc/config.guess\
$$direc/config.sub\
$$direc/install-sh\
$$direc/user/Makefile \
$$direc/utils/Makefile \
$$direc/samples/Makefile \
;\
sed "s|^\(.*\)$$|/\1/|g" $$direc/system.list \
| uniq > /tmp/$$direc.list; \
echo "/RCS/" >> /tmp/$$direc.list; \
for each in misc docs wx src setup; do \
tar -uf /tmp/$$direc.tar \
`\
find $$direc/$$each \( -type f -o -type l \) -print \
| fgrep -vf /tmp/$$direc.list \
| grep -v "[~#]$$" \
` ;\
done; \
echo compressing $$direc.tar to $$direc.tgz;\
gzip -9 -c /tmp/$$direc.tar > $$direc/distrib/$$direc.tgz;\
rm /tmp/$$direc.tar /tmp/$$direc.list;\
)\
)
# the following ones are only needed if configure.in has changed
# and needs to be updated...
config:: configure
configure::
@autoconf
@cat configure \
| sed "s/config.cache/\$$OSTYPE.config.cache/g" \
| sed "s/config.status/\$$OSTYPE.config.status/g" \
| sed "s/\*\*--/ --/g" \
> configure1
@chmod a+x configure1
@mv configure1 configure

52
TODO.txt Normal file
View File

@@ -0,0 +1,52 @@
********************* TODO list for wxWindows 2 ******************************
The items are grouped by platform (generic, MSW, GTK...) and inside by
subject. The first 2 columns containg the following codes:
Priority classification: Amount of work expected:
9 next point release q quick fix
8 next release s small change
7 as soon as possible l a little work
6 soon w some work
5 should be included b big change
4 nice to have m major change
3 consider including ? don't know how to fix
2 maybe not - unclassified
1 probably not
- unclassified
After the subject the name in brackets indicates the person who is going to do
it.
=============================== common ========================================
4w wxString optimization (VZ)
allocate more memory than needed to avoid reallocation each time when
operator+ or += is used.
6b stream classes (VZ)
=============================== generic ======================================
7s wxTreeCtrl root item (RR)
root item is not shown currently (unlike in MSW version)
5w wxImageList
it's not implemented currently, to do (assuming that all images have the
same size - no resizing should be done to simplify the job)
================================ MSW ==========================================
7w consistent keyboard interface and focus behaviour (VZ)
currently, the focus is lost all the time (after a MessageBox, for example)
and sometimes TABbing through controls doesn't work
================================ GTK ==========================================
9m keyboard interface (RR)
TAB traversal, Alt-letter accelerators for the controls and accelerators
for menu items - TODO.
3b wxTreeCtrl native implementation?
GTK has a GtkCTree widget which seems to be quite close to the Windows
standard control - what about writing a native wxTreeCtrl based on it?

View File

@@ -1,47 +0,0 @@
###############################################################################
# Purpose: Makefile.in for STC contrib for Unix with autoconf
# Created: 14.03.00
# Author: VZ
# Version: $Id$
###############################################################################
top_srcdir = @top_srcdir@
top_builddir = ../../..
this_dir = $(top_srcdir)/src/stc
scintilla_dir=$(this_dir)/scintilla
VPATH=$(this_dir)@PATH_IFS@$(scintilla_dir)/src # ':' for autoconf
TARGET_LIBNAME=libstc
LIBVERSION_CURRENT=1
LIBVERSION_REVISION=0
LIBVERSION_AGE=0
OBJECTS=PlatWX.o ScintillaWX.o stc.o \
Accessor.o \
AutoComplete.o \
CallTip.o \
CellBuffer.o \
ContractionState.o \
Document.o \
Editor.o \
Indicator.o \
KeyMap.o \
KeyWords.o \
LexCPP.o \
LexHTML.o \
LexOthers.o \
LexPerl.o \
LexPython.o \
LexSQL.o \
LexVB.o \
LineMarker.o \
PropSet.o \
ScintillaBase.o \
Style.o \
ViewStyle.o
APPEXTRADEFS=-D__WX__ -DSCI_LEXER -I$(scintilla_dir)/src -I$(scintilla_dir)/include -I$(top_srcdir)/include
include $(top_builddir)/src/makelib.env

View File

@@ -1,597 +0,0 @@
// Scintilla source code edit control
// PlatWX.cxx - implementation of platform facilities on wxWindows
// Copyright 1998-1999 by Neil Hodgson <neilh@scintilla.org>
// Robin Dunn <robin@aldunn.com>
// The License.txt file describes the conditions under which this software may be distributed.
#include <ctype.h>
#include "Platform.h"
#include "wx/stc/stc.h"
Point Point::FromLong(long lpoint) {
return Point(lpoint & 0xFFFF, lpoint >> 32);
}
wxRect wxRectFromPRectangle(PRectangle prc) {
wxRect rc(prc.left, prc.top,
prc.right-prc.left+1, prc.bottom-prc.top+1);
return rc;
}
PRectangle PRectangleFromwxRect(wxRect rc) {
return PRectangle(rc.GetLeft(), rc.GetTop(), rc.GetRight(), rc.GetBottom());
}
Colour::Colour(long lcol) {
co.Set(lcol & 0xff, (lcol >> 8) & 0xff, (lcol >> 16) & 0xff);
}
Colour::Colour(unsigned int red, unsigned int green, unsigned int blue) {
co.Set(red, green, blue);
}
bool Colour::operator==(const Colour &other) const {
return co == other.co;
}
long Colour::AsLong() const {
return (((long)co.Blue() << 16) |
((long)co.Green() << 8) |
((long)co.Red()));
}
unsigned int Colour::GetRed() {
return co.Red();
}
unsigned int Colour::GetGreen() {
return co.Green();
}
unsigned int Colour::GetBlue() {
return co.Blue();
}
Palette::Palette() {
used = 0;
allowRealization = false;
}
Palette::~Palette() {
Release();
}
void Palette::Release() {
used = 0;
}
// This method either adds a colour to the list of wanted colours (want==true)
// or retrieves the allocated colour back to the ColourPair.
// This is one method to make it easier to keep the code for wanting and retrieving in sync.
void Palette::WantFind(ColourPair &cp, bool want) {
if (want) {
for (int i=0; i < used; i++) {
if (entries[i].desired == cp.desired)
return;
}
if (used < numEntries) {
entries[used].desired = cp.desired;
entries[used].allocated = cp.desired;
used++;
}
} else {
for (int i=0; i < used; i++) {
if (entries[i].desired == cp.desired) {
cp.allocated = entries[i].allocated;
return;
}
}
cp.allocated = cp.desired;
}
}
void Palette::Allocate(Window &) {
if (allowRealization) {
}
}
Font::Font() {
id = 0;
ascent = 0;
}
Font::~Font() {
}
void Font::Create(const char *faceName, int size, bool bold, bool italic) {
Release();
id = new wxFont(size,
wxDEFAULT,
italic ? wxITALIC : wxNORMAL,
bold ? wxBOLD : wxNORMAL,
false,
faceName);
}
void Font::Release() {
if (id)
delete id;
id = 0;
}
Surface::Surface() :
hdc(0), hdcOwned(0), bitmap(0),
x(0), y(0) {
}
Surface::~Surface() {
Release();
}
void Surface::Release() {
if (bitmap) {
((wxMemoryDC*)hdc)->SelectObject(wxNullBitmap);
delete bitmap;
bitmap = 0;
}
if (hdcOwned) {
delete hdc;
hdc = 0;
hdcOwned = false;
}
}
bool Surface::Initialised() {
return hdc != 0;
}
void Surface::Init() {
Release();
hdc = new wxMemoryDC();
hdcOwned = true;
// **** ::SetTextAlign(hdc, TA_BASELINE);
}
void Surface::Init(SurfaceID hdc_) {
Release();
hdc = hdc_;
// **** ::SetTextAlign(hdc, TA_BASELINE);
}
void Surface::InitPixMap(int width, int height, Surface *surface_) {
Release();
hdc = new wxMemoryDC(surface_->hdc);
hdcOwned = true;
bitmap = new wxBitmap(width, height);
((wxMemoryDC*)hdc)->SelectObject(*bitmap);
// **** ::SetTextAlign(hdc, TA_BASELINE);
}
void Surface::PenColour(Colour fore) {
hdc->SetPen(wxPen(fore.co, 1, wxSOLID));
}
void Surface::BrushColor(Colour back) {
hdc->SetBrush(wxBrush(back.co, wxSOLID));
}
void Surface::SetFont(Font &font_) {
// I think the following check is valid.
// It eliminates a crash for me. -- eric@sourcegear.com
if (font_.GetID())
{
hdc->SetFont(*font_.GetID());
}
}
int Surface::LogPixelsY() {
return hdc->GetPPI().y;
}
void Surface::MoveTo(int x_, int y_) {
x = x_;
y = y_;
}
void Surface::LineTo(int x_, int y_) {
hdc->DrawLine(x,y, x_,y_);
x = x_;
y = y_;
}
void Surface::Polygon(Point *pts, int npts, Colour fore,
Colour back) {
PenColour(fore);
BrushColor(back);
hdc->DrawPolygon(npts, (wxPoint*)pts);
}
void Surface::RectangleDraw(PRectangle rc, Colour fore, Colour back) {
PenColour(fore);
BrushColor(back);
hdc->DrawRectangle(wxRectFromPRectangle(rc));
}
void Surface::FillRectangle(PRectangle rc, Colour back) {
BrushColor(back);
hdc->SetPen(*wxTRANSPARENT_PEN);
hdc->DrawRectangle(wxRectFromPRectangle(rc));
}
void Surface::FillRectangle(PRectangle rc, Surface &surfacePattern) {
wxBrush br;
if (surfacePattern.bitmap)
br = wxBrush(*surfacePattern.bitmap);
else // Something is wrong so display in red
br = wxBrush(*wxRED, wxSOLID);
hdc->SetPen(*wxTRANSPARENT_PEN);
hdc->SetBrush(br);
hdc->DrawRectangle(wxRectFromPRectangle(rc));
}
void Surface::RoundedRectangle(PRectangle rc, Colour fore, Colour back) {
PenColour(fore);
BrushColor(back);
hdc->DrawRoundedRectangle(wxRectFromPRectangle(rc), 8);
}
void Surface::Ellipse(PRectangle rc, Colour fore, Colour back) {
PenColour(fore);
BrushColor(back);
hdc->DrawEllipse(wxRectFromPRectangle(rc));
}
void Surface::Copy(PRectangle rc, Point from, Surface &surfaceSource) {
hdc->Blit(rc.left, rc.top, rc.Width(), rc.Height(),
surfaceSource.hdc, from.x, from.y, wxCOPY);
}
void Surface::DrawText(PRectangle rc, Font &font, int ybase,
const char *s, int len, Colour fore, Colour back) {
SetFont(font);
hdc->SetTextForeground(fore.co);
hdc->SetTextBackground(back.co);
FillRectangle(rc, back);
// ybase is where the baseline should be, but wxWin uses the upper left
// corner, so I need to calculate the real position for the text...
hdc->DrawText(wxString(s, len), rc.left, ybase - font.ascent);
}
void Surface::DrawTextClipped(PRectangle rc, Font &font, int ybase, const char *s, int len, Colour fore, Colour back) {
SetFont(font);
hdc->SetTextForeground(fore.co);
hdc->SetTextBackground(back.co);
FillRectangle(rc, back);
hdc->SetClippingRegion(wxRectFromPRectangle(rc));
// see comments above
hdc->DrawText(wxString(s, len), rc.left, ybase - font.ascent);
hdc->DestroyClippingRegion();
}
int Surface::WidthText(Font &font, const char *s, int len) {
SetFont(font);
int w;
int h;
hdc->GetTextExtent(wxString(s, len), &w, &h);
return w;
}
void Surface::MeasureWidths(Font &font, const char *s, int len, int *positions) {
SetFont(font);
int totalWidth = 0;
for (int i=0; i<len; i++) {
int w;
int h;
hdc->GetTextExtent(s[i], &w, &h);
totalWidth += w;
positions[i] = totalWidth;
}
}
int Surface::WidthChar(Font &font, char ch) {
SetFont(font);
int w;
int h;
hdc->GetTextExtent(ch, &w, &h);
return w;
}
#define EXTENT_TEST " `~!@#$%^&*()-_=+\\|[]{};:\"\'<,>.?/1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
int Surface::Ascent(Font &font) {
SetFont(font);
int w, h, d, e;
hdc->GetTextExtent(EXTENT_TEST, &w, &h, &d, &e);
font.ascent = h - d;
return font.ascent;
}
int Surface::Descent(Font &font) {
SetFont(font);
int w, h, d, e;
hdc->GetTextExtent(EXTENT_TEST, &w, &h, &d, &e);
return d;
}
int Surface::InternalLeading(Font &font) {
return 0;
}
int Surface::ExternalLeading(Font &font) {
SetFont(font);
int w, h, d, e;
hdc->GetTextExtent(EXTENT_TEST, &w, &h, &d, &e);
return e;
}
int Surface::Height(Font &font) {
SetFont(font);
return hdc->GetCharHeight();
}
int Surface::AverageCharWidth(Font &font) {
SetFont(font);
return hdc->GetCharWidth();
}
int Surface::SetPalette(Palette *pal, bool inBackGround) {
return 0; // **** figure out what to do with palettes...
}
void Surface::SetClip(PRectangle rc) {
hdc->SetClippingRegion(wxRectFromPRectangle(rc));
}
void Surface::FlushCachedState() {
// TODO Is there anything we need to do here? eric@sourcegear.com
// TODO I had to add this method when I merged new Scintilla code
// TODO from Neil.
}
Window::~Window() {
}
void Window::Destroy() {
if (id)
id->Destroy();
id = 0;
}
bool Window::HasFocus() {
return wxWindow::FindFocus() == id;
}
PRectangle Window::GetPosition() {
wxRect rc(id->GetPosition(), id->GetSize());
return PRectangleFromwxRect(rc);
}
void Window::SetPosition(PRectangle rc) {
id->SetSize(rc.left, rc.top, rc.Width(), rc.Height());
}
void Window::SetPositionRelative(PRectangle rc, Window) {
SetPosition(rc); // ????
}
PRectangle Window::GetClientPosition() {
wxSize sz = id->GetClientSize();
return PRectangle(0, 0, sz.x - 1, sz.y - 1);
}
void Window::Show(bool show) {
id->Show(show);
}
void Window::InvalidateAll() {
id->Refresh(false);
}
void Window::InvalidateRectangle(PRectangle rc) {
id->Refresh(false, &wxRectFromPRectangle(rc));
}
void Window::SetFont(Font &font) {
id->SetFont(*font.GetID());
}
void Window::SetCursor(Cursor curs) {
int cursorId;
switch (curs) {
case cursorText:
cursorId = wxCURSOR_IBEAM;
break;
case cursorArrow:
cursorId = wxCURSOR_ARROW;
break;
case cursorUp:
cursorId = wxCURSOR_ARROW; // ** no up arrow... wxCURSOR_UPARROW;
break;
case cursorWait:
cursorId = wxCURSOR_WAIT;
break;
case cursorHoriz:
cursorId = wxCURSOR_SIZEWE;
break;
case cursorVert:
cursorId = wxCURSOR_SIZENS;
break;
case cursorReverseArrow:
cursorId = wxCURSOR_POINT_RIGHT;
break;
default:
cursorId = wxCURSOR_ARROW;
break;
}
id->SetCursor(wxCursor(cursorId));
}
void Window::SetTitle(const char *s) {
id->SetTitle(s);
}
ListBox::ListBox() {
}
ListBox::~ListBox() {
}
void ListBox::Create(Window &parent, int ctrlID) {
id = new wxListBox(parent.id, ctrlID, wxDefaultPosition, wxDefaultSize,
0, NULL, wxLB_SINGLE | wxLB_SORT);
}
void ListBox::Clear() {
((wxListBox*)id)->Clear();
}
void ListBox::Append(char *s) {
((wxListBox*)id)->Append(s);
}
int ListBox::Length() {
return ((wxListBox*)id)->Number();
}
void ListBox::Select(int n) {
((wxListBox*)id)->SetSelection(n);
}
int ListBox::GetSelection() {
return ((wxListBox*)id)->GetSelection();
}
int ListBox::Find(const char *prefix) {
return ((wxListBox*)id)->FindString(prefix);
}
void ListBox::GetValue(int n, char *value, int len) {
wxString text = ((wxListBox*)id)->GetString(n);
strncpy(value, text.c_str(), len);
value[len-1] = '\0';
}
void ListBox::Sort() {
// wxWindows keeps sorted so no need to sort
}
Menu::Menu() : id(0) {
}
void Menu::CreatePopUp() {
Destroy();
id = new wxMenu();
}
void Menu::Destroy() {
if (id)
delete id;
id = 0;
}
void Menu::Show(Point pt, Window &w) {
w.GetID()->PopupMenu(id, pt.x - 4, pt.y);
Destroy();
}
Colour Platform::Chrome() {
wxColour c;
c = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
return Colour(c.Red(), c.Green(), c.Blue());
}
Colour Platform::ChromeHighlight() {
wxColour c;
c = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DHIGHLIGHT);
return Colour(c.Red(), c.Green(), c.Blue());
}
const char *Platform::DefaultFont() {
return wxNORMAL_FONT->GetFaceName();
}
int Platform::DefaultFontSize() {
return 8;
}
unsigned int Platform::DoubleClickTime() {
return 500; // **** ::GetDoubleClickTime();
}
void Platform::DebugDisplay(const char *s) {
wxLogDebug(s);
}
bool Platform::IsKeyDown(int key) {
return false; // I don't think we'll need this.
}
long Platform::SendScintilla(WindowID w,
unsigned int msg,
unsigned long wParam,
long lParam) {
wxStyledTextCtrl* stc = (wxStyledTextCtrl*)w;
return stc->SendMsg(msg, wParam, lParam);
}
// These are utility functions not really tied to a platform
int Platform::Minimum(int a, int b) {
if (a < b)
return a;
else
return b;
}
int Platform::Maximum(int a, int b) {
if (a > b)
return a;
else
return b;
}
#define TRACE
void Platform::DebugPrintf(const char *format, ...) {
#ifdef TRACE
char buffer[2000];
va_list pArguments;
va_start(pArguments, format);
vsprintf(buffer,format,pArguments);
va_end(pArguments);
Platform::DebugDisplay(buffer);
#endif
}
int Platform::Clamp(int val, int minVal, int maxVal) {
if (val > maxVal)
val = maxVal;
if (val < minVal)
val = minVal;
return val;
}

View File

@@ -1,47 +0,0 @@
This contrib is the wxStyledTextCtrl, which is a wrapper around the
Scintilla edit control. (See www.scintilla.org)
There is still VERY MUCH to be done, most notable of which is a more
advanced sample that exercises more of the code. (I havn't tested
AutoComplete or CallTips, or most of the event types at all yet.) And
also documentation, adding wrappers for some new scintilla
functionality, building and testing on wxGTK, etc. Be patient, it all
will get there soon.
Let me describe a bit about the architecture I am implementing...
Obviously there is the Platform layer which implements the varioius
platform classes by using wxWindows classes and filling in where
needed. Then there is a ScintillaWX class that is derived from
ScintillaBase and implements the necessary virtual methods that
Scintilla needs to fully funciton. This class however is not meant to
ever be used directly by wx programmers. I call it one end of the
bridge between the wx and Scintilla worlds. The other end of the
bridge is a class called wxStyledTextCtrl that looks, feels and acts
like other classes in wxWindows. Here is a diagram:
+------------------+ +-------------------+
| wxStyledTextCtrl |--bridge--| ScintillaWX |
+------------------+ +-------------------+
| ScintillaBase |
+-------------------+
| Editor |
+-------------------+
| PlatWX |
+-------------------+
wxStyledTextCtrl derives from wxControl so it has a window that can be
drawn upon. When a wxStyledTextCtrl is constructed it constructs a
ScintillaWX for itself and passes itself to the scintilla object to be
set as the wMain and wDraw attributes. All method calls on the STC
are sent over the bridge in the form of calls to ScintiallWX::WndProc.
All notifications are sent back over the bridge and turned into
wxEvents.
Robin

View File

@@ -1,460 +0,0 @@
////////////////////////////////////////////////////////////////////////////
// Name: ScintillaWX.cxx
// Purpose: A wxWindows implementation of Scintilla. A class derived
// from ScintillaBase that uses the "wx platform" defined in
// PlatformWX.cxx This class is one end of a bridge between
// the wx world and the Scintilla world. It needs a peer
// object of type wxStyledTextCtrl to function.
//
// Author: Robin Dunn
//
// Created: 13-Jan-2000
// RCS-ID: $Id$
// Copyright: (c) 2000 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#include <ctype.h>
#include "ScintillaWX.h"
#include "wx/stc/stc.h"
//----------------------------------------------------------------------
const int H_SCROLL_MAX = 2000;
const int H_SCROLL_STEP = 20;
const int H_SCROLL_PAGE = 200;
//----------------------------------------------------------------------
// Helper classes
class wxSTCTimer : public wxTimer {
public:
wxSTCTimer(ScintillaWX* swx) {
this->swx = swx;
}
void Notify() {
swx->DoTick();
}
private:
ScintillaWX* swx;
};
bool wxSTCDropTarget::OnDropText(wxCoord x, wxCoord y, const wxString& data) {
return swx->DoDropText(x, y, data);
}
wxDragResult wxSTCDropTarget::OnEnter(wxCoord x, wxCoord y, wxDragResult def) {
return swx->DoDragEnter(x, y, def);
}
wxDragResult wxSTCDropTarget::OnDragOver(wxCoord x, wxCoord y, wxDragResult def) {
return swx->DoDragOver(x, y, def);
}
void wxSTCDropTarget::OnLeave() {
swx->DoDragLeave();
}
//----------------------------------------------------------------------
// Constructor/Destructor
ScintillaWX::ScintillaWX(wxStyledTextCtrl* win) {
capturedMouse = false;
wMain = win;
wDraw = win;
stc = win;
Initialise();
}
ScintillaWX::~ScintillaWX() {
SetTicking(false);
}
//----------------------------------------------------------------------
// base class virtuals
void ScintillaWX::Initialise() {
//ScintillaBase::Initialise();
dropTarget = new wxSTCDropTarget;
dropTarget->SetScintilla(this);
stc->SetDropTarget(dropTarget);
}
void ScintillaWX::Finalise() {
ScintillaBase::Finalise();
}
void ScintillaWX::StartDrag() {
wxDropSource source(wMain.GetID());
wxTextDataObject data(dragChars);
wxDragResult result;
source.SetData(data);
result = source.DoDragDrop(TRUE);
if (result == wxDragMove && dropWentOutside)
ClearSelection();
inDragDrop = FALSE;
SetDragPosition(invalidPosition);
}
void ScintillaWX::SetTicking(bool on) {
wxSTCTimer* steTimer;
if (timer.ticking != on) {
timer.ticking = on;
if (timer.ticking) {
steTimer = new wxSTCTimer(this);
steTimer->Start(timer.tickSize);
timer.tickerID = (int)steTimer;
} else {
steTimer = (wxSTCTimer*)timer.tickerID;
steTimer->Stop();
delete steTimer;
timer.tickerID = 0;
}
}
timer.ticksToWait = caret.period;
}
void ScintillaWX::SetMouseCapture(bool on) {
if (on && !capturedMouse)
wMain.GetID()->CaptureMouse();
else if (!on && capturedMouse)
wMain.GetID()->ReleaseMouse();
capturedMouse = on;
}
bool ScintillaWX::HaveMouseCapture() {
return capturedMouse;
}
void ScintillaWX::ScrollText(int linesToMove) {
int dy = vs.lineHeight * (linesToMove);
// TODO: calculate the rectangle to refreshed...
wMain.GetID()->ScrollWindow(0, dy);
}
void ScintillaWX::SetVerticalScrollPos() {
wMain.GetID()->SetScrollPos(wxVERTICAL, topLine);
}
void ScintillaWX::SetHorizontalScrollPos() {
wMain.GetID()->SetScrollPos(wxHORIZONTAL, xOffset);
}
bool ScintillaWX::ModifyScrollBars(int nMax, int nPage) {
bool modified = false;
int sbMax = wMain.GetID()->GetScrollRange(wxVERTICAL);
int sbThumb = wMain.GetID()->GetScrollThumb(wxVERTICAL);
int sbPos = wMain.GetID()->GetScrollPos(wxVERTICAL);
if (sbMax != nMax || sbThumb != nPage) {
wMain.GetID()->SetScrollbar(wxVERTICAL, sbPos, nPage, nMax);
modified = true;
}
sbMax = wMain.GetID()->GetScrollRange(wxHORIZONTAL);
sbThumb = wMain.GetID()->GetScrollThumb(wxHORIZONTAL);
if ((sbMax != H_SCROLL_MAX) || (sbThumb != H_SCROLL_STEP)) {
wMain.GetID()->SetScrollbar(wxHORIZONTAL, 0, H_SCROLL_STEP, H_SCROLL_MAX);
modified = true;
}
return modified;
}
void ScintillaWX::NotifyChange() {
stc->NotifyChange();
}
void ScintillaWX::NotifyParent(SCNotification scn) {
stc->NotifyParent(&scn);
}
void ScintillaWX::Copy() {
if (currentPos != anchor) {
char* text = CopySelectionRange();
textDO.SetText(text);
wxTheClipboard->Open();
wxTheClipboard->SetData(&textDO);
wxTheClipboard->Close();
}
}
void ScintillaWX::Paste() {
pdoc->BeginUndoAction();
ClearSelection();
wxTextDataObject data;
bool canPaste;
wxTheClipboard->Open();
canPaste = wxTheClipboard->GetData(data);
wxTheClipboard->Close();
if (canPaste) {
wxString str = data.GetText();
int len = str.Length();
pdoc->InsertString(currentPos, str.c_str(), len);
SetEmptySelection(currentPos + len);
}
pdoc->EndUndoAction();
NotifyChange();
Redraw();
}
bool ScintillaWX::CanPaste() {
wxTextDataObject data;
bool canPaste;
wxTheClipboard->Open();
canPaste = wxTheClipboard->GetData(data);
wxTheClipboard->Close();
return canPaste;
}
void ScintillaWX::CreateCallTipWindow(PRectangle) {
ct.wCallTip = new wxWindow(wDraw.GetID(), -1);
ct.wDraw = ct.wCallTip;
}
void ScintillaWX::AddToPopUp(const char *label, int cmd, bool enabled) {
if (!label[0])
popup.GetID()->AppendSeparator();
else
popup.GetID()->Append(cmd, label);
if (!enabled)
popup.GetID()->Enable(cmd, enabled);
// TODO: need to create event handler mappings for the cmd ID
}
void ScintillaWX::ClaimSelection() {
}
LRESULT ScintillaWX::DefWndProc(UINT /*iMessage*/, WPARAM /*wParam*/, LPARAM /*lParam*/) {
return 0;
}
LRESULT ScintillaWX::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
switch (iMessage) {
case EM_CANPASTE:
return CanPaste();
default:
return ScintillaBase::WndProc(iMessage, wParam, lParam);
}
return 0;
}
//----------------------------------------------------------------------
// Event delegates
void ScintillaWX::DoPaint(wxDC* dc, wxRect rect) {
paintState = painting;
Surface surfaceWindow;
surfaceWindow.Init(dc);
PRectangle rcPaint = PRectangleFromwxRect(rect);
dc->BeginDrawing();
Paint(&surfaceWindow, rcPaint);
dc->EndDrawing();
surfaceWindow.Release();
if (paintState == paintAbandoned) {
// Painting area was insufficient to cover new styling or brace highlight positions
FullPaint();
}
paintState = notPainting;
}
void ScintillaWX::DoHScroll(int type, int pos) {
int xPos = xOffset;
switch (type) {
case wxEVT_SCROLLWIN_LINEUP:
xPos -= H_SCROLL_STEP;
break;
case wxEVT_SCROLLWIN_LINEDOWN:
xPos += H_SCROLL_STEP;
break;
case wxEVT_SCROLLWIN_PAGEUP:
xPos -= H_SCROLL_PAGE;
break;
case wxEVT_SCROLLWIN_PAGEDOWN:
xPos += H_SCROLL_PAGE;
break;
case wxEVT_SCROLLWIN_TOP:
xPos = 0;
break;
case wxEVT_SCROLLWIN_BOTTOM:
xPos = H_SCROLL_MAX;
break;
case wxEVT_SCROLLWIN_THUMBTRACK:
xPos = pos;
break;
}
HorizontalScrollTo(xPos);
}
void ScintillaWX::DoVScroll(int type, int pos) {
int topLineNew = topLine;
switch (type) {
case wxEVT_SCROLLWIN_LINEUP:
topLineNew -= 1;
break;
case wxEVT_SCROLLWIN_LINEDOWN:
topLineNew += 1;
break;
case wxEVT_SCROLLWIN_PAGEUP:
topLineNew -= LinesToScroll();
break;
case wxEVT_SCROLLWIN_PAGEDOWN:
topLineNew += LinesToScroll();
break;
case wxEVT_SCROLLWIN_TOP:
topLineNew = 0;
break;
case wxEVT_SCROLLWIN_BOTTOM:
topLineNew = MaxScrollPos();
break;
case wxEVT_SCROLLWIN_THUMBTRACK:
topLineNew = pos;
break;
}
ScrollTo(topLineNew);
}
void ScintillaWX::DoSize(int width, int height) {
PRectangle rcClient(0,0,width,height);
SetScrollBarsTo(rcClient);
DropGraphics();
}
void ScintillaWX::DoLoseFocus(){
DropCaret();
}
void ScintillaWX::DoGainFocus(){
ShowCaretAtCurrentPosition();
}
void ScintillaWX::DoSysColourChange() {
InvalidateStyleData();
}
void ScintillaWX::DoButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt) {
ButtonDown(pt, curTime, shift, ctrl, alt);
}
void ScintillaWX::DoButtonUp(Point pt, unsigned int curTime, bool ctrl) {
ButtonUp(pt, curTime, ctrl);
}
void ScintillaWX::DoButtonMove(Point pt) {
ButtonMove(pt);
}
void ScintillaWX::DoAddChar(char ch) {
AddChar(ch);
}
int ScintillaWX::DoKeyDown(int key, bool shift, bool ctrl, bool alt) {
return KeyDown(key, shift, ctrl, alt);
}
void ScintillaWX::DoCommand(int ID) {
Command(ID);
}
void ScintillaWX::DoContextMenu(Point pt) {
ContextMenu(pt);
}
//----------------------------------------------------------------------
bool ScintillaWX::DoDropText(long x, long y, const wxString& data) {
SetDragPosition(invalidPosition);
int movePos = PositionFromLocation(Point(x,y));
DropAt(movePos, data, dragResult == wxDragMove, FALSE); // TODO: rectangular?
return TRUE;
}
wxDragResult ScintillaWX::DoDragEnter(wxCoord x, wxCoord y, wxDragResult def) {
return def;
}
wxDragResult ScintillaWX::DoDragOver(wxCoord x, wxCoord y, wxDragResult def) {
SetDragPosition(PositionFromLocation(Point(x, y)));
dragResult = def;
return def;
}
void ScintillaWX::DoDragLeave() {
SetDragPosition(invalidPosition);
}
//----------------------------------------------------------------------
// Redraw all of text area. This paint will not be abandoned.
void ScintillaWX::FullPaint() {
paintState = painting;
rcPaint = GetTextRectangle();
wxClientDC dc(wMain.GetID());
Surface surfaceWindow;
surfaceWindow.Init(&dc);
Paint(&surfaceWindow, rcPaint);
surfaceWindow.Release();
paintState = notPainting;
}
void ScintillaWX::DoScrollToLine(int line) {
ScrollTo(line);
}
void ScintillaWX::DoScrollToColumn(int column) {
HorizontalScrollTo(column * vs.spaceWidth);
}
//----------------------------------------------------------------------
//----------------------------------------------------------------------

View File

@@ -1,148 +0,0 @@
////////////////////////////////////////////////////////////////////////////
// Name: ScintillaWX.h
// Purpose: A wxWindows implementation of Scintilla. A class derived
// from ScintillaBase that uses the "wx platform" defined in
// PlatWX.cpp. This class is one end of a bridge between
// the wx world and the Scintilla world. It needs a peer
// object of type wxStyledTextCtrl to function.
//
// Author: Robin Dunn
//
// Created: 13-Jan-2000
// RCS-ID: $Id$
// Copyright: (c) 2000 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef __ScintillaWX_h__
#define __ScintillaWX_h__
//----------------------------------------------------------------------
#include "Platform.h"
#include "Scintilla.h"
#ifdef SCI_LEXER
#include "SciLexer.h"
#include "PropSet.h"
#include "Accessor.h"
#include "KeyWords.h"
#endif
#include "ContractionState.h"
#include "SVector.h"
#include "CellBuffer.h"
#include "CallTip.h"
#include "KeyMap.h"
#include "Indicator.h"
#include "LineMarker.h"
#include "Style.h"
#include "ViewStyle.h"
#include "AutoComplete.h"
#include "Document.h"
#include "Editor.h"
#include "ScintillaBase.h"
#include <wx/wx.h>
#include <wx/dataobj.h>
#include <wx/clipbrd.h>
#include <wx/dnd.h>
//----------------------------------------------------------------------
class wxStyledTextCtrl; // forward
class ScintillaWX;
//----------------------------------------------------------------------
// Helper classes
class wxSTCDropTarget : public wxTextDropTarget {
public:
void SetScintilla(ScintillaWX* swx) {
this->swx = swx;
}
bool OnDropText(wxCoord x, wxCoord y, const wxString& data);
wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def);
wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
void OnLeave();
private:
ScintillaWX* swx;
};
//----------------------------------------------------------------------
class ScintillaWX : public ScintillaBase {
public:
ScintillaWX(wxStyledTextCtrl* win);
~ScintillaWX();
// base class virtuals
virtual void Initialise();
virtual void Finalise();
virtual void StartDrag();
virtual void SetTicking(bool on);
virtual void SetMouseCapture(bool on);
virtual bool HaveMouseCapture();
virtual void ScrollText(int linesToMove);
virtual void SetVerticalScrollPos();
virtual void SetHorizontalScrollPos();
virtual bool ModifyScrollBars(int nMax, int nPage);
virtual void Copy();
virtual void Paste();
virtual void CreateCallTipWindow(PRectangle rc);
virtual void AddToPopUp(const char *label, int cmd = 0, bool enabled = true);
virtual void ClaimSelection();
virtual LRESULT DefWndProc(UINT iMessage, WPARAM wParam, LPARAM lParam);
virtual LRESULT WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam);
virtual void NotifyChange();
virtual void NotifyParent(SCNotification scn);
// Event delegates
void DoPaint(wxDC* dc, wxRect rect);
void DoHScroll(int type, int pos);
void DoVScroll(int type, int pos);
void DoSize(int width, int height);
void DoLoseFocus();
void DoGainFocus();
void DoSysColourChange();
void DoButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt);
void DoButtonUp(Point pt, unsigned int curTime, bool ctrl);
void DoButtonMove(Point pt);
void DoAddChar(char ch);
int DoKeyDown(int key, bool shift, bool ctrl, bool alt);
void DoTick() { Tick(); }
bool DoDropText(long x, long y, const wxString& data);
wxDragResult DoDragEnter(wxCoord x, wxCoord y, wxDragResult def);
wxDragResult DoDragOver(wxCoord x, wxCoord y, wxDragResult def);
void DoDragLeave();
void DoCommand(int ID);
void DoContextMenu(Point pt);
// helpers
void FullPaint();
bool CanPaste();
bool GetHideSelection() { return hideSelection; }
void DoScrollToLine(int line);
void DoScrollToColumn(int column);
private:
bool capturedMouse;
wxStyledTextCtrl* stc;
wxTextDataObject textDO;
wxSTCDropTarget* dropTarget;
wxDragResult dragResult;
};
//----------------------------------------------------------------------
#endif

View File

@@ -1,250 +0,0 @@
# Microsoft Developer Studio Project File - Name="StcVC" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=StcVC - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "StcVC.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "StcVC.mak" CFG="StcVC - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "StcVC - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "StcVC - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
!IF "$(CFG)" == "StcVC - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
RSC=rc.exe
# ADD BASE RSC /l 0x809
# ADD RSC /l 0x809
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../../include" /I "../../include" /I "scintilla/include" /I "scintilla/src" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D "__WX__" /D "SCI_LEXER" /FD /c
# SUBTRACT CPP /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\..\lib\stc.lib"
!ELSEIF "$(CFG)" == "StcVC - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
RSC=rc.exe
# ADD BASE RSC /l 0x809
# ADD RSC /l 0x809
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /I "../../../include" /I "../../include" /I "scintilla/include" /I "scintilla/src" /D "_DEBUG" /D DEBUG=1 /D "__WXDEBUG__" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D "__WX__" /D "SCI_LEXER" /FD /c
# SUBTRACT CPP /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\..\lib\stcd.lib"
!ENDIF
# Begin Target
# Name "StcVC - Win32 Release"
# Name "StcVC - Win32 Debug"
# Begin Group "Stc"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\PlatWX.cpp
# End Source File
# Begin Source File
SOURCE=.\ScintillaWX.cpp
# End Source File
# Begin Source File
SOURCE=.\ScintillaWX.h
# End Source File
# Begin Source File
SOURCE=.\stc.cpp
# End Source File
# End Group
# Begin Group "Scintilla"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\scintilla\src\Accessor.cxx
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\AutoComplete.cxx
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\AutoComplete.h
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\CallTip.cxx
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\CallTip.h
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\CellBuffer.cxx
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\CellBuffer.h
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\ContractionState.cxx
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\ContractionState.h
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\Document.cxx
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\Document.h
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\Editor.cxx
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\Editor.h
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\Indicator.cxx
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\Indicator.h
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\KeyMap.cxx
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\KeyMap.h
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\KeyWords.cxx
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\LexCPP.cxx
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\LexHTML.cxx
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\LexOthers.cxx
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\LexPerl.cxx
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\LexPython.cxx
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\LexSQL.cxx
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\LexVB.cxx
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\LineMarker.cxx
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\LineMarker.h
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\PropSet.cxx
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\ScintillaBase.cxx
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\ScintillaBase.h
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\Style.cxx
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\Style.h
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\SVector.h
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\ViewStyle.cxx
# End Source File
# Begin Source File
SOURCE=.\scintilla\src\ViewStyle.h
# End Source File
# End Group
# End Target
# End Project

View File

@@ -1,29 +0,0 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "StcVC"=.\StcVC.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -1,79 +0,0 @@
#
# File: makefile.b32
# Author: Julian Smart
# Created: 1999
# Updated:
# Copyright:
#
# Makefile : Builds wxMMedia library for 32-bit BC++
# N.B. use:
# make -f makefile.b32 stc.cfg
# make -f makefile.b32
WXDIR = $(WXWIN)
SCINTILLA=.\scintilla
S=$(SCINTILLA)\src
STCEXTRACPPFLAGS=-D__WX__ -DSCI_LEXER -I$(SCINTILLA)/include -I$(S)
LIBTARGET=$(WXDIR)\contrib\lib\stc.lib
OBJECTS = \
Accessor.obj \
AutoComplete.obj \
CallTip.obj \
CellBuffer.obj \
ContractionState.obj\
Document.obj \
Editor.obj \
Indicator.obj \
KeyMap.obj \
KeyWords.obj \
LineMarker.obj \
PropSet.obj \
ScintillaBase.obj \
Style.obj \
ViewStyle.obj \
\
PlatWX.obj \
ScintillaWX.obj \
stc.obj \
!include $(WXDIR)\src\makelib.b32
CFG = stc.cfg
CPPFLAGS=$(DLL_FLAGS) $(EXTRACPPFLAGS) @$(CFG)
{$(S)}.cxx.obj:
bcc32 $(CPPFLAGS) -P -c {$< }
$(CFG): makefile.b32
copy &&!
-H=$(WXDIR)\src\msw\wx32.csm
-3
-d
-a1 # byte alignment
-R-
-X
-w-par
-w-aus
-w-hid # virtual function A hides virtual function B
-WE
-tWM
-I$(WXINC);$(BCCDIR)\include;$(WXDIR)/src/generic;$(WXDIR)/src/png;$(WXDIR)/src/jpeg;$(WXDIR)/src/zlib;$(WXDIR)/src/xpm;$(WXDIR)/src/tiff
-I$(WXDIR)\include\wx\msw\gnuwin32
-L$(BCCDIR)\lib
-D__WXWIN__
-D__WXMSW__
-D__WINDOWS__
-DWIN32
$(OPT)
$(DEBUG_FLAGS)
$(WIN95FLAG)
$(STCEXTRACPPFLAGS)
! $(CFG)

View File

@@ -1,34 +0,0 @@
# File: makefile.g95 For stectrl
# Author: Robin Dunn
# Created: 1-Feb-2000
# Updated:
WXDIR = ../../..
SCINTILLA=$(WXDIR)/contrib/src/stc/scintilla
S=$(SCINTILLA)/src
EXTRAINC=-D__WX__ -DSCI_LEXER -I$(SCINTILLA)/include -I$(S) -I. -I$(WXDIR)/contrib/include
OBJECTS = \
$(S)/Accessor.$(OBJSUFF) \
$(S)/AutoComplete.$(OBJSUFF) \
$(S)/CallTip.$(OBJSUFF) \
$(S)/CellBuffer.$(OBJSUFF) \
$(S)/ContractionState.$(OBJSUFF)\
$(S)/Document.$(OBJSUFF) \
$(S)/Editor.$(OBJSUFF) \
$(S)/Indicator.$(OBJSUFF) \
$(S)/KeyMap.$(OBJSUFF) \
$(S)/KeyWords.$(OBJSUFF) \
$(S)/LineMarker.$(OBJSUFF) \
$(S)/PropSet.$(OBJSUFF) \
$(S)/ScintillaBase.$(OBJSUFF) \
$(S)/Style.$(OBJSUFF) \
$(S)/ViewStyle.$(OBJSUFF) \
PlatWX.$(OBJSUFF) \
ScintillaWX.$(OBJSUFF) \
stc.$(OBJSUFF)
LIBTARGET = $(WXDIR)/contrib/lib/libstc.a
include $(WXDIR)/src/makelib.g95

View File

@@ -1,94 +0,0 @@
# File: makefile.vc For stectrl
# Author: Robin Dunn
# Created: 1-Feb-2000
# Updated:
# Set WXDIR for your system
WXDIR = $(WXWIN)
SCINTILLA=.\scintilla
S=$(SCINTILLA)\src
EXTRAINC=-D__WX__ -DSCI_LEXER -I$(SCINTILLA)/include -I$(S) -I. -I$(WXDIR)\contrib\include
NOPCH=1
!include $(WXDIR)\src\makevc.env
OBJECTS = \
$(D)\Accessor.obj \
$(D)\AutoComplete.obj \
$(D)\CallTip.obj \
$(D)\CellBuffer.obj \
$(D)\ContractionState.obj\
$(D)\Document.obj \
$(D)\Editor.obj \
$(D)\Indicator.obj \
$(D)\KeyMap.obj \
$(D)\KeyWords.obj \
$(D)\LineMarker.obj \
$(D)\PropSet.obj \
$(D)\ScintillaBase.obj \
$(D)\Style.obj \
$(D)\ViewStyle.obj \
\
$(D)\PlatWX.obj \
$(D)\ScintillaWX.obj \
$(D)\stc.obj \
LIBTARGET = $(WXDIR)\contrib\lib\stc$(LIBEXT).lib
all: $(D) $(LIBTARGET)
$(D) :
mkdir $(D)
wx:
cd $(WXDIR)\src\msw
nmake -f makefile.vc FINAL=$(FINAL)
cd $(THISDIR)
wxclean:
cd $(WXDIR)\src\msw
nmake -f makefile.vc clean
cd $(THISDIR)
$(LIBTARGET): $(OBJECTS)
-erase $(LIBTARGET)
$(implib) @<<
-out:$(LIBTARGET)
-machine:$(CPU)
$(OBJECTS)
<<
{$(S)}.cxx{$(D)}.obj:
$(cc) @<<
$(CPPFLAGS) /c /Fo$@ /Tp $<
<<
{}.cpp{$(D)}.obj:
$(cc) @<<
$(CPPFLAGS) /c /Fo$@ /Tp $<
<<
show:
@echo $(CPPFLAGS)
clean:
-erase $(D)\*.obj
-erase *.sbr
-erase *.exe
-erase *.res
-erase *.map
-erase *.pdb
-erase $(LIBTARGET)

View File

@@ -1,7 +0,0 @@
This directory contains copies of the scintilla/src and
scintilla/include directories from the Scintilla/SCiTE source
distribution. All other code needed to implement Scintilla on top of
wxWindows is located in the directory above this one.
The current version of the Scintilla code is somewhere between 1.22
and 1.23, (from their CVS.)

View File

@@ -1,88 +0,0 @@
// SciTE - Scintilla based Text Editor
// Accessor.h - rapid easy access to contents of a Scintilla
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
enum { wsSpace = 1, wsTab = 2, wsSpaceTab = 4, wsInconsistent=8};
class Accessor {
protected:
// bufferSize is a trade off between time taken to copy the characters and SendMessage overhead
// slopSize positions the buffer before the desired position in case there is some backtracking
enum {bufferSize=4000, slopSize=bufferSize/8};
char buf[bufferSize+1];
WindowID id;
PropSet &props;
int startPos;
int endPos;
int lenDoc;
int offset; // Optional but including an offset makes GCC generate better code
int codePage;
bool InternalIsLeadByte(char ch);
void Fill(int position);
public:
Accessor(WindowID id_, PropSet &props_, int offset_=0) :
id(id_), props(props_), startPos(0x7FFFFFFF), endPos(0),
lenDoc(-1), offset(offset_), codePage(0) {
}
void SetCodePage(int codePage_) { codePage = codePage_; }
char operator[](int position) {
position += offset;
if (position < startPos || position >= endPos) {
Fill(position);
}
return buf[position - startPos];
}
char SafeGetCharAt(int position, char chDefault=' ') {
// Safe version of operator[], returning a defined value for invalid position
position += offset;
if (position < startPos || position >= endPos) {
Fill(position);
if (position < startPos || position >= endPos) {
// Position is outside range of document
return chDefault;
}
}
return buf[position - startPos];
}
bool IsLeadByte(char ch) {
return codePage && InternalIsLeadByte(ch);
}
char StyleAt(int position);
int GetLine(int position);
int LineStart(int line);
int LevelAt(int line);
int Length();
void Flush() {
startPos = 0x7FFFFFFF;
lenDoc = -1;
}
int GetLineState(int line);
int SetLineState(int line, int state);
PropSet &GetPropSet() { return props; }
};
class StylingContext;
typedef bool (*PFNIsCommentLeader)(StylingContext &styler, int pos, int len);
class StylingContext : public Accessor {
char styleBuf[bufferSize];
int validLen;
char chFlags;
char chWhile;
unsigned int startSeg;
public:
StylingContext(WindowID id_, PropSet &props_, int offset_=0) :
Accessor(id_,props_,offset_), validLen(0), chFlags(0) {}
void StartAt(unsigned int start, char chMask=31);
void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; };
unsigned int GetStartSegment() { return startSeg; }
void StartSegment(unsigned int pos);
void ColourTo(unsigned int pos, int chAttr);
int GetLine(int position);
void SetLevel(int line, int level);
void Flush();
int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0);
};

View File

@@ -1,41 +0,0 @@
// SciTE - Scintilla based Text Editor
// KeyWords.h - colourise for particular languages
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
typedef void (*LexerFunction)(unsigned int startPos, int lengthDoc, int initStyle,
WordList *keywordlists[], StylingContext &styler);
class LexerModule {
static LexerModule *base;
LexerModule *next;
int language;
LexerFunction fn;
public:
LexerModule(int language_, LexerFunction fn_);
static void Colourise(unsigned int startPos, int lengthDoc, int initStyle,
int language, WordList *keywordlists[], StylingContext &styler);
};
inline bool iswordchar(char ch) {
return isalnum(ch) || ch == '.' || ch == '_';
}
inline bool iswordstart(char ch) {
return isalnum(ch) || ch == '_';
}
inline bool isoperator(char ch) {
if (isalnum(ch))
return false;
// '.' left out as it is used to make up numbers
if (ch == '%' || ch == '^' || ch == '&' || ch == '*' ||
ch == '(' || ch == ')' || ch == '-' || ch == '+' ||
ch == '=' || ch == '|' || ch == '{' || ch == '}' ||
ch == '[' || ch == ']' || ch == ':' || ch == ';' ||
ch == '<' || ch == '>' || ch == ',' || ch == '/' ||
ch == '?' || ch == '!' || ch == '.' || ch == '~')
return true;
return false;
}

View File

@@ -1,395 +0,0 @@
// Scintilla source code edit control
// Platform.h - interface to platform facilities
// Also includes some basic utilities
// Implemented in PlatGTK.cxx for GTK+/Linux, PlatWin.cxx for Windows, and PlatWX.cxx for wxWindows
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef PLATFORM_H
#define PLATFORM_H
// PLAT_GTK = GTK+ on Linux, PLAT_WIN = Win32 API on Win32 OS
// PLAT_WX is wxWindows on any supported platform
// Could also have PLAT_GTKWIN = GTK+ on Win32 OS in future
#define PLAT_GTK 0
#define PLAT_WIN 0
#define PLAT_WX 0
#if defined(__WX__)
#undef PLAT_WX
#define PLAT_WX 1
#elif defined(GTK)
#undef PLAT_GTK
#define PLAT_GTK 1
#else
#undef PLAT_WIN
#define PLAT_WIN 1
#endif
// Include the main header for each platform
#if PLAT_GTK
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#endif
#if PLAT_WIN
#define _WIN32_WINNT 0x0400 // Otherwise some required stuff gets ifdef'd out
// Vassili Bourdo: shut up annoying Visual C++ warnings:
#ifdef _MSC_VER
#pragma warning(disable: 4800 4244 4309)
#endif
#include <windows.h>
#include <richedit.h>
#endif
#if PLAT_WX
#include <wx/wx.h>
#endif
// Underlying the implementation of the platform classes are platform specific types.
// Sometimes these need to be passed around by client code so they are defined here
#if PLAT_GTK
typedef GdkColor ColourID;
typedef GdkFont* FontID;
typedef GdkDrawable* SurfaceID;
typedef GtkWidget* WindowID;
typedef GtkItemFactory* MenuID;
#endif
#if PLAT_WIN
typedef COLORREF ColourID;
typedef HFONT FontID;
typedef HDC SurfaceID;
typedef HWND WindowID;
typedef HMENU MenuID;
#endif
#if PLAT_WX
typedef wxColour ColourID;
typedef wxFont* FontID;
typedef wxDC* SurfaceID;
typedef wxWindow* WindowID;
typedef wxMenu* MenuID;
#endif
#if PLAT_GTK || PLAT_WX
#define SHIFT_PRESSED 1
#define LEFT_CTRL_PRESSED 2
#define LEFT_ALT_PRESSED 4
#endif
// Point is exactly the same as the Win32 POINT and GTK+ GdkPoint so can be used interchangeably
class Point {
public:
int x;
int y;
Point(int x_=0, int y_=0) : x(x_), y(y_) {
}
// Other automatically defined methods (assignment, copy constructor, destructor) are fine
static Point FromLong(long lpoint);
};
// PRectangle is exactly the same as the Win32 RECT so can be used interchangeably
// PRectangles contain their top and left sides, but not their right and bottom sides
class PRectangle {
public:
int left;
int top;
int right;
int bottom;
PRectangle(int left_=0, int top_=0, int right_=0, int bottom_ = 0) :
left(left_), top(top_), right(right_), bottom(bottom_) {
}
// Other automatically defined methods (assignment, copy constructor, destructor) are fine
bool Contains(Point pt) {
return (pt.x >= left) && (pt.x <= right) &&
(pt.y >= top) && (pt.y <= bottom);
}
bool Contains(PRectangle rc) {
return (rc.left >= left) && (rc.right <= right) &&
(rc.top >= top) && (rc.bottom <= bottom);
}
bool Intersects(PRectangle other) {
return (right >= other.left) && (left <= other.right) &&
(bottom >= other.top) && (top <= other.bottom);
}
int Width() { return right - left; }
int Height() { return bottom - top; }
};
#if PLAT_WX
wxRect wxRectFromPRectangle(PRectangle prc);
PRectangle PRectangleFromwxRect(wxRect rc);
#endif
class Colour {
ColourID co;
public:
Colour(long lcol=0);
Colour(unsigned int red, unsigned int green, unsigned int blue);
bool operator==(const Colour &other) const;
long AsLong() const;
unsigned int GetRed();
unsigned int GetGreen();
unsigned int GetBlue();
friend class Surface;
friend class Palette;
};
// Colour pairs hold a desired colour and the colour that the graphics engine
// allocates to approximate the desired colour.
// To make palette management more automatic, ColourPairs could register at
// construction time with a palette management object.
struct ColourPair {
Colour desired;
Colour allocated;
ColourPair(Colour desired_=Colour(0,0,0)) {
desired = desired_;
allocated = desired;
}
};
class Window; // Forward declaration for Palette
class Palette {
int used;
enum {numEntries = 100};
ColourPair entries[numEntries];
#if PLAT_GTK
GdkColor *allocatedPalette;
int allocatedLen;
#elif PLAT_WIN
HPALETTE hpal;
#elif PLAT_WX
// wxPalette* pal; // **** Is this needed?
#endif
public:
bool allowRealization;
Palette();
~Palette();
void Release();
// This method either adds a colour to the list of wanted colours (want==true)
// or retrieves the allocated colour back to the ColourPair.
// This is one method to make it easier to keep the code for wanting and retrieving in sync.
void WantFind(ColourPair &cp, bool want);
void Allocate(Window &w);
friend class Surface;
};
class Font {
FontID id;
#if PLAT_WX
int ascent;
#endif
// Private so Font objects can not be copied
Font(const Font &) {}
Font &operator=(const Font &) { id=0; return *this; }
public:
Font();
~Font();
void Create(const char *faceName, int size, bool bold=false, bool italic=false);
void Release();
FontID GetID() { return id; }
// Alias another font - caller guarantees not to Release
void SetID(FontID id_) { id = id_; }
friend class Surface;
};
// A surface abstracts a place to draw
class Surface {
private:
#if PLAT_GTK
GdkDrawable *drawable;
GdkGC *gc;
GdkPixmap *ppixmap;
int x;
int y;
bool inited;
bool createdGC;
#elif PLAT_WIN
HDC hdc;
bool hdcOwned;
HPEN pen;
HPEN penOld;
HBRUSH brush;
HBRUSH brushOld;
HFONT font;
HFONT fontOld;
HBITMAP bitmap;
HBITMAP bitmapOld;
HPALETTE paletteOld;
#elif PLAT_WX
wxDC* hdc;
bool hdcOwned;
wxBitmap* bitmap;
int x;
int y;
#endif
// Private so Surface objects can not be copied
Surface(const Surface &) {}
Surface &operator=(const Surface &) { return *this; }
#if PLAT_WIN || PLAT_WX
void BrushColor(Colour back);
void SetFont(Font &font_);
#endif
public:
Surface();
~Surface();
void Init();
void Init(SurfaceID hdc_);
void InitPixMap(int width, int height, Surface *surface_);
void Release();
bool Initialised();
void PenColour(Colour fore);
int LogPixelsY();
void MoveTo(int x_, int y_);
void LineTo(int x_, int y_);
void Polygon(Point *pts, int npts, Colour fore, Colour back);
void RectangleDraw(PRectangle rc, Colour fore, Colour back);
void FillRectangle(PRectangle rc, Colour back);
void FillRectangle(PRectangle rc, Surface &surfacePattern);
void RoundedRectangle(PRectangle rc, Colour fore, Colour back);
void Ellipse(PRectangle rc, Colour fore, Colour back);
void Copy(PRectangle rc, Point from, Surface &surfaceSource);
void DrawText(PRectangle rc, Font &font_, int ybase, const char *s, int len, Colour fore, Colour back);
void DrawTextClipped(PRectangle rc, Font &font_, int ybase, const char *s, int len, Colour fore, Colour back);
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_);
int SetPalette(Palette *pal, bool inBackGround);
void SetClip(PRectangle rc);
void FlushCachedState();
};
// Class to hide the details of window manipulation
// Does not own the window which will normally have a longer life than this object
class Window {
friend class ListBox;
protected:
WindowID id;
public:
Window() : id(0) {}
virtual ~Window();
Window &operator=(WindowID id_) {
id = id_;
return *this;
}
WindowID GetID() { return id; }
bool Created() { return id != 0; }
void Destroy();
bool HasFocus();
PRectangle GetPosition();
void SetPosition(PRectangle rc);
void SetPositionRelative(PRectangle rc, Window relativeTo);
PRectangle GetClientPosition();
void Show(bool show=true);
void InvalidateAll();
void InvalidateRectangle(PRectangle rc);
void SetFont(Font &font);
enum Cursor { cursorText, cursorArrow, cursorUp, cursorWait, cursorHoriz, cursorVert, cursorReverseArrow };
void SetCursor(Cursor curs);
void SetTitle(const char *s);
#if PLAT_WIN
LRESULT SendMessage(UINT msg, WPARAM wParam=0, LPARAM lParam=0);
int GetDlgCtrlID();
HINSTANCE GetInstance();
#endif
};
class ListBox : public Window {
#if PLAT_GTK
WindowID list;
WindowID scroller;
int current;
#endif
public:
ListBox();
virtual ~ListBox();
ListBox &operator=(WindowID id_) {
id = id_;
return *this;
}
void Create(Window &parent, int ctrlID);
void Clear();
void Append(char *s);
int Length();
void Select(int n);
int GetSelection();
int Find(const char *prefix);
void GetValue(int n, char *value, int len);
void Sort();
};
class Menu {
MenuID id;
public:
Menu();
MenuID GetID() { return id; }
void CreatePopUp();
void Destroy();
void Show(Point pt, Window &w);
};
// Platform class used to retrieve system wide parameters such as double click speed
// and chrome colour. Not a creatable object, more of a module with several functions.
class Platform {
// Private so Platform objects can not be copied
Platform(const Platform &) {}
Platform &operator=(const Platform &) { return *this; }
public:
// Should be private because no new Platforms are ever created
// but gcc warns about this
Platform() {}
~Platform() {}
static Colour Chrome();
static Colour ChromeHighlight();
static const char *DefaultFont();
static int DefaultFontSize();
static unsigned int DoubleClickTime();
static void DebugDisplay(const char *s);
static bool IsKeyDown(int key);
static long SendScintilla(
WindowID w, unsigned int msg, unsigned long wParam=0, long lParam=0);
// These are utility functions not really tied to a platform
static int Minimum(int a, int b);
static int Maximum(int a, int b);
static void DebugPrintf(const char *format, ...);
static int Clamp(int val, int minVal, int maxVal);
};
#endif

View File

@@ -1,180 +0,0 @@
// SciTE - Scintilla based Text Editor
// PropSet.h - a java style properties file module
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef PROPSET_H
#define PROPSET_H
bool EqualCaseInsensitive(const char *a, const char *b);
// Define another string class.
// While it would be 'better' to use std::string, that doubles the executable size.
inline char *StringDup(const char *s) {
if (!s)
return 0;
char *sNew = new char[strlen(s) + 1];
if (sNew)
strcpy(sNew, s);
return sNew;
}
class SString {
char *s;
public:
SString() {
s = 0;
}
SString(const SString &source) {
s = StringDup(source.s);
}
SString(const char *s_) {
s = StringDup(s_);
}
SString(int i) {
char number[100];
sprintf(number, "%0d", i);
//itoa(i, number, 10);
s = StringDup(number);
}
~SString() {
delete []s;
s = 0;
}
SString &operator=(const SString &source) {
if (this != &source) {
delete []s;
s = StringDup(source.s);
}
return *this;
}
bool operator==(const SString &other) const {
if ((s == 0) && (other.s == 0))
return true;
if ((s == 0) || (other.s == 0))
return false;
return strcmp(s, other.s) == 0;
}
bool operator==(const char *sother) const {
if ((s == 0) && (sother == 0))
return true;
if ((s == 0) || (sother == 0))
return false;
return strcmp(s, sother) == 0;
}
const char *c_str() const {
if (s)
return s;
else
return "";
}
int length() const {
if (s)
return strlen(s);
else
return 0;
}
char operator[](int i) {
if (s)
return s[i];
else
return '\0';
}
SString &operator +=(const char *sother) {
int len = length();
int lenOther = strlen(sother);
char *sNew = new char[len + lenOther + 1];
if (sNew) {
if (s)
memcpy(sNew, s, len);
memcpy(sNew + len, sother, lenOther);
sNew[len + lenOther] = '\0';
delete []s;
s = sNew;
}
return *this;
}
int value() {
if (s)
return atoi(s);
else
return 0;
}
};
class PropSet {
private:
char **vals;
int size;
int used;
public:
PropSet *superPS;
PropSet();
~PropSet();
void EnsureCanAddEntry();
void Set(const char *key, const char *val);
void Set(char *keyval);
SString Get(const char *key);
int GetInt(const char *key, int defaultValue=0);
SString GetWild(const char *keybase, const char *filename);
SString GetNewExpand(const char *keybase, const char *filename);
void Clear();
void ReadFromMemory(const char *data, int len);
void Read(const char *filename);
};
// This is a fixed length list of strings suitable for display in combo boxes
// as a memory of user entries
template<int sz>
class EntryMemory {
SString entries[sz];
public:
void Insert(SString s) {
for (int i=0;i<sz;i++) {
if (entries[i] == s) {
for (int j=i;j>0;j--) {
entries[j] = entries[j-1];
}
entries[0] = s;
return;
}
}
for (int k=sz-1;k>0;k--) {
entries[k] = entries[k-1];
}
entries[0] = s;
}
int Length() const {
int len = 0;
for (int i=0;i<sz;i++)
if (entries[i].length())
len++;
return len;
}
SString At(int n) const {
return entries[n];
}
};
class WordList {
public:
// Each word contains at least one character - a empty word acts as sentinal at the end.
char **words;
char *list;
int len;
bool onlyLineEnds; // Delimited by any white space or only line ends
int starts[256];
WordList(bool onlyLineEnds_ = false) :
words(0), list(0), len(0), onlyLineEnds(onlyLineEnds_) {}
~WordList() { Clear(); }
operator bool() { return list; }
const char *operator[](int ind) { return words[ind]; }
void Clear();
void Set(const char *s);
char *Allocate(int size);
void SetFromAllocated();
bool InList(const char *s);
};
#endif

View File

@@ -1,172 +0,0 @@
// Scintilla source code edit control
// SciLexer - interface to the added lexer functions in the SciLexer version of the edit control
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef SCILEXER_H
#define SCILEXER_H
// SciLexer features - not in standard Scintilla
#define SCLEX_CONTAINER 0
#define SCLEX_NULL 1
#define SCLEX_PYTHON 2
#define SCLEX_CPP 3
#define SCLEX_HTML 4
#define SCLEX_XML 5
#define SCLEX_PERL 6
#define SCLEX_SQL 7
#define SCLEX_VB 8
#define SCLEX_PROPERTIES 9
#define SCLEX_ERRORLIST 10
#define SCLEX_MAKEFILE 11
#define SCLEX_BATCH 12
// Lexical states for SCLEX_PYTHON
#define SCE_P_DEFAULT 0
#define SCE_P_COMMENTLINE 1
#define SCE_P_NUMBER 2
#define SCE_P_STRING 3
#define SCE_P_CHARACTER 4
#define SCE_P_WORD 5
#define SCE_P_TRIPLE 6
#define SCE_P_TRIPLEDOUBLE 7
#define SCE_P_CLASSNAME 8
#define SCE_P_DEFNAME 9
#define SCE_P_OPERATOR 10
#define SCE_P_IDENTIFIER 11
#define SCE_P_COMMENTBLOCK 12
#define SCE_P_STRINGEOL 13
// Lexical states for SCLEX_CPP, SCLEX_VB
#define SCE_C_DEFAULT 0
#define SCE_C_COMMENT 1
#define SCE_C_COMMENTLINE 2
#define SCE_C_COMMENTDOC 3
#define SCE_C_NUMBER 4
#define SCE_C_WORD 5
#define SCE_C_STRING 6
#define SCE_C_CHARACTER 7
#define SCE_C_UUID 8
#define SCE_C_PREPROCESSOR 9
#define SCE_C_OPERATOR 10
#define SCE_C_IDENTIFIER 11
#define SCE_C_STRINGEOL 12
// Lexical states for SCLEX_HTML, SCLEX_xML
#define SCE_H_DEFAULT 0
#define SCE_H_TAG 1
#define SCE_H_TAGUNKNOWN 2
#define SCE_H_ATTRIBUTE 3
#define SCE_H_ATTRIBUTEUNKNOWN 4
#define SCE_H_NUMBER 5
#define SCE_H_DOUBLESTRING 6
#define SCE_H_SINGLESTRING 7
#define SCE_H_OTHER 8
#define SCE_H_COMMENT 9
#define SCE_H_ENTITY 10
// XML and ASP
#define SCE_H_TAGEND 11
#define SCE_H_XMLSTART 12
#define SCE_H_XMLEND 13
#define SCE_H_SCRIPT 14
#define SCE_H_ASP 15
#define SCE_H_ASPAT 16
// Embedded Javascript
#define SCE_HJ_START 40
#define SCE_HJ_DEFAULT 41
#define SCE_HJ_COMMENT 42
#define SCE_HJ_COMMENTLINE 43
#define SCE_HJ_COMMENTDOC 44
#define SCE_HJ_NUMBER 45
#define SCE_HJ_WORD 46
#define SCE_HJ_KEYWORD 47
#define SCE_HJ_DOUBLESTRING 48
#define SCE_HJ_SINGLESTRING 49
#define SCE_HJ_SYMBOLS 50
#define SCE_HJ_STRINGEOL 51
// ASP Javascript
#define SCE_HJA_START 55
#define SCE_HJA_DEFAULT 56
#define SCE_HJA_COMMENT 57
#define SCE_HJA_COMMENTLINE 58
#define SCE_HJA_COMMENTDOC 59
#define SCE_HJA_NUMBER 60
#define SCE_HJA_WORD 61
#define SCE_HJA_KEYWORD 62
#define SCE_HJA_DOUBLESTRING 63
#define SCE_HJA_SINGLESTRING 64
#define SCE_HJA_SYMBOLS 65
#define SCE_HJA_STRINGEOL 66
// Embedded VBScript
#define SCE_HB_START 70
#define SCE_HB_DEFAULT 71
#define SCE_HB_COMMENTLINE 72
#define SCE_HB_NUMBER 73
#define SCE_HB_WORD 74
#define SCE_HB_STRING 75
#define SCE_HB_IDENTIFIER 76
#define SCE_HB_STRINGEOL 77
// ASP VBScript
#define SCE_HBA_START 80
#define SCE_HBA_DEFAULT 81
#define SCE_HBA_COMMENTLINE 82
#define SCE_HBA_NUMBER 83
#define SCE_HBA_WORD 84
#define SCE_HBA_STRING 85
#define SCE_HBA_IDENTIFIER 86
#define SCE_HBA_STRINGEOL 87
// Embedded Python
#define SCE_HP_START 90
#define SCE_HP_DEFAULT 91
#define SCE_HP_COMMENTLINE 92
#define SCE_HP_NUMBER 93
#define SCE_HP_STRING 94
#define SCE_HP_CHARACTER 95
#define SCE_HP_WORD 96
#define SCE_HP_TRIPLE 97
#define SCE_HP_TRIPLEDOUBLE 98
#define SCE_HP_CLASSNAME 99
#define SCE_HP_DEFNAME 100
#define SCE_HP_OPERATOR 101
#define SCE_HP_IDENTIFIER 102
// ASP Python
#define SCE_HPA_START 105
#define SCE_HPA_DEFAULT 106
#define SCE_HPA_COMMENTLINE 107
#define SCE_HPA_NUMBER 108
#define SCE_HPA_STRING 109
#define SCE_HPA_CHARACTER 110
#define SCE_HPA_WORD 111
#define SCE_HPA_TRIPLE 112
#define SCE_HPA_TRIPLEDOUBLE 113
#define SCE_HPA_CLASSNAME 114
#define SCE_HPA_DEFNAME 115
#define SCE_HPA_OPERATOR 116
#define SCE_HPA_IDENTIFIER 117
// Lexical states for SCLEX_PERL
#define SCE_PL_DEFAULT 0
#define SCE_PL_HERE 1
#define SCE_PL_COMMENTLINE 2
#define SCE_PL_POD 3
#define SCE_PL_NUMBER 4
#define SCE_PL_WORD 5
#define SCE_PL_STRING 6
#define SCE_PL_CHARACTER 7
#define SCE_PL_PUNCTUATION 8
#define SCE_PL_PREPROCESSOR 9
#define SCE_PL_OPERATOR 10
#define SCE_PL_IDENTIFIER 11
#define SCE_PL_SCALAR 12
#define SCE_PL_ARRAY 13
#define SCE_PL_HASH 14
#define SCE_PL_SYMBOLTABLE 15
#define SCE_PL_REF 16
#define SCE_PL_REGEX 17
#define SCE_PL_REGSUBST 18
#define SCE_PL_LONGQUOTE 19
#define SCE_PL_BACKTICKS 20
#define SCE_PL_DATASECTION 21
#endif

View File

@@ -1,423 +0,0 @@
// Scintilla source code edit control
// Scintilla.h - interface to the edit control
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef SCINTILLA_H
#define SCINTILLA_H
// Compile-time configuration options
#define MACRO_SUPPORT 1 // Comment out to remove macro hooks
#if PLAT_GTK
#include <gdk/gdk.h>
#include <gtk/gtkvbox.h>
#ifdef __cplusplus
extern "C" {
#endif
#define SCINTILLA(obj) GTK_CHECK_CAST (obj, scintilla_get_type (), ScintillaObject)
#define SCINTILLA_CLASS(klass) GTK_CHECK_CLASS_CAS T (klass, scintilla_get_type (), ScintillaClass)
#define IS_SCINTILLA(obj) GTK_CHECK_TYPE (obj, scintilla_get_type ())
typedef struct _ScintillaObject ScintillaObject;
typedef struct _ScintillaClass ScintillaClass;
struct _ScintillaObject
{
GtkFixed vbox;
void *pscin;
};
struct _ScintillaClass
{
GtkFixedClass parent_class;
void (* command) (ScintillaObject *ttt);
void (* notify) (ScintillaObject *ttt);
};
guint scintilla_get_type (void);
GtkWidget* scintilla_new (void);
void scintilla_set_id (ScintillaObject *sci,int id);
long scintilla_send_message (ScintillaObject *sci,int iMessage,int wParam,int lParam);
#include "WinDefs.h"
#ifdef __cplusplus
}
#endif
#endif
#if PLAT_WX
#include "WinDefs.h"
#endif
// Both GTK and Windows
#define INVALID_POSITION -1
// Define start of Scintilla messages to be greater than all edit (EM_*) messages
// as many EM_ messages can be used.
#define SCI_START 2000
#define SCI_OPTIONAL_START 3000
#define SCI_LEXER_START 4000
#define SCI_ADDTEXT SCI_START + 1
#define SCI_ADDSTYLEDTEXT SCI_START + 2
#define SCI_INSERTTEXT SCI_START + 3
#define SCI_CLEARALL SCI_START + 4
#define SCI_GETLENGTH SCI_START + 6
#define SCI_GETCHARAT SCI_START + 7
#define SCI_GETCURRENTPOS SCI_START + 8
#define SCI_GETANCHOR SCI_START + 9
#define SCI_GETSTYLEAT SCI_START + 10
#define SCI_REDO SCI_START + 11
#define SCI_SETUNDOCOLLECTION SCI_START + 12
#define SCI_SELECTALL SCI_START + 13
#define SCI_SETSAVEPOINT SCI_START + 14
#define SCI_GETSTYLEDTEXT SCI_START + 15
#define SCI_CANREDO SCI_START + 16
#define SCI_MARKERLINEFROMHANDLE SCI_START + 17
#define SCI_MARKERDELETEHANDLE SCI_START + 18
#define SC_UNDOCOLLECT_NONE 0
#define SC_UNDOCOLLECT_AUTOSTART 1
#define SCI_GETVIEWWS SCI_START + 20
#define SCI_SETVIEWWS SCI_START + 21
#define SCI_CHANGEPOSITION SCI_START + 22
#define SCI_GOTOLINE SCI_START + 24
#define SCI_GOTOPOS SCI_START + 25
#define SCI_SETANCHOR SCI_START + 26
#define SCI_GETCURLINE SCI_START + 27
#define SCI_GETENDSTYLED SCI_START + 28
#define SCI_CONVERTEOLS SCI_START + 29
#define SCI_GETEOLMODE SCI_START + 30
#define SCI_SETEOLMODE SCI_START + 31
#define SC_EOL_CRLF 0
#define SC_EOL_CR 1
#define SC_EOL_LF 2
#define SCI_STARTSTYLING SCI_START + 32
#define SCI_SETSTYLING SCI_START + 33
#define SCI_SETBUFFEREDDRAW SCI_START + 35
#define SCI_SETTABWIDTH SCI_START + 36
#define SCI_SETCODEPAGE SCI_START + 37
#define SCI_SETUSEPALETTE SCI_START + 39
#define MARKER_MAX 31
#define SC_MARK_CIRCLE 0
#define SC_MARK_ROUNDRECT 1
#define SC_MARK_ARROW 2
#define SC_MARK_SMALLRECT 3
#define SC_MARK_SHORTARROW 4
#define SC_MARK_EMPTY 5
#define SC_MARK_ARROWDOWN 6
#define SC_MARK_MINUS 7
#define SC_MARK_PLUS 8
#define SCI_MARKERDEFINE SCI_START + 40
#define SCI_MARKERSETFORE SCI_START + 41
#define SCI_MARKERSETBACK SCI_START + 42
#define SCI_MARKERADD SCI_START + 43
#define SCI_MARKERDELETE SCI_START + 44
#define SCI_MARKERDELETEALL SCI_START + 45
#define SCI_MARKERGET SCI_START + 46
#define SCI_MARKERNEXT SCI_START + 47
#define SCI_MARKERPREVIOUS SCI_START + 48
#define SC_MARKNUM_FOLDER 30
#define SC_MARKNUM_FOLDEROPEN 31
#define SC_MASK_FOLDERS ((1<<SC_MARKNUM_FOLDER) | (1<<SC_MARKNUM_FOLDEROPEN))
#define SC_MARGIN_SYMBOL 0
#define SC_MARGIN_NUMBER 1
#define SCI_SETMARGINTYPEN SCI_START + 240
#define SCI_GETMARGINTYPEN SCI_START + 241
#define SCI_SETMARGINWIDTHN SCI_START + 242
#define SCI_GETMARGINWIDTHN SCI_START + 243
#define SCI_SETMARGINMASKN SCI_START + 244
#define SCI_GETMARGINMASKN SCI_START + 245
#define SCI_SETMARGINSENSITIVEN SCI_START + 246
#define SCI_GETMARGINSENSITIVEN SCI_START + 247
#define STYLE_DEFAULT 32
#define STYLE_LINENUMBER 33
#define STYLE_BRACELIGHT 34
#define STYLE_BRACEBAD 35
#define STYLE_CONTROLCHAR 36
#define STYLE_MAX 127
#define SCI_STYLECLEARALL SCI_START + 50
#define SCI_STYLESETFORE SCI_START + 51
#define SCI_STYLESETBACK SCI_START + 52
#define SCI_STYLESETBOLD SCI_START + 53
#define SCI_STYLESETITALIC SCI_START + 54
#define SCI_STYLESETSIZE SCI_START + 55
#define SCI_STYLESETFONT SCI_START + 56
#define SCI_STYLESETEOLFILLED SCI_START + 57
#define SCI_STYLERESETDEFAULT SCI_START + 58
#define SCI_SETSELFORE SCI_START + 67
#define SCI_SETSELBACK SCI_START + 68
#define SCI_SETCARETFORE SCI_START + 69
#define SCI_ASSIGNCMDKEY SCI_START + 70
#define SCI_CLEARCMDKEY SCI_START + 71
#define SCI_CLEARALLCMDKEYS SCI_START + 72
#define SCI_SETSTYLINGEX SCI_START + 73
#define SCI_GETCARETPERIOD SCI_START + 75
#define SCI_SETCARETPERIOD SCI_START + 76
#define SCI_SETWORDCHARS SCI_START + 77
#define SCI_BEGINUNDOACTION SCI_START + 78
#define SCI_ENDUNDOACTION SCI_START + 79
#define INDIC_MAX 7
#define INDIC_PLAIN 0
#define INDIC_SQUIGGLE 1
#define INDIC_TT 2
#define INDIC0_MASK 32
#define INDIC1_MASK 64
#define INDIC2_MASK 128
#define INDICS_MASK (INDIC0_MASK | INDIC1_MASK | INDIC2_MASK)
#define SCI_INDICSETSTYLE SCI_START + 80
#define SCI_INDICGETSTYLE SCI_START + 81
#define SCI_INDICSETFORE SCI_START + 82
#define SCI_INDICGETFORE SCI_START + 83
#define SCI_SETSTYLEBITS SCI_START + 90
#define SCI_GETSTYLEBITS SCI_START + 91
#define SCI_SETLINESTATE SCI_START + 92
#define SCI_GETLINESTATE SCI_START + 93
#define SCI_GETMAXLINESTATE SCI_START + 94
#define SCI_AUTOCSHOW SCI_START + 100
#define SCI_AUTOCCANCEL SCI_START + 101
#define SCI_AUTOCACTIVE SCI_START + 102
#define SCI_AUTOCPOSSTART SCI_START + 103
#define SCI_AUTOCCOMPLETE SCI_START + 104
#define SCI_AUTOCSTOPS SCI_START + 105
#define SCI_CALLTIPSHOW SCI_START + 200
#define SCI_CALLTIPCANCEL SCI_START + 201
#define SCI_CALLTIPACTIVE SCI_START + 202
#define SCI_CALLTIPPOSSTART SCI_START + 203
#define SCI_CALLTIPSETHLT SCI_START + 204
#define SCI_CALLTIPSETBACK SCI_START + 205
#define SC_FOLDLEVELBASE 0x400
#define SC_FOLDLEVELWHITEFLAG 0x1000
#define SC_FOLDLEVELHEADERFLAG 0x2000
#define SC_FOLDLEVELNUMBERMASK 0x0FFF
#define SCI_VISIBLEFROMDOCLINE SCI_START + 220
#define SCI_DOCLINEFROMVISIBLE SCI_START + 221
#define SCI_SETFOLDLEVEL SCI_START + 222
#define SCI_GETFOLDLEVEL SCI_START + 223
#define SCI_GETLASTCHILD SCI_START + 224
#define SCI_GETFOLDPARENT SCI_START + 225
#define SCI_SHOWLINES SCI_START + 226
#define SCI_HIDELINES SCI_START + 227
#define SCI_GETLINEVISIBLE SCI_START + 228
#define SCI_SETFOLDEXPANDED SCI_START + 229
#define SCI_GETFOLDEXPANDED SCI_START + 230
#define SCI_TOGGLEFOLD SCI_START + 231
#define SCI_ENSUREVISIBLE SCI_START + 232
#define SCI_SETFOLDFLAGS SCI_START + 233
// Key messages
#define SCI_LINEDOWN SCI_START + 300
#define SCI_LINEDOWNEXTEND SCI_START + 301
#define SCI_LINEUP SCI_START + 302
#define SCI_LINEUPEXTEND SCI_START + 303
#define SCI_CHARLEFT SCI_START + 304
#define SCI_CHARLEFTEXTEND SCI_START + 305
#define SCI_CHARRIGHT SCI_START + 306
#define SCI_CHARRIGHTEXTEND SCI_START + 307
#define SCI_WORDLEFT SCI_START + 308
#define SCI_WORDLEFTEXTEND SCI_START + 309
#define SCI_WORDRIGHT SCI_START + 310
#define SCI_WORDRIGHTEXTEND SCI_START + 311
#define SCI_HOME SCI_START + 312
#define SCI_HOMEEXTEND SCI_START + 313
#define SCI_LINEEND SCI_START + 314
#define SCI_LINEENDEXTEND SCI_START + 315
#define SCI_DOCUMENTSTART SCI_START + 316
#define SCI_DOCUMENTSTARTEXTEND SCI_START + 317
#define SCI_DOCUMENTEND SCI_START + 318
#define SCI_DOCUMENTENDEXTEND SCI_START + 319
#define SCI_PAGEUP SCI_START + 320
#define SCI_PAGEUPEXTEND SCI_START + 321
#define SCI_PAGEDOWN SCI_START + 322
#define SCI_PAGEDOWNEXTEND SCI_START + 323
#define SCI_EDITTOGGLEOVERTYPE SCI_START + 324
#define SCI_CANCEL SCI_START + 325
#define SCI_DELETEBACK SCI_START + 326
#define SCI_TAB SCI_START + 327
#define SCI_BACKTAB SCI_START + 328
#define SCI_NEWLINE SCI_START + 329
#define SCI_FORMFEED SCI_START + 330
#define SCI_VCHOME SCI_START + 331
#define SCI_VCHOMEEXTEND SCI_START + 332
#define SCI_ZOOMIN SCI_START + 333
#define SCI_ZOOMOUT SCI_START + 334
#define SCI_DELWORDLEFT SCI_START + 335
#define SCI_DELWORDRIGHT SCI_START + 336
#define SCI_LINECUT SCI_START + 337
#define SCI_LINEDELETE SCI_START + 338
#define SCI_LINETRANSPOSE SCI_START + 339
#define SCI_LOWERCASE SCI_START + 340
#define SCI_UPPERCASE SCI_START + 341
#define SCI_LINELENGTH SCI_START + 350
#define SCI_BRACEHIGHLIGHT SCI_START + 351
#define SCI_BRACEBADLIGHT SCI_START + 352
#define SCI_BRACEMATCH SCI_START + 353
#define SCI_GETVIEWEOL SCI_START + 355
#define SCI_SETVIEWEOL SCI_START + 356
#define SCI_GETDOCPOINTER SCI_START + 357
#define SCI_SETDOCPOINTER SCI_START + 358
#define SCI_SETMODEVENTMASK SCI_START + 359
#define EDGE_NONE 0
#define EDGE_LINE 1
#define EDGE_BACKGROUND 2
#define SCI_GETEDGECOLUMN SCI_START + 360
#define SCI_SETEDGECOLUMN SCI_START + 361
#define SCI_GETEDGEMODE SCI_START + 362
#define SCI_SETEDGEMODE SCI_START + 363
#define SCI_GETEDGECOLOUR SCI_START + 364
#define SCI_SETEDGECOLOUR SCI_START + 365
#define SCI_SEARCHANCHOR SCI_START + 366
#define SCI_SEARCHNEXT SCI_START + 367
#define SCI_SEARCHPREV SCI_START + 368
#define CARET_SLOP 0x01 // Show caret within N lines of edge when it's scrolled to view
#define CARET_CENTER 0x02 // Center caret on screen when it's scrolled to view
#define CARET_STRICT 0x04 // OR this with CARET_CENTER to reposition even when visible, or
// OR this with CARET_SLOP to reposition whenever outside slop border
#define SCI_SETCARETPOLICY SCI_START + 369
#define SCI_LINESONSCREEN SCI_START + 370
#define SCI_USEPOPUP SCI_START + 371
// GTK+ Specific
#define SCI_GRABFOCUS SCI_START + 400
// Optional module for macro recording
#ifdef MACRO_SUPPORT
typedef void (tMacroRecorder)(UINT iMessage, WPARAM wParam, LPARAM lParam,
void *userData);
#define SCI_STARTRECORD SCI_OPTIONAL_START + 1
#define SCI_STOPRECORD SCI_OPTIONAL_START + 2
#endif
#define SCI_SETLEXER SCI_LEXER_START + 1
#define SCI_GETLEXER SCI_LEXER_START + 2
#define SCI_COLOURISE SCI_LEXER_START + 3
#define SCI_SETPROPERTY SCI_LEXER_START + 4
#define SCI_SETKEYWORDS SCI_LEXER_START + 5
// Notifications
// Type of modification and the action which caused the modification
// These are defined as a bit mask to make it easy to specify which notifications are wanted.
// One bit is set from each of SC_MOD_* and SC_PERFORMED_*.
#define SC_MOD_INSERTTEXT 0x1
#define SC_MOD_DELETETEXT 0x2
#define SC_MOD_CHANGESTYLE 0x4
#define SC_MOD_CHANGEFOLD 0x8
#define SC_PERFORMED_USER 0x10
#define SC_PERFORMED_UNDO 0x20
#define SC_PERFORMED_REDO 0x40
#define SC_LASTSTEPINUNDOREDO 0x100
#define SC_MOD_CHANGEMARKER 0x200
#define SC_MODEVENTMASKALL 0x377
struct SCNotification {
NMHDR nmhdr;
int position; // SCN_STYLENEEDED, SCN_MODIFIED
int ch; // SCN_CHARADDED, SCN_KEY
int modifiers; // SCN_KEY
int modificationType; // SCN_MODIFIED
const char *text; // SCN_MODIFIED
int length; // SCN_MODIFIED
int linesAdded; // SCN_MODIFIED
#ifdef MACRO_SUPPORT
int message; // SCN_MACRORECORD
int wParam; // SCN_MACRORECORD
int lParam; // SCN_MACRORECORD
#endif
int line; // SCN_MODIFIED
int foldLevelNow; // SCN_MODIFIED
int foldLevelPrev; // SCN_MODIFIED
int margin; // SCN_MARGINCLICK
};
#define SCN_STYLENEEDED 2000
#define SCN_CHARADDED 2001
#define SCN_SAVEPOINTREACHED 2002
#define SCN_SAVEPOINTLEFT 2003
#define SCN_MODIFYATTEMPTRO 2004
// GTK+ Specific to work around focus and accelerator problems:
#define SCN_KEY 2005
#define SCN_DOUBLECLICK 2006
#define SCN_UPDATEUI 2007
// The old name for SCN_UPDATEUI:
#define SCN_CHECKBRACE 2007
#define SCN_MODIFIED 2008
// Optional module for macro recording
#ifdef MACRO_SUPPORT
#define SCN_MACRORECORD 2009
#endif
#define SCN_MARGINCLICK 2010
#define SCN_NEEDSHOWN 2011
#ifdef STATIC_BUILD
void Scintilla_RegisterClasses(HINSTANCE hInstance);
#endif
// Deprecation section listing all API features that are deprecated and will
// will be removed completely in a future version.
// To enable these features define INCLUDE_DEPRECATED_FEATURES
#ifdef INCLUDE_DEPRECATED_FEATURES
// Default style settings. These are deprecated and will be removed in a future version.
#define SCI_SETFORE SCI_START + 60
#define SCI_SETBACK SCI_START + 61
#define SCI_SETBOLD SCI_START + 62
#define SCI_SETITALIC SCI_START + 63
#define SCI_SETSIZE SCI_START + 64
#define SCI_SETFONT SCI_START + 65
#define SCI_APPENDUNDOSTARTACTION SCI_START + 74
#define SC_UNDOCOLLECT_MANUALSTART 2
// Deprecated in release 1.22
#define SCI_SETMARGINWIDTH SCI_START + 34
#define SCI_SETLINENUMBERWIDTH SCI_START + 38
#endif
#endif

View File

@@ -1,218 +0,0 @@
// Scintilla source code edit control
// WinDefs.h - the subset of definitions from Windows needed by Scintilla for GTK+
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef WINDEFS_H
#define WINDEFS_H
#define WORD short
#define WPARAM unsigned long
#define LPARAM long
#define LRESULT long
#define DWORD long
#define UINT unsigned int
#define LPSTR char *
#define LONG long
/* RTF control */
#define EM_CANPASTE (1074)
#define EM_CANUNDO (198)
#define EM_CHARFROMPOS (215)
#define EM_DISPLAYBAND (1075)
#define EM_EMPTYUNDOBUFFER (205)
#define EM_EXGETSEL (1076)
#define EM_EXLIMITTEXT (1077)
#define EM_EXLINEFROMCHAR (1078)
#define EM_EXSETSEL (1079)
#define EM_FINDTEXT (1080)
#define EM_FINDTEXTEX (1103)
#define EM_FINDWORDBREAK (1100)
#define EM_FMTLINES (200)
#define EM_FORMATRANGE (1081)
#define EM_GETCHARFORMAT (1082)
#define EM_GETEVENTMASK (1083)
#define EM_GETFIRSTVISIBLELINE (206)
#define EM_GETHANDLE (189)
#define EM_GETLIMITTEXT (213)
#define EM_GETLINE (196)
#define EM_GETLINECOUNT (186)
#define EM_GETMARGINS (212)
#define EM_GETMODIFY (184)
#define EM_GETIMECOLOR (1129)
#define EM_GETIMEOPTIONS (1131)
#define EM_GETOPTIONS (1102)
#define EM_GETOLEINTERFACE (1084)
#define EM_GETPARAFORMAT (1085)
#define EM_GETPASSWORDCHAR (210)
#define EM_GETPUNCTUATION (1125)
#define EM_GETRECT (178)
#define EM_GETSEL (176)
#define EM_GETSELTEXT (1086)
#define EM_GETTEXTRANGE (1099)
#define EM_GETTHUMB (190)
#define EM_GETWORDBREAKPROC (209)
#define EM_GETWORDBREAKPROCEX (1104)
#define EM_GETWORDWRAPMODE (1127)
#define EM_HIDESELECTION (1087)
#define EM_LIMITTEXT (197)
#define EM_LINEFROMCHAR (201)
#define EM_LINEINDEX (187)
#define EM_LINELENGTH (193)
#define EM_LINESCROLL (182)
#define EM_PASTESPECIAL (1088)
#define EM_POSFROMCHAR (214)
#define EM_REPLACESEL (194)
#define EM_REQUESTRESIZE (1089)
#define EM_SCROLL (181)
#define EM_SCROLLCARET (183)
#define EM_SELECTIONTYPE (1090)
#define EM_SETBKGNDCOLOR (1091)
#define EM_SETCHARFORMAT (1092)
#define EM_SETEVENTMASK (1093)
#define EM_SETHANDLE (188)
#define EM_SETIMECOLOR (1128)
#define EM_SETIMEOPTIONS (1130)
#define EM_SETLIMITTEXT (197)
#define EM_SETMARGINS (211)
#define EM_SETMODIFY (185)
#define EM_SETOLECALLBACK (1094)
#define EM_SETOPTIONS (1101)
#define EM_SETPARAFORMAT (1095)
#define EM_SETPASSWORDCHAR (204)
#define EM_SETPUNCTUATION (1124)
#define EM_SETREADONLY (207)
#define EM_SETRECT (179)
#define EM_SETRECTNP (180)
#define EM_SETSEL (177)
#define EM_SETTABSTOPS (203)
#define EM_SETTARGETDEVICE (1096)
#define EM_SETWORDBREAKPROC (208)
#define EM_SETWORDBREAKPROCEX (1105)
#define EM_SETWORDWRAPMODE (1126)
#define EM_STREAMIN (1097)
#define EM_STREAMOUT (1098)
#define EM_UNDO (199)
#define WM_NULL (0)
#define WM_CLEAR (771)
#define WM_COMMAND (273)
#define WM_COPY (769)
#define WM_CUT (768)
#define WM_GETTEXT (13)
#define WM_GETTEXTLENGTH (14)
#define WM_NOTIFY (78)
#define WM_PASTE (770)
#define WM_SETTEXT (12)
#define WM_UNDO (772)
#define EN_CHANGE (768)
#define EN_KILLFOCUS (512)
#define EN_SETFOCUS (256)
#define EC_LEFTMARGIN 1
#define EC_RIGHTMARGIN 2
#define EC_USEFONTINFO 0xffff
#if PLAT_GTK
#define VK_DOWN GDK_Down
#define VK_UP GDK_Up
#define VK_LEFT GDK_Left
#define VK_RIGHT GDK_Right
#define VK_HOME GDK_Home
#define VK_END GDK_End
#define VK_PRIOR GDK_Page_Up
#define VK_NEXT GDK_Page_Down
#define VK_DELETE GDK_Delete
#define VK_INSERT GDK_Insert
#define VK_ESCAPE GDK_Escape
#define VK_BACK GDK_BackSpace
#define VK_TAB GDK_Tab
#define VK_RETURN GDK_Return
#define VK_ADD GDK_KP_Add
#define VK_SUBTRACT GDK_KP_Subtract
#endif
#if PLAT_WX
#define VK_DOWN WXK_DOWN
#define VK_UP WXK_UP
#define VK_LEFT WXK_LEFT
#define VK_RIGHT WXK_RIGHT
#define VK_HOME WXK_HOME
#define VK_END WXK_END
#define VK_PRIOR WXK_PRIOR
#define VK_NEXT WXK_NEXT
#define VK_DELETE WXK_DELETE
#define VK_INSERT WXK_INSERT
#define VK_ESCAPE WXK_ESCAPE
#define VK_BACK WXK_BACK
#define VK_TAB WXK_TAB
#define VK_RETURN WXK_RETURN
#define VK_ADD WXK_ADD
#define VK_SUBTRACT WXK_SUBTRACT
// Are these needed any more
#define LPSTR char *
#define LONG long
#define LPDWORD (long *)
#endif
/* SELCHANGE structure */
#define SEL_EMPTY (0)
#define SEL_TEXT (1)
#define SEL_OBJECT (2)
#define SEL_MULTICHAR (4)
#define SEL_MULTIOBJECT (8)
/* FINDREPLACE structure */
#define FR_MATCHCASE (0x4)
#define FR_WHOLEWORD (0x2)
#define FR_DOWN (0x1)
#define SHIFT_PRESSED 1
#define LEFT_CTRL_PRESSED 2
#define LEFT_ALT_PRESSED 4
struct RECT {
LONG left;
LONG top;
LONG right;
LONG bottom;
};
struct CHARRANGE {
LONG cpMin;
LONG cpMax;
};
struct TEXTRANGE {
CHARRANGE chrg;
LPSTR lpstrText;
};
struct FINDTEXTEX {
CHARRANGE chrg;
LPSTR lpstrText;
CHARRANGE chrgText;
};
struct NMHDR {
WindowID hwndFrom;
UINT idFrom;
UINT code;
};
struct FORMATRANGE {
SurfaceID hdc;
SurfaceID hdcTarget;
RECT rc;
RECT rcPage;
CHARRANGE chrg;
};
#define MAKELONG(a, b) ((a) | ((b) << 16))
#define LOWORD(x) (x & 0xffff)
#define HIWORD(x) (x >> 16)
#endif

View File

@@ -1,166 +0,0 @@
// SciTE - Scintilla based Text Editor
// Accessor.cxx - rapid easy access to contents of a Scintilla
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <ctype.h>
#include <stdio.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "Scintilla.h"
bool Accessor::InternalIsLeadByte(char ch) {
#if PLAT_GTK
// TODO: support DBCS under GTK+
return false;
#elif PLAT_WIN
return IsDBCSLeadByteEx(codePage, ch);
#elif PLAT_WX
return false;
#endif
}
void Accessor::Fill(int position) {
if (lenDoc == -1)
lenDoc = Platform::SendScintilla(id, WM_GETTEXTLENGTH, 0, 0);
startPos = position - slopSize;
if (startPos + bufferSize > lenDoc)
startPos = lenDoc - bufferSize;
if (startPos < 0)
startPos = 0;
endPos = startPos + bufferSize;
if (endPos > lenDoc)
endPos = lenDoc;
TEXTRANGE tr = {{startPos, endPos}, buf};
Platform::SendScintilla(id, EM_GETTEXTRANGE, 0, reinterpret_cast<LPARAM>(&tr));
}
char Accessor::StyleAt(int position) {
return static_cast<char>(Platform::SendScintilla(
id, SCI_GETSTYLEAT, position, 0));
}
int Accessor::GetLine(int position) {
return Platform::SendScintilla(id, EM_LINEFROMCHAR, position, 0);
}
int Accessor::LineStart(int line) {
return Platform::SendScintilla(id, EM_LINEINDEX, line, 0);
}
int Accessor::LevelAt(int line) {
return Platform::SendScintilla(id, SCI_GETFOLDLEVEL, line, 0);
}
int Accessor::Length() {
if (lenDoc == -1)
lenDoc = Platform::SendScintilla(id, WM_GETTEXTLENGTH, 0, 0);
return lenDoc;
}
int Accessor::GetLineState(int line) {
return Platform::SendScintilla(id, SCI_GETLINESTATE, line);
}
int Accessor::SetLineState(int line, int state) {
return Platform::SendScintilla(id, SCI_SETLINESTATE, line, state);
}
void StylingContext::StartAt(unsigned int start, char chMask) {
Platform::SendScintilla(id, SCI_STARTSTYLING, start, chMask);
}
void StylingContext::StartSegment(unsigned int pos) {
startSeg = pos;
}
void StylingContext::ColourTo(unsigned int pos, int chAttr) {
// Only perform styling if non empty range
if (pos != startSeg - 1) {
if (pos < startSeg) {
Platform::DebugPrintf("Bad colour positions %d - %d\n", startSeg, pos);
}
if (validLen + (pos - startSeg + 1) >= bufferSize)
Flush();
if (validLen + (pos - startSeg + 1) >= bufferSize) {
// Too big for buffer so send directly
Platform::SendScintilla(id, SCI_SETSTYLING, pos - startSeg + 1, chAttr);
} else {
if (chAttr != chWhile)
chFlags = 0;
chAttr |= chFlags;
for (unsigned int i = startSeg; i <= pos; i++) {
styleBuf[validLen++] = chAttr;
}
}
}
startSeg = pos+1;
}
int StylingContext::GetLine(int position) {
return Platform::SendScintilla(id, EM_LINEFROMCHAR, position, 0);
}
void StylingContext::SetLevel(int line, int level) {
Platform::SendScintilla(id, SCI_SETFOLDLEVEL, line, level);
}
void StylingContext::Flush() {
if (validLen > 0) {
Platform::SendScintilla(id, SCI_SETSTYLINGEX, validLen,
reinterpret_cast<LPARAM>(styleBuf));
validLen = 0;
}
}
int StylingContext::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) {
int end = Length();
int spaceFlags = 0;
// Determines the indentation level of the current line and also checks for consistent
// indentation compared to the previous line.
// Indentation is judged consistent when the indentation whitespace of each line lines
// the same or the indentation of one line is a prefix of the other.
int pos = LineStart(line);
char ch = (*this)[pos];
int indent = 0;
bool inPrevPrefix = line > 0;
int posPrev = inPrevPrefix ? LineStart(line-1) : 0;
while ((ch == ' ' || ch == '\t') && (pos < end)) {
if (inPrevPrefix) {
char chPrev = (*this)[posPrev++];
if (chPrev == ' ' || chPrev == '\t') {
if (chPrev != ch)
spaceFlags |= wsInconsistent;
} else {
inPrevPrefix = false;
}
}
if (ch == ' ') {
spaceFlags |= wsSpace;
indent++;
} else { // Tab
spaceFlags |= wsTab;
if (spaceFlags & wsSpace)
spaceFlags |= wsSpaceTab;
indent = (indent / 8 + 1) * 8;
}
ch = (*this)[++pos];
}
*flags = spaceFlags;
indent += SC_FOLDLEVELBASE;
// if completely empty line or the start of a comment...
if (isspace(ch) || (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)) )
return indent | SC_FOLDLEVELWHITEFLAG;
else
return indent;
}

View File

@@ -1,104 +0,0 @@
// Scintilla source code edit control
// AutoComplete.cxx - defines the auto completion list box
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include "Platform.h"
#include "AutoComplete.h"
AutoComplete::AutoComplete() {
lb = 0;
active = false;
posStart = 0;
strcpy(stopChars, "");
}
AutoComplete::~AutoComplete() {
lb.Destroy();
}
bool AutoComplete::Active() {
return active;
}
void AutoComplete::Start(Window &parent, int ctrlID, int position, int startLen_) {
if (!lb.Created()) {
lb.Create(parent, ctrlID);
}
lb.Clear();
active = true;
startLen = startLen_;
posStart = position;
}
void AutoComplete::SetStopChars(const char *stopChars_) {
strncpy(stopChars, stopChars_, sizeof(stopChars));
stopChars[sizeof(stopChars) - 1] = '\0';
}
bool AutoComplete::IsStopChar(char ch) {
return ch && strchr(stopChars, ch);
}
int AutoComplete::SetList(const char *list) {
int maxStrLen = 12;
lb.Clear();
char *words = new char[strlen(list) + 1];
if (words) {
strcpy(words, list);
char *startword = words;
int i = 0;
for (; words && words[i]; i++) {
if (words[i] == ' ') {
words[i] = '\0';
lb.Append(startword);
maxStrLen = Platform::Maximum(maxStrLen, strlen(startword));
startword = words + i + 1;
}
}
if (startword) {
lb.Append(startword);
maxStrLen = Platform::Maximum(maxStrLen, strlen(startword));
}
delete []words;
}
lb.Sort();
return maxStrLen;
}
void AutoComplete::Show() {
lb.Show();
lb.Select(0);
}
void AutoComplete::Cancel() {
if (lb.Created()) {
lb.Destroy();
lb = 0;
active = false;
}
}
void AutoComplete::Move(int delta) {
int count = lb.Length();
int current = lb.GetSelection();
current += delta;
if (current >= count)
current = count - 1;
if (current < 0)
current = 0;
lb.Select(current);
}
void AutoComplete::Select(const char *word) {
int pos = lb.Find(word);
//Platform::DebugPrintf("Autocompleting at <%s> %d\n", wordCurrent, pos);
if (pos != -1)
lb.Select(pos);
}

View File

@@ -1,43 +0,0 @@
// Scintilla source code edit control
// AutoComplete.h - defines the auto completion list box
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef AUTOCOMPLETE_H
#define AUTOCOMPLETE_H
class AutoComplete {
bool active;
char stopChars[256];
public:
ListBox lb;
int posStart;
int startLen;
AutoComplete();
~AutoComplete();
// Is the auto completion list displayed?
bool Active();
// Display the auto completion list positioned to be near a character position
void Start(Window &parent, int ctrlID, int position, int startLen_);
// The stop chars are characters which, when typed, cause the auto completion list to disappear
void SetStopChars(const char *stopChars_);
bool IsStopChar(char ch);
// The list string contains a sequence of words separated by spaces
int SetList(const char *list);
void Show();
void Cancel();
// Move the current list element by delta, scrolling appropriately
void Move(int delta);
// Select a list element that starts with word as the current element
void Select(const char *word);
};
#endif

View File

@@ -1,168 +0,0 @@
// Scintilla source code edit control
// CallTip.cxx - code for displaying call tips
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include "Platform.h"
#include "CallTip.h"
CallTip::CallTip() {
wCallTip = 0;
inCallTipMode = false;
posStartCallTip = 0;
val = 0;
startHighlight = 0;
endHighlight = 0;
colourBG.desired = Colour(0xff, 0xff, 0xff);
colourUnSel.desired = Colour(0x80, 0x80, 0x80);
colourSel.desired = Colour(0, 0, 0x80);
colourShade.desired = Colour(0, 0, 0);
colourLight.desired = Colour(0xc0, 0xc0, 0xc0);
}
CallTip::~CallTip() {
wCallTip.Destroy();
delete []val;
val = 0;
}
void CallTip::RefreshColourPalette(Palette &pal, bool want) {
pal.WantFind(colourBG, want);
pal.WantFind(colourUnSel, want);
pal.WantFind(colourSel, want);
pal.WantFind(colourShade, want);
pal.WantFind(colourLight, want);
}
void CallTip::PaintCT(Surface *surfaceWindow) {
if (!val)
return;
PRectangle rcClientPos = wCallTip.GetClientPosition();
PRectangle rcClientSize(0, 0, rcClientPos.right - rcClientPos.left,
rcClientPos.bottom - rcClientPos.top);
PRectangle rcClient(1, 1, rcClientSize.right - 1, rcClientSize.bottom - 1);
surfaceWindow->FillRectangle(rcClient, colourBG.allocated);
// To make a nice small call tip window, it is only sized to fit most normal characters without accents
int lineHeight = surfaceWindow->Height(font);
int ascent = surfaceWindow->Ascent(font) - surfaceWindow->InternalLeading(font);
// For each line...
// Draw the definition in three parts: before highlight, highlighted, after highlight
int ytext = rcClient.top + ascent + 1;
char *chunkVal = val;
bool moreChunks = true;
while (moreChunks) {
char *chunkEnd = strchr(chunkVal, '\n');
if (chunkEnd == NULL) {
chunkEnd = chunkVal + strlen(chunkVal);
moreChunks = false;
}
int chunkOffset = chunkVal - val;
int chunkLength = chunkEnd - chunkVal;
int chunkEndOffset = chunkOffset + chunkLength;
int thisStartHighlight = Platform::Maximum(startHighlight, chunkOffset);
thisStartHighlight = Platform::Minimum(thisStartHighlight, chunkEndOffset);
thisStartHighlight -= chunkOffset;
int thisEndHighlight = Platform::Maximum(endHighlight, chunkOffset);
thisEndHighlight = Platform::Minimum(thisEndHighlight, chunkEndOffset);
thisEndHighlight -= chunkOffset;
int x = 5;
int xEnd = x + surfaceWindow->WidthText(font, chunkVal, thisStartHighlight);
rcClient.left = x;
rcClient.top = ytext - ascent - 1;
rcClient.right = xEnd;
surfaceWindow->DrawText(rcClient, font, ytext,
chunkVal, thisStartHighlight,
colourUnSel.allocated, colourBG.allocated);
x = xEnd;
xEnd = x + surfaceWindow->WidthText(font, chunkVal + thisStartHighlight,
thisEndHighlight - thisStartHighlight);
rcClient.top = ytext;
rcClient.left = x;
rcClient.right = xEnd;
surfaceWindow->DrawText(rcClient, font, ytext,
chunkVal + thisStartHighlight, thisEndHighlight - thisStartHighlight,
colourSel.allocated, colourBG.allocated);
x = xEnd;
xEnd = x + surfaceWindow->WidthText(font, chunkVal + thisEndHighlight,
chunkLength - thisEndHighlight);
rcClient.left = x;
rcClient.right = xEnd;
surfaceWindow->DrawText(rcClient, font, ytext,
chunkVal + thisEndHighlight, chunkLength - thisEndHighlight,
colourUnSel.allocated, colourBG.allocated);
chunkVal = chunkEnd + 1;
ytext += lineHeight;
}
// Draw a raised border around the edges of the window
surfaceWindow->MoveTo(0, rcClientSize.bottom - 1);
surfaceWindow->PenColour(colourShade.allocated);
surfaceWindow->LineTo(rcClientSize.right - 1, rcClientSize.bottom - 1);
surfaceWindow->LineTo(rcClientSize.right - 1, 0);
surfaceWindow->PenColour(colourLight.allocated);
surfaceWindow->LineTo(0, 0);
surfaceWindow->LineTo(0, rcClientSize.bottom - 1);
}
PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn,
const char *faceName, int size) {
Surface surfaceMeasure;
surfaceMeasure.Init();
int deviceHeight = (size * surfaceMeasure.LogPixelsY()) / 72;
font.Create(faceName, deviceHeight);
if (val)
delete []val;
val = new char[strlen(defn) + 1];
if (!val)
return PRectangle();
strcpy(val, defn);
startHighlight = 0;
endHighlight = 0;
inCallTipMode = true;
posStartCallTip = pos;
// Look for multiple lines in the text
// Only support \n here - simply means container must avoid \r!
int width = 0;
int numLines = 1;
const char *newline;
const char *look = val;
while ((newline = strchr(look, '\n')) != NULL) {
int thisWidth = surfaceMeasure.WidthText(font, look, newline - look);
width = Platform::Maximum(width, thisWidth);
look = newline + 1;
numLines++;
}
int lastWidth = surfaceMeasure.WidthText(font, look, strlen(look));
width = Platform::Maximum(width, lastWidth) + 10;
int lineHeight = surfaceMeasure.Height(font);
// Extra line for border and an empty line at top and bottom
int height = lineHeight * numLines - surfaceMeasure.InternalLeading(font) + 2 + 2;
return PRectangle(pt.x -5, pt.y + lineHeight + 1, pt.x + width - 5, pt.y + lineHeight + 1 + height);
}
void CallTip::CallTipCancel() {
inCallTipMode = false;
if (wCallTip.Created()) {
wCallTip.Destroy();
}
}
void CallTip::SetHighlight(int start, int end) {
// Avoid flashing by checking something has really changed
if ((start != startHighlight) || (end != endHighlight)) {
startHighlight = start;
endHighlight = end;
if (wCallTip.Created()) {
wCallTip.InvalidateAll();
}
}
}

View File

@@ -1,46 +0,0 @@
// Scintilla source code edit control
// CallTip.h - interface to the call tip control
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef CALLTIP_H
#define CALLTIP_H
const char callClassName[] = "CallTip";
class CallTip {
int startHighlight;
int endHighlight;
char *val;
Font font;
public:
Window wCallTip;
Window wDraw;
bool inCallTipMode;
int posStartCallTip;
ColourPair colourBG;
ColourPair colourUnSel;
ColourPair colourSel;
ColourPair colourShade;
ColourPair colourLight;
CallTip();
~CallTip();
// Claim or accept palette entries for the colours required to paint a calltip
void RefreshColourPalette(Palette &pal, bool want);
void PaintCT(Surface *surfaceWindow);
// Setup the calltip and return a rectangle of the area required
PRectangle CallTipStart(int pos, Point pt, const char *defn,
const char *faceName, int size);
void CallTipCancel();
// Set a range of characters to be displayed in a highlight style.
// Commonly used to highlight the current parameter.
void SetHighlight(int start, int end);
};
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,224 +0,0 @@
// Scintilla source code edit control
// CellBuffer.h - manages the text of the document
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef CELLBUFFER_H
#define CELLBUFFER_H
// This holds the marker identifier and the marker type to display.
// MarkerHandleNumbers are members of lists.
struct MarkerHandleNumber {
int handle;
int number;
MarkerHandleNumber *next;
};
// A marker handle set contains any number of MarkerHandleNumbers
class MarkerHandleSet {
MarkerHandleNumber *root;
public:
MarkerHandleSet();
~MarkerHandleSet();
int Length();
int NumberFromHandle(int handle);
int MarkValue(); // Bit set of marker numbers
bool Contains(int handle);
bool InsertHandle(int handle, int markerNum);
void RemoveHandle(int handle);
void RemoveNumber(int markerNum);
void CombineWith(MarkerHandleSet *other);
};
// Each line stores the starting position of the first character of the line in the cell buffer
// and potentially a marker handle set. Often a line will not have any attached markers.
struct LineData {
int startPosition;
MarkerHandleSet *handleSet;
LineData() : startPosition(0), handleSet(0) {
}
};
// The line vector contains information about each of the lines in a cell buffer.
class LineVector {
public:
enum { growSize = 4000 };
int lines;
LineData *linesData;
int size;
int *levels;
int sizeLevels;
// Handles are allocated sequentially and should never have to be reused as 32 bit ints are very big.
int handleCurrent;
LineVector();
~LineVector();
void Init();
void Expand(int sizeNew);
void ExpandLevels(int sizeNew=-1);
void InsertValue(int pos, int value);
void SetValue(int pos, int value);
void Remove(int pos);
int LineFromPosition(int pos);
int AddMark(int line, int marker);
void MergeMarkers(int pos);
void DeleteMark(int line, int markerNum);
void DeleteMarkFromHandle(int markerHandle);
int LineFromHandle(int markerHandle);
};
// Actions are used to store all the information required to perform one undo/redo step.
enum actionType { insertAction, removeAction, startAction };
class Action {
public:
actionType at;
int position;
char *data;
int lenData;
Action();
~Action();
void Create(actionType at_, int position_=0, char *data_=0, int lenData_=0);
void Destroy();
void Grab(Action *source);
};
enum undoCollectionType { undoCollectNone, undoCollectAutoStart, undoCollectManualStart };
class UndoHistory {
Action *actions;
int lenActions;
int maxAction;
int currentAction;
int undoSequenceDepth;
int savePoint;
void EnsureUndoRoom();
public:
UndoHistory();
~UndoHistory();
void AppendAction(actionType at, int position, char *data, int length);
void BeginUndoAction();
void EndUndoAction();
void DropUndoSequence();
void DeleteUndoHistory();
// The save point is a marker in the undo stack where the container has stated that
// the buffer was saved. Undo and redo can move over the save point.
void SetSavePoint();
bool IsSavePoint() const;
// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is
// called that many times. Similarly for redo.
bool CanUndo() const;
int StartUndo();
const Action &UndoStep();
bool CanRedo() const;
int StartRedo();
const Action &RedoStep();
};
// Holder for an expandable array of characters that supports undo and line markers
// Based on article "Data Structures in a Bit-Mapped Text Editor"
// by Wilfred J. Hansen, Byte January 1987, page 183
class CellBuffer {
private:
char *body;
int size;
int length;
int part1len;
int gaplen;
char *part2body;
bool readOnly;
undoCollectionType collectingUndo;
UndoHistory uh;
LineVector lv;
SVector<int, 4000> lineStates;
void GapTo(int position);
void RoomFor(int insertionLength);
inline char ByteAt(int position);
void SetByteAt(int position, char ch);
public:
CellBuffer(int initialLength = 4000);
~CellBuffer();
// Retrieving positions outside the range of the buffer works and returns 0
char CharAt(int position);
void GetCharRange(char *buffer, int position, int lengthRetrieve);
char StyleAt(int position);
int ByteLength();
int Length();
int Lines();
int LineStart(int line);
int LineFromPosition(int pos) { return lv.LineFromPosition(pos); }
const char *InsertString(int position, char *s, int insertLength);
void InsertCharStyle(int position, char ch, char style);
// Setting styles for positions outside the range of the buffer is safe and has no effect.
// True is returned if the style of a character changed.
bool SetStyleAt(int position, char style, char mask=(char)0xff);
bool SetStyleFor(int position, int length, char style, char mask);
const char *DeleteChars(int position, int deleteLength);
bool IsReadOnly();
void SetReadOnly(bool set);
// The save point is a marker in the undo stack where the container has stated that
// the buffer was saved. Undo and redo can move over the save point.
void SetSavePoint();
bool IsSavePoint();
// Line marker functions
int AddMark(int line, int markerNum);
void DeleteMark(int line, int markerNum);
void DeleteMarkFromHandle(int markerHandle);
int GetMark(int line);
void DeleteAllMarks(int markerNum);
int LineFromHandle(int markerHandle);
// Without undo
void BasicInsertString(int position, char *s, int insertLength);
void BasicDeleteChars(int position, int deleteLength);
undoCollectionType SetUndoCollection(undoCollectionType collectUndo);
bool IsCollectingUndo();
void BeginUndoAction();
void EndUndoAction();
void DeleteUndoHistory();
// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is
// called that many times. Similarly for redo.
bool CanUndo();
int StartUndo();
const Action &UndoStep();
bool CanRedo();
int StartRedo();
const Action &RedoStep();
int SetLineState(int line, int state);
int GetLineState(int line);
int GetMaxLineState();
int SetLevel(int line, int level);
int GetLevel(int line);
};
#define CELL_SIZE 2
#endif

View File

@@ -1,203 +0,0 @@
// Scintilla source code edit control
// ContractionState.cxx - manages visibility of lines for folding
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include "Platform.h"
#include "ContractionState.h"
OneLine::OneLine() {
displayLine = 0;
docLine = 0;
visible = true;
expanded = true;
}
ContractionState::ContractionState() {
lines = 0;
size = 0;
linesInDoc = 1;
linesInDisplay = 1;
valid = false;
}
ContractionState::~ContractionState() {
Clear();
}
void ContractionState::MakeValid() const {
if (!valid) {
// Could be cleverer by keeping the index of the last still valid entry
// rather than invalidating all.
int linePrev = -1;
int lineDisplay = 0;
for (int line=0; line<linesInDoc; line++) {
lines[line].displayLine = lineDisplay;
if (lines[line].visible) {
lines[lineDisplay].docLine = line;
lineDisplay++;
}
}
valid = true;
}
}
void ContractionState::Clear() {
delete []lines;
lines = 0;
size = 0;
linesInDoc = 1;
linesInDisplay = 1;
}
int ContractionState::LinesInDoc() const {
return linesInDoc;
}
int ContractionState::LinesDisplayed() const {
return linesInDisplay;
}
int ContractionState::DisplayFromDoc(int lineDoc) const {
if (size == 0) {
return lineDoc;
}
MakeValid();
if ((lineDoc >= 0) && (lineDoc < linesInDoc)) {
return lines[lineDoc].displayLine;
}
return -1;
}
int ContractionState::DocFromDisplay(int lineDisplay) const {
if (lineDisplay <= 0)
return 0;
if (lineDisplay >= linesInDisplay)
return linesInDoc-1;
if (size == 0)
return lineDisplay;
MakeValid();
return lines[lineDisplay].docLine;
}
void ContractionState::Grow(int sizeNew) {
OneLine *linesNew = new OneLine[sizeNew];
if (linesNew) {
int i = 0;
for (; i < size; i++) {
linesNew[i] = lines[i];
}
for (; i < sizeNew; i++) {
linesNew[i].displayLine = i;
}
delete []lines;
lines = linesNew;
size = sizeNew;
valid = false;
} else {
Platform::DebugPrintf("No memory available\n");
// TODO: Blow up
}
}
void ContractionState::InsertLines(int lineDoc, int lineCount) {
if (size == 0) {
linesInDoc += lineCount;
linesInDisplay += lineCount;
return;
}
//Platform::DebugPrintf("InsertLine[%d] = %d\n", lineDoc);
if ((linesInDoc + lineCount + 2) >= size) {
Grow(linesInDoc + lineCount + growSize);
}
linesInDoc += lineCount;
linesInDisplay += lineCount;
for (int i = linesInDoc + 1; i >= lineDoc + lineCount; i--) {
lines[i].visible = lines[i - lineCount].visible;
lines[i].expanded = lines[i - lineCount].expanded;
}
for (int d=0;d<lineCount;d++) {
lines[lineDoc+d].visible = true; // Should inherit visibility from context ?
lines[lineDoc+d].expanded = true;
}
valid = false;
}
void ContractionState::DeleteLines(int lineDoc, int lineCount) {
if (size == 0) {
linesInDoc -= lineCount;
linesInDisplay -= lineCount;
return;
}
int delta = 0;
for (int d=0;d<lineCount;d++)
if (lines[lineDoc+d].visible)
delta--;
for (int i = lineDoc; i < linesInDoc-lineCount; i++) {
lines[i].visible = lines[i + lineCount].visible;
lines[i].expanded = lines[i + lineCount].expanded;
}
linesInDoc -= lineCount;
linesInDisplay += delta;
valid = false;
}
bool ContractionState::GetVisible(int lineDoc) const {
if (size == 0)
return true;
if ((lineDoc >= 0) && (lineDoc < linesInDoc)) {
return lines[lineDoc].visible;
} else {
return false;
}
}
bool ContractionState::SetVisible(int lineDocStart, int lineDocEnd, bool visible) {
if (size == 0) {
Grow(linesInDoc + growSize);
}
// TODO: modify docLine members to mirror displayLine
int delta = 0;
// Change lineDocs
if ((lineDocStart <= lineDocEnd) && (lineDocStart >= 0) && (lineDocEnd < linesInDoc)) {
for (int line=lineDocStart; line <= lineDocEnd; line++) {
if (lines[line].visible != visible) {
delta += visible ? 1 : -1;
lines[line].visible = visible;
}
lines[line].displayLine += delta;
}
if (delta != 0) {
for (int line=lineDocEnd+1; line <= linesInDoc; line++) {
lines[line].displayLine += delta;
}
}
}
linesInDisplay += delta;
valid = false;
return delta != 0;
}
bool ContractionState::GetExpanded(int lineDoc) const {
if (size == 0)
return true;
if ((lineDoc >= 0) && (lineDoc < linesInDoc)) {
return lines[lineDoc].expanded;
} else {
return false;
}
}
bool ContractionState::SetExpanded(int lineDoc, bool expanded) {
if (size == 0) {
Grow(linesInDoc + growSize);
}
if ((lineDoc >= 0) && (lineDoc < linesInDoc)) {
if (lines[lineDoc].expanded != expanded) {
lines[lineDoc].expanded = expanded;
return true;
}
}
return false;
}

View File

@@ -1,50 +0,0 @@
// Scintilla source code edit control
// ContractionState.h - manages visibility of lines for folding
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef CONTRACTIONSTATE_H
#define CONTRACTIONSTATE_H
class OneLine {
public:
int displayLine; // position within set of visible lines
int docLine; // inverse of displayLine
bool visible;
bool expanded;
OneLine();
virtual ~OneLine() {}
};
class ContractionState {
void Grow(int sizeNew);
enum { growSize = 4000 };
int linesInDoc;
int linesInDisplay;
mutable OneLine *lines;
int size;
mutable bool valid;
void MakeValid() const;
public:
ContractionState();
virtual ~ContractionState();
void Clear();
int LinesInDoc() const;
int LinesDisplayed() const;
int DisplayFromDoc(int lineDoc) const;
int DocFromDisplay(int lineDisplay) const;
void InsertLines(int lineDoc, int lineCount);
void DeleteLines(int lineDoc, int lineCount);
bool GetVisible(int lineDoc) const;
bool SetVisible(int lineDocStart, int lineDocEnd, bool visible);
bool GetExpanded(int lineDoc) const;
bool SetExpanded(int lineDoc, bool expanded);
};
#endif

View File

@@ -1,797 +0,0 @@
// Scintilla source code edit control
// Document.cxx - text document that handles notifications, DBCS, styling, words and end of line
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include "Platform.h"
#include "Scintilla.h"
#include "SVector.h"
#include "CellBuffer.h"
#include "Document.h"
Document::Document() {
refCount = 0;
#ifdef unix
eolMode = SC_EOL_LF;
#else
eolMode = SC_EOL_CRLF;
#endif
dbcsCodePage = 0;
stylingBits = 5;
stylingBitsMask = 0x1F;
stylingPos = 0;
stylingMask = 0;
for (int ch = 0; ch < 256; ch++) {
wordchars[ch] = isalnum(ch) || ch == '_';
}
endStyled = 0;
enteredCount = 0;
tabInChars = 8;
watchers = 0;
lenWatchers = 0;
}
Document::~Document() {
for (int i = 0; i < lenWatchers; i++) {
watchers[i].watcher->NotifyDeleted(this, watchers[i].userData);
}
delete []watchers;
watchers = 0;
lenWatchers = 0;
}
// Increase reference count and return its previous value.
int Document::AddRef() {
return refCount++;
}
// Decrease reference count and return its provius value.
// Delete the document if reference count reaches zero.
int Document::Release() {
int curRefCount = --refCount;
if (curRefCount == 0)
delete this;
return curRefCount;
}
void Document::SetSavePoint() {
cb.SetSavePoint();
NotifySavePoint(true);
}
int Document::AddMark(int line, int markerNum) {
int prev = cb.AddMark(line, markerNum);
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0);
NotifyModified(mh);
return prev;
}
void Document::DeleteMark(int line, int markerNum) {
cb.DeleteMark(line, markerNum);
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0);
NotifyModified(mh);
}
void Document::DeleteMarkFromHandle(int markerHandle) {
cb.DeleteMarkFromHandle(markerHandle);
DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
NotifyModified(mh);
}
void Document::DeleteAllMarks(int markerNum) {
cb.DeleteAllMarks(markerNum);
DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
NotifyModified(mh);
}
int Document::LineStart(int line) {
return cb.LineStart(line);
}
int Document::LineEnd(int line) {
if (line == LinesTotal() - 1) {
return LineStart(line + 1);
} else {
int position = LineStart(line + 1) - 1;
// When line terminator is CR+LF, may need to go back one more
if ((position > LineStart(line)) && (cb.CharAt(position - 1) == '\r')) {
position--;
}
return position;
}
}
int Document::LineFromPosition(int pos) {
return cb.LineFromPosition(pos);
}
int Document::LineEndPosition(int position) {
return LineEnd(LineFromPosition(position));
}
int Document::VCHomePosition(int position) {
int line = LineFromPosition(position);
int startPosition = LineStart(line);
int endLine = LineStart(line + 1) - 1;
int startText = startPosition;
while (startText < endLine && (cb.CharAt(startText) == ' ' || cb.CharAt(startText) == '\t' ) )
startText++;
if (position == startText)
return startPosition;
else
return startText;
}
int Document::SetLevel(int line, int level) {
int prev = cb.SetLevel(line, level);
if (prev != level) {
DocModification mh(SC_MOD_CHANGEFOLD, LineStart(line), 0, 0, 0);
mh.line = line;
mh.foldLevelNow = level;
mh.foldLevelPrev = prev;
NotifyModified(mh);
}
return prev;
}
static bool IsSubordinate(int levelStart, int levelTry) {
if (levelTry & SC_FOLDLEVELWHITEFLAG)
return true;
else
return (levelStart & SC_FOLDLEVELNUMBERMASK) < (levelTry & SC_FOLDLEVELNUMBERMASK);
}
int Document::GetLastChild(int lineParent, int level) {
if (level == -1)
level = GetLevel(lineParent) & SC_FOLDLEVELNUMBERMASK;
int maxLine = LinesTotal();
int lineMaxSubord = lineParent;
while (lineMaxSubord < maxLine-1) {
EnsureStyledTo(LineStart(lineMaxSubord+2));
if (!IsSubordinate(level, GetLevel(lineMaxSubord+1)))
break;
lineMaxSubord++;
}
if (lineMaxSubord > lineParent) {
if (level > (GetLevel(lineMaxSubord+1) & SC_FOLDLEVELNUMBERMASK)) {
// Have chewed up some whitespace that belongs to a parent so seek back
if ((lineMaxSubord > lineParent) && (GetLevel(lineMaxSubord) & SC_FOLDLEVELWHITEFLAG)) {
lineMaxSubord--;
}
}
}
return lineMaxSubord;
}
int Document::GetFoldParent(int line) {
int level = GetLevel(line);
int lineLook = line-1;
while ((lineLook > 0) && (
(!(GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG)) ||
((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) >= level))
) {
lineLook--;
}
if ((GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG) &&
((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) < level)) {
return lineLook;
} else {
return -1;
}
}
int Document::ClampPositionIntoDocument(int pos) {
return Platform::Clamp(pos, 0, Length());
}
bool Document::IsCrLf(int pos) {
if (pos < 0)
return false;
if (pos >= (Length() - 1))
return false;
return (cb.CharAt(pos) == '\r') && (cb.CharAt(pos + 1) == '\n');
}
bool Document::IsDBCS(int pos) {
#if PLAT_WIN
if (dbcsCodePage) {
// Anchor DBCS calculations at start of line because start of line can
// not be a DBCS trail byte.
int startLine = pos;
while (startLine > 0 && cb.CharAt(startLine) != '\r' && cb.CharAt(startLine) != '\n')
startLine--;
while (startLine <= pos) {
if (IsDBCSLeadByteEx(dbcsCodePage, cb.CharAt(startLine))) {
startLine++;
if (startLine >= pos)
return true;
}
startLine++;
}
}
return false;
#else
return false;
#endif
}
// Normalise a position so that it is not halfway through a two byte character.
// This can occur in two situations -
// When lines are terminated with \r\n pairs which should be treated as one character.
// When displaying DBCS text such as Japanese.
// If moving, move the position in the indicated direction.
int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) {
//Platform::DebugPrintf("NoCRLF %d %d\n", pos, moveDir);
// If out of range, just return value - should be fixed up after
if (pos < 0)
return pos;
if (pos > Length())
return pos;
// Position 0 and Length() can not be between any two characters
if (pos == 0)
return pos;
if (pos == Length())
return pos;
// assert pos > 0 && pos < Length()
if (checkLineEnd && IsCrLf(pos - 1)) {
if (moveDir > 0)
return pos + 1;
else
return pos - 1;
}
// Not between CR and LF
#if PLAT_WIN
if (dbcsCodePage) {
// Anchor DBCS calculations at start of line because start of line can
// not be a DBCS trail byte.
int startLine = pos;
while (startLine > 0 && cb.CharAt(startLine) != '\r' && cb.CharAt(startLine) != '\n')
startLine--;
bool atLeadByte = false;
while (startLine < pos) {
if (atLeadByte)
atLeadByte = false;
else if (IsDBCSLeadByteEx(dbcsCodePage, cb.CharAt(startLine)))
atLeadByte = true;
else
atLeadByte = false;
startLine++;
//Platform::DebugPrintf("DBCS %s\n", atlead ? "D" : "-");
}
if (atLeadByte) {
// Position is between a lead byte and a trail byte
if (moveDir > 0)
return pos + 1;
else
return pos - 1;
}
}
#endif
return pos;
}
void Document::ModifiedAt(int pos) {
if (endStyled > pos)
endStyled = pos;
}
// Document only modified by gateways DeleteChars, InsertStyledString, Undo, Redo, and SetStyleAt.
// SetStyleAt does not change the persistent state of a document
// Unlike Undo, Redo, and InsertStyledString, the pos argument is a cell number not a char number
void Document::DeleteChars(int pos, int len) {
if (enteredCount == 0) {
enteredCount++;
if (cb.IsReadOnly())
NotifyModifyAttempt();
if (!cb.IsReadOnly()) {
int prevLinesTotal = LinesTotal();
bool startSavePoint = cb.IsSavePoint();
const char *text = cb.DeleteChars(pos*2, len * 2);
if (startSavePoint && cb.IsCollectingUndo())
NotifySavePoint(!startSavePoint);
ModifiedAt(pos);
int modFlags = SC_MOD_DELETETEXT | SC_PERFORMED_USER;
DocModification mh(modFlags, pos, len, LinesTotal() - prevLinesTotal, text);
NotifyModified(mh);
}
enteredCount--;
}
}
void Document::InsertStyledString(int position, char *s, int insertLength) {
if (enteredCount == 0) {
enteredCount++;
if (cb.IsReadOnly())
NotifyModifyAttempt();
if (!cb.IsReadOnly()) {
int prevLinesTotal = LinesTotal();
bool startSavePoint = cb.IsSavePoint();
const char *text = cb.InsertString(position, s, insertLength);
if (startSavePoint && cb.IsCollectingUndo())
NotifySavePoint(!startSavePoint);
ModifiedAt(position / 2);
int modFlags = SC_MOD_INSERTTEXT | SC_PERFORMED_USER;
DocModification mh(modFlags, position / 2, insertLength / 2, LinesTotal() - prevLinesTotal, text);
NotifyModified(mh);
}
enteredCount--;
}
}
int Document::Undo() {
int newPos = 0;
if (enteredCount == 0) {
enteredCount++;
bool startSavePoint = cb.IsSavePoint();
int steps = cb.StartUndo();
//Platform::DebugPrintf("Steps=%d\n", steps);
for (int step=0; step<steps; step++) {
int prevLinesTotal = LinesTotal();
const Action &action = cb.UndoStep();
int cellPosition = action.position / 2;
ModifiedAt(cellPosition);
newPos = cellPosition;
int modFlags = SC_PERFORMED_UNDO;
// With undo, an insertion action becomes a deletion notification
if (action.at == removeAction) {
newPos += action.lenData;
modFlags |= SC_MOD_INSERTTEXT;
} else {
modFlags |= SC_MOD_DELETETEXT;
}
if (step == steps-1)
modFlags |= SC_LASTSTEPINUNDOREDO;
NotifyModified(DocModification(modFlags, cellPosition, action.lenData,
LinesTotal() - prevLinesTotal, action.data));
}
bool endSavePoint = cb.IsSavePoint();
if (startSavePoint != endSavePoint)
NotifySavePoint(endSavePoint);
enteredCount--;
}
return newPos;
}
int Document::Redo() {
int newPos = 0;
if (enteredCount == 0) {
enteredCount++;
bool startSavePoint = cb.IsSavePoint();
int steps = cb.StartRedo();
for (int step=0; step<steps; step++) {
int prevLinesTotal = LinesTotal();
const Action &action = cb.RedoStep();
int cellPosition = action.position / 2;
ModifiedAt(cellPosition);
newPos = cellPosition;
int modFlags = SC_PERFORMED_REDO;
if (action.at == insertAction) {
newPos += action.lenData;
modFlags |= SC_MOD_INSERTTEXT;
} else {
modFlags |= SC_MOD_DELETETEXT;
}
if (step == steps-1)
modFlags |= SC_LASTSTEPINUNDOREDO;
NotifyModified(DocModification(modFlags, cellPosition, action.lenData,
LinesTotal() - prevLinesTotal, action.data));
}
bool endSavePoint = cb.IsSavePoint();
if (startSavePoint != endSavePoint)
NotifySavePoint(endSavePoint);
enteredCount--;
}
return newPos;
}
void Document::InsertChar(int pos, char ch) {
char chs[2];
chs[0] = ch;
chs[1] = 0;
InsertStyledString(pos*2, chs, 2);
}
// Insert a null terminated string
void Document::InsertString(int position, const char *s) {
InsertString(position, s, strlen(s));
}
// Insert a string with a length
void Document::InsertString(int position, const char *s, int insertLength) {
char *sWithStyle = new char[insertLength * 2];
if (sWithStyle) {
for (int i = 0; i < insertLength; i++) {
sWithStyle[i*2] = s[i];
sWithStyle[i*2 + 1] = 0;
}
InsertStyledString(position*2, sWithStyle, insertLength*2);
delete []sWithStyle;
}
}
void Document::ChangeChar(int pos, char ch) {
DeleteChars(pos, 1);
InsertChar(pos, ch);
}
void Document::DelChar(int pos) {
if (IsCrLf(pos)) {
DeleteChars(pos, 2);
} else if (IsDBCS(pos)) {
DeleteChars(pos, 2);
} else if (pos < Length()) {
DeleteChars(pos, 1);
}
}
int Document::DelCharBack(int pos) {
if (pos <= 0) {
return pos;
} else if (IsCrLf(pos - 2)) {
DeleteChars(pos - 2, 2);
return pos - 2;
} else if (IsDBCS(pos - 1)) {
DeleteChars(pos - 2, 2);
return pos - 2;
} else {
DeleteChars(pos - 1, 1);
return pos - 1;
}
}
void Document::Indent(bool forwards, int lineBottom, int lineTop) {
if (forwards) {
// Indent by a tab
for (int line = lineBottom; line >= lineTop; line--) {
InsertChar(LineStart(line), '\t');
}
} else {
// Dedent - suck white space off the front of the line to dedent by equivalent of a tab
for (int line = lineBottom; line >= lineTop; line--) {
int ispc = 0;
while (ispc < tabInChars && cb.CharAt(LineStart(line) + ispc) == ' ')
ispc++;
int posStartLine = LineStart(line);
if (ispc == tabInChars) {
DeleteChars(posStartLine, ispc);
} else if (cb.CharAt(posStartLine + ispc) == '\t') {
DeleteChars(posStartLine, ispc + 1);
} else { // Hit a non-white
DeleteChars(posStartLine, ispc);
}
}
}
}
void Document::ConvertLineEnds(int eolModeSet) {
BeginUndoAction();
for (int pos = 0; pos < Length(); pos++) {
if (cb.CharAt(pos) == '\r') {
if (cb.CharAt(pos+1) == '\n') {
if (eolModeSet != SC_EOL_CRLF) {
DeleteChars(pos, 2);
if (eolModeSet == SC_EOL_CR)
InsertString(pos, "\r", 1);
else
InsertString(pos, "\n", 1);
} else {
pos++;
}
} else {
if (eolModeSet != SC_EOL_CR) {
DeleteChars(pos, 1);
if (eolModeSet == SC_EOL_CRLF) {
InsertString(pos, "\r\n", 2);
pos++;
} else {
InsertString(pos, "\n", 1);
}
}
}
} else if (cb.CharAt(pos) == '\n') {
if (eolModeSet != SC_EOL_LF) {
DeleteChars(pos, 1);
if (eolModeSet == SC_EOL_CRLF) {
InsertString(pos, "\r\n", 2);
pos++;
} else {
InsertString(pos, "\r", 1);
}
}
}
}
EndUndoAction();
}
bool Document::IsWordChar(unsigned char ch) {
return wordchars[ch];
}
int Document::ExtendWordSelect(int pos, int delta) {
if (delta < 0) {
while (pos > 0 && IsWordChar(cb.CharAt(pos - 1)))
pos--;
} else {
while (pos < (Length()) && IsWordChar(cb.CharAt(pos)))
pos++;
}
return pos;
}
int Document::NextWordStart(int pos, int delta) {
if (delta < 0) {
while (pos > 0 && (cb.CharAt(pos - 1) == ' ' || cb.CharAt(pos - 1) == '\t'))
pos--;
if (isspace(cb.CharAt(pos - 1))) { // Back up to previous line
while (pos > 0 && isspace(cb.CharAt(pos - 1)))
pos--;
} else {
bool startAtWordChar = IsWordChar(cb.CharAt(pos - 1));
while (pos > 0 && !isspace(cb.CharAt(pos - 1)) && (startAtWordChar == IsWordChar(cb.CharAt(pos - 1))))
pos--;
}
} else {
bool startAtWordChar = IsWordChar(cb.CharAt(pos));
while (pos < (Length()) && isspace(cb.CharAt(pos)))
pos++;
while (pos < (Length()) && !isspace(cb.CharAt(pos)) && (startAtWordChar == IsWordChar(cb.CharAt(pos))))
pos++;
while (pos < (Length()) && (cb.CharAt(pos) == ' ' || cb.CharAt(pos) == '\t'))
pos++;
}
return pos;
}
bool Document::IsWordAt(int start, int end) {
int lengthDoc = Length();
if (start > 0) {
char ch = CharAt(start - 1);
if (IsWordChar(ch))
return false;
}
if (end < lengthDoc - 1) {
char ch = CharAt(end);
if (IsWordChar(ch))
return false;
}
return true;
}
// Find text in document, supporting both forward and backward
// searches (just pass minPos > maxPos to do a backward search)
// Has not been tested with backwards DBCS searches yet.
long Document::FindText(int minPos, int maxPos, const char *s, bool caseSensitive, bool word) {
bool forward = minPos <= maxPos;
int increment = forward ? 1 : -1;
// Range endpoints should not be inside DBCS characters, but just in case, move them.
int startPos = MovePositionOutsideChar(minPos, increment, false);
int endPos = MovePositionOutsideChar(maxPos, increment, false);
// Compute actual search ranges needed
int lengthFind = strlen(s);
int endSearch = 0;
if (startPos <= endPos) {
endSearch = endPos - lengthFind + 1;
} else {
endSearch = endPos;
}
//Platform::DebugPrintf("Find %d %d %s %d\n", startPos, endPos, ft->lpstrText, lengthFind);
char firstChar = s[0];
if (!caseSensitive)
firstChar = toupper(firstChar);
int pos = startPos;
while (forward ? (pos < endSearch) : (pos >= endSearch)) {
char ch = CharAt(pos);
if (caseSensitive) {
if (ch == firstChar) {
bool found = true;
for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) {
ch = CharAt(pos + posMatch);
if (ch != s[posMatch])
found = false;
}
if (found) {
if ((!word) || IsWordAt(pos, pos + lengthFind))
return pos;
}
}
} else {
if (toupper(ch) == firstChar) {
bool found = true;
for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) {
ch = CharAt(pos + posMatch);
if (toupper(ch) != toupper(s[posMatch]))
found = false;
}
if (found) {
if ((!word) || IsWordAt(pos, pos + lengthFind))
return pos;
}
}
}
pos += increment;
if (dbcsCodePage) {
// Ensure trying to match from start of character
pos = MovePositionOutsideChar(pos, increment, false);
}
}
//Platform::DebugPrintf("Not found\n");
return - 1;
}
int Document::LinesTotal() {
return cb.Lines();
}
void Document::ChangeCase(Range r, bool makeUpperCase) {
for (int pos=r.start; pos<r.end; pos++) {
char ch = CharAt(pos);
if (dbcsCodePage && IsDBCS(pos)) {
pos++;
} else {
if (makeUpperCase) {
if (islower(ch)) {
ChangeChar(pos, toupper(ch));
}
} else {
if (isupper(ch)) {
ChangeChar(pos, tolower(ch));
}
}
}
}
}
void Document::SetWordChars(unsigned char *chars) {
int ch;
for (ch = 0; ch < 256; ch++) {
wordchars[ch] = false;
}
if (chars) {
while (*chars) {
wordchars[*chars] = true;
chars++;
}
} else {
for (ch = 0; ch < 256; ch++) {
wordchars[ch] = isalnum(ch) || ch == '_';
}
}
}
void Document::SetStylingBits(int bits) {
stylingBits = bits;
stylingBitsMask = 0;
for (int bit=0; bit<stylingBits; bit++) {
stylingBitsMask <<= 1;
stylingBitsMask |= 1;
}
}
void Document::StartStyling(int position, char mask) {
stylingPos = position;
stylingMask = mask;
}
void Document::SetStyleFor(int length, char style) {
if (enteredCount == 0) {
enteredCount++;
int prevEndStyled = endStyled;
if (cb.SetStyleFor(stylingPos, length, style, stylingMask)) {
DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
prevEndStyled, length);
NotifyModified(mh);
}
stylingPos += length;
endStyled = stylingPos;
enteredCount--;
}
}
void Document::SetStyles(int length, char *styles) {
if (enteredCount == 0) {
enteredCount++;
int prevEndStyled = endStyled;
bool didChange = false;
for (int iPos = 0; iPos < length; iPos++, stylingPos++) {
if (cb.SetStyleAt(stylingPos, styles[iPos], stylingMask)) {
didChange = true;
}
}
endStyled = stylingPos;
if (didChange) {
DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
prevEndStyled, endStyled - prevEndStyled);
NotifyModified(mh);
}
enteredCount--;
}
}
bool Document::EnsureStyledTo(int pos) {
// Ask the watchers to style, and stop as soon as one responds.
for (int i = 0; pos > GetEndStyled() && i < lenWatchers; i++)
watchers[i].watcher->NotifyStyleNeeded(this, watchers[i].userData, pos);
return pos <= GetEndStyled();
}
bool Document::AddWatcher(DocWatcher *watcher, void *userData) {
for (int i = 0; i < lenWatchers; i++) {
if ((watchers[i].watcher == watcher) &&
(watchers[i].userData == userData))
return false;
}
WatcherWithUserData *pwNew = new WatcherWithUserData[lenWatchers + 1];
if (!pwNew)
return false;
for (int j = 0; j < lenWatchers; j++)
pwNew[j] = watchers[j];
pwNew[lenWatchers].watcher = watcher;
pwNew[lenWatchers].userData = userData;
delete []watchers;
watchers = pwNew;
lenWatchers++;
return true;
}
bool Document::RemoveWatcher(DocWatcher *watcher, void *userData) {
for (int i = 0; i < lenWatchers; i++) {
if ((watchers[i].watcher == watcher) &&
(watchers[i].userData == userData)) {
if (lenWatchers == 1) {
delete []watchers;
watchers = 0;
lenWatchers = 0;
} else {
WatcherWithUserData *pwNew = new WatcherWithUserData[lenWatchers];
if (!pwNew)
return false;
for (int j = 0; j < lenWatchers - 1; j++) {
pwNew[j] = (j < i) ? watchers[j] : watchers[j + 1];
}
delete []watchers;
watchers = pwNew;
lenWatchers--;
}
return true;
}
}
return false;
}
void Document::NotifyModifyAttempt() {
for (int i = 0; i < lenWatchers; i++) {
watchers[i].watcher->NotifyModifyAttempt(this, watchers[i].userData);
}
}
void Document::NotifySavePoint(bool atSavePoint) {
for (int i = 0; i < lenWatchers; i++) {
watchers[i].watcher->NotifySavePoint(this, watchers[i].userData, atSavePoint);
}
}
void Document::NotifyModified(DocModification mh) {
for (int i = 0; i < lenWatchers; i++) {
watchers[i].watcher->NotifyModified(this, mh, watchers[i].userData);
}
}

View File

@@ -1,227 +0,0 @@
// Scintilla source code edit control
// Document.h - text document that handles notifications, DBCS, styling, words and end of line
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef DOCUMENT_H
#define DOCUMENT_H
// A Position is a position within a document between two characters or at the beginning or end.
// Sometimes used as a character index where it identifies the character after the position.
typedef int Position;
const Position invalidPosition = -1;
// The range class represents a range of text in a document.
// The two values are not sorted as one end may be more significant than the other
// as is the case for the selection where the end position is the position of the caret.
// If either position is invalidPosition then the range is invalid and most operations will fail.
class Range {
public:
Position start;
Position end;
Range(Position pos=0) :
start(pos), end(pos) {
};
Range(Position start_, Position end_) :
start(start_), end(end_) {
};
bool Valid() const {
return (start != invalidPosition) && (end != invalidPosition);
}
bool Contains(Position pos) const {
if (start < end) {
return (pos >= start && pos <= end);
} else {
return (pos <= start && pos >= end);
}
}
bool Contains(Range other) const {
return Contains(other.start) && Contains(other.end);
}
bool Overlaps(Range other) const {
return
Contains(other.start) ||
Contains(other.end) ||
other.Contains(start) ||
other.Contains(end);
}
};
class DocWatcher;
class DocModification;
class Document {
public:
// Used to pair watcher pointer with user data
class WatcherWithUserData {
public:
DocWatcher *watcher;
void *userData;
WatcherWithUserData() {
watcher = 0;
userData = 0;
}
};
private:
int refCount;
CellBuffer cb;
bool wordchars[256];
int stylingPos;
int stylingMask;
int endStyled;
int enteredCount;
WatcherWithUserData *watchers;
int lenWatchers;
public:
int stylingBits;
int stylingBitsMask;
int eolMode;
int dbcsCodePage;
int tabInChars;
Document();
virtual ~Document();
int AddRef();
int Release();
int LineFromPosition(int pos);
int ClampPositionIntoDocument(int pos);
bool IsCrLf(int pos);
int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true);
// Gateways to modifying document
void DeleteChars(int pos, int len);
void InsertStyledString(int position, char *s, int insertLength);
int Undo();
int Redo();
bool CanUndo() { return cb.CanUndo(); }
bool CanRedo() { return cb.CanRedo(); }
void DeleteUndoHistory() { cb.DeleteUndoHistory(); }
undoCollectionType SetUndoCollection(undoCollectionType collectUndo) {
return cb.SetUndoCollection(collectUndo);
}
void BeginUndoAction() { cb.BeginUndoAction(); }
void EndUndoAction() { cb.EndUndoAction(); }
void SetSavePoint();
bool IsSavePoint() { return cb.IsSavePoint(); }
void Indent(bool forwards, int lineBottom, int lineTop);
void ConvertLineEnds(int eolModeSet);
void SetReadOnly(bool set) { cb.SetReadOnly(set); }
void InsertChar(int pos, char ch);
void InsertString(int position, const char *s);
void InsertString(int position, const char *s, int insertLength);
void ChangeChar(int pos, char ch);
void DelChar(int pos);
int DelCharBack(int pos);
char CharAt(int position) { return cb.CharAt(position); }
void GetCharRange(char *buffer, int position, int lengthRetrieve) {
cb.GetCharRange(buffer, position, lengthRetrieve);
}
char StyleAt(int position) { return cb.StyleAt(position); }
int GetMark(int line) { return cb.GetMark(line); }
int AddMark(int line, int markerNum);
void DeleteMark(int line, int markerNum);
void DeleteMarkFromHandle(int markerHandle);
void DeleteAllMarks(int markerNum);
int LineFromHandle(int markerHandle) { return cb.LineFromHandle(markerHandle); }
int LineStart(int line);
int LineEnd(int line);
int LineEndPosition(int position);
int VCHomePosition(int position);
int SetLevel(int line, int level);
int GetLevel(int line) { return cb.GetLevel(line); }
int GetLastChild(int lineParent, int level=-1);
int GetFoldParent(int line);
void Indent(bool forwards);
int ExtendWordSelect(int pos, int delta);
int NextWordStart(int pos, int delta);
int Length() { return cb.Length(); }
long FindText(int minPos, int maxPos, const char *s, bool caseSensitive, bool word);
long FindText(WORD iMessage,WPARAM wParam,LPARAM lParam);
int LinesTotal();
void ChangeCase(Range r, bool makeUpperCase);
void SetWordChars(unsigned char *chars);
void SetStylingBits(int bits);
void StartStyling(int position, char mask);
void SetStyleFor(int length, char style);
void SetStyles(int length, char *styles);
int GetEndStyled() { return endStyled; }
bool EnsureStyledTo(int pos);
int SetLineState(int line, int state) { return cb.SetLineState(line, state); }
int GetLineState(int line) { return cb.GetLineState(line); }
int GetMaxLineState() { return cb.GetMaxLineState(); }
bool AddWatcher(DocWatcher *watcher, void *userData);
bool RemoveWatcher(DocWatcher *watcher, void *userData);
const WatcherWithUserData *GetWatchers() const { return watchers; }
int GetLenWatchers() const { return lenWatchers; }
private:
bool IsDBCS(int pos);
bool IsWordChar(unsigned char ch);
bool IsWordAt(int start, int end);
void ModifiedAt(int pos);
void NotifyModifyAttempt();
void NotifySavePoint(bool atSavePoint);
void NotifyModified(DocModification mh);
};
// To optimise processing of document modifications by DocWatchers, a hint is passed indicating the
// scope of the change.
// If the DocWatcher is a document view then this can be used to optimise screen updating.
class DocModification {
public:
int modificationType;
int position;
int length;
int linesAdded; // Negative if lines deleted
const char *text; // Only valid for changes to text, not for changes to style
int line;
int foldLevelNow;
int foldLevelPrev;
DocModification(int modificationType_, int position_=0, int length_=0,
int linesAdded_=0, const char *text_=0) :
modificationType(modificationType_),
position(position_),
length(length_),
linesAdded(linesAdded_),
text(text_),
line(0),
foldLevelNow(0),
foldLevelPrev(0) {}
};
// A class that wants to receive notifications from a Document must be derived from DocWatcher
// and implement the notification methods. It can then be added to the watcher list with AddWatcher.
class DocWatcher {
public:
virtual ~DocWatcher() {}
virtual void NotifyModifyAttempt(Document *doc, void *userData) = 0;
virtual void NotifySavePoint(Document *doc, void *userData, bool atSavePoint) = 0;
virtual void NotifyModified(Document *doc, DocModification mh, void *userData) = 0;
virtual void NotifyDeleted(Document *doc, void *userData) = 0;
virtual void NotifyStyleNeeded(Document *doc, void *userData, int endPos) = 0;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,287 +0,0 @@
// Scintilla source code edit control
// Editor.h - defines the main editor class
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef EDITOR_H
#define EDITOR_H
class Caret {
public:
bool active;
bool on;
int period;
Caret();
};
class Timer {
public:
bool ticking;
int ticksToWait;
enum {tickSize = 100};
int tickerID;
Timer();
};
class LineLayout {
public:
// Drawing is only performed for maxLineLength characters on each line.
enum {maxLineLength = 4000};
int numCharsInLine;
char chars[maxLineLength];
char styles[maxLineLength];
char indicators[maxLineLength];
int positions[maxLineLength];
};
class Editor : public DocWatcher {
protected: // ScintillaBase subclass needs access to much of Editor
// On GTK+, Scintilla is a container widget holding two scroll bars and a drawing area
// whereas on Windows there is just one window with both scroll bars turned on.
// Therefore, on GTK+ the following are separate windows but only one window on Windows.
Window wMain; // The Scintilla parent window
Window wDraw; // The text drawing area
// Style resources may be expensive to allocate so are cached between uses.
// When a style attribute is changed, this cache is flushed.
bool stylesValid;
ViewStyle vs;
Palette palette;
bool hideSelection;
bool inOverstrike;
// In bufferedDraw mode, graphics operations are drawn to a pixmap and then copied to
// the screen. This avoids flashing but is about 30% slower.
bool bufferedDraw;
int xOffset; // Horizontal scrolled amount in pixels
int xCaretMargin; // Ensure this many pixels visible on both sides of caret
Surface pixmapLine;
Surface pixmapSelMargin;
Surface pixmapSelPattern;
// Intellimouse support - currently only implemented for Windows
unsigned int ucWheelScrollLines;
short cWheelDelta; //wheel delta from roll
KeyMap kmap;
Caret caret;
Timer timer;
Point lastClick;
unsigned int lastClickTime;
enum { selChar, selWord, selLine } selectionType;
Point ptMouseLast;
bool firstExpose;
bool inDragDrop;
bool dropWentOutside;
int posDrag;
int posDrop;
int lastXChosen;
int lineAnchor;
int originalAnchorPos;
int currentPos;
int anchor;
int topLine;
int posTopLine;
bool needUpdateUI;
Position braces[2];
int bracesMatchStyle;
int edgeState;
int theEdge;
enum { notPainting, painting, paintAbandoned } paintState;
PRectangle rcPaint;
bool paintingAllText;
int modEventMask;
char *dragChars;
int lenDrag;
bool dragIsRectangle;
enum { selStream, selRectangle, selRectangleFixed } selType;
int xStartSelect;
int xEndSelect;
int caretPolicy;
int caretSlop;
int searchAnchor;
int displayPopupMenu;
#ifdef MACRO_SUPPORT
int recordingMacro;
#endif
int foldFlags;
ContractionState cs;
Document *pdoc;
Editor();
virtual ~Editor();
virtual void Initialise() = 0;
virtual void Finalise();
void InvalidateStyleData();
void InvalidateStyleRedraw();
virtual void RefreshColourPalette(Palette &pal, bool want);
void RefreshStyleData();
void DropGraphics();
PRectangle GetClientRectangle();
PRectangle GetTextRectangle();
int LinesOnScreen();
int LinesToScroll();
int MaxScrollPos();
Point LocationFromPosition(unsigned int pos);
int XFromPosition(unsigned int pos);
int PositionFromLocation(Point pt);
int PositionFromLineX(int line, int x);
int LineFromLocation(Point pt);
void SetTopLine(int topLineNew);
void RedrawRect(PRectangle rc);
void Redraw();
void RedrawSelMargin();
PRectangle RectangleFromRange(int start, int end);
void InvalidateRange(int start, int end);
int CurrentPosition();
bool SelectionEmpty();
int SelectionStart(int line=-1);
int SelectionEnd(int line=-1);
void SetSelection(int currentPos_, int anchor_);
void SetSelection(int currentPos_);
void SetEmptySelection(int currentPos_);
int MovePositionTo(int newPos, bool extend = false);
int MovePositionSoVisible(int pos, int moveDir);
void SetLastXChosen();
void ScrollTo(int line);
virtual void ScrollText(int linesToMove);
void HorizontalScrollTo(int xPos);
void EnsureCaretVisible(bool useMargin=true);
void ShowCaretAtCurrentPosition();
void DropCaret();
void InvalidateCaret();
void PaintSelMargin(Surface *surface, PRectangle &rc);
void LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout &ll);
void DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int xStart,
PRectangle rcLine, LineLayout &ll);
void Paint(Surface *surfaceWindow, PRectangle rcArea);
long FormatRange(bool draw, FORMATRANGE *pfr);
virtual void SetVerticalScrollPos() = 0;
virtual void SetHorizontalScrollPos() = 0;
virtual bool ModifyScrollBars(int nMax, int nPage) = 0;
void SetScrollBarsTo(PRectangle rsClient);
void SetScrollBars();
virtual void AddChar(char ch);
void ClearSelection();
void ClearAll();
void Cut();
void PasteRectangular(int pos, const char *ptr, int len);
virtual void Copy() = 0;
virtual void Paste() = 0;
void Clear();
void SelectAll();
void Undo();
void Redo();
void DelChar();
void DelCharBack();
virtual void ClaimSelection() = 0;
virtual void NotifyChange() = 0;
virtual void NotifyFocus(bool focus);
virtual void NotifyParent(SCNotification scn) = 0;
virtual void NotifyStyleNeeded(int endStyleNeeded);
void NotifyChar(char ch);
void NotifySavePoint(bool isSavePoint);
void NotifyModifyAttempt();
virtual void NotifyDoubleClick(Point pt, bool shift);
void NotifyUpdateUI();
bool NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt);
void NotifyNeedShown(int pos, int len);
void NotifyModifyAttempt(Document *document, void *userData);
void NotifySavePoint(Document *document, void *userData, bool atSavePoint);
void NotifyModified(Document *document, DocModification mh, void *userData);
void NotifyDeleted(Document *document, void *userData);
void NotifyStyleNeeded(Document *doc, void *userData, int endPos);
#ifdef MACRO_SUPPORT
void NotifyMacroRecord(UINT iMessage, WPARAM wParam, LPARAM lParam);
#endif
void PageMove(int direction, bool extend=false);
void ChangeCaseOfSelection(bool makeUpperCase);
void LineTranspose();
virtual int KeyCommand(UINT iMessage);
virtual int KeyDefault(int /* key */, int /*modifiers*/);
int KeyDown(int key, bool shift, bool ctrl, bool alt);
bool GetWhitespaceVisible();
void SetWhitespaceVisible(bool view);
void Indent(bool forwards);
long FindText(UINT iMessage,WPARAM wParam,LPARAM lParam);
void SearchAnchor();
long SearchText(UINT iMessage,WPARAM wParam,LPARAM lParam);
void GoToLine(int lineNo);
char *CopyRange(int start, int end);
int SelectionRangeLength();
char *CopySelectionRange();
void CopySelectionIntoDrag();
void SetDragPosition(int newPos);
virtual void StartDrag();
void DropAt(int position, const char *value, bool moving, bool rectangular);
// PositionInSelection returns 0 if position in selection, -1 if position before selection, and 1 if after.
// Before means either before any line of selection or before selection on its line, with a similar meaning to after
int PositionInSelection(int pos);
bool PointInSelection(Point pt);
bool PointInSelMargin(Point pt);
virtual void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt);
void ButtonMove(Point pt);
void ButtonUp(Point pt, unsigned int curTime, bool ctrl);
void Tick();
virtual void SetTicking(bool on) = 0;
virtual void SetMouseCapture(bool on) = 0;
virtual bool HaveMouseCapture() = 0;
void CheckForChangeOutsidePaint(Range r);
int BraceMatch(int position, int maxReStyle);
void SetBraceHighlight(Position pos0, Position pos1, int matchStyle);
void SetDocPointer(Document *document);
void Expand(int &line, bool doExpand);
void ToggleContraction(int line);
void EnsureLineVisible(int line);
virtual LRESULT DefWndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) = 0;
public:
// Public so scintilla_send_message can use it
virtual LRESULT WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam);
// Public so scintilla_set_id can use it
int ctrlID;
};
#endif

View File

@@ -1,45 +0,0 @@
// Scintilla source code edit control
// Indicator.cxx - defines the style of indicators which are text decorations such as underlining
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include "Platform.h"
#include "Scintilla.h"
#include "Indicator.h"
void Indicator::Draw(Surface *surface, PRectangle &rc) {
surface->PenColour(fore.allocated);
int ymid = (rc.bottom + rc.top) / 2;
if (style == INDIC_SQUIGGLE) {
surface->MoveTo(rc.left, rc.top);
int x = rc.left + 2;
int y = 2;
while (x < rc.right) {
surface->LineTo(x, rc.top + y);
x += 2;
y = 2 - y;
}
surface->LineTo(rc.right, rc.top + y); // Finish the line
} else if (style == INDIC_TT) {
surface->MoveTo(rc.left, ymid);
int x = rc.left + 5;
while (x < rc.right) {
surface->LineTo(x, ymid);
surface->MoveTo(x-3, ymid);
surface->LineTo(x-3, ymid+2);
x++;
surface->MoveTo(x, ymid);
x += 5;
}
surface->LineTo(rc.right, ymid); // Finish the line
if (x - 3 <= rc.right) {
surface->MoveTo(x-3, ymid);
surface->LineTo(x-3, ymid+2);
}
} else { // Either INDIC_PLAIN or unknown
surface->MoveTo(rc.left, ymid);
surface->LineTo(rc.right, ymid);
}
}

View File

@@ -1,18 +0,0 @@
// Scintilla source code edit control
// Indicator.h - defines the style of indicators which are text decorations such as underlining
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef INDICATOR_H
#define INDICATOR_H
class Indicator {
public:
int style;
ColourPair fore;
Indicator() : style(INDIC_PLAIN), fore(Colour(0,0,0)) {
}
void Draw(Surface *surface, PRectangle &rc);
};
#endif

View File

@@ -1,116 +0,0 @@
// Scintilla source code edit control
// KeyMap.cxx - defines a mapping between keystrokes and commands
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include "Platform.h"
#include "Scintilla.h"
#include "KeyMap.h"
KeyMap::KeyMap() : kmap(0), len(0), alloc(0) {
for (int i = 0; MapDefault[i].key; i++) {
AssignCmdKey(MapDefault[i].key,
MapDefault[i].modifiers,
MapDefault[i].msg);
}
}
KeyMap::~KeyMap() {
Clear();
}
void KeyMap::Clear() {
delete []kmap;
kmap = 0;
len = 0;
alloc = 0;
}
void KeyMap::AssignCmdKey(int key, int modifiers, UINT msg) {
if ((len+1) >= alloc) {
KeyToCommand *ktcNew = new KeyToCommand[alloc + 5];
if (!ktcNew)
return;
for (int k=0;k<len;k++)
ktcNew[k] = kmap[k];
alloc += 5;
delete []kmap;
kmap = ktcNew;
}
for (int keyIndex = 0; keyIndex < len; keyIndex++) {
if ((key == kmap[keyIndex].key) && (modifiers == kmap[keyIndex].modifiers)) {
kmap[keyIndex].msg = msg;
return;
}
}
kmap[len].key = key;
kmap[len].modifiers = modifiers;
kmap[len].msg = msg;
len++;
}
UINT KeyMap::Find(int key, int modifiers) {
for (int i=0; i < len; i++) {
if ((key == kmap[i].key) && (modifiers == kmap[i].modifiers)) {
return kmap[i].msg;
}
}
return 0;
}
KeyToCommand KeyMap::MapDefault[] = {
VK_DOWN, SCI_NORM, SCI_LINEDOWN,
VK_DOWN, SCI_SHIFT, SCI_LINEDOWNEXTEND,
VK_UP, SCI_NORM, SCI_LINEUP,
VK_UP, SCI_SHIFT, SCI_LINEUPEXTEND,
VK_LEFT, SCI_NORM, SCI_CHARLEFT,
VK_LEFT, SCI_SHIFT, SCI_CHARLEFTEXTEND,
VK_LEFT, SCI_CTRL, SCI_WORDLEFT,
VK_LEFT, SCI_CSHIFT, SCI_WORDLEFTEXTEND,
VK_RIGHT, SCI_NORM, SCI_CHARRIGHT,
VK_RIGHT, SCI_SHIFT, SCI_CHARRIGHTEXTEND,
VK_RIGHT, SCI_CTRL, SCI_WORDRIGHT,
VK_RIGHT, SCI_CSHIFT, SCI_WORDRIGHTEXTEND,
VK_HOME, SCI_NORM, SCI_VCHOME,
VK_HOME, SCI_SHIFT, SCI_VCHOMEEXTEND,
VK_HOME, SCI_CTRL, SCI_DOCUMENTSTART,
VK_HOME, SCI_CSHIFT, SCI_DOCUMENTSTARTEXTEND,
VK_END, SCI_NORM, SCI_LINEEND,
VK_END, SCI_SHIFT, SCI_LINEENDEXTEND,
VK_END, SCI_CTRL, SCI_DOCUMENTEND,
VK_END, SCI_CSHIFT, SCI_DOCUMENTENDEXTEND,
VK_PRIOR, SCI_NORM, SCI_PAGEUP,
VK_PRIOR, SCI_SHIFT, SCI_PAGEUPEXTEND,
VK_NEXT, SCI_NORM, SCI_PAGEDOWN,
VK_NEXT, SCI_SHIFT, SCI_PAGEDOWNEXTEND,
VK_DELETE, SCI_NORM, WM_CLEAR,
VK_DELETE, SCI_SHIFT, WM_CUT,
VK_DELETE, SCI_CTRL, SCI_DELWORDRIGHT,
VK_INSERT, SCI_NORM, SCI_EDITTOGGLEOVERTYPE,
VK_INSERT, SCI_SHIFT, WM_PASTE,
VK_INSERT, SCI_CTRL, WM_COPY,
VK_ESCAPE, SCI_NORM, SCI_CANCEL,
VK_BACK, SCI_NORM, SCI_DELETEBACK,
VK_BACK, SCI_CTRL, SCI_DELWORDLEFT,
'Z', SCI_CTRL, WM_UNDO,
'Y', SCI_CTRL, SCI_REDO,
'X', SCI_CTRL, WM_CUT,
'C', SCI_CTRL, WM_COPY,
'V', SCI_CTRL, WM_PASTE,
'A', SCI_CTRL, SCI_SELECTALL,
VK_TAB, SCI_NORM, SCI_TAB,
VK_TAB, SCI_SHIFT, SCI_BACKTAB,
VK_RETURN, SCI_NORM, SCI_NEWLINE,
VK_ADD, SCI_CTRL, SCI_ZOOMIN,
VK_SUBTRACT, SCI_CTRL, SCI_ZOOMOUT,
//'L', SCI_CTRL, SCI_FORMFEED,
'L', SCI_CTRL, SCI_LINECUT,
'L', SCI_CSHIFT, SCI_LINEDELETE,
'T', SCI_CTRL, SCI_LINETRANSPOSE,
'U', SCI_CTRL, SCI_LOWERCASE,
'U', SCI_CSHIFT, SCI_UPPERCASE,
0,0,0,
};

View File

@@ -1,36 +0,0 @@
// Scintilla source code edit control
// KeyMap.h - defines a mapping between keystrokes and commands
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef KEYTOCOMMAND_H
#define KEYTOCOMMAND_H
#define SCI_NORM 0
#define SCI_SHIFT SHIFT_PRESSED
#define SCI_CTRL LEFT_CTRL_PRESSED
#define SCI_ALT LEFT_ALT_PRESSED
#define SCI_CSHIFT (SCI_CTRL | SCI_SHIFT)
#define SCI_ASHIFT (SCI_ALT | SCI_SHIFT)
class KeyToCommand {
public:
int key;
int modifiers;
UINT msg;
};
class KeyMap {
KeyToCommand *kmap;
int len;
int alloc;
static KeyToCommand MapDefault[];
public:
KeyMap();
~KeyMap();
void Clear();
void AssignCmdKey(int key, int modifiers, UINT msg);
UINT Find(int key, int modifiers); // 0 returned on failure
};
#endif

View File

@@ -1,45 +0,0 @@
// SciTE - Scintilla based Text Editor
// KeyWords.cxx - colourise for particular languages
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
LexerModule *LexerModule::base = 0;
LexerModule::LexerModule(int language_, LexerFunction fn_) :
language(language_), fn(fn_) {
next = base;
base = this;
}
void LexerModule::Colourise(unsigned int startPos, int lengthDoc, int initStyle,
int language, WordList *keywordlists[], StylingContext &styler) {
LexerModule *lm = base;
while (lm) {
if (lm->language == language) {
lm->fn(startPos, lengthDoc, initStyle, keywordlists, styler);
return;
}
lm = lm->next;
}
// Unknown language
// Null language means all style bytes are 0 so just mark the end - no need to fill in.
if (lengthDoc > 0) {
styler.StartAt(startPos + lengthDoc - 1);
styler.StartSegment(startPos + lengthDoc - 1);
styler.ColourTo(startPos + lengthDoc - 1, 0);
}
}

View File

@@ -1,255 +0,0 @@
// SciTE - Scintilla based Text Editor
// LexCPP.cxx - lexer for C++, C, Java, and Javascript
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
static bool classifyWordCpp(unsigned int start, unsigned int end, WordList &keywords, StylingContext &styler) {
char s[100];
bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.');
bool wordIsUUID = false;
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
s[i] = styler[start + i];
s[i + 1] = '\0';
}
char chAttr = SCE_C_IDENTIFIER;
if (wordIsNumber)
chAttr = SCE_C_NUMBER;
else {
if (keywords.InList(s)) {
chAttr = SCE_C_WORD;
wordIsUUID = strcmp(s, "uuid") == 0;
}
}
styler.ColourTo(end, chAttr);
return wordIsUUID;
}
static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
StylingContext &styler) {
WordList &keywords = *keywordlists[0];
styler.StartAt(startPos);
bool fold = styler.GetPropSet().GetInt("fold");
int lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
int state = initStyle;
char chPrev = ' ';
char chNext = styler[startPos];
unsigned int lengthDoc = startPos + length;
int visChars = 0;
styler.StartSegment(startPos);
bool lastWordWasUUID = false;
for (unsigned int i = startPos; i <= lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
if ((fold) && ((ch == '\r' && chNext != '\n') || (ch == '\n'))) {
int lev = levelPrev;
if (visChars == 0)
lev |= SC_FOLDLEVELWHITEFLAG;
if ((levelCurrent > levelPrev) && (visChars > 0))
lev |= SC_FOLDLEVELHEADERFLAG;
styler.SetLevel(lineCurrent, lev);
lineCurrent++;
visChars = 0;
levelPrev = levelCurrent;
}
if (!isspace(ch))
visChars++;
if (styler.IsLeadByte(ch)) {
chNext = styler.SafeGetCharAt(i + 2);
chPrev = ' ';
i += 1;
continue;
}
if (state == SCE_C_STRINGEOL) {
if (ch != '\r' && ch != '\n') {
styler.ColourTo(i-1, state);
state = SCE_C_DEFAULT;
}
}
if (state == SCE_C_DEFAULT) {
if (iswordstart(ch)) {
styler.ColourTo(i-1, state);
if (lastWordWasUUID) {
state = SCE_C_UUID;
lastWordWasUUID = false;
} else {
state = SCE_C_WORD;
}
} else if (ch == '/' && chNext == '*') {
styler.ColourTo(i-1, state);
if (styler.SafeGetCharAt(i + 2) == '*')
state = SCE_C_COMMENTDOC;
else
state = SCE_C_COMMENT;
} else if (ch == '/' && chNext == '/') {
styler.ColourTo(i-1, state);
state = SCE_C_COMMENTLINE;
} else if (ch == '\"') {
styler.ColourTo(i-1, state);
state = SCE_C_STRING;
} else if (ch == '\'') {
styler.ColourTo(i-1, state);
state = SCE_C_CHARACTER;
} else if (ch == '#') {
styler.ColourTo(i-1, state);
state = SCE_C_PREPROCESSOR;
} else if (isoperator(ch)) {
styler.ColourTo(i-1, state);
styler.ColourTo(i, SCE_C_OPERATOR);
if ((ch == '{') || (ch == '}')) {
levelCurrent += (ch == '{') ? 1 : -1;
}
}
} else if (state == SCE_C_WORD) {
if (!iswordchar(ch)) {
lastWordWasUUID = classifyWordCpp(styler.GetStartSegment(), i - 1, keywords, styler);
state = SCE_C_DEFAULT;
if (ch == '/' && chNext == '*') {
if (styler.SafeGetCharAt(i + 2) == '*')
state = SCE_C_COMMENTDOC;
else
state = SCE_C_COMMENT;
} else if (ch == '/' && chNext == '/') {
state = SCE_C_COMMENTLINE;
} else if (ch == '\"') {
state = SCE_C_STRING;
} else if (ch == '\'') {
state = SCE_C_CHARACTER;
} else if (ch == '#') {
state = SCE_C_PREPROCESSOR;
} else if (isoperator(ch)) {
styler.ColourTo(i, SCE_C_OPERATOR);
if ((ch == '{') || (ch == '}')) {
levelCurrent += (ch == '{') ? 1 : -1;
}
}
}
} else {
if (state == SCE_C_PREPROCESSOR) {
if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
styler.ColourTo(i-1, state);
state = SCE_C_DEFAULT;
}
} else if (state == SCE_C_COMMENT) {
if (ch == '/' && chPrev == '*') {
if (((i > styler.GetStartSegment() + 2) || (
(initStyle == SCE_C_COMMENT) &&
(styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) {
styler.ColourTo(i, state);
state = SCE_C_DEFAULT;
}
}
} else if (state == SCE_C_COMMENTDOC) {
if (ch == '/' && chPrev == '*') {
if (((i > styler.GetStartSegment() + 3) || (
(initStyle == SCE_C_COMMENTDOC) &&
(styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) {
styler.ColourTo(i, state);
state = SCE_C_DEFAULT;
}
}
} else if (state == SCE_C_COMMENTLINE) {
if (ch == '\r' || ch == '\n') {
styler.ColourTo(i-1, state);
state = SCE_C_DEFAULT;
}
} else if (state == SCE_C_STRING) {
if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
styler.ColourTo(i-1, state);
state = SCE_C_STRINGEOL;
} else if (ch == '\\') {
if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (ch == '\"') {
styler.ColourTo(i, state);
state = SCE_C_DEFAULT;
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (state == SCE_C_CHARACTER) {
if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
styler.ColourTo(i-1, state);
state = SCE_C_STRINGEOL;
} else if (ch == '\\') {
if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (ch == '\'') {
styler.ColourTo(i, state);
state = SCE_C_DEFAULT;
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (state == SCE_C_UUID) {
if (ch == '\r' || ch == '\n' || ch == ')') {
styler.ColourTo(i-1, state);
state = SCE_C_DEFAULT;
}
}
if (state == SCE_C_DEFAULT) { // One of the above succeeded
if (ch == '/' && chNext == '*') {
if (styler.SafeGetCharAt(i + 2) == '*')
state = SCE_C_COMMENTDOC;
else
state = SCE_C_COMMENT;
} else if (ch == '/' && chNext == '/') {
state = SCE_C_COMMENTLINE;
} else if (ch == '\"') {
state = SCE_C_STRING;
} else if (ch == '\'') {
state = SCE_C_CHARACTER;
} else if (ch == '#') {
state = SCE_C_PREPROCESSOR;
} else if (iswordstart(ch)) {
state = SCE_C_WORD;
} else if (isoperator(ch)) {
styler.ColourTo(i, SCE_C_OPERATOR);
if ((ch == '{') || (ch == '}')) {
levelCurrent += (ch == '{') ? 1 : -1;
}
}
}
}
chPrev = ch;
}
styler.ColourTo(lengthDoc - 1, state);
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
if (fold) {
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
//styler.SetLevel(lineCurrent, levelCurrent | flagsNext);
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
}
}
LexerModule lmCPP(SCLEX_CPP, ColouriseCppDoc);

File diff suppressed because it is too large Load Diff

View File

@@ -1,200 +0,0 @@
// SciTE - Scintilla based Text Editor
// LexOthers.cxx - lexers for properties files, batch files, make files and error lists
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
static void ColouriseBatchLine(char *lineBuffer, int endLine, StylingContext &styler) {
if (0 == strncmp(lineBuffer, "REM", 3)) {
styler.ColourTo(endLine, 1);
} else if (0 == strncmp(lineBuffer, "rem", 3)) {
styler.ColourTo(endLine, 1);
} else if (0 == strncmp(lineBuffer, "SET", 3)) {
styler.ColourTo(endLine, 2);
} else if (0 == strncmp(lineBuffer, "set", 3)) {
styler.ColourTo(endLine, 2);
} else if (lineBuffer[0] == ':') {
styler.ColourTo(endLine, 3);
} else {
styler.ColourTo(endLine, 0);
}
}
static void ColouriseBatchDoc(unsigned int startPos, int length, int, WordList *[], StylingContext &styler) {
char lineBuffer[1024];
styler.StartAt(startPos);
styler.StartSegment(startPos);
unsigned int linePos = 0;
for (unsigned int i = startPos; i < startPos + length; i++) {
lineBuffer[linePos++] = styler[i];
if (styler[i] == '\r' || styler[i] == '\n' || (linePos >= sizeof(lineBuffer) - 1)) {
ColouriseBatchLine(lineBuffer, i, styler);
linePos = 0;
}
}
if (linePos > 0)
ColouriseBatchLine(lineBuffer, startPos + length, styler);
}
static void ColourisePropsLine(char *lineBuffer, int lengthLine, int startLine, int endPos, StylingContext &styler) {
int i = 0;
while (isspace(lineBuffer[i]) && (i < lengthLine)) // Skip initial spaces
i++;
if (lineBuffer[i] == '#' || lineBuffer[i] == '!' || lineBuffer[i] == ';') {
styler.ColourTo(endPos, 1);
} else if (lineBuffer[i] == '[') {
styler.ColourTo(endPos, 2);
} else if (lineBuffer[i] == '@') {
styler.ColourTo(startLine+i, 4);
if (lineBuffer[++i] == '=')
styler.ColourTo(startLine+i, 3);
styler.ColourTo(endPos, 0);
} else {
while (lineBuffer[i] != '=' && (i < lengthLine)) // Search the '=' character
i++;
if (lineBuffer[i] == '=') {
styler.ColourTo(startLine+i-1, 0);
styler.ColourTo(startLine+i, 3);
styler.ColourTo(endPos, 0);
} else {
styler.ColourTo(endPos, 0);
}
}
}
static void ColourisePropsDoc(unsigned int startPos, int length, int, WordList *[], StylingContext &styler) {
char lineBuffer[1024];
styler.StartAt(startPos);
styler.StartSegment(startPos);
unsigned int linePos = 0;
int startLine = startPos;
for (unsigned int i = startPos; i <= startPos + length; i++) {
lineBuffer[linePos++] = styler[i];
if ((styler[i] == '\r' && styler.SafeGetCharAt(i+1) != '\n') ||
styler[i] == '\n' ||
(linePos >= sizeof(lineBuffer) - 1)) {
lineBuffer[linePos] = '\0';
ColourisePropsLine(lineBuffer, linePos, startLine, i, styler);
linePos = 0;
startLine = i+1;
}
}
if (linePos > 0)
ColourisePropsLine(lineBuffer, linePos, startLine, startPos + length, styler);
}
static void ColouriseMakeLine(char *lineBuffer, int lengthLine, int endPos, StylingContext &styler) {
int i = 0;
while (isspace(lineBuffer[i]) && (i < lengthLine))
i++;
if (lineBuffer[i] == '#' || lineBuffer[i] == '!') {
styler.ColourTo(endPos, 1);
} else {
styler.ColourTo(endPos, 0);
}
}
static void ColouriseMakeDoc(unsigned int startPos, int length, int, WordList *[], StylingContext &styler) {
char lineBuffer[1024];
styler.StartAt(startPos);
styler.StartSegment(startPos);
unsigned int linePos = 0;
for (unsigned int i = startPos; i <= startPos + length; i++) {
lineBuffer[linePos++] = styler[i];
if (styler[i] == '\r' || styler[i] == '\n' || (linePos >= sizeof(lineBuffer) - 1)) {
ColouriseMakeLine(lineBuffer, linePos, i, styler);
linePos = 0;
}
}
if (linePos > 0)
ColouriseMakeLine(lineBuffer, linePos, startPos + length, styler);
}
static void ColouriseErrorListLine(char *lineBuffer, int lengthLine, int endPos, StylingContext &styler) {
if (lineBuffer[0] == '>') {
// Command or return status
styler.ColourTo(endPos, 4);
} else if (strstr(lineBuffer, "File \"") && strstr(lineBuffer, ", line ")) {
styler.ColourTo(endPos, 1);
} else if (0 == strncmp(lineBuffer, "Error ", strlen("Error "))) {
// Borland error message
styler.ColourTo(endPos, 5);
} else if (0 == strncmp(lineBuffer, "Warning ", strlen("Warning "))) {
// Borland warning message
styler.ColourTo(endPos, 5);
} else {
// Look for <filename>:<line>:message
// Look for <filename>(line)message
// Look for <filename>(line,pos)message
int state = 0;
for (int i = 0; i < lengthLine; i++) {
if (state == 0 && lineBuffer[i] == ':' && isdigit(lineBuffer[i + 1])) {
state = 1;
} else if (state == 0 && lineBuffer[i] == '(') {
state = 10;
} else if (state == 1 && isdigit(lineBuffer[i])) {
state = 2;
} else if (state == 2 && lineBuffer[i] == ':') {
state = 3;
break;
} else if (state == 2 && !isdigit(lineBuffer[i])) {
state = 99;
} else if (state == 10 && isdigit(lineBuffer[i])) {
state = 11;
} else if (state == 11 && lineBuffer[i] == ',') {
state = 14;
} else if (state == 11 && lineBuffer[i] == ')') {
state = 12;
break;
} else if (state == 12 && lineBuffer[i] == ':') {
state = 13;
} else if (state == 14 && lineBuffer[i] == ')') {
state = 15;
break;
} else if (((state == 11) || (state == 14)) && !((lineBuffer[i] == ' ') || isdigit(lineBuffer[i]))) {
state = 99;
}
}
if (state == 3) {
styler.ColourTo(endPos, 2);
} else if ((state == 14) || (state == 15)) {
styler.ColourTo(endPos, 3);
} else {
styler.ColourTo(endPos, 0);
}
}
}
static void ColouriseErrorListDoc(unsigned int startPos, int length, int, WordList *[], StylingContext &styler) {
char lineBuffer[1024];
styler.StartAt(startPos);
styler.StartSegment(startPos);
unsigned int linePos = 0;
for (unsigned int i = startPos; i <= startPos + length; i++) {
lineBuffer[linePos++] = styler[i];
if (styler[i] == '\r' || styler[i] == '\n' || (linePos >= sizeof(lineBuffer) - 1)) {
ColouriseErrorListLine(lineBuffer, linePos, i, styler);
linePos = 0;
}
}
if (linePos > 0)
ColouriseErrorListLine(lineBuffer, linePos, startPos + length, styler);
}
LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc);
LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc);
LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc);
LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc);

View File

@@ -1,488 +0,0 @@
// SciTE - Scintilla based Text Editor
// LexPerl.cxx - lexer for subset of Perl
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
inline bool isPerlOperator(char ch) {
if (isalnum(ch))
return false;
// '.' left out as it is used to make up numbers
if (ch == '%' || ch == '^' || ch == '&' || ch == '*' || ch == '\\' ||
ch == '(' || ch == ')' || ch == '-' || ch == '+' ||
ch == '=' || ch == '|' || ch == '{' || ch == '}' ||
ch == '[' || ch == ']' || ch == ':' || ch == ';' ||
ch == '<' || ch == '>' || ch == ',' || ch == '/' ||
ch == '?' || ch == '!' || ch == '.' || ch == '~')
return true;
return false;
}
static int classifyWordPerl(unsigned int start, unsigned int end, WordList &keywords, StylingContext &styler) {
char s[100];
bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.');
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
s[i] = styler[start + i];
s[i + 1] = '\0';
}
char chAttr = SCE_PL_IDENTIFIER;
if (wordIsNumber)
chAttr = SCE_PL_NUMBER;
else {
if (keywords.InList(s))
chAttr = SCE_PL_WORD;
}
styler.ColourTo(end, chAttr);
return chAttr;
}
static bool isEndVar(char ch) {
return !isalnum(ch) && ch != '#' && ch != '$' &&
ch != '_' && ch != '\'';
}
static bool isMatch(StylingContext &styler, int lengthDoc, int pos, const char *val) {
if ((pos + static_cast<int>(strlen(val))) >= lengthDoc) {
return false;
}
while (*val) {
if (*val != styler[pos++]) {
return false;
}
val++;
}
return true;
}
static bool isOKQuote(char ch) {
if (isalnum(ch))
return false;
if (isspace(ch))
return false;
if (iscntrl(ch))
return false;
return true;
}
static char opposite(char ch) {
if (ch == '(')
return ')';
if (ch == '[')
return ']';
if (ch == '{')
return '}';
if (ch == '<')
return '>';
return ch;
}
static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], StylingContext &styler) {
// Lexer for perl often has to backtrack to start of current style to determine
// which characters are being used as quotes, how deeply nested is the
// start position and what the termination string is for here documents
WordList &keywords = *keywordlists[0];
char sooked[100];
int quotes = 0;
char quoteDown = 'd';
char quoteUp = 'd';
int quoteRep = 1;
int sookedpos = 0;
bool preferRE = true;
sooked[sookedpos] = '\0';
int state = initStyle;
int lengthDoc = startPos + length;
// If in a long distance lexical state, seek to the beginning to find quote characters
if (state == SCE_PL_HERE || state == SCE_PL_REGEX ||
state == SCE_PL_REGSUBST || state == SCE_PL_LONGQUOTE) {
while ((startPos > 1) && (styler.StyleAt(startPos - 1) == state)) {
startPos--;
}
state = SCE_PL_DEFAULT;
}
styler.StartAt(startPos);
char chPrev = ' ';
char chNext = styler[startPos];
styler.StartSegment(startPos);
for (int i = startPos; i <= lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
char chNext2 = styler.SafeGetCharAt(i + 2);
if (styler.IsLeadByte(ch)) {
chNext = styler.SafeGetCharAt(i + 2);
chPrev = ' ';
i += 1;
continue;
}
if (state == SCE_PL_DEFAULT) {
if (iswordstart(ch)) {
styler.ColourTo(i - 1, state);
if (ch == 's' && !isalnum(chNext)) {
state = SCE_PL_REGSUBST;
quotes = 0;
quoteUp = '\0';
quoteDown = '\0';
quoteRep = 2;
} else if (ch == 'm' && !isalnum(chNext)) {
state = SCE_PL_REGEX;
quotes = 0;
quoteUp = '\0';
quoteDown = '\0';
quoteRep = 1;
} else if (ch == 't' && chNext == 'r' && !isalnum(chNext2)) {
state = SCE_PL_REGSUBST;
quotes = 0;
quoteUp = '\0';
quoteDown = '\0';
quoteRep = 2;
i++;
chNext = chNext2;
} else if (ch == 'q' && (chNext == 'q' || chNext == 'r' || chNext == 'w' || chNext == 'x') && !isalnum(chNext2)) {
state = SCE_PL_LONGQUOTE;
i++;
chNext = chNext2;
quotes = 0;
quoteUp = '\0';
quoteDown = '\0';
quoteRep = 1;
} else {
state = SCE_PL_WORD;
preferRE = false;
}
} else if (ch == '#') {
styler.ColourTo(i - 1, state);
state = SCE_PL_COMMENTLINE;
} else if (ch == '\"') {
styler.ColourTo(i - 1, state);
state = SCE_PL_STRING;
} else if (ch == '\'') {
if (chPrev == '&') {
// Archaic call
styler.ColourTo(i, state);
} else {
styler.ColourTo(i - 1, state);
state = SCE_PL_CHARACTER;
}
} else if (ch == '`') {
styler.ColourTo(i - 1, state);
state = SCE_PL_BACKTICKS;
} else if (ch == '$') {
preferRE = false;
styler.ColourTo(i - 1, state);
if (isalnum(chNext) || chNext == '#' || chNext == '$' || chNext == '_') {
state = SCE_PL_SCALAR;
} else if (chNext != '{' && chNext != '[') {
styler.ColourTo(i, SCE_PL_SCALAR);
i++;
ch = ' ';
chNext = ' ';
} else {
styler.ColourTo(i, SCE_PL_SCALAR);
}
} else if (ch == '@') {
preferRE = false;
styler.ColourTo(i - 1, state);
if (isalpha(chNext) || chNext == '#' || chNext == '$' || chNext == '_') {
state = SCE_PL_ARRAY;
} else if (chNext != '{' && chNext != '[') {
styler.ColourTo(i, SCE_PL_ARRAY);
i++;
ch = ' ';
} else {
styler.ColourTo(i, SCE_PL_ARRAY);
}
} else if (ch == '%') {
preferRE = false;
styler.ColourTo(i - 1, state);
if (isalpha(chNext) || chNext == '#' || chNext == '$' || chNext == '_') {
state = SCE_PL_HASH;
} else if (chNext != '{' && chNext != '[') {
styler.ColourTo(i, SCE_PL_HASH);
i++;
ch = ' ';
} else {
styler.ColourTo(i, SCE_PL_HASH);
}
} else if (ch == '*') {
styler.ColourTo(i - 1, state);
state = SCE_PL_SYMBOLTABLE;
} else if (ch == '/' && preferRE) {
styler.ColourTo(i - 1, state);
state = SCE_PL_REGEX;
quoteUp = '/';
quoteDown = '/';
quotes = 1;
quoteRep = 1;
} else if (ch == '<' && chNext == '<') {
styler.ColourTo(i - 1, state);
state = SCE_PL_HERE;
i++;
ch = chNext;
chNext = chNext2;
quotes = 0;
sookedpos = 0;
sooked[sookedpos] = '\0';
} else if (ch == '=' && isalpha(chNext)) {
styler.ColourTo(i - 1, state);
state = SCE_PL_POD;
quotes = 0;
sookedpos = 0;
sooked[sookedpos] = '\0';
} else if (isPerlOperator(ch)) {
if (ch == ')' || ch == ']')
preferRE = false;
else
preferRE = true;
styler.ColourTo(i - 1, state);
styler.ColourTo(i, SCE_PL_OPERATOR);
}
} else if (state == SCE_PL_WORD) {
if (!iswordchar(ch) && ch != '\'') { // Archaic Perl has quotes inside names
if (isMatch(styler, lengthDoc, styler.GetStartSegment(), "__DATA__")) {
styler.ColourTo(i, SCE_PL_DATASECTION);
state = SCE_PL_DATASECTION;
} else if (isMatch(styler, lengthDoc, styler.GetStartSegment(), "__END__")) {
styler.ColourTo(i, SCE_PL_DATASECTION);
state = SCE_PL_DATASECTION;
} else {
if (classifyWordPerl(styler.GetStartSegment(), i - 1, keywords, styler) == SCE_PL_WORD)
preferRE = true;
state = SCE_PL_DEFAULT;
if (ch == '#') {
state = SCE_PL_COMMENTLINE;
} else if (ch == '\"') {
state = SCE_PL_STRING;
} else if (ch == '\'') {
state = SCE_PL_CHARACTER;
} else if (ch == '<' && chNext == '<') {
state = SCE_PL_HERE;
quotes = 0;
sookedpos = 0;
sooked[sookedpos] = '\0';
} else if (isPerlOperator(ch)) {
if (ch == ')' || ch == ']')
preferRE = false;
else
preferRE = true;
styler.ColourTo(i, SCE_PL_OPERATOR);
state = SCE_PL_DEFAULT;
}
}
}
} else {
if (state == SCE_PL_COMMENTLINE) {
if (ch == '\r' || ch == '\n') {
styler.ColourTo(i - 1, state);
state = SCE_PL_DEFAULT;
}
} else if (state == SCE_PL_HERE) {
if (isalnum(ch) && quotes < 2) {
sooked[sookedpos++] = ch;
sooked[sookedpos] = '\0';
if (quotes == 0)
quotes = 1;
} else {
quotes++;
}
if (quotes > 1 && isMatch(styler, lengthDoc, i, sooked)) {
styler.ColourTo(i + sookedpos - 1, SCE_PL_HERE);
state = SCE_PL_DEFAULT;
i += sookedpos;
chNext = ' ';
}
} else if (state == SCE_PL_STRING) {
if (ch == '\\') {
if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (ch == '\"') {
styler.ColourTo(i, state);
state = SCE_PL_DEFAULT;
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (state == SCE_PL_CHARACTER) {
if (ch == '\\') {
if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (ch == '\'') {
styler.ColourTo(i, state);
state = SCE_PL_DEFAULT;
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (state == SCE_PL_BACKTICKS) {
if (ch == '`') {
styler.ColourTo(i, state);
state = SCE_PL_DEFAULT;
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (state == SCE_PL_POD) {
if (ch == '=') {
if (isMatch(styler, lengthDoc, i, "=cut")) {
styler.ColourTo(i - 1 + 4, state);
i += 4;
state = SCE_PL_DEFAULT;
chNext = ' ';
ch = ' ';
}
}
} else if (state == SCE_PL_SCALAR) {
if (isEndVar(ch)) {
styler.ColourTo(i - 1, state);
state = SCE_PL_DEFAULT;
}
} else if (state == SCE_PL_ARRAY) {
if (isEndVar(ch)) {
styler.ColourTo(i - 1, state);
state = SCE_PL_DEFAULT;
}
} else if (state == SCE_PL_HASH) {
if (isEndVar(ch)) {
styler.ColourTo(i - 1, state);
state = SCE_PL_DEFAULT;
}
} else if (state == SCE_PL_SYMBOLTABLE) {
if (isEndVar(ch)) {
styler.ColourTo(i - 1, state);
state = SCE_PL_DEFAULT;
}
} else if (state == SCE_PL_REF) {
if (isEndVar(ch)) {
styler.ColourTo(i - 1, state);
state = SCE_PL_DEFAULT;
}
} else if (state == SCE_PL_REGEX) {
if (!quoteUp && !isspace(ch)) {
quoteUp = ch;
quoteDown = opposite(ch);
quotes++;
} else {
if (ch == quoteDown && chPrev != '\\') {
quotes--;
if (quotes == 0) {
quoteRep--;
if (quoteUp == quoteDown) {
quotes++;
}
}
if (!isalpha(chNext)) {
if (quoteRep <= 0) {
styler.ColourTo(i, state);
state = SCE_PL_DEFAULT;
ch = ' ';
}
}
} else if (ch == quoteUp && chPrev != '\\') {
quotes++;
} else if (!isalpha(chNext)) {
if (quoteRep <= 0) {
styler.ColourTo(i, state);
state = SCE_PL_DEFAULT;
ch = ' ';
}
}
}
} else if (state == SCE_PL_REGSUBST) {
if (!quoteUp && !isspace(ch)) {
quoteUp = ch;
quoteDown = opposite(ch);
quotes++;
} else {
if (ch == quoteDown && chPrev != '\\') {
quotes--;
if (quotes == 0) {
quoteRep--;
}
if (!isalpha(chNext)) {
if (quoteRep <= 0) {
styler.ColourTo(i, state);
state = SCE_PL_DEFAULT;
ch = ' ';
}
}
if (quoteUp == quoteDown) {
quotes++;
}
} else if (ch == quoteUp && chPrev != '\\') {
quotes++;
} else if (!isalpha(chNext)) {
if (quoteRep <= 0) {
styler.ColourTo(i, state);
state = SCE_PL_DEFAULT;
ch = ' ';
}
}
}
} else if (state == SCE_PL_LONGQUOTE) {
if (!quoteDown && !isspace(ch)) {
quoteUp = ch;
quoteDown = opposite(quoteUp);
quotes++;
} else if (ch == quoteDown) {
quotes--;
if (quotes == 0) {
quoteRep--;
if (quoteRep <= 0) {
styler.ColourTo(i, state);
state = SCE_PL_DEFAULT;
ch = ' ';
}
if (quoteUp == quoteDown) {
quotes++;
}
}
} else if (ch == quoteUp) {
quotes++;
}
}
if (state == SCE_PL_DEFAULT) { // One of the above succeeded
if (ch == '#') {
state = SCE_PL_COMMENTLINE;
} else if (ch == '\"') {
state = SCE_PL_STRING;
} else if (ch == '\'') {
state = SCE_PL_CHARACTER;
} else if (iswordstart(ch)) {
state = SCE_PL_WORD;
preferRE = false;
} else if (isoperator(ch)) {
styler.ColourTo(i, SCE_PL_OPERATOR);
}
}
}
chPrev = ch;
}
styler.ColourTo(lengthDoc, state);
}
LexerModule lmPerl(SCLEX_PERL, ColourisePerlDoc);

View File

@@ -1,254 +0,0 @@
// SciTE - Scintilla based Text Editor
// LexPython.cxx - lexer for Python
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
static void classifyWordPy(unsigned int start, unsigned int end, WordList &keywords, StylingContext &styler, char *prevWord) {
char s[100];
bool wordIsNumber = isdigit(styler[start]);
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
s[i] = styler[start + i];
s[i + 1] = '\0';
}
char chAttr = SCE_P_IDENTIFIER;
if (0 == strcmp(prevWord, "class"))
chAttr = SCE_P_CLASSNAME;
else if (0 == strcmp(prevWord, "def"))
chAttr = SCE_P_DEFNAME;
else if (wordIsNumber)
chAttr = SCE_P_NUMBER;
else if (keywords.InList(s))
chAttr = SCE_P_WORD;
styler.ColourTo(end, chAttr);
strcpy(prevWord, s);
}
static bool IsPyComment(StylingContext &styler, int pos, int len) {
return len>0 && styler[pos]=='#';
}
static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], StylingContext &styler) {
// Python uses a different mask because bad indentation is marked by oring with 32
styler.StartAt(startPos, 127);
WordList &keywords = *keywordlists[0];
//Platform::DebugPrintf("Python coloured\n");
bool fold = styler.GetPropSet().GetInt("fold");
int whingeLevel = styler.GetPropSet().GetInt("tab.timmy.whinge.level");
char prevWord[200];
prevWord[0] = '\0';
if (length == 0)
return ;
int lineCurrent = styler.GetLine(startPos);
int spaceFlags = 0;
// TODO: Need to check previous line for indentation for both folding and bad indentation
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
int state = initStyle & 31;
char chPrev = ' ';
char chPrev2 = ' ';
char chNext = styler[startPos];
char chNext2 = styler[startPos];
styler.StartSegment(startPos);
int lengthDoc = startPos + length;
bool atStartLine = true;
for (int i = startPos; i <= lengthDoc; i++) {
if (atStartLine) {
if (whingeLevel == 1) {
styler.SetFlags((spaceFlags & wsInconsistent) ? 64 : 0, state);
} else if (whingeLevel == 2) {
styler.SetFlags((spaceFlags & wsSpaceTab) ? 64 : 0, state);
} else if (whingeLevel == 3) {
styler.SetFlags((spaceFlags & wsSpace) ? 64 : 0, state);
} else if (whingeLevel == 4) {
styler.SetFlags((spaceFlags & wsTab) ? 64 : 0, state);
}
atStartLine = false;
}
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
chNext2 = styler.SafeGetCharAt(i + 2);
if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc)) {
if ((state == SCE_P_DEFAULT) || (state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE)) {
// Perform colourisation of white space and triple quoted strings at end of each line to allow
// tab marking to work inside white space and triple quoted strings
styler.ColourTo(i, state);
}
int lev = indentCurrent;
int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsPyComment);
if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) {
// Only non whitespace lines can be headers
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) {
lev |= SC_FOLDLEVELHEADERFLAG;
} else if (indentNext & SC_FOLDLEVELWHITEFLAG) {
// Line after is blank so check the next - maybe should continue further?
int spaceFlags2 = 0;
int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsPyComment);
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) {
lev |= SC_FOLDLEVELHEADERFLAG;
}
}
}
indentCurrent = indentNext;
if (fold) {
styler.SetLevel(lineCurrent, lev);
}
lineCurrent++;
atStartLine = true;
}
if (styler.IsLeadByte(ch)) {
chNext = styler.SafeGetCharAt(i + 2);
chPrev = ' ';
chPrev2 = ' ';
i += 1;
continue;
}
if (state == SCE_P_STRINGEOL) {
if (ch != '\r' && ch != '\n') {
styler.ColourTo(i - 1, state);
state = SCE_P_DEFAULT;
}
}
if (state == SCE_P_DEFAULT) {
if (iswordstart(ch)) {
styler.ColourTo(i - 1, state);
state = SCE_P_WORD;
} else if (ch == '#') {
styler.ColourTo(i - 1, state);
state = chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE;
} else if (ch == '\"') {
styler.ColourTo(i - 1, state);
if (chNext == '\"' && chNext2 == '\"') {
i += 2;
state = SCE_P_TRIPLEDOUBLE;
ch = ' ';
chPrev = ' ';
chNext = styler.SafeGetCharAt(i + 1);
} else {
state = SCE_P_STRING;
}
} else if (ch == '\'') {
styler.ColourTo(i - 1, state);
if (chNext == '\'' && chNext2 == '\'') {
i += 2;
state = SCE_P_TRIPLE;
ch = ' ';
chPrev = ' ';
chNext = styler.SafeGetCharAt(i + 1);
} else {
state = SCE_P_CHARACTER;
}
} else if (isoperator(ch)) {
styler.ColourTo(i - 1, state);
styler.ColourTo(i, SCE_P_OPERATOR);
}
} else if (state == SCE_P_WORD) {
if (!iswordchar(ch)) {
classifyWordPy(styler.GetStartSegment(), i - 1, keywords, styler, prevWord);
state = SCE_P_DEFAULT;
if (ch == '#') {
state = chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE;
} else if (ch == '\"') {
if (chNext == '\"' && chNext2 == '\"') {
i += 2;
state = SCE_P_TRIPLEDOUBLE;
ch = ' ';
chPrev = ' ';
chNext = styler.SafeGetCharAt(i + 1);
} else {
state = SCE_P_STRING;
}
} else if (ch == '\'') {
if (chNext == '\'' && chNext2 == '\'') {
i += 2;
state = SCE_P_TRIPLE;
ch = ' ';
chPrev = ' ';
chNext = styler.SafeGetCharAt(i + 1);
} else {
state = SCE_P_CHARACTER;
}
} else if (isoperator(ch)) {
styler.ColourTo(i, SCE_P_OPERATOR);
}
}
} else {
if (state == SCE_P_COMMENTLINE || state == SCE_P_COMMENTBLOCK) {
if (ch == '\r' || ch == '\n') {
styler.ColourTo(i - 1, state);
state = SCE_P_DEFAULT;
}
} else if (state == SCE_P_STRING) {
if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
styler.ColourTo(i - 1, state);
state = SCE_P_STRINGEOL;
} else if (ch == '\\') {
if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (ch == '\"') {
styler.ColourTo(i, state);
state = SCE_P_DEFAULT;
}
} else if (state == SCE_P_CHARACTER) {
if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
styler.ColourTo(i - 1, state);
state = SCE_P_STRINGEOL;
} else if (ch == '\\') {
if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (ch == '\'') {
styler.ColourTo(i, state);
state = SCE_P_DEFAULT;
}
} else if (state == SCE_P_TRIPLE) {
if (ch == '\'' && chPrev == '\'' && chPrev2 == '\'') {
styler.ColourTo(i, state);
state = SCE_P_DEFAULT;
}
} else if (state == SCE_P_TRIPLEDOUBLE) {
if (ch == '\"' && chPrev == '\"' && chPrev2 == '\"') {
styler.ColourTo(i, state);
state = SCE_P_DEFAULT;
}
}
}
chPrev2 = chPrev;
chPrev = ch;
}
if (state == SCE_P_WORD) {
classifyWordPy(styler.GetStartSegment(), lengthDoc, keywords, styler, prevWord);
} else {
styler.ColourTo(lengthDoc, state);
}
}
LexerModule lmPython(SCLEX_PYTHON, ColourisePyDoc);

View File

@@ -1,158 +0,0 @@
// SciTE - Scintilla based Text Editor
// LexSQL.cxx - lexer for SQL
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
static void classifyWordSQL(unsigned int start, unsigned int end, WordList &keywords, StylingContext &styler) {
char s[100];
bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.');
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
s[i] = toupper(styler[start + i]);
s[i + 1] = '\0';
}
char chAttr = SCE_C_IDENTIFIER;
if (wordIsNumber)
chAttr = SCE_C_NUMBER;
else {
if (keywords.InList(s))
chAttr = SCE_C_WORD;
}
styler.ColourTo(end, chAttr);
}
static void ColouriseSQLDoc(unsigned int startPos, int length,
int initStyle, WordList *keywordlists[], StylingContext &styler) {
WordList &keywords = *keywordlists[0];
styler.StartAt(startPos);
bool fold = styler.GetPropSet().GetInt("fold");
int lineCurrent = styler.GetLine(startPos);
int spaceFlags = 0;
int indentCurrent = 0;
int state = initStyle;
char chPrev = ' ';
char chNext = styler[startPos];
styler.StartSegment(startPos);
unsigned int lengthDoc = startPos + length;
bool prevCr = false;
for (unsigned int i = startPos; i <= lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
if ((ch == '\r' && chNext != '\n') || (ch == '\n')) {
indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags);
int lev = indentCurrent;
if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) {
// Only non whitespace lines can be headers
int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags);
if (indentCurrent < (indentNext & ~SC_FOLDLEVELWHITEFLAG)) {
lev |= SC_FOLDLEVELHEADERFLAG;
}
}
if (fold) {
styler.SetLevel(lineCurrent, lev);
}
}
if (styler.IsLeadByte(ch)) {
chNext = styler.SafeGetCharAt(i + 2);
chPrev = ' ';
i += 1;
continue;
}
if (state == SCE_C_DEFAULT) {
if (iswordstart(ch)) {
styler.ColourTo(i - 1, state);
state = SCE_C_WORD;
} else if (ch == '/' && chNext == '*') {
styler.ColourTo(i - 1, state);
state = SCE_C_COMMENT;
} else if (ch == '-' && chNext == '-') {
styler.ColourTo(i - 1, state);
state = SCE_C_COMMENTLINE;
} else if (ch == '\'') {
styler.ColourTo(i - 1, state);
state = SCE_C_STRING;
} else if (isoperator(ch)) {
styler.ColourTo(i - 1, state);
styler.ColourTo(i, SCE_C_OPERATOR);
}
} else if (state == SCE_C_WORD) {
if (!iswordchar(ch)) {
classifyWordSQL(styler.GetStartSegment(), i - 1, keywords, styler);
state = SCE_C_DEFAULT;
if (ch == '/' && chNext == '*') {
state = SCE_C_COMMENT;
} else if (ch == '-' && chNext == '-') {
state = SCE_C_COMMENTLINE;
} else if (ch == '\'') {
state = SCE_C_STRING;
} else if (isoperator(ch)) {
styler.ColourTo(i, SCE_C_OPERATOR);
}
}
} else {
if (state == SCE_C_COMMENT) {
if (ch == '/' && chPrev == '*') {
if (((i > (styler.GetStartSegment() + 2)) || ((initStyle == SCE_C_COMMENT) &&
(styler.GetStartSegment() == startPos)))) {
styler.ColourTo(i, state);
state = SCE_C_DEFAULT;
}
}
} else if (state == SCE_C_COMMENTLINE) {
if (ch == '\r' || ch == '\n') {
styler.ColourTo(i - 1, state);
state = SCE_C_DEFAULT;
}
} else if (state == SCE_C_STRING) {
if (ch == '\'') {
if ( chNext == '\'' ) {
i++;
} else {
styler.ColourTo(i, state);
state = SCE_C_DEFAULT;
i++;
}
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
}
if (state == SCE_C_DEFAULT) { // One of the above succeeded
if (ch == '/' && chNext == '*') {
state = SCE_C_COMMENT;
} else if (ch == '-' && chNext == '-') {
state = SCE_C_COMMENTLINE;
} else if (ch == '\'') {
state = SCE_C_STRING;
} else if (iswordstart(ch)) {
state = SCE_C_WORD;
} else if (isoperator(ch)) {
styler.ColourTo(i, SCE_C_OPERATOR);
}
}
}
chPrev = ch;
}
styler.ColourTo(lengthDoc - 1, state);
}
LexerModule lmSQL(SCLEX_SQL, ColouriseSQLDoc);

View File

@@ -1,118 +0,0 @@
// SciTE - Scintilla based Text Editor
// LexVB.cxx - lexer for Visual Basic and VBScript
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
static int classifyWordVB(unsigned int start, unsigned int end, WordList &keywords, StylingContext &styler) {
char s[100];
bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.');
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
s[i] = tolower(styler[start + i]);
s[i + 1] = '\0';
}
char chAttr = SCE_C_DEFAULT;
if (wordIsNumber)
chAttr = SCE_C_NUMBER;
else {
if (keywords.InList(s)) {
chAttr = SCE_C_WORD;
if (strcmp(s, "rem") == 0)
chAttr = SCE_C_COMMENTLINE;
}
}
styler.ColourTo(end, chAttr);
if (chAttr == SCE_C_COMMENTLINE)
return SCE_C_COMMENTLINE;
else
return SCE_C_DEFAULT;
}
static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], StylingContext &styler) {
WordList &keywords = *keywordlists[0];
styler.StartAt(startPos);
int state = initStyle;
char chNext = styler[startPos];
styler.StartSegment(startPos);
int lengthDoc = startPos + length;
for (int i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
if (styler.IsLeadByte(ch)) {
chNext = styler.SafeGetCharAt(i + 2);
i += 1;
continue;
}
if (state == SCE_C_DEFAULT) {
if (iswordstart(ch)) {
styler.ColourTo(i - 1, state);
state = SCE_C_WORD;
} else if (ch == '\'') {
styler.ColourTo(i - 1, state);
state = SCE_C_COMMENTLINE;
} else if (ch == '\"') {
styler.ColourTo(i - 1, state);
state = SCE_C_STRING;
}
} else if (state == SCE_C_WORD) {
if (!iswordchar(ch)) {
state = classifyWordVB(styler.GetStartSegment(), i - 1, keywords, styler);
if (state == SCE_C_DEFAULT) {
if (ch == '\'') {
state = SCE_C_COMMENTLINE;
} else if (ch == '\"') {
state = SCE_C_STRING;
}
}
}
} else {
if (state == SCE_C_COMMENTLINE) {
if (ch == '\r' || ch == '\n') {
styler.ColourTo(i - 1, state);
state = SCE_C_DEFAULT;
}
} else if (state == SCE_C_STRING) {
// VB doubles quotes to preserve them
if (ch == '\"') {
styler.ColourTo(i, state);
state = SCE_C_DEFAULT;
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
}
if (state == SCE_C_DEFAULT) { // One of the above succeeded
if (ch == '\'') {
state = SCE_C_COMMENTLINE;
} else if (ch == '\"') {
state = SCE_C_STRING;
} else if (iswordstart(ch)) {
state = SCE_C_WORD;
}
}
}
}
styler.ColourTo(lengthDoc, state);
}
LexerModule lmVB(SCLEX_VB, ColouriseVBDoc);

View File

@@ -1,125 +0,0 @@
// Scintilla source code edit control
// LineMarker.cxx - defines the look of a line marker in the margin
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include "Platform.h"
#include "Scintilla.h"
#include "LineMarker.h"
void LineMarker::Draw(Surface *surface, PRectangle &rc) {
int minDim = Platform::Minimum(rc.Width(), rc.Height());
minDim--; // Ensure does not go beyond edge
int centreX = (rc.right + rc.left) / 2;
int centreY = (rc.bottom + rc.top) / 2;
int dimOn2 = minDim / 2;
int dimOn4 = minDim / 4;
if (rc.Width() > (rc.Height() * 2)) {
// Wide column is line number so move to left to try to avoid overlapping number
centreX = rc.left + dimOn2 + 1;
}
if (markType == SC_MARK_ROUNDRECT) {
PRectangle rcRounded = rc;
rcRounded.left = rc.left + 1;
rcRounded.right = rc.right - 1;
surface->RoundedRectangle(rcRounded, fore.allocated, back.allocated);
} else if (markType == SC_MARK_CIRCLE) {
PRectangle rcCircle;
rcCircle.left = centreX - dimOn2;
rcCircle.top = centreY - dimOn2;
rcCircle.right = centreX + dimOn2;
rcCircle.bottom = centreY + dimOn2;
surface->Ellipse(rcCircle, fore.allocated, back.allocated);
} else if (markType == SC_MARK_ARROW) {
Point pts[] = {
Point(centreX - dimOn4, centreY - dimOn2),
Point(centreX - dimOn4, centreY + dimOn2),
Point(centreX + dimOn2 - dimOn4, centreY),
};
surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]),
fore.allocated, back.allocated);
} else if (markType == SC_MARK_ARROWDOWN) {
Point pts[] = {
Point(centreX - dimOn2, centreY - dimOn4),
Point(centreX + dimOn2, centreY - dimOn4),
Point(centreX, centreY + dimOn2 - dimOn4),
};
surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]),
fore.allocated, back.allocated);
} else if (markType == SC_MARK_PLUS) {
int armSize = dimOn2-2;
Point xpts[] = {
Point(centreX - armSize, centreY),
Point(centreX, centreY),
Point(centreX, centreY - armSize),
Point(centreX, centreY - armSize),
Point(centreX, centreY),
Point(centreX + armSize, centreY),
Point(centreX + armSize, centreY),
Point(centreX, centreY),
Point(centreX, centreY + armSize),
Point(centreX, centreY + armSize),
Point(centreX, centreY),
Point(centreX - armSize, centreY),
};
Point pts[] = {
Point(centreX - armSize, centreY - 1),
Point(centreX - 1, centreY - 1),
Point(centreX - 1, centreY - armSize),
Point(centreX + 1, centreY - armSize),
Point(centreX + 1, centreY - 1),
Point(centreX + armSize, centreY -1),
Point(centreX + armSize, centreY +1),
Point(centreX + 1, centreY + 1),
Point(centreX + 1, centreY + armSize),
Point(centreX - 1, centreY + armSize),
Point(centreX - 1, centreY + 1),
Point(centreX - armSize, centreY + 1),
};
surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]),
fore.allocated, back.allocated);
} else if (markType == SC_MARK_MINUS) {
int armSize = dimOn2-2;
Point pts[] = {
Point(centreX - armSize, centreY - 1),
Point(centreX + armSize, centreY -1),
Point(centreX + armSize, centreY +1),
Point(centreX - armSize, centreY + 1),
};
Point xpts[] = {
Point(centreX - armSize, centreY),
Point(centreX + armSize, centreY),
Point(centreX + armSize, centreY),
Point(centreX - armSize, centreY),
};
surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]),
fore.allocated, back.allocated);
} else if (markType == SC_MARK_SMALLRECT) {
PRectangle rcSmall;
rcSmall.left = rc.left + 1;
rcSmall.top = rc.top + 2;
rcSmall.right = rc.right - 1;
rcSmall.bottom = rc.bottom - 2;
surface->RectangleDraw(rcSmall, fore.allocated, back.allocated);
} else if (markType == SC_MARK_EMPTY) {
// An invisible marker so don't draw anything
} else { // SC_MARK_SHORTARROW
Point pts[] = {
Point(centreX, centreY + dimOn2),
Point(centreX + dimOn2, centreY),
Point(centreX, centreY - dimOn2),
Point(centreX, centreY - dimOn4),
Point(centreX - dimOn4, centreY - dimOn4),
Point(centreX - dimOn4, centreY + dimOn4),
Point(centreX, centreY + dimOn4),
Point(centreX, centreY + dimOn2),
};
surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]),
fore.allocated, back.allocated);
}
}

View File

@@ -1,22 +0,0 @@
// Scintilla source code edit control
// LineMarker.h - defines the look of a line marker in the margin
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef LINEMARKER_H
#define LINEMARKER_H
class LineMarker {
public:
int markType;
ColourPair fore;
ColourPair back;
LineMarker() {
markType = SC_MARK_CIRCLE;
fore = Colour(0,0,0);
back = Colour(0xff,0xff,0xff);
}
void Draw(Surface *surface, PRectangle &rc);
};
#endif

View File

@@ -1,404 +0,0 @@
// SciTE - Scintilla based Text Editor
// PropSet.cxx - a java style properties file module
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
// Maintain a dictionary of properties
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include "Platform.h"
#include "PropSet.h"
bool EqualCaseInsensitive(const char *a, const char *b) {
#if PLAT_GTK
return 0 == strcasecmp(a, b);
#elif PLAT_WIN
return 0 == stricmp(a, b);
#elif PLAT_WX
return 0 == wxStricmp(a, b);
#endif
}
// Get a line of input. If end of line escaped with '\\' then continue reading.
static bool GetFullLine(const char *&fpc, int &lenData, char *s, int len) {
bool continuation = true;
s[0] = '\0';
while ((len > 1) && lenData > 0) {
char ch = *fpc;
fpc++;
lenData--;
if ((ch == '\r') || (ch == '\n')) {
if (!continuation) {
if ((lenData > 0) && (ch == '\r') && ((*fpc) == '\n')) {
// munch the second half of a crlf
fpc++;
lenData--;
}
*s++ = '\0';
return true;
}
} else if ((ch == '\\') && (lenData > 0) && ((*fpc == '\r') || (*fpc == '\n'))) {
continuation = true;
} else {
continuation = false;
*s++ = ch;
*s = '\0';
len--;
}
}
return false;
}
PropSet::PropSet() {
superPS = 0;
size = 10;
used = 0;
vals = new char * [size];
}
PropSet::~PropSet() {
superPS = 0;
Clear();
delete []vals;
}
void PropSet::EnsureCanAddEntry() {
if (used >= size - 2) {
int newsize = size + 10;
char **newvals = new char * [newsize];
for (int i = 0; i < used; i++) {
newvals[i] = vals[i];
}
delete []vals;
vals = newvals;
size = newsize;
}
}
void PropSet::Set(const char *key, const char *val) {
EnsureCanAddEntry();
for (int i = 0; i < used; i += 2) {
if (EqualCaseInsensitive(vals[i], key)) {
// Replace current value
delete [](vals[i + 1]);
vals[i + 1] = StringDup(val);
return;
}
}
// Not found
vals[used++] = StringDup(key);
vals[used++] = StringDup(val);
}
void PropSet::Set(char *keyval) {
char *eqat = strchr(keyval, '=');
if (eqat) {
*eqat = '\0';
Set(keyval, eqat + 1);
*eqat = '=';
}
}
SString PropSet::Get(const char *key) {
for (int i = 0; i < used; i += 2) {
if (EqualCaseInsensitive(vals[i], key)) {
return vals[i + 1];
}
}
if (superPS) {
// Failed here, so try in base property set
return superPS->Get(key);
} else {
return "";
}
}
int PropSet::GetInt(const char *key, int defaultValue) {
SString val = Get(key);
if (val.length())
return Get(key).value();
else
return defaultValue;
}
bool isprefix(const char *target, const char *prefix) {
while (*target && *prefix) {
if (toupper(*target) != toupper(*prefix))
return false;
target++;
prefix++;
}
if (*prefix)
return false;
else
return true;
}
bool issuffix(const char *target, const char *suffix) {
int lentarget = strlen(target);
int lensuffix = strlen(suffix);
if (lensuffix > lentarget)
return false;
for (int i = lensuffix - 1; i >= 0; i--) {
if (toupper(target[i + lentarget - lensuffix]) != toupper(suffix[i]))
return false;
}
return true;
}
SString PropSet::GetWild(const char *keybase, const char *filename) {
for (int i = 0; i < used; i += 2) {
if (isprefix(vals[i], keybase)) {
char *orgkeyfile = vals[i] + strlen(keybase);
char *keyfile = NULL;
if (strstr(orgkeyfile, "$(") == orgkeyfile) {
char *cpendvar = strchr(orgkeyfile, ')');
if (cpendvar) {
int lenvar = cpendvar - orgkeyfile - 2; // Subtract the $()
char *var = static_cast<char *>(malloc(lenvar + 1));
strncpy(var, orgkeyfile + 2, lenvar);
var[lenvar] = '\0';
SString s = Get(var);
free(var);
keyfile = strdup(s.c_str());
}
}
char *keyptr = keyfile;
if (keyfile == NULL)
keyfile = orgkeyfile;
for (; ; ) {
char *del = strchr(keyfile, ';');
if (del == NULL)
del = keyfile + strlen(keyfile);
char delchr = *del;
*del = '\0';
if (*keyfile == '*') {
if (issuffix(filename, keyfile + 1)) {
*del = delchr;
free(keyptr);
return vals[i + 1];
}
} else if (EqualCaseInsensitive(keyfile, filename)) {
*del = delchr;
free(keyptr);
return vals[i + 1];
}
if (delchr == '\0')
break;
*del = delchr;
keyfile = del + 1;
}
free(keyptr);
if (EqualCaseInsensitive(vals[i], keybase)) {
return vals[i + 1];
}
}
}
if (superPS) {
// Failed here, so try in base property set
return superPS->GetWild(keybase, filename);
} else {
return "";
}
}
SString PropSet::GetNewExpand(const char *keybase, const char *filename) {
char *base = StringDup(GetWild(keybase, filename).c_str());
char *cpvar = strstr(base, "$(");
while (cpvar) {
char *cpendvar = strchr(cpvar, ')');
if (cpendvar) {
int lenvar = cpendvar - cpvar - 2; // Subtract the $()
char *var = new char[lenvar + 1];
strncpy(var, cpvar + 2, lenvar);
var[lenvar] = '\0';
SString val = GetWild(var, filename);
int newlenbase = strlen(base) + val.length() - lenvar;
char *newbase = new char[newlenbase];
strncpy(newbase, base, cpvar - base);
strcpy(newbase + (cpvar - base), val.c_str());
strcpy(newbase + (cpvar - base) + val.length(), cpendvar + 1);
delete []var;
delete []base;
base = newbase;
}
cpvar = strstr(base, "$(");
}
SString sret = base;
delete []base;
return sret;
}
void PropSet::Clear() {
for (int i = 0; i < used; i++) {
delete [](vals[i]);
vals[i] = 0;
}
used = 0;
}
void PropSet::ReadFromMemory(const char *data, int len) {
if (len > 0) {
const char *pd = data;
char linebuf[60000];
while (GetFullLine(pd, len, linebuf, sizeof(linebuf))) {
if (isalpha(linebuf[0]))
Set(linebuf);
}
// If there is a final line:
if (isalpha(linebuf[0]))
Set(linebuf);
}
}
void PropSet::Read(const char *filename) {
//printf("Opening properties <%s>\n", filename);
Clear();
char propsData[60000];
FILE *rcfile = fopen(filename, "rb");
if (rcfile) {
int lenFile = fread(propsData, 1, sizeof(propsData), rcfile);
fclose(rcfile);
ReadFromMemory(propsData, lenFile);
} else {
//printf("Could not open <%s>\n", filename);
}
}
static bool iswordsep(char ch, bool onlyLineEnds) {
if (!isspace(ch))
return false;
if (!onlyLineEnds)
return true;
return ch == '\r' || ch == '\n';
}
// Creates an array that points into each word in the string and puts \0 terminators
// after each word.
static char **ArrayFromWordList(char *wordlist, bool onlyLineEnds = false) {
char prev = '\n';
int words = 0;
for (int j = 0; wordlist[j]; j++) {
if (!iswordsep(wordlist[j], onlyLineEnds) && iswordsep(prev, onlyLineEnds))
words++;
prev = wordlist[j];
}
char **keywords = new char * [words + 1];
if (keywords) {
words = 0;
prev = '\0';
int len = strlen(wordlist);
for (int k = 0; k < len; k++) {
if (!iswordsep(wordlist[k], onlyLineEnds)) {
if (!prev) {
keywords[words] = &wordlist[k];
words++;
}
} else {
wordlist[k] = '\0';
}
prev = wordlist[k];
}
keywords[words] = &wordlist[len];
}
return keywords;
}
void WordList::Clear() {
if (words) {
delete []words;
delete []list;
}
words = 0;
list = 0;
len = 0;
}
void WordList::Set(const char *s) {
len = 0;
list = StringDup(s);
words = ArrayFromWordList(list, onlyLineEnds);
}
char *WordList::Allocate(int size) {
list = new char[size + 1];
list[size] = '\0';
return list;
}
void WordList::SetFromAllocated() {
len = 0;
words = ArrayFromWordList(list, onlyLineEnds);
}
// Shell sort based upon public domain C implementation by Raymond Gardner 1991
// Used here because of problems with mingw qsort.
static void SortWordList(char **words, unsigned int len) {
unsigned int gap = len / 2;
while (gap > 0) {
unsigned int i = gap;
while (i < len) {
unsigned int j = i;
char **a = words + j;
do {
j -= gap;
char **b = a;
a -= gap;
if (strcmp(*a, *b) > 0) {
char *tmp = *a;
*a = *b;
*b = tmp;
} else {
break;
}
} while (j >= gap);
i++;
}
gap = gap / 2;
}
}
bool WordList::InList(const char *s) {
if (0 == words)
return false;
if (len == 0) {
for (int i = 0; words[i][0]; i++)
len++;
SortWordList(words, len);
for (int k = 0; k < (sizeof(starts) / sizeof(starts[0])); k++)
starts[k] = -1;
for (int l = len - 1; l >= 0; l--) {
unsigned char indexChar = words[l][0];
starts[indexChar] = l;
}
}
unsigned char firstChar = s[0];
int j = starts[firstChar];
if (j >= 0) {
while (words[j][0] == firstChar) {
if (s[1] == words[j][1]) {
const char *a = words[j] + 1;
const char *b = s + 1;
while (*a && *a == *b) {
a++;
b++;
}
if (!*a && !*b)
return true;
}
j++;
}
}
return false;
}

View File

@@ -1,110 +0,0 @@
// Scintilla source code edit control
// SVector.h - a simple expandable vector
// Copyright 1998-1999 by Neil Hodgson <neilh@hare.net.au>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef SVECTOR_H
#define SVECTOR_H
// A simple expandable vector.
// T must support assignment.
// Storage not allocated for elements until an element is used.
// This makes it very lightweight unless used so is a good match for optional features.
template<class T, int sizeIncrement>
class SVector {
T *v;
unsigned int size; // Number of elements allocated
unsigned int len; // Number of elements in vector
bool allocFailure; // A memory allocation call has failed
// Internally allocate more elements than the user wants to avoid
// thrashng the memory allocator
void SizeTo(int newSize) {
if (newSize < sizeIncrement)
newSize += sizeIncrement;
else
newSize = (newSize * 3) / 2;
T* newv = new T[newSize];
if (!newv) {
allocFailure = true;
return;
}
size = newSize;
for (unsigned int i=0; i<len; i++) {
newv[i] = v[i];
}
delete []v;
v = newv;
}
public:
SVector() {
allocFailure = false;
v = 0;
len = 0;
size = 0;
}
~SVector() {
Free();
}
SVector(const SVector &other) {
allocFailure = false;
v = 0;
len = 0;
size = 0;
if (other.Length() > 0) {
SizeTo(other.Length());
if (!allocFailure) {
for (int i=0;i<other.Length();i++)
v[i] = other.v[i];
len = other.Length();
}
}
}
SVector &operator=(const SVector &other) {
if (this != &other) {
delete []v;
allocFailure = false;
v = 0;
len = 0;
size = 0;
if (other.Length() > 0) {
SizeTo(other.Length());
if (!allocFailure) {
for (int i=0;i<other.Length();i++)
v[i] = other.v[i];
}
len = other.Length();
}
}
return *this;
}
T &operator[](unsigned int i) {
if (i >= len) {
if (i >= size) {
SizeTo(i);
}
len = i+1;
}
return v[i];
}
void Free() {
delete []v;
v = 0;
size = 0;
len = 0;
}
void SetLength(unsigned int newLength) {
if (newLength > len) {
if (newLength >= size) {
SizeTo(newLength);
}
}
len = newLength;
}
int Length() const {
return len;
}
};
#endif

View File

@@ -1,398 +0,0 @@
// Scintilla source code edit control
// ScintillaBase.cxx - an enhanced subclass of Editor with calltips, autocomplete and context menu
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include "Platform.h"
#include "Scintilla.h"
#ifdef SCI_LEXER
#include "SciLexer.h"
#include "PropSet.h"
#include "Accessor.h"
#include "KeyWords.h"
#endif
#include "ContractionState.h"
#include "SVector.h"
#include "CellBuffer.h"
#include "CallTip.h"
#include "KeyMap.h"
#include "Indicator.h"
#include "LineMarker.h"
#include "Style.h"
#include "ViewStyle.h"
#include "AutoComplete.h"
#include "Document.h"
#include "Editor.h"
#include "ScintillaBase.h"
ScintillaBase::ScintillaBase() {
#ifdef SCI_LEXER
lexLanguage = SCLEX_CONTAINER;
for (int wl=0;wl<numWordLists;wl++)
keyWordLists[wl] = new WordList;
#endif
}
ScintillaBase::~ScintillaBase() {}
void ScintillaBase::Finalise() {
popup.Destroy();
}
void ScintillaBase::RefreshColourPalette(Palette &pal, bool want) {
Editor::RefreshColourPalette(pal, want);
ct.RefreshColourPalette(pal, want);
}
void ScintillaBase::AddChar(char ch) {
bool acActiveBeforeCharAdded = ac.Active();
Editor::AddChar(ch);
if (acActiveBeforeCharAdded)
AutoCompleteChanged(ch);
}
void ScintillaBase::Command(int cmdId) {
switch (cmdId) {
case idAutoComplete: // Nothing to do
break;
case idCallTip: // Nothing to do
break;
case idcmdUndo:
WndProc(WM_UNDO, 0, 0);
break;
case idcmdRedo:
WndProc(SCI_REDO, 0, 0);
break;
case idcmdCut:
WndProc(WM_CUT, 0, 0);
break;
case idcmdCopy:
WndProc(WM_COPY, 0, 0);
break;
case idcmdPaste:
WndProc(WM_PASTE, 0, 0);
break;
case idcmdDelete:
WndProc(WM_CLEAR, 0, 0);
break;
case idcmdSelectAll:
WndProc(SCI_SELECTALL, 0, 0);
break;
}
}
int ScintillaBase::KeyCommand(UINT iMessage) {
// Most key commands cancel autocompletion mode
if (ac.Active()) {
switch (iMessage) {
// Except for these
case SCI_LINEDOWN:
AutoCompleteMove(1);
return 0;
case SCI_LINEUP:
AutoCompleteMove( -1);
return 0;
case SCI_PAGEDOWN:
AutoCompleteMove(5);
return 0;
case SCI_PAGEUP:
AutoCompleteMove( -5);
return 0;
case SCI_VCHOME:
AutoCompleteMove( -5000);
return 0;
case SCI_LINEEND:
AutoCompleteMove(5000);
return 0;
case SCI_DELETEBACK:
DelCharBack();
AutoCompleteChanged();
EnsureCaretVisible();
return 0;
case SCI_TAB:
AutoCompleteCompleted();
return 0;
default:
ac.Cancel();
}
}
if (ct.inCallTipMode) {
if (
(iMessage != SCI_CHARLEFT) &&
(iMessage != SCI_CHARLEFTEXTEND) &&
(iMessage != SCI_CHARRIGHT) &&
(iMessage != SCI_CHARLEFTEXTEND) &&
(iMessage != SCI_EDITTOGGLEOVERTYPE) &&
(iMessage != SCI_DELETEBACK)
) {
ct.CallTipCancel();
}
if (iMessage == SCI_DELETEBACK) {
if (currentPos <= ct.posStartCallTip) {
ct.CallTipCancel();
}
}
}
return Editor::KeyCommand(iMessage);
}
void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
//Platform::DebugPrintf("AutoCOmplete %s\n", list);
ct.CallTipCancel();
ac.Start(wDraw, idAutoComplete, currentPos, lenEntered);
PRectangle rcClient = GetClientRectangle();
Point pt = LocationFromPosition(currentPos-lenEntered);
//Platform::DebugPrintf("Auto complete %x\n", lbAutoComplete);
int heightLB = 100;
int widthLB = 100;
if (pt.x >= rcClient.right - widthLB) {
HorizontalScrollTo(xOffset + pt.x - rcClient.right + widthLB);
Redraw();
pt = LocationFromPosition(currentPos);
}
PRectangle rcac;
rcac.left = pt.x - 5;
if (pt.y >= rcClient.bottom - heightLB && // Wont fit below.
pt.y >= (rcClient.bottom + rcClient.top) / 2) { // and there is more room above.
rcac.top = pt.y - heightLB;
if (rcac.top < 0) {
heightLB += rcac.top;
rcac.top = 0;
}
} else {
rcac.top = pt.y + vs.lineHeight;
}
rcac.right = rcac.left + widthLB;
rcac.bottom = Platform::Minimum(rcac.top + heightLB, rcClient.bottom);
ac.lb.SetPositionRelative(rcac, wMain);
ac.lb.SetFont(vs.styles[0].font);
int maxStrLen = ac.SetList(list);
// Fiddle the position of the list so it is right next to the target and wide enough for all its strings
PRectangle rcList = ac.lb.GetPosition();
int heightAlloced = rcList.bottom - rcList.top;
// Make an allowance for large strings in list
rcList.left = pt.x - 5;
rcList.right = rcList.left + Platform::Maximum(widthLB, maxStrLen * 8 + 16);
if (pt.y >= rcClient.bottom - heightLB && // Wont fit below.
pt.y >= (rcClient.bottom + rcClient.top) / 2) { // and there is more room above.
rcList.top = pt.y - heightAlloced;
} else {
rcList.top = pt.y + vs.lineHeight;
}
rcList.bottom = rcList.top + heightAlloced;
ac.lb.SetPositionRelative(rcList, wMain);
//lbAutoComplete.SetPosition(rcList);
ac.Show();
}
void ScintillaBase::AutoCompleteCancel() {
ac.Cancel();
}
void ScintillaBase::AutoCompleteMove(int delta) {
ac.Move(delta);
}
void ScintillaBase::AutoCompleteChanged(char ch) {
if (currentPos <= ac.posStart) {
ac.Cancel();
} else if (ac.IsStopChar(ch)) {
ac.Cancel();
} else {
char wordCurrent[1000];
int i;
int startWord = ac.posStart - ac.startLen;
for (i = startWord; i < currentPos; i++)
wordCurrent[i - startWord] = pdoc->CharAt(i);
wordCurrent[i - startWord] = '\0';
ac.Select(wordCurrent);
}
}
void ScintillaBase::AutoCompleteCompleted() {
int item = ac.lb.GetSelection();
char selected[200];
if (item != -1) {
ac.lb.GetValue(item, selected, sizeof(selected));
}
ac.Cancel();
if (currentPos != ac.posStart) {
pdoc->DeleteChars(ac.posStart, currentPos - ac.posStart);
}
SetEmptySelection(ac.posStart);
if (item != -1) {
pdoc->InsertString(currentPos, selected + ac.startLen);
SetEmptySelection(currentPos + strlen(selected + ac.startLen));
}
}
void ScintillaBase::ContextMenu(Point pt) {
popup.CreatePopUp();
AddToPopUp("Undo", idcmdUndo, pdoc->CanUndo());
AddToPopUp("Redo", idcmdRedo, pdoc->CanRedo());
AddToPopUp("");
AddToPopUp("Cut", idcmdCut, currentPos != anchor);
AddToPopUp("Copy", idcmdCopy, currentPos != anchor);
AddToPopUp("Paste", idcmdPaste, WndProc(EM_CANPASTE, 0, 0));
AddToPopUp("Delete", idcmdDelete, currentPos != anchor);
AddToPopUp("");
AddToPopUp("Select All", idcmdSelectAll);
popup.Show(pt, wMain);
}
void ScintillaBase::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt) {
AutoCompleteCancel();
ct.CallTipCancel();
Editor::ButtonDown(pt, curTime, shift, ctrl, alt);
}
#ifdef SCI_LEXER
void ScintillaBase::Colourise(int start, int end) {
int lengthDoc = Platform::SendScintilla(wMain.GetID(), SCI_GETLENGTH, 0, 0);
if (end == -1)
end = lengthDoc;
int len = end - start;
StylingContext styler(wMain.GetID(), props);
int styleStart = 0;
if (start > 0)
styleStart = styler.StyleAt(start - 1);
styler.SetCodePage(pdoc->dbcsCodePage);
LexerModule::Colourise(start, len, styleStart, lexLanguage, keyWordLists, styler);
styler.Flush();
}
#endif
void ScintillaBase::NotifyStyleNeeded(int endStyleNeeded) {
#ifdef SCI_LEXER
if (lexLanguage != SCLEX_CONTAINER) {
int endStyled = Platform::SendScintilla(wMain.GetID(), SCI_GETENDSTYLED, 0, 0);
int lineEndStyled = Platform::SendScintilla(wMain.GetID(), EM_LINEFROMCHAR, endStyled, 0);
endStyled = Platform::SendScintilla(wMain.GetID(), EM_LINEINDEX, lineEndStyled, 0);
Colourise(endStyled, endStyleNeeded);
return;
}
#endif
Editor::NotifyStyleNeeded(endStyleNeeded);
}
LRESULT ScintillaBase::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
switch (iMessage) {
case SCI_AUTOCSHOW:
AutoCompleteStart(wParam, reinterpret_cast<const char *>(lParam));
break;
case SCI_AUTOCCANCEL:
AutoCompleteCancel();
break;
case SCI_AUTOCACTIVE:
return ac.Active();
case SCI_AUTOCPOSSTART:
return ac.posStart;
case SCI_AUTOCCOMPLETE:
AutoCompleteCompleted();
break;
case SCI_AUTOCSTOPS:
ac.SetStopChars(reinterpret_cast<char *>(lParam));
break;
case SCI_CALLTIPSHOW: {
AutoCompleteCancel();
if (!ct.wCallTip.Created()) {
PRectangle rc = ct.CallTipStart(currentPos, LocationFromPosition(wParam),
reinterpret_cast<char *>(lParam),
vs.styles[0].fontName, vs.styles[0].size);
// If the call-tip window would be out of the client
// space, adjust so it displays above the text.
PRectangle rcClient = GetClientRectangle();
if (rc.bottom > rcClient.bottom) {
int offset = vs.lineHeight + rc.Height();
rc.top -= offset;
rc.bottom -= offset;
}
// Now display the window.
CreateCallTipWindow(rc);
ct.wCallTip.SetPositionRelative(rc, wDraw);
ct.wCallTip.Show();
}
}
break;
case SCI_CALLTIPCANCEL:
ct.CallTipCancel();
break;
case SCI_CALLTIPACTIVE:
return ct.inCallTipMode;
case SCI_CALLTIPPOSSTART:
return ct.posStartCallTip;
case SCI_CALLTIPSETHLT:
ct.SetHighlight(wParam, lParam);
break;
case SCI_CALLTIPSETBACK:
ct.colourBG = Colour(wParam);
InvalidateStyleRedraw();
break;
#ifdef SCI_LEXER
case SCI_SETLEXER:
lexLanguage = wParam;
break;
case SCI_GETLEXER:
return lexLanguage;
case SCI_COLOURISE:
Colourise(wParam, lParam);
break;
case SCI_SETPROPERTY:
props.Set(reinterpret_cast<const char *>(wParam),
reinterpret_cast<const char *>(lParam));
break;
case SCI_SETKEYWORDS:
if ((wParam >= 0) && (wParam < numWordLists)) {
keyWordLists[wParam]->Clear();
keyWordLists[wParam]->Set(reinterpret_cast<const char *>(lParam));
}
break;
#endif
default:
return Editor::WndProc(iMessage, wParam, lParam);
}
return 0l;
}

View File

@@ -1,68 +0,0 @@
// Scintilla source code edit control
// ScintillaBase.h - defines an enhanced subclass of Editor with calltips, autocomplete and context menu
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef SCINTILLABASE_H
#define SCINTILLABASE_H
class ScintillaBase : public Editor {
protected:
// Enumeration of commands and child windows
enum {
idCallTip=1,
idAutoComplete=2,
idcmdUndo=10,
idcmdRedo=11,
idcmdCut=12,
idcmdCopy=13,
idcmdPaste=14,
idcmdDelete=15,
idcmdSelectAll=16
};
Menu popup;
AutoComplete ac;
CallTip ct;
#ifdef SCI_LEXER
int lexLanguage;
PropSet props;
enum {numWordLists=5};
WordList *keyWordLists[numWordLists];
void Colourise(int start, int end);
#endif
ScintillaBase();
virtual ~ScintillaBase();
virtual void Initialise() = 0;
virtual void Finalise() = 0;
virtual void RefreshColourPalette(Palette &pal, bool want);
virtual void AddChar(char ch);
void Command(int cmdId);
virtual int KeyCommand(UINT iMessage);
void AutoCompleteStart(int lenEntered, const char *list);
void AutoCompleteCancel();
void AutoCompleteMove(int delta);
void AutoCompleteChanged(char ch=0);
void AutoCompleteCompleted();
virtual void CreateCallTipWindow(PRectangle rc) = 0;
virtual void AddToPopUp(const char *label, int cmd=0, bool enabled=true) = 0;
void ContextMenu(Point pt);
virtual void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt);
virtual void NotifyStyleNeeded(int endStyleNeeded);
public:
// Public so scintilla_send_message can use it
virtual LRESULT WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam);
};
#endif

View File

@@ -1,101 +0,0 @@
// Scintilla source code edit control
// Style.cxx - defines the font and colour style for a class of text
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <string.h>
#include "Platform.h"
#include "Style.h"
Style::Style() {
aliasOfDefaultFont = true;
Clear(Colour(0,0,0), Colour(0xff,0xff,0xff),
Platform::DefaultFontSize(), 0,
false, false, false);
}
Style::~Style() {
if (aliasOfDefaultFont)
font.SetID(0);
else
font.Release();
aliasOfDefaultFont = false;
}
Style &Style::operator=(const Style &source) {
if (this == &source)
return *this;
Clear(Colour(0,0,0), Colour(0xff,0xff,0xff),
0, 0,
false, false, false);
fore.desired = source.fore.desired;
back.desired = source.back.desired;
bold = source.bold;
italic = source.italic;
size = source.size;
eolFilled = source.eolFilled;
return *this;
}
void Style::Clear(Colour fore_, Colour back_, int size_, const char *fontName_,
bool bold_, bool italic_, bool eolFilled_) {
fore.desired = fore_;
back.desired = back_;
bold = bold_;
italic = italic_;
size = size_;
fontName = fontName_;
eolFilled = eolFilled_;
if (aliasOfDefaultFont)
font.SetID(0);
else
font.Release();
aliasOfDefaultFont = false;
}
bool Style::EquivalentFontTo(const Style *other) const {
if (bold != other->bold ||
italic != other->italic ||
size != other->size)
return false;
if (fontName == other->fontName)
return true;
if (!fontName)
return false;
if (!other->fontName)
return false;
return strcmp(fontName, other->fontName) == 0;
}
void Style::Realise(Surface &surface, int zoomLevel, Style *defaultStyle) {
int sizeZoomed = size + zoomLevel;
if (sizeZoomed <= 2) // Hangs if sizeZoomed <= 1
sizeZoomed = 2;
if (aliasOfDefaultFont)
font.SetID(0);
else
font.Release();
int deviceHeight = (sizeZoomed * surface.LogPixelsY()) / 72;
aliasOfDefaultFont = defaultStyle &&
(EquivalentFontTo(defaultStyle) || !fontName);
if (aliasOfDefaultFont) {
font.SetID(defaultStyle->font.GetID());
} else if (fontName) {
font.Create(fontName, deviceHeight, bold, italic);
} else {
font.SetID(0);
}
ascent = surface.Ascent(font);
descent = surface.Descent(font);
// Probably more typographically correct to include leading
// but that means more complex drawing as leading must be erased
//lineHeight = surface.ExternalLeading() + surface.Height();
externalLeading = surface.ExternalLeading(font);
lineHeight = surface.Height(font);
aveCharWidth = surface.AverageCharWidth(font);
spaceWidth = surface.WidthChar(font, ' ');
}

View File

@@ -1,39 +0,0 @@
// Scintilla source code edit control
// Style.h - defines the font and colour style for a class of text
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef STYLE_H
#define STYLE_H
class Style {
public:
ColourPair fore;
ColourPair back;
bool aliasOfDefaultFont;
bool bold;
bool italic;
int size;
const char *fontName;
bool eolFilled;
Font font;
unsigned int lineHeight;
unsigned int ascent;
unsigned int descent;
unsigned int externalLeading;
unsigned int aveCharWidth;
unsigned int spaceWidth;
Style();
~Style();
Style &operator=(const Style &source);
void Clear(Colour fore_, Colour back_,
int size_,
const char *fontName_,
bool bold_, bool italic_, bool eolFilled_);
bool EquivalentFontTo(const Style *other) const;
void Realise(Surface &surface, int zoomLevel, Style *defaultStyle=0);
};
#endif

View File

@@ -1,227 +0,0 @@
// Scintilla source code edit control
// ViewStyle.cxx - store information on how the document is to be viewed
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <string.h>
#include "Platform.h"
#include "Scintilla.h"
#include "Indicator.h"
#include "LineMarker.h"
#include "Style.h"
#include "ViewStyle.h"
MarginStyle::MarginStyle() :
symbol(false), width(16), mask(0xffffffff), sensitive(false) {
}
// A list of the fontnames - avoids wasting space in each style
FontNames::FontNames() {
max = 0;
}
FontNames::~FontNames() {
Clear();
}
void FontNames::Clear() {
for (int i=0;i<max;i++) {
delete []names[i];
}
max = 0;
}
const char *FontNames::Save(const char *name) {
if (!name)
return 0;
for (int i=0;i<max;i++) {
if (strcmp(names[i], name) == 0) {
return names[i];
}
}
names[max] = new char[strlen(name) + 1];
strcpy(names[max], name);
max++;
return names[max-1];
}
ViewStyle::ViewStyle() {
Init();
}
ViewStyle::ViewStyle(const ViewStyle &source) {
Init();
for (unsigned int sty=0;sty<(sizeof(styles)/sizeof(styles[0]));sty++) {
styles[sty] = source.styles[sty];
// Can't just copy fontname as its lifetime is relative to its owning ViewStyle
styles[sty].fontName = fontNames.Save(source.styles[sty].fontName);
}
for (int mrk=0;mrk<=MARKER_MAX;mrk++) {
markers[mrk] = source.markers[mrk];
}
for (int ind=0;ind<=INDIC_MAX;ind++) {
indicators[ind] = source.indicators[ind];
}
selforeset = source.selforeset;
selforeground.desired = source.selforeground.desired;
selbackset = source.selbackset;
selbackground.desired = source.selbackground.desired;
selbar.desired = source.selbar.desired;
selbarlight.desired = source.selbarlight.desired;
caretcolour.desired = source.caretcolour.desired;
edgecolour.desired = source.edgecolour.desired;
leftMarginWidth = source.leftMarginWidth;
rightMarginWidth = source.rightMarginWidth;
for (int i=0;i < margins; i++) {
ms[i] = source.ms[i];
}
symbolMargin = source.symbolMargin;
maskInLine = source.maskInLine;
fixedColumnWidth = source.fixedColumnWidth;
zoomLevel = source.zoomLevel;
viewWhitespace = source.viewWhitespace;
viewEOL = source.viewEOL;
showMarkedLines = source.showMarkedLines;
}
ViewStyle::~ViewStyle() {
}
void ViewStyle::Init() {
fontNames.Clear();
ResetDefaultStyle();
indicators[0].style = INDIC_SQUIGGLE;
indicators[0].fore = Colour(0, 0x7f, 0);
indicators[1].style = INDIC_TT;
indicators[1].fore = Colour(0, 0, 0xff);
indicators[2].style = INDIC_PLAIN;
indicators[2].fore = Colour(0xff, 0, 0);
lineHeight = 1;
maxAscent = 1;
maxDescent = 1;
aveCharWidth = 8;
spaceWidth = 8;
selforeset = false;
selforeground.desired = Colour(0xff, 0, 0);
selbackset = true;
selbackground.desired = Colour(0xc0, 0xc0, 0xc0);
selbar.desired = Platform::Chrome();
selbarlight.desired = Platform::ChromeHighlight();
styles[STYLE_LINENUMBER].fore.desired = Colour(0, 0, 0);
styles[STYLE_LINENUMBER].back.desired = Platform::Chrome();
//caretcolour.desired = Colour(0xff, 0, 0);
caretcolour.desired = Colour(0, 0, 0);
edgecolour.desired = Colour(0xc0, 0xc0, 0xc0);
leftMarginWidth = 1;
rightMarginWidth = 1;
ms[0].symbol = false;
ms[0].width = 0;
ms[0].mask = 0;
ms[1].symbol = true;
ms[1].width = 16;
ms[1].mask = ~SC_MASK_FOLDERS;
ms[2].symbol = true;
ms[2].width = 14; // Nice width for arrows
ms[2].mask = SC_MASK_FOLDERS;
ms[2].width = 0; // Nice width for arrows
ms[2].mask = 0;
fixedColumnWidth = leftMarginWidth;
symbolMargin = false;
maskInLine = 0xffffffff;
for (int margin=0; margin < margins; margin++) {
fixedColumnWidth += ms[margin].width;
symbolMargin = symbolMargin || ms[margin].symbol;
if (ms[margin].width > 0)
maskInLine &= ~ms[margin].mask;
}
zoomLevel = 0;
viewWhitespace = false;
viewEOL = false;
showMarkedLines = true;
}
void ViewStyle::RefreshColourPalette(Palette &pal, bool want) {
unsigned int i;
for (i=0;i<(sizeof(styles)/sizeof(styles[0]));i++) {
pal.WantFind(styles[i].fore, want);
pal.WantFind(styles[i].back, want);
}
for (i=0;i<(sizeof(indicators)/sizeof(indicators[0]));i++) {
pal.WantFind(indicators[i].fore, want);
}
for (i=0;i<(sizeof(markers)/sizeof(markers[0]));i++) {
pal.WantFind(markers[i].fore, want);
pal.WantFind(markers[i].back, want);
}
pal.WantFind(selforeground, want);
pal.WantFind(selbackground, want);
pal.WantFind(selbar, want);
pal.WantFind(selbarlight, want);
pal.WantFind(caretcolour, want);
pal.WantFind(edgecolour, want);
}
void ViewStyle::Refresh(Surface &surface) {
selbar.desired = Platform::Chrome();
selbarlight.desired = Platform::ChromeHighlight();
styles[STYLE_DEFAULT].Realise(surface, zoomLevel);
maxAscent = styles[STYLE_DEFAULT].ascent;
maxDescent = styles[STYLE_DEFAULT].descent;
for (unsigned int i=0;i<(sizeof(styles)/sizeof(styles[0]));i++) {
if (i != STYLE_DEFAULT) {
styles[i].Realise(surface, zoomLevel, &styles[STYLE_DEFAULT]);
if (maxAscent < styles[i].ascent)
maxAscent = styles[i].ascent;
if (maxDescent < styles[i].descent)
maxDescent = styles[i].descent;
}
}
lineHeight = maxAscent + maxDescent;
aveCharWidth = styles[STYLE_DEFAULT].aveCharWidth;
spaceWidth = styles[STYLE_DEFAULT].spaceWidth;
fixedColumnWidth = leftMarginWidth;
symbolMargin = false;
maskInLine = 0xffffffff;
for (int margin=0; margin < margins; margin++) {
fixedColumnWidth += ms[margin].width;
symbolMargin = symbolMargin || ms[margin].symbol;
if (ms[margin].width > 0)
maskInLine &= ~ms[margin].mask;
}
}
void ViewStyle::ResetDefaultStyle() {
styles[STYLE_DEFAULT].Clear(Colour(0,0,0), Colour(0xff,0xff,0xff),
Platform::DefaultFontSize(), fontNames.Save(Platform::DefaultFont()),
false, false, false);
}
void ViewStyle::ClearStyles() {
// Reset all styles to be like the default style
for (unsigned int i=0;i<(sizeof(styles)/sizeof(styles[0]));i++) {
if (i != STYLE_DEFAULT) {
styles[i].Clear(
styles[STYLE_DEFAULT].fore.desired,
styles[STYLE_DEFAULT].back.desired,
styles[STYLE_DEFAULT].size,
styles[STYLE_DEFAULT].fontName,
styles[STYLE_DEFAULT].bold,
styles[STYLE_DEFAULT].italic,
styles[STYLE_DEFAULT].eolFilled);
}
}
styles[STYLE_LINENUMBER].back.desired = Platform::Chrome();
}
void ViewStyle::SetStyleFontName(int styleIndex, const char *name) {
styles[styleIndex].fontName = fontNames.Save(name);
}

View File

@@ -1,72 +0,0 @@
// Scintilla source code edit control
// ViewStyle.h - store information on how the document is to be viewed
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef VIEWSTYLE_H
#define VIEWSTYLE_H
class MarginStyle {
public:
bool symbol;
int width;
int mask;
bool sensitive;
MarginStyle();
};
class FontNames {
private:
char *names[STYLE_MAX + 1];
int max;
public:
FontNames();
~FontNames();
void Clear();
const char *Save(const char *name);
};
class ViewStyle {
public:
FontNames fontNames;
Style styles[STYLE_MAX + 1];
LineMarker markers[MARKER_MAX + 1];
Indicator indicators[INDIC_MAX + 1];
int lineHeight;
unsigned int maxAscent;
unsigned int maxDescent;
unsigned int aveCharWidth;
unsigned int spaceWidth;
bool selforeset;
ColourPair selforeground;
bool selbackset;
ColourPair selbackground;
ColourPair selbar;
ColourPair selbarlight;
// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin
int leftMarginWidth; // Spacing margin on left of text
int rightMarginWidth; // Spacing margin on left of text
enum { margins=3 };
bool symbolMargin;
int maskInLine; // Mask for markers to be put into text because there is nowhere for them to go in margin
MarginStyle ms[margins];
int fixedColumnWidth;
int zoomLevel;
bool viewWhitespace;
bool viewEOL;
bool showMarkedLines;
ColourPair caretcolour;
ColourPair edgecolour;
ViewStyle();
ViewStyle(const ViewStyle &source);
~ViewStyle();
void Init();
void RefreshColourPalette(Palette &pal, bool want);
void Refresh(Surface &surface);
void ResetDefaultStyle();
void ClearStyles();
void SetStyleFontName(int styleIndex, const char *name);
};
#endif

File diff suppressed because it is too large Load Diff

85
distrib/msw/docsrc.rsp Normal file
View File

@@ -0,0 +1,85 @@
docs/latex/wx/*.tex
docs/latex/wx/*.sty
docs/latex/wx/*.bib
docs/latex/wx/*.hpj
docs/latex/wx/*.ini
docs/latex/wx/*.txt
docs/latex/wx/*.cnt
docs/latex/wx/*.eps
docs/latex/wx/*.bmp
docs/latex/wx/*.gif
docs/latex/wx/*.wmf
docs/latex/porting/*.tex
docs/latex/porting/*.sty
docs/latex/porting/*.bib
docs/latex/porting/*.hpj
docs/latex/porting/*.ini
docs/latex/porting/*.txt
docs/latex/porting/*.cnt
docs/latex/porting/*.eps
docs/latex/porting/*.gif
docs/latex/porting/*.bmp
utils/wxhelp/docs/*.tex
utils/wxhelp/docs/*.txt
utils/wxhelp/docs/*.hpj
utils/wxhelp/docs/*.ini
utils/wxhelp/docs/*.bmp
utils/wxhelp/docs/*.wmf
utils/wxhelp/docs/*.gif
utils/tex2rtf/docs/*.tex
utils/tex2rtf/docs/*.txt
utils/tex2rtf/docs/*.hpj
utils/tex2rtf/docs/*.bib
utils/tex2rtf/docs/*.ini
utils/tex2rtf/docs/*.sty
utils/tex2rtf/docs/*.bmp
utils/tex2rtf/docs/*.shg
utils/tex2rtf/docs/*.wmf
utils/tex2rtf/docs/*.gif
utils/wxtree/docs/*.tex
utils/wxtree/docs/*.ini
utils/wxtree/docs/*.bib
utils/wxtree/docs/*.txt
utils/wxtree/docs/*.hpj
utils/wxtree/docs/*.bmp
utils/wxtree/docs/*.wmf
utils/wxtree/docs/*.gif
utils/wxgraph/docs/*.tex
utils/wxgraph/docs/*.ini
utils/wxgraph/docs/*.bib
utils/wxgraph/docs/*.txt
utils/wxgraph/docs/*.hpj
utils/wxgraph/docs/*.bmp
utils/wxgraph/docs/*.wmf
utils/wxgraph/docs/*.gif
utils/mfutils/docs/*.tex
utils/mfutils/docs/*.txt
utils/mfutils/docs/*.hpj
utils/mfutils/docs/*.wmf
utils/mfutils/docs/*.bmp
utils/wxprop/docs/*.txt
utils/wxprop/docs/*.hpj
utils/wxprop/docs/*.tex
utils/wxprop/docs/*.ini
utils/wxprop/docs/*.eps
utils/wxprop/docs/*.bmp
utils/wxprop/docs/*.wmf
utils/wxprop/docs/*.gif
utils/dialoged/docs/*.txt
utils/dialoged/docs/*.hpj
utils/dialoged/docs/*.tex
utils/dialoged/docs/*.ini
utils/dialoged/docs/*.eps
utils/dialoged/docs/*.bmp
utils/dialoged/docs/*.wmf
utils/dialoged/docs/*.gif

540
distrib/msw/generic.rsp Normal file
View File

@@ -0,0 +1,540 @@
distrib/*.*
docs/readme.txt
docs/install.txt
docs/release.txt
docs/changes.txt
docs/upgrade.txt
docs/todo.txt
docs/licence.txt
docs/symbols.txt
src/common/*.cpp
src/common/dosyacc.c
src/common/doslex.c
src/common/vmsyacc.c
src/common/vmslex.c
src/common/extended.c
src/common/*.l
src/common/*.y
src/common/*.inc
src/generic/*.cpp
src/generic/*.c
src/generic/*.inc
src/png/*.c
src/png/*.h
src/png/makefile.*
src/png/INSTALL
src/png/CHANGES
src/png/README
src/png/TODO
src/png/*.1
src/png/*.3
src/png/*.5
src/png/scripts/*
src/zlib/*.c
src/zlib/*.h
src/zlib/INDEX
src/zlib/README
src/zlib/ChangeLog
src/zlib/configure
src/zlib/*.txt
src/zlib/makefile.*
src/zlib/*.com
src/zlib/*.3
src/zlib/*.mms
include/wx/*.h
include/wx/wx_setup.vms
include/wx/common/*.h
include/wx/generic/*.h
lib/dummy
bin/*.*
tools/gettext/*.*
bitmaps/xpm/16x16/*.*
bitmaps/xpm/32x32/*.*
bitmaps/xpm/64x64/*.*
bitmaps/xpm/misc/*.*
bitmaps/*.*
bitmaps/bmp/16x15/*.*
bitmaps/bmp/10x8/*.*
bitmaps/ico/32x32/*.*
afm/*.*
utils/*.txt
utils/make*.*
utils/xpmshow/src/makefile.*
utils/xpmshow/src/*.cpp
utils/xpmshow/src/*.h
utils/xpmshow/src/*.def
utils/xpmshow/src/*.rc
utils/xpmshow/src/*.xpm
utils/xpmshow/src/*.bmp
utils/xpmshow/src/*.ico
utils/wxhelp/src/*.cpp
utils/wxhelp/src/*.h
utils/wxhelp/src/makefile.*
utils/wxhelp/src/*.xbm
utils/wxhelp/src/*.txt
utils/wxhelp/src/*.ico
utils/wxhelp/src/*.def
utils/wxhelp/src/*.rc
utils/tex2rtf/src/wxwin/*.*
utils/tex2rtf/src/*.cpp
utils/tex2rtf/src/*.h
utils/tex2rtf/src/make*.*
utils/tex2rtf/src/*.xbm
utils/tex2rtf/src/*.sty
utils/tex2rtf/src/*.ini
utils/tex2rtf/src/*.inf
utils/tex2rtf/lib/dummy
utils/tex2rtf/src/*.bmp
utils/tex2rtf/src/*.ico
utils/tex2rtf/src/*.def
utils/tex2rtf/src/*.rc
utils/tex2rtf/tools/lacheck/*.*
utils/tex2rtf/tools/tcheck/*.awk
utils/tex2rtf/tools/tcheck/*.pl
utils/tex2rtf/tools/tcheck/*.bat
utils/wxtree/src/*.cpp
utils/wxtree/src/*.h
utils/wxtree/src/makefile.*
utils/wxtree/src/*.xbm
utils/wxtree/lib/dummy
utils/wxtree/src/*.ico
utils/wxtree/src/*.def
utils/wxtree/src/*.rc
utils/wxgraph/src/*.cpp
utils/wxgraph/src/*.c
utils/wxgraph/src/*.h
utils/wxgraph/src/makefile.*
utils/wxgraph/src/*.xbm
utils/wxgraph/lib/dummy
utils/wxgraph/src/*.ico
utils/wxgraph/src/*.def
utils/wxgraph/src/*.rc
utils/mfutils/src/*.cpp
utils/mfutils/src/*.h
utils/mfutils/src/*.rc
utils/mfutils/src/*.def
utils/mfutils/src/makefile.*
utils/mfutils/src/*.txt
utils/mfutils/lib/dummy
utils/mfutils/src/*.ico
utils/mfutils/src/*.def
utils/mfutils/src/*.bmp
utils/mfutils/src/*.ico
utils/rcparser/src/*.cpp
utils/rcparser/src/*.c
utils/rcparser/src/*.h
utils/rcparser/src/makefile.*
utils/rcparser/src/*.xbm
utils/rcparser/lib/dummy
utils/rcparser/src/*.ico
utils/rcparser/src/*.def
utils/rcparser/src/*.rc
utils/rcparser/src/*.rh
utils/colours/*.h
utils/colours/*.cpp
utils/colours/*.def
utils/colours/*.rc
utils/colours/makefile.*
utils/colours/*.xbm
utils/colours/*.txt
utils/wxprop/src/*.h
utils/wxprop/src/*.cpp
utils/wxprop/src/*.def
utils/wxprop/src/*.rc
utils/wxprop/src/makefile.*
utils/wxprop/src/*.xbm
utils/wxprop/src/*.txt
utils/wxprop/src/*.ico
utils/wxprop/src/*.bmp
utils/wxprop/lib/dummy
utils/dialoged/src/bitmaps/*.xbm
utils/dialoged/src/*.h
utils/dialoged/src/*.cpp
utils/dialoged/src/*.def
utils/dialoged/src/*.rc
utils/dialoged/src/makefile.*
utils/dialoged/src/*.xbm
utils/dialoged/src/*.txt
utils/dialoged/src/*.inf
utils/dialoged/test/*.h
utils/dialoged/src/*.ico
utils/dialoged/src/*.prj
utils/dialoged/src/*.bmp
utils/dialoged/src/bitmaps/*.bmp
utils/dialoged/src/bitmaps/*.ico
utils/dialoged/test/*.cpp
utils/dialoged/test/*.def
utils/dialoged/test/*.rc
utils/dialoged/test/makefile.*
utils/dialoged/lib/dummy
utils/dialoged/test/*.ico
utils/dialoged/test/*.prj
utils/dialoged/test/*.bmp
samples/*.txt
samples/makefile.*
samples/hello/*.cpp
samples/hello/*.h
samples/hello/*.def
samples/hello/makefile.*
samples/hello/*.xbm
samples/hello/*.txt
samples/hello/*.ico
samples/hello/*.bmp
samples/hello/*.rc
samples/hello/*.wav
samples/dynamic/*.cpp
samples/dynamic/*.h
samples/dynamic/*.def
samples/dynamic/makefile.*
samples/dynamic/*.xbm
samples/dynamic/*.txt
samples/dynamic/*.ico
samples/dynamic/*.bmp
samples/dynamic/*.rc
samples/dynamic/*.wav
samples/bombs/*.cpp
samples/bombs/*.h
samples/bombs/*.def
samples/bombs/makefile.*
samples/bombs/*.xbm
samples/bombs/*.txt
samples/bombs/*.ico
samples/bombs/*.bmp
samples/bombs/*.rc
samples/ipc/*.cpp
samples/ipc/*.h
samples/ipc/*.def
samples/ipc/makefile.*
samples/ipc/*.xbm
samples/ipc/*.ico
samples/ipc/*.rc
samples/types/*.cpp
samples/types/*.h
samples/types/*.def
samples/types/*.rc
samples/types/*.txt
samples/types/makefile.*
samples/types/*.xbm
samples/types/*.ico
samples/resource/*.cpp
samples/resource/*.h
samples/resource/*.def
samples/resource/*.rc
samples/resource/*.txt
samples/resource/*.wxr
samples/resource/makefile.*
samples/resource/*.xbm
samples/resource/*.ico
samples/animate/*.cpp
samples/animate/*.h
samples/animate/*.def
samples/animate/makefile.*
samples/animate/*.xbm
samples/animate/*.ico
samples/animate/*.rc
samples/mdi/*.cpp
samples/mdi/*.h
samples/mdi/*.def
samples/mdi/makefile.*
samples/mdi/*.xbm
samples/mdi/*.ico
samples/mdi/*.rc
samples/mdi/bitmaps/*.bmp
samples/mdi/bitmaps/*.ico
samples/minimal/*.cpp
samples/minimal/*.h
samples/minimal/*.def
samples/minimal/makefile.*
samples/minimal/*.xbm
samples/minimal/*.ico
samples/minimal/*.rc
samples/controls/*.cpp
samples/controls/*.h
samples/controls/*.def
samples/controls/makefile.*
samples/controls/*.xbm
samples/controls/*.ico
samples/controls/*.bmp
samples/controls/*.rc
samples/fractal/*.cpp
samples/fractal/*.h
samples/fractal/*.def
samples/fractal/makefile.*
samples/fractal/*.xbm
samples/fractal/*.ico
samples/fractal/*.rc
samples/layout/*.cpp
samples/layout/*.h
samples/layout/*.def
samples/layout/makefile.*
samples/layout/*.xbm
samples/layout/*.ico
samples/layout/*.rc
samples/layout/*.bmp
samples/layout/*.xpm
samples/printing/*.cpp
samples/printing/*.h
samples/printing/*.def
samples/printing/makefile.*
samples/printing/*.xbm
samples/printing/*.txt
samples/printing/*.ico
samples/printing/*.bmp
samples/printing/*.rc
samples/tbarsmpl/*.cpp
samples/tbarsmpl/*.h
samples/tbarsmpl/*.def
samples/tbarsmpl/makefile.*
samples/tbarsmpl/*.txt
samples/tbarsmpl/*.xbm
samples/tbarsmpl/bitmaps/*.xbm
samples/tbarsmpl/*.ico
samples/tbarsmpl/*.bmp
samples/tbarsmpl/*.rc
samples/tbarsmpl/bitmaps/*.bmp
samples/tbar95/*.cpp
samples/tbar95/*.h
samples/tbar95/*.def
samples/tbar95/makefile.*
samples/tbar95/*.txt
samples/tbar95/*.xbm
samples/tbar95/bitmaps/*.xbm
samples/tbar95/*.ico
samples/tbar95/*.bmp
samples/tbar95/*.rc
samples/tbar95/bitmaps/*.bmp
samples/tbarmsw/*.cpp
samples/tbarmsw/*.h
samples/tbarmsw/*.def
samples/tbarmsw/makefile.*
samples/tbarmsw/*.txt
samples/tbarmsw/*.xbm
samples/tbarmsw/bitmaps/*.xbm
samples/tbarmsw/*.ico
samples/tbarmsw/*.bmp
samples/tbarmsw/*.rc
samples/tbarmsw/bitmaps/*.bmp
samples/docview/*.h
samples/docview/*.cpp
samples/docview/*.def
samples/docview/*.rc
samples/docview/makefile.*
samples/docview/*.xbm
samples/docview/*.txt
samples/docview/*.ico
samples/docview/*.bmp
samples/memcheck/*.h
samples/memcheck/*.cpp
samples/memcheck/*.def
samples/memcheck/*.rc
samples/memcheck/makefile.*
samples/memcheck/*.xbm
samples/memcheck/*.txt
samples/memcheck/*.ico
samples/memcheck/*.bmp
samples/odbc/*.h
samples/odbc/*.cpp
samples/odbc/*.def
samples/odbc/*.rc
samples/odbc/makefile.*
samples/odbc/*.inf
samples/odbc/*.xbm
samples/odbc/*.ico
samples/odbc/*.bmp
samples/odbc/*.dbf
samples/odbc/*.cdx
samples/odbc/odbc32.lib
samples/dialogs/*.h
samples/dialogs/*.cpp
samples/dialogs/*.def
samples/dialogs/*.rc
samples/dialogs/makefile.*
samples/dialogs/*.xbm
samples/dialogs/*.txt
samples/dialogs/*.bmp
samples/dialogs/*.ico
samples/wxpoem/*.cpp
samples/wxpoem/*.h
samples/wxpoem/*.def
samples/wxpoem/*.rc
samples/wxpoem/*.inf
samples/wxpoem/*.txt
samples/wxpoem/makefile.*
samples/wxpoem/*.xbm
samples/wxpoem/*.ico
samples/wxpoem/*.bmp
samples/wxpoem/*.dat
samples/pressup/*.cpp
samples/pressup/*.c
samples/pressup/*.h
samples/pressup/*.def
samples/pressup/*.rc
samples/pressup/*.inf
samples/pressup/*.txt
samples/pressup/makefile.*
samples/pressup/*.xbm
samples/pressup/*.ico
samples/pressup/*.bmp
samples/validate/*.cpp
samples/validate/*.h
samples/validate/*.def
samples/validate/*.rc
samples/validate/*.inf
samples/validate/*.txt
samples/validate/makefile.*
samples/validate/*.xbm
samples/validate/*.ico
samples/validate/*.bmp
samples/events/*.cpp
samples/events/*.h
samples/events/*.def
samples/events/*.rc
samples/events/*.inf
samples/events/*.txt
samples/events/makefile.*
samples/events/*.xbm
samples/events/*.ico
samples/events/*.bmp
samples/treectrl/*.cpp
samples/treectrl/*.h
samples/treectrl/*.def
samples/treectrl/*.rc
samples/treectrl/*.txt
samples/treectrl/makefile.*
samples/treectrl/*.xbm
samples/treectrl/bitmaps/*.xbm
samples/treectrl/*.ico
samples/treectrl/*.bmp
samples/treectrl/bitmaps/*.bmp
samples/treectrl/bitmaps/*.ico
samples/listctrl/*.cpp
samples/listctrl/*.h
samples/listctrl/*.def
samples/listctrl/*.rc
samples/listctrl/*.txt
samples/listctrl/makefile.*
samples/listctrl/*.xbm
samples/listctrl/bitmaps/*.xbm
samples/listctrl/*.ico
samples/listctrl/*.bmp
samples/listctrl/bitmaps/*.bmp
samples/listctrl/bitmaps/*.ico
samples/splitter/*.cpp
samples/splitter/*.h
samples/splitter/*.def
samples/splitter/*.rc
samples/splitter/*.txt
samples/splitter/makefile.*
samples/splitter/*.xbm
samples/splitter/*.ico
samples/splitter/*.bmp
samples/grid/*.cpp
samples/grid/*.h
samples/grid/*.def
samples/grid/*.rc
samples/grid/*.txt
samples/grid/makefile.*
samples/grid/*.xbm
samples/grid/*.ico
samples/grid/*.bmp
samples/internat/*.cpp
samples/internat/*.h
samples/internat/*.def
samples/internat/*.rc
samples/internat/*.txt
samples/internat/makefile.*
samples/internat/*.xbm
samples/internat/*.po
samples/internat/*.ico
samples/internat/*.bmp
samples/internat/*.mo
samples/checklst/*.cpp
samples/checklst/*.h
samples/checklst/*.def
samples/checklst/*.rc
samples/checklst/*.txt
samples/checklst/makefile.*
samples/checklst/*.xbm
samples/checklst/*.ico
samples/checklst/*.bmp
samples/dnd/*.cpp
samples/dnd/*.h
samples/dnd/makefile.*
samples/dnd/*.rc
samples/dnd/*.def
samples/dnd/*.bmp
samples/dnd/*.ico
samples/dnd/*.txt
samples/tab/*.cpp
samples/tab/*.h
samples/tab/makefile.*
samples/tab/*.rc
samples/tab/*.def
samples/tab/*.bmp
samples/tab/*.ico
samples/tab/*.txt
samples/png/*.cpp
samples/png/*.h
samples/png/makefile.*
samples/png/*.rc
samples/png/*.def
samples/png/*.bmp
samples/png/*.ico
samples/png/*.txt
samples/png/*.png

129
distrib/msw/msw.rsp Normal file
View File

@@ -0,0 +1,129 @@
docs/msw/*.txt
src/makeb32.env
src/makebcc.env
src/makemsw.env
src/makewat.env
src/makesc.env
src/makeg95.env
src/makem95.env
src/ntwxwin.mak
src/makefile.bcc
src/makefile.dos
src/makefile.nt
src/*.bat
src/common/dosyacc.c
src/common/doslex.c
src/msw/*.cpp
src/msw/*.h
src/msw/makefile.*
src/msw/*.lst
src/msw/*.def
src/msw/*.inc
src/msw/ctl3d/*.*
src/msw/ctl3d/msvc/*.*
src/msw/ctl3d/wat32/*.*
src/msw/ctl3d/wat386/*.*
src/msw/ctl3d/borland/*.*
src/msw/ole/*.cpp
src/msw/*.prj
include/wx/msw/*.h
include/wx/msw/*.rc
include/wx/msw/ctl3d/*.h
include/wx/msw/gnuwin32/*.h
include/wx/msw/ole/*.h
include/wx/msw/*.cur
include/wx/msw/*.ico
include/wx/msw/*.bmp
lib/dummy
samples/ownerdrw/*.cpp
samples/ownerdrw/*.h
samples/ownerdrw/makefile.*
samples/ownerdrw/*.rc
samples/ownerdrw/*.def
samples/ownerdrw/*.bmp
samples/ownerdrw/*.ico
samples/ownerdrw/*.txt
samples/taskbar/*.cpp
samples/taskbar/*.h
samples/taskbar/makefile.*
samples/taskbar/*.rc
samples/taskbar/*.def
samples/taskbar/*.bmp
samples/taskbar/*.ico
samples/taskbar/*.txt
samples/regtest/*.cpp
samples/regtest/*.h
samples/regtest/makefile.*
samples/regtest/*.rc
samples/regtest/*.def
samples/regtest/*.bmp
samples/regtest/*.ico
samples/regtest/*.txt
samples/nativdlg/*.cpp
samples/nativdlg/*.h
samples/nativdlg/*.def
samples/nativdlg/*.rc
samples/nativdlg/*.txt
samples/nativdlg/makefile.*
samples/nativdlg/*.xbm
samples/nativdlg/*.ico
samples/nativdlg/*.bmp
samples/mfc/*.h
samples/mfc/*.cpp
samples/mfc/*.def
samples/mfc/*.rc
samples/mfc/makefile.*
samples/mfc/*.txt
samples/mfc/*.bmp
samples/mfc/*.ico
samples/joytest/*.h
samples/joytest/*.cpp
samples/joytest/*.def
samples/joytest/*.rc
samples/joytest/makefile.*
samples/joytest/*.txt
samples/joytest/*.bmp
samples/joytest/*.wav
samples/joytest/*.ico
utils/nplugin/make*.*
utils/nplugin/src/*.cpp
utils/nplugin/src/*.h
utils/nplugin/src/*.rc
utils/nplugin/src/*.def
utils/nplugin/src/makefile.*
utils/nplugin/src/*.txt
utils/nplugin/samples/simple/*.cpp
utils/nplugin/samples/simple/*.h
utils/nplugin/samples/simple/*.rc
utils/nplugin/samples/simple/*.def
utils/nplugin/samples/simple/makefile.*
utils/nplugin/samples/simple/*.txt
utils/nplugin/samples/gui/*.cpp
utils/nplugin/samples/gui/*.h
utils/nplugin/samples/gui/*.rc
utils/nplugin/samples/gui/*.def
utils/nplugin/samples/gui/makefile.*
utils/nplugin/samples/gui/*.txt
utils/nplugin/docs/*.tex
utils/nplugin/docs/*.txt
utils/nplugin/docs/*.hpj
utils/nplugin/docs/*.eps
utils/nplugin/docs/*.ps
utils/nplugin/docs/*.ini
utils/nplugin/docs/*.cnt
utils/nplugin/docs/*.hlp
utils/nplugin/lib/dummy

117
distrib/msw/tardist.bat Executable file
View File

@@ -0,0 +1,117 @@
@echo off
rem Tar up an external distribution of wxWindows 2.0: but
rem putting in separate ASCII and binary files
rem This seems to be the one that works, using
rem separate tar programs for conversion/non-conversion
rem of ASCII/binary files.
if "%1" == "" goto usage
if "%2" == "" goto usage
echo About to archive an external wxWindows 2.0 distribution:
echo From %1
echo To %2\wx200_1.tgz, %2\wx200_2.tgz, %2\wx200hlp.tgz, %2\wx200ps.tgz, %2\wx200htm.tgz
echo CTRL-C if this is not correct.
inkey /W4 `Press any key to continue...` %%input
erase %2\*.tgz
cd %1
rem First, expand the wildcards in the rsp files
rem Create empty list file
erase %1\distrib\*.lis
c:\bin\touch %1\distrib\wx200asc.lis
c:\bin\touch %1\distrib\wx200bin.lis
c:\bin\touch %1\distrib\wx200hlp.lis
c:\bin\touch %1\distrib\wx200ps.lis
c:\bin\touch %1\distrib\wx200xlp.lis
rem Create a .rsp file with backslashes instead
rem of forward slashes
rem No need if using ls2 (from UNIX95 distribution)
rem sed -e "s/\//\\/g" %1\distrib\wx_asc.rsp > %1\distrib\wx_asc.rs2
call %1\distrib\expdwild.bat %1\distrib\wx_asc.rsp %1\distrib\wx200asc.lis
call %1\distrib\expdwild.bat %1\distrib\util_asc.rsp %1\distrib\wx200asc.lis
call %1\distrib\expdwild.bat %1\distrib\smpl_asc.rsp %1\distrib\wx200asc.lis
rem call %1\distrib\expdwild.bat %1\distrib\wxim1asc.rsp %1\distrib\wx200asc.lis
rem call %1\distrib\expdwild.bat %1\distrib\wxim2asc.rsp %1\distrib\wx200asc.lis
call %1\distrib\expdwild.bat %1\distrib\wx_bin.rsp %1\distrib\wx200bin.lis
call %1\distrib\expdwild.bat %1\distrib\util_bin.rsp %1\distrib\wx200bin.lis
call %1\distrib\expdwild.bat %1\distrib\smpl_bin.rsp %1\distrib\wx200bin.lis
rem call %1\distrib\expdwild.bat %1\distrib\wxim1bin.rsp %1\distrib\wx200bin.lis
rem Docs
call %1\distrib\expdwild.bat %1\distrib\wx_hlp.rsp %1\distrib\wx200hlp.lis
call %1\distrib\expdwild.bat %1\distrib\wx_ps.rsp %1\distrib\wx200ps.lis
call %1\distrib\expdwild.bat %1\distrib\wx_html.rsp %1\distrib\wx200htm.lis
call %1\distrib\expdwild.bat %1\distrib\wx_pdf.rsp %1\distrib\wx200pdf.lis
rem Do some further massaging of the .lis files
sed -e "s/\\/\//g" %1\distrib\wx200asc.lis > c:\temp\temp.tmp
sed -e "s/D:\/wx\///g" c:\temp\temp.tmp > %1\distrib\wx200asc.lis
sed -e "s/\\/\//g" %1\distrib\wx200bin.lis > c:\temp\temp.tmp
sed -e "s/D:\/wx\///g" c:\temp\temp.tmp > %1\distrib\wx200bin.lis
sed -e "s/\\/\//g" %1\distrib\wx200hlp.lis > c:\temp\temp.tmp
sed -e "s/D:\/wx\///g" c:\temp\temp.tmp > %1\distrib\wx200hlp.lis
sed -e "s/\\/\//g" %1\distrib\wx200ps.lis > c:\temp\temp.tmp
sed -e "s/D:\/wx\///g" c:\temp\temp.tmp > %1\distrib\wx200ps.lis
sed -e "s/\\/\//g" %1\distrib\wx200htm.lis > c:\temp\temp.tmp
sed -e "s/D:\/wx\///g" c:\temp\temp.tmp > %1\distrib\wx200htm.lis
sed -e "s/\\/\//g" %1\distrib\wx200pdf.lis > c:\temp\temp.tmp
sed -e "s/D:\/wx\///g" c:\temp\temp.tmp > %1\distrib\wx200pdf.lis
rem 'tar' converts linefeeds.
tar -c -T %1\distrib\wx200asc.lis -f %2\wx200.tar
rem pause Press a key to continue.
rem This converts to lower case
ren %2\wx200.tar %2\wx200_1.tar
gzip32 %2\wx200_1.tar
ren %2\wx200_1.tar.gz %2\wx200_1.tgz
rem No linefeed conversion wanted
rem Note: GNU tar seems to crash with a full destination path, so
rem pander to it.
targnu -c -T %1\distrib\wx200bin.lis -f wx200_2.tar
move wx200_2.tar %2
gzip32 %2\wx200_2.tar
ren %2\wx200_2.tar.gz %2\wx200_2.tgz
targnu -c -T %1\distrib\wx200hlp.lis -f wx200_hlp.tar
move wx200_hlp.tar %2
gzip32 %2\wx200_hlp.tar
ren %2\wx200_hlp.tar.gz %2\wx200hlp.tgz
tar -c -T %1\distrib\wx200ps.lis -f %2\wx200ps.tar
gzip32 %2\wx200ps.tar
ren %2\wx200ps.tar.gz %2\wx200ps.tgz
targnu -c -T %1\distrib\wx200htm.lis -f wx200htm.tar
move wx200htm.tar %2
gzip32 %2\wx200htm.tar
ren %2\wx200htm.tar.gz %2\wx200htm.tgz
targnu -c -T %1\distrib\wx200pdf.lis -f wx200pdf.tar
move wx200pdf.tar %2
gzip32 %2\wx200pdf.tar
ren %2\wx200pdf.tar.gz %2\wx200pdf.tgz
cd %2
echo wxWindows archived.
goto end
:usage
echo Tar/gzip wxWindows distribution under DOS, making an ASCII and binary file
echo Usage: tardist source destination
echo e.g. tardist d:\wx d:\wx\deliver
:end

2
distrib/msw/wx_hlp.rsp Normal file
View File

@@ -0,0 +1,2 @@
docs/winhelp/*.hlp
docs/winhelp/*.cnt

38
distrib/msw/wx_html.rsp Normal file
View File

@@ -0,0 +1,38 @@
docs/html/*.htm
docs/html/*.gif
docs/html/wx/*.htm
docs/html/wx/*.gif
docs/html/porting/*.htm
docs/html/porting/*.gif
docs/html/faq/*.htm
docs/html/faq/*.gif
docs/html/techref/*.htm
docs/html/techref/*.gif
docs/html/prologio/*.htm
docs/html/prologio/*.gif
docs/html/dialoged/*.htm
docs/html/dialoged/*.gif
docs/html/wxbuild/*.htm
docs/html/wxbuild/*.gif
docs/html/wxtab/*.htm
docs/html/wxtab/*.gif
docs/html/wxchart/*.htm
docs/html/wxchart/*.gif
docs/html/wxtree/*.htm
docs/html/wxtree/*.gif
docs/html/wxgraph/*.htm
docs/html/wxgraph/*.gif
docs/html/wxgrid/*.htm
docs/html/wxgrid/*.gif
docs/html/wxhelp/*.htm
docs/html/wxhelp/*.gif
docs/html/wxhelp2/*.htm
docs/html/wxhelp2/*.gif
docs/html/wxprop/*.htm
docs/html/wxprop/*.gif
docs/html/winstall/*.htm
docs/html/winstall/*.gif
docs/html/tex2rtf/*.htm
docs/html/tex2rtf/*.gif

1
distrib/msw/wx_pdf.rsp Normal file
View File

@@ -0,0 +1 @@
docs/pdf/*.pdf

34
distrib/msw/zipdist.bat Executable file
View File

@@ -0,0 +1,34 @@
@echo off
rem Zip up an external, generic + Windows distribution of wxWindows 2.0
if "%1" == "" goto usage
if "%2" == "" goto usage
echo About to archive an external wxWindows distribution:
echo From %1
echo To %2\wx200gen.zip, %2\wx200doc.zip, %2\wx200msw.zip, %2\wx200ps.zip, %2\wx200hlp.zip, %2\wx200htm.zip, %2\wx200pdf.zip
echo CTRL-C if this is not correct.
pause
erase %2\wx200*.zip
cd %1
echo Zipping...
zip32 -@ %2\wx200gen.zip < %1\distrib\msw\generic.rsp
zip32 -@ %2\wx200msw.zip < %1\distrib\msw\msw.rsp
zip32 -@ %2\wx200doc.zip < %1\distrib\msw\docsrc.rsp
rem zip32 -@ %2\wx200ps.zip < %1\distrib\msw\wx_ps.rsp
zip32 -@ %2\wx200hlp.zip < %1\distrib\msw\wx_hlp.rsp
zip32 -@ %2\wx200htm.zip < %1\distrib\msw\wx_html.rsp
zip32 -@ %2\wx200pdf.zip < %1\distrib\msw\wx_pdf.rsp
cd %2
echo wxWindows archived.
goto end
:usage
echo DOS wxWindows distribution.
echo Usage: zipdist source destination
echo e.g. zipdist d:\wx2\wxWindows d:\wx2\wxWindows\deliver
:end

232
docs/changes.txt Normal file
View File

@@ -0,0 +1,232 @@
Generic wxWindows 2.0 Change Log
--------------------------------
Note: for platform-specific changes, see wx/docs/XXX/changes.txt
where XXX is one of msw, motif, xt, gtk, mac.
Alpha 11, July 3rd 1998
-----------------------
- Major work on Dialog Editor (still plenty to go).
- Expanded documentation a bit more.
Alpha 9, April 27th 1998
------------------------
- Corrected some bugs, such as the wxModule compilation problem.
- Added Gnu-Win32 b19/Mingw32 support by changing resource
compilation and pragmas.
- Changed SIZEOF to WXSIZEOF.
Alpha 8, April 17th 1998
------------------------
- Added src/other/png, src/other/zlib directories.
- Added samples/png.
- IMPORTANT: Changed 'no id' number from 0 to -1, in wxEVT_ macros.
Porters, please check particularly your wxTreeCtrl and wxListCtrl
header files.
- Added modules.h/cpp, config.cpp, fileconf.cpp, textfile.cpp/h.
Alpha 7, March 30th 1998
------------------------
- Added tab classes, tab sample.
- Revised memory.cpp, memory.h slightly; memory.h now #defines
new to WXDEBUG_NEW in DEBUG mode. Windows implementation app.cpp
now checks for leaks on exit. Added memcheck sample.
See src/msw/issues.txt for more details.
- resource.h, resource.cpp changed to make wxDefaultResourceTable
a pointer. Now initialize resource system with
wxInitializeResourceSystem and wxCleanUpResourceSystem, to
allow better control of memory.
- wxString now derives from wxObject, to enable memory leak
checking.
- Added some #include fixes in various files, plus changed
float to long in wxToolBar files.
Alpha 6, March 10th 1998
------------------------
- Added Vadim's dynarray.h, dynarray.cpp.
- Added Vadim's menuitem.cpp.
- Added Windows-specific wxCheckListBox,
owner-draw wxListBox, and drag-and-drop
(see docs/msw/changes.txt).
Alpha 5, 14th February 1998
--------------------------
- GENERIC AND MSW-SPECIFIC CODE NOW TREATED AS TWO SEPARATE
DISTRIBUTIONS. This change log will therefore now refer to
the generic code only. See docs/msw/changes.txt for Windows-specific
changes.
- Readmes, change logs and installation files now go in
platform-specific directories under docs, e.g. docs/msw,
docs/gtk.
- Added DECLARE_APP and IMPLEMENT_APP macros so wxApp object gets
created dynamically, not as a global object.
- Put wxColour into wx/msw/colour.h, src/msw/colour.cpp.
- Changed names of some include/wx/generic headers to be
consistent and to conform to gcc pragma conventions. Also
changed choicesg.cpp to choicdgg.cpp.
- Added gcc pragmas.
- Added gtk inclusion in include/wx headers.
- Added consistent file headings to source and headers.
- Removed lang.cpp, lang.h and references to wxSTR_... variables;
added a few references to wxTransString.
- Added operator to wxTransString that converts automatically
to wxString, so we can say e.g. wxMessageBox(wxTransString("Hello"), ...).
- samples/internat now works (minimally).
- Added wxMouseEvent::GetPosition and
wxMouseEvent::GetLogicalPosition, both returning wxPoints.
- Made wxSize and wxRect contain longs not ints.
- Cured some lemory leaks (thanks Vadim).
- Tidied up OnIdle and introduced RequestMore/MoreRequested so
will only keep processing OnIdle if it returns TRUE from
MoreRequested.
Alpha 4, 31st January 1998
--------------------------
- Changed wxDC functions to take longs instead of floats. GetSize now takes
integer pointers, plus a version that returns a wxSize.
- const keyword added to various wxDC functions.
- Under Windows, wxDC no longer has any knowledge of whether
an associated window is scrolled or not. Instead, the device
origin is set by wxScrolledWindow in wxScrolledWindow::PrepareDC.
- wxScrolledWindow applications can optionally override the virtual OnDraw
function instead of using the OnPaint event handler. The wxDC passed to
OnDraw will be translated by PrepareDC to reflect scrolling.
When drawing outside of OnDraw, must call PrepareDC explicitly.
- wxToolBarBase/wxToolBarSimple similarly changed to allow for
scrolling toolbars.
- Integrated wxPostScriptDC patches for 1.xx by Chris Breeze,
to help printing with multiple pages.
- IPC classes given base classes (wxConnectionBase etc.) which
define the API used by different implementations. DDE
implementation updated to use these base classes.
- wxHelpInstance now separated into wxHelpControllerBase (base
for all implementations), wxWinHelpController (uses standard
WinHelp), wxXLPHelPController (talks to wxHelp by DDE or
TCP/IP). There will be others eventually, such as
wxHTMLHelpController for Microsoft (and Netscape?) HTML Help.
- Added Vadim Zeitlin's wxString class plus
internationalization code (gettext simulation, wxLocale, etc.).
New files from Vadim:
include\wx\string.h
include\wx\debug.h
include\wx\file.h
include\wx\log.h
include\wx\intl.h
src\common\string.cpp
src\common\log.cpp
src\common\intl.cpp
src\common\file.cpp
No longer use GNU wxString files.
- Split off file-related functions into include\wx\filefn.h and
src\common\filefn.cpp.
- Borland C++ support (WIN32) for main library and
samples, using makefile.b32 files.
- Preparation done for allowing BC++ to compile wxWin as a DLL,
including changes to defs.h.
- wxIntPoint removed, wxPoint is now int, and wxRealPoint
introduced.
- Added wxShowEvent (generated when window is being shown or
hidden).
- Got minimal, docview, mdi samples working for 16-bit VC++ and
cured 16-bit problem with wxTextCtrl (removed global memory
trick).
- Updated GnuWin32 makefiles, checked minimal, mdi, docview samples.
Alpha 3, September 1997
-----------------------
- wxListCtrl, wxTreeCtrl, wxImageList classes done.
- Instigated new file hierarchy, split files and classes up more logically.
- PrologIO and some other utils now put into core library.
- Revamped print/preview classes, added wxPageSetupDialog.
- Started documentation.
Alpha 2, 30th April 1997
------------------------
- EVT_... macros now have at least one argument, for conformance
with MetroWerks compiler.
- Added ids to .wxr file format.
- Got Dialog Editor compiled and running again but need
to extend functionality to be in line with new controls.
Added dialoged\test app to allow dynamic loading of .wxr files
for testing purposes.
- Rewrote wxBitmap to allow installable file type
handlers.
- Rewrote wxBitmapButton, wxStaticBitmap to not use Fafa.
- Wrote most of wxTreeCtrl and sample (need wxImageList to implement it
fully).
- Added back wxRadioBox.
- Tidied up wx_main.cpp, wxApp class, putting PenWin code in
a separate file.
Alpha 1, 5th April 1997
-----------------------
At this point, the following has been achieved:
- A lot, but not all, of the code has been revamped for better
naming conventions, protection of data members, and use of
wxString instead of char *.
- Obsolete functionality deleted (e.g. default wxPanel layout,
old system event system) and code size reduced.
- Class hierarchy changed (see design doc) - base classes such
as wxbWindow now removed.
- No longer includes windows.h in wxWin headers, by using stand-in
Windows types where needed e.g. WXHWND.
- PrologIO revised.
- wxScrolledWindow, wxStatusBar and new MDI classes added.
MDI is now achived using separate classes, not window styles.
- wxSystemSettings added, and made use of to reflect standard
Windows settings.
- SetButtonFont/SetLabelFont replaced by SetFont; font and colour
settings mucho rationalised.
- All windows are now subclassed with the same window proc to make
event handling far more consistent. Old internal wxWnd and derived
classes removed.
- API for controls revised, in particular addition of
wxValidator parameters and removal of labels for some controls.
- 1 validator written: see examples/validate.
- Event table system introduced (see most samples and
wx_event.cpp/ProcessEvent, wx_event.h). wxEvtHandler
made more flexible, with Push/PopEventHandler allowing a chain
of event handlers.
- wxRadioBox removed - will be added back soon.
- Toolbar class hierarchy revised:
wxToolBarBase
wxToolBarSimple (= old wxToolBar)
wxToolBar95 (= old wxButtonBar under Win95
wxToolBarMSW (= old wxButtonBar under WIN16/WIN32)
- Constraint system debugged somewhat (sizers now work properly).
- wxFileDialog, wxDirDialog added; other common dialogs now
have class equivalents. Generic colour and font dialogs
rewritten to not need obsolete panel layout.
- .wxr resource system partially reinstated, though needs
an integer ID for controls. Hopefully the resource system
will be replaced by something better and more efficient
in the future.
- Device contexts no longer stored with window and accessed
with GetDC - use wxClientDC, wxPaintDC, wxWindowDC stack
variables instead.
- wxSlider uses trackbar class under Win95, and wxSL_LABELS flag
determines whether labels are shown. Other Win95-specific flags
introduced, e.g. for showing ticks.
- Styles introduced for dealing with 3D effects per window, for
any window: all Win95 3D effects supported, plus transparent windows.
- Major change to allow 3D effect support without CTL3D, under
Win95.
- Bitmap versions of button and checkbox separated out into new
classes, but unimplemented as yet because I intend to remove
the need for Fafa - it apparently causes GPFs in Win95 OSR 2.
- utils/wxprop classes working (except maybe wxPropertyFormView)
in preparation for use in Dialog Editor.
- GNU-WIN32 compilation verified (a month or so ago).

292
docs/gtk/welcome.html Normal file
View File

@@ -0,0 +1,292 @@
<html>
<head><title>wxGTK Homepage</title>
</head>
<body bgcolor=#FFFFFF text=#000000 link=#0020FF vlink=#800000 alink=#007777>
<h1>"wxWindows for the GTK" Homepage</h1>
<hr>
<h3>Current version</h3>
15th May '98: wxGTK v0.12 (alpha-)
<p>
This release is hardly more stable than the one before, but it
has many new features. It's main purpose is actually to prepare
the final merge of the Windows port and the GTK port source
trees into a common tree, developed using CVS. The growing
number of demos which compile and run with wxGTK "although"
being written for wxMSW shows that we seem to be on the right
track. One nice new feature for many potential users is that
wxGTK no longer needs any extra libraries to be installed,
other than the GTK.
<p>
If you have a compiler
better than gcc 2.7.2.2 then you can uncomment a line in src/common/prntbase.cpp
which defines __GOOD_COMPILER__. This should make the printing demo work.
I haven't got such a compiler, so I actually don't know. Somebody reported
problems with version 2.7.2.3 as well.
<p>
<hr>
<h3>Acknowledgements</h3>
I'd like to thank the
<a href="http://www.freiburg.linux.de">Freiburg Linux User Group</a>
for kindly providing
this site and Christian Wetzel in particular for helping me with
this site's administration.
<p>
<hr>
<h3>What is wxWindows?</h3>
wxWindows is a C++ cross-platform GUI toolkit written mainly by Julian Smart.
More information about wxWindows can be found at the
<a href="http://web.ukonline.co.uk/julian.smart/wxwin">wxWindows Homepage</a>.
<p>
The current version of wxWindows (v1.68) supports Windows ('95 and NT), Motif and
XView (aka OpenLook). There is another port (wxXt) available, which uses the
free-ware widget set from the Free Widget Foundation (FSF). Ports have been
started for the Mac, OS/2 and NextStep.
<p>
For different reasons, it was decided to start a complete rewrite of wxWindows,
which will then be called wxWindows 2.0. For a list of new features and changes
from the current version, you may read the wxWindows Homepage (see above).
<p>
Currently, work is being done on four ports of wxWindows 2.0:
<dl>
<li> Windows (wxMSW, main author Julian Smart)
<li> Unix, Motif (wxMotif, main author Markus Holzhem)
<li> Unix, GIMP Toolkit (wxGTK, main author Robert Roebling)
<li> Macintosh (wxMac, main author Greg Whitehead)
</dl>
<p>
wxWindows provides a rich set of classes which help to make cross-platform
GUI programming easy. In many aspect, it is modelled after MFC, making transition
from MFC to wxWindows relatively painless. The main technical
difference between most other free or commercial cross platform libraries is
that wxWindows is a wrapper around existing widget sets, whereas the other
toolkits (Qt, Tk, Java, Amulet, OPaC, JX, Fresko) draw their widgets themselves,
which results in applications having a different look than native applications
for that specific platform.
<p>
There are classes for the following categories
<dl>
<li> Window classes: wxWindow, wxFrame, wxDialogBox, wxPanel, wxCanvas etc.
<li> Widget classes: wxButton, wxCheckbox, wxChoice, wxListBox, wxListCtrl, wxText, wxGauge etc.
<li> Data structures: wxList, wxString, wxHashTable, wxDate etc.
<li> Layout/constraint system
<li> GDI classes: wxPen, wxBrush, wxFont, wxBitmap etc.
<li> Events: wxCommandEvent, wxMouseEvent, wxKeyEvent etc.
<li> Devices contexts: wxCanvasDC, wxPostScriptDC, wxMemoryDC, wxPrinterDC
<li> Base classes for runtime-type information: wxObject
<li> Interprocess communication: wxClient, wxConnection, wxSocket, wxServer etc.
<li> Document-view architecture: wxDocument, wxView, wxDocManager etc.
<li> Printing framework: wxPreviewFrame, wxPrintDialog, wxPrinter etc.
<li> Many helper classes, wxApplication, wxTypeTree, wxPathList etc.
<li> Classes for internationalization
<li> Built-in memory leak checking, log-files
<li> A multitude of functions and macros
</dl>
<hr>
<h3>Copyright</h3>
The choice of a suitable copyright has been subject to endless discussions. It
has always been the aim, to put wxWindows under a copyright, which protects
the work of its authors while at the same time encouraging the use of wxWindows
in as many projects as possible.
<p>
The (so far) last decision has been to put the whole of wxWindows
under a modified (less restrictive) version of the GNU library general
public license.
<p>
The only exception is that wxGTK now contains code (gdk_imlib) which is
under the GNU library general public license. When you make changes to
this part of wxGTK, you'll have to make these changes public (in contrast
to changes to the rest).
<p>
It is obviously encouraged that anybody who uses wxWindows and who
makes any improvements to it will make these changes available to
wxWindows' authors.
<p>
<hr>
<h3>What can I do with wxWindows 2.0?</h3>
wxWindows is still in alpha stage, which means that there are still bugs
waiting for you and several features are not yet (fully) implemented, but
you can expect the interface to be more or less stable, so no major
modifications will have to be made to your source code. wxGTK is already
used in a number of medium sized projects and is it being developped
in close cooperation with the authors of these applications.
<p>
<hr>
<h3>Can I write a GNOME application with wxGTK 2.0?</h3>
Good question. The idea to use wxGTK for the GNOME desktop environment is
quite obvious. When this topic came up on the GNOME mailing list, the GNOME
people have shown an amazingly negative opinion about wxWindows. One reason
might be that several of the main authors of the GNOME-project consider
C++ a "broken language". I don't share that view and I am sure many people
find C++ easier to handle and better suited for GUI programming than C.
<p>
Just recently, the topic of C++ in general and wxGTK in particular appeared
again on the GNOME list. It has shown that - at least - the opinion on C++
on the GNOME list is split.
<p>
There is already a C++ wrapper for the GTK called GTK-- written by Tero Pulkkinen.
It is very small and adds very little overhead to the GTK. If platform
independence is no issue for you and you want to write a small tool
for Linux, you should probably use GTK--. Of course you can use wxGTK
for that, too :-)
<p>
<hr>
<h3>Screenshots</h3>
What would a home page of a GUI be without a screenshot? Well, as wxWindows
is a wrapper around existing widget/item sets, a wxWindows application will
look like any other native Windows, Motif, GTK or Mac application.
<p>
But for those of you, who wouldn't download wxGTK only because there
is no screenshot,
<a href="ftp://ftp.freiburg.linux.de/pub/linux/wxxt/sshot.jpg">here it comes</a>.
<p>
<hr>
<h3>Download 1.68</h3>
Go to the
<a href="ftp://ftp.freiburg.linux.de/pub/linux/wxxt">FTP</a>
section directly.
<p>
There is documentation for version 1.68 in html available.
<a href="ftp://ftp.freiburg.linux.de/pub/linux/wxxt">here</a>. Not yet.
<p>
You can download current wxWindows version 1.68 for Windows, Motif and
XView from
<a href="ftp://ftp.freiburg.linux.de/pub/linux/wxxt">here</a>. Not yet.
<p>
You can download wxXt 1.66d from
<a href="ftp://ftp.freiburg.linux.de/pub/linux/wxxt/wxxt166d.tgz">here</a>.
<p>
<hr>
<h3>Download 2.0 alpha</h3>
There is documentation for version 2.0 in html available.
<a href="ftp://ftp.freiburg.linux.de/pub/linux/wxxt/wxGTK_doc.tgz">here</a>.
<p>
You can download the first alpha for wxWindows 2.0 for Windows from
<a href="ftp://ftp.freiburg.linux.de/pub/linux/wxxt/">here</a>. Not yet.
<p>
You can download the current alpha for wxWindows 2.0 for GTK from
<a href="ftp://ftp.freiburg.linux.de/pub/linux/wxxt/wxGTK-0.12.tgz">here</a>.
<p>
<hr>
<h3>News from wxGTK 0.12</h3>
<p>
PNG, zlib and gdk_imlib code included.
<p>
MDI implementation. More a basis for further testing
than of real value.
<p>
Split "--with-debug" option into two options: "--with-debug_info"
and "--with-debug_flag". The first one sets the "-g" flag when
compiling, the second defines "DEBUG" in setup.h (which is included
from defs.h).
<p>
Merged DocView framework. The sample doesn't compile yet, because
it uses features from wxTextCtrl, which I haven't implemented yet.
<p>
Merged TabCtrl. Doesn't look perfect, but it seems to work.
<p>
Merged remaining classes from the newest wxMSW alpha. (wxDynArray,
wxModule etc.).
<p>
Further updates, bug fixes or additions:
<p>
<dl>
<li> wxYield() (again)
<li> postscript support for bitmaps
<li> spline code merged
<li> several bug fixes
<li> new samples
</dl>
<p>
<hr>
<h3>Known problems</h3>
Missing implementation of:
<dl>
<li>Impossible to set new font in GTK's widgets
<li>Items containing bitmaps
<li>Masks, bitmap handlers (partially done)
<li>Gauge
<li>Combobox
<li>Palettes (colormaps)
<li>Keyboard accelerators for menus
<li>Validation
<li>Clipboard functions
<li>Resources (for use with wxIDE-to-be)
<li>Drag and Drop
<li>Threads, Interprocess communication
<li>Sockets
<li>Database classes
</dl>
<p>
<hr>
<h3>Installation of wxGTK under Linux</h3>
GTK requires an up-to-date version of the
<dl>
<li> GTK (GIMP ToolKit)
</dl>
to be installed as a shared lib on your system. wxGTK is being developped with
version 1.0.1 and it is known not to work with earlier versions.
The GTK library is available from
<a href="ftp://ftp.gtk.org/pub/">somewhere here (gtk.org).</a>
After having typed "make install" the GTK header files should be
in "/usr/local/include". Correct me, if I am wrong.
<p>
Compilation itself works as usual with autoconf:
<dl>
<li> Unpack it to a suitable subdirectory, let's say ~/wxGTK
<li> Type "cd wxGTK"
<li> Type "configure"
<li> Type "make"
</dl>
Some demos use files stored in the source directory of those demos
(e.g. internat uses files in samples/internat) whereas the binaries
will end up in samples/internat/linux. You'll have to copy the binaries
down or call them like "linux/test" from samples/internat. This is
also the case for wxTest (which should display a horse).
<p>
You can create a shared library by adding the option "--with-shared" to
the "configure" command. Afterwards, you'll have to copy the library
~/wxGTK/lib/linux (if you have Linux) to a directory in your LDPATH (e.g. /usr/X11R6/lib)
and run "ldconfig".
<p>
<hr>
<h3>Mailing list for wxGTK</h3>
The mailing list (as well as this page) is called wxxt for more
or less historical reasons.
<p>
You can subsribe to the mailing list by sending a mail to
<a href="mailto:majordomo@wesley.informatik.uni-freiburg.de">majordomo@wesley.informatik.uni-freiburg.de</a>.
This mail must contain the text "subscribe wxxt" in the body (not the subject) of the
mail. You will then get a confirmation that somebody asked majordomo to put you
on the list and you will have to confirm this once again by sending back
the authentisation, which comes in the confirmation mail. The last step
is also described in the actual confirmation mail (I think).
<p>
You can send a mail to the mailing list to the address
<a href="mailto:wxxt@www.freiburg.linux.de">wxxt@www.freiburg.linux.de</a>.
<p>
Unsubscribe by sending "unsubscribe wxxt" to majordomo (see above). Not to
the actual mailing list.
<p>
<hr>
<address>
<br>This page is maintained by <a href="mailto:roebling@sun2.ruf.uni-freiburg.de">Robert Roebling</a>.
Comments, in contrast to junk and flames, welcome.
<p>
Last changed 15th Mai '98.
</address>
</body>
</html>

BIN
docs/latex/porting/back.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 B

View File

@@ -0,0 +1,17 @@
[OPTIONS]
BMROOT=d:\wx2\wxwind~1\docs\latex\porting ; Assume that bitmaps are where the source is
TITLE=wxWindows Porting Guide
CONTENTS=Contents
COMPRESS=HIGH
[FILES]
porting.rtf
[CONFIG]
CreateButton("Up", "&Up", "JumpId(`porting.hlp', `Contents')")
BrowseButtons()
[MAP]
[BITMAPS]

View File

@@ -0,0 +1,390 @@
\documentstyle[a4,makeidx,verbatim,texhelp,fancyhea,mysober,mytitle]{report}
\newcommand{\indexit}[1]{#1\index{#1}}%
\newcommand{\pipe}[0]{$\|$\ }%
\definecolour{black}{0}{0}{0}%
\definecolour{cyan}{0}{255}{255}%
\definecolour{green}{0}{255}{0}%
\definecolour{magenta}{255}{0}{255}%
\definecolour{red}{255}{0}{0}%
\definecolour{blue}{0}{0}{200}%
\definecolour{yellow}{255}{255}{0}%
\definecolour{white}{255}{255}{255}%
\input psbox.tex
\parskip=10pt
\parindent=0pt
\title{Guide to porting applications from wxWindows 1.xx to 2.0}
\author{Julian Smart}
\date{October 1997}
\makeindex
\begin{document}
\maketitle
\pagestyle{fancyplain}
\bibliographystyle{plain}
\setheader{{\it CONTENTS}}{}{}{}{}{{\it CONTENTS}}
\setfooter{\thepage}{}{}{}{}{\thepage}%
\pagenumbering{roman}
\tableofcontents
%
\chapter{About this document}\label{about}
\pagenumbering{arabic}%
\setheader{{\it Porting guide}}{}{}{}{}{{\it Porting guide}}%
\setfooter{\thepage}{}{}{}{}{\thepage}%
This document gives guidelines and tips for porting applications from
version 1.xx of wxWindows to version 2.0.
The first section offers tips for writing 1.xx applications in a way to
minimize porting time. The following sections detail the changes and
how you can modify your application to be 2.0-compliant.
You may be worrying that porting to 2.0 will be a lot of work,
particularly if you have only recently started using 1.xx. In fact,
the wxWindows 2.0 API has far more in common with 1.xx than it has differences.
With backward compatibility mode on, much of the conversion can be
done gradually. The main challenges are doing without the default
panel item layout, and the lack of automatic labels in some controls.
However, if you already use resource files (.wxr), or application-specific positioning,
or constraints, then even this will be quite painless.
So please don't be freaked out by the jump to 2.0! For one thing, 1.xx is still available
and will be supported by the user community for some time. And when you have
changed to 2.0, we hope that you will appreciate the benefits in terms
of greater flexibility, better user interface aesthetics, improved C++ conformance,
improved compilation speed, and many other enhancements. The revised architecture
of 2.0 will ensure that wxWindows can continue to evolve for the forseeable
future.
{\it Please note that this document is a work in progress.}
\chapter{Preparing for version 2.0}\label{preparing}
Even before compiling with version 2.0, there's also a lot you can do right now to make porting
relatively simple. Here are a few tips.
\begin{itemize}
\item {\bf Use constraints or .wxr resources} for layout, rather than the default layout scheme.
Constraints should be the same in 2.0, and resources will be translated.
\item {\bf Use separate wxMessage items} instead of labels for wxText, wxMultiText,
wxChoice, wxComboBox. These labels will disappear in 2.0. Use separate
wxMessages whether you're creating controls programmatically or using
the dialog editor. The future dialog editor will be able to translate
from old to new more accurately if labels are separated out.
\item {\bf Parameterise functions that use wxDC} or derivatives, i.e. make the wxDC
an argument to all functions that do drawing. Minimise the use of
wxWindow::GetDC and definitely don't store wxDCs long-term
because in 2.0, you can't use GetDC() and wxDCs are not persistent.
You will use wxClientDC, wxPaintDC stack objects instead. Minimising
the use of GetDC() will ensure that there are very few places you
have to change drawing code for 2.0.
\item {\bf Don't set GDI objects} (wxPen, wxBrush etc.) in windows or wxCanvasDCs before they're
needed (e.g. in constructors) - do so within your drawing routine instead. In
2.0, these settings will only take effect between the construction and destruction
of temporary wxClient/PaintDC objects.
\item {\bf Don't rely} on arguments to wxDC functions being floating point - they will
be 32-bit integers in 2.0.
\item {\bf Don't use the wxCanvas member functions} that duplicate wxDC functions, such as SetPen and DrawLine, since
they are going.
\item {\bf Using member callbacks} called from global callback functions will make the transition
easier - see the FAQ
for some notes on using member functions for callbacks. wxWindows 2.0 will banish global
callback functions (and OnMenuCommand), and nearly all event handling will be done by functions taking a single event argument.
So in future you will have code like:
{\small\begin{verbatim}
void MyFrame::OnOK(wxCommandEvent& event)
{
...
}
\end{verbatim}
}%
You may find that writing the extra code to call a member function isn't worth it at this stage,
but the option is there.
\item {\bf Use wxString wherever possible.} 2.0 will replace char * with wxString
in most cases, and if you use wxString to receive strings returned from
wxWindows functions (except when you need to save the pointer if deallocation is required), there should
be no conversion problems later on.
\item Be aware that under Windows, {\bf font sizes will change} to match standard Windows
font sizes (for example, a 12-point font will appear bigger than before). Write your application
to be flexible where fonts are concerned.
Don't rely on fonts being similarly-sized across platforms, as they were (by chance) between
Windows and X under wxWindows 1.66. Yes, this is not easy... but I think it's better to conform to the
standards of each platform, and currently the size difference makes it difficult to
conform to Windows UI standards. You may eventually wish to build in a global 'fudge-factor' to compensate
for size differences. The old font sizing will still be available via wx\_setup.h, so do not panic...
\item {\bf Consider dropping wxForm usage}: an alternative is to be found in utils/wxprop.
wxPropertyFormView can be used in a wxForm-like way, except that you specify a pre-constructed panel
or dialog; or you can use a wxPropertyListView to show attributes in a scrolling list - you don't even need
to lay panel items out.
Because wxForm uses a number of features to be dropped in wxWindows 2.0, it cannot be
supported in the future, at least in its present state.
\item {\bf When creating a wxListBox}, put the wxLB\_SINGLE, wxLB\_MULTIPLE, wxLB\_EXTENDED styles in the window style parameter, and put
zero in the {\it multiple} parameter. The {\it multiple} parameter will be removed in 2.0.
\item {\bf For MDI applications}, don't reply on MDI being run-time-switchable in the way that the
MDI sample is. In wxWindows 2.0, MDI functionality is separated into distinct classes.
\end{itemize}
\chapter{The new event system}\label{eventsystem}
The way that events are handled has been radically changed in wxWindows 2.0. Please
read the topic `Event handling overview' in the wxWindows 2.0 manual for background
on this.
\section{Callbacks}
Instead of callbacks for panel items, menu command events, control commands and other events are directed to
the originating window, or an ancestor, or an event handler that has been plugged into the window
or its ancestor. Event handlers always have one argument, a derivative of wxEvent.
For menubar commands, the {\bf OnMenuCommand} member function will be replaced by a series of separate member functions,
each of which responds to a particular command. You need to add these (non-virtual) functions to your
frame class, add a DECLARE\_EVENT\_TABLE entry to the class, and then add an event table to
your implementation file, as a BEGIN\_EVENT\_TABLE and END\_EVENT\_TABLE block. The
individual event mapping macros will be of the form:
\begin{verbatim}
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(MYAPP_NEW, MyFrame::OnNew)
EVT_MENU(wxID_EXIT, MyFrame::OnExit)
END_EVENT_TABLE()
\end{verbatim}
Control commands, such as button commands, can be routed to a derived button class,
the parent window, or even the frame. Here, you use a function of the form EVT\_BUTTON(id, func).
Similar macros exist for other control commands.
\section{Other events}
To intercept other events, you used to override virtual functions, such as OnSize. Now, while you can use
the OnSize name for such event handlers (or any other name of your choice), it has only a single argument
(wxSizeEvent) and must again be `mapped' using the EVT\_SIZE macro. The same goes for all other events,
including OnClose (although in fact you can still use the old, virtual form of OnClose for the time being).
\chapter{Class hierarchy}\label{classhierarchy}
The class hierarchy has changed somewhat. wxToolBar and wxButtonBar
classes have been split into several classes, and are derived from wxControl (which was
called wxItem). wxPanel derives from wxWindow instead of from wxCanvas, which has
disappeared in favour of wxScrolledWindow (since all windows are now effectively canvases
which can be drawn into). The status bar has become a class in its own right, wxStatusBar.
There are new MDI classes so that wxFrame does not have to be overloaded with this
functionality.
There are new device context classes, with wxPanelDC and wxCanvasDC disappearing.
See \helpref{Device contexts and painting}{dc}.
\chapter{GDI objects}\label{gdiobjects}
These objects - instances of classes such as wxPen, wxBrush, wxBitmap (but not wxColour) -
are now implemented with reference-counting. This makes assignment a very cheap operation,
and also means that management of the resource is largely automatic. You now pass {\it references} to
objects to functions such as wxDC::SetPen. The device context does not store a copy of the pen
itself, but takes a copy of it (via reference counting), and the object's data gets freed up
when the reference count goes to zero. The application does not have to worry so much about
who the object belongs to: it can pass the reference, then destroy the object without
leaving a dangling pointer inside the device context.
For the purposes of code migration, you can use the old style of object management - maintaining
pointers to GDI objects, and using the FindOrCreate... functions. However, it is preferable to
keep this explicit management to a minimum, instead creating objects on the fly as needed, on the stack,
unless this causes too much of an overhead in your application.
At a minimum, you will have to make sure that calls to SetPen, SetBrush etc. work. Some compilers
will do the conversion from pointer to reference automatically (via a constructor in the GDI
class) but you cannot rely on this being true for all compilers. Also, where you pass NULL to these
functions, you will need to either cast to the appropriate reference type, or instead
use an identifier such as wxNullPen or wxNullBrush.
\chapter{Dialogs and controls}\label{dialogscontrols}
\wxheading{Labels}
Most controls no longer have labels and values as they used to in 1.xx. Instead, labels
should be created separately using wxStaticText (the new name for wxMessage). This will
need some reworking of dialogs, unfortunately; programmatic dialog creation that doesn't
use constraints will be especially hard-hit. Perhaps take this opportunity to make more
use of dialog resources or constraints. Or consider using the wxPropertyListView class
which can do away with dialog layout issues altogether by presenting a list of editable
properties.
\wxheading{Constructors}
All window constructors have two main changes, apart from the label issue mentioned above.
Windows now have integer identifiers; and position and size are now passed as wxPoint and
wxSize objects. In addition, some windows have a wxValidator argument. wxWindows 2.0 may provide
old-style constructors in WXWIN\_COMPATIBILITY mode for limited backward compatibility.
\wxheading{Show versus ShowModal}
If you have used or overridden the {\bf wxDialog::Show} function in the past, you may find
that modal dialogs no longer work as expected. This is because the function for modal showing
is now {\bf wxDialog:ShowModal}. This is part of a more fundamental change in which a
control may tell the dialog that it caused the dismissal of a dialog, by
calling {\bf wxDialog::EndModal} or {\bf wxWindow::SetReturnCode}. Using this
information, {\bf ShowModal} now returns the id of the control that caused dismissal,
giving greater feedback to the application than just TRUE or FALSE.
If you overrode or called {\bf wxDialog::Show}, use {\bf ShowModal} and test for a returned identifier,
commonly wxID\_OK or wxID\_CANCEL.
\wxheading{wxItem}
This is renamed wxControl.
\wxheading{wxText, wxMultiText and wxTextWindow}
These classes no longer exist and are replaced by the single class wxTextCtrl.
Multi-line text items are created using the wxTE\_MULTILINE style.
\wxheading{wxButton}
Bitmap buttons are now a separate class, instead of being part of wxBitmap.
\wxheading{wxMessage}
Bitmap messages are now a separate class, wxStaticBitmap, and wxMessage
is renamed wxStaticText.
\wxheading{wxGroupBox}
wxGroupBox is renamed wxStaticBox.
\wxheading{wxForm}
Note that wxForm is no longer supported in wxWindows 2.0. Consider using the wxPropertyForm class
instead, which takes standard dialogs and panels and associates controls with property objects.
You may also find that the new validation method, combined with dialog resources, is easier
and more flexible than using wxForm.
\chapter{Device contexts and painting}\label{dc}
In wxWindows 2.0, device contexts are used for drawing into, as per 1.xx, but the way
they are accessed and constructed is a bit different.
You no longer use {\bf GetDC} to access device contexts for panels, dialogs and canvases.
Instead, you create a temporary device context, which means that any window or control can be drawn
into. The sort of device context you create depends on where your code is called from. If
painting within an {\bf OnPaint} handler, you create a wxPaintDC. If not within an {\bf OnPaint} handler,
you use a wxClientDC or wxWindowDC. You can still parameterise your drawing code so that it
doesn't have to worry about what sort of device context to create - it uses the DC it is passed
from other parts of the program.
You {\bf must } create a wxPaintDC if you define an OnPaint handler, even if you do not
actually use this device context, or painting will not work correctly under Windows.
If you used device context functions with wxPoint or wxIntPoint before, please note
that wxPoint now contains integer members, and there is a new class wxRealPoint. wxIntPoint
no longer exists.
\chapter{Miscellaneous}
\section{Strings}
wxString has replaced char* in the majority of cases. For passing strings into functions,
this should not normally require you to change your code if the syntax is otherwise the
same. This is because C++ will automatically convert a char* or const char* to a wxString by virtue
of appropriate wxString constructors.
However, when a wxString is returned from a function in wxWindows 2.0 where a char* was
returned in wxWindows 1.xx, your application will need to be changed. Usually you can
simplify your application's allocation and deallocation of memory for the returned string,
and simply assign the result to a wxString object. For example, replace this:
{\small\begin{verbatim}
char* s = wxFunctionThatReturnsString();
s = copystring(s); // Take a copy in case it's temporary
.... // Do something with it
delete[] s;
\end{verbatim}
}
with this:
{\small\begin{verbatim}
wxString s = wxFunctionThatReturnsString();
.... // Do something with it
\end{verbatim}
}
To indicate an empty return value or a problem, a function may return either the
empty string (``") or a null string. You can check for a null string with wxString::IsNull().
\section{Use of const}
The {\bf const} keyword is now used to denote constant functions that do not affect the
object, and for function arguments to denote that the object passed cannot be changed.
This should not affect your application except for where you are overriding virtual functions
which now have a different signature. If functions are not being called which were previously,
check whether there is a parameter mismatch (or function type mismatch) involving consts.
Try to use the {\bf const} keyword in your own code where possible.
\chapter{Backward compatibility}\label{compat}
Some wxWindows 1.xx functionality has been left to ease the transition to 2.0. This functionality
(usually) only works if you compile with WXWIN\_COMPATIBILITY set to 1.
TODO
OnMenuCommand, OnSize, OnActivate, OnPaint, others?? can all be prefixed with Old (e.g. OldOnMenuCommand)
and will work as before. You are encouraged to convert your code to the new forms, but
this will allow you to get your applications up and running a little more quickly.
OnClose can be used as-is without an 'Old' prefix, but officially the OnCloseWindow event table handler should be
used instead.
\chapter{Quick reference}\label{quickreference}
This section allows you to quickly find features that
need to be converted.
TODO
\section{OnActivate}
Rename to OldOnActivate, or replace arguments with one wxActivateEvent\& argument.
\wxheading{See also}
\helpref{Backward compatibility}{compat}
\section{OnClose}
This can either remain the same as before, or you can add an OnCloseWindow event
handler using an EVT\_CLOSE event table entry.
\wxheading{See also}
\helpref{Backward compatibility}{compat}
\section{OnMenuCommand}
Rename to OldOnMenuCommand, or replace with a series of functions, one for
each case of your old switch statement. Create an event table for your frame
containing EVT\_MENU macros, and insert DECLARE\_EVENT\_TABLE() in your frame class.
\wxheading{See also}
\helpref{Backward compatibility}{compat}
\section{OnSize}
Rename to OldOnSize, or replace arguments with one wxSizeEvent\& argument.
\wxheading{See also}
\helpref{Backward compatibility}{compat}
\section{wxDialog::Show}
If you used {\bf Show} to show a modal dialog, or to override the standard
modal dialog {\bf Show}, use {\bf ShowModal} instead.
\wxheading{See also}
\helpref{Dialogs and controls}{dialogscontrols}
\end{document}

View File

@@ -0,0 +1,28 @@
;;; Tex2RTF initialisation file for 16-bit Winhelp
runTwice = yes
titleFontSize = 12
authorFontSize = 10
authorFontSize = 10
chapterFontSize = 12
sectionFontSize = 12
subsectionFontSize = 12
contentsDepth = 2
headerRule = yes
footerRule = yes
useHeadingStyles = yes
listItemIndent=40
generateHPJ = yes
htmlBrowseButtons = bitmap
winHelpContents = yes
winHelpVersion = 3 ; 3 for Windows 3.x, 4 for Windows 95
winHelpTitle = "wxWindows Porting Guide"
truncateFilenames = yes
combineSubSections = yes
\overview [2] {\rtfonly{See also }\settransparency{on}\sethotspotcolour{off}\sethotspotunderline{on}\winhelponly{\image{}{books.bmp}\settransparency{off}}
\htmlonly{\image{}{books.gif}}\helpref{#1}{#2}
\sethotspotcolour{on}\sethotspotunderline{on}}
\docparam [2]{\parskip{0}{\it #1}\par\parskip{10}\indented{1cm}{#2}}
\wxheading [1]{{\bf \fcol{blue}{#1}}}
\const [0] {{\bf const}}
\constfunc [3] {{\bf #1} {\bf #2}(#3) {\bf const}\index{#2}}

View File

@@ -0,0 +1,289 @@
% LaTeX style file
% Name: texhelp.sty
% Author: Julian Smart
%
% Purpose
% -------
% Style file to enable the simultaneous preparation of printed LaTeX and on-line
% hypertext manuals.
% Use in conjunction with Tex2RTF (see Tex2RTF documentation).
%
% Note that if a non-ASCII character starts a newline and there should be a space
% between the last word on the previous line and the first word on this line,
% you need to use \rtfsp to generate a space in Windows Help. \rtfsp is ignored
% in all other formats.
%
% Julian Smart
% Artificial Intelligence Applications Institute
%
%
% ============== C++/CLIPS Documentation Facilities ==============
%
% Each class definition should be typeset with e.g.
%
% \section{\class{Name}: Parent}
%
% followed by a description of the class.
% Each member should follow:
%
% \membersection{wxName::Member}
%
% with a description of what this member does.
% Then, one (or more if overloaded) member (function) in detail:
%
% \func{return type}{name}{args}
% or
% \member{type}{name}
%
% where args is a list of \param{type}{name}, ...
% Function, e.g.
% e.g. to typeset
%
% void DoIt(char *string);
%
% write:
%
% \func{void}{DoIt}{\param{char *}{string}}
%
\newcommand{\func}[3]{\hangafter=1\noindent\hangindent=10mm
{{\it #1} {\bf #2}\index{#2}}(#3)}
% For function/type definition where the name is a pointer,
% e.g. to typeset
%
% typedef void (*wxFunction)(wxObject&)
%
% write:
%
% \pfunc{typedef void}{wxFunction}{param{wxObject&}}
\newcommand{\pfunc}[3]{\hangafter=1\noindent\hangindent=10mm
{{\it #1} ({\bf *#2})\index{#2}}(#3)}
% Use an ordinary \section command for class name definitions.
% This is used for a member, such as wxBitmap: GetDepth
\newcommand{\membersection}[1]{\subsection*{#1}\index{#1}}
% CLIPS function
\newcommand{\clipsfunc}[3]{\hangafter=1\noindent\hangindent=10mm
{{\bf #1} ({\bf #2}\index{#2}}#3)}
\newcommand{\clipssection}[1]{\chapter{#1}}
% This is used for a CLIPS function name
\newcommand{\functionsection}[1]{\subsection*{#1}}
% Member: a type and a name
\newcommand{\member}[2]{{\bf #1 \it #2}}
% C++ Parameter: a type and a name (no intervening space)
\newcommand{\param}[2]{{\it #1}{\bf #2}}
% CLIPS Parameter: a type and a name (one intervening space)
\newcommand{\cparam}[2]{{\bf #1} {\it #2}}
% Class: puts in index
\newcommand{\class}[1]{#1\index{#1}}
% Void type
\newcommand{\void}{{\it void}}
% Typeset destructor
\newcommand{\destruct}[1]{{$\sim$}#1}
% Typeset insert/extract operators
\newcommand{\cinsert}{$<<$}
\newcommand{\cextract}{$>>$}
% =================== Hypertext facilities ===================
%
% To insert hyperlinks (or references, in Latex), \label the sections
% or membersections \label{ref-label} immediately after the section, on the same line,
% and use \helpref{text-to-show}{ref-label} to make a reference.
%
% Type text with section reference
\newcommand{\helpref}[2]{{\it #1} (p.\ \pageref{#2}) }
% Type text with URL in verbatim mode
\newcommand{\urlref}[2]{#1 (\verb$#2$)}
% Don't typeset section number in LaTeX
\newcommand{\helprefn}[2]{{\it #1}}
% Like helpref, but popup text in WinHelp instead of hyperlinked
\newcommand{\popref}[2]{{\it #1}}
% Like footnote, but popup text.
\newcommand{\footnotepopup}[2]{{\it #1}\footnote{#2}}
% =================== On-line help specific macros ===================
%
% Global document font size/family, help only.
\newcommand{\helpfontsize}[1]{}
\newcommand{\helpfontfamily}[1]{}
% Ignore in all on-line help
\newcommand{\helpignore}[1]{#1}
% Only print in all on-line help
\newcommand{\helponly}[1]{}
% Ignore in LaTeX
\newcommand{\latexignore}[1]{}
% Only print in LaTeX
\newcommand{\latexonly}[1]{#1}
% Ignore in linear RTF
\newcommand{\rtfignore}[1]{#1}
% Only print in linear RTF
\newcommand{\rtfonly}[1]{}
% Ignore in WinHelp RTF
\newcommand{\winhelpignore}[1]{#1}
% Only print in WinHelp RTF
\newcommand{\winhelponly}[1]{}
% Ignore in wxHelp
\newcommand{\xlpignore}[1]{#1}
% Only print in wxHelp
\newcommand{\xlponly}[1]{}
% Ignore in HTML
\newcommand{\htmlignore}[1]{#1}
% Only print in HTML
\newcommand{\htmlonly}[1]{}
% Input a file only for help system (binder thickness is not a limitation
% in help systems!)
\newcommand{\helpinput}[1]{}
\newcommand{\rtfsp}{ } % Force a space in RTF, ignore in Latex
% =================== Miscellaneous macros ===================
%
% Headings consistent with generated ones
\newcommand{\myheading}[1]{\vspace*{25pt}
\begin{flushleft}
{\LARGE \bf #1}
\end{flushleft}
\vskip 20pt
}
% Heading with entry in contents page.
\newcommand{\chapterheading}[1]{\myheading{#1}
\addcontentsline{toc}{chapter}{#1}}
\newcommand{\sectionheading}[1]{\myheading{#1}
\addcontentsline{toc}{section}{#1}}
% Glossary environment
\newenvironment{helpglossary}{\newpage\chapterheading{Glossary}\begin{description}}{\end{description}}
% Glossary entry
\newcommand{\gloss}[1]{\item[#1]\index{#1}}
% Image: EPS in Latex, BMP or MF (whatever's available) in RTF. Requires psbox.
\newcommand{\image}[2]{\psboxto(#1){#2}}
% Image, left aligned (HTML)
\newcommand{\imager}[2]{\psboxto(#1){#2}}
% Image, right aligned (HTML)
\newcommand{\imagel}[2]{\psboxto(#1){#2}}
% Imagemap: principally for HTML only. In Latex,
% acts like \image.
\newcommand{\imagemap}[3]{\psboxto(#1){#2}}
% Headers and footers
% \setheader{EvenPageLeft}{EvenPageCentre}{EvenPageRight}
% {OddPageLeft}{OddPageCentre}{OddPageRight}
\newcommand{\setheader}[6]{
\lhead[\fancyplain{}{#1}]{\fancyplain{}{#4}}
\chead[\fancyplain{}{#2}]{\fancyplain{}{#5}}
\rhead[\fancyplain{}{#3}]{\fancyplain{}{#6}}
}
% \setfooter{EvenPageLeft}{EvenPageCentre}{EvenPageRight}
% {OddPageLeft}{OddPageCentre}{OddPageRight}
\newcommand{\setfooter}[6]{
\lfoot[\fancyplain{#1}{#1}]{\fancyplain{#4}{#4}}
\cfoot[\fancyplain{#2}{#2}]{\fancyplain{#5}{#5}}
\rfoot[\fancyplain{#3}{#3}]{\fancyplain{#6}{#6}}
}
% Needed for telling RTF where margin paragraph should go
% in mirrored margins mode.
\newcommand{\marginpareven}[1]{\hspace*{0pt}\marginpar{#1}}
\newcommand{\marginparodd}[1]{\hspace*{0pt}\marginpar{#1}}
% Environment for two-column table popular in WinHelp and manuals.
\newcommand{\twocolwidtha}[1]{\def\twocolwidthaval{#1}}
\newcommand{\twocolwidthb}[1]{\def\twocolwidthbval{#1}}
\newcommand{\twocolspacing}[1]{\def\twocolspacingval{#1}}
\twocolwidtha{3cm}
\twocolwidthb{8.5cm}
\twocolspacing{2}
\newcommand{\twocolitem}[2]{#1 & #2\\}
\newcommand{\twocolitemruled}[2]{#1 & #2\\\hline}
\newenvironment{twocollist}{\renewcommand{\arraystretch}{\twocolspacingval}\begin{tabular}{lp{\twocolwidthbval}}}%
{\end{tabular}\renewcommand{\arraystretch}{1}}
% Specifying table rows for RTF compatibility
\newcommand{\row}[1]{#1\\}
% Use for the last ruled row for correct RTF generation.
\newcommand{\ruledrow}[1]{#1\\\hline}
% Indentation environment. Arg1 is left margin size
\newenvironment{indented}[1]{\begin{list}{}{\leftmargin=#1}\item[]}%
{\end{list}}
% Framed box of text, normal formatting.
\newcommand{\normalbox}[1]{\fbox{\vbox{#1}}}
% Double-framed box of text.
\newcommand{\normalboxd}[1]{\fbox{\fbox{\vbox{#1}}}}
% WITHDRAWN -- can't do in RTF, easily.
% Framed box of text, horizontally centred. Ragged right within box.
% \newcommand{\centeredbox}[2]{\begin{center}\fbox{\parbox{#1}{\raggedright#2}}\end{center}}
% Double-framed box of text, horizontally centred. Ragged right within box.
% \newcommand{\centeredboxd}[2]{\begin{center}\fbox{\fbox{\parbox{#1}{\raggedright#2}}}\end{center}}
% toocomplex environment: simply prints the argument in LaTeX,
% comes out verbatim in all generated formats.
\newenvironment{toocomplex}{}{}
% Colour: dummy commands since LaTeX doesn't support colour.
% \definecolour{name}{red}{blue}{green}
% \fcol{name}{text} ; Foreground
% \bcol{name}{text} ; Background
\newcommand{\definecolour}[4]{}
\newcommand{\definecolor}[4]{}
\newcommand{\fcol}[2]{#2}
\newcommand{\bcol}[2]{#2}
\newcommand{\sethotspotcolour}[1]{}
\newcommand{\sethotspotunderline}[1]{}
\newcommand{\settransparency}[1]{}
\newcommand{\backslashraw}[0]{}
\newcommand{\lbraceraw}[0]{}
\newcommand{\rbraceraw}[0]{}
\newcommand{\registered}[0]{(r)}
\newcommand{\background}[1]{}
\newcommand{\textcolour}[1]{}
\newcommand{\overview}[2]{See \helpref{#1}{#2}.}
\newcommand{\docparam}[2]{{\it #1}\begin{list}{}{\leftmargin=1cm}\item[]
#2%
\end{list}}
\newcommand{\wxheading}[1]{{\bf #1}}
\newcommand{\const}[0]{{\bf const}}
\newcommand{\constfunc}[3]{{\bf #1} {\bf #2}(#3) {\bf const}\index{#2}}

View File

@@ -0,0 +1 @@
GIF87a

After

Width:  |  Height:  |  Size: 6 B

View File

@@ -0,0 +1,56 @@
\section{\class{wxActivateEvent}}\label{wxactivateevent}
An activate event is sent when a window or application is being activated
or deactivated.
\wxheading{Derived from}
\helpref{wxEvent}{wxevent}\\
\helpref{wxObject}{wxobject}
\wxheading{Event table macros}
To process an activate event, use these event handler macros to direct input to a member
function that takes a wxActivateEvent argument.
\twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf EVT\_ACTIVATE(func)}}{Process a wxEVT\_ACTIVATE event.}
\twocolitem{{\bf EVT\_ACTIVATE\_APP(func)}}{Process a wxEVT\_ACTIVATE\_APP event.}
\end{twocollist}%
\wxheading{Remarks}
A top-level window (a dialog or frame) receives an activate event when is
being activated or deactivated. This is indicated visually by the title
bar changing colour, and a subwindow gaining the keyboard focus.
An application is activated or deactivated when one of its frames becomes activated,
or a frame becomes inactivate resulting in all application frames being inactive. (Windows only)
\wxheading{See also}
\helpref{wxWindow::OnActivate}{wxwindowonactivate},\rtfsp
\helpref{wxApp::OnActivate}{wxapponactivate},\rtfsp
\helpref{Event handling overview}{eventhandlingoverview}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxActivateEvent::wxActivateEvent}
\func{}{wxActivateEvent}{\param{WXTYPE }{eventType = 0}, \param{int }{id = 0}}
Constructor.
\membersection{wxActivateEvent::m\_active}
\member{bool}{m\_active}
TRUE if the window or application was activated.
\membersection{wxActivateEvent::GetActive}\label{wxactivateeventgetactive}
\constfunc{bool}{GetActive}{\void}
Returns TRUE if the application or window is being activated, FALSE otherwise.

395
docs/latex/wx/app.tex Normal file
View File

@@ -0,0 +1,395 @@
\section{\class{wxApp}}\label{wxapp}
The {\bf wxApp} class represents the application itself. It is used
to:
\begin{itemize}\itemsep=0pt
\item set and get application-wide properties;
\item implement the windowing system message or event loop;
\item initiate application processing via \helpref{wxApp::OnInit}{wxapponinit};
\item allow default processing of events not handled by other
objects in the application.
\end{itemize}
You should use the macro IMPLEMENT\_APP(appClass) in your application implementation
file to tell wxWindows how to create an instance of your application class.
Use DECLARE\_APP(appClass) in a header file if you want the wxGetApp function (which returns
a reference to your application object) to be visible to other files.
\wxheading{Derived from}
\helpref{wxEvtHandler}{wxevthandler}\\
\helpref{wxObject}{wxobject}
\wxheading{See also}
\helpref{wxApp overview}{wxappoverview}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxApp::wxApp}
\func{void}{wxApp}{\param{int}{ language = wxLANGUAGE\_ENGLISH}}
Constructor. Called implicitly with a definition of a wxApp object.
The argument is a language identifier; this is an experimental
feature and will be expanded and documented in future versions.
TODO: completely rewrite the language stuff.
\membersection{wxApp::\destruct{wxApp}}
\func{void}{\destruct{wxApp}}{\void}
Destructor. Will be called implicitly on program exit if the wxApp
object is created on the stack.
\membersection{wxApp::argc}\label{wxappargc}
\member{int}{argc}
Number of command line arguments (after environment-specific processing).
\membersection{wxApp::argv}\label{wxappargv}
\member{char **}{argv}
Command line arguments (after environment-specific processing).
\membersection{wxApp::CreateLogTarget}\label{wxappcreatelogtarget}
\func{virtual wxLog*}{CreateLogTarget}{\void}
Creates a wxLog class for the application to use for logging errors. The default
implementation returns a new wxLogGui class.
\wxheading{See also}
\helpref{wxLog}{wxlog}
\membersection{wxApp::Dispatch}\label{wxappdispatch}
\func{void}{Dispatch}{\void}
Dispatches the next event in the windowing system event queue.
This can be used for programming event loops, e.g.
\begin{verbatim}
while (app.Pending())
Dispatch();
\end{verbatim}
\wxheading{See also}
\helpref{wxApp::Pending}{wxapppending}
\membersection{wxApp::GetAppName}\label{wxappgetappname}
\constfunc{wxString}{GetAppName}{\void}
Returns the application name.
\wxheading{Remarks}
wxWindows sets this to a reasonable default before
calling \helpref{wxApp::OnInit}{wxapponinit}, but the application can reset it at will.
\membersection{wxApp::GetAuto3D}\label{wxappgetauto3d}
\constfunc{bool}{GetAuto3D}{\void}
Returns TRUE if 3D control mode is on, FALSE otherwise.
\wxheading{See also}
\helpref{wxApp::SetAuto3D}{wxappsetauto3d}
\membersection{wxApp::GetClassName}\label{wxappgetclassname}
\constfunc{wxString}{GetClassName}{\void}
Gets the class name of the application. The class name may be used in a platform specific
manner to refer to the application.
\wxheading{See also}
\helpref{wxApp::SetClassName}{wxappsetclassname}
\membersection{wxApp::GetExitOnDelete}\label{wxappgetexitondelete}
\constfunc{bool}{GetExitOnDelete}{\void}
Returns TRUE if the application will exit when the top-level window is deleted, FALSE
otherwise.
\wxheading{See also}
\helpref{wxApp::SetExitOnDelete}{wxappsetexitondelete}
\membersection{wxApp::GetPrintMode}\label{wxappgetprintmode}
\constfunc{bool}{GetPrintMode}{\void}
Returns the print mode: see \helpref{wxApp::SetPrintMode}{wxappsetprintmode}.
\membersection{wxApp::GetTopWindow}\label{wxappgettopwindow}
\constfunc{wxWindow *}{GetTopWindow}{\void}
Returns a pointer to the top window.
\wxheading{See also}
\helpref{wxApp::SetTopWindow}{wxappsettopwindow}
\membersection{wxApp::ExitMainLoop}\label{wxappexitmainloop}
\func{void}{ExitMainLoop}{\void}
Call this to explicitly exit the main message (event) loop.
You should normally exit the main loop (and the application) by deleting
the top window.
\membersection{wxApp::Initialized}\label{wxappinitialized}
\func{bool}{Initialized}{\void}
Returns TRUE if the application has been initialized (i.e. if\rtfsp
\helpref{wxApp::OnInit}{wxapponinit} has returned successfully). This can be useful for error
message routines to determine which method of output is best for the
current state of the program (some windowing systems may not like
dialogs to pop up before the main loop has been entered).
\membersection{wxApp::MainLoop}\label{wxappmainloop}
\func{int}{MainLoop}{\void}
Called by wxWindows on creation of the application. Override this if you wish
to provide your own (environment-dependent) main loop.
\wxheading{Return value}
Returns 0 under X, and the wParam of the WM\_QUIT message under Windows.
\membersection{wxApp::OnActivate}\label{wxapponactivate}
\func{void}{OnActivate}{\param{wxActivateEvent\& }{event}}
Provide this member function to know whether the application is being
activated or deactivated (Windows only).
\wxheading{See also}
\helpref{wxWindow::OnActivate}{wxwindowonactivate}, \helpref{wxActivateEvent}{wxactivateevent}
\membersection{wxApp::OnExit}\label{wxapponexit}
\func{int}{OnExit}{\void}
Provide this member function for any processing which needs to be done as
the application is about to exit.
\membersection{wxApp::OnCharHook}\label{wxapponcharhook}
\func{void}{OnCharHook}{\param{wxKeyEvent\&}{ event}}
This event handler function is called (under Windows only) to allow the window to intercept keyboard events
before they are processed by child windows.
\wxheading{Parameters}
\docparam{event}{The keypress event.}
\wxheading{Remarks}
Use the wxEVT\_CHAR\_HOOK macro in your event table.
If you use this member, you can selectively consume keypress events by calling\rtfsp
\helpref{wxEvent::Skip}{wxeventskip} for characters the application is not interested in.
\wxheading{See also}
\helpref{wxKeyEvent}{wxkeyevent}, \helpref{wxWindow::OnChar}{wxwindowonchar},\rtfsp
\helpref{wxWindow::OnCharHook}{wxwindowoncharhook}, \helpref{wxDialog::OnCharHook}{wxdialogoncharhook}
\membersection{wxApp::OnIdle}\label{wxapponidle}
\func{void}{OnIdle}{\param{wxIdleEvent\& }{event}}
Override this member function for any processing which needs to be done
when the application is idle. You should call wxApp::OnIdle from your own function,
since this forwards OnIdle events to windows and also performs garbage collection for
windows whose destruction has been delayed.
wxWindows' strategy for OnIdle processing is as follows. After pending user interface events for an
application have all been processed, wxWindows sends an OnIdle event to the application object. wxApp::OnIdle itself
sends an OnIdle event to each application window, allowing windows to do idle processing such as updating
their appearance. If either wxApp::OnIdle or a window OnIdle function requested more time, by
caling \helpref{wxIdleEvent::ReqestMore}{wxidleeventrequestmore}, wxWindows will send another OnIdle
event to the application event. This will occur in a loop until either a user event is found to be
pending, or OnIdle requests no more time. Then all pending user events are processed until the system
goes idle again, when OnIdle is called, and so on.
\wxheading{See also}
\helpref{wxWindow::OnIdle}{wxwindowonidle}, \helpref{wxIdleEvent}{wxidleevent},\rtfsp
\helpref{wxWindow::SendIdleEvents}{wxappsendidleevents}
\membersection{wxApp::OnInit}\label{wxapponinit}
\func{bool}{OnInit}{\void}
This must be provided by the application, and will usually create the
application's main window, calling \helpref{wxApp::SetTopWindow}{wxappsettopwindow}.
Return TRUE to continue processing, FALSE to exit the application.
\membersection{wxApp::Pending}\label{wxapppending}
\func{bool}{Pending}{\void}
Returns TRUE if unprocessed events are in the window system event queue
(MS Windows and Motif).
\wxheading{See also}
\helpref{wxApp::Dispatch}{wxappdispatch}
\membersection{wxApp::ProcessMessage}\label{wxappprocessmessage}
\func{bool}{ProcessMessage}{\param{MSG *}{msg}}
Windows-only function for processing a message. This function
is called from the main message loop, checking for windows that
may wish to process it. The function returns TRUE if the message
was processed, FALSE otherwise. If you use wxWindows with another class
library with its own message loop, you should make sure that this
function is called to allow wxWindows to receive messages. For example,
to allow co-existance with the Microsoft Foundation Classes, override
the PreTranslateMessage function:
\begin{verbatim}
// Provide wxWindows message loop compatibility
BOOL CTheApp::PreTranslateMessage(MSG *msg)
{
if (wxTheApp && wxTheApp->ProcessMessage(msg))
return TRUE;
else
return CWinApp::PreTranslateMessage(msg);
}
\end{verbatim}
\membersection{wxApp::SendIdleEvents}\label{wxappsendidleevents}
\func{bool}{SendIdleEvents}{\void}
Sends idle events to all top-level windows.
\func{bool}{SendIdleEvents}{\param{wxWindow*}{ win}}
Sends idle events to a window and its children.
\wxheading{Remarks}
These functions poll the top-level windows, and their children, for idle event processing.
If TRUE is returned, more OnIdle processing is requested by one or more window.
\wxheading{See also}
\helpref{wxApp::OnIdle}{wxapponidle}, \helpref{wxWindow::OnIdle}{wxwindowonidle}, \helpref{wxIdleEvent}{wxidleevent}
\membersection{wxApp::SetAppName}\label{wxappsetappname}
\func{void}{SetAppName}{\param{const wxString\& }{name}}
Sets the name of the application. The name may be used in dialogs
(for example by the document/view framework). A default name is set by
wxWindows.
\wxheading{See also}
\helpref{wxApp::GetAppName}{wxappgetappname}
\membersection{wxApp::SetAuto3D}\label{wxappsetauto3d}
\func{void}{SetAuto3D}{\param{const bool}{ auto3D}}
Switches automatic 3D controls on or off.
\wxheading{Parameters}
\docparam{auto3D}{If TRUE, all controls will be created with 3D appearances unless
overridden for a control or dialog. The default is TRUE}
\wxheading{Remarks}
This has an effect on Windows only.
\wxheading{See also}
\helpref{wxApp::GetAuto3D}{wxappgetauto3d}
\membersection{wxApp::SetClassName}\label{wxappsetclassname}
\func{void}{SetClassName}{\param{const wxString\& }{name}}
Sets the class name of the application. This may be used in a platform specific
manner to refer to the application.
\wxheading{See also}
\helpref{wxApp::GetClassName}{wxappgetclassname}
\membersection{wxApp::SetExitOnDelete}\label{wxappsetexitondelete}
\func{void}{SetExitOnDelete}{\param{bool}{ flag}}
Allows the programmer to specify whether the application will exit when the
top-level frame is deleted.
\wxheading{Parameters}
\docparam{flag}{If TRUE (the default), the application will exit when the top-level frame is
deleted. If FALSE, the application will continue to run.}
\wxheading{Remarks}
Currently, setting this to FALSE only has an effect under Windows.
\membersection{wxApp::SetPrintMode}\label{wxappsetprintmode}
\func{void}{SetPrintMode}{\param{int}{ mode}}
Sets the print mode determining what printing facilities will be
used by the printing framework.
\wxheading{Parameters}
\docparam{mode}{This can be one of:
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf wxPRINT\_WINDOWS}}{Under Windows, use Windows printing (wxPrinterDC). This is the
default under Windows.}
\twocolitem{{\bf wxPRINT\_POSTSCRIPT}}{Use PostScript printing (wxPostScriptDC). This is the
default for non-Windows platforms.}
\end{twocollist}
}%
\membersection{wxApp::SetTopWindow}\label{wxappsettopwindow}
\func{void}{SetTopWindow}{\param{wxWindow* }{window}}
Sets the `top' window. You should normally call this from within \helpref{wxApp::OnInit}{wxapponinit} to
let wxWindows know which is the main window.
\wxheading{Parameters}
\docparam{window}{The new top window.}
\wxheading{See also}
\helpref{wxApp::GetTopWindow}{wxappgettopwindow}, \helpref{wxApp::OnInit}{wxapponinit}

BIN
docs/latex/wx/back.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

223
docs/latex/wx/bbutton.tex Normal file
View File

@@ -0,0 +1,223 @@
\section{\class{wxBitmapButton}}\label{wxbitmapbutton}
A bitmap button is a control that contains a bitmap.
It may be placed on a \helpref{dialog box}{wxdialog} or \helpref{panel}{wxpanel}, or indeed
almost any other window.
\wxheading{Derived from}
\helpref{wxButton}{wxbutton}\\
\helpref{wxControl}{wxcontrol}\\
\helpref{wxWindow}{wxwindow}\\
\helpref{wxEvtHandler}{wxevthandler}\\
\helpref{wxObject}{wxobject}
\wxheading{Remarks}
A bitmap button can be supplied with a single bitmap, and wxWindows will draw
all button states using this bitmap. If the application needs more control, additional bitmaps for
the selected state, unpressed focussed state, and greyed-out state may be supplied.
\wxheading{Window styles}
\twocolwidtha{5cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{\windowstyle{wxBU\_AUTODRAW}}{If
this is specified, the button will be drawn automatically using the label bitmap only, providing
a 3D-look border. If this style is not specified, the button will be drawn without borders and using all
provided bitmaps.}
\end{twocollist}
See also \helpref{window styles overview}{windowstyles}.
\wxheading{See also}
\helpref{wxButton}{wxbutton}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxBitmapButton::wxBitmapButton}\label{wxbitmapbuttonconstr}
\func{}{wxBitmapButton}{\void}
Default constructor.
\func{}{wxBitmapButton}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id}, \param{const wxBitmap\& }{bitmap},\rtfsp
\param{const wxPoint\& }{pos}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
\param{long}{ style = wxBU\_AUTODRAW}, \param{const wxValidator\& }{validator}, \param{const wxString\& }{name = ``button"}}
Constructor, creating and showing a button.
\wxheading{Parameters}
\docparam{parent}{Parent window. Must not be NULL.}
\docparam{id}{Button identifier. A value of -1 indicates a default value.}
\docparam{bitmap}{Bitmap to be displayed.}
\docparam{pos}{Button position.}
\docparam{size}{Button size. If the default size (-1, -1) is specified then the button is sized
appropriately for the bitmap.}
\docparam{style}{Window style. See \helpref{wxBitmapButton}{wxbitmapbutton}.}
\docparam{validator}{Window validator.}
\docparam{name}{Window name.}
\wxheading{Remarks}
The {\it bitmap} parameter is normally the only bitmap you need to provide, and wxWindows will
draw the button correctly in its different states. If you want more control, call
any of the functions \helpref{wxBitmapButton::SetBitmapSelected}{wxbitmapbuttonsetbitmapselected},\rtfsp
\helpref{wxBitmapButton::SetBitmapFocus}{wxbitmapbuttonsetbitmapfocus},\rtfsp
\helpref{wxBitmapButton::SetBitmapDisabled}{wxbitmapbuttonsetbitmapdisabled}.
Note that the bitmap passed is smaller than the actual button created.
\wxheading{See also}
\helpref{wxBitmapButton::Create}{wxbitmapbuttoncreate}, \helpref{wxValidator}{wxvalidator}
\membersection{wxBitmapButton::\destruct{wxBitmapButton}}
\func{}{\destruct{wxBitmapButton}}{\void}
Destructor, destroying the button.
\membersection{wxBitmapButton::Create}\label{wxbitmapbuttoncreate}
\func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id}, \param{const wxBitmap\& }{bitmap},\rtfsp
\param{const wxPoint\& }{pos}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
\param{long}{ style = 0}, \param{const wxValidator\& }{validator}, \param{const wxString\& }{name = ``button"}}
Button creation function for two-step creation. For more details, see \helpref{wxBitmapButton::wxBitmapButton}{wxbitmapbuttonconstr}.
\membersection{wxBitmapButton::GetBitmapDisabled}\label{wxbitmapbuttongetbitmapdisabled}
\constfunc{wxBitmap\&}{GetBitmapLabel}{\void}
Returns the bitmap for the disabled state.
\wxheading{Return value}
A reference to the disabled state bitmap.
\wxheading{See also}
\helpref{wxBitmapButton::SetBitmapDisabled}{wxbitmapbuttonsetbitmapdisabled}
\membersection{wxBitmapButton::GetBitmapFocus}\label{wxbitmapbuttongetbitmapfocus}
\constfunc{wxBitmap\&}{GetBitmapFocus}{\void}
Returns the bitmap for the focussed state.
\wxheading{Return value}
A reference to the focussed state bitmap.
\wxheading{See also}
\helpref{wxBitmapButton::SetBitmapFocus}{wxbitmapbuttonsetbitmapfocus}
\membersection{wxBitmapButton::GetBitmapLabel}\label{wxbitmapbuttongetbitmaplabel}
\constfunc{wxBitmap\&}{GetBitmapLabel}{\void}
Returns the label bitmap (the one passed to the constructor).
\wxheading{Return value}
A reference to the button's label bitmap.
\wxheading{See also}
\helpref{wxBitmapButton::SetBitmapLabel}{wxbitmapbuttonsetbitmaplabel}
\membersection{wxBitmapButton::GetBitmapSelected}\label{wxbitmapbuttongetbitmapselected}
\constfunc{wxBitmap\&}{GetBitmapSelected}{\void}
Returns the bitmap for the selected state.
\wxheading{Return value}
A reference to the selected state bitmap.
\wxheading{See also}
\helpref{wxBitmapButton::SetBitmapSelected}{wxbitmapbuttonsetbitmapselected}
\membersection{wxBitmapButton::SetBitmapDisabled}\label{wxbitmapbuttonsetbitmapdisabled}
\func{void}{SetBitmapDisabled}{\param{const wxBitmap\& }{bitmap}}
Sets the bitmap for the disabled button appearance.
\wxheading{Parameters}
\docparam{bitmap}{The bitmap to set.}
\wxheading{See also}
\helpref{wxBitmapButton::GetBitmapDisabled}{wxbitmapbuttongetbitmapdisabled},\rtfsp
\helpref{wxBitmapButton::SetBitmapLabel}{wxbitmapbuttonsetbitmaplabel},\rtfsp
\helpref{wxBitmapButton::SetBitmapSelected}{wxbitmapbuttonsetbitmapselected},\rtfsp
\helpref{wxBitmapButton::SetBitmapFocus}{wxbitmapbuttonsetbitmapfocus}
\membersection{wxBitmapButton::SetBitmapFocus}\label{wxbitmapbuttonsetbitmapfocus}
\func{void}{SetBitmapFocus}{\param{const wxBitmap\& }{bitmap}}
Sets the bitmap for the button appearance when it has the keyboard focus.
\wxheading{Parameters}
\docparam{bitmap}{The bitmap to set.}
\wxheading{See also}
\helpref{wxBitmapButton::GetBitmapFocus}{wxbitmapbuttongetbitmapfocus},\rtfsp
\helpref{wxBitmapButton::SetBitmapLabel}{wxbitmapbuttonsetbitmaplabel},\rtfsp
\helpref{wxBitmapButton::SetBitmapSelected}{wxbitmapbuttonsetbitmapselected},\rtfsp
\helpref{wxBitmapButton::SetBitmapDisabled}{wxbitmapbuttonsetbitmapdisabled}
\membersection{wxBitmapButton::SetBitmapLabel}\label{wxbitmapbuttonsetbitmaplabel}
\func{void}{SetBitmapLabel}{\param{const wxBitmap\& }{bitmap}}
Sets the bitmap label for the button.
\wxheading{Parameters}
\docparam{bitmap}{The bitmap label to set.}
\wxheading{Remarks}
This is the bitmap used for the unselected state, and for all other states
if no other bitmaps are provided.
\wxheading{See also}
\helpref{wxBitmapButton::GetBitmapLabel}{wxbitmapbuttongetbitmaplabel}
\membersection{wxBitmapButton::SetBitmapSelected}\label{wxbitmapbuttonsetbitmapselected}
\func{void}{SetBitmapSelected}{\param{const wxBitmap\& }{bitmap}}
Sets the bitmap for the selected (depressed) button appearance.
\wxheading{Parameters}
\docparam{bitmap}{The bitmap to set.}
\wxheading{See also}
\helpref{wxBitmapButton::GetBitmapSelected}{wxbitmapbuttongetbitmapselected},\rtfsp
\helpref{wxBitmapButton::SetBitmapLabel}{wxbitmapbuttonsetbitmaplabel},\rtfsp
\helpref{wxBitmapButton::SetBitmapFocus}{wxbitmapbuttonsetbitmapfocus},\rtfsp
\helpref{wxBitmapButton::SetBitmapDisabled}{wxbitmapbuttonsetbitmapdisabled}

683
docs/latex/wx/bitmap.tex Normal file
View File

@@ -0,0 +1,683 @@
\section{\class{wxBitmap}}\label{wxbitmap}
%\overview{Overview}{wxbitmapoverview}
%
This class encapsulates the concept of a platform-dependent bitmap,
either monochrome or colour.
\wxheading{Derived from}
\helpref{wxGDIObject}{wxgdiobject}\\
\helpref{wxObject}{wxobject}
\wxheading{See also}
\helpref{wxBitmap overview}{wxbitmapoverview}, \helpref{wxDC::Blit}{wxdcblit}, \helpref{wxIcon}{wxicon}, \helpref{wxCursor}{wxcursor}, \helpref{wxMemoryDC}{wxmemorydc}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxBitmap::wxBitmap}\label{wxbitmapconstr}
\func{}{wxBitmap}{\void}
Default constructor.
\func{}{wxBitmap}{\param{const wxBitmap\& }{bitmap}}
\func{}{wxBitmap}{\param{const wxBitmap* }{bitmap}}
Copy constructors.
\func{}{wxBitmap}{\param{void*}{ data}, \param{int}{ type}, \param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}}
Creates a bitmap from the given data, which can be of arbitrary type.
\func{}{wxBitmap}{\param{const char}{ bits[]}, \param{int}{ width}, \param{int}{ height}\\
\param{int}{ depth = 1}}
Creates a bitmap from an array of bits.
\func{}{wxBitmap}{\param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}}
Creates a new bitmap.
\func{}{wxBitmap}{\param{const char**}{ bits}}
Creates a bitmap from XPM data.
\func{}{wxBitmap}{\param{const wxString\& }{name}, \param{long}{ type}}
Loads a bitmap from a file or resource.
\wxheading{Parameters}
\docparam{bits}{Specifies an array of pixel values.}
\docparam{width}{Specifies the width of the bitmap.}
\docparam{height}{Specifies the height of the bitmap.}
\docparam{depth}{Specifies the depth of the bitmap. If this is omitted, the display depth of the
screen is used.}
\docparam{name}{This can refer to a resource name under MS Windows, or a filename under MS Windows and X.
Its meaning is determined by the {\it flags} parameter.}
\docparam{type}{May be one of the following:
\twocolwidtha{5cm}
\begin{twocollist}
\twocolitem{{\bf \indexit{wxBITMAP\_TYPE\_BMP}}}{Load a Windows bitmap file.}
\twocolitem{{\bf \indexit{wxBITMAP\_TYPE\_BMP\_RESOURCE}}}{Load a Windows bitmap from the resource database.}
\twocolitem{{\bf \indexit{wxBITMAP\_TYPE\_GIF}}}{Load a GIF bitmap file.}
\twocolitem{{\bf \indexit{wxBITMAP\_TYPE\_XBM}}}{Load an X bitmap file.}
\twocolitem{{\bf \indexit{wxBITMAP\_TYPE\_XPM}}}{Load an XPM bitmap file.}
\twocolitem{{\bf \indexit{wxBITMAP\_TYPE\_RESOURCE}}}{Load a Windows resource name.}
\end{twocollist}
The validity of these flags depends on the platform and wxWindows configuration.
If all possible wxWindows settings are used, the Windows platform supports BMP, BMP\_RESOURCE,
XPM\_DATA, and XPM. Under X, the available formats are BMP, GIF, XBM, and XPM.}
\wxheading{Remarks}
The first form constructs a bitmap object with no data; an assignment or another member function such as Create
or LoadFile must be called subsequently.
The second and third forms provide copy constructors. Note that these do not copy the
bitmap data, but instead a pointer to the data, keeping a reference count. They are therefore
very efficient operations.
The fourth form constructs a bitmap from data whose type and value depends on
the value of the {\it type} argument.
The fifth form constructs a (usually monochrome) bitmap from an array of pixel values, under both
X and Windows.
The sixth form constructs a new bitmap.
The seventh form constructs a bitmap from pixmap (XPM) data, if wxWindows has been configured
to incorporate this feature.
To use this constructor, you must first include an XPM file. For
example, assuming that the file {\tt mybitmap.xpm} contains an XPM array
of character pointers called mybitmap:
\begin{verbatim}
#include "mybitmap.xpm"
...
wxBitmap *bitmap = new wxBitmap(mybitmap);
\end{verbatim}
The eighth form constructs a bitmap from a file or resource. {\it name} can refer
to a resource name under MS Windows, or a filename under MS Windows and X.
Under Windows, {\it type} defaults to wxBITMAP\_TYPE\_BMP\_RESOURCE.
Under X, {\it type} defaults to wxBITMAP\_TYPE\_XBM.
\wxheading{See also}
\helpref{wxBitmap::LoadFile}{wxbitmaploadfile}
\membersection{wxBitmap::\destruct{wxBitmap}}
\func{}{\destruct{wxBitmap}}{\void}
Destroys the wxBitmap object and possibly the underlying bitmap data.
Because reference counting is used, the bitmap may not actually be
destroyed at this point - only when the reference count is zero will the
data be deleted.
If the application omits to delete the bitmap explicitly, the bitmap will be
destroyed automatically by wxWindows when the application exits.
Do not delete a bitmap that is selected into a memory device context.
\membersection{wxBitmap::AddHandler}\label{wxbitmapaddhandler}
\func{static void}{AddHandler}{\param{wxBitmapHandler*}{ handler}}
Adds a handler to the end of the static list of format handlers.
\docparam{handler}{A new bitmap format handler object. There is usually only one instance
of a given handler class in an application session.}
\wxheading{See also}
\helpref{wxBitmapHandler}{wxbitmaphandler}
\membersection{wxBitmap::CleanUpHandlers}
\func{static void}{CleanUpHandlers}{\void}
Deletes all bitmap handlers.
This function is called by wxWindows on exit.
\membersection{wxBitmap::Create}
\func{virtual bool}{Create}{\param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}}
Creates a fresh bitmap. If the final argument is omitted, the display depth of
the screen is used.
\func{virtual bool}{Create}{\param{void*}{ data}, \param{int}{ type}, \param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}}
Creates a bitmap from the given data, which can be of arbitrary type.
\wxheading{Parameters}
\docparam{width}{The width of the bitmap in pixels.}
\docparam{height}{The height of the bitmap in pixels.}
\docparam{depth}{The depth of the bitmap in pixels. If this is -1, the screen depth is used.}
\docparam{data}{Data whose type depends on the value of {\it type}.}
\docparam{type}{A bitmap type identifier - see \helpref{wxBitmap::wxBitmap}{wxbitmapconstr} for a list
of possible values.}
\wxheading{Return value}
TRUE if the call succeeded, FALSE otherwise.
\wxheading{Remarks}
The first form works on all platforms. The portability of the second form depends on the
type of data.
\wxheading{See also}
\helpref{wxBitmap::wxBitmap}{wxbitmapconstr}
\membersection{wxBitmap::FindHandler}
\func{static wxBitmapHandler*}{FindHandler}{\param{const wxString\& }{name}}
Finds the handler with the given name.
\func{static wxBitmapHandler*}{FindHandler}{\param{const wxString\& }{extension}, \param{long}{ bitmapType}}
Finds the handler associated with the given extension and type.
\func{static wxBitmapHandler*}{FindHandler}{\param{long }{bitmapType}}
Finds the handler associated with the given bitmap type.
\docparam{name}{The handler name.}
\docparam{extension}{The file extension, such as ``bmp".}
\docparam{bitmapType}{The bitmap type, such as wxBITMAP\_TYPE\_BMP.}
\wxheading{Return value}
A pointer to the handler if found, NULL otherwise.
\wxheading{See also}
\helpref{wxBitmapHandler}{wxbitmaphandler}
\membersection{wxBitmap::GetDepth}
\constfunc{int}{GetDepth}{\void}
Gets the colour depth of the bitmap. A value of 1 indicates a
monochrome bitmap.
\membersection{wxBitmap::GetHandlers}
\func{static wxList\&}{GetHandlers}{\void}
Returns the static list of bitmap format handlers.
\wxheading{See also}
\helpref{wxBitmapHandler}{wxbitmaphandler}
\membersection{wxBitmap::GetHeight}\label{wxbitmapgetheight}
\constfunc{int}{GetHeight}{\void}
Gets the height of the bitmap in pixels.
\membersection{wxBitmap::GetPalette}\label{wxbitmapgetpalette}
\constfunc{wxPalette*}{GetPalette}{\void}
Gets the associated palette (if any) which may have been loaded from a file
or set for the bitmap.
\wxheading{See also}
\helpref{wxPalette}{wxpalette}
\membersection{wxBitmap::GetMask}\label{wxbitmapgetmask}
\constfunc{wxMask*}{GetMask}{\void}
Gets the associated mask if any) which may have been loaded from a file
or set for the bitmap.
\wxheading{See also}
\helpref{wxBitmap::SetMask}{wxbitmapsetmask}, \helpref{wxMask}{wxmask}
\membersection{wxBitmap::GetWidth}\label{wxbitmapgetwidth}
\constfunc{int}{GetWidth}{\void}
Gets the width of the bitmap in pixels.
\wxheading{See also}
\helpref{wxBitmap::GetHeight}{wxbitmapgetheight}
\membersection{wxBitmap::InitStandardHandlers}
\func{static void}{InitStandardHandlers}{\void}
Adds the standard bitmap format handlers, which, depending on wxWindows
configuration, can be handlers for Windows bitmap, Windows bitmap resource, and XPM.
This function is called by wxWindows on startup.
\wxheading{See also}
\helpref{wxBitmapHandler}{wxbitmaphandler}
\membersection{wxBitmap::InsertHandler}
\func{static void}{InsertHandler}{\param{wxBitmapHandler*}{ handler}}
Adds a handler at the start of the static list of format handlers.
\docparam{handler}{A new bitmap format handler object. There is usually only one instance
of a given handler class in an application session.}
\wxheading{See also}
\helpref{wxBitmapHandler}{wxbitmaphandler}
\membersection{wxBitmap::LoadFile}\label{wxbitmaploadfile}
\func{bool}{LoadFile}{\param{const wxString\&}{ name}, \param{long}{ type}}
Loads a bitmap from a file or resource.
\wxheading{Parameters}
\docparam{name}{Either a filename or a Windows resource name.
The meaning of {\it name} is determined by the {\it type} parameter.}
\docparam{type}{One of the following values:
\twocolwidtha{5cm}
\begin{twocollist}
\twocolitem{{\bf wxBITMAP\_TYPE\_BMP}}{Load a Windows bitmap file.}
\twocolitem{{\bf wxBITMAP\_TYPE\_BMP\_RESOURCE}}{Load a Windows bitmap from the resource database.}
\twocolitem{{\bf wxBITMAP\_TYPE\_GIF}}{Load a GIF bitmap file.}
\twocolitem{{\bf wxBITMAP\_TYPE\_XBM}}{Load an X bitmap file.}
\twocolitem{{\bf wxBITMAP\_TYPE\_XPM}}{Load an XPM bitmap file.}
\end{twocollist}
The validity of these flags depends on the platform and wxWindows configuration.}
\wxheading{Return value}
TRUE if the operation succeeded, FALSE otherwise.
\wxheading{Remarks}
A palette may be associated with the bitmap if one exists (especially for
colour Windows bitmaps), and if the code supports it. You can check
if one has been created by using the \helpref{GetPalette}{wxbitmapgetpalette} member.
\wxheading{See also}
\helpref{wxBitmap::SaveFile}{wxbitmapsavefile}
\membersection{wxBitmap::Ok}\label{wxbitmapok}
\constfunc{bool}{Ok}{\void}
Returns TRUE if bitmap data is present.
\membersection{wxBitmap::RemoveHandler}
\func{static bool}{RemoveHandler}{\param{const wxString\& }{name}}
Finds the handler with the given name, and removes it. The handler
is not deleted.
\docparam{name}{The handler name.}
\wxheading{Return value}
TRUE if the handler was found and removed, FALSE otherwise.
\wxheading{See also}
\helpref{wxBitmapHandler}{wxbitmaphandler}
\membersection{wxBitmap::SaveFile}\label{wxbitmapsavefile}
\func{bool}{SaveFile}{\param{const wxString\& }{name}, \param{int}{ type}, \param{wxPalette* }{palette = NULL}}
Saves a bitmap in the named file.
\wxheading{Parameters}
\docparam{name}{A filename. The meaning of {\it name} is determined by the {\it type} parameter.}
\docparam{type}{One of the following values:
\twocolwidtha{5cm}
\begin{twocollist}
\twocolitem{{\bf wxBITMAP\_TYPE\_BMP}}{Save a Windows bitmap file.}
\twocolitem{{\bf wxBITMAP\_TYPE\_GIF}}{Save a GIF bitmap file.}
\twocolitem{{\bf wxBITMAP\_TYPE\_XBM}}{Save an X bitmap file.}
\twocolitem{{\bf wxBITMAP\_TYPE\_XPM}}{Save an XPM bitmap file.}
\end{twocollist}
The validity of these flags depends on the platform and wxWindows configuration.}
\docparam{palette}{An optional palette used for saving the bitmap. TODO: this parameter should
probably be eliminated; instead the app should set the palette before saving.}
\wxheading{Return value}
TRUE if the operation succeeded, FALSE otherwise.
\wxheading{Remarks}
Depending on how wxWindows has been configured, not all formats may be available.
\wxheading{See also}
\helpref{wxBitmap::LoadFile}{wxbitmaploadfile}
\membersection{wxBitmap::SetDepth}\label{wxbitmapsetdepth}
\func{void}{SetDepth}{\param{int }{depth}}
Sets the depth member (does not affect the bitmap data).
\wxheading{Parameters}
\docparam{depth}{Bitmap depth.}
\membersection{wxBitmap::SetHeight}\label{wxbitmapsetheight}
\func{void}{SetHeight}{\param{int }{height}}
Sets the height member (does not affect the bitmap data).
\wxheading{Parameters}
\docparam{height}{Bitmap height in pixels.}
\membersection{wxBitmap::SetMask}\label{wxbitmapsetmask}
\func{void}{SetMask}{\param{wxMask* }{mask}}
Sets the mask for this bitmap.
\wxheading{Remarks}
The bitmap object owns the mask once this has been called.
\wxheading{See also}
\helpref{wxBitmap::GetMask}{wxbitmapgetmask}, \helpref{wxMask}{wxmask}
\membersection{wxBitmap::SetOk}
\func{void}{SetOk}{\param{int }{isOk}}
Sets the validity member (does not affect the bitmap data).
\wxheading{Parameters}
\docparam{isOk}{Validity flag.}
\membersection{wxBitmap::SetPalette}\label{wxbitmapsetpalette}
\func{void}{SetPalette}{\param{wxPalette* }{palette}}
Sets the associated palette: it will be deleted in the wxBitmap
destructor, so if you do not wish it to be deleted automatically,
reset the palette to NULL before the bitmap is deleted.
\wxheading{Parameters}
\docparam{palette}{The palette to set.}
\wxheading{Remarks}
The bitmap object owns the palette once this has been called.
\wxheading{See also}
\helpref{wxPalette}{wxpalette}
\membersection{wxBitmap::SetWidth}
\func{void}{SetWidth}{\param{int }{width}}
Sets the width member (does not affect the bitmap data).
\wxheading{Parameters}
\docparam{width}{Bitmap width in pixels.}
\membersection{wxBitmap::operator $=$}
\func{wxBitmap\& }{operator $=$}{\param{const wxBitmap\& }{bitmap}}
Assignment operator. This operator does not copy any data, but instead
passes a pointer to the data in {\it bitmap} and increments a reference
counter. It is a fast operation.
\wxheading{Parameters}
\docparam{bitmap}{Bitmap to assign.}
\wxheading{Return value}
Returns 'this' object.
\membersection{wxBitmap::operator $==$}
\func{bool}{operator $==$}{\param{const wxBitmap\& }{bitmap}}
Equality operator. This operator tests whether the internal data pointers are
equal (a fast test).
\wxheading{Parameters}
\docparam{bitmap}{Bitmap to compare with 'this'}
\wxheading{Return value}
Returns TRUE if the bitmaps were effectively equal, FALSE otherwise.
\membersection{wxBitmap::operator $!=$}
\func{bool}{operator $!=$}{\param{const wxBitmap\& }{bitmap}}
Inequality operator. This operator tests whether the internal data pointers are
unequal (a fast test).
\wxheading{Parameters}
\docparam{bitmap}{Bitmap to compare with 'this'}
\wxheading{Return value}
Returns TRUE if the bitmaps were unequal, FALSE otherwise.
\section{\class{wxBitmapHandler}}\label{wxbitmaphandler}
\overview{Overview}{wxbitmapoverview}
This is the base class for implementing bitmap file loading/saving, and bitmap creation from data.
It is used within wxBitmap and is not normally seen by the application.
If you wish to extend the capabilities of wxBitmap, derive a class from wxBitmapHandler
and add the handler using \helpref{wxBitmap::AddHandler}{wxbitmapaddhandler} in your
application initialisation.
\wxheading{Derived from}
\helpref{wxObject}{wxobject}
\wxheading{See also}
\helpref{wxBitmap}{wxbitmap}, \helpref{wxIcon}{wxicon}, \helpref{wxCursor}{wxcursor}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxBitmapHandler::wxBitmapHandler}\label{wxbitmaphandlerconstr}
\func{}{wxBitmapHandler}{\void}
Default constructor. In your own default constructor, initialise the members
m\_name, m\_extension and m\_type.
\membersection{wxBitmapHandler::\destruct{wxBitmapHandler}}
\func{}{\destruct{wxBitmapHandler}}{\void}
Destroys the wxBitmapHandler object.
\membersection{wxBitmapHandler::Create}
\func{virtual bool}{Create}{\param{wxBitmap* }{bitmap}, \param{void*}{ data}, \param{int}{ type}, \param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}}
Creates a bitmap from the given data, which can be of arbitrary type. The wxBitmap object {\it bitmap} is
manipulated by this function.
\wxheading{Parameters}
\docparam{bitmap}{The wxBitmap object.}
\docparam{width}{The width of the bitmap in pixels.}
\docparam{height}{The height of the bitmap in pixels.}
\docparam{depth}{The depth of the bitmap in pixels. If this is -1, the screen depth is used.}
\docparam{data}{Data whose type depends on the value of {\it type}.}
\docparam{type}{A bitmap type identifier - see \helpref{wxBitmapHandler::wxBitmapHandler}{wxbitmapconstr} for a list
of possible values.}
\wxheading{Return value}
TRUE if the call succeeded, FALSE otherwise (the default).
\membersection{wxBitmapHandler::GetName}
\constfunc{wxString}{GetName}{\void}
Gets the name of this handler.
\membersection{wxBitmapHandler::GetExtension}
\constfunc{wxString}{GetExtension}{\void}
Gets the file extension associated with this handler.
\membersection{wxBitmapHandler::GetType}
\constfunc{long}{GetType}{\void}
Gets the bitmap type associated with this handler.
\membersection{wxBitmapHandler::LoadFile}\label{wxbitmaphandlerloadfile}
\func{bool}{LoadFile}{\param{wxBitmap* }{bitmap}, \param{const wxString\&}{ name}, \param{long}{ type}}
Loads a bitmap from a file or resource, putting the resulting data into {\it bitmap}.
\wxheading{Parameters}
\docparam{bitmap}{The bitmap object which is to be affected by this operation.}
\docparam{name}{Either a filename or a Windows resource name.
The meaning of {\it name} is determined by the {\it type} parameter.}
\docparam{type}{See \helpref{wxBitmap::wxBitmap}{wxbitmapconstr} for values this can take.}
\wxheading{Return value}
TRUE if the operation succeeded, FALSE otherwise.
\wxheading{See also}
\helpref{wxBitmap::LoadFile}{wxbitmaploadfile}\\
\helpref{wxBitmap::SaveFile}{wxbitmapsavefile}\\
\helpref{wxBitmapHandler::SaveFile}{wxbitmaphandlersavefile}
\membersection{wxBitmapHandler::SaveFile}\label{wxbitmaphandlersavefile}
\func{bool}{SaveFile}{\param{wxBitmap* }{bitmap}, \param{const wxString\& }{name}, \param{int}{ type}, \param{wxPalette* }{palette = NULL}}
Saves a bitmap in the named file.
\wxheading{Parameters}
\docparam{bitmap}{The bitmap object which is to be affected by this operation.}
\docparam{name}{A filename. The meaning of {\it name} is determined by the {\it type} parameter.}
\docparam{type}{See \helpref{wxBitmap::wxBitmap}{wxbitmapconstr} for values this can take.}
\docparam{palette}{An optional palette used for saving the bitmap. TODO: this parameter should
probably be eliminated; instead the app should set the palette before saving.}
\wxheading{Return value}
TRUE if the operation succeeded, FALSE otherwise.
\wxheading{See also}
\helpref{wxBitmap::LoadFile}{wxbitmaploadfile}\\
\helpref{wxBitmap::SaveFile}{wxbitmapsavefile}\\
\helpref{wxBitmapHandler::LoadFile}{wxbitmaphandlerloadfile}
\membersection{wxBitmapHandler::SetName}
\func{void}{SetName}{\param{const wxString\& }{name}}
Sets the handler name.
\wxheading{Parameters}
\docparam{name}{Handler name.}
\membersection{wxBitmapHandler::SetExtension}
\func{void}{SetExtension}{\param{const wxString\& }{extension}}
Sets the handler extension.
\wxheading{Parameters}
\docparam{extension}{Handler extension.}
\membersection{wxBitmapHandler::SetType}
\func{void}{SetType}{\param{long }{type}}
Sets the handler type.
\wxheading{Parameters}
\docparam{name}{Handler type.}

924
docs/latex/wx/body.tex Normal file
View File

@@ -0,0 +1,924 @@
\chapter{Introduction}\label{introduction}
\pagenumbering{arabic}%
\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}%
\setfooter{\thepage}{}{}{}{}{\thepage}%
\section{What is wxWindows?}
wxWindows is a C++ framework providing GUI (Graphical User
Interface) and other facilities on more than one platform. It currently
supports subsets of Motif, Xt and MS Windows (16-bit, Windows 95 and Windows NT).
wxWindows was originally developed at the Artificial Intelligence
Applications Institute, University of Edinburgh, for internal use.
wxWindows has been released into the public domain in the hope
that others will also find it useful. Version 2.0 is written and
maintained by Julian Smart and Markus Holzem, with support from users.
This manual discusses wxWindows in the context of multi-platform
development.\helpignore{For more detail on the wxWindows version 2.0 API
(Application Programming Interface) please refer to the separate
wxWindows reference manual.}
Please note that in the following, ``MS Windows" often refers to all
platforms related to Microsoft Windows, including 16-bit and 32-bit
variants, unless otherwise stated. All trademarks are acknowledged.
\section{Why another cross-platform development tool?}
wxWindows was developed to provide a cheap and flexible way to maximize
investment in GUI application development. While a number of commercial
class libraries already exist for cross-platform development,
none met all of the following criteria:
\begin{enumerate}\itemsep=0pt
\item low price;
\item source availability;
\item simplicity of programming;
\item support for a wide range of compilers.
\end{enumerate}
As public domain software and a project open to everyone, wxWindows has
benefited from comments, ideas, bug fixes, enhancements and the sheer
enthusiasm of users, especially via the Internet. This gives wxWindows a
certain advantage over its commercial brothers, and a robustness against
the transience of one individual or company. This openness and
availability of source code is especially important when the future of
thousands of lines of application code may depend upon the longevity of
the underlying class library.
In writing wxWindows, completeness has sometimes been traded for
portability and simplicity of programming. Version 2.0 goes much
further than previous versions in terms of generality and features,
allowing applications to be produced
that are often indistinguishable from those produced using single-platform
toolkits
such as Motif and MFC.
wxWindows 2.0 currently maps to two native APIs: Motif and
MS Windows. An Xt port is also in preparation.
The importance of using a platform-independent class library cannot be
overstated, since GUI application development is very time-consuming,
and sustained popularity of particular GUIs cannot be guaranteed.
Code can very quickly become obsolete if it addresses the wrong
platform or audience. wxWindows helps to insulate the programmer from
these winds of change. Although wxWindows may not be suitable for
every application, it provides access to most of the functionality a
GUI program normally requires, plus some extras such as form
construction, interprocess communication and PostScript output, and
can of course be extended as needs dictate. As a bonus, it provides
a cleaner programming interface than the native
APIs. Programmers may find it worthwhile to use wxWindows even if they
are developing on only one platform.
It is impossible to sum up the functionality of wxWindows in a few paragraphs, but
here are some of the benefits:
\begin{itemize}\itemsep=0pt
\item Low cost (free, in fact!)
\item You get the source.
\item Several example programs.
\item Over 200 pages of printable and on-line documentation.
\item Simple-to-use, object-oriented API.
\item Graphics calls include splines, polylines, rounded rectangles, etc.
\item Constraint-based layout option.
\item Print/preview and document/view architectures.
\item Status line facility, toolbar
\item Easy, object-oriented interprocess comms (DDE subset) under UNIX and
MS Windows.
\item Encapsulated PostScript generation under UNIX, normal MS Windows printing on the
PC.
\item MDI support under Windows.
\item Can be used to create DLLs under Windows, dynamic libraries on the Sun.
\item Common dialogs for file browsing, printing, colour selection, etc.
\item Under MS Windows, support for creating metafiles and copying
them to the clipboard.
\item Hypertext help facility, with an API for invocation from applications.
\item Dialog Editor for building dialogs.
\end{itemize}
\section{Changes from version 1.xx}\label{versionchanges}
These are a few of the major differences between versions 1.xx and 2.0.
Removals:
\begin{itemize}\itemsep=0pt
\item XView is no longer supported;
\item Mac is not yet supported;
\item all controls (panel items) no longer have labels attached to them;
\item wxForm removed;
\item wxCanvasDC, wxPanelDC removed (replaced by wxClientDC, wxWindowDC, wxPaintDC which
can be used for any window);
\item wxMultiText, wxTextWindow, wxText removed and replaced by wxTextCtrl;
\item classes no longer divided into generic and platform-specific parts, for efficiency.
\end{itemize}
Additions and changes:
\begin{itemize}\itemsep=0pt
\item class hierarchy changed, and restrictions about subwindow nesting lifted;
\item header files reorganised to conform to normal C++ standards;
\item classes less dependent on each another, to reduce executable size;
\item wxString used instead of char* wherever possible;
\item the number of separate but mandatory utilities reduced;
\item the event system has been overhauled, with
virtual functions and callbacks being replaced with MFC-like event tables;
\item new controls, such as wxTreeCtrl, wxListCtrl, wxSpinButton;
\item less inconsistency about what events can be handled, so for example
mouse clicks or key presses on controls can now be intercepted;
\item the status bar is now a separate class, wxStatusBar, and is
implemented in generic wxWindows code;
\item some renaming of controls for greater consistency;
\item wxBitmap has the notion of bitmap handlers to allow for extension to new formats
without ifdefing;
\item new dialogs: wxPageSetupDialog, wxFileDialog, wxDirDialog,
wxMessageDialog, wxSingleChoiceDialog, wxTextEntryDialog;
\item GDI objects are reference-counted and are now passed to most functions
by reference, making memory management far easier;
\item wxSystemSettings class allows querying for various system-wide properties
such as dialog font, colours, user interface element sizes, and so on;
\item better platform look and feel conformance;
\item toolbar functionality now separated out into a family of classes with the
same API;
\item device contexts are no longer accessed using wxWindow::GetDC - they are created
temporarily with the window as an argument;
\item events from sliders and scrollbars can be handled more flexibly;
\item the handling of window close events has been changed in line with the new
event system, but backward {\bf OnClose} compatibility has been retained;
\item the concept of {\it validator} has been added to allow much easier coding of
the relationship between controls and application data;
\item the documentation has been revised, with more cross-referencing.
\end{itemize}
Platform-specific changes:
\begin{itemize}\itemsep=0pt
\item The Windows header file (windows.h) is no longer included by wxWindows headers;
\item wx.dll supported under Visual C++;
\item the full range of Windows 95 window decorations are supported, such as modal frame
borders;
\item MDI classes brought out of wxFrame into separate classes, and made more flexible.
\end{itemize}
\section{wxWindows requirements}\label{requirements}
To make use of wxWindows, you currently need one or both of the
following setups.
(a) PC:
\begin{enumerate}\itemsep=0pt
\item A 486 or higher PC running MS Windows.
\item One of Microsoft Visual C++, Borland C++, Watcom C++, MetroWerks C++,
Symantec C++, GNU-WIN32.
\item At least 30 MB of disk space.
\end{enumerate}
(b) UNIX:
\begin{enumerate}\itemsep=0pt
\item Almost any C++ compiler, including GNU C++.
\item Almost any UNIX workstation (VMS is supported too) and Motif 1.2 or higher (not necessary
for the Xt version)
\item At least 30 MB of disk space.
\end{enumerate}
\section{Availability and location of wxWindows}
wxWindows is currently available from the Artificial Intelligence
Applications Institute by anonymous FTP and World Wide Web:
\begin{verbatim}
ftp://ftp.aiai.ed.ac.uk/pub/packages/wxwin
http://web.ukonline.co.uk/julian.smart/wxwin
\end{verbatim}
\section{Acknowledgments}
Thanks are due to the AIAI for being willing to release wxWindows into
the public domain, and to our patient wives Harriet and Tanja.
The Internet has been an essential prop when coming up against tricky
problems. Thanks to those who answered our
queries or submitted bug fixes and enhancements; wxWindows is very
much a team effort.
Hermann Dunkel contributed XPM support; Arthur Seaton wrote the memory
checking code; Olaf Klein and Patrick Halke wrote the ODBC classes;
Harri Pasanen and Robin Dunn wrote wxPython and contributed to the
wxExtend library.
Markus Holzem write the Xt port. Jonathan Tonberg, Bill Hale,
Cecil Coupe, Thomaso Paoletti, Thomas Fettig, and others slaved away
writing the Mac port. Keith Gary Boyce ported wxWindows to the free
GNU-WIN32 compiler, refusing to give up when shortcuts were suggested.
Many thanks also to: Timothy Peters, Jamshid Afshar, Patrick Albert, C. Buckley,
Robin Corbet, Harco de Hilster, Josep Fortiana, Torsten Liermann, Tatu
M\"{a}nnist\"{o}, Ian Perrigo, Giordano Pezzoli, Petr Smilauer, Neil Smith,
Kari Syst\"{a}, Jyrki Tuomi, Edward Zimmermann, Ian Brown, and many
others.
`Graphplace', the basis for the wxGraphLayout library, is copyright Dr. Jos
T.J. van Eijndhoven of Eindhoven University of Technology. The code has
been used in wxGraphLayout with his permission.
We also acknowledge the author of XFIG, the excellent UNIX drawing tool,
from the source of which we have borrowed some spline drawing code.
His copyright is included below.
{\it XFig2.1 is copyright (c) 1985 by Supoj Sutanthavibul. Permission to
use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided
that the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation, and that the name of M.I.T. not be used in advertising or
publicity pertaining to distribution of the software without specific,
written prior permission. M.I.T. makes no representations about the
suitability of this software for any purpose. It is provided ``as is''
without express or implied warranty.}
\chapter{Multi-platform development with wxWindows}\label{multiplat}
\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}%
\setfooter{\thepage}{}{}{}{}{\thepage}%
This chapter describes the practical details of using wxWindows. Please
see the file install.txt for up-to-date installation instructions, and
changes.txt for differences between versions.
\section{Include files}
The main include file is {\tt "wx.h"}; this includes the most commonly
used modules of wxWindows.
To save on compilation time, include only those header files relevant to the
source file. If you are using precompiled headers, you should include
the following section before any other includes:
\begin{verbatim}
// For compilers that support precompilation, includes "wx.h".
#include "wx_prec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
... include minimum set of files necessary here ...
#endif
... now your other include files ...
\end{verbatim}
The file {\tt "wx\_prec.h"} includes {\tt "wx.h"}. Although this incantation
may seem quirky, it is in fact the end result of a lot of experimentation,
and several Windows compilers to use precompilation (those tested are Microsoft Visual C++, Borland C++
and Watcom C++).
Borland precompilation is largely automatic. Visual C++ requires specification of {\tt "wx\_prec.h"} as
the file to use for precompilation. Watcom C++ is automatic apart from the specification of
the .pch file. Watcom C++ is strange in requiring the precompiled header to be used only for
object files compiled in the same directory as that in which the precompiled header was created.
Therefore, the wxWindows Watcom C++ makefiles go through hoops deleting and recreating
a single precompiled header file for each module, thus preventing an accumulation of many
multi-megabyte .pch files.
\section{Libraries}
Under UNIX, use the library libwx\_motif.a
(Motif). Under Windows, use the library wx.lib for stand-alone Windows
applications, or wxdll.lib for creating DLLs.
\section{Configuration}
The following lists the options configurable in the file
\rtfsp{\tt include/base/wx\_setup.h.} Some settings are a matter
of taste, some help with platform-specific problems, and
others can be set to minimize the size of the library.
\subsection{General features}
\begin{twocollist}\itemsep=0pt
\twocolitem{USE\_CLIPBOARD}{If 1, clipboard code is compiled (Windows only).}
\twocolitem{USE\_CONSTRAINTS}{If 1, the constaint-based window layout system is compiled.}
\twocolitem{USE\_DOC\_VIEW\_ARCHITECTURE}{If 1, wxDocument, wxView and related classes are compiled.}
\twocolitem{USE\_DYNAMIC\_CLASSES}{If 1, the run-time class macros and classes are compiled. Recommended,
and necessary for the document/view framework.}
\twocolitem{USE\_EXTENDED\_STATICS}{If 1, wxStaticItem code is compiled for enhanced panel decorative items.
Not rigorously tested, and not documented.}
\twocolitem{USE\_HELP}{If 1, interface to help system is compiled.}
\twocolitem{USE\_GAUGE}{If 1, the wxGauge class compiled.}
\twocolitem{USE\_GLOBAL\_MEMORY\_OPERATORS}{If 1, redefines global new and delete operators to be compatible
with the extended arguments of the debugging wxObject new and delete operators. If this causes problems
for your compiler, set to 0.}
\twocolitem{USE\_GNU\_WXSTRING}{If 1, the enhanced GNU wxString and regular expression class are compiled
in place of the normal wxString class. See contrib/wxstring for details.}
\twocolitem{USE\_IMAGE\_LOADING\_IN\_MSW}{Use code to allow dynamic .BMP loading
under MS Windows.}
\twocolitem{USE\_IMAGE\_LOADING\_IN\_X}{Use code in utils/image to allow dynamic .BMP/.GIF loading
under X.}
\twocolitem{USE\_RESOURCE\_LOADING\_IN\_MSW}{Use code to allow dynamic .ICO/.CUR loading
under MS Windows.}
\twocolitem{USE\_IPC}{If 1, interprocess communication code is compiled.}
\twocolitem{USE\_MEMORY\_TRACING}{If 1, enables debugging versions of wxObject::new and wxObject::delete
if the value of DEBUG is defined to more than 0.}
\twocolitem{USE\_METAFILE}{If 1, Windows Metafile code is compiled.}
\twocolitem{USE\_PANEL\_IN\_PANEL}{If 1, experimental panel-in-panel code is used
for common dialog boxes. Not recommended, since tab traversal can suffer.}
\twocolitem{USE\_POSTSCRIPT}{If 1, PostScript code is compiled.}
\twocolitem{USE\_POSTSCRIPT\_ARCHITECTURE\_IN\_MSW}{Set to 1 to enable the printing architecture
to make use of either native Windows printing facilities, or the wxPostScriptDC class depending
on the wxApp::SetPrintMode setting.}
\twocolitem{USE\_PRINTING\_ARCHITECTURE}{If 1, wxPrinter, wxPrintout and related classes are compiled
for the print/preview framework.}
\twocolitem{USE\_RESOURCES}{If 1, win.ini or .Xdefaults-style resource read/write code is compiled.}
\twocolitem{USE\_SCROLLBAR}{If 1, wxScrollBar class is compiled. Not rigorously tested, and not documented.}
\twocolitem{USE\_SPLINES}{If 1, spline code is compiled.}
\twocolitem{USE\_TOOLBAR}{If 1, the wxToolBar class is compiled.}
\twocolitem{USE\_TYPEDEFS}{If 1, a typedef will be used for wxPoint instead of
a class declaration, to reduce overhead and avoid a Microsoft C++ memory bug.}
\twocolitem{USE\_VLBOX}{If 1, wxVirtListBox code is compiled for a virtual listbox item.
Not rigorously tested, and not documented.}
\twocolitem{USE\_WX\_RESOURCES}{If 1, wxWindows resource file (.WXR) code is compiled.}
\twocolitem{USE\_XFIG\_SPLINE\_CODE}{If 1, XFig-derived code is used for spline
drawing. If 0, AIAI code is used, which is slower.}
\twocolitem{USE\_XPM\_IN\_X}{If 1, XPM (colour pixmap) facilities will be compiled and used
in wxBitmap under X.}
\twocolitem{USE\_XPM\_IN\_MSW}{If 1, XPM (colour pixmap) facilities will be compiled and used
in wxBitmap under MS Windows.}
\end{twocollist}
\subsection{X features}
\begin{twocollist}
\twocolitem{DEFAULT\_FILE\_SELECTOR\_SIZE}{Let Motif choose the size of
XmFileSelectionBox. Otherwise, size is 500x600.}
\twocolitem{PIXEL0\_DISABLE}{Define to disallow allocation of pixel 0 (wxXOR problem).}
\twocolitem{USE\_GADGETS}{Use gadgets where possible rather than Widgets for items.
Default is to use Gadgets.}
\twocolitem{USE\_BUTTON\_GADGET}{Use gadgets for buttons. This can intefere with
default button selection, so the default is zero.}
\end{twocollist}
\subsection{Windows and NT features}
\begin{twocollist}
\twocolitem{CTL3D}{CTL3D should only be used for 16-bit Windows programs.
On Windows 95 and NT, native 3D effects are used. If you want to
use it and don't already have CTL3D installed, copy the files in
contrib/ctl3d to appropriate places (ctl3dv2.lib/ctl3d32.lib into your compiler lib
directory, ctl3d.h into an include directory, and ctl3dv2.dll into
windows/system). You may need to find a compiler-specific version of ctl3dv2.lib
or ctl3d32.lib. Define CTL3D to be 1 in wx\_setup.h and link your executables with ctl3dv2.lib
or ctl3d32.lib.}
\twocolitem{USE\_ITSY\_BITSY}{If 1, compiles in code to support tiny window titlebars.}
\twocolitem{USE\_ODBC}{If 1, compiles wxDatabase and wxRecordSet classes for ODBC
access. Requires sql.h, sqlext.h files if set to 1 (see topic on database support).}
\end{twocollist}
\section{Makefiles}
At the moment there is no attempt to make UNIX makefiles and
PC makefiles compatible, i.e. one makefile is required for
each environment.
Sample makefiles for UNIX (suffix .UNX), MS C++ (suffix .DOS and .NT), Borland
C++ (.BCC) and Symantec C++ (.SC) are included for the library, demos
and utilities. The NT, Borland and Symantec makefiles cannot be
guaranteed to be up-to-date since the author does not have
these compilers.
The controlling makefile for wxWindows is in the platform-specific
directory, such as {\tt src/msw} or {\tt src/x}. This makefile will
recursively execute the makefile in {\tt src/base}.
\subsection{Windows makefiles}
For Microsoft C++, normally it is only necessary to type {\tt nmake -f
makefile.dos} (or an alias or batch file which does this). By default,
binaries are made with debugging information, and no optimization. Use
FINAL=1 on the command line to remove debugging information (this only
really necessary at the link stage), and DLL=1 to make a DLL version of
the library, if building a library.
\subsection{UNIX makefiles}
TODO.
Debugging information is included by default; you may add DEBUG= as an
argument to make to compile without it, or use the UNIX {\bf strip}
command to remove debugging information from an executable.
\normalbox{{\it Important note:} Most compiler flags are kept centrally in
src/make.env, which is included by all other makefiles. This is the
file to edit to tailor wxWindows compilation to your environment.}
\section{Windows-specific files}
wxWindows application compilation under MS Windows requires at least two
extra files, resource and module definition files.
\subsection{Resource file}\label{resources}
The least that must be defined in the Windows resource file (extension RC)
is the following statement:
\begin{verbatim}
rcinclude wx.rc
\end{verbatim}
which includes essential internal wxWindows definitions. The resource script
may also contain references to icons, cursors, etc., for example:
\begin{verbatim}
wxicon icon wx.ico
\end{verbatim}
The icon can then be referenced by name when creating a frame icon. See
the MS Windows SDK documentation.
\normalbox{Note: include wx.rc {\it after} any ICON statements
so programs that search your executable for icons (such
as the Program Manager) find your application icon first.}
\subsection{Module definition file}
A module definition file (extension DEF) looks like the following:
\begin{verbatim}
NAME Hello
DESCRIPTION 'Hello'
EXETYPE WINDOWS
STUB 'WINSTUB.EXE'
CODE PRELOAD MOVEABLE DISCARDABLE
DATA PRELOAD MOVEABLE MULTIPLE
HEAPSIZE 1024
STACKSIZE 8192
\end{verbatim}
The only lines which will usually have to be changed per application are
NAME and DESCRIPTION.
\section{Memory models and memory allocation}\label{memorymodels}
Under UNIX, memory allocation isn't a problem. Under Windows, the only
really viable way to go is to use the large model, which uses the global
heap instead of the local heap for memory allocation. Unless more than
one read-write data segment is used,% (see \helpref{large data}{largedata}
large model programs may still have multiple instances under MS
C/C++ 7. Microsoft give the following guidelines for producing
multiple-instance large model programs:
\begin{itemize}\itemsep=0pt
\item Do not use {\tt /ND} to name extra data segments unless the segment is READONLY.
\item Use the .DEF file to mark extra data segments READONLY.
\item Do not use \_\_far or FAR to mark data items.
\item Use {\tt /PACKDATA} to combine data segments.
\item Use {\tt /Gt65500 /Gx} to force all data into the default data segment.
\end{itemize}
Even with the single-instance limitation, the productivity benefit is
worth it in the majority of cases. Note that some other multi-platform
class libraries also have this restriction. (If more than one instance
really is required, create several copies of the program with different
names.)
Having chosen the large model, just use C++ `new', `delete' (and if
necessary `malloc' and `free') in the normal way. The only restrictions
now encountered are a maximum of 64 KB for a single program segment and
for a single data item, unless huge model is selected.
For Borland users, use the data threshold switch, and the following is
also recommended:
\begin{itemize}\itemsep=0pt
\item Check ``Automatic Far Data Segments"
\item Check ``Put Constant Strings into Code Segment"
\end{itemize}
See also the Frequently Asked Questions document for further details
on using Borland with wxWindows.
\subsection{Allocating and deleting wxWindows objects}
In general, classes derived from wxWindow must dynamically allocated
with {\it new} and deleted with {\it delete}. If you delete a window,
all of its children and descendants will be automatically deleted,
so you don't need to delete these descendants explicitly.
Don't statically create a window unless you know that the window
cannot be deleted dynamically. Modal dialogs, such as those used
in the {\tt dialogs} sample, can usually be created statically,
if you know that the OK or Cancel button does not destroy the dialog.
Most drawing objects, such as wxPen, wxBrush, wxFont, and wxBitmap, should be
created dynamically. They are cleaned up automatically on program exit.
wxColourMap is an exception to this rule (currently). In particular,
do not attempt to create these objects globally before OnInit() has a chance
to be called, because wxWindows might not have done essential internal initialisation
(including creation of lists containing all instances of wxPen, wxBrush etc.)
If you decide to allocate a C++ array of objects (such as wxBitmap) that may
be cleaned up by wxWindows, make sure you delete the array explicitly
before wxWindows has a chance to do so on exit, since calling {\it delete} on
array members will cause memory problems.
wxColour can be created statically: it is not automatically cleaned
up and is unlikely to be shared between other objects; it is lightweight
enough for copies to be made.
Beware of deleting objects such as a wxPen or wxBitmap if they are still in use.
Windows is particularly sensitive to this: so make sure you
make calls like wxDC::SetPen(NULL) or wxDC::SelectObject(NULL) before deleting
a drawing object that may be in use. Code that doesn't do this will probably work
fine on some platforms, and then fail under Windows.
\section{Dynamic Link Libraries}
wxWindows may be used to produce DLLs which run under MS Windows. Note that
this is not the same thing as having wxWindows as a DLL, which is not
currently possible. For Microsoft C++, use the makefile with the argument DLL=1 to produce
a version of the wxWindows library which may be used in a DLL application.
There is a bug in Microsoft C++ which makes the compiler complain about returned floats,
which goes away when the {\tt /Os} option is used, which is why that flag is
set in the makefile.
For making wxWindows as a Sun dynamic library, there are comments in the
UNIX makefile for the appropriate flags for AT\&T C++. Sorry, I haven't
investigated the flags needed for other compilers.
\section{Conditional compilation}
One of the purposes of wxWindows is to reduce the need for conditional
compilation in source code, which can be messy and confusing to follow.
However, sometimes it is necessary to incorporate platform-specific
features (such as metafile use under MS Windows). The following identifiers
may be used for this purpose, along with any user-supplied ones:
\begin{itemize}
\item {\tt wx\_x} - for code which should work under any X toolkit
\item {\tt wx\_motif} - for code which should work under Motif only
\item {\tt wx\_msw} - for code which should work under Microsoft Windows only
\item {\tt wx\_xt} - for code which should work under Xt only
\end{itemize}
For example:
\begin{verbatim}
...
#ifdef wx_x
(void)wxMessageBox("Sorry, metafiles not available under X.");
#endif
#ifdef wx_msw
wxMetaFileDC dc;
DrawIt(dc);
wxMetaFile *mf = dc.Close();
mf->SetClipboard();
delete mf;
#endif
...
\end{verbatim}
\section{Building on-line help}
wxWindows has its own help system from version 1.30: wxHelp. It can be
used to view the wxWindows class library reference, and also to provide
on-line help for your wxWindows applications. The API, made accessible
by including {\tt wx\_help.h}, allows you to load files and display
specific sections, using DDE to communicate between the application and
wxHelp.
wxHelp files can be marked up by hand from ASCII files within wxHelp,
or may be generated from other files, as is the case with the wxWindows
documentation.
It is possible to use the platform-specific help
system (e.g. WinHelp) instead of wxHelp.
See {\tt install.txt}, the wxHelp documentation (in {\tt
utils/wxhelp/docs}) and \helpref{wxHelp}{wxhelp} for further details.
\section{C++ issues}
There are cases where a C++ program will compile and run fine under one
environment, and then fail to compile using a different compiler. Some
caveats are given below, from experience with the GNU C++ compiler (GCC)
and MS C/C++ compiler version 7.
\subsection{Templates}
wxWindows does not use templates for two main reasons: one, it is a
notoriously unportable feature, and two, the author is irrationally
suspicious of them and prefers to use casts. More compilers are
now implementing templates, and so it will probably be safe to use
them soon without fear of portability problems.
\subsection{Precompiled headers}
Some compilers, such as Borland C++ and Microsoft C++, support
precompiled headers. This can save a great deal of compiling time. The
recommended approach is to precompile {\tt ``wx.h''}, using this
precompiled header for compiling both wxWindows itself and any
wxWindows applications. For Windows compilers, two dummy source files
are provided (one for normal applications and one for creating DLLs)
to allow initial creation of the precompiled header.
However, there are several downsides to using precompiled headers. One
is that to take advantage of the facility, you often need to include
more header files than would normally be the case. This means that
changing a header file will cause more recompilations (in the case of
wxWindows, everything needs to be recompiled since everything includes
{\tt ``wx.h''}!)
A related problem is that for compilers that don't have precompiled
headers, including a lot of header files slows down compilation
considerably. For this reason, you will find (in the common
X and Windows parts of the library) conditional
compilation that under UNIX, includes a minimal set of headers;
and when using Visual C++, includes {\tt wx.h}. This should help provide
the optimal compilation for each compiler, although it is
biassed towards the precompiled headers facility available
in Microsoft C++.
\section{File handling}
When building an application which may be used under different
environments, one difficulty is coping with documents which may be
moved to different directories on other machines. Saving a file which
has pointers to full pathnames is going to be inherently unportable. One
approach is to store filenames on their own, with no directory
information. The application searches through a number of locally
defined directories to find the file. To support this, the class {\bf
wxPathList} makes adding directories and searching for files easy, and
the global function {\bf FileNameFromPath} allows the application to
strip off the filename from the path if the filename must be stored.
This has undesirable ramifications for people who have documents of the
same name in different directories.
As regards the limitations of DOS 8+3 single-case filenames versus
unrestricted UNIX filenames, the best solution is to use DOS filenames
for your application, and also for document filenames {\it if} the user
is likely to be switching platforms regularly. Obviously this latter
choice is up to the application user to decide. Some programs (such as
YACC and LEX) generate filenames incompatible with DOS; the best
solution here is to have your UNIX makefile rename the generated files
to something more compatible before transferring the source to DOS.
Transferring DOS files to UNIX is no problem, of course, apart from EOL
conversion for which there should be a utility available (such as
dos2unix).
See also the File Functions section of the reference manual for
descriptions of miscellaneous file handling functions.
\chapter{Utilities supplied with wxWindows}\label{utilities}
\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}%
\setfooter{\thepage}{}{}{}{}{\thepage}%
A number of `extras' are supplied with wxWindows, to complement
the GUI functionality in the main class library. These are found
below the utils directory and usually have their own source, library
and documentation directories. For larger user-contributed packages,
see the directory /pub/packages/wxwin/contrib.
\section{wxHelp}\label{wxhelp}
wxHelp is a stand-alone program, written using wxWindows,
for displaying hypertext help. It is necessary since not all target
systems (notably X) supply an adequate
standard for on-line help. wxHelp is modelled on the MS Windows help
system, with contents, search and browse buttons, but does not reformat
text to suit the size of window, as WinHelp does, and its input files
are uncompressed ASCII with some embedded font commands and an .xlp
extension. Most wxWindows documentation (user manuals and class
references) is supplied in wxHelp format, and also in Windows Help
format.
Note that an application can be programmed to use Windows Help under
MS Windows, and wxHelp under X. An alternative help viewer under X is
Mosaic, a World Wide Web viewer that uses HTML as its native hypertext
format. However, this is not currently integrated with wxWindows
applications.
wxHelp works in two modes---edit and end-user. In edit mode, an ASCII
file may be marked up with different fonts and colours, and divided into
sections. In end-user mode, no editing is possible, and the user browses
principally by clicking on highlighted blocks.
When an application invokes wxHelp, subsequent sections, blocks or
files may be viewed using the same instance of wxHelp since the two
programs are linked using wxWindows interprocess communication
facilities. When the application exits, that application's instance of
wxHelp may be made to exit also. See the {\bf wxHelpControllerBase} entry in the
reference section for how an application controls wxHelp.
\section{Tex2RTF}\label{textortf}
Supplied with wxWindows is a utility called Tex2RTF for converting\rtfsp
\LaTeX\ manuals to the following formats:
\begin{description}
\item[wxHelp]
wxWindows help system format (XLP).
\item[Linear RTF]
Rich Text Format suitable for importing into a word processor.
\item[Windows Help RTF]
Rich Text Format suitable for compiling into a WinHelp HLP file with the
help compiler.
\item[HTML]
HTML is the native format for Mosaic, the main hypertext viewer for
the World Wide Web. Since it is freely available it is a good candidate
for being the wxWindows help system under X, as an alternative to wxHelp.
\end{description}
Tex2RTF is used for the wxWindows manuals and can be used independently
by authors wishing to create on-line and printed manuals from the same\rtfsp
\LaTeX\ source. Please see the separate documentation for Tex2RTF.
\section{wxTreeLayout}
This is a simple class library for drawing trees in a reasonably pretty
fashion. It provides only minimal default drawing capabilities, since
the algorithm is meant to be used for implementing custom tree-based
tools.
Directed graphs may also be drawn using this library, if cycles are
removed before the nodes and arcs are passed to the algorithm.
Tree displays are used in many applications: directory browsers,
hypertext systems, class browsers, and decision trees are a few
possibilities.
See the separate manual and the directory utils/wxtree.
\section{wxGraphLayout}
The wxGraphLayout class is based on a tool called `graphplace' by Dr.
Jos T.J. van Eijndhoven of Eindhoven University of Technology. Given a
(possibly cyclic) directed graph, it does its best to lay out the nodes
in a sensible manner. There are many applications (such as diagramming)
where it is required to display a graph with no human intervention. Even
if manual repositioning is later required, this algorithm can make a good
first attempt.
See the separate manual and the directory utils/wxgraph.
\section{wxImage}\label{wximage}
This is a collection of GIF/BMP/XBM bitmap loading and displaying
routines for X.
\section{MFUTILS}\label{mfutils}
A very modest step towards reading Windows metafiles on the
any platform. Julian Smart's ClockWorks program demonstrates
how extremely simple metafiles may be read and displayed (in this
case, to be used as clock hands).
\section{Colours}\label{coloursampler}
A colour sampler for viewing colours and their names on each
platform.
%
\chapter{Tutorial}\label{tutorial}
\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}%
\setfooter{\thepage}{}{}{}{}{\thepage}%
To be written.
\chapter{Programming strategies}\label{strategies}
\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}%
\setfooter{\thepage}{}{}{}{}{\thepage}%
This chapter is intended to list strategies that may be useful when
writing and debugging wxWindows programs. If you have any good tips,
please submit them for inclusion here.
\section{Strategies for reducing programming errors}
\subsection{Use ASSERT}
Although I haven't done this myself within wxWindows, it is good
practice to use ASSERT statements liberally, that check for conditions that
should or should not hold, and print out appropriate error messages.
These can be compiled out of a non-debugging version of wxWindows
and your application. Using ASSERT is an example of `defensive programming':
it can alert you to problems later on.
\subsection{Use wxString in preference to character arrays}
Using wxString can be much safer and more convenient than using char *.
Again, I haven't practised what I'm preaching, but I'm now trying to use
wxString wherever possible. You can reduce the possibility of memory
leaks substantially, and it's much more convenient to use the overloaded
operators than functions such as strcmp. wxString won't add a significant
overhead to your program; the overhead is compensated for by easier
manipulation (which means less code).
The same goes for other data types: use classes wherever possible.
\section{Strategies for portability}
\subsection{Use relative positioning or constraints}
Don't use absolute panel item positioning if you can avoid it. Different GUIs have
very differently sized panel items. Consider using the constraint system, although this
can be complex to program. If you needs are simple, the default relative positioning
behaviour may be adequate (using default position values and wxPanel::NewLine).
Alternatively, you could use alternative .wrc (wxWindows resource files) on different
platforms, with slightly different dimensions in each. Or space your panel items out
to avoid problems.
\subsection{Use wxWindows resource files}
Use .wrc (wxWindows resource files) where possible, because they can be easily changed
independently of source code. Bitmap resources can be set up to load different
kinds of bitmap depending on platform (see the section on resource files).
\section{Strategies for debugging}
\subsection{Positive thinking}
It's common to blow up the problem in one's imagination, so that it seems to threaten
weeks, months or even years of work. The problem you face may seem insurmountable:
but almost never is. Once you have been programming for some time, you will be able
to remember similar incidents that threw you into the depths of despair. But
remember, you always solved the problem, somehow!
Perseverance is often the key, even though a seemingly trivial problem
can take an apparently inordinate amount of time to solve. In the end,
you will probably wonder why you worried so much. That's not to say it
isn't painful at the time. Try not to worry -- there are many more important
things in life.
\subsection{Simplify the problem}
Reduce the code exhibiting the problem to the smallest program possible
that exhibits the problem. If it is not possible to reduce a large and
complex program to a very small program, then try to ensure your code
doesn't hide the problem (you may have attempted to minimize the problem
in some way: but now you want to expose it).
With luck, you can add a small amount of code that causes the program
to go from functioning to non-functioning state. This should give a clue
to the problem. In some cases though, such as memory leaks or wrong
deallocation, this can still give totally spurious results!
\subsection{Genetic mutation}
If we had sophisticated genetic algorithm tools that could be applied
to programming, we could use them. Until then, a common -- if rather irrational --
technique is to just make arbitrary changes to the code until something
different happens. You may have an intuition why a change will make a difference;
otherwise, just try altering the order of code, comment lines out, anything
to get over an impasse. Obviously, this is usually a last resort.
\subsection{Use a debugger}
This sounds like facetious advice, but it's surprising how often people
don't use a debugger. Often it's an overhead to install or learn how to
use a debugger, but it really is essential for anything but the most
trivial programs. Some platforms don't allow for debugging, such
as WIN32s under Windows 3.x. In this case, you might be advised to
debug under 16-bit Windows and when you're confident, compile for
WIN32s. In fact WIN32s can be very strict about bad memory handling,
so testing out under WIN32s is a good thing to do even if you're
not going to distribute this version. (Unless you've got a good memory checking,
utility, of course!) Tracking bugs under WIN32s can involve a lot of debug message
insertion and relinking, so make sure your compiler has a fast linker
(e.g. Watcom, Symantec).
\subsection{Use tracing code}
You can use wxDebugMsg statements (or the wxDebugStreamBuf class) to
output to a debugging window such as DBWIN under Windows, or standard
error under X. If compiling in DEBUG mode, you can use TRACE statements
that will be compiled out of the final build of your application.
Using tracing statements may be more convenient than using the debugger
in some circumstances (such as when your debugger doesn't support a lot
of debugging code, or you wish to print a bunch of variables).
\subsection{Use wxObject::Dump and the wxDebugContext class}
It's good practice to implement the Dump member function for all
classes derived from wxObject. You can then make use of wxDebugContext
to dump out information on all objects in the program, if DEBUG is
defined to be more than zero. You can use wxDebugContext to check for
memory leaks and corrupt memory. See the debugging topic in the
reference manual for more information.
\subsection{Check Windows debug messages}
Under Windows, it's worth running your program with DBWIN running or
some other program that shows Windows-generated debug messages. It's
possible it'll show invalid handles being used. You may have fun seeing
what commercial programs cause these normally hidden errors! Microsoft
recommend using the debugging version of Windows, which shows up even
more problems. However, I doubt it's worth the hassle for most
applications. wxWindows is designed to minimize the possibility of such
errors, but they can still happen occasionally, slipping through unnoticed
because they are not severe enough to cause a crash.

BIN
docs/latex/wx/book1.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 566 B

BIN
docs/latex/wx/books.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
docs/latex/wx/books.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 B

343
docs/latex/wx/brush.tex Normal file
View File

@@ -0,0 +1,343 @@
\section{\class{wxBrush}}\label{wxbrush}
A brush is a drawing tool for filling in areas. It is used for painting
the background of rectangles, ellipses, etc. It has a colour and a
style.
\wxheading{Derived from}
\helpref{wxGDIObject}{wxgdiobject}\\
\helpref{wxObject}{wxobject}
\wxheading{Remarks}
On a monochrome display, wxWindows shows
all brushes as white unless the colour is really black.
Do not initialize objects on the stack before the program commences,
since other required structures may not have been set up yet. Instead,
define global pointers to objects and create them in \helpref{wxApp::OnInit}{wxapponinit} or
when required.
An application may wish to create brushes with different
characteristics dynamically, and there is the consequent danger that a
large number of duplicate brushes will be created. Therefore an
application may wish to get a pointer to a brush by using the global
list of brushes {\bf wxTheBrushList}, and calling the member function
\rtfsp{\bf FindOrCreateBrush}.
wxBrush uses a reference counting system, so assignments between brushes are very
cheap. You can therefore use actual wxBrush objects instead of pointers without
efficiency problems. Bear in mind, though, that changing a brush's properties may
affect another brush which has been involved in an assignment with the first brush,
because of the way internal brush data is shared.
TODO: an overview for wxBrush.
\wxheading{See also}
\helpref{wxBrushList}{wxbrushlist}, \helpref{wxDC}{wxdc}, \helpref{wxDC::SetBrush}{wxdcsetbrush}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxBrush::wxBrush}
\func{}{wxBrush}{\void}
Default constructor. The brush will be uninitialised, and \helpref{wxBrush::Ok}{wxbrushok} will
return FALSE.
\func{}{wxBrush}{\param{const wxColour\&}{ colour}, \param{int}{ style}}
Constructs a brush from a colour object and style.
\func{}{wxBrush}{\param{const wxString\& }{colourName}, \param{int}{ style}}
Constructs a brush from a colour name and style.
\func{}{wxBrush}{\param{const wxBitmap\& }{stippleBitmap}}
Constructs a stippled brush using a bitmap.
\func{}{wxBrush}{\param{const wxBrush\&}{ brush}}
Copy constructor. This uses reference counting so is a cheap operation.
\func{}{wxBrush}{\param{const wxBrush*}{ brush}}
Copy constructor. This uses reference counting so is a cheap operation.
\wxheading{Parameters}
\docparam{colour}{Colour object.}
\docparam{colourName}{Colour name. The name will be looked up in the colour database.}
\docparam{style}{One of:
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf wxTRANSPARENT}}{Transparent (no fill).}
\twocolitem{{\bf wxSOLID}}{Solid.}
\twocolitem{{\bf wxBDIAGONAL\_HATCH}}{Backward diagonal hatch.}
\twocolitem{{\bf wxCROSSDIAG\_HATCH}}{Cross-diagonal hatch.}
\twocolitem{{\bf wxFDIAGONAL\_HATCH}}{Forward diagonal hatch.}
\twocolitem{{\bf wxCROSS\_HATCH}}{Cross hatch.}
\twocolitem{{\bf wxHORIZONTAL\_HATCH}}{Horizontal hatch.}
\twocolitem{{\bf wxVERTICAL\_HATCH}}{Vertical hatch.}
\end{twocollist}}
\docparam{brush}{Pointer or reference to a brush to copy.}
\docparam{stippleBitmap}{A bitmap to use for stippling.}
\wxheading{Remarks}
If a stipple brush is created, the brush style will be set to wxSTIPPLE.
\wxheading{See also}
\helpref{wxBrushList}{wxbrushlist}, \helpref{wxColour}{wxcolour}, \helpref{wxColourDatabase}{wxcolourdatabase}
\membersection{wxBrush::\destruct{wxBrush}}
\func{void}{\destruct{wxBrush}}{\void}
Destructor.
\wxheading{Remarks}
The destructor may not delete the underlying brush object of the native windowing
system, since wxBrush uses a reference counting system for efficiency.
Although all remaining brushes are deleted when the application exits,
the application should try to clean up all brushes itself. This is because
wxWindows cannot know if a pointer to the brush object is stored in an
application data structure, and there is a risk of double deletion.
\membersection{wxBrush::GetColour}\label{wxbrushgetcolour}
\constfunc{wxColour\&}{GetColour}{\void}
Returns a reference to the brush colour.
\wxheading{See also}
\helpref{wxBrush::SetColour}{wxbrushsetcolour}
\membersection{wxBrush::GetStipple}\label{wxbrushgetstipple}
\constfunc{wxBitmap *}{GetStipple}{\void}
Gets a pointer to the stipple bitmap. If the brush does not have a wxSTIPPLE style,
this bitmap may be non-NULL but uninitialised (\helpref{wxBitmap::Ok}{wxbitmapok} returns FALSE).
\wxheading{See also}
\helpref{wxBrush::SetStipple}{wxbrushsetstipple}
\membersection{wxBrush::GetStyle}\label{wxbrushgetstyle}
\constfunc{int}{GetStyle}{\void}
Returns the brush style, one of:
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf wxTRANSPARENT}}{Transparent (no fill).}
\twocolitem{{\bf wxSOLID}}{Solid.}
\twocolitem{{\bf wxBDIAGONAL\_HATCH}}{Backward diagonal hatch.}
\twocolitem{{\bf wxCROSSDIAG\_HATCH}}{Cross-diagonal hatch.}
\twocolitem{{\bf wxFDIAGONAL\_HATCH}}{Forward diagonal hatch.}
\twocolitem{{\bf wxCROSS\_HATCH}}{Cross hatch.}
\twocolitem{{\bf wxHORIZONTAL\_HATCH}}{Horizontal hatch.}
\twocolitem{{\bf wxVERTICAL\_HATCH}}{Vertical hatch.}
\twocolitem{{\bf wxSTIPPLE}}{Stippled using a bitmap.}
\end{twocollist}
\wxheading{See also}
\helpref{wxBrush::SetStyle}{wxbrushsetstyle}, \helpref{wxBrush::SetColour}{wxbrushsetcolour},\rtfsp
\helpref{wxBrush::SetStipple}{wxbrushsetstipple}
\membersection{wxBrush::Ok}\label{wxbrushok}
\constfunc{bool}{Ok}{\void}
Returns TRUE if the brush is initialised. It will return FALSE if the default
constructor has been used (for example, the brush is a member of a class, or
NULL has been assigned to it).
\membersection{wxBrush::SetColour}\label{wxbrushsetcolour}
\func{void}{SetColour}{\param{wxColour\& }{colour}}
Sets the brush colour using a reference to a colour object.
\func{void}{SetColour}{\param{const wxString\& }{colourName}}
Sets the brush colour using a colour name from the colour database.
\func{void}{SetColour}{\param{const unsigned char}{ red}, \param{const unsigned char}{ green}, \param{const unsigned char}{ blue}}
Sets the brush colour using red, green and blue values.
\wxheading{See also}
\helpref{wxBrush::GetColour}{wxbrushgetcolour}
\membersection{wxBrush::SetStipple}\label{wxbrushsetstipple}
\func{void}{SetStipple}{\param{const wxBitmap\&}{ bitmap}}
Sets the stipple bitmap.
\wxheading{Parameters}
\docparam{bitmap}{The bitmap to use for stippling.}
\wxheading{Remarks}
The style will be set to wxSTIPPLE.
Note that there is a big difference between stippling in X and Windows.
On X, the stipple is a mask between the wxBitmap and current colour.
On Windows, the current colour is ignored, and the bitmap colour is used.
However, for pre-defined modes like wxCROSS\_HATCH, the behaviour is the
same for both platforms.
\wxheading{See also}
\helpref{wxBitmap}{wxbitmap}
\membersection{wxBrush::SetStyle}\label{wxbrushsetstyle}
\func{void}{SetStyle}{\param{int}{ style}}
Sets the brush style.
\docparam{style}{One of:
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf wxTRANSPARENT}}{Transparent (no fill).}
\twocolitem{{\bf wxSOLID}}{Solid.}
\twocolitem{{\bf wxBDIAGONAL\_HATCH}}{Backward diagonal hatch.}
\twocolitem{{\bf wxCROSSDIAG\_HATCH}}{Cross-diagonal hatch.}
\twocolitem{{\bf wxFDIAGONAL\_HATCH}}{Forward diagonal hatch.}
\twocolitem{{\bf wxCROSS\_HATCH}}{Cross hatch.}
\twocolitem{{\bf wxHORIZONTAL\_HATCH}}{Horizontal hatch.}
\twocolitem{{\bf wxVERTICAL\_HATCH}}{Vertical hatch.}
\twocolitem{{\bf wxSTIPPLE}}{Stippled using a bitmap.}
\end{twocollist}}
\wxheading{See also}
\helpref{wxBrush::GetStyle}{wxbrushgetstyle}
\membersection{wxBrush::operator $=$}\label{wxbrushassignment}
\func{wxBrush\&}{operator $=$}{\param{const wxBrush\& }{brush}}
Assignment operator, using reference counting. Returns a reference
to `this'.
\membersection{wxBrush::operator $==$}\label{wxbrushequals}
\func{bool}{operator $==$}{\param{const wxBrush\& }{brush}}
Equality operator. Two brushes are equal if they contain pointers
to the same underlying brush data. It does not compare each attribute,
so two independently-created brushes using the same parameters will
fail the test.
\membersection{wxBrush::operator $!=$}\label{wxbrushnotequals}
\func{bool}{operator $!=$}{\param{const wxBrush\& }{brush}}
Inequality operator. Two brushes are not equal if they contain pointers
to different underlying brush data. It does not compare each attribute.
\section{\class{wxBrushList}}\label{wxbrushlist}
A brush list is a list containing all brushes which have been created.
\wxheading{Derived from}
\helpref{wxList}{wxlist}\\
\helpref{wxObject}{wxobject}
\wxheading{Remarks}
There is only one instance of this class: {\bf wxTheBrushList}. Use
this object to search for a previously created brush of the desired
type and create it if not already found. In some windowing systems,
the brush may be a scarce resource, so it can pay to reuse old
resources if possible. When an application finishes, all brushes will
be deleted and their resources freed, eliminating the possibility of
`memory leaks'. However, it is best not to rely on this automatic
cleanup because it can lead to double deletion in some circumstances.
There are two mechanisms in recent versions of wxWindows which make the
brush list less useful than it once was. Under Windows, scarce resources
are cleaned up internally if they are not being used. Also, a referencing
counting mechanism applied to all GDI objects means that some sharing
of underlying resources is possible. You don't have to keep track of pointers,
working out when it is safe delete a brush, because the referencing counting does
it for you. For example, you can set a brush in a device context, and then
immediately delete the brush you passed, because the brush is `copied'.
So you may find it easier to ignore the brush list, and instead create
and copy brushes as you see fit. If your Windows resource meter suggests
your application is using too many resources, you can resort to using
GDI lists to share objects explicitly.
The only compelling use for the brush list is for wxWindows to keep
track of brushes in order to clean them up on exit. It is also kept for
backward compatibility with earlier versions of wxWindows.
\wxheading{See also}
\helpref{wxBrush}{wxbrush}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxBrushList::wxBrushList}\label{wxbrushlistconstr}
\func{void}{wxBrushList}{\void}
Constructor. The application should not construct its own brush list:
use the object pointer {\bf wxTheBrushList}.
\membersection{wxBrushList::AddBrush}\label{wxbrushlistaddbrush}
\func{void}{AddBrush}{\param{wxBrush *}{brush}}
Used internally by wxWindows to add a brush to the list.
\membersection{wxBrushList::FindOrCreateBrush}\label{wxbrushlistfindorcreatebrush}
\func{wxBrush *}{FindOrCreateBrush}{\param{const wxColour\& }{colour}, \param{int}{ style}}
Finds a brush with the specified attributes and returns it, else creates a new brush, adds it
to the brush list, and returns it.
\func{wxBrush *}{FindOrCreateBrush}{\param{const wxString\& }{colourName}, \param{int}{ style}}
Finds a brush with the specified attributes and returns it, else creates a new brush, adds it
to the brush list, and returns it.
Finds a brush of the given specification, or creates one and adds it to the list.
\wxheading{Parameters}
\docparam{colour}{Colour object.}
\docparam{colourName}{Colour name, which should be in the colour database.}
\docparam{style}{Brush style. See \helpref{wxBrush::SetStyle}{wxbrushsetstyle} for a list of styles.}
\membersection{wxBrushList::RemoveBrush}\label{wxbrushlistremovebrush}
\func{void}{RemoveBrush}{\param{wxBrush *}{brush}}
Used by wxWindows to remove a brush from the list.

BIN
docs/latex/wx/bullet.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

126
docs/latex/wx/button.tex Normal file
View File

@@ -0,0 +1,126 @@
\section{\class{wxButton}}\label{wxbutton}
A button is a control that contains a text string,
and is one of the commonest elements of a GUI. It may be placed on a
\rtfsp\helpref{dialog box}{wxdialog} or \helpref{panel}{wxpanel}, or indeed
almost any other window.
\wxheading{Derived from}
\helpref{wxControl}{wxcontrol}\\
\helpref{wxWindow}{wxwindow}\\
\helpref{wxEvtHandler}{wxevthandler}\\
\helpref{wxObject}{wxobject}
\wxheading{Window styles}
There are no special styles for wxButton.
See also \helpref{window styles overview}{windowstyles}.
\wxheading{See also}
\helpref{wxBitmapButton}{wxbitmapbutton}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxButton::wxButton}\label{wxbuttonconstr}
\func{}{wxButton}{\void}
Default constructor.
\func{}{wxButton}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id}, \param{const wxString\& }{label},\rtfsp
\param{const wxPoint\& }{pos}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
\param{long}{ style = 0}, \param{const wxValidator\& }{validator}, \param{const wxString\& }{name = ``button"}}
Constructor, creating and showing a button.
\wxheading{Parameters}
\docparam{parent}{Parent window. Must not be NULL.}
\docparam{id}{Button identifier. A value of -1 indicates a default value.}
\docparam{label}{Text to be displayed on the button.}
\docparam{pos}{Button position.}
\docparam{size}{Button size. If the default size (-1, -1) is specified then the button is sized
appropriately for the text.}
\docparam{style}{Window style. See \helpref{wxButton}{wxbutton}.}
\docparam{validator}{Window validator.}
\docparam{name}{Window name.}
\wxheading{See also}
\helpref{wxButton::Create}{wxbuttoncreate}, \helpref{wxValidator}{wxvalidator}
\membersection{wxButton::\destruct{wxButton}}
\func{}{\destruct{wxButton}}{\void}
Destructor, destroying the button.
\membersection{wxButton::Create}\label{wxbuttoncreate}
\func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id}, \param{const wxString\& }{label},\rtfsp
\param{const wxPoint\& }{pos}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
\param{long}{ style = 0}, \param{const wxValidator\& }{validator}, \param{const wxString\& }{name = ``button"}}
Button creation function for two-step creation. For more details, see \helpref{wxButton::wxButton}{wxbuttonconstr}.
\membersection{wxButton::GetLabel}\label{wxbuttongetlabel}
\constfunc{wxString}{GetLabel}{\void}
Returns the string label for the button.
\wxheading{Return value}
The button's label.
\wxheading{See also}
\helpref{wxButton::SetLabel}{wxbuttonsetlabel}
\membersection{wxButton::SetDefault}\label{wxbuttonsetdefault}
\func{void}{SetDefault}{\void}
This sets the button to be the default item for the panel or dialog
box.
\wxheading{Remarks}
Under Windows, only dialog box buttons respond to this function. As
normal under Windows and Motif, pressing return causes the default button to
be depressed when the return key is pressed. See also \helpref{wxWindow::SetFocus}{wxwindowsetfocus}\rtfsp
which sets the keyboard focus for windows and text panel items, \helpref{wxWindow::OnDefaultAction}{wxwindowondefaultaction}\rtfsp
and \helpref{wxWindow::GetDefaultItem}{wxwindowgetdefaultitem}.
Note that under Motif, calling this function immediately after
creation of a button and before the creation of other buttons
will cause misalignment of the row of buttons, since default
buttons are larger. To get around this, call {\it SetDefault}\rtfsp
after you have created a row of buttons: wxWindows will
then set the size of all buttons currently on the panel to
the same size.
\membersection{wxButton::SetLabel}\label{wxbuttonsetlabel}
\func{void}{SetLabel}{\param{const wxString\& }{label}}
Sets the string label for the button.
\wxheading{Parameters}
\docparam{label}{The label to set.}
\wxheading{See also}
\helpref{wxButton::GetLabel}{wxbuttongetlabel}

336
docs/latex/wx/category.tex Normal file
View File

@@ -0,0 +1,336 @@
\chapter{Classes by category}\label{classesbycat}
\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}%
\setfooter{\thepage}{}{}{}{}{\thepage}%
A classification of wxWindows classes by category.
\twocolwidtha{5cm}
{\large {\bf Managed windows}}
There are several types of window that are directly controlled by the
window manager (such as MS Windows, or the Motif Window Manager).
Frames may contain windows, and dialog boxes may directly contain controls.
\begin{twocollist}\itemsep=0pt
\twocolitem{\helpref{wxDialog}{wxdialog}}{Dialog box}
\twocolitem{\helpref{wxFrame}{wxframe}}{Normal frame}
\twocolitem{\helpref{wxMDIParentFrame}{wxmdiparentframe}}{MDI parent frame}
\twocolitem{\helpref{wxMDIChildFrame}{wxmdichildframe}}{MDI child frame}
\twocolitem{\helpref{wxMiniFrame}{wxminiframe}}{A frame with a small title bar}
\twocolitem{\helpref{wxTabbedDialog}{wxtabbeddialog}}{Tabbed dialog}
\end{twocollist}
See also {\bf Common dialogs}.
{\large {\bf Miscellaneous windows}}
The following are a variety of windows that are derived from wxWindow.
\begin{twocollist}\itemsep=0pt
\twocolitem{\helpref{wxGrid}{wxgrid}}{A grid (table) window}
\twocolitem{\helpref{wxPanel}{wxpanel}}{A window whose colour changes according to current user settings}
\twocolitem{\helpref{wxScrolledWindow}{wxscrolledwindow}}{Window with automatically managed scrollbars}
\twocolitem{\helpref{wxSplitterWindow}{wxsplitterwindow}}{Window which can be split vertically or horizontally}
\twocolitem{\helpref{wxStatusBar}{wxstatusbar}}{Implements the status bar on a frame}
\twocolitem{\helpref{wxStatusBar95}{wxstatusbar95}}{Implements a Windows 95 status bar on a frame}
\twocolitem{\helpref{wxTabbedPanel}{wxtabbedpanel}}{Tabbed panel}
\end{twocollist}
{\large {\bf Toolbar classes}}
\overview{Overview}{wxtoolbaroverview}
These are the toolbar classes.
\begin{twocollist}\itemsep=0pt
\twocolitem{\helpref{wxToolBarBase}{wxtoolbarbase}}{Toolbar base class}
\twocolitem{\helpref{wxToolBarSimple}{wxtoolbarsimple}}{A simple, cross-platform toolbar class}
\twocolitem{\helpref{wxToolBarMSW}{wxtoolbarmsw}}{A Windows-only toolbar class}
\twocolitem{\helpref{wxToolBar95}{wxtoolbar95}}{A Windows 95-only toolbar class}
\end{twocollist}
{\large {\bf Common dialogs}}
\overview{Overview}{commondialogsoverview}
Common dialogs are ready-made dialog classes which are frequently used
in an application.
\begin{twocollist}\itemsep=0pt
\twocolitem{\helpref{wxDialog}{wxdialog}}{Base class for common dialogs}
\twocolitem{\helpref{wxColourDialog}{wxcolourdialog}}{Colour chooser dialog}
\twocolitem{\helpref{wxDirDialog}{wxdirdialog}}{Directory selector dialog}
\twocolitem{\helpref{wxFileDialog}{wxfiledialog}}{File selector dialog}
\twocolitem{\helpref{wxMultipleChoiceDialog}{wxmultiplechoicedialog}}{Dialog to get one or more selections from a list}
\twocolitem{\helpref{wxSingleChoiceDialog}{wxsinglechoicedialog}}{Dialog to get a single selection from a list and return the string}
\twocolitem{\helpref{wxTextEntryDialog}{wxtextentrydialog}}{Dialog to get a single line of text from the user}
\twocolitem{\helpref{wxFontDialog}{wxfontdialog}}{Font chooser dialog}
\twocolitem{\helpref{wxPageSetupDialog}{wxpagesetupdialog}}{Standard page setup dialog}
\twocolitem{\helpref{wxPrintDialog}{wxprintdialog}}{Standard print dialog}
\twocolitem{\helpref{wxMessageDialog}{wxmessagedialog}}{Simple message box dialog}
\end{twocollist}
{\large {\bf Controls}}
Typically, these are small windows which provide interaction with the user. Controls
that are not static can have \helpref{validators}{wxvalidator} associated with them.
\begin{twocollist}\itemsep=0pt
\twocolitem{\helpref{wxControl}{wxcontrol}}{The base class for controls}
\twocolitem{\helpref{wxButton}{wxbutton}}{Push button control, displaying text}
\twocolitem{\helpref{wxBitmapButton}{wxbitmapbutton}}{Push button control, displaying a bitmap}
\twocolitem{\helpref{wxCheckBox}{wxcheckbox}}{Checkbox control}
\twocolitem{\helpref{wxCheckListBox}{wxchecklistbox}}{A listbox with a checkbox to the left of each item}
\twocolitem{\helpref{wxChoice}{wxchoice}}{Choice control (a combobox without the editable area)}
\twocolitem{\helpref{wxComboBox}{wxcombobox}}{A choice with an editable area}
\twocolitem{\helpref{wxGauge}{wxgauge}}{A control to represent a varying quantity, such as time remaining}
\twocolitem{\helpref{wxStaticBox}{wxstaticbox}}{A static, or group box for visually grouping related controls}
\twocolitem{\helpref{wxListBox}{wxlistbox}}{A list of strings for single or multiple selection}
\twocolitem{\helpref{wxListCtrl}{wxlistctrl}}{A control for displaying lists of strings and/or icons, plus a multicolumn report view}
\twocolitem{\helpref{wxTabCtrl}{wxtabctrl}}{Manages several tabs}
\twocolitem{\helpref{wxTextCtrl}{wxtextctrl}}{Single or multline text editing control}
\twocolitem{\helpref{wxTreeCtrl}{wxtreectrl}}{Tree (hierachy) control}
\twocolitem{\helpref{wxScrollBar}{wxscrollbar}}{Scrollbar control}
\twocolitem{\helpref{wxSpinButton}{wxspinbutton}}{A spin or `up-down' control}
\twocolitem{\helpref{wxStaticText}{wxstatictext}}{One or more lines of non-editable text}
\twocolitem{\helpref{wxStaticBitmap}{wxstaticbitmap}}{A control to display a bitmap}
\twocolitem{\helpref{wxRadioBox}{wxradiobox}}{A group of radio buttons}
\twocolitem{\helpref{wxRadioButton}{wxradiobutton}}{A round button to be used with others in a mutually exclusive way}
\twocolitem{\helpref{wxSlider}{wxslider}}{A slider that can be dragged by the user}
\end{twocollist}
{\large {\bf Menus}}
\begin{twocollist}\itemsep=0pt
\twocolitem{\helpref{wxMenu}{wxmenu}}{Displays a series of menu items for selection}
\twocolitem{\helpref{wxMenuBar}{wxmenubar}}{Contains a series of menus for use with a frame}
\twocolitem{\helpref{wxMenuItem}{wxmenuitem}}{Represents a single menu item}
\end{twocollist}
{\large {\bf Window layout}}
\overview{Overview}{constraintsoverview}
These are the classes relevant to automated window layout.
\begin{twocollist}\itemsep=0pt
\twocolitem{\helpref{wxIndividualLayoutConstraint}{wxindividuallayoutconstraint}}{Represents a single constraint dimension}
\twocolitem{\helpref{wxLayoutConstraints}{wxlayoutconstraints}}{Represents the constraints for a window class}
\end{twocollist}
{\large {\bf Device contexts}}
\overview{Overview}{dcoverview}
Device contexts are surfaces that may be drawn on, and provide an
abstraction that allows parameterisation of your drawing code
by passing different device contexts.
\begin{twocollist}\itemsep=0pt
\twocolitem{\helpref{wxClientDC}{wxclientdc}}{A device context to access the client area outside {\bf OnPaint} events}
\twocolitem{\helpref{wxPaintDC}{wxpaintdc}}{A device context to access the client area inside {\bf OnPaint} events}
\twocolitem{\helpref{wxWindowDC}{wxwindowdc}}{A device context to access the non-client area}
\twocolitem{\helpref{wxScreenDC}{wxscreendc}}{A device context to access the entire screen}
\twocolitem{\helpref{wxDC}{wxdc}}{The device context base class}
\twocolitem{\helpref{wxMemoryDC}{wxmemorydc}}{A device context for drawing into bitmaps}
\twocolitem{\helpref{wxMetaFileDC}{wxmetafiledc}}{A device context for drawing into metafiles}
\twocolitem{\helpref{wxPostScriptDC}{wxpostscriptdc}}{A device context for drawing into PostScript files}
\twocolitem{\helpref{wxPrinterDC}{wxprinterdc}}{A device context for drawing to printers}
\end{twocollist}
{\large {\bf Graphics device interface}}
\overview{Bitmaps overview}{wxbitmapoverview}
These classes are related to drawing on device contexts and windows.
\begin{twocollist}\itemsep=0pt
\twocolitem{\helpref{wxColour}{wxcolour}}{Represents the red, blue and green elements of a colour}
\twocolitem{\helpref{wxBitmap}{wxbitmap}}{Represents a bitmap}
\twocolitem{\helpref{wxBrush}{wxbrush}}{Used for filling areas on a device context}
\twocolitem{\helpref{wxBrushList}{wxbrushlist}}{The list of previously-created brushes}
\twocolitem{\helpref{wxCursor}{wxcursor}}{A small, transparent bitmap representing the cursor}
\twocolitem{\helpref{wxFont}{wxfont}}{Represents fonts}
\twocolitem{\helpref{wxFontList}{wxfontlist}}{The list of previously-created fonts}
\twocolitem{\helpref{wxIcon}{wxicon}}{A small, transparent bitmap for assigning to frames and drawing on device contexts}
\twocolitem{\helpref{wxImageList}{wximagelist}}{A list of images, used with some controls}
\twocolitem{\helpref{wxMask}{wxmask}}{Represents a mask to be used with a bitmap for transparent drawing}
\twocolitem{\helpref{wxPen}{wxpen}}{Used for drawing lines on a device context}
\twocolitem{\helpref{wxPenList}{wxpenlist}}{The list of previously-created pens}
\twocolitem{\helpref{wxPalette}{wxpalette}}{Represents a table of indices into RGB values}
\twocolitem{\helpref{wxRegion}{wxregion}}{Represents a simple or complex region on a window or device context}
\end{twocollist}
{\large {\bf Events}}
\overview{Overview}{eventhandlingoverview}
An event object contains information about a specific event. Event handlers
(usually member functions) have a single, event argument.
\begin{twocollist}\itemsep=0pt
\twocolitem{\helpref{wxActivateEvent}{wxactivateevent}}{A window or application activation event}
\twocolitem{\helpref{wxCloseEvent}{wxcloseevent}}{A close window or end session event}
\twocolitem{\helpref{wxCommandEvent}{wxcommandevent}}{An event from a variety of standard controls}
\twocolitem{\helpref{wxDropFilesEvent}{wxdropfilesevent}}{A drop files event}
\twocolitem{\helpref{wxEraseEvent}{wxeraseevent}}{An erase background event}
\twocolitem{\helpref{wxEvent}{wxevent}}{The event base class}
\twocolitem{\helpref{wxFocusEvent}{wxfocusevent}}{A window focus event}
\twocolitem{\helpref{wxKeyEvent}{wxkeyevent}}{A keypress event}
\twocolitem{\helpref{wxIdleEvent}{wxidleevent}}{An idle event}
\twocolitem{\helpref{wxInitDialogEvent}{wxinitdialogevent}}{A dialog initialisation event}
\twocolitem{\helpref{wxJoystickEvent}{wxjoystickevent}}{A joystick event}
\twocolitem{\helpref{wxListEvent}{wxlistevent}}{A list control event}
\twocolitem{\helpref{wxMenuEvent}{wxmenuevent}}{A menu event}
\twocolitem{\helpref{wxMouseEvent}{wxmouseevent}}{A mouse event}
\twocolitem{\helpref{wxMoveEvent}{wxmoveevent}}{A move event}
\twocolitem{\helpref{wxPaintEvent}{wxpaintevent}}{A paint event}
%\twocolitem{\helpref{wxSessionEvent}{wxsessionevent}}{A session ending event}
\twocolitem{\helpref{wxSizeEvent}{wxsizeevent}}{A size event}
\twocolitem{\helpref{wxSysColourChangedEvent}{wxsyscolourchangedevent}}{A system colour change event}
\twocolitem{\helpref{wxTabEvent}{wxtabevent}}{A tab control event}
\twocolitem{\helpref{wxTreeEvent}{wxtreeevent}}{A tree control event}
\twocolitem{\helpref{wxUpdateUIEvent}{wxupdateuievent}}{A user interface update event}
\end{twocollist}
{\large {\bf Validators}}
These are the window validators, used for filtering and validating
user input.
\begin{twocollist}\itemsep=0pt
\twocolitem{\helpref{wxValidator}{wxvalidator}}{Base validator class.}
\twocolitem{\helpref{wxTextValidator}{wxtextvalidator}}{Text control validator class.}
\end{twocollist}
{\large {\bf Data structures}}
These are the data structure classes supported by wxWindows.
\begin{twocollist}\itemsep=0pt
\twocolitem{\helpref{wxExpr}{wxexpr}}{A class for flexible I/O}
\twocolitem{\helpref{wxExprDatabase}{wxexprdatabase}}{A class for flexible I/O}
\twocolitem{\helpref{wxDate}{wxdate}}{A class for date manipulation}
\twocolitem{\helpref{wxHashTable}{wxhashtable}}{A simple hash table implementation}
\twocolitem{\helpref{wxList}{wxlist}}{A simple linked list implementation}
\twocolitem{\helpref{wxNode}{wxnode}}{Represents a node in the wxList implementation}
\twocolitem{\helpref{wxObject}{wxobject}}{The root class for most wxWindows classes}
\twocolitem{\helpref{wxPathList}{wxpathlist}}{A class to help search multiple paths}
\twocolitem{\helpref{wxPoint}{wxpoint}}{Representation of a point}
\twocolitem{\helpref{wxRect}{wxrect}}{A class representing a rectangle}
\twocolitem{\helpref{wxRegion}{wxregion}}{A class representing a region}
\twocolitem{\helpref{wxString}{wxstring}}{A string class}
\twocolitem{\helpref{wxStringList}{wxstringlist}}{A class representing a list of strings}
\twocolitem{\helpref{wxRealPoint}{wxrealpoint}}{Representation of a point using floating point numbers}
\twocolitem{\helpref{wxSize}{wxsize}}{Representation of a size}
\twocolitem{\helpref{wxTime}{wxtime}}{A class for time manipulation}
\end{twocollist}
{\large {\bf Run-time class information system}}
\overview{Overview}{runtimeclassoverview}
wxWindows supports run-time manipulation of class information, and dynamic
creation of objects given class names.
\begin{twocollist}\itemsep=0pt
\twocolitem{\helpref{wxClassInfo}{wxclassinfo}}{Holds run-time class information}
\twocolitem{\helpref{wxObject}{wxobject}}{Root class for classes with run-time information}
\twocolitem{\helpref{Macros}{macros}}{Macros for manipulating run-time information}
\end{twocollist}
{\large {\bf Debugging features}}
\overview{Overview}{debuggingoverview}
wxWindows supports some aspects of debugging an application through
classes, functions and macros.
\begin{twocollist}\itemsep=0pt
\twocolitem{\helpref{wxDebugContext}{wxdebugcontext}}{Provides various debugging facilities}
\twocolitem{\helpref{wxDebugStreamBuf}{wxdebugstreambuf}}{A stream buffer writing to the debug stream}
\twocolitem{\helpref{wxObject}{wxobject}}{Provides optional debugging versions of {\bf new} and {\bf delete}}
\twocolitem{\helpref{wxTrace}{wxtrace}}{Tracing facility}
\twocolitem{\helpref{wxTraceLevel}{wxtracelevel}}{Tracing facility with levels}
\twocolitem{\helpref{WXDEBUG\_NEW}{debugnew}}{Use this macro to give further debugging information}
\twocolitem{\helpref{WXTRACE}{trace}}{Trace macro}
\twocolitem{\helpref{WXTRACELEVEL}{tracelevel}}{Trace macro with levels}
\end{twocollist}
{\large {\bf Interprocess communication}}
\overview{Overview}{ipcoverview}
wxWindows provides a simple interprocess communications facilities
based on DDE.
\begin{twocollist}\itemsep=0pt
\twocolitem{\helpref{wxDDEClient}{wxddeclient}}{Represents a client}
\twocolitem{\helpref{wxDDEConnection}{wxddeconnection}}{Represents the connection between a client and a server}
\twocolitem{\helpref{wxDDEServer}{wxddeserver}}{Represents a server}
\end{twocollist}
{\large {\bf Document/view framework}}
\overview{Overview}{docviewoverview}
wxWindows supports a document/view framework which provides
housekeeping for a document-centric application.
TODO: MDI frame classes for documents; make it unnecessary to convert
between streams and files (overridable method that uses filenames instead of streams).
\begin{twocollist}\itemsep=0pt
\twocolitem{\helpref{wxDocument}{wxdocument}}{Represents a document}
\twocolitem{\helpref{wxView}{wxview}}{Represents a view}
\twocolitem{\helpref{wxDocTemplate}{wxdoctemplate}}{Manages the relationship between a document class and a veiw class}
\twocolitem{\helpref{wxDocManager}{wxdocmanager}}{Manages the documents and views in an application}
\twocolitem{\helpref{wxDocChildFrame}{wxdocchildframe}}{A child frame for showing a document view}
\twocolitem{\helpref{wxDocParentFrame}{wxdocparentframe}}{A parent frame to contain views}
\end{twocollist}
{\large {\bf Printing framework}}
\overview{Overview}{printingoverview}
A printing and previewing framework is implemented to
make it relatively straighforward to provide document printing
facilities.
\begin{twocollist}\itemsep=0pt
\twocolitem{\helpref{wxPreviewFrame}{wxpreviewframe}}{Frame for displaying a print preview}
\twocolitem{\helpref{wxPreviewCanvas}{wxpreviewcanvas}}{Canvas for displaying a print preview}
\twocolitem{\helpref{wxPreviewControlBar}{wxpreviewcontrolbar}}{Standard control bar for a print preview}
\twocolitem{\helpref{wxPrintData}{wxprintdata}}{Represents information about the document being printed}
\twocolitem{\helpref{wxPrintDialog}{wxprintdialog}}{Standard print dialog}
\twocolitem{\helpref{wxPrinter}{wxprinter}}{Class representing the printer}
\twocolitem{\helpref{wxPrinterDC}{wxprinterdc}}{Printer device context}
\twocolitem{\helpref{wxPrintout}{wxprintout}}{Class representing a particular printout}
\twocolitem{\helpref{wxPrintPreview}{wxprintpreview}}{Class representing a print preview}
\end{twocollist}
{\large {\bf Database classes}}
\overview{Database classes overview}{odbcoverview}
wxWindows provides a set of classes for accessing Microsoft's ODBC (Open Database Connectivity)
product.
\begin{twocollist}\itemsep=0pt
\twocolitem{\helpref{wxDatabase}{wxdatabase}}{Database class}
\twocolitem{\helpref{wxQueryCol}{wxquerycol}}{Class representing a column}
\twocolitem{\helpref{wxQueryField}{wxqueryfield}}{Class representing a field}
\twocolitem{\helpref{wxRecordSet}{wxrecordset}}{Class representing one or more record}
\end{twocollist}
{\large {\bf Miscellaneous}}
\begin{twocollist}\itemsep=0pt
\twocolitem{\helpref{wxApp}{wxapp}}{Application class}
\twocolitem{\helpref{wxHelpControllerBase}{wxhelpcontrollerbase}}{Base class for help controllers}
\twocolitem{\helpref{wxTimer}{wxtimer}}{Timer class}
\twocolitem{\helpref{wxSystemSettings}{wxsystemsettings}}{System settings class}
\twocolitem{\helpref{wxWinHelpController}{wxwinhelpcontroller}}{Controls WinHelp instances}
\end{twocollist}

View File

@@ -0,0 +1,96 @@
\section{\class{wxCheckBox}}\label{wxcheckbox}
A checkbox is a labelled box which is either on (checkmark is visible)
or off (no checkmark).
\wxheading{Derived from}
\helpref{wxControl}{wxcontrol}\\
\helpref{wxWindow}{wxwindow}\\
\helpref{wxEvtHandler}{wxevthandler}\\
\helpref{wxObject}{wxobject}
\wxheading{Window styles}
There are no special styles for wxCheckBox.
See also \helpref{window styles overview}{windowstyles}.
\wxheading{See also}
\helpref{wxRadioButton}{wxradiobutton}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxCheckBox::wxCheckBox}\label{wxcheckboxconstr}
\func{}{wxCheckBox}{\void}
Default constructor.
\func{}{wxCheckBox}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id},\rtfsp
\param{const wxString\& }{label}, \param{const wxPoint\& }{pos = wxDefaultPosition},\rtfsp
\param{const wxSize\& }{size = wxDefaultSize}, \param{long}{ style = 0},\rtfsp
\param{const wxValidator\& }{val}, \param{const wxString\& }{name = ``checkBox"}}
Constructor, creating and showing a checkbox.
\wxheading{Parameters}
\docparam{parent}{Parent window. Must not be NULL.}
\docparam{id}{Checkbox identifier. A value of -1 indicates a default value.}
\docparam{label}{Text to be displayed next to the checkbox.}
\docparam{pos}{Checkbox position. If the position (-1, -1) is specified then a default position is chosen.}
\docparam{size}{Checkbox size. If the default size (-1, -1) is specified then a default size is chosen.}
\docparam{style}{Window style. See \helpref{wxCheckBox}{wxcheckbox}.}
\docparam{validator}{Window validator.}
\docparam{name}{Window name.}
\wxheading{See also}
\helpref{wxCheckBox::Create}{wxcheckboxcreate}, \helpref{wxValidator}{wxvalidator}
\membersection{wxCheckBox::\destruct{wxCheckBox}}
\func{}{\destruct{wxCheckBox}}{\void}
Destructor, destroying the checkbox.
\membersection{wxCheckBox::Create}\label{wxcheckboxcreate}
\func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id},\rtfsp
\param{const wxString\& }{label}, \param{const wxPoint\& }{pos = wxDefaultPosition},\rtfsp
\param{const wxSize\& }{size = wxDefaultSize}, \param{long}{ style = 0},\rtfsp
\param{const wxValidator\& }{val}, \param{const wxString\& }{name = ``checkBox"}}
Creates the checkbox for two-step construction. See \helpref{wxCheckBox::wxCheckBox}{wxcheckboxconstr}\rtfsp
for details.
\membersection{wxCheckBox::GetValue}\label{wxcheckboxgetvalue}
\constfunc{bool}{GetValue}{\void}
Gets the state of the checkbox.
\wxheading{Return value}
Returns TRUE if it is checked, FALSE otherwise.
\membersection{wxCheckBox::SetValue}\label{wxcheckboxsetvalue}
\func{void}{SetValue}{\param{const bool}{ state}}
Sets the checkbox to the given state.
\wxheading{Parameters}
\docparam{state}{If TRUE, the check is on, otherwise it is off.}

193
docs/latex/wx/choice.tex Normal file
View File

@@ -0,0 +1,193 @@
\section{\class{wxChoice}}\label{wxchoice}
A choice item is used to select one of a list of strings. Unlike a
listbox, only the selection is visible until the user pulls down the
menu of choices.
\wxheading{Derived from}
\helpref{wxControl}{wxcontrol}\\
\helpref{wxWindow}{wxwindow}\\
\helpref{wxEvtHandler}{wxevthandler}\\
\helpref{wxObject}{wxobject}
\wxheading{Window styles}
There are no special styles for wxChoice.
See also \helpref{window styles overview}{windowstyles}.
\wxheading{See also}
\helpref{wxListBox}{wxlistbox}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxChoice::wxChoice}\label{wxchoiceconstr}
\func{}{wxChoice}{\void}
Default constructor.
\func{}{wxChoice}{\param{wxWindow *}{parent}, \param{wxWindowID}{ id},\rtfsp
\param{const wxPoint\& }{pos}, \param{const wxSize\&}{ size},\rtfsp
\param{int}{ n}, \param{const wxString }{choices[]},\rtfsp
\param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``choice"}}
Constructor, creating and showing a choice.
\wxheading{Parameters}
\docparam{parent}{Parent window. Must not be NULL.}
\docparam{id}{Window identifier. A value of -1 indicates a default value.}
\docparam{pos}{Window position.}
\docparam{size}{Window size. If the default size (-1, -1) is specified then the choice is sized
appropriately.}
\docparam{n}{Number of strings with which to initialise the choice control.}
\docparam{choices}{An array of strings with which to initialise the choice control.}
\docparam{style}{Window style. See \helpref{wxChoice}{wxchoice}.}
\docparam{validator}{Window validator.}
\docparam{name}{Window name.}
\wxheading{See also}
\helpref{wxChoice::Create}{wxchoicecreate}, \helpref{wxValidator}{wxvalidator}
\membersection{wxChoice::\destruct{wxChoice}}
\func{}{\destruct{wxChoice}}{\void}
Destructor, destroying the choice item.
\membersection{wxChoice::Append}\label{wxchoiceappend}
\func{void}{Append}{\param{const wxString\& }{ item}}
Adds the item to the end of the choice control.
\wxheading{Parameters}
\docparam{item}{String to add.}
\membersection{wxChoice::Clear}\label{wxchoiceclear}
\func{void}{Clear}{\void}
Clears the strings from the choice item.
\membersection{wxChoice::Create}\label{wxchoicecreate}
\func{bool}{Create}{\param{wxWindow *}{parent}, \param{wxWindowID}{ id},\rtfsp
\param{const wxPoint\& }{pos}, \param{const wxSize\&}{ size},\rtfsp
\param{int}{ n}, \param{const wxString }{choices[]},\rtfsp
\param{long}{ style = 0}, \param{const wxString\& }{name = ``choice"}}
Creates the choice for two-step construction. See \helpref{wxChoice::wxChoice}{wxchoiceconstr}.
\membersection{wxChoice::FindString}\label{wxchoicefindstring}
\constfunc{int}{FindString}{\param{const wxString\& }{string}}
Finds a choice matching the given string.
\wxheading{Parameters}
\docparam{string}{String to find.}
\wxheading{Return value}
Returns the position if found, or -1 if not found.
\membersection{wxChoice::GetColumns}\label{wxchoicegetcolumns}
\constfunc{int}{GetColumns}{\void}
Gets the number of columns in this choice item.
\wxheading{Remarks}
This is implemented for Motif only.
\membersection{wxChoice::GetSelection}\label{wxchoicegetselection}
\constfunc{int}{GetSelection}{\void}
Gets the id (position) of the selected string, or -1 if there is no selection.
\membersection{wxChoice::GetString}\label{wxchoicegetstring}
\constfunc{wxString}{GetString}{\param{int}{ n}}
Returns the string at the given position.
\wxheading{Parameters}
\docparam{n}{The zero-based position.}
\wxheading{Return value}
The string at the given position, or the empty string if {\it n} is invalid.
\membersection{wxChoice::GetStringSelection}\label{wxchoicegetstringselection}
\constfunc{wxString}{GetStringSelection}{\void}
Gets the selected string, or the empty string if no string is selected.
\membersection{wxChoice::Number}\label{wxchoicenumber}
\constfunc{int}{Number}{\void}
Returns the number of strings in the choice control.
\membersection{wxChoice::SetColumns}\label{wxchoicesetcolumns}
\func{void}{SetColumns}{\param{int}{ n = 1}}
Sets the number of columns in this choice item.
\wxheading{Parameters}
\docparam{n}{Number of columns.}
\wxheading{Remarks}
This is implemented for Motif only.
\membersection{wxChoice::SetSelection}\label{wxchoicesetselection}
\func{void}{SetSelection}{\param{int}{ n}}
Sets the choice by passing the desired string position.
\wxheading{Parameters}
\docparam{n}{The string position to select, starting from zero.}
\wxheading{See also}
\helpref{wxChoice::SetStringSelection}{wxchoicesetstringselection}
\membersection{wxChoice::SetStringSelection}\label{wxchoicesetstringselection}
\func{void}{SetStringSelection}{\param{const wxString\& }{ string}}
Sets the choice by passing the desired string.
\wxheading{Parameters}
\docparam{string}{The string to select.}
\wxheading{See also}
\helpref{wxChoice::SetSelection}{wxchoicesetselection}

View File

@@ -0,0 +1,76 @@
\section{\class{wxClassInfo}}\label{wxclassinfo}
This class stores meta-information about classes. Instances of this class are
not generally defined directly by an application, but indirectly through use
of macros such as {\bf DECLARE\_DYNAMIC\_CLASS} and {\bf IMPLEMENT\_DYNAMIC\_CLASS}.
\wxheading{Derived from}
No parent class.
\wxheading{See also}
\overview{Overview}{wxclassinfooverview}\\
\helpref{wxObject}{wxobject}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxClassInfo::wxClassInfo}\label{wxclassinfoconstr}
\func{}{wxClassInfo}{\param{char* }{className}, \param{char* }{baseClass1}, \param{char* }{baseClass2},
\param{int}{ size}, \param{wxObjectConstructorFn }{fn}}
Constructs a wxClassInfo object. The supplied macros implicitly construct objects of this
class, so there is no need to create such objects explicitly in an application.
\membersection{wxClassInfo::CreateObject}
\func{wxObject*}{CreateObject}{\void}
Creates an object of the appropriate kind. Returns NULL if the class has not been declared
dynamically createable (typically, it's an abstract class).
\membersection{wxClassInfo::FindClass}
\func{static wxClassInfo *}{FindClass}{\param{char* }{name}}
Finds the wxClassInfo object for a class of the given string name.
\membersection{wxClassInfo::GetBaseClassName1}
\constfunc{char*}{GetBaseClassName1}{\void}
Returns the name of the first base class (NULL if none).
\membersection{wxClassInfo::GetBaseClassName2}
\constfunc{char*}{GetBaseClassName2}{\void}
Returns the name of the second base class (NULL if none).
\membersection{wxClassInfo::GetClassName}
\constfunc{char *}{GetClassName}{\void}
Returns the string form of the class name.
\membersection{wxClassInfo::GetSize}
\constfunc{int}{GetSize}{\void}
Returns the size of the class.
\membersection{wxClassInfo::InitializeClasses}
\func{static void}{InitializeClasses}{\void}
Initializes pointers in the wxClassInfo objects for fast execution
of IsKindOf. Called in base wxWindows library initialization.
\membersection{wxClassInfo::IsKindOf}\label{wxclassinfoiskindof}
\func{bool}{IsKindOf}{\param{wxClassInfo* }{info}}
Returns TRUE if this class is a kind of (inherits from) the given class.

174
docs/latex/wx/classes.tex Normal file
View File

@@ -0,0 +1,174 @@
\chapter{Alphabetical class reference}\label{classref}
\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}%
\setfooter{\thepage}{}{}{}{}{\thepage}%
\pagenumbering{arabic}%
%
\begin{comment}
\helpignore{\section{Class hierarchy}%
The GUI-specific wxWindows class hierarchy is shown in Figure 5.1.
Many other, non-GUI classes have been omitted.
\vskip 1cm
$$\image{14cm;0cm}{wxclass.ps}$$
\vskip 1cm
\centerline{Figure 5.1: wxWindows class hierarchy}
\newpage}%
\overview{Writing a wxWindows application: a rough guide}{roughguide}
\helponly{
\sethotspotcolour{off}%
\large{
\helpref{Notes on using the reference}{referencenotes}\\
\helpref{Guide to functions}{functions}
\sethotspotcolour{on}%
}}
\end{comment}
\input activevt.tex
\input app.tex
\input button.tex
\input bitmap.tex
\input bbutton.tex
\input brush.tex
\input checkbox.tex
\input choice.tex
\input clasinfo.tex
\input clientdc.tex
\input clipbrd.tex
\input closeevt.tex
\input colour.tex
\input colordlg.tex
\input combobox.tex
\input command.tex
\input cmdevent.tex
\input cmdproc.tex
\input conditn.tex
\input control.tex
\input cursor.tex
\input database.tex
\input date.tex
\input datstream.tex
\input dc.tex
\input ddeclint.tex
\input ddeconn.tex
\input ddeservr.tex
\input debugcxt.tex
\input dialog.tex
\input dirdlg.tex
\input document.tex
\input docchfrm.tex
\input docmanag.tex
\input docprfrm.tex
\input doctempl.tex
\input dropevt.tex
\input eraseevt.tex
\input event.tex
\input evthand.tex
\input expr.tex
\input file.tex
\input filedlg.tex
\input filehist.tex
\input focusevt.tex
\input font.tex
\input fontdlg.tex
\input fontlist.tex
\input frame.tex
\input gauge.tex
\input gdiobj.tex
\input grid.tex
\input hash.tex
\input helpinst.tex
\input idleevt.tex
\input icon.tex
\input imaglist.tex
\input ilayout.tex
\input indlgevt.tex
\input joystick.tex
\input joyevent.tex
\input keyevent.tex
\input layout.tex
\input list.tex
\input listbox.tex
\input listctrl.tex
\input listevt.tex
\input mask.tex
\input mdi.tex
\input menu.tex
\input menuitem.tex
\input menuevt.tex
\input memorydc.tex
\input msgdlg.tex
\input metafile.tex
\input minifram.tex
\input module.tex
\input mouseevt.tex
\input moveevt.tex
\input mltchdlg.tex
\input mutex.tex
\input node.tex
\input object.tex
\input pagedlg.tex
\input paintdc.tex
\input paintevt.tex
\input palette.tex
\input panel.tex
\input pantabv.tex
\input pathlist.tex
\input pen.tex
\input point.tex
\input prevwin.tex
\input print.tex
\input process.tex
\input postscpt.tex
\input query.tex
\input radiobox.tex
\input radiobut.tex
\input realpoin.tex
\input rect.tex
\input recrdset.tex
\input region.tex
\input screendc.tex
\input scrolbar.tex
\input scrolevt.tex
\input scrolwin.tex
\input sngchdlg.tex
\input size.tex
\input sizeevt.tex
\input slider.tex
\input spinbutt.tex
\input splitter.tex
\input statbmp.tex
\input statbox.tex
\input stattext.tex
\input statusbr.tex
%\input wxstring.tex
\input strlist.tex
\input sysclevt.tex
\input settings.tex
\input tab.tex
\input tabctrl.tex
\input tabevent.tex
\input taskbar.tex
\input text.tex
\input textdlg.tex
\input valtext.tex
\input thread.tex
\input time.tex
\input timer.tex
\input toolbar.tex
\input treectrl.tex
\input treeevt.tex
\input upditer.tex
\input upduievt.tex
\input validatr.tex
\input view.tex
\input wave.tex
\input window.tex
\input windowdc.tex
\input winhelp.tex
\input function.tex

View File

@@ -0,0 +1,31 @@
\section{\class{wxClientDC}}\label{wxclientdc}
A wxClientDC must be constructed if an application wishes to paint on the
client area of a window from outside an {\bf OnPaint} event.
This should normally be constructed as a temporary stack object; don't store
a wxClientDC object.
To draw on a window from within {\bf OnPaint}, construct a \helpref{wxPaintDC}{wxpaintdc} object.
To draw on the whole window including decorations, construct a \helpref{wxWindowDC}{wxwindowdc} object
(Windows only).
\wxheading{Derived from}
\helpref{wxDC}{wxdc}
\wxheading{See also}
\helpref{wxDC}{wxdc}, \helpref{wxMemoryDC}{wxmemorydc}, \helpref{wxPaintDC}{wxpaintdc},\rtfsp
\helpref{wxWindowDC}{wxwindowdc}, \helpref{wxScreenDC}{wxscreendc}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxClientDC::wxClientDC}
\func{}{wxClientDC}{\param{wxWindow*}{ window}}
Constructor. Pass a pointer to the window on which you wish to paint.

103
docs/latex/wx/clipbrd.tex Normal file
View File

@@ -0,0 +1,103 @@
\section{\class{wxClipboard}}\label{wxclipboard}
There is one wxClipboard object referenced by the pointer
wxTheClipboard, initialized by calling \helpref{wxInitClipboard}{wxinitclipboard}.
Under X, clipboard manipulation must be done by using this class, and
such code will work under MS Windows also. Under MS Windows, you have the
alternative of using the normal clipboard functions.
The documentation for this class will be expanded in due course. At present,
wxClipboard is only used in the wxMediaWindow add-on library.
\wxheading{Derived from}
\helpref{wxObject}{wxobject}
\wxheading{See also}
\helpref{wxClipboardClient}{wxclipboardclient}, \helpref{wxInitClipboard}{wxinitclipboard}.
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxClipboard::GetClipboardClient}
\func{wxClipboardClient *}{GetClipboardClient}{\void}
Get the clipboard client directly. Will be NULL if clipboard data
is a string, or if some other application owns the clipboard.
This can be useful for shortcutting data translation, if the
clipboard user can check for a specific client.
\membersection{wxClipboard::GetClipboardData}
\func{char*}{GetClipboardData}{\param{const wxString\& }{format}, \param{long *}{length}, \param{long}{ time}}
Get data from the clipboard.
\membersection{wxClipboard::GetClipboardString}
\func{wxString}{GetClipboardString}{\param{long}{ time}}
Get the data from the clipboard in the format ``TEXT".
\membersection{wxClipboard::SetClipboardClient}
\func{void}{SetClipboardClient}{\param{wxClipboardClient *}{client}, \param{long}{ time}}
Set the clipboard data owner.
\membersection{wxClipboard::SetClipboardString}
\func{void}{SetClipboardString}{\param{const wxString\& }{data}, \param{long}{ time}}
Set the clipboard string; does not require a client.
\section{\class{wxClipboardClient}}\label{wxclipboardclient}
Implemented under X and MS Windows, a clipboard client holds data
belonging to the clipboard. For plain text, a client is not necessary.
wxClipboardClient is an abstract class for which the virtual functions
BeingReplaced and GetData must be overridden.
\wxheading{Derived from}
\helpref{wxObject}{wxobject}
\wxheading{See also}
\helpref{wxClipboard}{wxclipboard}, \helpref{wxInitClipboard}{wxinitclipboard}.
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxClipboardClient::formats}
\member{wxStringList}{formats}
This list should be filled in with strings indicating the formats
this client can provide. Almost all clients will provide``TEXT".
Format names should be 4 characters long, so things will work
out on the Macintosh.
\membersection{wxClipboardClient::BeingReplaced}
\func{void}{BeingReplaced}{\void}
This method is called when the client is losing the selection.
\membersection{wxClipboardClient::GetData}
\func{char*}{GetData}{\param{const wxString\& }{format}, \param{long *}{size}}
This method is called when someone wants the data this client is
supplying to the clipboard.
{\it format} is a string indicating the
format of the data - one of the strings from the ``formats"
list.
{\it size} should be filled with the size of the resulting
data. In the case of text, {\it size} does not count the
NULL terminator.

View File

@@ -0,0 +1,57 @@
\section{\class{wxCloseEvent}}\label{wxcloseevent}
This event class contains information about window and session close events.
\wxheading{Derived from}
\helpref{wxEvent}{wxevent}
\wxheading{Event table macros}
To process a close event, use these event handler macros to direct input to member
functions that take a wxCloseEvent argument.
\twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf EVT\_CLOSE(func)}}{Process a close event, supplying the member function.}
\end{twocollist}%
\wxheading{See also}
\helpref{wxWindow::OnCloseWindow}{wxwindowonclosewindow},\rtfsp
\helpref{wxWindow::Close}{wxwindowclose},\rtfsp
\helpref{Window deletion overview}{windowdeletionoverview}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxCloseEvent::wxCloseEvent}
\func{}{wxCloseEvent}{\param{WXTYPE}{ commandEventType = 0}, \param{int}{ id = 0}}
Constructor.
\membersection{wxCloseEvent::GetLoggingOff}\label{wxcloseeventgetloggingoff}
\constfunc{bool}{GetLoggingOff}{\void}
Returns TRUE if the user is logging off.
\membersection{wxCloseEvent::GetSessionEnding}\label{wxcloseeventgetsessionending}
\constfunc{bool}{GetSessionEnding}{\void}
Returns TRUE if the session is ending.
\membersection{wxCloseEvent::GetForce}\label{wxcloseeventgetforce}
\constfunc{void}{GetForce}{\void}
Returns TRUE if the application wishes to force the window to close.
\membersection{wxCloseEvent::Veto}\label{wxcloseeventveto}
\func{void}{Veto}{\void}
Call this from your event handler to veto a system shutdown.

179
docs/latex/wx/cmdevent.tex Normal file
View File

@@ -0,0 +1,179 @@
\section{\class{wxCommandEvent}}\label{wxcommandevent}
This event class contains information about command events, which originate from a variety of
simple controls. More complex controls, such as \helpref{wxTreeCtrl}{wxtreectrl}, have separate command event classes.
\wxheading{Derived from}
\helpref{wxEvent}{wxevent}
\wxheading{Event table macros}
To process a menu command event, use these event handler macros to direct input to member
functions that take a wxCommandEvent argument.
\twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf EVT\_COMMAND(id, cmd, func)}}{Process a command, supplying the window identifier,
command event identifier, and member function.}
\twocolitem{{\bf EVT\_COMMAND\_RANGE(id1, id2, cmd, func)}}{Process a command for a range
of window identifiers, supplying the minimum and maximum window identifiers,
command event identifier, and member function.}
\twocolitem{{\bf EVT\_BUTTON(id, func)}}{Process a wxEVT\_COMMAND\_BUTTON\_CLICKED command,
which is generated by a wxButton control.}
\twocolitem{{\bf EVT\_CHECKBOX(id, func)}}{Process a wxEVT\_COMMAND\_CHECKBOX\_CLICKED command,
which is generated by a wxCheckBox control.}
\twocolitem{{\bf EVT\_CHOICE(id, func)}}{Process a wxEVT\_COMMAND\_CHOICE\_SELECTED command,
which is generated by a wxChoice control.}
\twocolitem{{\bf EVT\_LISTBOX(id, func)}}{Process a wxEVT\_COMMAND\_LISTBOX\_SELECTED command,
which is generated by a wxListBox control.}
\twocolitem{{\bf EVT\_LISTBOX_DCLICK(id, func)}}{Process a wxEVT\_COMMAND\_LISTBOX\_DOUBLECLICKED command,
which is generated by a wxListBox control.}
\twocolitem{{\bf EVT\_TEXT(id, func)}}{Process a wxEVT\_COMMAND\_TEXT\_UPDATED command,
which is generated by a wxTextCtrl control.}
\twocolitem{{\bf EVT\_TEXT\_ENTER(id, func)}}{Process a wxEVT\_COMMAND\_TEXT\_ENTER command,
which is generated by a wxTextCtrl control.}
\twocolitem{{\bf EVT\_MENU(id, func)}}{Process a wxEVT\_COMMAND\_MENU\_SELECTED command,
which is generated by a menu item.}
\twocolitem{{\bf EVT\_MENU\_RANGE(id1, id2, func)}}{Process a wxEVT\_COMMAND\_MENU\_RANGE command,
which is generated by a range of menu items.}
\twocolitem{{\bf EVT\_SLIDER(id, func)}}{Process a wxEVT\_COMMAND\_SLIDER\_UPDATED command,
which is generated by a wxSlider control.}
\twocolitem{{\bf EVT\_RADIOBOX(id, func)}}{Process a wxEVT\_COMMAND\_RADIOBOX\_SELECTED command,
which is generated by a wxRadioBox control.}
\twocolitem{{\bf EVT\_RADIOBUTTON(id, func)}}{Process a wxEVT\_COMMAND\_RADIOBUTTON\_SELECTED command,
which is generated by a wxRadioButton control.}
\twocolitem{{\bf EVT\_SCROLLBAR(id, func)}}{Process a wxEVT\_COMMAND\_SCROLLBAR\_UPDATED command,
which is generated by a wxScrollBar control. This is provided for compatibility only;
more specific scrollbar event macros should be used instead (see \helpref{wxScrollEvent}{wxscrollevent}).}
\twocolitem{{\bf EVT\_COMBOBOX(id, func)}}{Process a wxEVT\_COMMAND\_COMBOBOX\_SELECTED command,
which is generated by a wxComboBox control.}
\twocolitem{{\bf EVT\_TOOL(id, func)}}{Process a wxEVT\_COMMAND\_TOOL\_CLICKED command,
which is generated by a toobar button.}
\twocolitem{{\bf EVT\_TOOL\_RCLICKED(id, func)}}{Process a wxEVT\_COMMAND\_TOOL\_RCLICKED command,
which is generated by a toobar button.}
\twocolitem{{\bf EVT\_TOOL\_ENTER(id, func)}}{Process a wxEVT\_COMMAND\_TOOL\_ENTER command,
which is generated by a toobar button.}
\twocolitem{{\bf EVT\_COMMAND\_LEFT\_CLICK(id, func)}}{Process a wxEVT\_COMMAND\_LEFT\_CLICK command,
which is generated by a control (Windows 95 and NT only).}
\twocolitem{{\bf EVT\_COMMAND\_LEFT\_DCLICK(id, func)}}{Process a wxEVT\_COMMAND\_LEFT\_DCLICK command,
which is generated by a control (Windows 95 and NT only).}
\twocolitem{{\bf EVT\_COMMAND\_RIGHT\_CLICK(id, func)}}{Process a wxEVT\_COMMAND\_RIGHT\_CLICK command,
which is generated by a control (Windows 95 and NT only).}
\twocolitem{{\bf EVT\_COMMAND\_SET\_FOCUS(id, func)}}{Process a wxEVT\_COMMAND\_SET\_FOCUS command,
which is generated by a control (Windows 95 and NT only).}
\twocolitem{{\bf EVT\_COMMAND\_KILL\_FOCUS(id, func)}}{Process a wxEVT\_COMMAND\_KILL\_FOCUS command,
which is generated by a control (Windows 95 and NT only).}
\twocolitem{{\bf EVT\_COMMAND\_ENTER(id, func)}}{Process a wxEVT\_COMMAND\_ENTER command,
which is generated by a control.}
\end{twocollist}%
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxCommandEvent::m\_clientData}
\member{char*}{m\_clientData}
Contains a pointer to client data for listboxes and choices, if the event
was a selection.
\membersection{wxCommandEvent::m\_commandInt}
\member{int}{m\_commandInt}
Contains an integer identifier corresponding to a listbox, choice or
radiobox selection (only if the event was a selection, not a
deselection), or a boolean value representing the value of a checkbox.
\membersection{wxCommandEvent::m\_commandString}
\member{char*}{m\_commandString}
Contains a string corresponding to a listbox or choice selection.
\membersection{wxCommandEvent::m\_extraLong}
\member{long}{m\_extraLong}
Extra information. If the event comes from a listbox selection, it is
a boolean determining whether the event was a selection (TRUE) or a
deselection (FALSE). A listbox deselection only occurs for
multiple-selection boxes, and in this case the index and string values
are indeterminate and the listbox must be examined by the application.
\membersection{wxCommandEvent::wxCommandEvent}
\func{}{wxCommandEvent}{\param{WXTYPE}{ commandEventType = 0}, \param{int}{ id = 0}}
Constructor.
\membersection{wxCommandEvent::Checked}
\func{bool}{Checked}{\void}
Returns TRUE or FALSE for a checkbox selection event.
\membersection{wxCommandEvent::GetClientData}
\func{char*}{GetClientData}{\void}
Returns client data pointer for a listbox or choice selection event
(not valid for a deselection).
\membersection{wxCommandEvent::GetExtraLong}
\func{long}{GetExtraLong}{\void}
Returns the {\bf m\_extraLong} member.
\membersection{wxCommandEvent::GetInt}
\func{int}{GetInt}{\void}
Returns the {\bf m\_commandInt} member.
\membersection{wxCommandEvent::GetSelection}
\func{int}{GetSelection}{\void}
Returns item index for a listbox or choice selection event (not valid for
a deselection).
\membersection{wxCommandEvent::GetString}
\func{char*}{GetString}{\void}
Returns item string for a listbox or choice selection event (not valid for
a deselection).
\membersection{wxCommandEvent::IsSelection}
\func{bool}{IsSelection}{\void}
For a listbox or choice event, returns TRUE if it is a selection, FALSE if it
is a deselection.
\membersection{wxCommandEvent::SetClientData}
\func{void}{SetClientData}{\param{char*}{ clientData}}
Sets the client data for this event.
\membersection{wxCommandEvent::SetExtraLong}
\func{void}{SetExtraLong}{\param{int}{ extraLong}}
Sets the {\bf m\_extraLong} member.
\membersection{wxCommandEvent::SetInt}
\func{void}{SetInt}{\param{int}{ intCommand}}
Sets the {\bf m\_commandInt} member.
\membersection{wxCommandEvent::SetString}
\func{void}{SetString}{\param{char*}{ string}}
Sets the {\bf m\_commandString} member.

106
docs/latex/wx/cmdproc.tex Normal file
View File

@@ -0,0 +1,106 @@
\section{\class{wxCommandProcessor}}\label{wxcommandprocessor}
wxCommandProcessor is a class that maintains a history of wxCommands,
with undo/redo functionality built-in. Derive a new class from this
if you want different behaviour.
\wxheading{Derived from}
\helpref{wxObject}{wxobject}
\wxheading{See also}
\helpref{wxCommandProcessor overview}{wxcommandprocessoroverview}, \helpref{wxCommand}{wxcommand}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxCommandProcessor::wxCommandProcessor}
\func{}{wxCommandProcessor}{\param{int}{ maxCommands = 100}}
Constructor.
{\it maxCommands} defaults to a rather arbitrary 100, but can be set from 1 to any integer.
If your wxCommand classes store a lot of data, you may wish the limit the number of
commands stored to a smaller number.
\membersection{wxCommandProcessor::\destruct{wxCommandProcessor}}
\func{}{\destruct{wxCommandProcessor}}{\void}
Destructor.
\membersection{wxCommandProcessor::CanUndo}
\func{virtual bool}{CanUndo}{\void}
Returns TRUE if the currently-active command can be undone, FALSE otherwise.
\membersection{wxCommandProcessor::ClearCommands}
\func{virtual void}{ClearCommands}{\void}
Deletes all the commands in the list and sets the current command pointer to NULL.
\membersection{wxCommandProcessor::Do}
\func{virtual bool}{Do}{\void}
Executes (redoes) the current command (the command that has just been undone if any).
\membersection{wxCommandProcessor::GetCommands}
\constfunc{wxList\&}{GetCommands}{\void}
Returns the list of commands.
\membersection{wxCommandProcessor::GetMaxCommands}
\constfunc{int}{GetMaxCommands}{\void}
Returns the maximum number of commands that the command processor stores.
\membersection{wxCommandProcessor::GetEditMenu}
\constfunc{wxMenu*}{GetEditMenu}{\void}
Returns the edit menu associated with the command processor.
\membersection{wxCommandProcessor::Initialize}
\func{virtual void}{Initialize}{\void}
Initializes the command processor, setting the current command to the
last in the list (if any), and updating the edit menu (if one has been
specified).
\membersection{wxCommandProcessor::SetEditMenu}
\func{void}{SetEditMenu}{\param{wxMenu* }{menu}}
Tells the command processor to update the Undo and Redo items on this
menu as appropriate. Set this to NULL if the menu is about to be
destroyed and command operations may still be performed, or the command
processor may try to access an invalid pointer.
\membersection{wxCommandProcessor::Submit}
\func{virtual bool}{Submit}{\param{wxCommand *}{command}, \param{bool}{ storeIt = TRUE}}
Submits a new command to the command processor. The command processor
calls wxCommand::Do to execute the command; if it succeeds, the command
is stored in the history list, and the associated edit menu (if any) updated
appropriately. If it fails, the command is deleted
immediately. Once Submit has been called, the passed command should not
be deleted directly by the application.
{\it storeIt} indicates whether the successful command should be stored
in the history list.
\membersection{wxCommandProcessor::Undo}
\func{virtual bool}{Undo}{\void}
Undoes the command just executed.

View File

@@ -0,0 +1,48 @@
\section{\class{wxColourDialog}}\label{wxcolourdialog}
This class represents the colour chooser dialog.
\wxheading{Derived from}
\helpref{wxDialog}{wxdialog}\\
\helpref{wxWindow}{wxwindow}\\
\helpref{wxEvtHandler}{wxevthandler}\\
\helpref{wxObject}{wxobject}
\wxheading{See also}
\helpref{wxColourDialog Overview}{wxcolourdialogoverview}, \helpref{wxColour}{wxcolour}, \helpref{wxColourData}{wxcolourdata}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxColourDialog::wxColourDialog}
\func{}{wxColourDialog}{\param{wxWindow* }{parent}, \param{wxColourData* }{data = NULL}}
Constructor. Pass a parent window, and optionally a pointer to a block of colour
data, which will be copied to the colour dialog's colour data.
\wxheading{See also}
\helpref{wxColourData}{wxcolourdata}
\membersection{wxColourDialog::\destruct{wxColourDialog}}
\func{}{\destruct{wxColourDialog}}{\void}
Destructor.
\membersection{wxColourDialog::GetColourData}
\func{wxColourData\&}{GetColourData}{\void}
Returns the \helpref{colour data}{wxcolourdata} associated with the colour dialog.
\membersection{wxColourDialog::ShowModal}
\func{int}{ShowModal}{\void}
Shows the dialog, returning wxID\_OK if the user pressed OK, and wxOK\_CANCEL
otherwise.

Some files were not shown because too many files have changed in this diff Show More