wxStyledTextCtrl can now be built and used when wxUSE_UNICODE==1.

When in unicode mode Scintilla uses UTF-8 internally so the wxSTC
wrapper only needs to convert to/from UTF-8 in the right places.
Still need to figure out to get unicode characters from key/char
events...


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14693 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2002-03-20 20:43:39 +00:00
parent ef1cae87cd
commit 10ef30eb53
22 changed files with 1033 additions and 534 deletions

View File

@@ -218,10 +218,10 @@ static PyObject *_wrap_wxStyledTextCtrl_AddText(PyObject *self, PyObject *args,
static PyObject *_wrap_wxStyledTextCtrl_AddStyledText(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxStyledTextCtrl * _arg0;
wxString * _arg1;
wxMemoryBuffer * _arg1;
PyObject * _argo0 = 0;
PyObject * _obj1 = 0;
char *_kwnames[] = { "self","text", NULL };
char *_kwnames[] = { "self","data", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_AddStyledText",_kwnames,&_argo0,&_obj1))
@@ -234,9 +234,14 @@ static PyObject *_wrap_wxStyledTextCtrl_AddStyledText(PyObject *self, PyObject *
}
}
{
_arg1 = wxString_in_helper(_obj1);
if (_arg1 == NULL)
if (!PyString_Check(_obj1)) {
PyErr_SetString(PyExc_TypeError, "String buffer expected");
return NULL;
}
char* str = PyString_AS_STRING(_obj1);
int len = PyString_GET_SIZE(_obj1);
_arg1 = new wxMemoryBuffer(len);
memcpy(_arg1->GetData(), str, len);
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
@@ -609,7 +614,7 @@ static PyObject *_wrap_wxStyledTextCtrl_SetSavePoint(PyObject *self, PyObject *a
#define wxStyledTextCtrl_GetStyledText(_swigobj,_swigarg0,_swigarg1) (_swigobj->GetStyledText(_swigarg0,_swigarg1))
static PyObject *_wrap_wxStyledTextCtrl_GetStyledText(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxString * _result;
wxMemoryBuffer * _result;
wxStyledTextCtrl * _arg0;
int _arg1;
int _arg2;
@@ -628,16 +633,12 @@ static PyObject *_wrap_wxStyledTextCtrl_GetStyledText(PyObject *self, PyObject *
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
_result = new wxString (wxStyledTextCtrl_GetStyledText(_arg0,_arg1,_arg2));
_result = new wxMemoryBuffer (wxStyledTextCtrl_GetStyledText(_arg0,_arg1,_arg2));
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
}{
#if wxUSE_UNICODE
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
#else
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
#endif
_resultobj = PyString_FromStringAndSize((char*)_result->GetData(), _result->GetDataLen());
}
{
delete _result;
@@ -2231,6 +2232,36 @@ static PyObject *_wrap_wxStyledTextCtrl_StyleSetCase(PyObject *self, PyObject *a
return _resultobj;
}
#define wxStyledTextCtrl_StyleSetCharacterSet(_swigobj,_swigarg0,_swigarg1) (_swigobj->StyleSetCharacterSet(_swigarg0,_swigarg1))
static PyObject *_wrap_wxStyledTextCtrl_StyleSetCharacterSet(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxStyledTextCtrl * _arg0;
int _arg1;
int _arg2;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self","style","characterSet", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_StyleSetCharacterSet",_kwnames,&_argo0,&_arg1,&_arg2))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_StyleSetCharacterSet. Expected _wxStyledTextCtrl_p.");
return NULL;
}
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
wxStyledTextCtrl_StyleSetCharacterSet(_arg0,_arg1,_arg2);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
#define wxStyledTextCtrl_SetSelForeground(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetSelForeground(_swigarg0,_swigarg1))
static PyObject *_wrap_wxStyledTextCtrl_SetSelForeground(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
@@ -6907,34 +6938,6 @@ static PyObject *_wrap_wxStyledTextCtrl_GetLayoutCache(PyObject *self, PyObject
return _resultobj;
}
#define wxStyledTextCtrl_DeleteBackNotLine(_swigobj) (_swigobj->DeleteBackNotLine())
static PyObject *_wrap_wxStyledTextCtrl_DeleteBackNotLine(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxStyledTextCtrl * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_DeleteBackNotLine",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_DeleteBackNotLine. Expected _wxStyledTextCtrl_p.");
return NULL;
}
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
wxStyledTextCtrl_DeleteBackNotLine(_arg0);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
#define wxStyledTextCtrl_MoveCaretInsideView(_swigobj) (_swigobj->MoveCaretInsideView())
static PyObject *_wrap_wxStyledTextCtrl_MoveCaretInsideView(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
@@ -9312,12 +9315,13 @@ static PyObject *_wrap_wxStyledTextEvent_SetModificationType(PyObject *self, PyO
static PyObject *_wrap_wxStyledTextEvent_SetText(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxStyledTextEvent * _arg0;
char * _arg1;
wxString * _arg1;
PyObject * _argo0 = 0;
PyObject * _obj1 = 0;
char *_kwnames[] = { "self","t", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Os:wxStyledTextEvent_SetText",_kwnames,&_argo0,&_arg1))
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextEvent_SetText",_kwnames,&_argo0,&_obj1))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
@@ -9326,14 +9330,23 @@ static PyObject *_wrap_wxStyledTextEvent_SetText(PyObject *self, PyObject *args,
return NULL;
}
}
{
_arg1 = wxString_in_helper(_obj1);
if (_arg1 == NULL)
return NULL;
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
wxStyledTextEvent_SetText(_arg0,_arg1);
wxStyledTextEvent_SetText(_arg0,*_arg1);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
} Py_INCREF(Py_None);
_resultobj = Py_None;
{
if (_obj1)
delete _arg1;
}
return _resultobj;
}
@@ -10597,7 +10610,6 @@ static PyMethodDef stc_cMethods[] = {
{ "wxStyledTextCtrl_BraceHighlight", (PyCFunction) _wrap_wxStyledTextCtrl_BraceHighlight, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_LineLength", (PyCFunction) _wrap_wxStyledTextCtrl_LineLength, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_MoveCaretInsideView", (PyCFunction) _wrap_wxStyledTextCtrl_MoveCaretInsideView, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_DeleteBackNotLine", (PyCFunction) _wrap_wxStyledTextCtrl_DeleteBackNotLine, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_GetLayoutCache", (PyCFunction) _wrap_wxStyledTextCtrl_GetLayoutCache, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_SetLayoutCache", (PyCFunction) _wrap_wxStyledTextCtrl_SetLayoutCache, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_GetWrapMode", (PyCFunction) _wrap_wxStyledTextCtrl_GetWrapMode, METH_VARARGS | METH_KEYWORDS },
@@ -10750,6 +10762,7 @@ static PyMethodDef stc_cMethods[] = {
{ "wxStyledTextCtrl_SetCaretForeground", (PyCFunction) _wrap_wxStyledTextCtrl_SetCaretForeground, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_SetSelBackground", (PyCFunction) _wrap_wxStyledTextCtrl_SetSelBackground, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_SetSelForeground", (PyCFunction) _wrap_wxStyledTextCtrl_SetSelForeground, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_StyleSetCharacterSet", (PyCFunction) _wrap_wxStyledTextCtrl_StyleSetCharacterSet, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_StyleSetCase", (PyCFunction) _wrap_wxStyledTextCtrl_StyleSetCase, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_StyleSetUnderline", (PyCFunction) _wrap_wxStyledTextCtrl_StyleSetUnderline, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_StyleResetDefault", (PyCFunction) _wrap_wxStyledTextCtrl_StyleResetDefault, METH_VARARGS | METH_KEYWORDS },

View File

@@ -310,6 +310,9 @@ class wxStyledTextCtrlPtr(wxControlPtr):
def StyleSetCase(self, *_args, **_kwargs):
val = apply(stc_c.wxStyledTextCtrl_StyleSetCase,(self,) + _args, _kwargs)
return val
def StyleSetCharacterSet(self, *_args, **_kwargs):
val = apply(stc_c.wxStyledTextCtrl_StyleSetCharacterSet,(self,) + _args, _kwargs)
return val
def SetSelForeground(self, *_args, **_kwargs):
val = apply(stc_c.wxStyledTextCtrl_SetSelForeground,(self,) + _args, _kwargs)
return val
@@ -769,9 +772,6 @@ class wxStyledTextCtrlPtr(wxControlPtr):
def GetLayoutCache(self, *_args, **_kwargs):
val = apply(stc_c.wxStyledTextCtrl_GetLayoutCache,(self,) + _args, _kwargs)
return val
def DeleteBackNotLine(self, *_args, **_kwargs):
val = apply(stc_c.wxStyledTextCtrl_DeleteBackNotLine,(self,) + _args, _kwargs)
return val
def MoveCaretInsideView(self, *_args, **_kwargs):
val = apply(stc_c.wxStyledTextCtrl_MoveCaretInsideView,(self,) + _args, _kwargs)
return val

View File

@@ -42,7 +42,11 @@
<FONT color=#a020f0>#define wxSTC_START </FONT><FONT color=#ff00ff>2000</FONT>
<FONT color=#a020f0>#define wxSTC_OPTIONAL_START </FONT><FONT color=#ff00ff>3000</FONT>
<FONT color=#a020f0>#define wxSTC_LEXER_START </FONT><FONT color=#ff00ff>4000</FONT>
<FONT color=#0000ff>// Redoes the next action on the undo history</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_REDO </FONT><FONT color=#ff00ff>2011</FONT>
<FONT color=#0000ff>// Select all the text in the document.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_SELECTALL </FONT><FONT color=#ff00ff>2013</FONT>
<FONT color=#a020f0>#define wxSTC_WS_INVISIBLE </FONT><FONT color=#ff00ff>0</FONT>
<FONT color=#a020f0>#define wxSTC_WS_VISIBLEALWAYS </FONT><FONT color=#ff00ff>1</FONT>
@@ -160,9 +164,17 @@
<FONT color=#a020f0>#define wxSTC_FIND_MATCHCASE </FONT><FONT color=#ff00ff>4</FONT>
<FONT color=#a020f0>#define wxSTC_FIND_WORDSTART </FONT><FONT color=#ff00ff>0x00100000</FONT>
<FONT color=#a020f0>#define wxSTC_FIND_REGEXP </FONT><FONT color=#ff00ff>0x00200000</FONT>
<FONT color=#0000ff>// Undo one action in the undo history.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_UNDO </FONT><FONT color=#ff00ff>2176</FONT>
<FONT color=#0000ff>// Cut the selection to the clipboard.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_CUT </FONT><FONT color=#ff00ff>2177</FONT>
<FONT color=#0000ff>// Copy the selection to the clipboard.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_COPY </FONT><FONT color=#ff00ff>2178</FONT>
<FONT color=#0000ff>// Paste the contents of the clipboard into the document replacing the selection.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_PASTE </FONT><FONT color=#ff00ff>2179</FONT>
<FONT color=#a020f0>#define wxSTC_FOLDLEVELBASE </FONT><FONT color=#ff00ff>0x400</FONT>
<FONT color=#a020f0>#define wxSTC_FOLDLEVELWHITEFLAG </FONT><FONT color=#ff00ff>0x1000</FONT>
@@ -175,50 +187,144 @@
<FONT color=#a020f0>#define wxSTC_CACHE_CARET </FONT><FONT color=#ff00ff>1</FONT>
<FONT color=#a020f0>#define wxSTC_CACHE_PAGE </FONT><FONT color=#ff00ff>2</FONT>
<FONT color=#a020f0>#define wxSTC_CACHE_DOCUMENT </FONT><FONT color=#ff00ff>3</FONT>
<FONT color=#0000ff>// Move caret down one line.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_LINEDOWN </FONT><FONT color=#ff00ff>2300</FONT>
<FONT color=#0000ff>// Move caret down one line extending selection to new caret position.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_LINEDOWNEXTEND </FONT><FONT color=#ff00ff>2301</FONT>
<FONT color=#0000ff>// Move caret up one line.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_LINEUP </FONT><FONT color=#ff00ff>2302</FONT>
<FONT color=#0000ff>// Move caret up one line extending selection to new caret position.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_LINEUPEXTEND </FONT><FONT color=#ff00ff>2303</FONT>
<FONT color=#0000ff>// Move caret left one character.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_CHARLEFT </FONT><FONT color=#ff00ff>2304</FONT>
<FONT color=#0000ff>// Move caret left one character extending selection to new caret position.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_CHARLEFTEXTEND </FONT><FONT color=#ff00ff>2305</FONT>
<FONT color=#0000ff>// Move caret right one character.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_CHARRIGHT </FONT><FONT color=#ff00ff>2306</FONT>
<FONT color=#0000ff>// Move caret right one character extending selection to new caret position.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_CHARRIGHTEXTEND </FONT><FONT color=#ff00ff>2307</FONT>
<FONT color=#0000ff>// Move caret left one word.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_WORDLEFT </FONT><FONT color=#ff00ff>2308</FONT>
<FONT color=#0000ff>// Move caret left one word extending selection to new caret position.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_WORDLEFTEXTEND </FONT><FONT color=#ff00ff>2309</FONT>
<FONT color=#0000ff>// Move caret right one word.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_WORDRIGHT </FONT><FONT color=#ff00ff>2310</FONT>
<FONT color=#0000ff>// Move caret right one word extending selection to new caret position.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_WORDRIGHTEXTEND </FONT><FONT color=#ff00ff>2311</FONT>
<FONT color=#0000ff>// Move caret to first position on line.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_HOME </FONT><FONT color=#ff00ff>2312</FONT>
<FONT color=#0000ff>// Move caret to first position on line extending selection to new caret position.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_HOMEEXTEND </FONT><FONT color=#ff00ff>2313</FONT>
<FONT color=#0000ff>// Move caret to last position on line.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_LINEEND </FONT><FONT color=#ff00ff>2314</FONT>
<FONT color=#0000ff>// Move caret to last position on line extending selection to new caret position.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_LINEENDEXTEND </FONT><FONT color=#ff00ff>2315</FONT>
<FONT color=#0000ff>// Move caret to first position in document.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_DOCUMENTSTART </FONT><FONT color=#ff00ff>2316</FONT>
<FONT color=#0000ff>// Move caret to first position in document extending selection to new caret position.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_DOCUMENTSTARTEXTEND </FONT><FONT color=#ff00ff>2317</FONT>
<FONT color=#0000ff>// Move caret to last position in document.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_DOCUMENTEND </FONT><FONT color=#ff00ff>2318</FONT>
<FONT color=#0000ff>// Move caret to last position in document extending selection to new caret position.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_DOCUMENTENDEXTEND </FONT><FONT color=#ff00ff>2319</FONT>
<FONT color=#0000ff>// Move caret one page up.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_PAGEUP </FONT><FONT color=#ff00ff>2320</FONT>
<FONT color=#0000ff>// Move caret one page up extending selection to new caret position.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_PAGEUPEXTEND </FONT><FONT color=#ff00ff>2321</FONT>
<FONT color=#0000ff>// Move caret one page down.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_PAGEDOWN </FONT><FONT color=#ff00ff>2322</FONT>
<FONT color=#0000ff>// Move caret one page down extending selection to new caret position.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_PAGEDOWNEXTEND </FONT><FONT color=#ff00ff>2323</FONT>
<FONT color=#0000ff>// Switch from insert to overtype mode or the reverse.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_EDITTOGGLEOVERTYPE </FONT><FONT color=#ff00ff>2324</FONT>
<FONT color=#0000ff>// Cancel any modes such as call tip or auto-completion list display.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_CANCEL </FONT><FONT color=#ff00ff>2325</FONT>
<FONT color=#0000ff>// Delete the selection or if no selection, the character before the caret.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_DELETEBACK </FONT><FONT color=#ff00ff>2326</FONT>
<FONT color=#0000ff>// If selection is empty or all on one line replace the selection with a tab</FONT>
<FONT color=#0000ff>// character.</FONT>
<FONT color=#0000ff>// If more than one line selected, indent the lines.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_TAB </FONT><FONT color=#ff00ff>2327</FONT>
<FONT color=#0000ff>// Dedent the selected lines.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_BACKTAB </FONT><FONT color=#ff00ff>2328</FONT>
<FONT color=#0000ff>// Insert a new line, may use a CRLF, CR or LF depending on EOL mode.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_NEWLINE </FONT><FONT color=#ff00ff>2329</FONT>
<FONT color=#0000ff>// Insert a Form Feed character.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_FORMFEED </FONT><FONT color=#ff00ff>2330</FONT>
<FONT color=#0000ff>// Move caret to before first visible character on line.</FONT>
<FONT color=#0000ff>// If already there move to first character on line.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_VCHOME </FONT><FONT color=#ff00ff>2331</FONT>
<FONT color=#0000ff>// Like VCHome but extending selection to new caret position.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_VCHOMEEXTEND </FONT><FONT color=#ff00ff>2332</FONT>
<FONT color=#0000ff>// Magnify the displayed text by increasing the sizes by 1 point.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_ZOOMIN </FONT><FONT color=#ff00ff>2333</FONT>
<FONT color=#0000ff>// Make the displayed text smaller by decreasing the sizes by 1 point.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_ZOOMOUT </FONT><FONT color=#ff00ff>2334</FONT>
<FONT color=#0000ff>// Delete the word to the left of the caret.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_DELWORDLEFT </FONT><FONT color=#ff00ff>2335</FONT>
<FONT color=#0000ff>// Delete the word to the right of the caret.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_DELWORDRIGHT </FONT><FONT color=#ff00ff>2336</FONT>
<FONT color=#0000ff>// Cut the line containing the caret.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_LINECUT </FONT><FONT color=#ff00ff>2337</FONT>
<FONT color=#0000ff>// Delete the line containing the caret.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_LINEDELETE </FONT><FONT color=#ff00ff>2338</FONT>
<FONT color=#0000ff>// Switch the current line with the previous.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_LINETRANSPOSE </FONT><FONT color=#ff00ff>2339</FONT>
<FONT color=#0000ff>// Transform the selection to lower case.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_LOWERCASE </FONT><FONT color=#ff00ff>2340</FONT>
<FONT color=#0000ff>// Transform the selection to upper case.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_UPPERCASE </FONT><FONT color=#ff00ff>2341</FONT>
<FONT color=#0000ff>// Scroll the document down, keeping the caret visible.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_LINESCROLLDOWN </FONT><FONT color=#ff00ff>2342</FONT>
<FONT color=#0000ff>// Scroll the document up, keeping the caret visible.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_LINESCROLLUP </FONT><FONT color=#ff00ff>2343</FONT>
<FONT color=#0000ff>// Delete the selection or if no selection, the character before the caret.</FONT>
<FONT color=#0000ff>// Will not delete the chraacter before at the start of a line.</FONT>
<FONT color=#a020f0>#define wxSTC_CMD_DELETEBACKNOTLINE </FONT><FONT color=#ff00ff>2344</FONT>
<FONT color=#a020f0>#define wxSTC_EDGE_NONE </FONT><FONT color=#ff00ff>0</FONT>
<FONT color=#a020f0>#define wxSTC_EDGE_LINE </FONT><FONT color=#ff00ff>1</FONT>
@@ -742,7 +848,7 @@
<B><FONT color=#2e8b57>void</FONT></B> AddText(<B><FONT color=#2e8b57>const</FONT></B> wxString&amp; text);
<FONT color=#0000ff>// Add array of cells to document</FONT>
<B><FONT color=#2e8b57>void</FONT></B> AddStyledText(<B><FONT color=#2e8b57>const</FONT></B> wxString&amp; text);
<B><FONT color=#2e8b57>void</FONT></B> AddStyledText(<B><FONT color=#2e8b57>const</FONT></B> wxMemoryBuffer&amp; data);
<FONT color=#0000ff>// Insert string at a position</FONT>
<B><FONT color=#2e8b57>void</FONT></B> InsertText(<B><FONT color=#2e8b57>int</FONT></B> pos, <B><FONT color=#2e8b57>const</FONT></B> wxString&amp; text);
@@ -783,7 +889,7 @@
<B><FONT color=#2e8b57>void</FONT></B> SetSavePoint();
<FONT color=#0000ff>// Retrieve a buffer of cells.</FONT>
wxString GetStyledText(<B><FONT color=#2e8b57>int</FONT></B> startPos, <B><FONT color=#2e8b57>int</FONT></B> endPos);
wxMemoryBuffer GetStyledText(<B><FONT color=#2e8b57>int</FONT></B> startPos, <B><FONT color=#2e8b57>int</FONT></B> endPos);
<FONT color=#0000ff>// Are there any redoable actions in the undo history.</FONT>
<B><FONT color=#2e8b57>bool</FONT></B> CanRedo();
@@ -865,7 +971,6 @@
<B><FONT color=#2e8b57>int</FONT></B> GetTabWidth();
<FONT color=#0000ff>// Set the code page used to interpret the bytes of the document as characters.</FONT>
<FONT color=#0000ff>// The SC_CP_UTF8 value can be used to enter Unicode mode.</FONT>
<B><FONT color=#2e8b57>void</FONT></B> SetCodePage(<B><FONT color=#2e8b57>int</FONT></B> codePage);
<FONT color=#0000ff>// Set the symbol used for a particular marker number,</FONT>
@@ -955,6 +1060,9 @@
<FONT color=#0000ff>// Set a style to be mixed case, or to force upper or lower case.</FONT>
<B><FONT color=#2e8b57>void</FONT></B> StyleSetCase(<B><FONT color=#2e8b57>int</FONT></B> style, <B><FONT color=#2e8b57>int</FONT></B> caseForce);
<FONT color=#0000ff>// Set the character set of the font in a style.</FONT>
<B><FONT color=#2e8b57>void</FONT></B> StyleSetCharacterSet(<B><FONT color=#2e8b57>int</FONT></B> style, <B><FONT color=#2e8b57>int</FONT></B> characterSet);
<FONT color=#0000ff>// Set the foreground colour of the selection and whether to use this setting.</FONT>
<B><FONT color=#2e8b57>void</FONT></B> SetSelForeground(<B><FONT color=#2e8b57>bool</FONT></B> useSetting, <B><FONT color=#2e8b57>const</FONT></B> wxColour&amp; fore);
@@ -1446,10 +1554,6 @@
<FONT color=#0000ff>// Retrieve the degree of caching of layout information</FONT>
<B><FONT color=#2e8b57>int</FONT></B> GetLayoutCache();
<FONT color=#0000ff>// Delete the selection or if no selection, the character before the caret.</FONT>
<FONT color=#0000ff>// Will not delete the chraacter before at the start of a line.</FONT>
<B><FONT color=#2e8b57>void</FONT></B> DeleteBackNotLine();
<FONT color=#0000ff>// Move the caret inside current view if it's not there already</FONT>
<B><FONT color=#2e8b57>void</FONT></B> MoveCaretInsideView();
@@ -1762,7 +1866,7 @@
<B><FONT color=#2e8b57>void</FONT></B> SetKey(<B><FONT color=#2e8b57>int</FONT></B> k) { m_key = k; }
<B><FONT color=#2e8b57>void</FONT></B> SetModifiers(<B><FONT color=#2e8b57>int</FONT></B> m) { m_modifiers = m; }
<B><FONT color=#2e8b57>void</FONT></B> SetModificationType(<B><FONT color=#2e8b57>int</FONT></B> t) { m_modificationType = t; }
<B><FONT color=#2e8b57>void</FONT></B> SetText(<B><FONT color=#2e8b57>const</FONT></B> <B><FONT color=#2e8b57>char</FONT></B>* t) { m_text = t; }
<B><FONT color=#2e8b57>void</FONT></B> SetText(<B><FONT color=#2e8b57>const</FONT></B> wxString&amp; t) { m_text = t; }
<B><FONT color=#2e8b57>void</FONT></B> SetLength(<B><FONT color=#2e8b57>int</FONT></B> len) { m_length = len; }
<B><FONT color=#2e8b57>void</FONT></B> SetLinesAdded(<B><FONT color=#2e8b57>int</FONT></B> num) { m_linesAdded = num; }
<B><FONT color=#2e8b57>void</FONT></B> SetLine(<B><FONT color=#2e8b57>int</FONT></B> val) { m_line = val; }

View File

@@ -107,7 +107,7 @@ class MySTC(wxStyledTextCtrl):
evt.GetPosition(),
evt.GetLinesAdded(),
evt.GetLength(),
evt.GetText() ))
repr(evt.GetText()) ))
def transModType(self, modType):
@@ -153,7 +153,23 @@ def runTest(frame, nb, log):
p.SetSizer(s)
p.SetAutoLayout(true)
## ed.SetBufferedDraw(false)
## ed.StyleClearAll()
ed.SetText(demoText)
if wxUSE_UNICODE:
import codecs
decode = codecs.lookup("utf-8")[1]
ed.GotoPos(ed.GetLength())
ed.AddText("\n\nwxStyledTextCtrl can also do Unicode:\n")
unitext, l = decode('\xd0\x9f\xd0\xb8\xd1\x82\xd0\xbe\xd0\xbd - '
'\xd0\xbb\xd1\x83\xd1\x87\xd1\x88\xd0\xb8\xd0\xb9 '
'\xd1\x8f\xd0\xb7\xd1\x8b\xd0\xba \xd0\xbf\xd1\x80\xd0\xbe\xd0\xb3\xd1\x80\xd0\xb0\xd0\xbc\xd0\xbc\xd0\xb8\xd1\x80\xd0\xbe\xd0\xb2\xd0\xb0\xd0\xbd\xd0\xb8\xd1\x8f!\n\n')
ed.AddText('\tRussian: ')
ed.AddText(unitext)
ed.GotoPos(0)
ed.EmptyUndoBuffer()
# make some styles
@@ -163,8 +179,7 @@ def runTest(frame, nb, log):
ed.StyleSetSpec(3, "face:%s,bold,size:%d" % (face2, pb+2))
ed.StyleSetSpec(4, "face:%s,size:%d" % (face1, pb-1))
# now set some text to those styles... Normally this would be
# Now set some text to those styles... Normally this would be
# done in an event handler that happens when text needs displayed.
ed.StartStyling(98, 0xff)
ed.SetStyling(6, 1) # set style for 6 characters using style 1
@@ -211,6 +226,7 @@ def runTest(frame, nb, log):
ed.SetStyling(10, wxSTC_INDIC1_MASK)
ed.SetStyling(10, wxSTC_INDIC2_MASK | wxSTC_INDIC1_MASK)
# some test stuff...
if debug:
print "GetTextLength(): ", ed.GetTextLength(), len(ed.GetText())

View File

@@ -465,7 +465,7 @@ if BUILD_GLCANVAS or GL_ONLY:
other_sources = []
swig_sources = run_swig(swig_files, location, GENDIR, PKGDIR,
USE_SWIG, swig_force, swig_args)
USE_SWIG, swig_force, swig_args, swig_deps)
gl_libs = []
if os.name == 'posix':
@@ -507,7 +507,7 @@ if not GL_ONLY and BUILD_OGL:
'oglcanvas.i']
swig_sources = run_swig(swig_files, location, '', PKGDIR,
USE_SWIG, swig_force, swig_args)
USE_SWIG, swig_force, swig_args, swig_deps)
if IN_CVS_TREE:
# make sure local copy of contrib files are up to date
@@ -577,7 +577,7 @@ if not GL_ONLY and BUILD_STC:
swig_sources = run_swig(swig_files, location, GENDIR, PKGDIR,
USE_SWIG, swig_force,
swig_args + ['-I'+STC_H, '-I'+location],
[opj(STC_H, 'stc.h')])
[opj(STC_H, 'stc.h')] + swig_deps)
# copy a contrib project specific py module to the main package dir
copy_file(opj(location, 'stc.py'), PKGDIR, update=1, verbose=0)
@@ -666,7 +666,7 @@ if not GL_ONLY and BUILD_IEWIN:
swig_files = ['iewin.i', ]
swig_sources = run_swig(swig_files, location, '', PKGDIR,
USE_SWIG, swig_force, swig_args)
USE_SWIG, swig_force, swig_args, swig_deps)
ext = Extension('iewinc', ['%s/IEHtmlWin.cpp' % location,
@@ -698,7 +698,7 @@ if not GL_ONLY and BUILD_XRC:
swig_files = ['xrc.i']
swig_sources = run_swig(swig_files, location, '', PKGDIR,
USE_SWIG, swig_force, swig_args)
USE_SWIG, swig_force, swig_args, swig_deps)
xmlres_includes = includes[:]
xmlres_includes.append('%s/expat/xmlparse' % XMLLOC)
@@ -786,7 +786,7 @@ if not GL_ONLY and BUILD_GIZMOS:
swig_files = ['gizmos.i']
swig_sources = run_swig(swig_files, location, '', PKGDIR,
USE_SWIG, swig_force, swig_args)
USE_SWIG, swig_force, swig_args, swig_deps)
gizmos_includes = includes[:]
gizmos_includes.append(GIZMOINC)
@@ -829,7 +829,7 @@ if not GL_ONLY and BUILD_DLLWIDGET:
swig_files = ['dllwidget_.i']
swig_sources = run_swig(swig_files, location, '', PKGDIR,
USE_SWIG, swig_force, swig_args)
USE_SWIG, swig_force, swig_args, swig_deps)
# copy a contrib project specific py module to the main package dir
copy_file(opj(location, 'dllwidget.py'), PKGDIR, update=1, verbose=0)

View File

@@ -188,6 +188,32 @@ $function
//---------------------------------------------------------------------------
%typemap(python, in) wxMemoryBuffer& {
if (!PyString_Check($source)) {
PyErr_SetString(PyExc_TypeError, "String buffer expected");
return NULL;
}
char* str = PyString_AS_STRING($source);
int len = PyString_GET_SIZE($source);
$target = new wxMemoryBuffer(len);
memcpy($target->GetData(), str, len);
}
%typemap(python, freearg) wxMemoryBuffer& {
if ($target)
delete $source;
}
%typemap(python, out) wxMemoryBuffer {
$target = PyString_FromStringAndSize((char*)$source->GetData(), $source->GetDataLen());
}
%typemap(python, ret) wxMemoryBuffer {
delete $source;
}
//---------------------------------------------------------------------------