but you have to use "our" scintilla, because there are some C::B specific patches we use.
Maybe we can move the specific patches from wxScintilla to cbEditor or cbStyledTextCtrl?
I am trying, but I found it is impossible.
/*
* This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
* http://www.gnu.org/licenses/lgpl-3.0.html
*/
#ifndef CBSCINTILLA_H
#define CBSCINTILLA_H
#if wxCHECK_VERSION(2, 9, 2)
#include <wx/stc/stc.h>
#define cbSCI_KEYWORDSET_MAX wxSTC_KEYWORDSET_MAX
#define cbSCI_EOL_LF wxSTC_EOL_LF
#define cbSCI_EOL_CR wxSTC_EOL_CR
#define cbSCI_C_COMMENT wxSTC_C_COMMENT
#define cbSCI_C_COMMENTDOC wxSTC_C_COMMENTDOC
#define cbSCI_C_COMMENTDOCKEYWORD wxSTC_C_COMMENTDOCKEYWORD
#define cbSCI_C_COMMENTDOCKEYWORDERROR wxSTC_C_COMMENTDOCKEYWORDERROR
#define cbSCI_C_COMMENTLINE wxSTC_C_COMMENTLINE
#define cbSCI_C_COMMENTLINEDOC wxSTC_C_COMMENTLINEDOC
#define cbSCI_D_COMMENT wxSTC_D_COMMENT
#define cbSCI_D_COMMENTDOC wxSTC_D_COMMENTDOC
#define cbSCI_D_COMMENTDOCKEYWORD wxSTC_D_COMMENTDOCKEYWORD
#define cbSCI_D_COMMENTDOCKEYWORDERROR wxSTC_D_COMMENTDOCKEYWORDERROR
#define cbSCI_D_COMMENTLINE wxSTC_D_COMMENTLINE
#define cbSCI_D_COMMENTLINEDOC wxSTC_D_COMMENTLINEDOC
#define cbSCI_LEX_CPP wxSTC_LEX_CPP
#define cbSCI_LEX_D wxSTC_LEX_D
#define cbSCI_C_PREPROCESSOR wxSTC_C_PREPROCESSOR
#define cbSCI_C_STRING wxSTC_C_STRING
#define cbSCI_C_CHARACTER wxSTC_C_CHARACTER
#define cbSCI_C_CHARACTER wxSTC_C_CHARACTER
#define cbSCI_D_PREPROCESSOR wxSTC_D_PREPROCESSOR
#define cbSCI_D_STRING wxSTC_D_STRING
#define cbSCI_D_CHARACTER wxSTC_D_CHARACTER
#define cbSCI_D_CHARACTER wxSTC_D_CHARACTER
#define cbSCI_STYLE_LINENUMBER wxSTC_STYLE_LINENUMBER
#define cbSCI_INDIC_HIGHLIGHT wxSTC_INDIC_HIGHLIGHT
#define cbSCI_FIND_MATCHCASE wxSTC_FIND_MATCHCASE
#define cbSCI_FIND_WHOLEWORD wxSTC_FIND_WHOLEWORD
#define cbSCI_KEY_HOME wxSTC_KEY_HOME
#define cbSCI_KEY_END wxSTC_KEY_END
#define cbSCI_SCMOD_NORM wxSTC_SCMOD_NORM
#define cbSCI_SCMOD_SHIFT wxSTC_SCMOD_SHIFT
#define cbSCI_SCMOD_ALT wxSTC_SCMOD_ALT
#define cbSCI_CMD_HOME wxSTC_CMD_HOME
#define cbSCI_CMD_HOMEEXTEND wxSTC_CMD_HOMEEXTEND
#define cbSCI_CMD_HOMERECTEXTEND wxSTC_CMD_HOMERECTEXTEND
#define cbSCI_CMD_VCHOME wxSTC_CMD_VCHOME
#define cbSCI_CMD_VCHOMEEXTEND wxSTC_CMD_VCHOMEEXTEND
#define cbSCI_CMD_VCHOMERECTEXTEND wxSTC_CMD_VCHOMERECTEXTEND
#define cbSCI_CMD_LINEENDWRAP wxSTC_CMD_LINEENDWRAP
#define cbSCI_IV_LOOKBOTH wxSTC_IV_LOOKBOTH
#define cbSCI_IV_NONE wxSTC_IV_NONE
class cbScintilla : public wxStyledTextCtrl
{
public:
cbScintilla(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0)
: wxStyledTextCtrl(parent, id, pos, size, style)
{
}
};
#else // !wxCHECK_VERSION(2, 9, 2)
#define cbSCI_INVALID_POSITION wxSCI_INVALID_POSITION
#define cbSCI_KEYWORDSET_MAX wxSCI_KEYWORDSET_MAX
#define cbSCI_EOL_LF wxSCI_EOL_LF
#define cbSCI_EOL_CR wxSCI_EOL_CR
#define cbSCI_C_COMMENT wxSCI_C_COMMENT
#define cbSCI_C_COMMENTDOC wxSCI_C_COMMENTDOC
#define cbSCI_C_COMMENTDOCKEYWORD wxSCI_C_COMMENTDOCKEYWORD
#define cbSCI_C_COMMENTDOCKEYWORDERROR wxSCI_C_COMMENTDOCKEYWORDERROR
#define cbSCI_C_COMMENTLINE wxSCI_C_COMMENTLINE
#define cbSCI_C_COMMENTLINEDOC wxSCI_C_COMMENTLINEDOC
#define cbSCI_D_COMMENT wxSCI_D_COMMENT
#define cbSCI_D_COMMENTDOC wxSCI_D_COMMENTDOC
#define cbSCI_D_COMMENTDOCKEYWORD wxSCI_D_COMMENTDOCKEYWORD
#define cbSCI_D_COMMENTDOCKEYWORDERROR wxSCI_D_COMMENTDOCKEYWORDERROR
#define cbSCI_D_COMMENTLINE wxSCI_D_COMMENTLINE
#define cbSCI_D_COMMENTLINEDOC wxSCI_D_COMMENTLINEDOC
#define cbSCI_LEX_CPP wxSCI_LEX_CPP
#define cbSCI_LEX_D wxSCI_LEX_D
#define cbSCI_C_PREPROCESSOR wxSCI_C_PREPROCESSOR
#define cbSCI_C_STRING wxSCI_C_STRING
#define cbSCI_C_CHARACTER wxSCI_C_CHARACTER
#define cbSCI_C_CHARACTER wxSCI_C_CHARACTER
#define cbSCI_D_PREPROCESSOR wxSCI_D_PREPROCESSOR
#define cbSCI_D_STRING wxSCI_D_STRING
#define cbSCI_D_CHARACTER wxSCI_D_CHARACTER
#define cbSCI_D_CHARACTER wxSCI_D_CHARACTER
#define cbSCI_STYLE_LINENUMBER wxSCI_STYLE_LINENUMBER
#define cbSCI_INDIC_HIGHLIGHT wxSCI_INDIC_HIGHLIGHT
#define cbSCI_FIND_MATCHCASE wxSCI_FIND_MATCHCASE
#define cbSCI_FIND_WHOLEWORD wxSCI_FIND_WHOLEWORD
#define cbSCI_KEY_HOME wxSCI_KEY_HOME
#define cbSCI_KEY_END wxSCI_KEY_END
#define cbSCI_SCMOD_NORM wxSCI_SCMOD_NORM
#define cbSCI_SCMOD_SHIFT wxSCI_SCMOD_SHIFT
#define cbSCI_SCMOD_ALT wxSCI_SCMOD_ALT
#define cbSCI_CMD_HOME wxSCI_CMD_HOME
#define cbSCI_CMD_HOMEEXTEND wxSCI_CMD_HOMEEXTEND
#define cbSCI_CMD_HOMERECTEXTEND wxSCI_CMD_HOMERECTEXTEND
#define cbSCI_CMD_VCHOME wxSCI_CMD_VCHOME
#define cbSCI_CMD_VCHOMEEXTEND wxSCI_CMD_VCHOMEEXTEND
#define cbSCI_CMD_VCHOMERECTEXTEND wxSCI_CMD_VCHOMERECTEXTEND
#define cbSCI_CMD_LINEENDWRAP wxSCI_CMD_LINEENDWRAP
#define cbSCI_IV_LOOKBOTH wxSCI_IV_LOOKBOTH
#define cbSCI_IV_NONE wxSCI_IV_NONE
class cbScintilla : public wxScintilla
{
public:
cbScintilla(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0)
: wxScintilla(parent, id, pos, size, style)
{
}
};
#endif // wxCHECK_VERSION(2, 9, 2)
#endif // CBSCINTILLA_H
And I have some questions:
void Editor::NotifyStyleToNeeded(int endStyleNeeded) {
/* C::B begin */
SCNotification scn; memset((void*)&scn, 0, sizeof(scn));
/* C::B end */
scn.nmhdr.code = SCN_STYLENEEDED;
scn.position = endStyleNeeded;
NotifyParent(scn);
}
void Editor::NotifyStyleNeeded(Document *, void *, int endStyleNeeded) {
NotifyStyleToNeeded(endStyleNeeded);
}
void Editor::NotifyLexerChanged(Document *, void *) {
}
void Editor::NotifyErrorOccurred(Document *, void *, int status) {
errorStatus = status;
}
void Editor::NotifyChar(int ch) {
/* C::B begin */
SCNotification scn; memset((void*)&scn, 0, sizeof(scn));
/* C::B end */
scn.nmhdr.code = SCN_CHARADDED;
scn.ch = ch;
NotifyParent(scn);
}
void Editor::NotifySavePoint(bool isSavePoint) {
/* C::B begin */
SCNotification scn; memset((void*)&scn, 0, sizeof(scn));
/* C::B end */
if (isSavePoint) {
scn.nmhdr.code = SCN_SAVEPOINTREACHED;
} else {
scn.nmhdr.code = SCN_SAVEPOINTLEFT;
}
NotifyParent(scn);
}
void Editor::NotifyModifyAttempt() {
/* C::B begin */
SCNotification scn; memset((void*)&scn, 0, sizeof(scn));
/* C::B end */
scn.nmhdr.code = SCN_MODIFYATTEMPTRO;
NotifyParent(scn);
}
void Editor::NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt) {
/* C::B begin */
SCNotification scn; memset((void*)&scn, 0, sizeof(scn));
/* C::B end */
scn.nmhdr.code = SCN_DOUBLECLICK;
scn.line = LineFromLocation(pt);
scn.position = PositionFromLocation(pt, true);
scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) |
(alt ? SCI_ALT : 0);
NotifyParent(scn);
}
void Editor::NotifyHotSpotDoubleClicked(int position, bool shift, bool ctrl, bool alt) {
/* C::B begin */
SCNotification scn; memset((void*)&scn, 0, sizeof(scn));
/* C::B end */
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) {
/* C::B begin */
SCNotification scn; memset((void*)&scn, 0, sizeof(scn));
/* C::B end */
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() {
/* C::B begin */
SCNotification scn; memset((void*)&scn, 0, sizeof(scn));
/* C::B end */
scn.nmhdr.code = SCN_UPDATEUI;
NotifyParent(scn);
}
void Editor::NotifyPainted() {
/* C::B begin */
SCNotification scn; memset((void*)&scn, 0, sizeof(scn));
/* C::B end */
scn.nmhdr.code = SCN_PAINTED;
NotifyParent(scn);
}
................
It seems the "C::B begin" and "C::B end" flag is error position?