'PositionFromPoint' :
(0,
- 'int %s(wxPoint pt);',
+ 'int %s(wxPoint pt) const;',
- '''int %s(wxPoint pt) {
+ '''int %s(wxPoint pt) const {
return SendMsg(%s, pt.x, pt.y);''',
0),
'SetSelFore' : ('SetSelForeground', 0, 0, 0),
'SetSelBack' : ('SetSelBackground', 0, 0, 0),
'SetCaretFore' : ('SetCaretForeground', 0, 0, 0),
- 'StyleGetFont' :
+ 'StyleGetFont' :
('StyleGetFaceName',
'wxString %s(int style);',
'''wxString %s(int style) {
('Get the font facename of a style',)),
'StyleSetFont' : ('StyleSetFaceName', 0, 0, 0),
'StyleSetCharacterSet' : (None, 0, 0, 0),
-
+
'AssignCmdKey' :
('CmdKeyAssign',
'void %s(int key, int modifiers, int cmd);',
'IndicGetFore' : ('IndicatorGetForeground', 0, 0, 0),
'IndicSetUnder': ('IndicatorSetUnder', 0, 0, 0),
'IndicGetUnder': ('IndicatorGetUnder', 0, 0, 0),
-
+
'SetWhitespaceFore' : ('SetWhitespaceForeground', 0, 0, 0),
'SetWhitespaceBack' : ('SetWhitespaceBackground', 0, 0, 0),
'AutoCSetMaxHeight' : ('AutoCompSetMaxHeight', 0, 0, 0),
'AutoCGetMaxHeight' : ('AutoCompGetMaxHeight', 0, 0, 0),
'AutoCGetMaxHeight' : ('AutoCompGetMaxHeight', 0, 0, 0),
-
+
'RegisterImage' :
(0,
'''void %s(int type, const wxBitmap& bmp);''',
int startPos,
int endPos,
wxDC* draw,
- wxDC* target,
+ wxDC* target,
wxRect renderRect,
wxRect pageRect);''',
''' int %s(bool doDraw,
int startPos,
int endPos,
wxDC* draw,
- wxDC* target,
+ wxDC* target,
wxRect renderRect,
wxRect pageRect) {
RangeToFormat fr;
'GetLine' :
(0,
- 'wxString %s(int line);',
+ 'wxString %s(int line) const;',
- '''wxString %s(int line) {
+ '''wxString %s(int line) const {
int len = LineLength(line);
if (!len) return wxEmptyString;
'GetText' :
(0,
- 'wxString %s();',
+ 'wxString %s() const;',
- '''wxString %s() {
+ '''wxString %s() const {
int len = GetTextLength();
wxMemoryBuffer mbuf(len+1); // leave room for the null...
char* buf = (char*)mbuf.GetWriteBuf(len+1);
'SetHotspotActiveBack' : ('SetHotspotActiveBackground', 0, 0, 0),
'GetHotspotActiveFore' : ('GetHotspotActiveForeground', 0, 0, 0),
'GetHotspotActiveBack' : ('GetHotspotActiveBackground', 0, 0, 0),
-
+
'GetCaretLineBack' : ('GetCaretLineBackground', 0, 0, 0),
'SetCaretLineBack' : ('SetCaretLineBackground', 0, 0, 0),
}
+# all Scintilla getters are transformed into const member of wxSTC class but
+# some non-getter methods are also logically const and this set contains their
+# names (notice that it's useless to include here methods manually overridden
+# above)
+constNonGetterMethods = set((
+ 'LineFromPosition',
+ 'PositionFromLine',
+ 'LineLength',
+ 'CanRedo',
+ 'CanUndo',
+))
+
#----------------------------------------------------------------------------
def processIface(iface, h_tmplt, cpp_tmplt, h_dest, cpp_dest, docstr_dest):
for v in cmdValues:
if (type(v) == type(()) and v[0] <= num <= v[1]) or v == num:
parseVal('CMD_%s=%s' % (string.upper(name), number), values, docs)
-
+
# if we are not also doing a function for CMD values, then
# just return, otherwise fall through to the append blow.
if not FUNC_FOR_CMD:
return
-
- methods.append( (retType, name, number, param1, param2, tuple(docs), is_const) )
+
+ methods.append( (retType, name, number, param1, param2, tuple(docs),
+ is_const or name in constNonGetterMethods) )
#----------------------------------------------------------------------------
def main(args):
# TODO: parse command line args to replace default input/output files???
+ if not os.path.exists(IFACE):
+ print 'Please run this script from src/stc subdirectory.'
+ sys.exit(1)
+
# Now just do it
processIface(IFACE, H_TEMPLATE, CPP_TEMPLATE, H_DEST, CPP_DEST, DOCSTR_DEST)