From 1c77a512f949bf04491b7b4feb9496ddcd892569 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=C2=ADn=20Lucas=20Golini?= Date: Sat, 11 Mar 2017 14:01:59 -0300 Subject: [PATCH] Changed some widget xml property names. --HG-- branch : dev --- src/eepp/ui/uilistbox.cpp | 30 +++++++++++++++--------------- src/eepp/ui/uipushbutton.cpp | 2 +- src/eepp/ui/uisprite.cpp | 2 +- src/eepp/ui/uitextedit.cpp | 6 +++--- src/eepp/ui/uitextinput.cpp | 6 +++--- src/eepp/ui/uitextview.cpp | 20 ++++++++++---------- src/eepp/ui/uiwidget.cpp | 26 +++++++++++++------------- src/test/eetest.cpp | 4 ++-- 8 files changed, 48 insertions(+), 48 deletions(-) diff --git a/src/eepp/ui/uilistbox.cpp b/src/eepp/ui/uilistbox.cpp index e4eb73ace..4edd47250 100644 --- a/src/eepp/ui/uilistbox.cpp +++ b/src/eepp/ui/uilistbox.cpp @@ -1057,19 +1057,19 @@ void UIListBox::loadFromXmlNode(const pugi::xml_node & node) { std::string name = ait->name(); String::toLowerInPlace( name ); - if ( "row-height" == name || "rowheight" == name ) { + if ( "rowheight" == name ) { setRowHeight( ait->as_int() ); - } else if ( "font-color" == name ) { + } else if ( "textcolor" == name ) { setFontColor( ColorA::fromString( ait->as_string() ) ); - } else if ( "font-shadow-color" == name ) { + } else if ( "textshadowcolor" == name ) { mFontStyleConfig.FontShadowColor = ( ColorA::fromString( ait->as_string() ) ); - } else if ( "font-over-color" == name ) { + } else if ( "textovercolor" == name ) { setFontOverColor( ColorA::fromString( ait->as_string() ) ); - } else if ( "font-selected-color" == name ) { + } else if ( "textselectedcolor" == name ) { setFontSelectedColor( ColorA::fromString( ait->as_string() ) ); - } else if ( "font-selection-back-color" == name ) { + } else if ( "textselectionbackcolor" == name ) { mFontStyleConfig.FontSelectionBackColor = ( ColorA::fromString( ait->as_string() ) ); - } else if ( "font-name" == name ) { + } else if ( "fontfamily" == name || "fontname" == name ) { Font * font = FontManager::instance()->getByName( ait->as_string() ); if ( NULL != font ) @@ -1077,27 +1077,27 @@ void UIListBox::loadFromXmlNode(const pugi::xml_node & node) { } else if ( "padding" == name ) { int val = ait->as_int(); setContainerPadding( Recti( val, val, val, val ) ); - } else if ( "padding_left" == name ) { + } else if ( "paddingleft" == name ) { setContainerPadding( Recti( ait->as_int(), mContainerPadding.Top, mContainerPadding.Right, mContainerPadding.Bottom ) ); - } else if ( "padding_right" == name ) { + } else if ( "paddingright" == name ) { setContainerPadding( Recti( mContainerPadding.Left, mContainerPadding.Top, ait->as_int(), mContainerPadding.Bottom ) ); - } else if ( "padding_top" == name ) { + } else if ( "paddingtop" == name ) { setContainerPadding( Recti( mContainerPadding.Left, ait->as_int(), mContainerPadding.Right, mContainerPadding.Bottom ) ); - } else if ( "padding_bottom" == name ) { + } else if ( "paddingbottom" == name ) { setContainerPadding( Recti( mContainerPadding.Left, mContainerPadding.Top, mContainerPadding.Right, ait->as_int() ) ); - } else if ( "vertical-scroll-mode" == name || "vscroll-mode" == name ) { + } else if ( "verticalscrollmode" == name || "vscrollmode" == name ) { std::string val = ait->as_string(); if ( "auto" == val ) setVerticalScrollMode( UI_SCROLLBAR_AUTO ); else if ( "on" == val ) setVerticalScrollMode( UI_SCROLLBAR_ALWAYS_ON ); else if ( "off" == val ) setVerticalScrollMode( UI_SCROLLBAR_ALWAYS_OFF ); - } else if ( "horizontal-scroll-mode" == name || "hscroll-mode" == name ) { + } else if ( "horizontalscrollmode" == name || "hscrollmode" == name ) { std::string val = ait->as_string(); if ( "auto" == val ) setHorizontalScrollMode( UI_SCROLLBAR_AUTO ); else if ( "on" == val ) setHorizontalScrollMode( UI_SCROLLBAR_ALWAYS_ON ); else if ( "off" == val ) setHorizontalScrollMode( UI_SCROLLBAR_ALWAYS_OFF ); - } else if ( "selected-index" == name || "selectedindex" == name ) { + } else if ( "selectedindex" == name ) { setSelected( ait->as_uint() ); - } else if ( "selected-text" == name || "selectedtext" == name ) { + } else if ( "selectedtext" == name ) { setSelected( ait->as_string() ); } } diff --git a/src/eepp/ui/uipushbutton.cpp b/src/eepp/ui/uipushbutton.cpp index 8df0f5e59..bec8ada50 100644 --- a/src/eepp/ui/uipushbutton.cpp +++ b/src/eepp/ui/uipushbutton.cpp @@ -298,7 +298,7 @@ void UIPushButton::loadFromXmlNode(const pugi::xml_node & node) { if ( "text" == name ) { setText( ait->as_string() ); - } else if ( "font-over-color" == name ) { + } else if ( "textovercolor" == name ) { setFontOverColor( ColorA::fromString( ait->as_string() ) ); } else if ( "icon" == name ) { std::string val = ait->as_string(); diff --git a/src/eepp/ui/uisprite.cpp b/src/eepp/ui/uisprite.cpp index ac74155fd..4f43d6f66 100644 --- a/src/eepp/ui/uisprite.cpp +++ b/src/eepp/ui/uisprite.cpp @@ -174,7 +174,7 @@ void UISprite::loadFromXmlNode(const pugi::xml_node & node) { std::string name = ait->name(); String::toLowerInPlace( name ); - if ( "src" == name || "sprite" == name ) { + if ( "src" == name ) { std::string val = ait->as_string(); if ( val.size() ) { diff --git a/src/eepp/ui/uitextedit.cpp b/src/eepp/ui/uitextedit.cpp index 99be90732..c69d7d928 100644 --- a/src/eepp/ui/uitextedit.cpp +++ b/src/eepp/ui/uitextedit.cpp @@ -445,14 +445,14 @@ void UITextEdit::loadFromXmlNode(const pugi::xml_node & node) { if ( "text" == name ) { setText( ait->as_string() ); - } else if ( "allow-editing" == name ) { + } else if ( "allowediting" == name ) { setAllowEditing( ait->as_bool() ); - } else if ( "vertical-scroll-mode" == name || "vscroll-mode" == name ) { + } else if ( "verticalscrollmode" == name || "vscrollmode" == name ) { std::string val = ait->as_string(); if ( "auto" == val ) setVerticalScrollMode( UI_SCROLLBAR_AUTO ); else if ( "on" == val ) setVerticalScrollMode( UI_SCROLLBAR_ALWAYS_ON ); else if ( "off" == val ) setVerticalScrollMode( UI_SCROLLBAR_ALWAYS_OFF ); - } else if ( "horizontal-scroll-mode" == name || "hscroll-mode" == name ) { + } else if ( "horizontalscrollmode" == name || "hscrollmode" == name ) { std::string val = ait->as_string(); if ( "auto" == val ) setHorizontalScrollMode( UI_SCROLLBAR_AUTO ); else if ( "on" == val ) setHorizontalScrollMode( UI_SCROLLBAR_ALWAYS_ON ); diff --git a/src/eepp/ui/uitextinput.cpp b/src/eepp/ui/uitextinput.cpp index 6d6b8c8ea..5b3ea8a83 100644 --- a/src/eepp/ui/uitextinput.cpp +++ b/src/eepp/ui/uitextinput.cpp @@ -332,11 +332,11 @@ void UITextInput::loadFromXmlNode(const pugi::xml_node & node) { if ( "text" == name ) { setText( ait->as_string() ); - } else if ( "allow-editing" == name ) { + } else if ( "allowediting" == name ) { setAllowEditing( ait->as_bool() ); - } else if ( "max-length" == name ) { + } else if ( "maxlength" == name ) { setMaxLength( ait->as_uint() ); - } else if ( "free-editing" == name ) { + } else if ( "freeediting" == name ) { setFreeEditing( ait->as_bool() ); } } diff --git a/src/eepp/ui/uitextview.cpp b/src/eepp/ui/uitextview.cpp index 1a2d5efd3..275e9c4f5 100644 --- a/src/eepp/ui/uitextview.cpp +++ b/src/eepp/ui/uitextview.cpp @@ -402,17 +402,17 @@ void UITextView::loadFromXmlNode(const pugi::xml_node & node) { if ( "text" == name ) { setText( ait->as_string() ); - } else if ( "font-color" == name ) { + } else if ( "textcolor" == name ) { setFontColor( ColorA::fromString( ait->as_string() ) ); - } else if ( "font-shadow-color" == name ) { + } else if ( "textshadowcolor" == name ) { setFontShadowColor( ColorA::fromString( ait->as_string() ) ); - } else if ( "font-over-color" == name ) { + } else if ( "textovercolor" == name ) { mFontStyleConfig.FontOverColor = ColorA::fromString( ait->as_string() ); - } else if ( "font-selected-color" == name ) { + } else if ( "textselectedcolor" == name ) { mFontStyleConfig.FontSelectedColor = ColorA::fromString( ait->as_string() ); - } else if ( "font-selection-back-color" == name ) { + } else if ( "textselectionbackcolor" == name ) { setSelectionBackColor( ColorA::fromString( ait->as_string() ) ); - } else if ( "font-name" == name ) { + } else if ( "fontfamily" == name || "fontname" == name ) { Font * font = FontManager::instance()->getByName( ait->as_string() ); if ( NULL != font ) @@ -420,13 +420,13 @@ void UITextView::loadFromXmlNode(const pugi::xml_node & node) { } else if ( "padding" == name ) { int val = ait->as_int(); setPadding( Recti( val, val, val, val ) ); - } else if ( "padding_left" == name ) { + } else if ( "paddingleft" == name ) { setPadding( Recti( ait->as_int(), mPadding.Top, mPadding.Right, mPadding.Bottom ) ); - } else if ( "padding_right" == name ) { + } else if ( "paddingright" == name ) { setPadding( Recti( mPadding.Left, mPadding.Top, ait->as_int(), mPadding.Bottom ) ); - } else if ( "padding_top" == name ) { + } else if ( "paddingtop" == name ) { setPadding( Recti( mPadding.Left, ait->as_int(), mPadding.Right, mPadding.Bottom ) ); - } else if ( "padding_bottom" == name ) { + } else if ( "paddingbottom" == name ) { setPadding( Recti( mPadding.Left, mPadding.Top, mPadding.Right, ait->as_int() ) ); } } diff --git a/src/eepp/ui/uiwidget.cpp b/src/eepp/ui/uiwidget.cpp index d1516b77e..f11198ccd 100644 --- a/src/eepp/ui/uiwidget.cpp +++ b/src/eepp/ui/uiwidget.cpp @@ -355,11 +355,11 @@ void UIWidget::loadFromXmlNode( const pugi::xml_node& node ) { } else if ( "height" == name ) { setInternalHeight( ait->as_int() ); notifyLayoutAttrChange(); - } else if ( "background-color" == name ) { + } else if ( "backgroundcolor" == name ) { setBackgroundFillEnabled( true )->setColor( ColorA::fromString( ait->as_string() ) ); - } else if ( "border-color" == name ) { + } else if ( "bordercolor" == name ) { setBorderEnabled( true )->setColor( ColorA::fromString( ait->as_string() ) ); - } else if ( "border-width" == name ) { + } else if ( "borderwidth" == name ) { setBorderEnabled( true )->setWidth( ait->as_uint(1) ); } else if ( "visible" == name ) { setVisible( ait->as_bool() ); @@ -423,7 +423,7 @@ void UIWidget::loadFromXmlNode( const pugi::xml_node& node ) { } else if ( "auto_padding" == cur || "autopadding" == cur ) { setFlags( UI_AUTO_PADDING ); notifyLayoutAttrChange(); - } else if ( "report_size_change_to_childs" == cur ) { + } else if ( "reportsizechangetochilds" == cur || "report_size_change_to_childs" == cur ) { setFlags( UI_REPORT_SIZE_CHANGE_TO_CHILDS ); } } @@ -431,13 +431,13 @@ void UIWidget::loadFromXmlNode( const pugi::xml_node& node ) { } else if ( "layout_margin" == name ) { int val = ait->as_int(); setLayoutMargin( Recti( val, val, val, val ) ); - } else if ( "layout_margin_left" == name ) { + } else if ( "layout_marginleft" == name ) { setLayoutMargin( Recti( ait->as_int(), mLayoutMargin.Top, mLayoutMargin.Right, mLayoutMargin.Bottom ) ); - } else if ( "layout_margin_right" == name ) { + } else if ( "layout_marginright" == name ) { setLayoutMargin( Recti( mLayoutMargin.Left, mLayoutMargin.Top, ait->as_int(), mLayoutMargin.Bottom ) ); - } else if ( "layout_margin_top" == name ) { + } else if ( "layout_margintop" == name ) { setLayoutMargin( Recti( mLayoutMargin.Left, ait->as_int(), mLayoutMargin.Right, mLayoutMargin.Bottom ) ); - } else if ( "layout_margin_bottom" == name ) { + } else if ( "layout_marginbottom" == name ) { setLayoutMargin( Recti( mLayoutMargin.Left, mLayoutMargin.Top, mLayoutMargin.Right, ait->as_int() ) ); } else if ( "tooltip" == name ) { setTooltipText( ait->as_string() ); @@ -495,12 +495,12 @@ void UIWidget::loadFromXmlNode( const pugi::xml_node& node ) { } else if ( "fixed" == val ) { setLayoutHeightRules( FIXED ); } - } else if ( String::startsWith( name, "layout_to_" ) ) { + } else if ( String::startsWith( name, "layout_to_" ) || String::startsWith( name, "layoutto" ) ) { LayoutPositionRules rule = NONE; - if ( "layout_to_left_of" == name ) rule = LEFT_OF; - else if ( "layout_to_right_of" == name ) rule = RIGHT_OF; - else if ( "layout_to_top_of" == name ) rule = TOP_OF; - else if ( "layout_to_bottom_of" == name ) rule = BOTTOM_OF; + if ( "layout_to_left_of" == name || "layouttoleftof" == name ) rule = LEFT_OF; + else if ( "layout_to_right_of" == name || "layouttorightof" == name ) rule = RIGHT_OF; + else if ( "layout_to_top_of" == name || "layouttotopof" == name ) rule = TOP_OF; + else if ( "layout_to_bottom_of" == name || "layouttobottomof" == name ) rule = BOTTOM_OF; std::string id = ait->as_string(); diff --git a/src/test/eetest.cpp b/src/test/eetest.cpp index 434102255..33c319d97 100644 --- a/src/test/eetest.cpp +++ b/src/test/eetest.cpp @@ -711,12 +711,12 @@ void EETest::createNewUI() { UIManager::instance()->loadLayoutFromString( "" " " - " " + " " " " " " " " " " - " " + " " " Test Item" " Test Item 2" " "