Updated Scintilla to 1.52
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20295 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -189,6 +189,7 @@
|
||||
#define wxSTC_FIND_MATCHCASE 4
|
||||
#define wxSTC_FIND_WORDSTART 0x00100000
|
||||
#define wxSTC_FIND_REGEXP 0x00200000
|
||||
#define wxSTC_FIND_POSIX 0x00400000
|
||||
#define wxSTC_FOLDLEVELBASE 0x400
|
||||
#define wxSTC_FOLDLEVELWHITEFLAG 0x1000
|
||||
#define wxSTC_FOLDLEVELHEADERFLAG 0x2000
|
||||
@@ -327,6 +328,7 @@
|
||||
#define wxSTC_LEX_FORTRAN 36
|
||||
#define wxSTC_LEX_F77 37
|
||||
#define wxSTC_LEX_CSS 38
|
||||
#define wxSTC_LEX_POV 39
|
||||
|
||||
// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
|
||||
// value assigned in sequence from SCLEX_AUTOMATIC+1.
|
||||
@@ -596,6 +598,8 @@
|
||||
#define wxSTC_ERR_DIFF_DELETION 12
|
||||
#define wxSTC_ERR_DIFF_MESSAGE 13
|
||||
#define wxSTC_ERR_PHP 14
|
||||
#define wxSTC_ERR_ELF 15
|
||||
#define wxSTC_ERR_IFC 16
|
||||
|
||||
// Lexical states for SCLEX_BATCH
|
||||
#define wxSTC_BAT_DEFAULT 0
|
||||
@@ -791,6 +795,21 @@
|
||||
#define wxSTC_CSS_ID 10
|
||||
#define wxSTC_CSS_IMPORTANT 11
|
||||
#define wxSTC_CSS_DIRECTIVE 12
|
||||
#define wxSTC_CSS_DOUBLESTRING 13
|
||||
#define wxSTC_CSS_SINGLESTRING 14
|
||||
|
||||
// Lexical states for SCLEX_POV
|
||||
#define wxSTC_POV_DEFAULT 0
|
||||
#define wxSTC_POV_COMMENT 1
|
||||
#define wxSTC_POV_COMMENTLINE 2
|
||||
#define wxSTC_POV_COMMENTDOC 3
|
||||
#define wxSTC_POV_NUMBER 4
|
||||
#define wxSTC_POV_WORD 5
|
||||
#define wxSTC_POV_STRING 6
|
||||
#define wxSTC_POV_OPERATOR 7
|
||||
#define wxSTC_POV_IDENTIFIER 8
|
||||
#define wxSTC_POV_BRACE 9
|
||||
#define wxSTC_POV_WORD2 10
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
@@ -972,6 +991,18 @@
|
||||
// caret position.
|
||||
#define wxSTC_CMD_LINEENDDISPLAYEXTEND 2348
|
||||
|
||||
// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)?
|
||||
// except they behave differently when word-wrap is enabled:
|
||||
// They go first to the start / end of the display line, like (Home|LineEnd)Display
|
||||
// The difference is that, the cursor is already at the point, it goes on to the start
|
||||
// or end of the document line, as appropriate for (Home|LineEnd|VCHome)Extend.
|
||||
#define wxSTC_CMD_HOMEWRAP 2349
|
||||
#define wxSTC_CMD_HOMEWRAPEXTEND 2450
|
||||
#define wxSTC_CMD_LINEENDWRAP 2451
|
||||
#define wxSTC_CMD_LINEENDWRAPEXTEND 2452
|
||||
#define wxSTC_CMD_VCHOMEWRAP 2453
|
||||
#define wxSTC_CMD_VCHOMEWRAPEXTEND 2454
|
||||
|
||||
// Move to the previous change in capitalisation.
|
||||
#define wxSTC_CMD_WORDPARTLEFT 2390
|
||||
|
||||
@@ -992,6 +1023,12 @@
|
||||
// Delete forwards from the current position to the end of the line.
|
||||
#define wxSTC_CMD_DELLINERIGHT 2396
|
||||
|
||||
// Move caret between paragraphs (delimited by empty lines)
|
||||
#define wxSTC_CMD_PARADOWN 2413
|
||||
#define wxSTC_CMD_PARADOWNEXTEND 2414
|
||||
#define wxSTC_CMD_PARAUP 2415
|
||||
#define wxSTC_CMD_PARAUPEXTEND 2416
|
||||
|
||||
|
||||
// END of generated section
|
||||
//----------------------------------------------------------------------
|
||||
@@ -1256,6 +1293,9 @@ public:
|
||||
// Set the character set of the font in a style.
|
||||
void StyleSetCharacterSet(int style, int characterSet);
|
||||
|
||||
// Set a style to be a hotspot or not.
|
||||
void StyleSetHotSpot(int style, bool hotspot);
|
||||
|
||||
// Set the foreground colour of the selection and whether to use this setting.
|
||||
void SetSelForeground(bool useSetting, const wxColour& fore);
|
||||
|
||||
@@ -1680,6 +1720,12 @@ public:
|
||||
// Set the background colour for the call tip.
|
||||
void CallTipSetBackground(const wxColour& back);
|
||||
|
||||
// Set the foreground colour for the call tip.
|
||||
void CallTipSetForeground(const wxColour& fore);
|
||||
|
||||
// Set the foreground colour for the highlighted part of the call tip.
|
||||
void CallTipSetForegroundHighlight(const wxColour& fore);
|
||||
|
||||
// Find the display line of a document line taking hidden lines into account.
|
||||
int VisibleFromDocLine(int line);
|
||||
|
||||
@@ -1807,7 +1853,6 @@ public:
|
||||
void TargetFromSelection();
|
||||
|
||||
// Join the lines in the target.
|
||||
// This is an experimental feature and may be changed or removed.
|
||||
void LinesJoin();
|
||||
|
||||
// Split the lines in the target into lines that are less wide than pixelWidth
|
||||
@@ -2002,6 +2047,15 @@ public:
|
||||
// Is printing line wrapped.
|
||||
int GetPrintWrapMode();
|
||||
|
||||
// Set a fore colour for active hotspots.
|
||||
void SetHotspotActiveForeground(bool useSetting, const wxColour& fore);
|
||||
|
||||
// Set a back colour for active hotspots.
|
||||
void SetHotspotActiveBackground(bool useSetting, const wxColour& back);
|
||||
|
||||
// Enable / Disable underlining active hotspots.
|
||||
void SetHotspotActiveUnderline(bool underline);
|
||||
|
||||
// Start notifying the container of all key presses and commands.
|
||||
void StartRecord();
|
||||
|
||||
@@ -2139,11 +2193,11 @@ private:
|
||||
void NotifyChange();
|
||||
void NotifyParent(SCNotification* scn);
|
||||
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_CLASS(wxStyledTextCtrl)
|
||||
|
||||
protected:
|
||||
|
||||
ScintillaWX* m_swx;
|
||||
wxStopWatch m_stopWatch;
|
||||
wxScrollBar* m_vScrollBar;
|
||||
@@ -2262,6 +2316,8 @@ private:
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifndef SWIG
|
||||
BEGIN_DECLARE_EVENT_TYPES()
|
||||
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CHANGE, 1650)
|
||||
@@ -2287,6 +2343,9 @@ BEGIN_DECLARE_EVENT_TYPES()
|
||||
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DRAG_OVER, 1670)
|
||||
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DO_DROP, 1671)
|
||||
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_ZOOM, 1672)
|
||||
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_HOTSPOT_CLICK, 1673)
|
||||
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_HOTSPOT_DCLICK, 1674)
|
||||
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CALLTIP_CLICK, 1675)
|
||||
END_DECLARE_EVENT_TYPES()
|
||||
#else
|
||||
enum {
|
||||
@@ -2313,6 +2372,9 @@ END_DECLARE_EVENT_TYPES()
|
||||
wxEVT_STC_DRAG_OVER,
|
||||
wxEVT_STC_DO_DROP,
|
||||
wxEVT_STC_ZOOM,
|
||||
wxEVT_STC_HOTSPOT_CLICK,
|
||||
wxEVT_STC_HOTSPOT_DCLICK,
|
||||
wxEVT_STC_CALLTIP_CLICK
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -2344,6 +2406,10 @@ typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&);
|
||||
#define EVT_STC_DRAG_OVER(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DRAG_OVER, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
|
||||
#define EVT_STC_DO_DROP(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DO_DROP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
|
||||
#define EVT_STC_ZOOM(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ZOOM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
|
||||
#define EVT_STC_HOTSPOT_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
|
||||
#define EVT_STC_HOTSPOT_DCLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_DCLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
|
||||
#define EVT_STC_CALLTIP_CLICK(id, fn)) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CALLTIP_CLICK id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
|
||||
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@@ -40,7 +40,26 @@ public:
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Make an editor class
|
||||
|
||||
class MySTC : public wxStyledTextCtrl
|
||||
{
|
||||
public:
|
||||
MySTC(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0);
|
||||
|
||||
void OnKeyPressed(wxKeyEvent& evt);
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
BEGIN_EVENT_TABLE(MySTC, wxStyledTextCtrl)
|
||||
EVT_KEY_DOWN(MySTC::OnKeyPressed)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Define a new frame type: this is going to be our main frame
|
||||
class MyFrame : public wxFrame
|
||||
{
|
||||
@@ -51,7 +70,7 @@ public:
|
||||
void OnAbout(wxCommandEvent& event);
|
||||
|
||||
private:
|
||||
wxStyledTextCtrl* ed;
|
||||
MySTC* ed;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
@@ -79,7 +98,7 @@ IMPLEMENT_APP(MyApp)
|
||||
bool MyApp::OnInit()
|
||||
{
|
||||
MyFrame *frame = new MyFrame(_T("Testing wxStyledTextCtrl"),
|
||||
wxPoint(5, 5), wxSize(400, 600));
|
||||
wxPoint(5, 5), wxSize(600, 600));
|
||||
|
||||
frame->Show(TRUE);
|
||||
return TRUE;
|
||||
@@ -123,59 +142,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
|
||||
//----------------------------------------
|
||||
// Setup the editor
|
||||
ed = new wxStyledTextCtrl(this, ID_ED);
|
||||
|
||||
// Default font
|
||||
wxFont font(10, wxMODERN, wxNORMAL, wxNORMAL);
|
||||
ed->StyleSetFont(wxSTC_STYLE_DEFAULT, font);
|
||||
ed->StyleClearAll();
|
||||
|
||||
ed->StyleSetForeground(0, wxColour(0x80, 0x80, 0x80));
|
||||
ed->StyleSetForeground(1, wxColour(0x00, 0x7f, 0x00));
|
||||
//ed->StyleSetForeground(2, wxColour(0x00, 0x7f, 0x00));
|
||||
ed->StyleSetForeground(3, wxColour(0x7f, 0x7f, 0x7f));
|
||||
ed->StyleSetForeground(4, wxColour(0x00, 0x7f, 0x7f));
|
||||
ed->StyleSetForeground(5, wxColour(0x00, 0x00, 0x7f));
|
||||
ed->StyleSetForeground(6, wxColour(0x7f, 0x00, 0x7f));
|
||||
ed->StyleSetForeground(7, wxColour(0x7f, 0x00, 0x7f));
|
||||
ed->StyleSetForeground(8, wxColour(0x00, 0x7f, 0x7f));
|
||||
ed->StyleSetForeground(9, wxColour(0x7f, 0x7f, 0x7f));
|
||||
ed->StyleSetForeground(10, wxColour(0x00, 0x00, 0x00));
|
||||
ed->StyleSetForeground(11, wxColour(0x00, 0x00, 0x00));
|
||||
ed->StyleSetBold(5, TRUE);
|
||||
ed->StyleSetBold(10, TRUE);
|
||||
|
||||
#ifdef __WXMSW__
|
||||
ed->StyleSetSpec(2, _T("fore:#007f00,bold,face:Arial,size:9"));
|
||||
#else
|
||||
ed->StyleSetSpec(2, _T("fore:#007f00,bold,face:Helvetica,size:9"));
|
||||
#endif
|
||||
|
||||
// give it some text to play with
|
||||
wxString st;
|
||||
wxFileInputStream stream(wxT("stctest.cpp"));
|
||||
size_t sz = stream.GetSize();
|
||||
char* buf = new char[sz + 1];
|
||||
stream.Read((void*) buf, stream.GetSize());
|
||||
buf[sz] = 0;
|
||||
st = wxString::FromAscii(buf);
|
||||
delete[] buf;
|
||||
|
||||
ed->InsertText(0, st);
|
||||
ed->EmptyUndoBuffer();
|
||||
|
||||
ed->SetLexer(wxSTC_LEX_CPP);
|
||||
ed->SetKeyWords(0,
|
||||
_T("asm auto bool break case catch char class const \
|
||||
const_cast continue default delete do double \
|
||||
dynamic_cast else enum explicit export extern \
|
||||
false float for friend goto if inline int long \
|
||||
mutable namespace new operator private protected \
|
||||
public register reinterpret_cast return short signed \
|
||||
sizeof static static_cast struct switch template this \
|
||||
throw true try typedef typeid typename union unsigned \
|
||||
using virtual void volatile wchar_t while"));
|
||||
|
||||
ed = new MySTC(this, ID_ED);
|
||||
}
|
||||
|
||||
|
||||
@@ -194,3 +161,94 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
wxMessageBox(msg, _T("About This Test"), wxOK | wxICON_INFORMATION, this);
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
wxChar* keywords =
|
||||
_T("asm auto bool break case catch char class const \
|
||||
const_cast continue default delete do double \
|
||||
dynamic_cast else enum explicit export extern \
|
||||
false float for friend goto if inline int long \
|
||||
mutable namespace new operator private protected \
|
||||
public register reinterpret_cast return short signed \
|
||||
sizeof static static_cast struct switch template this \
|
||||
throw true try typedef typeid typename union unsigned \
|
||||
using virtual void volatile wchar_t while");
|
||||
|
||||
|
||||
|
||||
MySTC::MySTC(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
long style)
|
||||
: wxStyledTextCtrl(parent, id, pos, size, style)
|
||||
{
|
||||
// Default font
|
||||
wxFont font(10, wxMODERN, wxNORMAL, wxNORMAL);
|
||||
StyleSetFont(wxSTC_STYLE_DEFAULT, font);
|
||||
StyleClearAll();
|
||||
|
||||
StyleSetForeground(0, wxColour(0x80, 0x80, 0x80));
|
||||
StyleSetForeground(1, wxColour(0x00, 0x7f, 0x00));
|
||||
//StyleSetForeground(2, wxColour(0x00, 0x7f, 0x00));
|
||||
StyleSetForeground(3, wxColour(0x7f, 0x7f, 0x7f));
|
||||
StyleSetForeground(4, wxColour(0x00, 0x7f, 0x7f));
|
||||
StyleSetForeground(5, wxColour(0x00, 0x00, 0x7f));
|
||||
StyleSetForeground(6, wxColour(0x7f, 0x00, 0x7f));
|
||||
StyleSetForeground(7, wxColour(0x7f, 0x00, 0x7f));
|
||||
StyleSetForeground(8, wxColour(0x00, 0x7f, 0x7f));
|
||||
StyleSetForeground(9, wxColour(0x7f, 0x7f, 0x7f));
|
||||
StyleSetForeground(10, wxColour(0x00, 0x00, 0x00));
|
||||
StyleSetForeground(11, wxColour(0x00, 0x00, 0x00));
|
||||
StyleSetBold(5, TRUE);
|
||||
StyleSetBold(10, TRUE);
|
||||
|
||||
#ifdef __WXMSW__
|
||||
StyleSetSpec(2, _T("fore:#007f00,bold,face:Arial,size:9"));
|
||||
#else
|
||||
StyleSetSpec(2, _T("fore:#007f00,bold,face:Helvetica,size:9"));
|
||||
#endif
|
||||
|
||||
// give it some text to play with
|
||||
wxString st;
|
||||
wxFileInputStream stream(wxT("stctest.cpp"));
|
||||
size_t sz = stream.GetSize();
|
||||
char* buf = new char[sz + 1];
|
||||
stream.Read((void*) buf, stream.GetSize());
|
||||
buf[sz] = 0;
|
||||
st = wxString::FromAscii(buf);
|
||||
delete[] buf;
|
||||
|
||||
InsertText(0, st);
|
||||
EmptyUndoBuffer();
|
||||
|
||||
SetLexer(wxSTC_LEX_CPP);
|
||||
SetKeyWords(0, keywords);
|
||||
}
|
||||
|
||||
void MySTC::OnKeyPressed(wxKeyEvent& evt)
|
||||
{
|
||||
if (CallTipActive())
|
||||
CallTipCancel();
|
||||
|
||||
int key = evt.GetKeyCode();
|
||||
if ( key == WXK_SPACE && evt.ControlDown()) {
|
||||
int pos = GetCurrentPos();
|
||||
|
||||
if (evt.ShiftDown()) {
|
||||
// show how to do CallTips
|
||||
CallTipSetBackground(wxColour(_T("YELLOW")));
|
||||
CallTipShow(pos, _T("lots of of text: blah, blah, blah\n\n"
|
||||
"show some suff, maybe parameters..\n\n"
|
||||
"fubar(param1, param2)"));
|
||||
}
|
||||
else {
|
||||
// show how to do AutoComplete
|
||||
AutoCompSetIgnoreCase(false);
|
||||
AutoCompShow(0, keywords); // reuse the keyword list here
|
||||
// normally you would build a string of completion texts...
|
||||
}
|
||||
}
|
||||
else
|
||||
evt.Skip();
|
||||
}
|
||||
|
@@ -49,6 +49,7 @@ OBJECTS=PlatWX.o ScintillaWX.o stc.o \
|
||||
LexLisp.o \
|
||||
LexLua.o \
|
||||
LexOthers.o \
|
||||
LexPOV.o \
|
||||
LexPascal.o \
|
||||
LexPerl.o \
|
||||
LexPython.o \
|
||||
|
@@ -216,9 +216,9 @@ public:
|
||||
SurfaceImpl();
|
||||
~SurfaceImpl();
|
||||
|
||||
virtual void Init();
|
||||
virtual void Init(SurfaceID sid);
|
||||
virtual void InitPixMap(int width, int height, Surface *surface_);
|
||||
virtual void Init(WindowID wid);
|
||||
virtual void Init(SurfaceID sid, WindowID wid);
|
||||
virtual void InitPixMap(int width, int height, Surface *surface_, WindowID wid);
|
||||
|
||||
virtual void Release();
|
||||
virtual bool Initialised();
|
||||
@@ -270,7 +270,7 @@ SurfaceImpl::~SurfaceImpl() {
|
||||
Release();
|
||||
}
|
||||
|
||||
void SurfaceImpl::Init() {
|
||||
void SurfaceImpl::Init(WindowID wid) {
|
||||
#if 0
|
||||
Release();
|
||||
hdc = new wxMemoryDC();
|
||||
@@ -279,16 +279,16 @@ void SurfaceImpl::Init() {
|
||||
// On Mac and GTK the DC is not really valid until it has a bitmap
|
||||
// selected into it. So instead of just creating the DC with no bitmap,
|
||||
// go ahead and give it one.
|
||||
InitPixMap(1,1,NULL);
|
||||
InitPixMap(1,1,NULL,wid);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SurfaceImpl::Init(SurfaceID hdc_) {
|
||||
void SurfaceImpl::Init(SurfaceID hdc_, WindowID) {
|
||||
Release();
|
||||
hdc = (wxDC*)hdc_;
|
||||
}
|
||||
|
||||
void SurfaceImpl::InitPixMap(int width, int height, Surface *surface_) {
|
||||
void SurfaceImpl::InitPixMap(int width, int height, Surface *surface_, WindowID) {
|
||||
Release();
|
||||
hdc = new wxMemoryDC();
|
||||
hdcOwned = true;
|
||||
@@ -615,6 +615,7 @@ bool Window::HasFocus() {
|
||||
}
|
||||
|
||||
PRectangle Window::GetPosition() {
|
||||
if (! id) return PRectangle();
|
||||
wxRect rc(GETWIN(id)->GetPosition(), GETWIN(id)->GetSize());
|
||||
return PRectangleFromwxRect(rc);
|
||||
}
|
||||
@@ -629,6 +630,7 @@ void Window::SetPositionRelative(PRectangle rc, Window) {
|
||||
}
|
||||
|
||||
PRectangle Window::GetClientPosition() {
|
||||
if (! id) return PRectangle();
|
||||
wxSize sz = GETWIN(id)->GetClientSize();
|
||||
return PRectangle(0, 0, sz.x, sz.y);
|
||||
}
|
||||
@@ -677,6 +679,8 @@ void Window::SetCursor(Cursor curs) {
|
||||
case cursorReverseArrow:
|
||||
cursorId = wxCURSOR_RIGHT_ARROW;
|
||||
break;
|
||||
case cursorHand:
|
||||
cursorId = wxCURSOR_HAND;
|
||||
default:
|
||||
cursorId = wxCURSOR_ARROW;
|
||||
break;
|
||||
@@ -736,7 +740,7 @@ public:
|
||||
wxWindow(parent, id, wxDefaultPosition, wxSize(0,0), wxNO_BORDER )
|
||||
{
|
||||
|
||||
SetBackgroundColour(*wxBLUE);
|
||||
SetBackgroundColour(*wxBLACK);
|
||||
lv = new wxSTCListBox(this, id, wxDefaultPosition, wxDefaultSize,
|
||||
wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_NO_HEADER | wxNO_BORDER);
|
||||
lv->SetCursor(wxCursor(wxCURSOR_ARROW));
|
||||
@@ -768,9 +772,10 @@ public:
|
||||
}
|
||||
|
||||
void OnSize(wxSizeEvent& event) {
|
||||
// reset the column widths
|
||||
// resize the child, leaving a 1 pixel border
|
||||
wxSize sz = GetClientSize();
|
||||
lv->SetSize(1, 1, sz.x-2, sz.y-2);
|
||||
// reset the column widths
|
||||
lv->SetColumnWidth(0, IconWidth()+4);
|
||||
lv->SetColumnWidth(1, sz.x - 2 - lv->GetColumnWidth(0) -
|
||||
wxSystemSettings::GetMetric(wxSYS_VSCROLL_X));
|
||||
@@ -1090,6 +1095,9 @@ unsigned int Platform::DoubleClickTime() {
|
||||
return 500; // **** ::GetDoubleClickTime();
|
||||
}
|
||||
|
||||
bool Platform::MouseButtonBounce() {
|
||||
return FALSE;
|
||||
}
|
||||
void Platform::DebugDisplay(const char *s) {
|
||||
wxLogDebug(stc2wx(s));
|
||||
}
|
||||
|
@@ -72,21 +72,23 @@ void wxSTCDropTarget::OnLeave() {
|
||||
|
||||
class wxSTCCallTip : public wxSTCCallTipBase {
|
||||
public:
|
||||
wxSTCCallTip(wxWindow* parent, CallTip* ct)
|
||||
: wxSTCCallTipBase(parent, param2)
|
||||
wxSTCCallTip(wxWindow* parent, CallTip* ct, ScintillaWX* swx)
|
||||
: wxSTCCallTipBase(parent, param2),
|
||||
m_ct(ct), m_swx(swx)
|
||||
{
|
||||
m_ct = ct;
|
||||
}
|
||||
|
||||
~wxSTCCallTip() {
|
||||
if (HasCapture()) ReleaseMouse();
|
||||
}
|
||||
|
||||
bool AcceptsFocus() const { return FALSE; }
|
||||
|
||||
void OnPaint(wxPaintEvent& evt) {
|
||||
wxPaintDC dc(this);
|
||||
Surface* surfaceWindow = Surface::Allocate();
|
||||
surfaceWindow->Init(&dc);
|
||||
surfaceWindow->Init(&dc, m_ct->wDraw.GetID());
|
||||
m_ct->PaintCT(surfaceWindow);
|
||||
surfaceWindow->Release();
|
||||
delete surfaceWindow;
|
||||
}
|
||||
|
||||
@@ -95,6 +97,13 @@ public:
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void OnLeftDown(wxMouseEvent& event) {
|
||||
wxPoint pt = event.GetPosition();
|
||||
Point p(pt.x, pt.y);
|
||||
m_ct->MouseClick(p);
|
||||
m_swx->CallTipClick();
|
||||
}
|
||||
|
||||
#if wxUSE_POPUPWIN && wxSTC_USE_POPUP
|
||||
virtual void DoSetSize(int x, int y,
|
||||
int width, int height,
|
||||
@@ -105,32 +114,18 @@ public:
|
||||
GetParent()->ClientToScreen(NULL, &y);
|
||||
wxSTCCallTipBase::DoSetSize(x, y, width, height, sizeFlags);
|
||||
}
|
||||
|
||||
virtual bool Show( bool show = TRUE ) {
|
||||
bool retval = wxSTCCallTipBase::Show(show);
|
||||
if (show)
|
||||
CaptureMouse();
|
||||
else
|
||||
if (HasCapture()) ReleaseMouse();
|
||||
return retval;
|
||||
}
|
||||
|
||||
void OnLeftDown(wxMouseEvent& ) {
|
||||
Show(FALSE);
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
CallTip* m_ct;
|
||||
CallTip* m_ct;
|
||||
ScintillaWX* m_swx;
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
BEGIN_EVENT_TABLE(wxSTCCallTip, wxSTCCallTipBase)
|
||||
EVT_PAINT(wxSTCCallTip::OnPaint)
|
||||
EVT_SET_FOCUS(wxSTCCallTip::OnFocus)
|
||||
#if wxUSE_POPUPWIN && wxSTC_USE_POPUP
|
||||
EVT_LEFT_DOWN(wxSTCCallTip::OnLeftDown)
|
||||
#endif
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
@@ -389,8 +384,10 @@ bool ScintillaWX::CanPaste() {
|
||||
}
|
||||
|
||||
void ScintillaWX::CreateCallTipWindow(PRectangle) {
|
||||
ct.wCallTip = new wxSTCCallTip(stc, &ct);
|
||||
ct.wDraw = ct.wCallTip;
|
||||
if (! ct.wCallTip.Created() ) {
|
||||
ct.wCallTip = new wxSTCCallTip(stc, &ct, this);
|
||||
ct.wDraw = ct.wCallTip;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -441,32 +438,32 @@ long ScintillaWX::WndProc(unsigned int iMessage, unsigned long wParam, long lPar
|
||||
// because of the little tweak that needs done below for wxGTK.
|
||||
// When updating new versions double check that this is still
|
||||
// needed, and that any new code there is copied here too.
|
||||
Point pt = LocationFromPosition(wParam);
|
||||
char* defn = reinterpret_cast<char *>(lParam);
|
||||
AutoCompleteCancel();
|
||||
if (!ct.wCallTip.Created()) {
|
||||
Point pt = LocationFromPosition(wParam);
|
||||
pt.y += vs.lineHeight;
|
||||
PRectangle rc = ct.CallTipStart(currentPos, pt,
|
||||
reinterpret_cast<char *>(lParam),
|
||||
vs.styles[STYLE_DEFAULT].fontName,
|
||||
vs.styles[STYLE_DEFAULT].sizeZoomed,
|
||||
IsUnicodeMode());
|
||||
// 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) {
|
||||
pt.y += vs.lineHeight;
|
||||
PRectangle rc = ct.CallTipStart(currentPos, pt,
|
||||
defn,
|
||||
vs.styles[STYLE_DEFAULT].fontName,
|
||||
vs.styles[STYLE_DEFAULT].sizeZoomed,
|
||||
IsUnicodeMode(),
|
||||
wMain);
|
||||
// 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) {
|
||||
#ifdef __WXGTK__
|
||||
int offset = int(vs.lineHeight * 1.25) + rc.Height();
|
||||
int offset = int(vs.lineHeight * 1.25) + rc.Height();
|
||||
#else
|
||||
int offset = vs.lineHeight + rc.Height();
|
||||
int offset = vs.lineHeight + rc.Height();
|
||||
#endif
|
||||
rc.top -= offset;
|
||||
rc.bottom -= offset;
|
||||
}
|
||||
// Now display the window.
|
||||
CreateCallTipWindow(rc);
|
||||
ct.wCallTip.SetPositionRelative(rc, wMain);
|
||||
ct.wCallTip.Show();
|
||||
rc.top -= offset;
|
||||
rc.bottom -= offset;
|
||||
}
|
||||
// Now display the window.
|
||||
CreateCallTipWindow(rc);
|
||||
ct.wCallTip.SetPositionRelative(rc, wMain);
|
||||
ct.wCallTip.Show();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -485,7 +482,7 @@ void ScintillaWX::DoPaint(wxDC* dc, wxRect rect) {
|
||||
|
||||
paintState = painting;
|
||||
Surface* surfaceWindow = Surface::Allocate();
|
||||
surfaceWindow->Init(dc);
|
||||
surfaceWindow->Init(dc, wMain.GetID());
|
||||
rcPaint = PRectangleFromwxRect(rect);
|
||||
PRectangle rcClient = GetClientRectangle();
|
||||
paintingAllText = rcPaint.Contains(rcClient);
|
||||
@@ -781,7 +778,7 @@ void ScintillaWX::FullPaint() {
|
||||
paintingAllText = true;
|
||||
wxClientDC dc(stc);
|
||||
Surface* surfaceWindow = Surface::Allocate();
|
||||
surfaceWindow->Init(&dc);
|
||||
surfaceWindow->Init(&dc, wMain.GetID());
|
||||
|
||||
dc.BeginDrawing();
|
||||
ClipChildren(dc, rcPaint);
|
||||
|
@@ -161,6 +161,9 @@ private:
|
||||
wxDragResult dragResult;
|
||||
#endif
|
||||
int wheelRotation;
|
||||
|
||||
|
||||
friend class wxSTCCallTip;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@@ -342,6 +342,10 @@ SOURCE=.\scintilla\src\LexOthers.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\scintilla\src\LexPOV.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\scintilla\src\LexPascal.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@@ -43,6 +43,8 @@ cmdValues = [ (2300, 2349),
|
||||
(2390, 2393),
|
||||
(2395, 2396),
|
||||
2404,
|
||||
(2413, 2416),
|
||||
(2450, 2454),
|
||||
]
|
||||
|
||||
|
||||
@@ -453,9 +455,14 @@ methodOverrideMap = {
|
||||
'GetDirectFunction' : (None, 0, 0, 0),
|
||||
'GetDirectPointer' : (None, 0, 0, 0),
|
||||
|
||||
'CallTipPosStart' : ('CallTipPosAtStart', 0, 0, 0),
|
||||
'CallTipSetHlt' : ('CallTipSetHighlight', 0, 0, 0),
|
||||
'CallTipSetBack' : ('CallTipSetBackground', 0, 0, 0),
|
||||
'CallTipPosStart' : ('CallTipPosAtStart', 0, 0, 0),
|
||||
'CallTipSetHlt' : ('CallTipSetHighlight', 0, 0, 0),
|
||||
'CallTipSetBack' : ('CallTipSetBackground', 0, 0, 0),
|
||||
'CallTipSetFore' : ('CallTipSetForeground', 0, 0, 0),
|
||||
'CallTipSetForeHlt' : ('CallTipSetForegroundHighlight', 0, 0, 0),
|
||||
|
||||
'SetHotspotActiveFore' : ('SetHotspotActiveForeground', 0, 0, 0),
|
||||
'SetHotspotActiveBack' : ('SetHotspotActiveBackground', 0, 0, 0),
|
||||
|
||||
|
||||
'ReplaceTarget' :
|
||||
@@ -544,6 +551,9 @@ methodOverrideMap = {
|
||||
'GetFocus' : ('GetSTCFocus', 0, 0, 0),
|
||||
|
||||
|
||||
'LoadLexerLibrary' : (None, 0,0,0),
|
||||
|
||||
|
||||
|
||||
# Remove all methods that are key commands since they can be
|
||||
# executed with CmdKeyExecute
|
||||
@@ -592,7 +602,16 @@ methodOverrideMap = {
|
||||
'LineScrollDown' : (None, 0, 0, 0),
|
||||
'LineScrollUp' : (None, 0, 0, 0),
|
||||
'DeleteBackNotLine' : (None, 0, 0, 0),
|
||||
|
||||
'HomeWrap' : (None, 0, 0, 0),
|
||||
'HomeWrapExtend' : (None, 0, 0, 0),
|
||||
'LineEndWrap' : (None, 0, 0, 0),
|
||||
'LineEndWrapExtend' : (None, 0, 0, 0),
|
||||
'VCHomeWrap' : (None, 0, 0, 0),
|
||||
'VCHomeWrapExtend' : (None, 0, 0, 0),
|
||||
'ParaDown' : (None, 0, 0, 0),
|
||||
'ParaDownExtend' : (None, 0, 0, 0),
|
||||
'ParaUp' : (None, 0, 0, 0),
|
||||
'ParaUpExtend' : (None, 0, 0, 0),
|
||||
|
||||
|
||||
|
||||
|
@@ -48,6 +48,7 @@ OBJECTS = \
|
||||
LexLisp.obj \
|
||||
LexLua.obj \
|
||||
LexOthers.obj \
|
||||
LexPOV.obj \
|
||||
LexPascal.obj \
|
||||
LexPerl.obj \
|
||||
LexPython.obj \
|
||||
|
@@ -36,6 +36,7 @@ OBJECTS = \
|
||||
$(S)/LexLisp.$(OBJSUFF) \
|
||||
$(S)/LexLua.$(OBJSUFF) \
|
||||
$(S)/LexOthers.$(OBJSUFF) \
|
||||
$(S)/LexPOV.$(OBJSUFF) \
|
||||
$(S)/LexPascal.$(OBJSUFF) \
|
||||
$(S)/LexPerl.$(OBJSUFF) \
|
||||
$(S)/LexPython.$(OBJSUFF) \
|
||||
|
@@ -41,6 +41,7 @@ OBJECTS = \
|
||||
$(D)\LexLisp.obj \
|
||||
$(D)\LexLua.obj \
|
||||
$(D)\LexOthers.obj \
|
||||
$(D)\LexPOV.obj \
|
||||
$(D)\LexPascal.obj \
|
||||
$(D)\LexPerl.obj \
|
||||
$(D)\LexPython.obj \
|
||||
|
@@ -45,6 +45,7 @@ OBJECTS = &
|
||||
LexLisp.obj &
|
||||
LexLua.obj &
|
||||
LexOthers.obj &
|
||||
LexPOV.obj &
|
||||
LexPascal.obj &
|
||||
LexPerl.obj &
|
||||
LexPython.obj &
|
||||
|
20
contrib/src/stc/scintilla/License.txt
Normal file
20
contrib/src/stc/scintilla/License.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
License for Scintilla and SciTE
|
||||
|
||||
Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation.
|
||||
|
||||
NEIL HODGSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS, IN NO EVENT SHALL NEIL HODGSON BE LIABLE FOR ANY
|
||||
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
|
||||
OR PERFORMANCE OF THIS SOFTWARE.
|
@@ -3,4 +3,4 @@ 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 1.51
|
||||
The current version of the Scintilla code is 1.52
|
||||
|
@@ -109,6 +109,12 @@ public:
|
||||
return (right > other.left) && (left < other.right) &&
|
||||
(bottom > other.top) && (top < other.bottom);
|
||||
}
|
||||
void Move(int xDelta, int yDelta) {
|
||||
left += xDelta;
|
||||
top += yDelta;
|
||||
right += xDelta;
|
||||
bottom += yDelta;
|
||||
}
|
||||
int Width() { return right - left; }
|
||||
int Height() { return bottom - top; }
|
||||
};
|
||||
@@ -299,9 +305,9 @@ public:
|
||||
virtual ~Surface() {};
|
||||
static Surface *Allocate();
|
||||
|
||||
virtual void Init()=0;
|
||||
virtual void Init(SurfaceID sid)=0;
|
||||
virtual void InitPixMap(int width, int height, Surface *surface_)=0;
|
||||
virtual void Init(WindowID wid)=0;
|
||||
virtual void Init(SurfaceID sid, WindowID wid)=0;
|
||||
virtual void InitPixMap(int width, int height, Surface *surface_, WindowID wid)=0;
|
||||
|
||||
virtual void Release()=0;
|
||||
virtual bool Initialised()=0;
|
||||
@@ -371,7 +377,7 @@ public:
|
||||
void InvalidateAll();
|
||||
void InvalidateRectangle(PRectangle rc);
|
||||
virtual void SetFont(Font &font);
|
||||
enum Cursor { cursorInvalid, cursorText, cursorArrow, cursorUp, cursorWait, cursorHoriz, cursorVert, cursorReverseArrow };
|
||||
enum Cursor { cursorInvalid, cursorText, cursorArrow, cursorUp, cursorWait, cursorHoriz, cursorVert, cursorReverseArrow, cursorHand };
|
||||
void SetCursor(Cursor curs);
|
||||
void SetTitle(const char *s);
|
||||
private:
|
||||
@@ -446,6 +452,7 @@ public:
|
||||
static const char *DefaultFont();
|
||||
static int DefaultFontSize();
|
||||
static unsigned int DoubleClickTime();
|
||||
static bool MouseButtonBounce();
|
||||
static void DebugDisplay(const char *s);
|
||||
static bool IsKeyDown(int key);
|
||||
static long SendScintilla(
|
||||
|
@@ -53,6 +53,7 @@
|
||||
#define SCLEX_FORTRAN 36
|
||||
#define SCLEX_F77 37
|
||||
#define SCLEX_CSS 38
|
||||
#define SCLEX_POV 39
|
||||
#define SCLEX_AUTOMATIC 1000
|
||||
#define SCE_P_DEFAULT 0
|
||||
#define SCE_P_COMMENTLINE 1
|
||||
@@ -279,6 +280,8 @@
|
||||
#define SCE_ERR_DIFF_DELETION 12
|
||||
#define SCE_ERR_DIFF_MESSAGE 13
|
||||
#define SCE_ERR_PHP 14
|
||||
#define SCE_ERR_ELF 15
|
||||
#define SCE_ERR_IFC 16
|
||||
#define SCE_BAT_DEFAULT 0
|
||||
#define SCE_BAT_COMMENT 1
|
||||
#define SCE_BAT_WORD 2
|
||||
@@ -444,6 +447,19 @@
|
||||
#define SCE_CSS_ID 10
|
||||
#define SCE_CSS_IMPORTANT 11
|
||||
#define SCE_CSS_DIRECTIVE 12
|
||||
#define SCE_CSS_DOUBLESTRING 13
|
||||
#define SCE_CSS_SINGLESTRING 14
|
||||
#define SCE_POV_DEFAULT 0
|
||||
#define SCE_POV_COMMENT 1
|
||||
#define SCE_POV_COMMENTLINE 2
|
||||
#define SCE_POV_COMMENTDOC 3
|
||||
#define SCE_POV_NUMBER 4
|
||||
#define SCE_POV_WORD 5
|
||||
#define SCE_POV_STRING 6
|
||||
#define SCE_POV_OPERATOR 7
|
||||
#define SCE_POV_IDENTIFIER 8
|
||||
#define SCE_POV_BRACE 9
|
||||
#define SCE_POV_WORD2 10
|
||||
//--Autogenerated -- end of section automatically generated from Scintilla.iface
|
||||
|
||||
#endif
|
||||
|
@@ -184,6 +184,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define SC_CASE_LOWER 2
|
||||
#define SCI_STYLESETCASE 2060
|
||||
#define SCI_STYLESETCHARACTERSET 2066
|
||||
#define SCI_STYLESETHOTSPOT 2409
|
||||
#define SCI_SETSELFORE 2067
|
||||
#define SCI_SETSELBACK 2068
|
||||
#define SCI_SETCARETFORE 2069
|
||||
@@ -285,6 +286,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define SCFIND_MATCHCASE 4
|
||||
#define SCFIND_WORDSTART 0x00100000
|
||||
#define SCFIND_REGEXP 0x00200000
|
||||
#define SCFIND_POSIX 0x00400000
|
||||
#define SCI_FINDTEXT 2150
|
||||
#define SCI_FORMATRANGE 2151
|
||||
#define SCI_GETFIRSTVISIBLELINE 2152
|
||||
@@ -340,6 +342,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define SCI_CALLTIPPOSSTART 2203
|
||||
#define SCI_CALLTIPSETHLT 2204
|
||||
#define SCI_CALLTIPSETBACK 2205
|
||||
#define SCI_CALLTIPSETFORE 2206
|
||||
#define SCI_CALLTIPSETFOREHLT 2207
|
||||
#define SCI_VISIBLEFROMDOCLINE 2220
|
||||
#define SCI_DOCLINEFROMVISIBLE 2221
|
||||
#define SC_FOLDLEVELBASE 0x400
|
||||
@@ -454,6 +458,12 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define SCI_HOMEDISPLAYEXTEND 2346
|
||||
#define SCI_LINEENDDISPLAY 2347
|
||||
#define SCI_LINEENDDISPLAYEXTEND 2348
|
||||
#define SCI_HOMEWRAP 2349
|
||||
#define SCI_HOMEWRAPEXTEND 2450
|
||||
#define SCI_LINEENDWRAP 2451
|
||||
#define SCI_LINEENDWRAPEXTEND 2452
|
||||
#define SCI_VCHOMEWRAP 2453
|
||||
#define SCI_VCHOMEWRAPEXTEND 2454
|
||||
#define SCI_MOVECARETINSIDEVIEW 2401
|
||||
#define SCI_LINELENGTH 2350
|
||||
#define SCI_BRACEHIGHLIGHT 2351
|
||||
@@ -518,6 +528,13 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define SCI_SETYCARETPOLICY 2403
|
||||
#define SCI_SETPRINTWRAPMODE 2406
|
||||
#define SCI_GETPRINTWRAPMODE 2407
|
||||
#define SCI_SETHOTSPOTACTIVEFORE 2410
|
||||
#define SCI_SETHOTSPOTACTIVEBACK 2411
|
||||
#define SCI_SETHOTSPOTACTIVEUNDERLINE 2412
|
||||
#define SCI_PARADOWN 2413
|
||||
#define SCI_PARADOWNEXTEND 2414
|
||||
#define SCI_PARAUP 2415
|
||||
#define SCI_PARAUPEXTEND 2416
|
||||
#define SCI_STARTRECORD 3001
|
||||
#define SCI_STOPRECORD 3002
|
||||
#define SCI_SETLEXER 4001
|
||||
@@ -526,6 +543,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define SCI_SETPROPERTY 4004
|
||||
#define SCI_SETKEYWORDS 4005
|
||||
#define SCI_SETLEXERLANGUAGE 4006
|
||||
#define SCI_LOADLEXERLIBRARY 4007
|
||||
#define SC_MOD_INSERTTEXT 0x1
|
||||
#define SC_MOD_DELETETEXT 0x2
|
||||
#define SC_MOD_CHANGESTYLE 0x4
|
||||
@@ -579,6 +597,9 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define SCN_DWELLSTART 2016
|
||||
#define SCN_DWELLEND 2017
|
||||
#define SCN_ZOOM 2018
|
||||
#define SCN_HOTSPOTCLICK 2019
|
||||
#define SCN_HOTSPOTDOUBLECLICK 2020
|
||||
#define SCN_CALLTIPCLICK 2021
|
||||
//--Autogenerated -- end of section automatically generated from Scintilla.iface
|
||||
|
||||
// These structures are defined to be exactly the same shape as the Win32
|
||||
|
@@ -412,6 +412,9 @@ set void StyleSetCase=2060(int style, int caseForce)
|
||||
# Set the character set of the font in a style.
|
||||
set void StyleSetCharacterSet=2066(int style, int characterSet)
|
||||
|
||||
# Set a style to be a hotspot or not.
|
||||
set void StyleSetHotSpot=2409(int style, bool hotspot)
|
||||
|
||||
# Set the foreground colour of the selection and whether to use this setting.
|
||||
fun void SetSelFore=2067(bool useSetting, colour fore)
|
||||
|
||||
@@ -701,6 +704,7 @@ val SCFIND_WHOLEWORD=2
|
||||
val SCFIND_MATCHCASE=4
|
||||
val SCFIND_WORDSTART=0x00100000
|
||||
val SCFIND_REGEXP=0x00200000
|
||||
val SCFIND_POSIX=0x00400000
|
||||
|
||||
# Find some text in the document.
|
||||
fun position FindText=2150(int flags, findtext ft)
|
||||
@@ -883,6 +887,12 @@ fun void CallTipSetHlt=2204(int start, int end)
|
||||
# Set the background colour for the call tip.
|
||||
set void CallTipSetBack=2205(colour back,)
|
||||
|
||||
# Set the foreground colour for the call tip.
|
||||
set void CallTipSetFore=2206(colour fore,)
|
||||
|
||||
# Set the foreground colour for the highlighted part of the call tip.
|
||||
set void CallTipSetForeHlt=2207(colour fore,)
|
||||
|
||||
# Find the display line of a document line taking hidden lines into account.
|
||||
fun int VisibleFromDocLine=2220(int line,)
|
||||
|
||||
@@ -1040,7 +1050,6 @@ set void SetTwoPhaseDraw=2284(bool twoPhase,)
|
||||
fun void TargetFromSelection=2287(,)
|
||||
|
||||
# Join the lines in the target.
|
||||
# This is an experimental feature and may be changed or removed.
|
||||
fun void LinesJoin=2288(,)
|
||||
|
||||
# Split the lines in the target into lines that are less wide than pixelWidth
|
||||
@@ -1209,6 +1218,19 @@ fun void LineEndDisplay=2347(,)
|
||||
# caret position.
|
||||
fun void LineEndDisplayExtend=2348(,)
|
||||
|
||||
# These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)?
|
||||
# except they behave differently when word-wrap is enabled:
|
||||
# They go first to the start / end of the display line, like (Home|LineEnd)Display
|
||||
# The difference is that, the cursor is already at the point, it goes on to the start
|
||||
# or end of the document line, as appropriate for (Home|LineEnd|VCHome)Extend.
|
||||
|
||||
fun void HomeWrap=2349(,)
|
||||
fun void HomeWrapExtend=2450(,)
|
||||
fun void LineEndWrap=2451(,)
|
||||
fun void LineEndWrapExtend=2452(,)
|
||||
fun void VCHomeWrap=2453(,)
|
||||
fun void VCHomeWrapExtend=2454(,)
|
||||
|
||||
# Move the caret inside current view if it's not there already.
|
||||
fun void MoveCaretInsideView=2401(,)
|
||||
|
||||
@@ -1404,6 +1426,21 @@ set void SetPrintWrapMode=2406(int mode,)
|
||||
# Is printing line wrapped.
|
||||
get int GetPrintWrapMode=2407(,)
|
||||
|
||||
# Set a fore colour for active hotspots.
|
||||
set void SetHotspotActiveFore=2410(bool useSetting, colour fore)
|
||||
|
||||
# Set a back colour for active hotspots.
|
||||
set void SetHotspotActiveBack=2411(bool useSetting, colour back)
|
||||
|
||||
# Enable / Disable underlining active hotspots.
|
||||
set void SetHotspotActiveUnderline=2412(bool underline,)
|
||||
|
||||
# Move caret between paragraphs (delimited by empty lines)
|
||||
fun void ParaDown=2413(,)
|
||||
fun void ParaDownExtend=2414(,)
|
||||
fun void ParaUp=2415(,)
|
||||
fun void ParaUpExtend=2416(,)
|
||||
|
||||
# Start notifying the container of all key presses and commands.
|
||||
fun void StartRecord=3001(,)
|
||||
|
||||
@@ -1428,6 +1465,10 @@ set void SetKeyWords=4005(int keywordSet, string keyWords)
|
||||
# Set the lexing language of the document based on string name.
|
||||
set void SetLexerLanguage=4006(, string language)
|
||||
|
||||
# Load a lexer library (dll / so)
|
||||
# NOT YET IMPLEMENTED
|
||||
fun void LoadLexerLibrary=4007(, string path)
|
||||
|
||||
# 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.
|
||||
@@ -1524,6 +1565,7 @@ val SCLEX_CPPNOCASE=35
|
||||
val SCLEX_FORTRAN=36
|
||||
val SCLEX_F77=37
|
||||
val SCLEX_CSS=38
|
||||
val SCLEX_POV=39
|
||||
|
||||
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
|
||||
# value assigned in sequence from SCLEX_AUTOMATIC+1.
|
||||
@@ -1791,6 +1833,8 @@ val SCE_ERR_DIFF_ADDITION=11
|
||||
val SCE_ERR_DIFF_DELETION=12
|
||||
val SCE_ERR_DIFF_MESSAGE=13
|
||||
val SCE_ERR_PHP=14
|
||||
val SCE_ERR_ELF=15
|
||||
val SCE_ERR_IFC=16
|
||||
# Lexical states for SCLEX_BATCH
|
||||
lex Batch=SCLEX_BATCH SCE_BAT_
|
||||
val SCE_BAT_DEFAULT=0
|
||||
@@ -1988,7 +2032,21 @@ val SCE_CSS_COMMENT=9
|
||||
val SCE_CSS_ID=10
|
||||
val SCE_CSS_IMPORTANT=11
|
||||
val SCE_CSS_DIRECTIVE=12
|
||||
|
||||
val SCE_CSS_DOUBLESTRING=13
|
||||
val SCE_CSS_SINGLESTRING=14
|
||||
# Lexical states for SCLEX_POV
|
||||
lex POV=SCLEX_POV SCE_POV_
|
||||
val SCE_POV_DEFAULT=0
|
||||
val SCE_POV_COMMENT=1
|
||||
val SCE_POV_COMMENTLINE=2
|
||||
val SCE_POV_COMMENTDOC=3
|
||||
val SCE_POV_NUMBER=4
|
||||
val SCE_POV_WORD=5
|
||||
val SCE_POV_STRING=6
|
||||
val SCE_POV_OPERATOR=7
|
||||
val SCE_POV_IDENTIFIER=8
|
||||
val SCE_POV_BRACE=9
|
||||
val SCE_POV_WORD2=10
|
||||
# Events
|
||||
|
||||
evt void StyleNeeded=2000(int position)
|
||||
@@ -2010,6 +2068,9 @@ evt void URIDropped=2015(string text)
|
||||
evt void DwellStart=2016(int position)
|
||||
evt void DwellEnd=2017(int position)
|
||||
evt void Zoom=2018(void)
|
||||
evt void HotSpotClick=2019(int modifiers, int position)
|
||||
evt void HotSpotDoubleClick=2020(int modifiers, int position)
|
||||
evt void CallTipClick=2021(int position)
|
||||
|
||||
cat Deprecated
|
||||
|
||||
|
@@ -18,6 +18,9 @@ CallTip::CallTip() {
|
||||
inCallTipMode = false;
|
||||
posStartCallTip = 0;
|
||||
val = 0;
|
||||
xUp = -100;
|
||||
xDown = -100;
|
||||
lineHeight = 1;
|
||||
startHighlight = 0;
|
||||
endHighlight = 0;
|
||||
|
||||
@@ -35,6 +38,8 @@ CallTip::~CallTip() {
|
||||
val = 0;
|
||||
}
|
||||
|
||||
const int widthArrow = 14;
|
||||
|
||||
void CallTip::RefreshColourPalette(Palette &pal, bool want) {
|
||||
pal.WantFind(colourBG, want);
|
||||
pal.WantFind(colourUnSel, want);
|
||||
@@ -43,24 +48,98 @@ void CallTip::RefreshColourPalette(Palette &pal, bool want) {
|
||||
pal.WantFind(colourLight, want);
|
||||
}
|
||||
|
||||
void CallTip::PaintCT(Surface *surfaceWindow) {
|
||||
if (!val)
|
||||
return ;
|
||||
void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
|
||||
int posStart, int posEnd, int ytext, PRectangle rcClient,
|
||||
bool highlight, bool draw) {
|
||||
s += posStart;
|
||||
int len = posEnd - posStart;
|
||||
int maxEnd = 0;
|
||||
int ends[10];
|
||||
for (int i=0;i<len;i++) {
|
||||
if (s[i] <= '\002') {
|
||||
if (i > 0)
|
||||
ends[maxEnd++] = i;
|
||||
ends[maxEnd++] = i+1;
|
||||
}
|
||||
}
|
||||
ends[maxEnd++] = len;
|
||||
int startSeg = 0;
|
||||
int xEnd;
|
||||
for (int seg = 0; seg<maxEnd; seg++) {
|
||||
int endSeg = ends[seg];
|
||||
if (endSeg > startSeg) {
|
||||
if (s[startSeg] <= '\002') {
|
||||
xEnd = x + widthArrow;
|
||||
offsetMain = xEnd;
|
||||
if (draw) {
|
||||
const int halfWidth = widthArrow / 2 - 3;
|
||||
const int centreX = x + widthArrow / 2 - 1;
|
||||
const int centreY = (rcClient.top + rcClient.bottom) / 2;
|
||||
rcClient.left = x;
|
||||
rcClient.right = xEnd;
|
||||
surface->FillRectangle(rcClient, colourBG.allocated);
|
||||
PRectangle rcClientInner(rcClient.left+1, rcClient.top+1, rcClient.right-2, rcClient.bottom-1);
|
||||
surface->FillRectangle(rcClientInner, colourUnSel.allocated);
|
||||
|
||||
if (s[startSeg] == '\001') {
|
||||
// Up arrow
|
||||
Point pts[] = {
|
||||
Point(centreX - halfWidth, centreY + halfWidth / 2),
|
||||
Point(centreX + halfWidth, centreY + halfWidth / 2),
|
||||
Point(centreX, centreY - halfWidth + halfWidth / 2),
|
||||
};
|
||||
surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]),
|
||||
colourBG.allocated, colourBG.allocated);
|
||||
} else {
|
||||
// Down arrow
|
||||
Point pts[] = {
|
||||
Point(centreX - halfWidth, centreY - halfWidth / 2),
|
||||
Point(centreX + halfWidth, centreY - halfWidth / 2),
|
||||
Point(centreX, centreY + halfWidth - halfWidth / 2),
|
||||
};
|
||||
surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]),
|
||||
colourBG.allocated, colourBG.allocated);
|
||||
}
|
||||
} else {
|
||||
if (s[startSeg] == '\001') {
|
||||
xUp = x+1;
|
||||
} else {
|
||||
xDown = x+1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
xEnd = x + surface->WidthText(font, s+startSeg, endSeg - startSeg);
|
||||
if (draw) {
|
||||
rcClient.left = x;
|
||||
rcClient.right = xEnd;
|
||||
surface->DrawTextNoClip(rcClient, font, ytext,
|
||||
s+startSeg, endSeg - startSeg,
|
||||
highlight ? colourSel.allocated : colourUnSel.allocated,
|
||||
colourBG.allocated);
|
||||
}
|
||||
}
|
||||
x = xEnd;
|
||||
startSeg = endSeg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int CallTip::PaintContents(Surface *surfaceWindow, bool draw) {
|
||||
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;
|
||||
rcClient.bottom = ytext + surfaceWindow->Descent(font) + 1;
|
||||
char *chunkVal = val;
|
||||
bool moreChunks = true;
|
||||
int maxWidth = 0;
|
||||
while (moreChunks) {
|
||||
char *chunkEnd = strchr(chunkVal, '\n');
|
||||
if (chunkEnd == NULL) {
|
||||
@@ -76,36 +155,38 @@ void CallTip::PaintCT(Surface *surfaceWindow) {
|
||||
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->DrawTextNoClip(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->DrawTextNoClip(rcClient, font, ytext,
|
||||
chunkVal + thisStartHighlight, thisEndHighlight - thisStartHighlight,
|
||||
colourSel.allocated, colourBG.allocated);
|
||||
x = xEnd;
|
||||
int x = 5;
|
||||
|
||||
DrawChunk(surfaceWindow, x, chunkVal, 0, thisStartHighlight,
|
||||
ytext, rcClient, false, draw);
|
||||
DrawChunk(surfaceWindow, x, chunkVal, thisStartHighlight, thisEndHighlight,
|
||||
ytext, rcClient, true, draw);
|
||||
DrawChunk(surfaceWindow, x, chunkVal, thisEndHighlight, chunkLength,
|
||||
ytext, rcClient, false, draw);
|
||||
|
||||
xEnd = x + surfaceWindow->WidthText(font, chunkVal + thisEndHighlight,
|
||||
chunkLength - thisEndHighlight);
|
||||
rcClient.left = x;
|
||||
rcClient.right = xEnd;
|
||||
surfaceWindow->DrawTextNoClip(rcClient, font, ytext,
|
||||
chunkVal + thisEndHighlight, chunkLength - thisEndHighlight,
|
||||
colourUnSel.allocated, colourBG.allocated);
|
||||
chunkVal = chunkEnd + 1;
|
||||
ytext += lineHeight;
|
||||
rcClient.bottom += lineHeight;
|
||||
maxWidth = Platform::Maximum(maxWidth, x);
|
||||
}
|
||||
return maxWidth;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
offsetMain = 5;
|
||||
PaintContents(surfaceWindow, true);
|
||||
|
||||
// Draw a raised border around the edges of the window
|
||||
surfaceWindow->MoveTo(0, rcClientSize.bottom - 1);
|
||||
surfaceWindow->PenColour(colourShade.allocated);
|
||||
@@ -116,9 +197,21 @@ void CallTip::PaintCT(Surface *surfaceWindow) {
|
||||
surfaceWindow->LineTo(0, rcClientSize.bottom - 1);
|
||||
}
|
||||
|
||||
void CallTip::MouseClick(Point pt) {
|
||||
clickPlace = 0;
|
||||
if (pt.y < lineHeight) {
|
||||
if ((pt.x > xUp) && (pt.x < xUp + widthArrow - 2)) {
|
||||
clickPlace = 1;
|
||||
} else if ((pt.x > xDown) && (pt.x < xDown + widthArrow - 2)) {
|
||||
clickPlace = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn,
|
||||
const char *faceName, int size,
|
||||
int codePage_) {
|
||||
int codePage_, Window &wParent) {
|
||||
clickPlace = 0;
|
||||
if (val)
|
||||
delete []val;
|
||||
val = new char[strlen(defn) + 1];
|
||||
@@ -129,7 +222,7 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn,
|
||||
Surface *surfaceMeasure = Surface::Allocate();
|
||||
if (!surfaceMeasure)
|
||||
return PRectangle();
|
||||
surfaceMeasure->Init();
|
||||
surfaceMeasure->Init(wParent.GetID());
|
||||
surfaceMeasure->SetUnicodeMode(SC_CP_UTF8 == codePage);
|
||||
surfaceMeasure->SetDBCSMode(codePage);
|
||||
startHighlight = 0;
|
||||
@@ -140,23 +233,22 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn,
|
||||
font.Create(faceName, SC_CHARSET_DEFAULT, deviceHeight, false, false);
|
||||
// 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;
|
||||
xUp = -100;
|
||||
xDown = -100;
|
||||
offsetMain = 5;
|
||||
int width = PaintContents(surfaceMeasure, false) + 5;
|
||||
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, static_cast<int>(strlen(look)));
|
||||
width = Platform::Maximum(width, lastWidth) + 10;
|
||||
int lineHeight = surfaceMeasure->Height(font);
|
||||
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;
|
||||
delete surfaceMeasure;
|
||||
return PRectangle(pt.x -5, pt.y + 1, pt.x + width - 5, pt.y + 1 + height);
|
||||
return PRectangle(pt.x - offsetMain, pt.y + 1, pt.x + width - offsetMain, pt.y + 1 + height);
|
||||
}
|
||||
|
||||
void CallTip::CallTipCancel() {
|
||||
|
@@ -15,9 +15,17 @@ class CallTip {
|
||||
int endHighlight;
|
||||
char *val;
|
||||
Font font;
|
||||
int xUp;
|
||||
int xDown;
|
||||
int lineHeight;
|
||||
int offsetMain;
|
||||
// Private so CallTip objects can not be copied
|
||||
CallTip(const CallTip &) {}
|
||||
CallTip &operator=(const CallTip &) { return *this; }
|
||||
void DrawChunk(Surface *surface, int &x, const char *s,
|
||||
int posStart, int posEnd, int ytext, PRectangle rcClient,
|
||||
bool highlight, bool draw);
|
||||
int PaintContents(Surface *surfaceWindow, bool draw);
|
||||
|
||||
public:
|
||||
Window wCallTip;
|
||||
@@ -30,6 +38,7 @@ public:
|
||||
ColourPair colourShade;
|
||||
ColourPair colourLight;
|
||||
int codePage;
|
||||
int clickPlace;
|
||||
|
||||
CallTip();
|
||||
~CallTip();
|
||||
@@ -39,9 +48,11 @@ public:
|
||||
|
||||
void PaintCT(Surface *surfaceWindow);
|
||||
|
||||
void MouseClick(Point pt);
|
||||
|
||||
/// 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, int codePage_);
|
||||
const char *faceName, int size, int codePage_, Window &wParent);
|
||||
|
||||
void CallTipCancel();
|
||||
|
||||
|
@@ -720,6 +720,33 @@ void Document::ConvertLineEnds(int eolModeSet) {
|
||||
EndUndoAction();
|
||||
}
|
||||
|
||||
int Document::ParaDown(int pos) {
|
||||
int line = LineFromPosition(pos);
|
||||
while (line < LinesTotal() && LineStart(line) != LineEnd(line)) { // skip non-empty lines
|
||||
line++;
|
||||
}
|
||||
while (line < LinesTotal() && LineStart(line) == LineEnd(line)) { // skip empty lines
|
||||
line++;
|
||||
}
|
||||
if (line < LinesTotal())
|
||||
return LineStart(line);
|
||||
else // end of a document
|
||||
return LineEnd(line-1);
|
||||
}
|
||||
|
||||
int Document::ParaUp(int pos) {
|
||||
int line = LineFromPosition(pos);
|
||||
line--;
|
||||
while (line >= 0 && LineStart(line) == LineEnd(line)) { // skip empty lines
|
||||
line--;
|
||||
}
|
||||
while (line >= 0 && LineStart(line) != LineEnd(line)) { // skip non-empty lines
|
||||
line--;
|
||||
}
|
||||
line++;
|
||||
return LineStart(line);
|
||||
}
|
||||
|
||||
Document::charClassification Document::WordCharClass(unsigned char ch) {
|
||||
if ((SC_CP_UTF8 == dbcsCodePage) && (ch >= 0x80))
|
||||
return ccWord;
|
||||
@@ -847,7 +874,7 @@ public:
|
||||
* Has not been tested with backwards DBCS searches yet.
|
||||
*/
|
||||
long Document::FindText(int minPos, int maxPos, const char *s,
|
||||
bool caseSensitive, bool word, bool wordStart, bool regExp,
|
||||
bool caseSensitive, bool word, bool wordStart, bool regExp, bool posix,
|
||||
int *length) {
|
||||
if (regExp) {
|
||||
if (!pre)
|
||||
@@ -864,7 +891,7 @@ long Document::FindText(int minPos, int maxPos, const char *s,
|
||||
startPos = MovePositionOutsideChar(startPos, 1, false);
|
||||
endPos = MovePositionOutsideChar(endPos, 1, false);
|
||||
|
||||
const char *errmsg = pre->Compile(s, *length, caseSensitive);
|
||||
const char *errmsg = pre->Compile(s, *length, caseSensitive, posix);
|
||||
if (errmsg) {
|
||||
return -1;
|
||||
}
|
||||
@@ -888,16 +915,30 @@ long Document::FindText(int minPos, int maxPos, const char *s,
|
||||
for (int line = lineRangeStart; line != lineRangeBreak; line += increment) {
|
||||
int startOfLine = LineStart(line);
|
||||
int endOfLine = LineEnd(line);
|
||||
if ((increment == 1) && (line == lineRangeStart)) {
|
||||
if ((startPos != startOfLine) && (s[0] == '^'))
|
||||
continue; // Can't match start of line if start position after start of line
|
||||
startOfLine = startPos;
|
||||
}
|
||||
if ((increment == 1) && (line == lineRangeEnd)) {
|
||||
if ((endPos != endOfLine) && (searchEnd == '$'))
|
||||
continue; // Can't match end of line if end position before end of line
|
||||
endOfLine = endPos;
|
||||
if (increment == 1) {
|
||||
if (line == lineRangeStart) {
|
||||
if ((startPos != startOfLine) && (s[0] == '^'))
|
||||
continue; // Can't match start of line if start position after start of line
|
||||
startOfLine = startPos;
|
||||
}
|
||||
if (line == lineRangeEnd) {
|
||||
if ((endPos != endOfLine) && (searchEnd == '$'))
|
||||
continue; // Can't match end of line if end position before end of line
|
||||
endOfLine = endPos;
|
||||
}
|
||||
} else {
|
||||
if (line == lineRangeEnd) {
|
||||
if ((endPos != startOfLine) && (s[0] == '^'))
|
||||
continue; // Can't match start of line if end position after start of line
|
||||
startOfLine = endPos;
|
||||
}
|
||||
if (line == lineRangeStart) {
|
||||
if ((startPos != endOfLine) && (searchEnd == '$'))
|
||||
continue; // Can't match end of line if start position before end of line
|
||||
endOfLine = startPos;
|
||||
}
|
||||
}
|
||||
|
||||
DocumentIndexer di(this, endOfLine);
|
||||
int success = pre->Execute(di, startOfLine, endOfLine);
|
||||
if (success) {
|
||||
@@ -905,7 +946,8 @@ long Document::FindText(int minPos, int maxPos, const char *s,
|
||||
lenRet = pre->eopat[0] - pre->bopat[0];
|
||||
if (increment == -1) {
|
||||
// Check for the last match on this line.
|
||||
while (success && (pre->eopat[0] < endOfLine)) {
|
||||
int repetitions = 1000; // Break out of infinite loop
|
||||
while (success && (pre->eopat[0] < endOfLine) && (repetitions--)) {
|
||||
success = pre->Execute(di, pre->eopat[0], endOfLine);
|
||||
if (success) {
|
||||
if (pre->eopat[0] <= minPos) {
|
||||
@@ -1301,3 +1343,16 @@ int Document::WordPartRight(int pos) {
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
int Document::ExtendStyleRange(int pos, int delta) {
|
||||
int sStart = cb.StyleAt(pos);
|
||||
if (delta < 0) {
|
||||
while (pos > 0 && (cb.StyleAt(pos) == sStart))
|
||||
pos--;
|
||||
pos++;
|
||||
} else {
|
||||
while (pos < (Length()) && (cb.StyleAt(pos) == sStart))
|
||||
pos++;
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
@@ -192,7 +192,7 @@ public:
|
||||
int NextWordStart(int pos, int delta);
|
||||
int Length() { return cb.Length(); }
|
||||
long FindText(int minPos, int maxPos, const char *s,
|
||||
bool caseSensitive, bool word, bool wordStart, bool regExp, int *length);
|
||||
bool caseSensitive, bool word, bool wordStart, bool regExp, bool posix, int *length);
|
||||
long FindText(int iMessage, unsigned long wParam, long lParam);
|
||||
const char *SubstituteByPosition(const char *text, int *length);
|
||||
int LinesTotal();
|
||||
@@ -220,6 +220,9 @@ public:
|
||||
bool IsWordPartSeparator(char ch);
|
||||
int WordPartLeft(int pos);
|
||||
int WordPartRight(int pos);
|
||||
int ExtendStyleRange(int pos, int delta);
|
||||
int ParaUp(int pos);
|
||||
int ParaDown(int pos);
|
||||
|
||||
private:
|
||||
charClassification WordCharClass(unsigned char ch);
|
||||
|
@@ -364,7 +364,7 @@ Editor::Editor() {
|
||||
modEventMask = SC_MODEVENTMASKALL;
|
||||
|
||||
pdoc = new Document();
|
||||
pdoc ->AddRef();
|
||||
pdoc->AddRef();
|
||||
pdoc->AddWatcher(this, 0);
|
||||
|
||||
recordingMacro = false;
|
||||
@@ -374,6 +374,9 @@ Editor::Editor() {
|
||||
wrapWidth = LineLayout::wrapWidthInfinite;
|
||||
docLineLastWrapped = -1;
|
||||
|
||||
hsStart = -1;
|
||||
hsEnd = -1;
|
||||
|
||||
llc.SetLevel(LineLayoutCache::llcCaret);
|
||||
}
|
||||
|
||||
@@ -420,7 +423,7 @@ void Editor::RefreshColourPalette(Palette &pal, bool want) {
|
||||
void Editor::RefreshStyleData() {
|
||||
if (!stylesValid) {
|
||||
stylesValid = true;
|
||||
AutoSurface surface(CodePage());
|
||||
AutoSurface surface(this);
|
||||
if (surface) {
|
||||
vs.Refresh(*surface);
|
||||
RefreshColourPalette(palette, true);
|
||||
@@ -496,7 +499,7 @@ const char *ControlCharacterString(unsigned char ch) {
|
||||
class AutoLineLayout {
|
||||
LineLayoutCache &llc;
|
||||
LineLayout *ll;
|
||||
AutoLineLayout &operator=(const AutoLineLayout &) { return *this; }
|
||||
AutoLineLayout &operator=(const AutoLineLayout &) { return * this; }
|
||||
public:
|
||||
AutoLineLayout(LineLayoutCache &llc_, LineLayout *ll_) : llc(llc_), ll(ll_) {}
|
||||
~AutoLineLayout() {
|
||||
@@ -523,7 +526,7 @@ Point Editor::LocationFromPosition(int pos) {
|
||||
int line = pdoc->LineFromPosition(pos);
|
||||
int lineVisible = cs.DisplayFromDoc(line);
|
||||
//Platform::DebugPrintf("line=%d\n", line);
|
||||
AutoSurface surface(CodePage());
|
||||
AutoSurface surface(this);
|
||||
AutoLineLayout ll(llc, RetrieveLineLayout(line));
|
||||
if (surface && ll) {
|
||||
// -1 because of adding in for visible lines in following loop.
|
||||
@@ -581,7 +584,7 @@ int Editor::PositionFromLocation(Point pt) {
|
||||
return pdoc->Length();
|
||||
unsigned int posLineStart = pdoc->LineStart(lineDoc);
|
||||
int retVal = posLineStart;
|
||||
AutoSurface surface(CodePage());
|
||||
AutoSurface surface(this);
|
||||
AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc));
|
||||
if (surface && ll) {
|
||||
LayoutLine(lineDoc, surface, vs, ll, wrapWidth);
|
||||
@@ -624,7 +627,7 @@ int Editor::PositionFromLocationClose(Point pt) {
|
||||
return INVALID_POSITION;
|
||||
if (lineDoc >= pdoc->LinesTotal())
|
||||
return INVALID_POSITION;
|
||||
AutoSurface surface(CodePage());
|
||||
AutoSurface surface(this);
|
||||
AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc));
|
||||
if (surface && ll) {
|
||||
LayoutLine(lineDoc, surface, vs, ll, wrapWidth);
|
||||
@@ -656,7 +659,7 @@ int Editor::PositionFromLineX(int lineDoc, int x) {
|
||||
if (lineDoc >= pdoc->LinesTotal())
|
||||
return pdoc->Length();
|
||||
//Platform::DebugPrintf("Position of (%d,%d) line = %d top=%d\n", pt.x, pt.y, line, topLine);
|
||||
AutoSurface surface(CodePage());
|
||||
AutoSurface surface(this);
|
||||
AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc));
|
||||
int retVal = 0;
|
||||
if (surface && ll) {
|
||||
@@ -898,9 +901,9 @@ int Editor::MovePositionTo(int newPos, bool extend, bool ensureVisible) {
|
||||
} else {
|
||||
SetEmptySelection(newPos);
|
||||
}
|
||||
ShowCaretAtCurrentPosition();
|
||||
if (ensureVisible)
|
||||
EnsureCaretVisible();
|
||||
ShowCaretAtCurrentPosition();
|
||||
NotifyMove(newPos);
|
||||
return 0;
|
||||
}
|
||||
@@ -983,7 +986,7 @@ void Editor::MoveCaretInsideView(bool ensureVisible) {
|
||||
int Editor::DisplayFromPosition(int pos) {
|
||||
int lineDoc = pdoc->LineFromPosition(pos);
|
||||
int lineDisplay = cs.DisplayFromDoc(lineDoc);
|
||||
AutoSurface surface(CodePage());
|
||||
AutoSurface surface(this);
|
||||
AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc));
|
||||
if (surface && ll) {
|
||||
LayoutLine(lineDoc, surface, vs, ll, wrapWidth);
|
||||
@@ -1146,9 +1149,9 @@ void Editor::EnsureCaretVisible(bool useMargin, bool vert, bool horiz) {
|
||||
}
|
||||
newTopLine = Platform::Clamp(newTopLine, 0, MaxScrollPos());
|
||||
if (newTopLine != topLine) {
|
||||
Redraw();
|
||||
SetTopLine(newTopLine);
|
||||
SetVerticalScrollPos();
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1327,7 +1330,7 @@ bool Editor::WrapLines() {
|
||||
wrapWidth = rcTextArea.Width();
|
||||
// Ensure all of the document is styled.
|
||||
pdoc->EnsureStyledTo(pdoc->Length());
|
||||
AutoSurface surface(CodePage());
|
||||
AutoSurface surface(this);
|
||||
if (surface) {
|
||||
int lastLineToWrap = pdoc->LinesTotal();
|
||||
while (docLineLastWrapped <= lastLineToWrap) {
|
||||
@@ -1363,10 +1366,17 @@ bool Editor::WrapLines() {
|
||||
void Editor::LinesJoin() {
|
||||
if (!RangeContainsProtected(targetStart, targetEnd)) {
|
||||
pdoc->BeginUndoAction();
|
||||
bool prevNonWS = true;
|
||||
for (int pos = targetStart; pos < targetEnd; pos++) {
|
||||
if (IsEOLChar(pdoc->CharAt(pos))) {
|
||||
targetEnd -= pdoc->LenChar(pos);
|
||||
pdoc->DelChar(pos);
|
||||
if (prevNonWS) {
|
||||
// Ensure at least one space separating previous lines
|
||||
pdoc->InsertChar(pos, ' ');
|
||||
}
|
||||
} else {
|
||||
prevNonWS = pdoc->CharAt(pos) != ' ';
|
||||
}
|
||||
}
|
||||
pdoc->EndUndoAction();
|
||||
@@ -1394,13 +1404,14 @@ void Editor::LinesSplit(int pixelWidth) {
|
||||
const char *eol = StringFromEOLMode(pdoc->eolMode);
|
||||
pdoc->BeginUndoAction();
|
||||
for (int line = lineStart; line <= lineEnd; line++) {
|
||||
AutoSurface surface(CodePage());
|
||||
AutoSurface surface(this);
|
||||
AutoLineLayout ll(llc, RetrieveLineLayout(line));
|
||||
if (surface && ll) {
|
||||
unsigned int posLineStart = pdoc->LineStart(line);
|
||||
LayoutLine(line, surface, vs, ll, pixelWidth);
|
||||
for (int subLine = 1; subLine < ll->lines; subLine++) {
|
||||
pdoc->InsertString(posLineStart + subLine - 1 + ll->LineStart(subLine), eol);
|
||||
pdoc->InsertString(posLineStart + (subLine - 1) * strlen(eol) +
|
||||
ll->LineStart(subLine), eol);
|
||||
targetEnd += strlen(eol);
|
||||
}
|
||||
}
|
||||
@@ -1845,7 +1856,7 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
|
||||
}
|
||||
|
||||
ColourAllocated Editor::TextBackground(ViewStyle &vsDraw, bool overrideBackground,
|
||||
ColourAllocated background, bool inSelection, int styleMain, int i, LineLayout *ll) {
|
||||
ColourAllocated background, bool inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll) {
|
||||
if (inSelection) {
|
||||
if (vsDraw.selbackset) {
|
||||
if (primarySelection)
|
||||
@@ -1858,6 +1869,8 @@ ColourAllocated Editor::TextBackground(ViewStyle &vsDraw, bool overrideBackgroun
|
||||
(i >= ll->edgeColumn) &&
|
||||
!IsEOLChar(ll->chars[i]))
|
||||
return vsDraw.edgecolour.allocated;
|
||||
if (inHotspot)
|
||||
return vsDraw.hotspotBackground.allocated;
|
||||
if (overrideBackground)
|
||||
return background;
|
||||
}
|
||||
@@ -1990,7 +2003,8 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
|
||||
if ((rcSegment.left <= rcLine.right) && (rcSegment.right >= rcLine.left)) {
|
||||
int styleMain = ll->styles[i];
|
||||
bool inSelection = (iDoc >= ll->selStart) && (iDoc < ll->selEnd) && (ll->selStart != ll->selEnd);
|
||||
ColourAllocated textBack = TextBackground(vsDraw, overrideBackground, background, inSelection, styleMain, i, ll);
|
||||
bool inHotspot = (ll->hsStart != -1) && (iDoc >= ll->hsStart) && (iDoc < ll->hsEnd);
|
||||
ColourAllocated textBack = TextBackground(vsDraw, overrideBackground, background, inSelection, inHotspot, styleMain, i, ll);
|
||||
if (ll->chars[i] == '\t') {
|
||||
// Tab display
|
||||
if (drawWhitespaceBackground &&
|
||||
@@ -2050,11 +2064,17 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
|
||||
int styleMain = ll->styles[i];
|
||||
ColourAllocated textFore = vsDraw.styles[styleMain].fore.allocated;
|
||||
Font &textFont = vsDraw.styles[styleMain].font;
|
||||
//hotspot foreground
|
||||
if (ll->hsStart != -1 && iDoc >= ll->hsStart && iDoc < hsEnd) {
|
||||
if (vsDraw.hotspotForegroundSet)
|
||||
textFore = vsDraw.hotspotForeground.allocated;
|
||||
}
|
||||
bool inSelection = (iDoc >= ll->selStart) && (iDoc < ll->selEnd) && (ll->selStart != ll->selEnd);
|
||||
if (inSelection && (vsDraw.selforeset)) {
|
||||
textFore = vsDraw.selforeground.allocated;
|
||||
}
|
||||
ColourAllocated textBack = TextBackground(vsDraw, overrideBackground, background, inSelection, styleMain, i, ll);
|
||||
bool inHotspot = (ll->hsStart != -1) && (iDoc >= ll->hsStart) && (iDoc < ll->hsEnd);
|
||||
ColourAllocated textBack = TextBackground(vsDraw, overrideBackground, background, inSelection, inHotspot, styleMain, i, ll);
|
||||
if (ll->chars[i] == '\t') {
|
||||
// Tab display
|
||||
if (!twoPhaseDraw) {
|
||||
@@ -2161,7 +2181,15 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
|
||||
}
|
||||
}
|
||||
}
|
||||
if (vsDraw.styles[styleMain].underline) {
|
||||
if (ll->hsStart != -1 && vsDraw.hotspotUnderline && iDoc >= ll->hsStart && iDoc < ll->hsEnd ) {
|
||||
PRectangle rcUL = rcSegment;
|
||||
rcUL.top = rcUL.top + vsDraw.maxAscent + 1;
|
||||
rcUL.bottom = rcUL.top + 1;
|
||||
if (vsDraw.hotspotForegroundSet)
|
||||
surface->FillRectangle(rcUL, vsDraw.hotspotForeground.allocated);
|
||||
else
|
||||
surface->FillRectangle(rcUL, textFore);
|
||||
} else if (vsDraw.styles[styleMain].underline) {
|
||||
PRectangle rcUL = rcSegment;
|
||||
rcUL.top = rcUL.top + vsDraw.maxAscent + 1;
|
||||
rcUL.bottom = rcUL.top + 1;
|
||||
@@ -2213,8 +2241,8 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
|
||||
|
||||
void Editor::RefreshPixMaps(Surface *surfaceWindow) {
|
||||
if (!pixmapSelPattern->Initialised()) {
|
||||
const int patternSize=8;
|
||||
pixmapSelPattern->InitPixMap(patternSize, patternSize, surfaceWindow);
|
||||
const int patternSize = 8;
|
||||
pixmapSelPattern->InitPixMap(patternSize, patternSize, surfaceWindow, wMain.GetID());
|
||||
// This complex procedure is to reproduce the checkerboard dithered pattern used by windows
|
||||
// for scroll bars and Visual Studio for its selection margin. The colour of this pattern is half
|
||||
// way between the chrome colour and the chrome highlight colour making a nice transition
|
||||
@@ -2251,8 +2279,8 @@ void Editor::RefreshPixMaps(Surface *surfaceWindow) {
|
||||
|
||||
if (!pixmapIndentGuide->Initialised()) {
|
||||
// 1 extra pixel in height so can handle odd/even positions and so produce a continuous line
|
||||
pixmapIndentGuide->InitPixMap(1, vs.lineHeight + 1, surfaceWindow);
|
||||
pixmapIndentGuideHighlight->InitPixMap(1, vs.lineHeight + 1, surfaceWindow);
|
||||
pixmapIndentGuide->InitPixMap(1, vs.lineHeight + 1, surfaceWindow, wMain.GetID());
|
||||
pixmapIndentGuideHighlight->InitPixMap(1, vs.lineHeight + 1, surfaceWindow, wMain.GetID());
|
||||
PRectangle rcIG(0, 0, 1, vs.lineHeight);
|
||||
pixmapIndentGuide->FillRectangle(rcIG, vs.styles[STYLE_INDENTGUIDE].back.allocated);
|
||||
pixmapIndentGuide->PenColour(vs.styles[STYLE_INDENTGUIDE].fore.allocated);
|
||||
@@ -2270,9 +2298,9 @@ void Editor::RefreshPixMaps(Surface *surfaceWindow) {
|
||||
if (!pixmapLine->Initialised()) {
|
||||
PRectangle rcClient = GetClientRectangle();
|
||||
pixmapLine->InitPixMap(rcClient.Width(), rcClient.Height(),
|
||||
surfaceWindow);
|
||||
surfaceWindow, wMain.GetID());
|
||||
pixmapSelMargin->InitPixMap(vs.fixedColumnWidth,
|
||||
rcClient.Height(), surfaceWindow);
|
||||
rcClient.Height(), surfaceWindow, wMain.GetID());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2405,6 +2433,8 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
|
||||
ll->containsCaret = false;
|
||||
}
|
||||
|
||||
GetHotSpotRange(ll->hsStart, ll->hsEnd);
|
||||
|
||||
PRectangle rcLine = rcClient;
|
||||
rcLine.top = ypos;
|
||||
rcLine.bottom = ypos + vs.lineHeight;
|
||||
@@ -2583,10 +2613,10 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
|
||||
if (!pfr)
|
||||
return 0;
|
||||
|
||||
AutoSurface surface(pfr->hdc, CodePage());
|
||||
AutoSurface surface(pfr->hdc, this);
|
||||
if (!surface)
|
||||
return 0;
|
||||
AutoSurface surfaceMeasure(pfr->hdcTarget, CodePage());
|
||||
AutoSurface surfaceMeasure(pfr->hdcTarget, this);
|
||||
if (!surfaceMeasure) {
|
||||
return 0;
|
||||
}
|
||||
@@ -2758,7 +2788,7 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
|
||||
|
||||
int Editor::TextWidth(int style, const char *text) {
|
||||
RefreshStyleData();
|
||||
AutoSurface surface(CodePage());
|
||||
AutoSurface surface(this);
|
||||
if (surface) {
|
||||
return surface->WidthText(vs.styles[style].font, text, strlen(text));
|
||||
} else {
|
||||
@@ -2815,7 +2845,7 @@ void Editor::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) {
|
||||
bool wasSelection = currentPos != anchor;
|
||||
ClearSelection();
|
||||
if (inOverstrike && !wasSelection && !RangeContainsProtected(currentPos, currentPos + 1)) {
|
||||
if (currentPos < (pdoc->Length() - 1)) {
|
||||
if (currentPos < (pdoc->Length())) {
|
||||
if (!IsEOLChar(pdoc->CharAt(currentPos))) {
|
||||
pdoc->DelChar(currentPos);
|
||||
}
|
||||
@@ -3087,6 +3117,24 @@ void Editor::NotifyDoubleClick(Point, bool) {
|
||||
NotifyParent(scn);
|
||||
}
|
||||
|
||||
void Editor::NotifyHotSpotDoubleClicked(int position, bool shift, bool ctrl, bool alt) {
|
||||
SCNotification scn;
|
||||
scn.nmhdr.code = SCN_HOTSPOTDOUBLECLICK;
|
||||
scn.position = position;
|
||||
scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) |
|
||||
(alt ? SCI_ALT : 0);
|
||||
NotifyParent(scn);
|
||||
}
|
||||
|
||||
void Editor::NotifyHotSpotClicked(int position, bool shift, bool ctrl, bool alt) {
|
||||
SCNotification scn;
|
||||
scn.nmhdr.code = SCN_HOTSPOTCLICK;
|
||||
scn.position = position;
|
||||
scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) |
|
||||
(alt ? SCI_ALT : 0);
|
||||
NotifyParent(scn);
|
||||
}
|
||||
|
||||
void Editor::NotifyUpdateUI() {
|
||||
SCNotification scn;
|
||||
scn.nmhdr.code = SCN_UPDATEUI;
|
||||
@@ -3169,7 +3217,7 @@ void Editor::CheckModificationForWrap(DocModification mh) {
|
||||
if (wrapState != eWrapNone) {
|
||||
int lineDoc = pdoc->LineFromPosition(mh.position);
|
||||
if (mh.linesAdded == 0) {
|
||||
AutoSurface surface(CodePage());
|
||||
AutoSurface surface(this);
|
||||
AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc));
|
||||
if (surface && ll) {
|
||||
LayoutLine(lineDoc, surface, vs, ll, wrapWidth);
|
||||
@@ -3336,8 +3384,12 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long
|
||||
case SCI_SEARCHPREV:
|
||||
case SCI_LINEDOWN:
|
||||
case SCI_LINEDOWNEXTEND:
|
||||
case SCI_PARADOWN:
|
||||
case SCI_PARADOWNEXTEND:
|
||||
case SCI_LINEUP:
|
||||
case SCI_LINEUPEXTEND:
|
||||
case SCI_PARAUP:
|
||||
case SCI_PARAUPEXTEND:
|
||||
case SCI_CHARLEFT:
|
||||
case SCI_CHARLEFTEXTEND:
|
||||
case SCI_CHARRIGHT:
|
||||
@@ -3354,6 +3406,10 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long
|
||||
case SCI_HOMEEXTEND:
|
||||
case SCI_LINEEND:
|
||||
case SCI_LINEENDEXTEND:
|
||||
case SCI_HOMEWRAP:
|
||||
case SCI_HOMEWRAPEXTEND:
|
||||
case SCI_LINEENDWRAP:
|
||||
case SCI_LINEENDWRAPEXTEND:
|
||||
case SCI_DOCUMENTSTART:
|
||||
case SCI_DOCUMENTSTARTEXTEND:
|
||||
case SCI_DOCUMENTEND:
|
||||
@@ -3370,6 +3426,8 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long
|
||||
case SCI_FORMFEED:
|
||||
case SCI_VCHOME:
|
||||
case SCI_VCHOMEEXTEND:
|
||||
case SCI_VCHOMEWRAP:
|
||||
case SCI_VCHOMEWRAPEXTEND:
|
||||
case SCI_DELWORDLEFT:
|
||||
case SCI_DELWORDRIGHT:
|
||||
case SCI_DELLINELEFT:
|
||||
@@ -3531,7 +3589,7 @@ void Editor::CursorUpOrDown(int direction, bool extend) {
|
||||
int Editor::StartEndDisplayLine(int pos, bool start) {
|
||||
RefreshStyleData();
|
||||
int line = pdoc->LineFromPosition(pos);
|
||||
AutoSurface surface(CodePage());
|
||||
AutoSurface surface(this);
|
||||
AutoLineLayout ll(llc, RetrieveLineLayout(line));
|
||||
int posRet = INVALID_POSITION;
|
||||
if (surface && ll) {
|
||||
@@ -3568,6 +3626,12 @@ int Editor::KeyCommand(unsigned int iMessage) {
|
||||
case SCI_LINEDOWNEXTEND:
|
||||
CursorUpOrDown(1, true);
|
||||
break;
|
||||
case SCI_PARADOWN:
|
||||
MovePositionTo(pdoc->ParaDown(currentPos));
|
||||
break;
|
||||
case SCI_PARADOWNEXTEND:
|
||||
MovePositionTo(pdoc->ParaDown(currentPos), true);
|
||||
break;
|
||||
case SCI_LINESCROLLDOWN:
|
||||
ScrollTo(topLine + 1);
|
||||
MoveCaretInsideView(false);
|
||||
@@ -3578,6 +3642,12 @@ int Editor::KeyCommand(unsigned int iMessage) {
|
||||
case SCI_LINEUPEXTEND:
|
||||
CursorUpOrDown(-1, true);
|
||||
break;
|
||||
case SCI_PARAUP:
|
||||
MovePositionTo(pdoc->ParaUp(currentPos));
|
||||
break;
|
||||
case SCI_PARAUPEXTEND:
|
||||
MovePositionTo(pdoc->ParaUp(currentPos), true);
|
||||
break;
|
||||
case SCI_LINESCROLLUP:
|
||||
ScrollTo(topLine - 1);
|
||||
MoveCaretInsideView(false);
|
||||
@@ -3638,6 +3708,38 @@ int Editor::KeyCommand(unsigned int iMessage) {
|
||||
MovePositionTo(pdoc->LineEndPosition(currentPos), true);
|
||||
SetLastXChosen();
|
||||
break;
|
||||
case SCI_HOMEWRAP: {
|
||||
int homePos = MovePositionSoVisible(StartEndDisplayLine(currentPos, true), -1);
|
||||
if (currentPos <= homePos)
|
||||
homePos = pdoc->LineStart(pdoc->LineFromPosition(currentPos));
|
||||
MovePositionTo(homePos);
|
||||
SetLastXChosen();
|
||||
}
|
||||
break;
|
||||
case SCI_HOMEWRAPEXTEND: {
|
||||
int homePos = MovePositionSoVisible(StartEndDisplayLine(currentPos, true), -1);
|
||||
if (currentPos <= homePos)
|
||||
homePos = pdoc->LineStart(pdoc->LineFromPosition(currentPos));
|
||||
MovePositionTo(homePos, true);
|
||||
SetLastXChosen();
|
||||
}
|
||||
break;
|
||||
case SCI_LINEENDWRAP: {
|
||||
int endPos = MovePositionSoVisible(StartEndDisplayLine(currentPos, false), 1);
|
||||
if (currentPos >= endPos)
|
||||
endPos = pdoc->LineEndPosition(currentPos);
|
||||
MovePositionTo(endPos);
|
||||
SetLastXChosen();
|
||||
}
|
||||
break;
|
||||
case SCI_LINEENDWRAPEXTEND: {
|
||||
int endPos = MovePositionSoVisible(StartEndDisplayLine(currentPos, false), 1);
|
||||
if (currentPos >= endPos)
|
||||
endPos = pdoc->LineEndPosition(currentPos);
|
||||
MovePositionTo(endPos, true);
|
||||
SetLastXChosen();
|
||||
}
|
||||
break;
|
||||
case SCI_DOCUMENTSTART:
|
||||
MovePositionTo(0);
|
||||
SetLastXChosen();
|
||||
@@ -3672,7 +3774,7 @@ int Editor::KeyCommand(unsigned int iMessage) {
|
||||
ShowCaretAtCurrentPosition();
|
||||
NotifyUpdateUI();
|
||||
break;
|
||||
case SCI_CANCEL: // Cancel any modes - handled in subclass
|
||||
case SCI_CANCEL: // Cancel any modes - handled in subclass
|
||||
// Also unselect text
|
||||
CancelModes();
|
||||
break;
|
||||
@@ -3710,6 +3812,26 @@ int Editor::KeyCommand(unsigned int iMessage) {
|
||||
MovePositionTo(pdoc->VCHomePosition(currentPos), true);
|
||||
SetLastXChosen();
|
||||
break;
|
||||
case SCI_VCHOMEWRAP: {
|
||||
int homePos = pdoc->VCHomePosition(currentPos);
|
||||
int viewLineStart = MovePositionSoVisible(StartEndDisplayLine(currentPos, true), -1);
|
||||
if ((viewLineStart < currentPos) && (viewLineStart > homePos))
|
||||
homePos = viewLineStart;
|
||||
|
||||
MovePositionTo(homePos);
|
||||
SetLastXChosen();
|
||||
}
|
||||
break;
|
||||
case SCI_VCHOMEWRAPEXTEND: {
|
||||
int homePos = pdoc->VCHomePosition(currentPos);
|
||||
int viewLineStart = MovePositionSoVisible(StartEndDisplayLine(currentPos, true), -1);
|
||||
if ((viewLineStart < currentPos) && (viewLineStart > homePos))
|
||||
homePos = viewLineStart;
|
||||
|
||||
MovePositionTo(homePos, true);
|
||||
SetLastXChosen();
|
||||
}
|
||||
break;
|
||||
case SCI_ZOOMIN:
|
||||
if (vs.zoomLevel < 20) {
|
||||
vs.zoomLevel++;
|
||||
@@ -3929,8 +4051,8 @@ void Editor::Indent(bool forwards) {
|
||||
* @return The position of the found text, -1 if not found.
|
||||
*/
|
||||
long Editor::FindText(
|
||||
uptr_t wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD,
|
||||
///< @c SCFIND_WORDSTART or @c SCFIND_REGEXP.
|
||||
uptr_t wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD,
|
||||
///< @c SCFIND_WORDSTART, @c SCFIND_REGEXP or @c SCFIND_POSIX.
|
||||
sptr_t lParam) { ///< @c TextToFind structure: The text to search for in the given range.
|
||||
|
||||
TextToFind *ft = reinterpret_cast<TextToFind *>(lParam);
|
||||
@@ -3940,6 +4062,7 @@ long Editor::FindText(
|
||||
(wParam & SCFIND_WHOLEWORD) != 0,
|
||||
(wParam & SCFIND_WORDSTART) != 0,
|
||||
(wParam & SCFIND_REGEXP) != 0,
|
||||
(wParam & SCFIND_POSIX) != 0,
|
||||
&lengthFound);
|
||||
if (pos != -1) {
|
||||
ft->chrgText.cpMin = pos;
|
||||
@@ -3969,8 +4092,8 @@ void Editor::SearchAnchor() {
|
||||
* @return The position of the found text, -1 if not found.
|
||||
*/
|
||||
long Editor::SearchText(
|
||||
unsigned int iMessage, ///< Accepts both @c SCI_SEARCHNEXT and @c SCI_SEARCHPREV.
|
||||
uptr_t wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD,
|
||||
unsigned int iMessage, ///< Accepts both @c SCI_SEARCHNEXT and @c SCI_SEARCHPREV.
|
||||
uptr_t wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD,
|
||||
///< @c SCFIND_WORDSTART or @c SCFIND_REGEXP.
|
||||
sptr_t lParam) { ///< The text to search for.
|
||||
|
||||
@@ -3983,6 +4106,7 @@ long Editor::SearchText(
|
||||
(wParam & SCFIND_WHOLEWORD) != 0,
|
||||
(wParam & SCFIND_WORDSTART) != 0,
|
||||
(wParam & SCFIND_REGEXP) != 0,
|
||||
(wParam & SCFIND_POSIX) != 0,
|
||||
&lengthFound);
|
||||
} else {
|
||||
pos = pdoc->FindText(searchAnchor, 0, txt,
|
||||
@@ -3990,6 +4114,7 @@ long Editor::SearchText(
|
||||
(wParam & SCFIND_WHOLEWORD) != 0,
|
||||
(wParam & SCFIND_WORDSTART) != 0,
|
||||
(wParam & SCFIND_REGEXP) != 0,
|
||||
(wParam & SCFIND_POSIX) != 0,
|
||||
&lengthFound);
|
||||
}
|
||||
|
||||
@@ -4011,6 +4136,7 @@ long Editor::SearchInTarget(const char *text, int length) {
|
||||
(searchFlags & SCFIND_WHOLEWORD) != 0,
|
||||
(searchFlags & SCFIND_WORDSTART) != 0,
|
||||
(searchFlags & SCFIND_REGEXP) != 0,
|
||||
(searchFlags & SCFIND_POSIX) != 0,
|
||||
&lengthFound);
|
||||
if (pos != -1) {
|
||||
targetStart = pos;
|
||||
@@ -4280,7 +4406,7 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b
|
||||
SetEmptySelection(newPos);
|
||||
bool doubleClick = false;
|
||||
// Stop mouse button bounce changing selection type
|
||||
if (curTime != lastClickTime) {
|
||||
if (!Platform::MouseButtonBounce() || curTime != lastClickTime) {
|
||||
if (selectionType == selChar) {
|
||||
selectionType = selWord;
|
||||
doubleClick = true;
|
||||
@@ -4308,8 +4434,11 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b
|
||||
SetEmptySelection(currentPos);
|
||||
}
|
||||
//Platform::DebugPrintf("Double click: %d - %d\n", anchor, currentPos);
|
||||
if (doubleClick)
|
||||
if (doubleClick) {
|
||||
NotifyDoubleClick(pt, shift);
|
||||
if (PositionIsHotspot(newPos))
|
||||
NotifyHotSpotDoubleClicked(newPos, shift, ctrl, alt);
|
||||
}
|
||||
} else { // Single click
|
||||
if (inSelMargin) {
|
||||
selType = selStream;
|
||||
@@ -4339,6 +4468,9 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b
|
||||
SetMouseCapture(true);
|
||||
selectionType = selLine;
|
||||
} else {
|
||||
if (PositionIsHotspot(newPos)) {
|
||||
NotifyHotSpotClicked(newPos, shift, ctrl, alt);
|
||||
}
|
||||
if (!shift) {
|
||||
inDragDrop = PointInSelection(pt);
|
||||
}
|
||||
@@ -4365,6 +4497,53 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b
|
||||
ShowCaretAtCurrentPosition();
|
||||
}
|
||||
|
||||
bool Editor::PositionIsHotspot(int position) {
|
||||
return vs.styles[pdoc->StyleAt(position)].hotspot;
|
||||
}
|
||||
|
||||
bool Editor::PointIsHotspot(Point pt) {
|
||||
int pos = PositionFromLocation(pt);
|
||||
return PositionIsHotspot(pos);
|
||||
}
|
||||
|
||||
void Editor::SetHotSpotRange(Point *pt) {
|
||||
if (pt) {
|
||||
int pos = PositionFromLocation(*pt);
|
||||
|
||||
// If we don't limit this to word characters then the
|
||||
// range can encompass more than the run range and then
|
||||
// the underline will not be drawn properly.
|
||||
int hsStart_ = pdoc->ExtendStyleRange(pos, -1);
|
||||
int hsEnd_ = pdoc->ExtendStyleRange(pos, 1);
|
||||
|
||||
// Only invalidate the range if the hotspot range has changed...
|
||||
if (hsStart_ != hsStart || hsEnd_ != hsEnd) {
|
||||
if (hsStart != -1) {
|
||||
InvalidateRange(hsStart, hsEnd);
|
||||
}
|
||||
hsStart = hsStart_;
|
||||
hsEnd = hsEnd_;
|
||||
InvalidateRange(hsStart, hsEnd);
|
||||
}
|
||||
} else {
|
||||
if (hsStart != -1) {
|
||||
int hsStart_ = hsStart;
|
||||
int hsEnd_ = hsEnd;
|
||||
hsStart = -1;
|
||||
hsEnd = -1;
|
||||
InvalidateRange(hsStart_, hsEnd_);
|
||||
} else {
|
||||
hsStart = -1;
|
||||
hsEnd = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Editor::GetHotSpotRange(int& hsStart_, int& hsEnd_) {
|
||||
hsStart_ = hsStart;
|
||||
hsEnd_ = hsEnd;
|
||||
}
|
||||
|
||||
void Editor::ButtonMove(Point pt) {
|
||||
if ((ptMouseLast.x != pt.x) || (ptMouseLast.y != pt.y)) {
|
||||
DwellEnd(true);
|
||||
@@ -4409,7 +4588,7 @@ void Editor::ButtonMove(Point pt) {
|
||||
if (pt.y > rcClient.bottom) {
|
||||
int lineMove = cs.DisplayFromDoc(LineFromLocation(pt));
|
||||
if (lineMove < 0) {
|
||||
lineMove = cs.DisplayFromDoc(pdoc->LinesTotal()-1);
|
||||
lineMove = cs.DisplayFromDoc(pdoc->LinesTotal() - 1);
|
||||
}
|
||||
ScrollTo(lineMove - LinesOnScreen() + 5);
|
||||
Redraw();
|
||||
@@ -4420,6 +4599,9 @@ void Editor::ButtonMove(Point pt) {
|
||||
}
|
||||
EnsureCaretVisible(false, false, true);
|
||||
|
||||
if (hsStart != -1 && !PositionIsHotspot(movePos))
|
||||
SetHotSpotRange(NULL);
|
||||
|
||||
} else {
|
||||
if (vs.fixedColumnWidth > 0) { // There is a margin
|
||||
if (PointInSelMargin(pt)) {
|
||||
@@ -4428,10 +4610,15 @@ void Editor::ButtonMove(Point pt) {
|
||||
}
|
||||
}
|
||||
// Display regular (drag) cursor over selection
|
||||
if (PointInSelection(pt))
|
||||
if (PointInSelection(pt)) {
|
||||
DisplayCursor(Window::cursorArrow);
|
||||
else
|
||||
} else if (PointIsHotspot(pt)) {
|
||||
DisplayCursor(Window::cursorHand);
|
||||
SetHotSpotRange(&pt);
|
||||
} else {
|
||||
DisplayCursor(Window::cursorText);
|
||||
SetHotSpotRange(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4443,6 +4630,7 @@ void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) {
|
||||
DisplayCursor(Window::cursorReverseArrow);
|
||||
} else {
|
||||
DisplayCursor(Window::cursorText);
|
||||
SetHotSpotRange(NULL);
|
||||
}
|
||||
xEndSelect = pt.x - vs.fixedColumnWidth + xOffset;
|
||||
ptMouseLast = pt;
|
||||
@@ -4524,6 +4712,7 @@ void Editor::SetFocusState(bool focusState) {
|
||||
if (hasFocus) {
|
||||
ShowCaretAtCurrentPosition();
|
||||
} else {
|
||||
CancelModes();
|
||||
DropCaret();
|
||||
}
|
||||
}
|
||||
@@ -4668,6 +4857,13 @@ void Editor::SetDocPointer(Document *document) {
|
||||
pdoc = document;
|
||||
}
|
||||
pdoc->AddRef();
|
||||
|
||||
// Ensure all positions within document
|
||||
currentPos = 0;
|
||||
anchor = 0;
|
||||
targetStart = 0;
|
||||
targetEnd = 0;
|
||||
|
||||
// Reset the contraction state to fully shown.
|
||||
cs.Clear();
|
||||
cs.InsertLines(0, pdoc->LinesTotal() - 1);
|
||||
@@ -4676,7 +4872,10 @@ void Editor::SetDocPointer(Document *document) {
|
||||
|
||||
pdoc->AddWatcher(this, 0);
|
||||
Redraw();
|
||||
SetScrollBars();
|
||||
// Removed because of reentrance problems of GTK+ 2.x
|
||||
// where changing a scroll bar position causes synchronous
|
||||
// painting before lexer and styling state is set up.
|
||||
//SetScrollBars();
|
||||
}
|
||||
|
||||
// Recursively expand a fold, making lines visible except where they have an unexpanded parent
|
||||
@@ -5318,7 +5517,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
||||
pdoc->SetStyleFor(wParam, static_cast<char>(lParam));
|
||||
break;
|
||||
|
||||
case SCI_SETSTYLINGEX: // Specify a complete styling buffer
|
||||
case SCI_SETSTYLINGEX: // Specify a complete styling buffer
|
||||
if (lParam == 0)
|
||||
return 0;
|
||||
pdoc->SetStyles(wParam, CharPtrFromSPtr(lParam));
|
||||
@@ -5439,7 +5638,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
||||
break;
|
||||
|
||||
case SCI_TEXTWIDTH:
|
||||
PLATFORM_ASSERT((wParam >= 0) && (wParam <= STYLE_MAX));
|
||||
PLATFORM_ASSERT(wParam <= STYLE_MAX);
|
||||
PLATFORM_ASSERT(lParam);
|
||||
return TextWidth(wParam, CharPtrFromSPtr(lParam));
|
||||
|
||||
@@ -5710,6 +5909,12 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
||||
InvalidateStyleRedraw();
|
||||
}
|
||||
break;
|
||||
case SCI_STYLESETHOTSPOT:
|
||||
if (wParam <= STYLE_MAX) {
|
||||
vs.styles[wParam].hotspot = lParam != 0;
|
||||
InvalidateStyleRedraw();
|
||||
}
|
||||
break;
|
||||
|
||||
case SCI_STYLERESETDEFAULT:
|
||||
vs.ResetDefaultStyle();
|
||||
@@ -5818,7 +6023,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
||||
return SearchText(iMessage, wParam, lParam);
|
||||
|
||||
#ifdef INCLUDE_DEPRECATED_FEATURES
|
||||
case SCI_SETCARETPOLICY: // Deprecated
|
||||
case SCI_SETCARETPOLICY: // Deprecated
|
||||
caretXPolicy = caretYPolicy = wParam;
|
||||
caretXSlop = caretYSlop = lParam;
|
||||
break;
|
||||
@@ -5923,8 +6128,12 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
||||
|
||||
case SCI_LINEDOWN:
|
||||
case SCI_LINEDOWNEXTEND:
|
||||
case SCI_PARADOWN:
|
||||
case SCI_PARADOWNEXTEND:
|
||||
case SCI_LINEUP:
|
||||
case SCI_LINEUPEXTEND:
|
||||
case SCI_PARAUP:
|
||||
case SCI_PARAUPEXTEND:
|
||||
case SCI_CHARLEFT:
|
||||
case SCI_CHARLEFTEXTEND:
|
||||
case SCI_CHARRIGHT:
|
||||
@@ -5937,6 +6146,10 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
||||
case SCI_HOMEEXTEND:
|
||||
case SCI_LINEEND:
|
||||
case SCI_LINEENDEXTEND:
|
||||
case SCI_HOMEWRAP:
|
||||
case SCI_HOMEWRAPEXTEND:
|
||||
case SCI_LINEENDWRAP:
|
||||
case SCI_LINEENDWRAPEXTEND:
|
||||
case SCI_DOCUMENTSTART:
|
||||
case SCI_DOCUMENTSTARTEXTEND:
|
||||
case SCI_DOCUMENTEND:
|
||||
@@ -5954,6 +6167,8 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
||||
case SCI_FORMFEED:
|
||||
case SCI_VCHOME:
|
||||
case SCI_VCHOMEEXTEND:
|
||||
case SCI_VCHOMEWRAP:
|
||||
case SCI_VCHOMEWRAPEXTEND:
|
||||
case SCI_ZOOMIN:
|
||||
case SCI_ZOOMOUT:
|
||||
case SCI_DELWORDLEFT:
|
||||
@@ -6037,6 +6252,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
||||
return reinterpret_cast<sptr_t>(pdoc);
|
||||
|
||||
case SCI_SETDOCPOINTER:
|
||||
CancelModes();
|
||||
SetDocPointer(reinterpret_cast<Document *>(lParam));
|
||||
return 0;
|
||||
|
||||
@@ -6138,6 +6354,23 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
||||
InvalidateStyleRedraw();
|
||||
break;
|
||||
|
||||
case SCI_SETHOTSPOTACTIVEFORE:
|
||||
vs.hotspotForegroundSet = wParam != 0;
|
||||
vs.hotspotForeground.desired = ColourDesired(lParam);
|
||||
InvalidateStyleRedraw();
|
||||
break;
|
||||
|
||||
case SCI_SETHOTSPOTACTIVEBACK:
|
||||
vs.hotspotBackgroundSet = wParam != 0;
|
||||
vs.hotspotBackground.desired = ColourDesired(lParam);
|
||||
InvalidateStyleRedraw();
|
||||
break;
|
||||
|
||||
case SCI_SETHOTSPOTACTIVEUNDERLINE:
|
||||
vs.hotspotUnderline = wParam != 0;
|
||||
InvalidateStyleRedraw();
|
||||
break;
|
||||
|
||||
default:
|
||||
return DefWndProc(iMessage, wParam, lParam);
|
||||
}
|
||||
|
@@ -58,6 +58,10 @@ public:
|
||||
int *positions;
|
||||
char bracePreviousStyles[2];
|
||||
|
||||
// Hotspot support
|
||||
int hsStart;
|
||||
int hsEnd;
|
||||
|
||||
// Wrapped line support
|
||||
int widthLine;
|
||||
int lines;
|
||||
@@ -131,40 +135,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* A smart pointer class to ensure Surfaces are set up and deleted correctly.
|
||||
*/
|
||||
class AutoSurface {
|
||||
private:
|
||||
Surface *surf;
|
||||
public:
|
||||
AutoSurface(int codePage) {
|
||||
surf = Surface::Allocate();
|
||||
if (surf) {
|
||||
surf->Init();
|
||||
surf->SetUnicodeMode(SC_CP_UTF8 == codePage);
|
||||
surf->SetDBCSMode(codePage);
|
||||
}
|
||||
}
|
||||
AutoSurface(SurfaceID sid, int codePage) {
|
||||
surf = Surface::Allocate();
|
||||
if (surf) {
|
||||
surf->Init(sid);
|
||||
surf->SetUnicodeMode(SC_CP_UTF8 == codePage);
|
||||
surf->SetDBCSMode(codePage);
|
||||
}
|
||||
}
|
||||
~AutoSurface() {
|
||||
delete surf;
|
||||
}
|
||||
Surface *operator->() const {
|
||||
return surf;
|
||||
}
|
||||
operator Surface *() const {
|
||||
return surf;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*/
|
||||
class Editor : public DocWatcher {
|
||||
@@ -282,6 +252,10 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
int foldFlags;
|
||||
ContractionState cs;
|
||||
|
||||
// Hotspot support
|
||||
int hsStart;
|
||||
int hsEnd;
|
||||
|
||||
// Wrapping support
|
||||
enum { eWrapNone, eWrapWord } wrapState;
|
||||
int wrapWidth;
|
||||
@@ -355,14 +329,14 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
LineLayout *RetrieveLineLayout(int lineNumber);
|
||||
void LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll,
|
||||
int width=LineLayout::wrapWidthInfinite);
|
||||
ColourAllocated TextBackground(ViewStyle &vsDraw, bool overrideBackground, ColourAllocated background, bool inSelection, int styleMain, int i, LineLayout *ll);
|
||||
ColourAllocated TextBackground(ViewStyle &vsDraw, bool overrideBackground, ColourAllocated background, bool inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll);
|
||||
void DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight, int start, PRectangle rcSegment, bool highlight);
|
||||
void DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, LineLayout *ll,
|
||||
int line, int lineEnd, int xStart, int subLine, int subLineStart,
|
||||
bool overrideBackground, ColourAllocated background);
|
||||
void DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart,
|
||||
PRectangle rcLine, LineLayout *ll, int subLine=0);
|
||||
void RefreshPixMaps(Surface *surfaceWindow);
|
||||
void RefreshPixMaps(Surface *surfaceWindow);
|
||||
void Paint(Surface *surfaceWindow, PRectangle rcArea);
|
||||
long FormatRange(bool draw, RangeToFormat *pfr);
|
||||
int TextWidth(int style, const char *text);
|
||||
@@ -402,6 +376,8 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
void NotifySavePoint(bool isSavePoint);
|
||||
void NotifyModifyAttempt();
|
||||
virtual void NotifyDoubleClick(Point pt, bool shift);
|
||||
void NotifyHotSpotClicked(int position, bool shift, bool ctrl, bool alt);
|
||||
void NotifyHotSpotDoubleClicked(int position, bool shift, bool ctrl, bool alt);
|
||||
void NotifyUpdateUI();
|
||||
void NotifyPainted();
|
||||
bool NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt);
|
||||
@@ -474,6 +450,11 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
void EnsureLineVisible(int lineDoc, bool enforcePolicy);
|
||||
int ReplaceTarget(bool replacePatterns, const char *text, int length=-1);
|
||||
|
||||
bool PositionIsHotspot(int position);
|
||||
bool PointIsHotspot(Point pt);
|
||||
void SetHotSpotRange(Point *pt);
|
||||
void GetHotSpotRange(int& hsStart, int& hsEnd);
|
||||
|
||||
int CodePage() const;
|
||||
|
||||
virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) = 0;
|
||||
@@ -485,6 +466,45 @@ public:
|
||||
virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
|
||||
// Public so scintilla_set_id can use it.
|
||||
int ctrlID;
|
||||
friend class AutoSurface;
|
||||
};
|
||||
|
||||
/**
|
||||
* A smart pointer class to ensure Surfaces are set up and deleted correctly.
|
||||
*/
|
||||
class AutoSurface {
|
||||
private:
|
||||
Surface *surf;
|
||||
public:
|
||||
AutoSurface(Editor *ed) : surf(0) {
|
||||
if (ed->wMain.GetID()) {
|
||||
surf = Surface::Allocate();
|
||||
if (surf) {
|
||||
surf->Init(ed->wMain.GetID());
|
||||
surf->SetUnicodeMode(SC_CP_UTF8 == ed->CodePage());
|
||||
surf->SetDBCSMode(ed->CodePage());
|
||||
}
|
||||
}
|
||||
}
|
||||
AutoSurface(SurfaceID sid, Editor *ed) : surf(0) {
|
||||
if (ed->wMain.GetID()) {
|
||||
surf = Surface::Allocate();
|
||||
if (surf) {
|
||||
surf->Init(sid, ed->wMain.GetID());
|
||||
surf->SetUnicodeMode(SC_CP_UTF8 == ed->CodePage());
|
||||
surf->SetDBCSMode(ed->CodePage());
|
||||
}
|
||||
}
|
||||
}
|
||||
~AutoSurface() {
|
||||
delete surf;
|
||||
}
|
||||
Surface *operator->() const {
|
||||
return surf;
|
||||
}
|
||||
operator Surface *() const {
|
||||
return surf;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -66,9 +66,13 @@ const KeyToCommand KeyMap::MapDefault[] = {
|
||||
{SCK_DOWN, SCI_NORM, SCI_LINEDOWN},
|
||||
{SCK_DOWN, SCI_SHIFT, SCI_LINEDOWNEXTEND},
|
||||
{SCK_DOWN, SCI_CTRL, SCI_LINESCROLLDOWN},
|
||||
{SCK_DOWN, SCI_ALT, SCI_PARADOWN},
|
||||
{SCK_DOWN, SCI_ASHIFT, SCI_PARADOWNEXTEND},
|
||||
{SCK_UP, SCI_NORM, SCI_LINEUP},
|
||||
{SCK_UP, SCI_SHIFT, SCI_LINEUPEXTEND},
|
||||
{SCK_UP, SCI_CTRL, SCI_LINESCROLLUP},
|
||||
{SCK_UP, SCI_ALT, SCI_PARAUP},
|
||||
{SCK_UP, SCI_ASHIFT, SCI_PARAUPEXTEND},
|
||||
{SCK_LEFT, SCI_NORM, SCI_CHARLEFT},
|
||||
{SCK_LEFT, SCI_SHIFT, SCI_CHARLEFTEXTEND},
|
||||
{SCK_LEFT, SCI_CTRL, SCI_WORDLEFT},
|
||||
|
@@ -171,6 +171,7 @@ int Scintilla_LinkLexers() {
|
||||
LINK_LEXER(lmLatex);
|
||||
LINK_LEXER(lmPascal);
|
||||
LINK_LEXER(lmPerl);
|
||||
LINK_LEXER(lmPOV);
|
||||
LINK_LEXER(lmPython);
|
||||
LINK_LEXER(lmRuby);
|
||||
LINK_LEXER(lmSQL);
|
||||
|
@@ -30,7 +30,12 @@ static void ColouriseDocument(
|
||||
WordList *keywordlists[],
|
||||
Accessor &styler);
|
||||
|
||||
LexerModule lmAda(SCLEX_ADA, ColouriseDocument, "ada");
|
||||
static const char * const adaWordListDesc[] = {
|
||||
"Keywords",
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmAda(SCLEX_ADA, ColouriseDocument, "ada", NULL, adaWordListDesc);
|
||||
|
||||
/*
|
||||
* Implementation
|
||||
|
@@ -129,5 +129,14 @@ static void ColouriseAsmDoc(unsigned int startPos, int length, int initStyle, Wo
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
LexerModule lmAsm(SCLEX_ASM, ColouriseAsmDoc, "asm");
|
||||
static const char * const asmWordListDesc[] = {
|
||||
"CPU instructions",
|
||||
"FPU instructions",
|
||||
"Registers",
|
||||
"Directives",
|
||||
"Directive operands",
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmAsm(SCLEX_ASM, ColouriseAsmDoc, "asm", 0, asmWordListDesc);
|
||||
|
||||
|
@@ -30,18 +30,6 @@ static int classifyWordBullant(unsigned int start, unsigned int end, WordList &k
|
||||
else {
|
||||
if (keywords.InList(s)) {
|
||||
chAttr = SCE_C_WORD;
|
||||
/* if (strcmp(s, "end method") == 0 ||
|
||||
strcmp(s, "end case") == 0 ||
|
||||
strcmp(s, "end class") == 0 ||
|
||||
strcmp(s, "end debug") == 0 ||
|
||||
strcmp(s, "end test") == 0 ||
|
||||
strcmp(s, "end if") == 0 ||
|
||||
strcmp(s, "end lock") == 0 ||
|
||||
strcmp(s, "end transaction") == 0 ||
|
||||
strcmp(s, "end trap") == 0 ||
|
||||
strcmp(s, "end until") == 0 ||
|
||||
strcmp(s, "end while") == 0)
|
||||
lev = -1;*/
|
||||
if (strcmp(s, "end") == 0)
|
||||
lev = -1;
|
||||
else if (strcmp(s, "method") == 0 ||
|
||||
@@ -80,7 +68,6 @@ static void ColouriseBullantDoc(unsigned int startPos, int length, int initStyle
|
||||
char chNext = styler[startPos];
|
||||
unsigned int lengthDoc = startPos + length;
|
||||
int visibleChars = 0;
|
||||
// int blockChange = 0;
|
||||
styler.StartSegment(startPos);
|
||||
int endFoundThisLine = 0;
|
||||
for (unsigned int i = startPos; i < lengthDoc; i++) {
|
||||
@@ -230,4 +217,9 @@ static void ColouriseBullantDoc(unsigned int startPos, int length, int initStyle
|
||||
}
|
||||
}
|
||||
|
||||
LexerModule lmBullant(SCLEX_BULLANT, ColouriseBullantDoc, "bullant");
|
||||
static const char * const bullantWordListDesc[] = {
|
||||
"Keywords",
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmBullant(SCLEX_BULLANT, ColouriseBullantDoc, "bullant", 0, bullantWordListDesc);
|
||||
|
@@ -21,10 +21,8 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
|
||||
|
||||
static inline bool IsAWordChar(const unsigned int ch) {
|
||||
return (isalnum(ch) || ch == '-' || ch >= 161);
|
||||
return (isalnum(ch) || ch == '-' || ch == '_' || ch >= 161); // _ is not in fact correct CSS word-character
|
||||
}
|
||||
|
||||
inline bool IsCssOperator(const char ch) {
|
||||
@@ -73,6 +71,17 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
|
||||
if (sc.state == SCE_CSS_COMMENT)
|
||||
continue;
|
||||
|
||||
if (sc.state == SCE_CSS_DOUBLESTRING || sc.state == SCE_CSS_SINGLESTRING) {
|
||||
if (sc.ch != (sc.state == SCE_CSS_DOUBLESTRING ? '\"' : '\''))
|
||||
continue;
|
||||
unsigned int i = sc.currentPos;
|
||||
while (i && styler[i-1] == '\\')
|
||||
i--;
|
||||
if ((sc.currentPos - i) % 2 == 1)
|
||||
continue;
|
||||
sc.ForwardSetState(SCE_CSS_VALUE);
|
||||
}
|
||||
|
||||
if (sc.state == SCE_CSS_OPERATOR) {
|
||||
if (op == ' ') {
|
||||
unsigned int i = startPos;
|
||||
@@ -99,7 +108,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
|
||||
sc.SetState(SCE_CSS_DEFAULT);
|
||||
break;
|
||||
case ':':
|
||||
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID)
|
||||
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID)
|
||||
sc.SetState(SCE_CSS_PSEUDOCLASS);
|
||||
else if (lastState == SCE_CSS_IDENTIFIER || lastState == SCE_CSS_UNKNOWN_IDENTIFIER)
|
||||
sc.SetState(SCE_CSS_VALUE);
|
||||
@@ -169,19 +178,18 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
|
||||
}
|
||||
}
|
||||
|
||||
if (sc.ch != '.' && sc.ch != ':' && sc.ch != '#' && (sc.state == SCE_CSS_CLASS || sc.state == SCE_CSS_PSEUDOCLASS || sc.state == SCE_CSS_UNKNOWN_PSEUDOCLASS || sc.state == SCE_CSS_UNKNOWN_PSEUDOCLASS || sc.state == SCE_CSS_ID))
|
||||
if (sc.ch != '.' && sc.ch != ':' && sc.ch != '#' && (sc.state == SCE_CSS_CLASS || sc.state == SCE_CSS_PSEUDOCLASS || sc.state == SCE_CSS_UNKNOWN_PSEUDOCLASS || sc.state == SCE_CSS_ID))
|
||||
sc.SetState(SCE_CSS_TAG);
|
||||
|
||||
if (sc.Match('/', '*')) {
|
||||
lastStateC = sc.state;
|
||||
sc.SetState(SCE_CSS_COMMENT);
|
||||
sc.Forward();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (IsCssOperator(static_cast<char>(sc.ch))
|
||||
&& (sc.state != SCE_CSS_VALUE || sc.ch == ';' || sc.ch == '}' || sc.ch == '!')
|
||||
&& (sc.state != SCE_CSS_DIRECTIVE || sc.ch == ';' || sc.ch == '{')
|
||||
} else if (sc.state == SCE_CSS_VALUE && (sc.ch == '\"' || sc.ch == '\'')) {
|
||||
sc.SetState((sc.ch == '\"' ? SCE_CSS_DOUBLESTRING : SCE_CSS_SINGLESTRING));
|
||||
} else if (IsCssOperator(static_cast<char>(sc.ch))
|
||||
&& (sc.state != SCE_CSS_VALUE || sc.ch == ';' || sc.ch == '}' || sc.ch == '!')
|
||||
&& (sc.state != SCE_CSS_DIRECTIVE || sc.ch == ';' || sc.ch == '{')
|
||||
) {
|
||||
if (sc.state != SCE_CSS_OPERATOR)
|
||||
lastState = sc.state;
|
||||
@@ -243,4 +251,10 @@ static void FoldCSSDoc(unsigned int startPos, int length, int, WordList *[], Acc
|
||||
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
|
||||
}
|
||||
|
||||
LexerModule lmCss(SCLEX_CSS, ColouriseCssDoc, "css", FoldCSSDoc);
|
||||
static const char * const cssWordListDesc[] = {
|
||||
"Keywords",
|
||||
"Pseudo classes",
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmCss(SCLEX_CSS, ColouriseCssDoc, "css", FoldCSSDoc, cssWordListDesc);
|
||||
|
@@ -175,4 +175,10 @@ static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *k
|
||||
delete []buffer;
|
||||
}
|
||||
|
||||
LexerModule lmConf(SCLEX_CONF, ColouriseConfDoc, "conf");
|
||||
static const char * const confWordListDesc[] = {
|
||||
"Directives",
|
||||
"Parameters",
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmConf(SCLEX_CONF, ColouriseConfDoc, "conf", 0, confWordListDesc);
|
||||
|
@@ -208,4 +208,11 @@ static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordLi
|
||||
delete []buffer;
|
||||
}
|
||||
|
||||
LexerModule lmNncrontab(SCLEX_NNCRONTAB, ColouriseNncrontabDoc, "nncrontab");
|
||||
static const char * const cronWordListDesc[] = {
|
||||
"Section keywords and Forth words",
|
||||
"nnCrontab keywords",
|
||||
"Modifiers",
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmNncrontab(SCLEX_NNCRONTAB, ColouriseNncrontabDoc, "nncrontab", 0, cronWordListDesc);
|
||||
|
@@ -226,5 +226,10 @@ static void FoldEiffelDocKeyWords(unsigned int startPos, int length, int /* init
|
||||
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
|
||||
}
|
||||
|
||||
LexerModule lmEiffel(SCLEX_EIFFEL, ColouriseEiffelDoc, "eiffel", FoldEiffelDocIndent);
|
||||
LexerModule lmEiffelkw(SCLEX_EIFFELKW, ColouriseEiffelDoc, "eiffelkw", FoldEiffelDocKeyWords);
|
||||
static const char * const eiffelWordListDesc[] = {
|
||||
"Keywords",
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmEiffel(SCLEX_EIFFEL, ColouriseEiffelDoc, "eiffel", FoldEiffelDocIndent, eiffelWordListDesc);
|
||||
LexerModule lmEiffelkw(SCLEX_EIFFELKW, ColouriseEiffelDoc, "eiffelkw", FoldEiffelDocKeyWords, eiffelWordListDesc);
|
||||
|
@@ -192,4 +192,9 @@ static void FoldLispDoc(unsigned int startPos, int length, int /* initStyle */,
|
||||
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
|
||||
}
|
||||
|
||||
LexerModule lmLISP(SCLEX_LISP, ColouriseLispDoc, "lisp", FoldLispDoc);
|
||||
static const char * const lispWordListDesc[] = {
|
||||
"Keywords",
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmLISP(SCLEX_LISP, ColouriseLispDoc, "lisp", FoldLispDoc, lispWordListDesc);
|
||||
|
@@ -297,4 +297,14 @@ static void FoldLuaDoc(unsigned int startPos, int length, int /* initStyle */, W
|
||||
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
|
||||
}
|
||||
|
||||
LexerModule lmLua(SCLEX_LUA, ColouriseLuaDoc, "lua", FoldLuaDoc);
|
||||
static const char * const luaWordListDesc[] = {
|
||||
"Keywords",
|
||||
"Basic functions",
|
||||
"String & math functions",
|
||||
"I/O & system facilities",
|
||||
"XXX",
|
||||
"XXX",
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmLua(SCLEX_LUA, ColouriseLuaDoc, "lua", FoldLuaDoc, luaWordListDesc);
|
||||
|
@@ -165,4 +165,9 @@ static void FoldMatlabDoc(unsigned int startPos, int length, int,
|
||||
}
|
||||
}
|
||||
|
||||
LexerModule lmMatlab(SCLEX_MATLAB, ColouriseMatlabDoc, "matlab", FoldMatlabDoc);
|
||||
static const char * const matlabWordListDesc[] = {
|
||||
"Keywords",
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmMatlab(SCLEX_MATLAB, ColouriseMatlabDoc, "matlab", FoldMatlabDoc, matlabWordListDesc);
|
||||
|
@@ -20,6 +20,14 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
static bool Is0To9(char ch) {
|
||||
return (ch >= '0') && (ch <= '9');
|
||||
}
|
||||
|
||||
static bool Is1To9(char ch) {
|
||||
return (ch >= '1') && (ch <= '9');
|
||||
}
|
||||
|
||||
static inline bool AtEOL(Accessor &styler, unsigned int i) {
|
||||
return (styler[i] == '\n') ||
|
||||
((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n'));
|
||||
@@ -85,7 +93,7 @@ static void ColouriseBatchLine(
|
||||
while (offset < lengthLine) {
|
||||
if (state == SCE_BAT_DEFAULT && lineBuffer[offset] == '%') {
|
||||
styler.ColourTo(startLine + offset - 1, state);
|
||||
if (isdigit(lineBuffer[offset + 1])) {
|
||||
if (Is0To9(lineBuffer[offset + 1])) {
|
||||
styler.ColourTo(startLine + offset + 1, SCE_BAT_IDENTIFIER);
|
||||
offset += 2;
|
||||
} else if (lineBuffer[offset + 1] == '%' &&
|
||||
@@ -343,12 +351,17 @@ static void ColouriseMakeDoc(unsigned int startPos, int length, int, WordList *[
|
||||
}
|
||||
}
|
||||
|
||||
static bool strstart(char *haystack, char *needle) {
|
||||
return strncmp(haystack, needle, strlen(needle)) == 0;
|
||||
}
|
||||
|
||||
static void ColouriseErrorListLine(
|
||||
char *lineBuffer,
|
||||
unsigned int lengthLine,
|
||||
// unsigned int startLine,
|
||||
unsigned int endPos,
|
||||
Accessor &styler) {
|
||||
const int unRecognized = 99;
|
||||
if (lineBuffer[0] == '>') {
|
||||
// Command or return status
|
||||
styler.ColourTo(endPos, SCE_ERR_CMD);
|
||||
@@ -367,10 +380,17 @@ static void ColouriseErrorListLine(
|
||||
styler.ColourTo(endPos, SCE_ERR_PYTHON);
|
||||
} else if (strstr(lineBuffer, " in ") && strstr(lineBuffer, " on line ")) {
|
||||
styler.ColourTo(endPos, SCE_ERR_PHP);
|
||||
} else if (0 == strncmp(lineBuffer, "Error ", strlen("Error "))) {
|
||||
} else if ((strstart(lineBuffer, "Error ") ||
|
||||
strstart(lineBuffer, "Warning ")) &&
|
||||
strstr(lineBuffer, " at (") &&
|
||||
strstr(lineBuffer, ") : ") &&
|
||||
(strstr(lineBuffer, " at (") < strstr(lineBuffer, ") : "))) {
|
||||
// Intel Fortran Compiler error/warning message
|
||||
styler.ColourTo(endPos, SCE_ERR_IFC);
|
||||
} else if (strstart(lineBuffer, "Error ")) {
|
||||
// Borland error message
|
||||
styler.ColourTo(endPos, SCE_ERR_BORLAND);
|
||||
} else if (0 == strncmp(lineBuffer, "Warning ", strlen("Warning "))) {
|
||||
} else if (strstart(lineBuffer, "Warning ")) {
|
||||
// Borland warning message
|
||||
styler.ColourTo(endPos, SCE_ERR_BORLAND);
|
||||
} else if (strstr(lineBuffer, "at line " ) &&
|
||||
@@ -382,51 +402,84 @@ static void ColouriseErrorListLine(
|
||||
} else if (strstr(lineBuffer, " at " ) &&
|
||||
(strstr(lineBuffer, " at " ) < (lineBuffer + lengthLine)) &&
|
||||
strstr(lineBuffer, " line ") &&
|
||||
(strstr(lineBuffer, " line ") < (lineBuffer + lengthLine))) {
|
||||
(strstr(lineBuffer, " line ") < (lineBuffer + lengthLine)) &&
|
||||
(strstr(lineBuffer, " at " ) < (strstr(lineBuffer, " line ")))) {
|
||||
// perl error message
|
||||
styler.ColourTo(endPos, SCE_ERR_PERL);
|
||||
} else if ((memcmp(lineBuffer, " at ", 6) == 0) &&
|
||||
strstr(lineBuffer, ":line ")) {
|
||||
// A .NET traceback
|
||||
styler.ColourTo(endPos, SCE_ERR_NET);
|
||||
} else if (strstart(lineBuffer, "Line ") &&
|
||||
strstr(lineBuffer, ", file ")) {
|
||||
// Essential Lahey Fortran error message
|
||||
styler.ColourTo(endPos, SCE_ERR_ELF);
|
||||
} else {
|
||||
// Look for <filename>:<line>:message
|
||||
// Look for <filename>(line)message
|
||||
// Look for <filename>(line,pos)message
|
||||
// Look for GCC <filename>:<line>:message
|
||||
// Look for Microsoft <filename>(line) :message
|
||||
// Look for Microsoft <filename>(line,pos)message
|
||||
// Look for CTags \tmessage
|
||||
int state = 0;
|
||||
for (unsigned 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 == 0) && (lineBuffer[i] == '\t')) {
|
||||
state = 20;
|
||||
} else if ((state == 1) && isdigit(lineBuffer[i])) {
|
||||
state = 2;
|
||||
} else if ((state == 2) && (lineBuffer[i] == ':')) {
|
||||
state = 3;
|
||||
break;
|
||||
} else if ((state == 2) && !isdigit(lineBuffer[i])) {
|
||||
state = 99;
|
||||
} else if ((state == 10) && isdigit(lineBuffer[i])) {
|
||||
state = 11;
|
||||
} else if ((state == 11) && (lineBuffer[i] == ',')) {
|
||||
state = 14;
|
||||
} else if ((state == 11) && (lineBuffer[i] == ')')) {
|
||||
state = 12;
|
||||
} else if ((state == 12) && (lineBuffer[i] == ':')) {
|
||||
state = 13;
|
||||
} else if ((state == 14) && (lineBuffer[i] == ')')) {
|
||||
state = 15;
|
||||
break;
|
||||
} else if (((state == 11) || (state == 14)) && !((lineBuffer[i] == ' ') || isdigit(lineBuffer[i]))) {
|
||||
state = 99;
|
||||
} else if ((state == 20) && (lineBuffer[i-1] == '\t') &&
|
||||
((lineBuffer[i] == '/' && lineBuffer[i+1] == '^') || isdigit(lineBuffer[i]))) {
|
||||
state = 24;
|
||||
break;
|
||||
} else if ((state == 20) && ((lineBuffer[i] == '/') && (lineBuffer[i+1] == '^'))) {
|
||||
state = 21;
|
||||
char ch = lineBuffer[i];
|
||||
char chNext = ' ';
|
||||
if ((i+1) < lengthLine)
|
||||
chNext = lineBuffer[i+1];
|
||||
if (state == 0) {
|
||||
if (ch == ':') {
|
||||
// May be GCC
|
||||
if ((chNext != '\\') && (chNext != '/')) {
|
||||
// This check is not completely accurate as may be on
|
||||
// GTK+ with a file name that includes ':'.
|
||||
state = 1;
|
||||
}
|
||||
} else if ((ch == '(') && Is1To9(chNext)) {
|
||||
// May be Microsoft
|
||||
// Check againt '0' often removes phone numbers
|
||||
state = 10;
|
||||
} else if (ch == '\t') {
|
||||
// May be CTags
|
||||
state = 20;
|
||||
}
|
||||
} else if (state == 1) {
|
||||
state = Is1To9(ch) ? 2 : unRecognized;
|
||||
} else if (state == 2) {
|
||||
if (ch == ':') {
|
||||
state = 3; // :9.*: is GCC
|
||||
break;
|
||||
} else if (!Is0To9(ch)) {
|
||||
state = unRecognized;
|
||||
}
|
||||
} else if (state == 10) {
|
||||
state = Is0To9(ch) ? 11 : unRecognized;
|
||||
} else if (state == 11) {
|
||||
if (ch == ',') {
|
||||
state = 14;
|
||||
} else if (ch == ')') {
|
||||
state = 12;
|
||||
} else if ((ch != ' ') && !Is0To9(ch)) {
|
||||
state = unRecognized;
|
||||
}
|
||||
} else if (state == 12) {
|
||||
if ((ch == ' ') && (chNext == ':'))
|
||||
state = 13;
|
||||
else
|
||||
state = unRecognized;
|
||||
} else if (state == 14) {
|
||||
if (ch == ')') {
|
||||
state = 15;
|
||||
break;
|
||||
} else if ((ch != ' ') && !Is0To9(ch)) {
|
||||
state = unRecognized;
|
||||
}
|
||||
} else if (state == 20) {
|
||||
if ((lineBuffer[i-1] == '\t') &&
|
||||
((ch == '/' && lineBuffer[i+1] == '^') || Is0To9(ch))) {
|
||||
state = 24;
|
||||
break;
|
||||
} else if ((ch == '/') && (lineBuffer[i+1] == '^')) {
|
||||
state = 21;
|
||||
}
|
||||
} else if ((state == 21) && ((lineBuffer[i] == '$') && (lineBuffer[i+1] == '/'))) {
|
||||
state = 22;
|
||||
break;
|
||||
@@ -561,12 +614,21 @@ static void ColouriseLatexDoc(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
}
|
||||
}
|
||||
styler.ColourTo(lengthDoc, state);
|
||||
styler.ColourTo(lengthDoc-1, state);
|
||||
}
|
||||
|
||||
LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc, "batch");
|
||||
LexerModule lmDiff(SCLEX_DIFF, ColouriseDiffDoc, "diff");
|
||||
LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc, "props");
|
||||
LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc, "makefile");
|
||||
LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc, "errorlist");
|
||||
LexerModule lmLatex(SCLEX_LATEX, ColouriseLatexDoc, "latex");
|
||||
static const char * const batchWordListDesc[] = {
|
||||
"Keywords",
|
||||
0
|
||||
};
|
||||
|
||||
static const char * const emptyWordListDesc[] = {
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc, "batch", 0, batchWordListDesc);
|
||||
LexerModule lmDiff(SCLEX_DIFF, ColouriseDiffDoc, "diff", 0, emptyWordListDesc);
|
||||
LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc, "props", 0, emptyWordListDesc);
|
||||
LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc, "makefile", 0, emptyWordListDesc);
|
||||
LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc, "errorlist", 0, emptyWordListDesc);
|
||||
LexerModule lmLatex(SCLEX_LATEX, ColouriseLatexDoc, "latex", 0, emptyWordListDesc);
|
||||
|
222
contrib/src/stc/scintilla/src/LexPOV.cxx
Normal file
222
contrib/src/stc/scintilla/src/LexPOV.cxx
Normal file
@@ -0,0 +1,222 @@
|
||||
// Scintilla source code edit control
|
||||
/** @file LexPOV.cxx
|
||||
** Lexer for POV-Ray, based on lexer for C++.
|
||||
**/
|
||||
// Copyright 2003 by Steven te Brinke <steven.t.b@zonnet.nl>
|
||||
// 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 "StyleContext.h"
|
||||
#include "KeyWords.h"
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#define KEYWORD_BOXHEADER 1
|
||||
#define KEYWORD_FOLDCONTRACTED 2
|
||||
|
||||
static inline bool IsAWordChar(const int ch) {
|
||||
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
|
||||
}
|
||||
|
||||
static inline bool IsAWordStart(const int ch) {
|
||||
return (ch < 0x80) && (isalnum(ch) || ch == '_');
|
||||
}
|
||||
|
||||
static inline bool IsStateComment(const int state) {
|
||||
return ((state == SCE_POV_COMMENT) ||
|
||||
(state == SCE_POV_COMMENTLINE) ||
|
||||
(state == SCE_POV_COMMENTDOC));
|
||||
}
|
||||
|
||||
static inline bool IsStateString(const int state) {
|
||||
return ((state == SCE_POV_STRING));
|
||||
}
|
||||
|
||||
static void ColourisePOVDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
|
||||
WordList &keywords = *keywordlists[0];
|
||||
WordList &keywords2 = *keywordlists[1];
|
||||
|
||||
// Do not leak onto next line
|
||||
/*if (initStyle == SCE_POV_STRINGEOL)
|
||||
initStyle = SCE_POV_DEFAULT;*/
|
||||
|
||||
StyleContext sc(startPos, length, initStyle, styler);
|
||||
|
||||
bool caseSensitive = styler.GetPropertyInt("pov.case.sensitive", 1) != 0;
|
||||
|
||||
for (; sc.More(); sc.Forward()) {
|
||||
|
||||
/*if (sc.atLineStart && (sc.state == SCE_POV_STRING)) {
|
||||
// Prevent SCE_POV_STRINGEOL from leaking back to previous line
|
||||
sc.SetState(SCE_POV_STRING);
|
||||
}*/
|
||||
|
||||
// Handle line continuation generically.
|
||||
if (sc.ch == '\\') {
|
||||
if (sc.chNext == '\n' || sc.chNext == '\r') {
|
||||
sc.Forward();
|
||||
if (sc.ch == '\r' && sc.chNext == '\n') {
|
||||
sc.Forward();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Determine if the current state should terminate.
|
||||
if (sc.state == SCE_POV_OPERATOR || sc.state == SCE_POV_BRACE) {
|
||||
sc.SetState(SCE_POV_DEFAULT);
|
||||
} else if (sc.state == SCE_POV_NUMBER) {
|
||||
if (!IsADigit(sc.ch) || sc.ch != '.') {
|
||||
sc.SetState(SCE_POV_DEFAULT);
|
||||
}
|
||||
} else if (sc.state == SCE_POV_IDENTIFIER) {
|
||||
if (!IsAWordChar(sc.ch) || (sc.ch == '.')) {
|
||||
char s[100];
|
||||
if (caseSensitive) {
|
||||
sc.GetCurrent(s, sizeof(s));
|
||||
} else {
|
||||
sc.GetCurrentLowered(s, sizeof(s));
|
||||
}
|
||||
if (keywords.InList(s)) {
|
||||
sc.ChangeState(SCE_POV_WORD);
|
||||
} else if (keywords2.InList(s)) {
|
||||
sc.ChangeState(SCE_POV_WORD2);
|
||||
}
|
||||
sc.SetState(SCE_POV_DEFAULT);
|
||||
}
|
||||
} else if (sc.state == SCE_POV_COMMENT) {
|
||||
if (sc.Match('*', '/')) {
|
||||
sc.Forward();
|
||||
sc.ForwardSetState(SCE_POV_DEFAULT);
|
||||
}
|
||||
} else if (sc.state == SCE_POV_COMMENTDOC) {
|
||||
if (sc.Match('*', '/')) {
|
||||
sc.Forward();
|
||||
sc.ForwardSetState(SCE_POV_DEFAULT);
|
||||
}
|
||||
} else if (sc.state == SCE_POV_COMMENTLINE) {
|
||||
if (sc.atLineEnd) {
|
||||
sc.SetState(SCE_POV_DEFAULT);
|
||||
}
|
||||
} else if (sc.state == SCE_POV_STRING) {
|
||||
if (sc.ch == '\\') {
|
||||
if (sc.chNext == '\"' || sc.chNext == '\\') {
|
||||
sc.Forward();
|
||||
}
|
||||
} else if (sc.ch == '\"') {
|
||||
sc.ForwardSetState(SCE_POV_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
// Determine if a new state should be entered.
|
||||
if (sc.state == SCE_POV_DEFAULT) {
|
||||
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
|
||||
sc.SetState(SCE_POV_NUMBER);
|
||||
} else if (IsAWordStart(sc.ch) || (sc.ch == '#')) {
|
||||
sc.SetState(SCE_POV_IDENTIFIER);
|
||||
} else if (sc.Match('/', '*')) {
|
||||
sc.SetState(SCE_POV_COMMENT);
|
||||
sc.Forward(); // Eat the * so it isn't used for the end of the comment
|
||||
} else if (sc.Match('/', '/')) {
|
||||
sc.SetState(SCE_POV_COMMENTLINE);
|
||||
} else if (sc.ch == '\"') {
|
||||
sc.SetState(SCE_POV_STRING);
|
||||
//} else if (isoperator(static_cast<char>(sc.ch))) {
|
||||
} else if (sc.ch == '+' || sc.ch == '-' || sc.ch == '*' || sc.ch == '/' || sc.ch == '=' || sc.ch == '<' || sc.ch == '>' || sc.ch == '&' || sc.ch == '|' || sc.ch == '!' || sc.ch == '?' || sc.ch == ':') {
|
||||
sc.SetState(SCE_POV_OPERATOR);
|
||||
} else if (sc.ch == '{' || sc.ch == '}') {
|
||||
sc.SetState(SCE_POV_BRACE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static bool IsStreamCommentStyle(int style) {
|
||||
return style == SCE_POV_COMMENT ||
|
||||
style == SCE_POV_COMMENTDOC;
|
||||
}
|
||||
|
||||
static void FoldNoBoxPOVDoc(unsigned int startPos, int length, int initStyle,
|
||||
Accessor &styler) {
|
||||
bool foldComment = styler.GetPropertyInt("fold.comment", 1) != 0;
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
unsigned int endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||
int levelCurrent = levelPrev;
|
||||
char chNext = styler[startPos];
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
int style = initStyle;
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int stylePrev = style;
|
||||
style = styleNext;
|
||||
styleNext = styler.StyleAt(i + 1);
|
||||
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
|
||||
if (foldComment && IsStreamCommentStyle(style)) {
|
||||
if (!IsStreamCommentStyle(stylePrev)) {
|
||||
levelCurrent++;
|
||||
} else if (!IsStreamCommentStyle(styleNext) && !atEOL) {
|
||||
// Comments don't end at end of line and the next character may be unstyled.
|
||||
levelCurrent--;
|
||||
}
|
||||
}
|
||||
if (style == SCE_POV_BRACE) {
|
||||
if (ch == '{') {
|
||||
levelCurrent++;
|
||||
} else if (ch == '}') {
|
||||
levelCurrent--;
|
||||
}
|
||||
}
|
||||
if (atEOL) {
|
||||
int lev = levelPrev;
|
||||
if (visibleChars == 0 && foldCompact)
|
||||
lev |= SC_FOLDLEVELWHITEFLAG;
|
||||
if ((levelCurrent > levelPrev) && (visibleChars > 0))
|
||||
lev |= SC_FOLDLEVELHEADERFLAG;
|
||||
if (lev != styler.LevelAt(lineCurrent)) {
|
||||
styler.SetLevel(lineCurrent, lev);
|
||||
}
|
||||
lineCurrent++;
|
||||
levelPrev = levelCurrent;
|
||||
visibleChars = 0;
|
||||
}
|
||||
if (!isspacechar(ch))
|
||||
visibleChars++;
|
||||
}
|
||||
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
|
||||
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
|
||||
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
|
||||
}
|
||||
|
||||
static void FoldPOVDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) {
|
||||
FoldNoBoxPOVDoc(startPos, length, initStyle, styler);
|
||||
}
|
||||
|
||||
static const char * const POVWordLists[] = {
|
||||
"Primary keywords and identifiers",
|
||||
"Secondary keywords and identifiers",
|
||||
0,
|
||||
};
|
||||
|
||||
static void ColourisePOVDocSensitive(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
ColourisePOVDoc(startPos, length, initStyle, keywordlists, styler);
|
||||
}
|
||||
|
||||
LexerModule lmPOV(SCLEX_POV, ColourisePOVDocSensitive, "pov", FoldPOVDoc, POVWordLists);
|
@@ -339,4 +339,10 @@ static void FoldPascalDoc(unsigned int startPos, int length, int initStyle, Word
|
||||
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
|
||||
}
|
||||
|
||||
LexerModule lmPascal(SCLEX_PASCAL, ColourisePascalDoc, "pascal", FoldPascalDoc);
|
||||
static const char * const pascalWordListDesc[] = {
|
||||
"Keywords",
|
||||
"Classwords",
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmPascal(SCLEX_PASCAL, ColourisePascalDoc, "pascal", FoldPascalDoc, pascalWordListDesc);
|
||||
|
@@ -715,7 +715,7 @@ static void FoldPerlDoc(unsigned int startPos, int length, int, WordList *[],
|
||||
}
|
||||
|
||||
static const char * const perlWordListDesc[] = {
|
||||
"Perl keywords",
|
||||
"Keywords",
|
||||
0
|
||||
};
|
||||
|
||||
|
@@ -431,7 +431,7 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse
|
||||
}
|
||||
|
||||
static const char * const pythonWordListDesc[] = {
|
||||
"Python keywords",
|
||||
"Keywords",
|
||||
0
|
||||
};
|
||||
|
||||
|
@@ -352,4 +352,9 @@ static void FoldRbDoc(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
}
|
||||
|
||||
LexerModule lmRuby(SCLEX_RUBY, ColouriseRbDoc, "ruby", FoldRbDoc);
|
||||
static const char * const rubyWordListDesc[] = {
|
||||
"Keywords",
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmRuby(SCLEX_RUBY, ColouriseRbDoc, "ruby", FoldRbDoc, rubyWordListDesc);
|
||||
|
@@ -155,4 +155,9 @@ static void ColouriseSQLDoc(unsigned int startPos, int length,
|
||||
styler.ColourTo(lengthDoc - 1, state);
|
||||
}
|
||||
|
||||
LexerModule lmSQL(SCLEX_SQL, ColouriseSQLDoc, "sql");
|
||||
static const char * const sqlWordListDesc[] = {
|
||||
"Keywords",
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmSQL(SCLEX_SQL, ColouriseSQLDoc, "sql", 0, sqlWordListDesc);
|
||||
|
@@ -116,7 +116,7 @@ static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
|
||||
} else if (sc.ch == '#') {
|
||||
int n = 1;
|
||||
int chSeek = ' ';
|
||||
while (chSeek == ' ' || chSeek == '\t') {
|
||||
while ((n < 100) && (chSeek == ' ' || chSeek == '\t')) {
|
||||
chSeek = sc.GetRelative(n);
|
||||
n++;
|
||||
}
|
||||
@@ -200,6 +200,11 @@ static void ColouriseVBScriptDoc(unsigned int startPos, int length, int initStyl
|
||||
ColouriseVBDoc(startPos, length, initStyle, keywordlists, styler, true);
|
||||
}
|
||||
|
||||
LexerModule lmVB(SCLEX_VB, ColouriseVBNetDoc, "vb", FoldVBDoc);
|
||||
LexerModule lmVBScript(SCLEX_VBSCRIPT, ColouriseVBScriptDoc, "vbscript", FoldVBDoc);
|
||||
static const char * const vbWordListDesc[] = {
|
||||
"Keywords",
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmVB(SCLEX_VB, ColouriseVBNetDoc, "vb", FoldVBDoc, vbWordListDesc);
|
||||
LexerModule lmVBScript(SCLEX_VBSCRIPT, ColouriseVBScriptDoc, "vbscript", FoldVBDoc, vbWordListDesc);
|
||||
|
||||
|
@@ -37,6 +37,7 @@ public:
|
||||
markType = SC_MARK_CIRCLE;
|
||||
fore = ColourDesired(0,0,0);
|
||||
back = ColourDesired(0xff,0xff,0xff);
|
||||
delete pxpm;
|
||||
pxpm = NULL;
|
||||
return *this;
|
||||
}
|
||||
|
@@ -185,7 +185,8 @@ SString PropSet::GetExpanded(const char *key) {
|
||||
SString PropSet::Expand(const char *withVars) {
|
||||
char *base = StringDup(withVars);
|
||||
char *cpvar = strstr(base, "$(");
|
||||
while (cpvar) {
|
||||
int maxExpands = 1000; // Avoid infinite expansion of recursive definitions
|
||||
while (cpvar && (maxExpands > 0)) {
|
||||
char *cpendvar = strchr(cpvar, ')');
|
||||
if (cpendvar) {
|
||||
int lenvar = cpendvar - cpvar - 2; // Subtract the $()
|
||||
@@ -201,6 +202,7 @@ SString PropSet::Expand(const char *withVars) {
|
||||
base = newbase;
|
||||
}
|
||||
cpvar = strstr(base, "$(");
|
||||
maxExpands--;
|
||||
}
|
||||
SString sret = base;
|
||||
delete []base;
|
||||
@@ -304,7 +306,8 @@ SString PropSet::GetWild(const char *keybase, const char *filename) {
|
||||
SString PropSet::GetNewExpand(const char *keybase, const char *filename) {
|
||||
char *base = StringDup(GetWild(keybase, filename).c_str());
|
||||
char *cpvar = strstr(base, "$(");
|
||||
while (cpvar) {
|
||||
int maxExpands = 1000; // Avoid infinite expansion of recursive definitions
|
||||
while (cpvar && (maxExpands > 0)) {
|
||||
char *cpendvar = strchr(cpvar, ')');
|
||||
if (cpendvar) {
|
||||
int lenvar = cpendvar - cpvar - 2; // Subtract the $()
|
||||
@@ -320,6 +323,7 @@ SString PropSet::GetNewExpand(const char *keybase, const char *filename) {
|
||||
base = newbase;
|
||||
}
|
||||
cpvar = strstr(base, "$(");
|
||||
maxExpands--;
|
||||
}
|
||||
SString sret = base;
|
||||
delete []base;
|
||||
|
@@ -30,8 +30,20 @@
|
||||
* Modification history:
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.5.2.1 2003/04/08 22:40:19 RD
|
||||
* Updated wxSTC to Scintilla 1.51
|
||||
* Revision 1.5.2.2 2003/04/19 19:56:40 RD
|
||||
* Updated Scintilla to 1.52
|
||||
*
|
||||
* Revision 1.9 2003/03/21 10:36:08 nyamatongwe
|
||||
* Detect patterns too long in regular expression search.
|
||||
*
|
||||
* Revision 1.8 2003/03/04 10:53:59 nyamatongwe
|
||||
* Patch from Jakub to optionally implement more POSIX compatible regular
|
||||
* expressions. \(..\) changes to (..)
|
||||
* Fixes problem where find previous would not find earlier matches on same
|
||||
* line.
|
||||
*
|
||||
* Revision 1.8 2003/03/03 20:12:56 vrana
|
||||
* Added posix syntax.
|
||||
*
|
||||
* Revision 1.7 2002/09/28 00:33:28 nyamatongwe
|
||||
* Fixed problem with character ranges caused by expansion to 8 bits.
|
||||
@@ -335,10 +347,11 @@ const char escapeValue(char ch) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *RESearch::Compile(const char *pat, int length, bool caseSensitive) {
|
||||
const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, bool posix) {
|
||||
char *mp=nfa; /* nfa pointer */
|
||||
char *lp; /* saved pointer.. */
|
||||
char *sp=nfa; /* another one.. */
|
||||
char *mpMax = mp + MAXNFA - BITBLK - 10;
|
||||
|
||||
int tagi = 0; /* tag stack index */
|
||||
int tagc = 1; /* actual tag count */
|
||||
@@ -356,6 +369,8 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive) {
|
||||
|
||||
const char *p=pat; /* pattern pointer */
|
||||
for (int i=0; i<length; i++, p++) {
|
||||
if (mp > mpMax)
|
||||
return badpat("Pattern too long");
|
||||
lp = mp;
|
||||
switch(*p) {
|
||||
|
||||
@@ -470,25 +485,6 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive) {
|
||||
i++;
|
||||
switch(*++p) {
|
||||
|
||||
case '(':
|
||||
if (tagc < MAXTAG) {
|
||||
tagstk[++tagi] = tagc;
|
||||
*mp++ = BOT;
|
||||
*mp++ = static_cast<char>(tagc++);
|
||||
}
|
||||
else
|
||||
return badpat("Too many \\(\\) pairs");
|
||||
break;
|
||||
case ')':
|
||||
if (*sp == BOT)
|
||||
return badpat("Null pattern inside \\(\\)");
|
||||
if (tagi > 0) {
|
||||
*mp++ = static_cast<char>(EOT);
|
||||
*mp++ = static_cast<char>(tagstk[tagi--]);
|
||||
}
|
||||
else
|
||||
return badpat("Unmatched \\)");
|
||||
break;
|
||||
case '<':
|
||||
*mp++ = BOW;
|
||||
break;
|
||||
@@ -527,13 +523,49 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive) {
|
||||
*mp++ = escapeValue(*p);
|
||||
break;
|
||||
default:
|
||||
*mp++ = CHR;
|
||||
*mp++ = *p;
|
||||
if (!posix && *p == '(') {
|
||||
if (tagc < MAXTAG) {
|
||||
tagstk[++tagi] = tagc;
|
||||
*mp++ = BOT;
|
||||
*mp++ = static_cast<char>(tagc++);
|
||||
}
|
||||
else
|
||||
return badpat("Too many \\(\\) pairs");
|
||||
} else if (!posix && *p == ')') {
|
||||
if (*sp == BOT)
|
||||
return badpat("Null pattern inside \\(\\)");
|
||||
if (tagi > 0) {
|
||||
*mp++ = static_cast<char>(EOT);
|
||||
*mp++ = static_cast<char>(tagstk[tagi--]);
|
||||
}
|
||||
else
|
||||
return badpat("Unmatched \\)");
|
||||
} else {
|
||||
*mp++ = CHR;
|
||||
*mp++ = *p;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default : /* an ordinary char */
|
||||
if (caseSensitive) {
|
||||
if (posix && *p == '(') {
|
||||
if (tagc < MAXTAG) {
|
||||
tagstk[++tagi] = tagc;
|
||||
*mp++ = BOT;
|
||||
*mp++ = static_cast<char>(tagc++);
|
||||
}
|
||||
else
|
||||
return badpat("Too many () pairs");
|
||||
} else if (posix && *p == ')') {
|
||||
if (*sp == BOT)
|
||||
return badpat("Null pattern inside ()");
|
||||
if (tagi > 0) {
|
||||
*mp++ = static_cast<char>(EOT);
|
||||
*mp++ = static_cast<char>(tagstk[tagi--]);
|
||||
}
|
||||
else
|
||||
return badpat("Unmatched )");
|
||||
} else if (caseSensitive) {
|
||||
*mp++ = CHR;
|
||||
*mp++ = *p;
|
||||
} else {
|
||||
@@ -548,7 +580,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive) {
|
||||
sp = lp;
|
||||
}
|
||||
if (tagi > 0)
|
||||
return badpat("Unmatched \\(");
|
||||
return badpat((posix ? "Unmatched (" : "Unmatched \\("));
|
||||
*mp = END;
|
||||
sta = OKP;
|
||||
return 0;
|
||||
|
@@ -32,7 +32,7 @@ public:
|
||||
bool GrabMatches(CharacterIndexer &ci);
|
||||
void ChSet(char c);
|
||||
void ChSetWithCase(char c, bool caseSensitive);
|
||||
const char *Compile(const char *pat, int length, bool caseSensitive);
|
||||
const char *Compile(const char *pat, int length, bool caseSensitive, bool posix);
|
||||
int Execute(CharacterIndexer &ci, int lp, int endp);
|
||||
void ModifyWord(char *s);
|
||||
int Substitute(CharacterIndexer &ci, char *src, char *dst);
|
||||
|
@@ -307,6 +307,7 @@ void ScintillaBase::AutoCompleteCharacterDeleted() {
|
||||
void ScintillaBase::AutoCompleteCompleted() {
|
||||
int item = ac.lb->GetSelection();
|
||||
char selected[1000];
|
||||
selected[0] = '\0';
|
||||
if (item != -1) {
|
||||
ac.lb->GetValue(item, selected, sizeof(selected));
|
||||
}
|
||||
@@ -344,6 +345,36 @@ void ScintillaBase::AutoCompleteCompleted() {
|
||||
pdoc->EndUndoAction();
|
||||
}
|
||||
|
||||
void ScintillaBase::CallTipShow(Point pt, const char *defn) {
|
||||
AutoCompleteCancel();
|
||||
pt.y += vs.lineHeight;
|
||||
PRectangle rc = ct.CallTipStart(currentPos, pt,
|
||||
defn,
|
||||
vs.styles[STYLE_DEFAULT].fontName,
|
||||
vs.styles[STYLE_DEFAULT].sizeZoomed,
|
||||
IsUnicodeMode(),
|
||||
wMain);
|
||||
// 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, wMain);
|
||||
ct.wCallTip.Show();
|
||||
}
|
||||
|
||||
void ScintillaBase::CallTipClick() {
|
||||
SCNotification scn;
|
||||
scn.nmhdr.code = SCN_CALLTIPCLICK;
|
||||
scn.position = ct.clickPlace;
|
||||
NotifyParent(scn);
|
||||
}
|
||||
|
||||
void ScintillaBase::ContextMenu(Point pt) {
|
||||
if (displayPopupMenu) {
|
||||
bool writable = !WndProc(SCI_GETREADONLY, 0, 0);
|
||||
@@ -525,30 +556,9 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
|
||||
case SCI_AUTOCGETTYPESEPARATOR:
|
||||
return ac.GetTypesep();
|
||||
|
||||
case SCI_CALLTIPSHOW: {
|
||||
AutoCompleteCancel();
|
||||
if (!ct.wCallTip.Created()) {
|
||||
Point pt = LocationFromPosition(wParam);
|
||||
pt.y += vs.lineHeight;
|
||||
PRectangle rc = ct.CallTipStart(currentPos, pt,
|
||||
reinterpret_cast<char *>(lParam),
|
||||
vs.styles[STYLE_DEFAULT].fontName,
|
||||
vs.styles[STYLE_DEFAULT].sizeZoomed,
|
||||
IsUnicodeMode());
|
||||
// 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, wMain);
|
||||
ct.wCallTip.Show();
|
||||
}
|
||||
}
|
||||
case SCI_CALLTIPSHOW:
|
||||
CallTipShow(LocationFromPosition(wParam),
|
||||
reinterpret_cast<const char *>(lParam));
|
||||
break;
|
||||
|
||||
case SCI_CALLTIPCANCEL:
|
||||
@@ -570,6 +580,16 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
|
||||
InvalidateStyleRedraw();
|
||||
break;
|
||||
|
||||
case SCI_CALLTIPSETFORE:
|
||||
ct.colourUnSel = ColourDesired(wParam);
|
||||
InvalidateStyleRedraw();
|
||||
break;
|
||||
|
||||
case SCI_CALLTIPSETFOREHLT:
|
||||
ct.colourSel = ColourDesired(wParam);
|
||||
InvalidateStyleRedraw();
|
||||
break;
|
||||
|
||||
case SCI_USEPOPUP:
|
||||
displayPopupMenu = wParam != 0;
|
||||
break;
|
||||
|
@@ -71,6 +71,8 @@ protected:
|
||||
void AutoCompleteMoveToCurrentWord();
|
||||
static void AutoCompleteDoubleClick(void* p);
|
||||
|
||||
void CallTipClick();
|
||||
void CallTipShow(Point pt, const char *defn);
|
||||
virtual void CreateCallTipWindow(PRectangle rc) = 0;
|
||||
|
||||
virtual void AddToPopUp(const char *label, int cmd=0, bool enabled=true) = 0;
|
||||
|
@@ -16,13 +16,13 @@ Style::Style() {
|
||||
aliasOfDefaultFont = true;
|
||||
Clear(ColourDesired(0, 0, 0), ColourDesired(0xff, 0xff, 0xff),
|
||||
Platform::DefaultFontSize(), 0, SC_CHARSET_DEFAULT,
|
||||
false, false, false, false, caseMixed, true, true);
|
||||
false, false, false, false, caseMixed, true, true, false);
|
||||
}
|
||||
|
||||
Style::Style(const Style &source) {
|
||||
Clear(ColourDesired(0, 0, 0), ColourDesired(0xff, 0xff, 0xff),
|
||||
0, 0, 0,
|
||||
false, false, false, false, caseMixed, true, true);
|
||||
false, false, false, false, caseMixed, true, true, false);
|
||||
fore.desired = source.fore.desired;
|
||||
back.desired = source.back.desired;
|
||||
characterSet = source.characterSet;
|
||||
@@ -34,6 +34,7 @@ Style::Style(const Style &source) {
|
||||
caseForce = source.caseForce;
|
||||
visible = source.visible;
|
||||
changeable = source.changeable;
|
||||
hotspot = source.hotspot;
|
||||
}
|
||||
|
||||
Style::~Style() {
|
||||
@@ -49,7 +50,7 @@ Style &Style::operator=(const Style &source) {
|
||||
return * this;
|
||||
Clear(ColourDesired(0, 0, 0), ColourDesired(0xff, 0xff, 0xff),
|
||||
0, 0, SC_CHARSET_DEFAULT,
|
||||
false, false, false, false, caseMixed, true, true);
|
||||
false, false, false, false, caseMixed, true, true, false);
|
||||
fore.desired = source.fore.desired;
|
||||
back.desired = source.back.desired;
|
||||
characterSet = source.characterSet;
|
||||
@@ -68,7 +69,7 @@ void Style::Clear(ColourDesired fore_, ColourDesired back_, int size_,
|
||||
const char *fontName_, int characterSet_,
|
||||
bool bold_, bool italic_, bool eolFilled_,
|
||||
bool underline_, ecaseForced caseForce_,
|
||||
bool visible_, bool changeable_) {
|
||||
bool visible_, bool changeable_, bool hotspot_) {
|
||||
fore.desired = fore_;
|
||||
back.desired = back_;
|
||||
characterSet = characterSet_;
|
||||
@@ -81,6 +82,7 @@ void Style::Clear(ColourDesired fore_, ColourDesired back_, int size_,
|
||||
caseForce = caseForce_;
|
||||
visible = visible_;
|
||||
changeable = changeable_;
|
||||
hotspot = hotspot_;
|
||||
if (aliasOfDefaultFont)
|
||||
font.SetID(0);
|
||||
else
|
||||
@@ -101,7 +103,8 @@ void Style::ClearTo(const Style &source) {
|
||||
source.underline,
|
||||
source.caseForce,
|
||||
source.visible,
|
||||
source.changeable);
|
||||
source.changeable,
|
||||
source.hotspot);
|
||||
}
|
||||
|
||||
bool Style::EquivalentFontTo(const Style *other) const {
|
||||
|
@@ -26,6 +26,7 @@ public:
|
||||
ecaseForced caseForce;
|
||||
bool visible;
|
||||
bool changeable;
|
||||
bool hotspot;
|
||||
|
||||
Font font;
|
||||
int sizeZoomed;
|
||||
@@ -45,7 +46,7 @@ public:
|
||||
const char *fontName_, int characterSet_,
|
||||
bool bold_, bool italic_, bool eolFilled_,
|
||||
bool underline_, ecaseForced caseForce_,
|
||||
bool visible_, bool changeable_);
|
||||
bool visible_, bool changeable_, bool hotspot_);
|
||||
void ClearTo(const Style &source);
|
||||
bool EquivalentFontTo(const Style *other) const;
|
||||
void Realise(Surface &surface, int zoomLevel, Style *defaultStyle = 0);
|
||||
|
@@ -74,7 +74,7 @@ public:
|
||||
if (ch >= 0x100)
|
||||
currentPos++;
|
||||
ch = chNext;
|
||||
GetNextChar(currentPos);
|
||||
GetNextChar(currentPos + ((ch >= 0x100) ? 1 : 0));
|
||||
} else {
|
||||
atLineStart = false;
|
||||
chPrev = ' ';
|
||||
|
@@ -79,6 +79,12 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
|
||||
foldmarginHighlightColourSet = source.foldmarginHighlightColourSet;
|
||||
foldmarginHighlightColour.desired = source.foldmarginHighlightColour.desired;
|
||||
|
||||
hotspotForegroundSet = source.hotspotForegroundSet;
|
||||
hotspotForeground.desired = source.hotspotForeground.desired;
|
||||
hotspotBackgroundSet = source.hotspotBackgroundSet;
|
||||
hotspotBackground.desired = source.hotspotBackground.desired;
|
||||
hotspotUnderline = source.hotspotUnderline;
|
||||
|
||||
whitespaceForegroundSet = source.whitespaceForegroundSet;
|
||||
whitespaceForeground.desired = source.whitespaceForeground.desired;
|
||||
whitespaceBackgroundSet = source.whitespaceBackgroundSet;
|
||||
@@ -153,6 +159,12 @@ void ViewStyle::Init() {
|
||||
caretWidth = 1;
|
||||
someStylesProtected = false;
|
||||
|
||||
hotspotForegroundSet = false;
|
||||
hotspotForeground.desired = ColourDesired(0, 0, 0xff);
|
||||
hotspotBackgroundSet = false;
|
||||
hotspotBackground.desired = ColourDesired(0xff, 0xff, 0xff);
|
||||
hotspotUnderline = true;
|
||||
|
||||
leftMarginWidth = 1;
|
||||
rightMarginWidth = 1;
|
||||
ms[0].symbol = false;
|
||||
@@ -206,6 +218,8 @@ void ViewStyle::RefreshColourPalette(Palette &pal, bool want) {
|
||||
pal.WantFind(caretcolour, want);
|
||||
pal.WantFind(caretLineBackground, want);
|
||||
pal.WantFind(edgecolour, want);
|
||||
pal.WantFind(hotspotForeground, want);
|
||||
pal.WantFind(hotspotBackground, want);
|
||||
}
|
||||
|
||||
void ViewStyle::Refresh(Surface &surface) {
|
||||
@@ -248,7 +262,7 @@ void ViewStyle::ResetDefaultStyle() {
|
||||
ColourDesired(0xff,0xff,0xff),
|
||||
Platform::DefaultFontSize(), fontNames.Save(Platform::DefaultFont()),
|
||||
SC_CHARSET_DEFAULT,
|
||||
false, false, false, false, Style::caseMixed, true, true);
|
||||
false, false, false, false, Style::caseMixed, true, true, false);
|
||||
}
|
||||
|
||||
void ViewStyle::ClearStyles() {
|
||||
|
@@ -63,6 +63,11 @@ public:
|
||||
ColourPair foldmarginColour;
|
||||
bool foldmarginHighlightColourSet;
|
||||
ColourPair foldmarginHighlightColour;
|
||||
bool hotspotForegroundSet;
|
||||
ColourPair hotspotForeground;
|
||||
bool hotspotBackgroundSet;
|
||||
ColourPair hotspotBackground;
|
||||
bool hotspotUnderline;
|
||||
/// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin
|
||||
enum { margins=3 };
|
||||
int leftMarginWidth; ///< Spacing margin on left of text
|
||||
|
@@ -85,6 +85,10 @@ DEFINE_EVENT_TYPE( wxEVT_STC_START_DRAG )
|
||||
DEFINE_EVENT_TYPE( wxEVT_STC_DRAG_OVER )
|
||||
DEFINE_EVENT_TYPE( wxEVT_STC_DO_DROP )
|
||||
DEFINE_EVENT_TYPE( wxEVT_STC_ZOOM )
|
||||
DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_CLICK )
|
||||
DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_DCLICK )
|
||||
DEFINE_EVENT_TYPE( wxEVT_STC_CALLTIP_CLICK )
|
||||
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
|
||||
@@ -573,6 +577,11 @@ void wxStyledTextCtrl::StyleSetCharacterSet(int style, int characterSet) {
|
||||
SendMsg(2066, style, characterSet);
|
||||
}
|
||||
|
||||
// Set a style to be a hotspot or not.
|
||||
void wxStyledTextCtrl::StyleSetHotSpot(int style, bool hotspot) {
|
||||
SendMsg(2409, style, hotspot);
|
||||
}
|
||||
|
||||
// Set the foreground colour of the selection and whether to use this setting.
|
||||
void wxStyledTextCtrl::SetSelForeground(bool useSetting, const wxColour& fore) {
|
||||
SendMsg(2067, useSetting, wxColourAsLong(fore));
|
||||
@@ -1348,6 +1357,16 @@ void wxStyledTextCtrl::CallTipSetBackground(const wxColour& back) {
|
||||
SendMsg(2205, wxColourAsLong(back), 0);
|
||||
}
|
||||
|
||||
// Set the foreground colour for the call tip.
|
||||
void wxStyledTextCtrl::CallTipSetForeground(const wxColour& fore) {
|
||||
SendMsg(2206, wxColourAsLong(fore), 0);
|
||||
}
|
||||
|
||||
// Set the foreground colour for the highlighted part of the call tip.
|
||||
void wxStyledTextCtrl::CallTipSetForegroundHighlight(const wxColour& fore) {
|
||||
SendMsg(2207, wxColourAsLong(fore), 0);
|
||||
}
|
||||
|
||||
// Find the display line of a document line taking hidden lines into account.
|
||||
int wxStyledTextCtrl::VisibleFromDocLine(int line) {
|
||||
return SendMsg(2220, line, 0);
|
||||
@@ -1553,7 +1572,6 @@ void wxStyledTextCtrl::TargetFromSelection() {
|
||||
}
|
||||
|
||||
// Join the lines in the target.
|
||||
// This is an experimental feature and may be changed or removed.
|
||||
void wxStyledTextCtrl::LinesJoin() {
|
||||
SendMsg(2288, 0, 0);
|
||||
}
|
||||
@@ -1871,6 +1889,21 @@ int wxStyledTextCtrl::GetPrintWrapMode() {
|
||||
return SendMsg(2407, 0, 0);
|
||||
}
|
||||
|
||||
// Set a fore colour for active hotspots.
|
||||
void wxStyledTextCtrl::SetHotspotActiveForeground(bool useSetting, const wxColour& fore) {
|
||||
SendMsg(2410, useSetting, wxColourAsLong(fore));
|
||||
}
|
||||
|
||||
// Set a back colour for active hotspots.
|
||||
void wxStyledTextCtrl::SetHotspotActiveBackground(bool useSetting, const wxColour& back) {
|
||||
SendMsg(2411, useSetting, wxColourAsLong(back));
|
||||
}
|
||||
|
||||
// Enable / Disable underlining active hotspots.
|
||||
void wxStyledTextCtrl::SetHotspotActiveUnderline(bool underline) {
|
||||
SendMsg(2412, underline, 0);
|
||||
}
|
||||
|
||||
// Start notifying the container of all key presses and commands.
|
||||
void wxStyledTextCtrl::StartRecord() {
|
||||
SendMsg(3001, 0, 0);
|
||||
@@ -2314,6 +2347,18 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) {
|
||||
evt.SetEventType(wxEVT_STC_ZOOM);
|
||||
break;
|
||||
|
||||
case SCN_HOTSPOTCLICK:
|
||||
evt.SetEventType(wxEVT_STC_HOTSPOT_CLICK);
|
||||
break;
|
||||
|
||||
case SCN_HOTSPOTDOUBLECLICK:
|
||||
evt.SetEventType(wxEVT_STC_HOTSPOT_DCLICK);
|
||||
break;
|
||||
|
||||
case SCN_CALLTIPCLICK:
|
||||
evt.SetEventType(wxEVT_STC_CALLTIP_CLICK);
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
@@ -85,6 +85,10 @@ DEFINE_EVENT_TYPE( wxEVT_STC_START_DRAG )
|
||||
DEFINE_EVENT_TYPE( wxEVT_STC_DRAG_OVER )
|
||||
DEFINE_EVENT_TYPE( wxEVT_STC_DO_DROP )
|
||||
DEFINE_EVENT_TYPE( wxEVT_STC_ZOOM )
|
||||
DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_CLICK )
|
||||
DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_DCLICK )
|
||||
DEFINE_EVENT_TYPE( wxEVT_STC_CALLTIP_CLICK )
|
||||
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
|
||||
@@ -575,6 +579,18 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) {
|
||||
evt.SetEventType(wxEVT_STC_ZOOM);
|
||||
break;
|
||||
|
||||
case SCN_HOTSPOTCLICK:
|
||||
evt.SetEventType(wxEVT_STC_HOTSPOT_CLICK);
|
||||
break;
|
||||
|
||||
case SCN_HOTSPOTDOUBLECLICK:
|
||||
evt.SetEventType(wxEVT_STC_HOTSPOT_DCLICK);
|
||||
break;
|
||||
|
||||
case SCN_CALLTIPCLICK:
|
||||
evt.SetEventType(wxEVT_STC_CALLTIP_CLICK);
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
@@ -225,11 +225,11 @@ private:
|
||||
void NotifyChange();
|
||||
void NotifyParent(SCNotification* scn);
|
||||
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_CLASS(wxStyledTextCtrl)
|
||||
|
||||
protected:
|
||||
|
||||
ScintillaWX* m_swx;
|
||||
wxStopWatch m_stopWatch;
|
||||
wxScrollBar* m_vScrollBar;
|
||||
@@ -348,6 +348,8 @@ private:
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifndef SWIG
|
||||
BEGIN_DECLARE_EVENT_TYPES()
|
||||
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CHANGE, 1650)
|
||||
@@ -373,6 +375,9 @@ BEGIN_DECLARE_EVENT_TYPES()
|
||||
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DRAG_OVER, 1670)
|
||||
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DO_DROP, 1671)
|
||||
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_ZOOM, 1672)
|
||||
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_HOTSPOT_CLICK, 1673)
|
||||
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_HOTSPOT_DCLICK, 1674)
|
||||
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CALLTIP_CLICK, 1675)
|
||||
END_DECLARE_EVENT_TYPES()
|
||||
#else
|
||||
enum {
|
||||
@@ -399,6 +404,9 @@ END_DECLARE_EVENT_TYPES()
|
||||
wxEVT_STC_DRAG_OVER,
|
||||
wxEVT_STC_DO_DROP,
|
||||
wxEVT_STC_ZOOM,
|
||||
wxEVT_STC_HOTSPOT_CLICK,
|
||||
wxEVT_STC_HOTSPOT_DCLICK,
|
||||
wxEVT_STC_CALLTIP_CLICK
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -430,6 +438,10 @@ typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&);
|
||||
#define EVT_STC_DRAG_OVER(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DRAG_OVER, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
|
||||
#define EVT_STC_DO_DROP(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DO_DROP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
|
||||
#define EVT_STC_ZOOM(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ZOOM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
|
||||
#define EVT_STC_HOTSPOT_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
|
||||
#define EVT_STC_HOTSPOT_DCLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_DCLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
|
||||
#define EVT_STC_CALLTIP_CLICK(id, fn)) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CALLTIP_CLICK id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
|
||||
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@@ -342,6 +342,10 @@ SOURCE=.\scintilla\src\LexOthers.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\scintilla\src\LexPOV.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\scintilla\src\LexPascal.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@@ -48,6 +48,7 @@ OBJECTS = \
|
||||
LexLisp.obj \
|
||||
LexLua.obj \
|
||||
LexOthers.obj \
|
||||
LexPOV.obj \
|
||||
LexPascal.obj \
|
||||
LexPerl.obj \
|
||||
LexPython.obj \
|
||||
|
@@ -36,6 +36,7 @@ OBJECTS = \
|
||||
$(S)/LexLisp.$(OBJSUFF) \
|
||||
$(S)/LexLua.$(OBJSUFF) \
|
||||
$(S)/LexOthers.$(OBJSUFF) \
|
||||
$(S)/LexPOV.$(OBJSUFF) \
|
||||
$(S)/LexPascal.$(OBJSUFF) \
|
||||
$(S)/LexPerl.$(OBJSUFF) \
|
||||
$(S)/LexPython.$(OBJSUFF) \
|
||||
|
@@ -41,6 +41,7 @@ OBJECTS = \
|
||||
$(D)\LexLisp.obj \
|
||||
$(D)\LexLua.obj \
|
||||
$(D)\LexOthers.obj \
|
||||
$(D)\LexPOV.obj \
|
||||
$(D)\LexPascal.obj \
|
||||
$(D)\LexPerl.obj \
|
||||
$(D)\LexPython.obj \
|
||||
|
@@ -45,6 +45,7 @@ OBJECTS = &
|
||||
LexLisp.obj &
|
||||
LexLua.obj &
|
||||
LexOthers.obj &
|
||||
LexPOV.obj &
|
||||
LexPascal.obj &
|
||||
LexPerl.obj &
|
||||
LexPython.obj &
|
||||
|
Reference in New Issue
Block a user