From 19fc3cb4d1a5dc28bd09a89ba073202d1d4ca2db Mon Sep 17 00:00:00 2001 From: Maarten ter Huurne Date: Wed, 14 Aug 2013 12:23:15 +0200 Subject: [PATCH] Added "bottomBarHeight" item to skin There was already "topBarHeight", but the height of the bottom bar was still hardcoded. --- data/platform/gcw0/skins/OD/skin.conf | 1 + data/skins/320x240/Default/skin.conf | 1 + data/skins/800x480/Default/skin.conf | 1 + src/gmenu2x.cpp | 28 +++++++++++++++------------ src/menu.cpp | 2 +- 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/data/platform/gcw0/skins/OD/skin.conf b/data/platform/gcw0/skins/OD/skin.conf index 0e20c7f..a30fe83 100644 --- a/data/platform/gcw0/skins/OD/skin.conf +++ b/data/platform/gcw0/skins/OD/skin.conf @@ -1,6 +1,7 @@ wallpaper="blue-zero.png" linkHeight=50 topBarHeight=50 +bottomBarHeight=21 linkWidth=80 topBarBg=#ffffff00 bottomBarBg=#ffffff00 diff --git a/data/skins/320x240/Default/skin.conf b/data/skins/320x240/Default/skin.conf index c98f25d..71fa2cd 100644 --- a/data/skins/320x240/Default/skin.conf +++ b/data/skins/320x240/Default/skin.conf @@ -5,5 +5,6 @@ messageBoxBg=#00000080 messageBoxSelection=#fffffff80 bottomBarBg=#ffffff80 topBarHeight=50 +bottomBarHeight=21 linkHeight=50 linkWidth=80 \ No newline at end of file diff --git a/data/skins/800x480/Default/skin.conf b/data/skins/800x480/Default/skin.conf index c98f25d..71fa2cd 100644 --- a/data/skins/800x480/Default/skin.conf +++ b/data/skins/800x480/Default/skin.conf @@ -5,5 +5,6 @@ messageBoxBg=#00000080 messageBoxSelection=#fffffff80 bottomBarBg=#ffffff80 topBarHeight=50 +bottomBarHeight=21 linkHeight=50 linkWidth=80 \ No newline at end of file diff --git a/src/gmenu2x.cpp b/src/gmenu2x.cpp index 5fa94e0..8965e79 100644 --- a/src/gmenu2x.cpp +++ b/src/gmenu2x.cpp @@ -813,9 +813,10 @@ void GMenu2X::setSkin(const string &skin, bool setWallpaper) { } } - evalIntConf( &skinConfInt["topBarHeight"], 40, 32,120 ); - evalIntConf( &skinConfInt["linkHeight"], 40, 32,120 ); - evalIntConf( &skinConfInt["linkWidth"], 60, 32,120 ); + evalIntConf(&skinConfInt["topBarHeight"], 40, 32, 120); + evalIntConf(&skinConfInt["bottomBarHeight"], 20, 20, 120); + evalIntConf(&skinConfInt["linkHeight"], 40, 32, 120); + evalIntConf(&skinConfInt["linkWidth"], 60, 32, 120); if (menu != NULL) menu->skinUpdated(); @@ -1195,8 +1196,8 @@ void GMenu2X::drawScrollBar(uint pageSize, uint totalSize, uint pagePos) { } const uint top = skinConfInt["topBarHeight"] + 1; - const uint bottomBarHeight = 21; - const uint height = resY - top - (bottomBarHeight + 1); + const uint bottom = skinConfInt["bottomBarHeight"] + 1; + const uint height = resY - top - bottom; s->rectangle(resX - 8, top, 7, height, skinConfColors[COLOR_SELECTION_BG]); @@ -1209,17 +1210,20 @@ void GMenu2X::drawScrollBar(uint pageSize, uint totalSize, uint pagePos) { void GMenu2X::drawTopBar(Surface *s) { Surface *bar = sc.skinRes("imgs/topbar.png", false); - if (bar != NULL) + if (bar) { bar->blit(s, 0, 0); - else - s->box(0, 0, resX, skinConfInt["topBarHeight"], - skinConfColors[COLOR_TOP_BAR_BG]); + } else { + const int h = skinConfInt["topBarHeight"]; + s->box(0, 0, resX, h, skinConfColors[COLOR_TOP_BAR_BG]); + } } void GMenu2X::drawBottomBar(Surface *s) { Surface *bar = sc.skinRes("imgs/bottombar.png", false); - if (bar != NULL) + if (bar) { bar->blit(s, 0, resY-bar->height()); - else - s->box(0, resY-20, resX, 20, skinConfColors[COLOR_BOTTOM_BAR_BG]); + } else { + const int h = skinConfInt["bottomBarHeight"]; + s->box(0, resY - h, resX, h, skinConfColors[COLOR_BOTTOM_BAR_BG]); + } } diff --git a/src/menu.cpp b/src/menu.cpp index 21b2c69..efd7dd6 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -185,7 +185,7 @@ void Menu::paint(Surface &s) { ConfIntHash &skinConfInt = gmenu2x->skinConfInt; const int topBarHeight = skinConfInt["topBarHeight"]; - const int bottomBarHeight = 21; + const int bottomBarHeight = skinConfInt["bottomBarHeight"]; const int linkWidth = skinConfInt["linkWidth"]; const int linkHeight = skinConfInt["linkHeight"]; RGBAColor &selectionBgColor = gmenu2x->skinConfColors[COLOR_SELECTION_BG];