From 05573d6d8d9e5a756ab1b03b159b127144f8e775 Mon Sep 17 00:00:00 2001 From: ROllerozxa Date: Wed, 29 Dec 2021 23:00:16 +0100 Subject: Remove unused (de)serializeAttributes() methods --- src/gui/guiButton.cpp | 79 ------------------------------------ src/gui/guiButton.h | 8 ---- src/gui/guiEditBox.cpp | 51 ----------------------- src/gui/guiEditBox.h | 8 ---- src/gui/guiEditBoxWithScrollbar.cpp | 20 --------- src/gui/guiEditBoxWithScrollbar.h | 6 --- src/gui/guiSkin.cpp | 42 ------------------- src/gui/guiSkin.h | 10 ----- src/irrlicht_changes/static_text.cpp | 44 -------------------- src/irrlicht_changes/static_text.h | 6 --- 10 files changed, 274 deletions(-) diff --git a/src/gui/guiButton.cpp b/src/gui/guiButton.cpp index d6dbddf54..ba95b81c3 100644 --- a/src/gui/guiButton.cpp +++ b/src/gui/guiButton.cpp @@ -632,85 +632,6 @@ bool GUIButton::isDrawingBorder() const } -//! Writes attributes of the element. -void GUIButton::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const -{ - IGUIButton::serializeAttributes(out,options); - - out->addBool ("PushButton", IsPushButton ); - if (IsPushButton) - out->addBool("Pressed", Pressed); - - for ( u32 i=0; i<(u32)EGBIS_COUNT; ++i ) - { - if ( ButtonImages[i].Texture ) - { - core::stringc name( GUIButtonImageStateNames[i] ); - out->addTexture(name.c_str(), ButtonImages[i].Texture); - name += "Rect"; - out->addRect(name.c_str(), ButtonImages[i].SourceRect); - } - } - - out->addBool ("UseAlphaChannel", UseAlphaChannel); - out->addBool ("Border", DrawBorder); - out->addBool ("ScaleImage", ScaleImage); - - for ( u32 i=0; i<(u32)EGBS_COUNT; ++i ) - { - if ( ButtonSprites[i].Index >= 0 ) - { - core::stringc nameIndex( GUIButtonStateNames[i] ); - nameIndex += "Index"; - out->addInt(nameIndex.c_str(), ButtonSprites[i].Index ); - - core::stringc nameColor( GUIButtonStateNames[i] ); - nameColor += "Color"; - out->addColor(nameColor.c_str(), ButtonSprites[i].Color ); - - core::stringc nameLoop( GUIButtonStateNames[i] ); - nameLoop += "Loop"; - out->addBool(nameLoop.c_str(), ButtonSprites[i].Loop ); - - core::stringc nameScale( GUIButtonStateNames[i] ); - nameScale += "Scale"; - out->addBool(nameScale.c_str(), ButtonSprites[i].Scale ); - } - } - - // out->addString ("OverrideFont", OverrideFont); -} - - -//! Reads attributes of the element -void GUIButton::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) -{ - IGUIButton::deserializeAttributes(in,options); - - IsPushButton = in->getAttributeAsBool("PushButton"); - Pressed = IsPushButton ? in->getAttributeAsBool("Pressed") : false; - - core::rect rec = in->getAttributeAsRect("ImageRect"); - if (rec.isValid()) - setImage( in->getAttributeAsTexture("Image"), rec); - else - setImage( in->getAttributeAsTexture("Image") ); - - rec = in->getAttributeAsRect("PressedImageRect"); - if (rec.isValid()) - setPressedImage( in->getAttributeAsTexture("PressedImage"), rec); - else - setPressedImage( in->getAttributeAsTexture("PressedImage") ); - - setDrawBorder(in->getAttributeAsBool("Border")); - setUseAlphaChannel(in->getAttributeAsBool("UseAlphaChannel")); - setScaleImage(in->getAttributeAsBool("ScaleImage")); - - // setOverrideFont(in->getAttributeAsString("OverrideFont")); - - updateAbsolutePosition(); -} - // PATCH GUIButton* GUIButton::addButton(IGUIEnvironment *environment, const core::rect& rectangle, ISimpleTextureSource *tsrc, diff --git a/src/gui/guiButton.h b/src/gui/guiButton.h index 834405f51..ee9bb6f21 100644 --- a/src/gui/guiButton.h +++ b/src/gui/guiButton.h @@ -221,14 +221,6 @@ public: return ClickControlState; } - //! Writes attributes of the element. - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const override; - - //! Reads attributes of the element - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) override; - - - void setColor(video::SColor color); // PATCH //! Set element properties from a StyleSpec corresponding to the button state diff --git a/src/gui/guiEditBox.cpp b/src/gui/guiEditBox.cpp index 8459107cd..4a0f5013d 100644 --- a/src/gui/guiEditBox.cpp +++ b/src/gui/guiEditBox.cpp @@ -846,54 +846,3 @@ void GUIEditBox::updateVScrollBar() } } } - -void GUIEditBox::deserializeAttributes( - io::IAttributes *in, io::SAttributeReadWriteOptions *options = 0) -{ - IGUIEditBox::deserializeAttributes(in, options); - - setOverrideColor(in->getAttributeAsColor("OverrideColor")); - enableOverrideColor(in->getAttributeAsBool("OverrideColorEnabled")); - setMax(in->getAttributeAsInt("MaxChars")); - setWordWrap(in->getAttributeAsBool("WordWrap")); - setMultiLine(in->getAttributeAsBool("MultiLine")); - setAutoScroll(in->getAttributeAsBool("AutoScroll")); - core::stringw ch = in->getAttributeAsStringW("PasswordChar"); - - if (ch.empty()) - setPasswordBox(in->getAttributeAsBool("PasswordBox")); - else - setPasswordBox(in->getAttributeAsBool("PasswordBox"), ch[0]); - - setTextAlignment((EGUI_ALIGNMENT)in->getAttributeAsEnumeration( - "HTextAlign", GUIAlignmentNames), - (EGUI_ALIGNMENT)in->getAttributeAsEnumeration( - "VTextAlign", GUIAlignmentNames)); - - setWritable(in->getAttributeAsBool("Writable")); - // setOverrideFont(in->getAttributeAsFont("OverrideFont")); -} - -//! Writes attributes of the element. -void GUIEditBox::serializeAttributes( - io::IAttributes *out, io::SAttributeReadWriteOptions *options = 0) const -{ - // IGUIEditBox::serializeAttributes(out,options); - - out->addBool("OverrideColorEnabled", m_override_color_enabled); - out->addColor("OverrideColor", m_override_color); - // out->addFont("OverrideFont",m_override_font); - out->addInt("MaxChars", m_max); - out->addBool("WordWrap", m_word_wrap); - out->addBool("MultiLine", m_multiline); - out->addBool("AutoScroll", m_autoscroll); - out->addBool("PasswordBox", m_passwordbox); - core::stringw ch = L" "; - ch[0] = m_passwordchar; - out->addString("PasswordChar", ch.c_str()); - out->addEnum("HTextAlign", m_halign, GUIAlignmentNames); - out->addEnum("VTextAlign", m_valign, GUIAlignmentNames); - out->addBool("Writable", m_writable); - - IGUIEditBox::serializeAttributes(out, options); -} diff --git a/src/gui/guiEditBox.h b/src/gui/guiEditBox.h index 2a5c911bc..4c7413f54 100644 --- a/src/gui/guiEditBox.h +++ b/src/gui/guiEditBox.h @@ -130,14 +130,6 @@ public: //! called if an event happened. virtual bool OnEvent(const SEvent &event); - //! Writes attributes of the element. - virtual void serializeAttributes(io::IAttributes *out, - io::SAttributeReadWriteOptions *options) const; - - //! Reads attributes of the element - virtual void deserializeAttributes( - io::IAttributes *in, io::SAttributeReadWriteOptions *options); - virtual bool acceptsIME() { return isEnabled() && m_writable; }; protected: diff --git a/src/gui/guiEditBoxWithScrollbar.cpp b/src/gui/guiEditBoxWithScrollbar.cpp index fb4bc2a0b..1b7f7832a 100644 --- a/src/gui/guiEditBoxWithScrollbar.cpp +++ b/src/gui/guiEditBoxWithScrollbar.cpp @@ -652,26 +652,6 @@ void GUIEditBoxWithScrollBar::setBackgroundColor(const video::SColor &bg_color) m_bg_color_used = true; } -//! Writes attributes of the element. -void GUIEditBoxWithScrollBar::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options = 0) const -{ - out->addBool("Border", m_border); - out->addBool("Background", m_background); - // out->addFont("OverrideFont", OverrideFont); - - GUIEditBox::serializeAttributes(out, options); -} - - -//! Reads attributes of the element -void GUIEditBoxWithScrollBar::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options = 0) -{ - GUIEditBox::deserializeAttributes(in, options); - - setDrawBorder(in->getAttributeAsBool("Border")); - setDrawBackground(in->getAttributeAsBool("Background")); -} - bool GUIEditBoxWithScrollBar::isDrawBackgroundEnabled() const { return false; } bool GUIEditBoxWithScrollBar::isDrawBorderEnabled() const { return false; } void GUIEditBoxWithScrollBar::setCursorChar(const wchar_t cursorChar) { } diff --git a/src/gui/guiEditBoxWithScrollbar.h b/src/gui/guiEditBoxWithScrollbar.h index 3f7450dcb..cea482fc2 100644 --- a/src/gui/guiEditBoxWithScrollbar.h +++ b/src/gui/guiEditBoxWithScrollbar.h @@ -31,12 +31,6 @@ public: //! Change the background color virtual void setBackgroundColor(const video::SColor &bg_color); - //! Writes attributes of the element. - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const; - - //! Reads attributes of the element - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options); - virtual bool isDrawBackgroundEnabled() const; virtual bool isDrawBorderEnabled() const; virtual void setCursorChar(const wchar_t cursorChar); diff --git a/src/gui/guiSkin.cpp b/src/gui/guiSkin.cpp index e09209bd9..ca692f6cb 100644 --- a/src/gui/guiSkin.cpp +++ b/src/gui/guiSkin.cpp @@ -1024,48 +1024,6 @@ void GUISkin::draw2DRectangle(IGUIElement* element, } -//! Writes attributes of the object. -//! Implement this to expose the attributes of your scene node animator for -//! scripting languages, editors, debuggers or xml serialization purposes. -void GUISkin::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const -{ - u32 i; - for (i=0; iaddColor(GUISkinColorNames[i], Colors[i]); - - for (i=0; iaddInt(GUISkinSizeNames[i], Sizes[i]); - - for (i=0; iaddString(GUISkinTextNames[i], Texts[i].c_str()); - - for (i=0; iaddInt(GUISkinIconNames[i], Icons[i]); -} - - -//! Reads attributes of the object. -//! Implement this to set the attributes of your scene node animator for -//! scripting languages, editors, debuggers or xml deserialization purposes. -void GUISkin::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) -{ - // TODO: This is not nice code for downward compatibility, whenever new values are added and users - // load an old skin the corresponding values will be set to 0. - u32 i; - for (i=0; igetAttributeAsColor(GUISkinColorNames[i]); - - for (i=0; igetAttributeAsInt(GUISkinSizeNames[i]); - - for (i=0; igetAttributeAsStringW(GUISkinTextNames[i]); - - for (i=0; igetAttributeAsInt(GUISkinIconNames[i]); -} - - //! gets the colors // PATCH void GUISkin::getColors(video::SColor* colors) diff --git a/src/gui/guiSkin.h b/src/gui/guiSkin.h index bbb900f9f..fa9b27bdd 100644 --- a/src/gui/guiSkin.h +++ b/src/gui/guiSkin.h @@ -290,16 +290,6 @@ namespace gui //! get the type of this skin virtual EGUI_SKIN_TYPE getType() const; - //! Writes attributes of the object. - //! Implement this to expose the attributes of your scene node animator for - //! scripting languages, editors, debuggers or xml serialization purposes. - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const; - - //! Reads attributes of the object. - //! Implement this to set the attributes of your scene node animator for - //! scripting languages, editors, debuggers or xml deserialization purposes. - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0); - //! gets the colors virtual void getColors(video::SColor* colors); // ::PATCH: diff --git a/src/irrlicht_changes/static_text.cpp b/src/irrlicht_changes/static_text.cpp index 8908a91f7..f548c3f71 100644 --- a/src/irrlicht_changes/static_text.cpp +++ b/src/irrlicht_changes/static_text.cpp @@ -588,50 +588,6 @@ s32 StaticText::getTextWidth() const } -//! Writes attributes of the element. -//! Implement this to expose the attributes of your element for -//! scripting languages, editors, debuggers or xml serialization purposes. -void StaticText::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const -{ - IGUIStaticText::serializeAttributes(out,options); - - out->addBool ("Border", Border); - out->addBool ("OverrideColorEnabled",true); - out->addBool ("OverrideBGColorEnabled",ColoredText.hasBackground()); - out->addBool ("WordWrap", WordWrap); - out->addBool ("Background", Background); - out->addBool ("RightToLeft", RightToLeft); - out->addBool ("RestrainTextInside", RestrainTextInside); - out->addColor ("OverrideColor", ColoredText.getDefaultColor()); - out->addColor ("BGColor", ColoredText.getBackground()); - out->addEnum ("HTextAlign", HAlign, GUIAlignmentNames); - out->addEnum ("VTextAlign", VAlign, GUIAlignmentNames); - - // out->addFont ("OverrideFont", OverrideFont); -} - - -//! Reads attributes of the element -void StaticText::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) -{ - IGUIStaticText::deserializeAttributes(in,options); - - Border = in->getAttributeAsBool("Border"); - setWordWrap(in->getAttributeAsBool("WordWrap")); - Background = in->getAttributeAsBool("Background"); - RightToLeft = in->getAttributeAsBool("RightToLeft"); - RestrainTextInside = in->getAttributeAsBool("RestrainTextInside"); - if (in->getAttributeAsBool("OverrideColorEnabled")) - ColoredText.setDefaultColor(in->getAttributeAsColor("OverrideColor")); - if (in->getAttributeAsBool("OverrideBGColorEnabled")) - ColoredText.setBackground(in->getAttributeAsColor("BGColor")); - - setTextAlignment( (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("HTextAlign", GUIAlignmentNames), - (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("VTextAlign", GUIAlignmentNames)); - - // OverrideFont = in->getAttributeAsFont("OverrideFont"); -} - } // end namespace gui #endif // USE_FREETYPE diff --git a/src/irrlicht_changes/static_text.h b/src/irrlicht_changes/static_text.h index 83bbf4c3d..17a3bf753 100644 --- a/src/irrlicht_changes/static_text.h +++ b/src/irrlicht_changes/static_text.h @@ -184,12 +184,6 @@ namespace gui //! Checks if the text should be interpreted as right-to-left text virtual bool isRightToLeft() const; - //! Writes attributes of the element. - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const; - - //! Reads attributes of the element - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options); - virtual bool hasType(EGUI_ELEMENT_TYPE t) const { return (t == EGUIET_ENRICHED_STATIC_TEXT) || (t == EGUIET_STATIC_TEXT); }; -- cgit v1.2.3