Patch# 893337, Fix for line control point handling in wxLineShape
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27144 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -193,7 +193,27 @@ public:
|
|||||||
%extend {
|
%extend {
|
||||||
PyObject* GetLineControlPoints() {
|
PyObject* GetLineControlPoints() {
|
||||||
wxList* list = self->GetLineControlPoints();
|
wxList* list = self->GetLineControlPoints();
|
||||||
return wxPy_ConvertShapeList(list);
|
return wxPy_ConvertRealPointList(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
// part of Patch# 893337
|
||||||
|
void SetLineControlPoints(PyObject* list) {
|
||||||
|
wxList* real_point_list = wxPy_wxRealPoint_ListHelper(list);
|
||||||
|
self->MakeLineControlPoints((int)(real_point_list->GetCount()));
|
||||||
|
wxList* old_control_points = self->GetLineControlPoints();
|
||||||
|
wxNode* old_node = old_control_points->GetFirst();
|
||||||
|
wxNode* real_node = real_point_list->GetFirst();
|
||||||
|
while(old_node)
|
||||||
|
{
|
||||||
|
wxRealPoint* old_point = (wxRealPoint*)old_node->GetData();
|
||||||
|
wxRealPoint* new_point = (wxRealPoint*)real_node->GetData();
|
||||||
|
old_point->x = new_point->x;
|
||||||
|
old_point->y = new_point->y;
|
||||||
|
old_node = old_node->GetNext();
|
||||||
|
real_node = real_node->GetNext();
|
||||||
|
}
|
||||||
|
self->ClearPointList(*real_point_list);
|
||||||
|
delete real_point_list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,21 +302,7 @@ public:
|
|||||||
%extend {
|
%extend {
|
||||||
PyObject* GetPoints() {
|
PyObject* GetPoints() {
|
||||||
wxList* list = self->GetPoints();
|
wxList* list = self->GetPoints();
|
||||||
PyObject* pyList;
|
return wxPy_ConvertRealPointList(list);
|
||||||
PyObject* pyObj;
|
|
||||||
wxObject* wxObj;
|
|
||||||
wxNode* node = list->GetFirst();
|
|
||||||
|
|
||||||
bool blocked = wxPyBeginBlockThreads();
|
|
||||||
pyList = PyList_New(0);
|
|
||||||
while (node) {
|
|
||||||
wxObj = node->GetData();
|
|
||||||
pyObj = wxPyConstructObject(wxObj, wxT("wxRealPoint"), 0);
|
|
||||||
PyList_Append(pyList, pyObj);
|
|
||||||
node = node->GetNext();
|
|
||||||
}
|
|
||||||
wxPyEndBlockThreads(blocked);
|
|
||||||
return pyList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject* GetOriginalPoints() {
|
PyObject* GetOriginalPoints() {
|
||||||
|
@@ -256,6 +256,26 @@ PyObject* wxPyMake_wxShapeEvtHandler(wxShapeEvtHandler* source) {
|
|||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
PyObject* wxPy_ConvertRealPointList(wxListBase* list) {
|
||||||
|
PyObject* pyList;
|
||||||
|
PyObject* pyObj;
|
||||||
|
wxObject* wxObj;
|
||||||
|
wxNode* node = list->GetFirst();
|
||||||
|
|
||||||
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
|
pyList = PyList_New(0);
|
||||||
|
while (node) {
|
||||||
|
wxObj = node->GetData();
|
||||||
|
pyObj = wxPyConstructObject(wxObj, wxT("wxRealPoint"), 0);
|
||||||
|
PyList_Append(pyList, pyObj);
|
||||||
|
node = node->GetNext();
|
||||||
|
}
|
||||||
|
wxPyEndBlockThreads(blocked);
|
||||||
|
return pyList;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
PyObject* wxPy_ConvertShapeList(wxListBase* listbase) {
|
PyObject* wxPy_ConvertShapeList(wxListBase* listbase) {
|
||||||
wxList* list = (wxList*)listbase;
|
wxList* list = (wxList*)listbase;
|
||||||
PyObject* pyList;
|
PyObject* pyList;
|
||||||
|
@@ -101,7 +101,7 @@ wxList* wxPy_wxListHelper(PyObject* pyList, const wxChar* className);
|
|||||||
wxList* wxPy_wxRealPoint_ListHelper(PyObject* pyList);
|
wxList* wxPy_wxRealPoint_ListHelper(PyObject* pyList);
|
||||||
PyObject* wxPyMake_wxShapeEvtHandler(wxShapeEvtHandler* source);
|
PyObject* wxPyMake_wxShapeEvtHandler(wxShapeEvtHandler* source);
|
||||||
PyObject* wxPy_ConvertShapeList(wxListBase* list);
|
PyObject* wxPy_ConvertShapeList(wxListBase* list);
|
||||||
|
PyObject* wxPy_ConvertRealPointList(wxListBase* list);
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user