diff --git a/data/gui/arenas.stkgui b/data/gui/arenas.stkgui index 7f0603d69..74fd7ff20 100644 --- a/data/gui/arenas.stkgui +++ b/data/gui/arenas.stkgui @@ -9,7 +9,7 @@ <spacer width="20" height="5" /> - <box proportion="1" width="100%" layout="vertical-row"> + <box proportion="1" width="100%" layout="vertical-row" padding="2"> <ribbon_grid id="tracks" proportion="1" width="100%" square_items="true" label_location="bottom" align="center" child_width="160" child_height="120" /> <spacer width="20" height="13" /> diff --git a/data/gui/credits.stkgui b/data/gui/credits.stkgui index c1cdb0b74..0c1afd656 100644 --- a/data/gui/credits.stkgui +++ b/data/gui/credits.stkgui @@ -1,14 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> <stkgui> <icon-button id="back" x="0" y="0" height="8%" icon="gui/back.png"/> - <div x="5%" y="2%" width="90%" height="96%" layout="vertical-row" > + <div x="2%" y="2%" width="98%" height="96%" layout="vertical-row" > <icon id="logo" align="center" proportion="4" width="100%" icon="gui/logo_slim.png"/> <header I18N="Title in credits screen" text="Credits" width="100%" /> - <box id="animated_area" width="100%" proportion="10"> + <box id="animated_area" width="100%" proportion="10" padding="0"> </box> diff --git a/data/gui/help1.stkgui b/data/gui/help1.stkgui index 7175e763f..46ee75fac 100644 Binary files a/data/gui/help1.stkgui and b/data/gui/help1.stkgui differ diff --git a/data/gui/help2.stkgui b/data/gui/help2.stkgui index 3da87df1d..a535e4e6c 100644 Binary files a/data/gui/help2.stkgui and b/data/gui/help2.stkgui differ diff --git a/data/gui/help3.stkgui b/data/gui/help3.stkgui index 22f67a691..9d117eebf 100644 Binary files a/data/gui/help3.stkgui and b/data/gui/help3.stkgui differ diff --git a/data/gui/help4.stkgui b/data/gui/help4.stkgui index c942ebc16..01785f3ad 100644 Binary files a/data/gui/help4.stkgui and b/data/gui/help4.stkgui differ diff --git a/data/gui/karts.stkgui b/data/gui/karts.stkgui index aa1eb3a49..0fc910355 100644 --- a/data/gui/karts.stkgui +++ b/data/gui/karts.stkgui @@ -1,6 +1,6 @@ <stkgui> -<div x="2%" y="1%" width="96%" height="99%" layout="vertical-row" > +<div x="1%" y="1%" width="98%" height="99%" layout="vertical-row" > <header width="80%" I18N="In the kart selection (player setup) screen" @@ -13,13 +13,13 @@ <spacer height="15" width="25"/> - <box proportion="2" width="100%" layout="vertical-row"> + <box proportion="2" width="100%" layout="vertical-row" padding="2"> <ribbon_grid id="karts" proportion="1" square_items="true" width="100%" align="center" child_width="90" child_height="90" max_rows="3"/> </box> <!-- Groups will be added dynamically at runtime --> - <tabs width="100%" height="25" id="kartgroups"> + <tabs width="98%" x="1%" height="25" id="kartgroups"> </tabs> <spacer width="100%" height="2%"/> </div> diff --git a/data/gui/options_audio.stkgui b/data/gui/options_audio.stkgui index 00762d1d6..c79d861ff 100644 --- a/data/gui/options_audio.stkgui +++ b/data/gui/options_audio.stkgui @@ -1,11 +1,11 @@ <stkgui> -<div x="2%" y="2%" width="96%" height="97%" layout="vertical-row" > +<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" > <header text_align="center" width="80%" align="center" text="SuperTuxKart Options"/> <spacer height="15" width="10"/> - <tabs id="options_choice" height="10%" max_height="110" width="100%" align="center"> + <tabs id="options_choice" height="10%" max_height="110" x="2%" width="98%"" align="center"> <icon-button id="tab_video" width="128" height="128" icon="gui/options_video.png"/> <icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png" I18N="Section in the settings menu" text="Audio"/> @@ -16,7 +16,7 @@ <box proportion="1" width="100%" layout="vertical-row"> - <spacer height="15" width="10"/> + <spacer height="5" width="10"/> <!-- ******** Music ******** --> <label width="100%" I18N="Section in the audio/video settings submenu" text="Music"/> diff --git a/data/gui/options_device.stkgui b/data/gui/options_device.stkgui index 2e70ba1af..c7b662bc6 100644 --- a/data/gui/options_device.stkgui +++ b/data/gui/options_device.stkgui @@ -1,11 +1,11 @@ <stkgui> -<div x="2%" y="2%" width="96%" height="97%" layout="vertical-row" > +<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" > <header text_align="center" width="80%" align="center" text="SuperTuxKart Options"/> <spacer height="15" width="10"/> - <tabs id="options_choice" height="10%" max_height="110" width="100%" align="center"> + <tabs id="options_choice" height="10%" max_height="110" x="2%" width="98%" align="center"> <icon-button id="tab_video" width="128" height="128" icon="gui/options_video.png"/> <icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"/> <icon-button id="tab_ui" width="128" height="128" icon="gui/options_ui.png"/> @@ -28,6 +28,7 @@ <spacer width="50" height="20" /> <div proportion="2" width="100%" layout="horizontal-row"> + <spacer width="7" height="5"/> <div height="100%" width="fit" layout="vertical-row"> <button id="delete" I18N="To delete a keyboard configuration" text="Delete Configuration"/> diff --git a/data/gui/options_input.stkgui b/data/gui/options_input.stkgui index ed35f8373..1fd60722c 100644 --- a/data/gui/options_input.stkgui +++ b/data/gui/options_input.stkgui @@ -1,11 +1,11 @@ <stkgui> -<div x="2%" y="2%" width="96%" height="97%" layout="vertical-row" > +<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" > <header text_align="center" width="80%" align="center" text="SuperTuxKart Options"/> <spacer height="15" width="10"/> - <tabs id="options_choice" height="10%" max_height="110" width="100%" align="center"> + <tabs id="options_choice" height="10%" max_height="110" x="2%" width="98%" align="center"> <icon-button id="tab_video" width="128" height="128" icon="gui/options_video.png"/> <icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"/> <icon-button id="tab_ui" width="128" height="128" icon="gui/options_ui.png"/> @@ -15,9 +15,6 @@ </tabs> <box proportion="1" width="100%" layout="vertical-row"> - - <spacer width="5" height="5"/> - <label width="100%" I18N="In key bindings configuration menu" text="Press enter or double-click on a device to configure it" diff --git a/data/gui/options_players.stkgui b/data/gui/options_players.stkgui index 391ff1b63..9255f69ac 100644 --- a/data/gui/options_players.stkgui +++ b/data/gui/options_players.stkgui @@ -1,11 +1,11 @@ <stkgui> -<div x="2%" y="2%" width="96%" height="97%" layout="vertical-row" > +<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" > <header text_align="center" width="80%" align="center" text="SuperTuxKart Options"/> <spacer height="15" width="10"/> - <tabs id="options_choice" height="10%" max_height="110" width="100%" align="center"> + <tabs id="options_choice" height="10%" max_height="110" x="2%" width="98%" align="center"> <icon-button id="tab_video" width="128" height="128" icon="gui/options_video.png"/> <icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"/> <icon-button id="tab_ui" width="128" height="128" icon="gui/options_ui.png"/> diff --git a/data/gui/options_ui.stkgui b/data/gui/options_ui.stkgui index 89a1918cb..5cc853979 100644 --- a/data/gui/options_ui.stkgui +++ b/data/gui/options_ui.stkgui @@ -1,11 +1,11 @@ <stkgui> -<div x="2%" y="2%" width="96%" height="97%" layout="vertical-row" > +<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" > <header text_align="center" width="80%" align="center" text="SuperTuxKart Options"/> <spacer height="15" width="10"/> - <tabs id="options_choice" height="10%" max_height="110" width="100%" align="center"> + <tabs id="options_choice" height="10%" max_height="110" x="2%" width="98%" align="center"> <icon-button id="tab_video" width="128" height="128" icon="gui/options_video.png"/> <icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"/> <icon-button id="tab_ui" width="128" height="128" icon="gui/options_ui.png" @@ -16,7 +16,7 @@ <box proportion="1" width="100%" layout="vertical-row"> - <spacer height="18" width="10"/> + <spacer height="5" width="10"/> <!-- ************ SKIN CHOICE ************ --> <div layout="horizontal-row" width="100%" height="fit"> diff --git a/data/gui/options_video.stkgui b/data/gui/options_video.stkgui index 9e538da8f..c90eb4851 100644 --- a/data/gui/options_video.stkgui +++ b/data/gui/options_video.stkgui @@ -1,11 +1,11 @@ <stkgui> -<div x="2%" y="2%" width="96%" height="97%" layout="vertical-row" > +<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" > <header text_align="center" width="80%" align="center" text="SuperTuxKart Options"/> <spacer height="15" width="10"/> - <tabs id="options_choice" height="10%" max_height="110" width="100%" align="center"> + <tabs id="options_choice" height="10%" max_height="110" x="2%" width="98%" align="center"> <icon-button id="tab_video" width="128" height="128" icon="gui/options_video.png" I18N="Section in the settings menu" text="Graphics"/> <icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"/> diff --git a/data/gui/skins/Peach.stkskin b/data/gui/skins/Peach.stkskin index c1018edb8..671a45a3d 100644 --- a/data/gui/skins/Peach.stkskin +++ b/data/gui/skins/Peach.stkskin @@ -180,12 +180,12 @@ when the border that intersect at this corner are enabled. <!-- Stateless --> <element type="section" image="peach/glass_section.png" left_border="15" right_border="15" top_border="15" bottom_border="15" - hborder_out_portion="1.0" vborder_out_portion="0.2" /> + hborder_out_portion="0.0" vborder_out_portion="0.0" /> <!-- Stateless --> <element type="rounded_section" image="glass/glass_rsection.png" left_border="15" right_border="15" top_border="15" bottom_border="15" - hborder_out_portion="1.0" vborder_out_portion="0.2" /> + hborder_out_portion="0.0" vborder_out_portion="0.0" /> <!-- Stateless --> <element type="window" image="peach/dialog.png" diff --git a/data/gui/tracks.stkgui b/data/gui/tracks.stkgui index b31208e35..a3f40d7a8 100644 --- a/data/gui/tracks.stkgui +++ b/data/gui/tracks.stkgui @@ -7,7 +7,7 @@ <header width="80%" I18N="Section in track selection screen" text="Grand Prix" align="center" text_align="center" /> - <box width="100%" height="195"> + <box width="100%" height="195" padding="0"> <scrollable_toolbar id="gps" height="175" y="10" x="10" width="98%" align="center" label_location="each" square_items="true" child_width="160" child_height="120" /> </box> @@ -15,7 +15,7 @@ <header width="100%" I18N="Section in track selection screen" text="All Tracks" align="center" text_align="center" /> - <box proportion="1" width="100%" layout="vertical-row"> + <box proportion="1" width="100%" layout="vertical-row" padding="1"> <ribbon_grid id="tracks" proportion="1" width="100%" square_items="true" label_location="bottom" align="center" max_rows="4" child_width="160" child_height="120" /> diff --git a/src/guiengine/engine.cpp b/src/guiengine/engine.cpp index 51b852e15..cdbefe733 100644 --- a/src/guiengine/engine.cpp +++ b/src/guiengine/engine.cpp @@ -479,6 +479,13 @@ namespace GUIEngine Currently used for spinners only. Value can be "true" or "false" + \n + \subsection prop19 PROP_DIV_PADDING + <em> Name in XML files: </em> \c "padding" + + Used on divs, indicate by how many pixels to pad contents + + \n <HR> \section code Using the engine in code diff --git a/src/guiengine/layout_manager.cpp b/src/guiengine/layout_manager.cpp index cc4ef2957..c917188ff 100644 --- a/src/guiengine/layout_manager.cpp +++ b/src/guiengine/layout_manager.cpp @@ -308,7 +308,19 @@ void LayoutManager::applyCoords(Widget* self, AbstractTopLevelContainer* topLeve parent_x = parent->m_x; parent_y = parent->m_y; } - + + if (parent != NULL && parent->getType() == WTYPE_DIV && parent->m_show_bounding_box) + { + int padding = 15; + if (parent->m_properties[PROP_DIV_PADDING].length() > 0) + padding = atoi(parent->m_properties[PROP_DIV_PADDING].c_str()); + + parent_x += padding; + parent_y += padding; + parent_w -= padding*2; + parent_h -= padding*2; + } + if (self->m_absolute_x > -1) self->m_x = parent_x + self->m_absolute_x; else if (self->m_absolute_reverse_x > -1) self->m_x = parent_x + (parent_w - self->m_absolute_reverse_x); else if (self->m_relative_x > -1) self->m_x = (int)(parent_x + parent_w*self->m_relative_x/100); @@ -418,8 +430,23 @@ void LayoutManager::doCalculateLayout(PtrVector<Widget>& widgets, AbstractTopLev break; } - const int w = parent->m_w, h = parent->m_h; + int x = parent->m_x; + int y = parent->m_y; + int w = parent->m_w; + int h = parent->m_h; + if (parent != NULL && parent->getType() == WTYPE_DIV && parent->m_show_bounding_box) + { + int padding = 15; + if (parent->m_properties[PROP_DIV_PADDING].length() > 0) + padding = atoi(parent->m_properties[PROP_DIV_PADDING].c_str()); + + x += padding; + y += padding; + w -= padding*2; + h -= padding*2; + } + // find space left after placing all absolutely-sized widgets in a row // (the space left will be divided between remaining widgets later) int left_space = (horizontal ? w : h); @@ -445,8 +472,6 @@ void LayoutManager::doCalculateLayout(PtrVector<Widget>& widgets, AbstractTopLev } // ---- lay widgets in row - int x = parent->m_x; - int y = parent->m_y; for (int n=0; n<widgets_amount; n++) { std::string prop = widgets[n].m_properties[ PROP_PROPORTION ]; @@ -694,7 +719,10 @@ void LayoutManager::doCalculateLayout(PtrVector<Widget>& widgets, AbstractTopLev // ----- also deal with containers' children for (int n=0; n<widgets_amount; n++) { - if (widgets[n].m_type == WTYPE_DIV) doCalculateLayout(widgets[n].m_children, topLevelContainer, &widgets[n]); + if (widgets[n].m_type == WTYPE_DIV) + { + doCalculateLayout(widgets[n].m_children, topLevelContainer, &widgets[n]); + } } } // calculateLayout diff --git a/src/guiengine/screen_loader.cpp b/src/guiengine/screen_loader.cpp index 8a1be9fcb..06fb47ce5 100644 --- a/src/guiengine/screen_loader.cpp +++ b/src/guiengine/screen_loader.cpp @@ -220,6 +220,7 @@ if(prop_name != NULL) widget.m_properties[prop_flag] = core::stringc(prop_name). READ_PROPERTY(label_location, PROP_LABELS_LOCATION); READ_PROPERTY(max_rows, PROP_MAX_ROWS); READ_PROPERTY(wrap_around, PROP_WRAP_AROUND); + READ_PROPERTY(padding, PROP_DIV_PADDING); #undef READ_PROPERTY const wchar_t* text = xml->getAttributeValue( L"text" ); diff --git a/src/guiengine/widget.hpp b/src/guiengine/widget.hpp index b915f1913..db09104f8 100644 --- a/src/guiengine/widget.hpp +++ b/src/guiengine/widget.hpp @@ -101,7 +101,8 @@ namespace GUIEngine PROP_EXTEND_LABEL, PROP_LABELS_LOCATION, PROP_MAX_ROWS, - PROP_WRAP_AROUND + PROP_WRAP_AROUND, + PROP_DIV_PADDING }; bool isWithinATextBox(); diff --git a/src/states_screens/credits.cpp b/src/states_screens/credits.cpp index ce17cea31..2504bee4e 100644 --- a/src/states_screens/credits.cpp +++ b/src/states_screens/credits.cpp @@ -245,7 +245,7 @@ void CreditsScreen::init() assert(w != NULL); reset(); - setArea(w->m_x, w->m_y, w->m_w, w->m_h); + setArea(w->m_x + 15, w->m_y + 8, w->m_w - 30, w->m_h - 16); } // init // ----------------------------------------------------------------------------