Skip to content

Commit e2d12db

Browse files
authored
Merge pull request #44 from chcg/iface_fix
iface corrections and scintilla wrapper update
2 parents edc3823 + 19b232f commit e2d12db

File tree

7 files changed

+55
-9
lines changed

7 files changed

+55
-9
lines changed

PythonScript/src/CreateWrapper.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,26 @@ def retStringFromEnc(v, out):
199199
return boost::python::str(result.c_str());
200200
'''.format(v["Param1Name"], symbolName(v)))
201201

202+
def retStringFromName(v, out):
203+
traceCall(v, out)
204+
checkDisallowedInCallback(v, out)
205+
out.write(
206+
''' std::string nameString = getStringFromObject({0});
207+
PythonCompatibleStrBuffer result(callScintilla({1}, reinterpret_cast<WPARAM>(nameString.c_str()), 0));
208+
callScintilla({1}, reinterpret_cast<WPARAM>(nameString.c_str()), reinterpret_cast<LPARAM>(*result));
209+
return boost::python::str(result.c_str());
210+
'''.format(v["Param1Name"], symbolName(v)))
211+
212+
def retStringFromUTF8(v, out):
213+
traceCall(v, out)
214+
checkDisallowedInCallback(v, out)
215+
out.write(
216+
''' std::string utf8String = getStringFromObject({0});
217+
PythonCompatibleStrBuffer result(callScintilla({1}, reinterpret_cast<WPARAM>(utf8String.c_str()), 0));
218+
callScintilla({1}, reinterpret_cast<WPARAM>(utf8String.c_str()), reinterpret_cast<LPARAM>(*result));
219+
return boost::python::str(result.c_str());
220+
'''.format(v["Param1Name"], symbolName(v)))
221+
202222
def findTextBody(v, out):
203223
traceCall(v, out)
204224
checkDisallowedInCallback(v, out)
@@ -378,6 +398,8 @@ def getPythonParamNamesQuoted(param1Type, param1Name, param2Type, param2Name):
378398
('int', 'length', 'stringresult', '', ('boost::python::str', '' , '', retString)),
379399
('string', 'key', 'stringresult', '', ('boost::python::str', 'boost::python::object','', retStringFromKey)),
380400
('string', 'encodedCharacter', 'stringresult', '', ('boost::python::str', 'boost::python::object','', retStringFromEnc)),
401+
('string', 'name', 'stringresult', '', ('boost::python::str', 'boost::python::object','', retStringFromName)),
402+
('string', 'utf8', 'stringresult', '', ('boost::python::str', 'boost::python::object','', retStringFromUTF8)),
381403
('int', 'length', 'stringresult', '', ('boost::python::str', '' , '', retStringNoLength)),
382404
('int', '', 'stringresult', '', ('boost::python::str', 'int', '', retStringNoLength)),
383405
('', '', 'stringresult', '', ('boost::python::str', '', '', retStringNoLength)),

PythonScript/src/Enums.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,13 @@ enum VirtualSpace
666666
PYSCR_SCVS_USERACCESSIBLE = SCVS_USERACCESSIBLE
667667
};
668668

669+
enum PhasesDraw
670+
{
671+
PYSCR_SC_PHASES_ONE = SC_PHASES_ONE,
672+
PYSCR_SC_PHASES_TWO = SC_PHASES_TWO,
673+
PYSCR_SC_PHASES_MULTIPLE = SC_PHASES_MULTIPLE
674+
};
675+
669676
enum EdgeVisualStyle
670677
{
671678
PYSCR_EDGE_NONE = EDGE_NONE,

PythonScript/src/EnumsWrapper.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,11 @@ void export_enums()
600600
.value("RECTANGULARSELECTION", PYSCR_SCVS_RECTANGULARSELECTION)
601601
.value("USERACCESSIBLE", PYSCR_SCVS_USERACCESSIBLE);
602602

603+
boost::python::enum_<PhasesDraw>("PHASESDRAW")
604+
.value("ONE", PYSCR_SC_PHASES_ONE)
605+
.value("TWO", PYSCR_SC_PHASES_TWO)
606+
.value("MULTIPLE", PYSCR_SC_PHASES_MULTIPLE);
607+
603608
boost::python::enum_<EdgeVisualStyle>("EDGEVISUALSTYLE")
604609
.value("NONE", PYSCR_EDGE_NONE)
605610
.value("LINE", PYSCR_EDGE_LINE)

PythonScript/src/Scintilla.iface

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,7 +1357,7 @@ get bool GetTwoPhaseDraw=2283(,)
13571357
# and then the foreground. This avoids chopping off characters that overlap the next run.
13581358
set void SetTwoPhaseDraw=2284(bool twoPhase,)
13591359

1360-
enu FontQuality=SC_PHASES_
1360+
enu PhasesDraw=SC_PHASES_
13611361
val SC_PHASES_ONE=0
13621362
val SC_PHASES_TWO=1
13631363
val SC_PHASES_MULTIPLE=2
@@ -2451,7 +2451,7 @@ get int GetLineEndTypesActive=2658(,)
24512451
# Set the way a character is drawn.
24522452
set void SetRepresentation=2665(string encodedCharacter, string representation)
24532453

2454-
# Set the way a character is drawn.
2454+
# Get the way a character is drawn.
24552455
# Result is NUL-terminated.
24562456
get int GetRepresentation=2666(string encodedCharacter, stringresult representation)
24572457

PythonScript/src/ScintillaPython.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ BOOST_PYTHON_MODULE(Npp)
751751
.def("getLineEndTypesAllowed", &ScintillaWrapper::GetLineEndTypesAllowed, "Get the line end types currently allowed.")
752752
.def("getLineEndTypesActive", &ScintillaWrapper::GetLineEndTypesActive, "Get the line end types currently recognised. May be a subset of the allowed types due to lexer limitation.")
753753
.def("setRepresentation", &ScintillaWrapper::SetRepresentation, boost::python::args("encodedCharacter", "representation"), "Set the way a character is drawn.")
754-
.def("getRepresentation", &ScintillaWrapper::GetRepresentation, boost::python::args("encodedCharacter"), "Set the way a character is drawn.\nResult is NUL-terminated.")
754+
.def("getRepresentation", &ScintillaWrapper::GetRepresentation, boost::python::args("encodedCharacter"), "Get the way a character is drawn.\nResult is NUL-terminated.")
755755
.def("clearRepresentation", &ScintillaWrapper::ClearRepresentation, boost::python::args("encodedCharacter"), "Remove a character representation.")
756756
.def("startRecord", &ScintillaWrapper::StartRecord, "Start notifying the container of all key presses and commands.")
757757
.def("stopRecord", &ScintillaWrapper::StopRecord, "Stop notifying the container of all key presses and commands.")

PythonScript/src/ScintillaWrapperGenerated.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4306,9 +4306,9 @@ void ScintillaWrapper::SetLengthForEncode(int bytes)
43064306
boost::python::str ScintillaWrapper::EncodedFromUTF8(boost::python::object utf8)
43074307
{
43084308
DEBUG_TRACE(L"ScintillaWrapper::EncodedFromUTF8\n");
4309-
std::string strinutf8 = getStringFromObject(utf8);
4310-
PythonCompatibleStrBuffer result(callScintilla(SCI_ENCODEDFROMUTF8, reinterpret_cast<WPARAM>(strinutf8.c_str()), 0));
4311-
callScintilla(SCI_ENCODEDFROMUTF8, reinterpret_cast<WPARAM>(strinutf8.c_str()), reinterpret_cast<LPARAM>(*result));
4309+
std::string utf8String = getStringFromObject(utf8);
4310+
PythonCompatibleStrBuffer result(callScintilla(SCI_ENCODEDFROMUTF8, reinterpret_cast<WPARAM>(utf8String.c_str()), 0));
4311+
callScintilla(SCI_ENCODEDFROMUTF8, reinterpret_cast<WPARAM>(utf8String.c_str()), reinterpret_cast<LPARAM>(*result));
43124312
return boost::python::str(result.c_str());
43134313
}
43144314

@@ -5662,9 +5662,9 @@ intptr_t ScintillaWrapper::PropertyType(boost::python::object name)
56625662
boost::python::str ScintillaWrapper::DescribeProperty(boost::python::object name)
56635663
{
56645664
DEBUG_TRACE(L"ScintillaWrapper::DescribeProperty\n");
5665-
std::string stringname = getStringFromObject(name);
5666-
PythonCompatibleStrBuffer result(callScintilla(SCI_DESCRIBEPROPERTY, reinterpret_cast<WPARAM>(stringname.c_str()), 0));
5667-
callScintilla(SCI_DESCRIBEPROPERTY, reinterpret_cast<WPARAM>(stringname.c_str()), reinterpret_cast<LPARAM>(*result));
5665+
std::string nameString = getStringFromObject(name);
5666+
PythonCompatibleStrBuffer result(callScintilla(SCI_DESCRIBEPROPERTY, reinterpret_cast<WPARAM>(nameString.c_str()), 0));
5667+
callScintilla(SCI_DESCRIBEPROPERTY, reinterpret_cast<WPARAM>(nameString.c_str()), reinterpret_cast<LPARAM>(*result));
56685668
return boost::python::str(result.c_str());
56695669
}
56705670

docs/source/enums.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1815,6 +1815,18 @@ ORDERING
18151815

18161816
.. attribute:: ORDERING.CUSTOM
18171817

1818+
PHASESDRAW
1819+
----------
1820+
1821+
.. _PHASESDRAW:
1822+
.. class:: PHASESDRAW
1823+
1824+
.. attribute:: PHASESDRAW.ONE
1825+
1826+
.. attribute:: PHASESDRAW.TWO
1827+
1828+
.. attribute:: PHASESDRAW.MULTIPLE
1829+
18181830
PRINTOPTION
18191831
-----------
18201832

0 commit comments

Comments
 (0)