From 020f8a1ba015ec033cda0f1eb07c30cccc430e01 Mon Sep 17 00:00:00 2001 From: Anne Marije v/d Meer Date: Wed, 9 Apr 2014 11:21:28 +0200 Subject: [PATCH] Move methods to pyGUIControl to pyGUIControlTextBox. --- .../FeatureLib/pfPython/pyGUIControl.cpp | 30 +++++++++++++++++++ .../Plasma/FeatureLib/pfPython/pyGUIControl.h | 2 ++ .../FeatureLib/pfPython/pyGUIControlGlue.cpp | 19 ++++++++++++ .../pfPython/pyGUIControlTextBox.cpp | 29 ------------------ .../FeatureLib/pfPython/pyGUIControlTextBox.h | 3 +- .../pfPython/pyGUIControlTextBoxGlue.cpp | 17 ----------- 6 files changed, 52 insertions(+), 48 deletions(-) diff --git a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/pyGUIControl.cpp b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/pyGUIControl.cpp index 2e9abc65..388851bb 100644 --- a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/pyGUIControl.cpp +++ b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/pyGUIControl.cpp @@ -444,3 +444,33 @@ void pyGUIControl::SetFontSize(UInt32 fontsize) } } } + +void pyGUIControl::SetFontFlags(UInt8 fontFlags) +{ + if (fGCkey) + { + // get the pointer to the modifier + pfGUIControlMod* pdmod = pfGUIControlMod::ConvertNoRef(fGCkey->ObjectIsLoaded()); + if (pdmod) + { + pfGUIColorScheme* colorscheme = pdmod->GetColorScheme(); + colorscheme->fFontFlags = fontFlags; + } + } +} + +UInt8 pyGUIControl::GetFontFlags() +{ + if (fGCkey) + { + // get the pointer to the modifier + pfGUIControlMod* pdmod = pfGUIControlMod::ConvertNoRef(fGCkey->ObjectIsLoaded()); + if (pdmod) + { + pfGUIColorScheme* colorscheme = pdmod->GetColorScheme(); + return colorscheme->fFontFlags; + } + } + return 0; +} + diff --git a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/pyGUIControl.h b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/pyGUIControl.h index 7444495b..b445a27c 100644 --- a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/pyGUIControl.h +++ b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/pyGUIControl.h @@ -121,12 +121,14 @@ public: virtual PyObject* GetBackColor(); // returns pyColor virtual PyObject* GetBackSelColor(); // returns pyColor virtual UInt32 GetFontSize(); + virtual UInt8 GetFontFlags(); // set color scheme virtual void SetForeColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ); virtual void SetSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ); virtual void SetBackColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ); virtual void SetBackSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ); virtual void SetFontSize(UInt32 fontsize); + virtual void SetFontFlags(UInt8 fontflags); }; diff --git a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/pyGUIControlGlue.cpp b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/pyGUIControlGlue.cpp index 935e8d06..932e771b 100644 --- a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/pyGUIControlGlue.cpp +++ b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/pyGUIControlGlue.cpp @@ -244,6 +244,23 @@ PYTHON_METHOD_DEFINITION_NOARGS(ptGUIControl, getFontSize) return PyLong_FromUnsignedLong(self->fThis->GetFontSize()); } +PYTHON_METHOD_DEFINITION_NOARGS(ptGUIControl, getFontFlags) +{ + return PyInt_FromLong(self->fThis->GetFontFlags()); +} + +PYTHON_METHOD_DEFINITION(ptGUIControl, setFontFlags, args) +{ + unsigned char fontflags; + if (!PyArg_ParseTuple(args, "b", &fontflags)) + { + PyErr_SetString(PyExc_TypeError, "setFontFlags expects an unsigned 8-bit int"); + PYTHON_RETURN_ERROR; + } + self->fThis->SetFontFlags(fontflags); + PYTHON_RETURN_NONE; +} + PYTHON_METHOD_DEFINITION(ptGUIControl, setForeColor, args) { float r, g, b, a; @@ -329,11 +346,13 @@ PYTHON_START_METHODS_TABLE(ptGUIControl) PYTHON_METHOD_NOARGS(ptGUIControl, getBackColor, "Returns the background color"), PYTHON_METHOD_NOARGS(ptGUIControl, getBackSelectColor, "Returns the background selection color"), PYTHON_METHOD_NOARGS(ptGUIControl, getFontSize, "Returns the font size"), + PYTHON_METHOD_NOARGS(ptGUIControl, getFontFlags, "Returns the current fontflags"), PYTHON_METHOD(ptGUIControl, setForeColor, "Params: r,g,b,a\nSets the foreground color"), PYTHON_METHOD(ptGUIControl, setSelectColor, "Params: r,g,b,a\nSets the selection color"), PYTHON_METHOD(ptGUIControl, setBackColor, "Params: r,g,b,a\nSets the background color"), PYTHON_METHOD(ptGUIControl, setBackSelectColor, "Params: r,g,b,a\nSets the selection background color"), PYTHON_METHOD(ptGUIControl, setFontSize, "Params: fontSize\nSets the font size"), + PYTHON_METHOD(ptGUIControl, setFontFlags, "Params: fontflags\nSets current fontflags"), PYTHON_END_METHODS_TABLE; // Type structure definition diff --git a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBox.cpp b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBox.cpp index 961a8f81..fecd6c43 100644 --- a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBox.cpp +++ b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBox.cpp @@ -215,32 +215,3 @@ UInt8 pyGUIControlTextBox::GetJustify() return pfGUIListText::kLeftJustify; } -void pyGUIControlTextBox::SetFontFlags(UInt8 fontFlags) -{ - if (fGCkey) - { - // get the pointer to the modifier - pfGUITextBoxMod* ptbmod = pfGUITextBoxMod::ConvertNoRef(fGCkey->ObjectIsLoaded()); - if (ptbmod) - { - pfGUIColorScheme* colorscheme = ptbmod->GetColorScheme(); - colorscheme->fFontFlags = fontFlags; - ptbmod->UpdateColorScheme(); - } - } -} - -UInt8 pyGUIControlTextBox::GetFontFlags() -{ - if (fGCkey) - { - // get the pointer to the modifier - pfGUITextBoxMod* ptbmod = pfGUITextBoxMod::ConvertNoRef(fGCkey->ObjectIsLoaded()); - if (ptbmod) - { - pfGUIColorScheme* colorscheme = ptbmod->GetColorScheme(); - return colorscheme->fFontFlags; - } - } - return 0; -} diff --git a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBox.h b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBox.h index a11076fd..fdc0565a 100644 --- a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBox.h +++ b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBox.h @@ -88,10 +88,9 @@ public: virtual void SetForeColor( pyColor& color ); virtual void SetBackColor( pyColor& color ); virtual void SetJustify( UInt8 justify ); - virtual void SetFontFlags(UInt8 fontflags); + virtual UInt8 GetJustify(); virtual PyObject* GetForeColor(); // returns pyColor - virtual UInt8 GetFontFlags(); }; #endif // _pyGUIControlTextBox_h_ diff --git a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBoxGlue.cpp b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBoxGlue.cpp index 6dd3ddf3..c20de702 100644 --- a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBoxGlue.cpp +++ b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBoxGlue.cpp @@ -185,22 +185,7 @@ PYTHON_METHOD_DEFINITION(ptGUIControlTextBox, setStringJustify, args) PYTHON_RETURN_NONE; } -PYTHON_METHOD_DEFINITION(ptGUIControlTextBox, setFontFlags, args) -{ - unsigned char fontflags; - if (!PyArg_ParseTuple(args, "b", &fontflags)) - { - PyErr_SetString(PyExc_TypeError, "setFontFlags expects an unsigned 8-bit int"); - PYTHON_RETURN_ERROR; - } - self->fThis->SetFontFlags(fontflags); - PYTHON_RETURN_NONE; -} -PYTHON_METHOD_DEFINITION_NOARGS(ptGUIControlTextBox, getFontFlags) -{ - return PyInt_FromLong(self->fThis->GetFontFlags()); -} PYTHON_METHOD_DEFINITION_NOARGS(ptGUIControlTextBox, getStringJustify) { @@ -221,10 +206,8 @@ PYTHON_START_METHODS_TABLE(ptGUIControlTextBox) PYTHON_METHOD(ptGUIControlTextBox, setForeColor, "Params: color\nSets the text forecolor to 'color', which is a ptColor object."), PYTHON_METHOD(ptGUIControlTextBox, setBackColor, "Params: color\nSets the text backcolor to 'color', which is a ptColor object."), PYTHON_METHOD(ptGUIControlTextBox, setStringJustify, "Params: justify\nSets current justify"), - PYTHON_METHOD(ptGUIControlTextBox, setFontFlags, "Params: fontflags\nSets current fontflags"), PYTHON_METHOD_NOARGS(ptGUIControlTextBox, getStringJustify, "Returns current justify"), PYTHON_METHOD_NOARGS(ptGUIControlTextBox, getForeColor, "Returns the current forecolor"), - PYTHON_METHOD_NOARGS(ptGUIControlTextBox, getFontFlags, "Returns the current fontflags"), PYTHON_END_METHODS_TABLE; // Type structure definition