1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-25 20:51:38 +02:00

Use a simple array instead of a hashmap for the colors.

This commit is contained in:
Lars-Peter Clausen 2010-05-02 19:53:06 +02:00
parent 28d3fc9ece
commit 7fd1ab032a
13 changed files with 111 additions and 55 deletions

View File

@ -94,7 +94,7 @@ bool DirDialog::exec() {
//Selection //Selection
iY = selected-firstElement; iY = selected-firstElement;
iY = gmenu2x->skinConfInt["topBarHeight"]+1+(iY*rowHeight); iY = gmenu2x->skinConfInt["topBarHeight"]+1+(iY*rowHeight);
gmenu2x->s->box(2, iY, gmenu2x->resX-12, rowHeight-1, gmenu2x->skinConfColors["selectionBg"]); gmenu2x->s->box(2, iY, gmenu2x->resX-12, rowHeight-1, gmenu2x->skinConfColors[COLOR_SELECTION_BG]);
//Directories //Directories
gmenu2x->s->setClipRect(clipRect); gmenu2x->s->setClipRect(clipRect);

View File

@ -80,7 +80,7 @@ bool FileDialog::exec() {
//Selection //Selection
iY = selected-firstElement; iY = selected-firstElement;
iY = gmenu2x->skinConfInt["topBarHeight"]+1+(iY*rowHeight); iY = gmenu2x->skinConfInt["topBarHeight"]+1+(iY*rowHeight);
gmenu2x->s->box(2, iY, gmenu2x->resX-12, rowHeight-1, gmenu2x->skinConfColors["selectionBg"]); gmenu2x->s->box(2, iY, gmenu2x->resX-12, rowHeight-1, gmenu2x->skinConfColors[COLOR_SELECTION_BG]);
beforeFileList(); beforeFileList();

View File

@ -171,8 +171,6 @@ GMenu2X::GMenu2X(int argc, char *argv[]) {
skinConfInt.set_deleted_key(""); skinConfInt.set_deleted_key("");
skinConfStr.set_empty_key(" "); skinConfStr.set_empty_key(" ");
skinConfStr.set_deleted_key(""); skinConfStr.set_deleted_key("");
skinConfColors.set_empty_key(" ");
skinConfColors.set_deleted_key("");
//open2x //open2x
savedVolumeMode = 0; savedVolumeMode = 0;
@ -213,14 +211,15 @@ GMenu2X::GMenu2X(int argc, char *argv[]) {
path = ""; path = "";
getExePath(); getExePath();
#ifdef TARGET_GP2X
gp2x_mem = 0;
cx25874 = 0;
batteryHandle = 0; batteryHandle = 0;
backlightHandle = 0; backlightHandle = 0;
usbHandle = 0; usbHandle = 0;
acHandle = 0; acHandle = 0;
#ifdef TARGET_GP2X
gp2x_mem = 0;
cx25874 = 0;
gp2x_init(); gp2x_init();
//Fix tv-out //Fix tv-out
@ -621,9 +620,12 @@ void GMenu2X::writeSkinConfig() {
for(ConfIntHash::iterator curr = skinConfInt.begin(); curr != endI; curr++) for(ConfIntHash::iterator curr = skinConfInt.begin(); curr != endI; curr++)
inf << curr->first << "=" << curr->second << endl; inf << curr->first << "=" << curr->second << endl;
ConfRGBAHash::iterator endC = skinConfColors.end(); int i;
for(ConfRGBAHash::iterator curr = skinConfColors.begin(); curr != endC; curr++) for (i = 0; i < NUM_COLORS; ++i) {
inf << curr->first << "=#" << hex << curr->second.r << hex << curr->second.g << hex << curr->second.b << hex << curr->second.a << endl; inf << colorToString((enum color)i) << "=#" << hex << skinConfColors[i].r << hex
<< skinConfColors[i].g << hex << skinConfColors[i].b << hex
<< skinConfColors[i].a << endl;
}
inf.close(); inf.close();
sync(); sync();
@ -812,7 +814,8 @@ int GMenu2X::main() {
string sectionIcon = "skin:sections/"+menu->sections[i]+".png"; string sectionIcon = "skin:sections/"+menu->sections[i]+".png";
x = (i-menu->firstDispSection())*skinConfInt["linkWidth"]+sectionsCoordX; x = (i-menu->firstDispSection())*skinConfInt["linkWidth"]+sectionsCoordX;
if (menu->selSectionIndex()==(int)i) if (menu->selSectionIndex()==(int)i)
s->box(x, 0, skinConfInt["linkWidth"], skinConfInt["topBarHeight"], skinConfColors["selectionBg"]); s->box(x, 0, skinConfInt["linkWidth"],
skinConfInt["topBarHeight"], skinConfColors[COLOR_SELECTION_BG]);
x += skinConfInt["linkWidth"]/2; x += skinConfInt["linkWidth"]/2;
if (sc.exists(sectionIcon)) if (sc.exists(sectionIcon))
sc[sectionIcon]->blit(s,x-16,sectionLinkPadding,32,32); sc[sectionIcon]->blit(s,x-16,sectionLinkPadding,32,32);
@ -879,8 +882,9 @@ int GMenu2X::main() {
helpDisplayed = ! helpDisplayed; helpDisplayed = ! helpDisplayed;
if (helpDisplayed) { if (helpDisplayed) {
s->box(10,50,300,143, skinConfColors["messageBoxBg"]); s->box(10,50,300,143, skinConfColors[COLOR_MESSAGE_BOX_BG]);
s->rectangle( 12,52,296,helpBoxHeight, skinConfColors["messageBoxBorder"] ); s->rectangle( 12,52,296,helpBoxHeight,
skinConfColors[COLOR_MESSAGE_BOX_BORDER] );
s->write( font, tr["CONTROLS"], 20, 60 ); s->write( font, tr["CONTROLS"], 20, 60 );
s->write( font, tr["B, Stick press: Launch link / Confirm action"], 20, 80 ); s->write( font, tr["B, Stick press: Launch link / Confirm action"], 20, 80 );
s->write( font, tr["L, R: Change section"], 20, 95 ); s->write( font, tr["L, R: Change section"], 20, 95 );
@ -1096,12 +1100,12 @@ void GMenu2X::skinMenu() {
SettingsDialog sd(this,tr["Skin"]); SettingsDialog sd(this,tr["Skin"]);
sd.addSetting(new MenuSettingMultiString(this,tr["Skin"],tr["Set the skin used by GMenu2X"],&confStr["skin"],&fl_sk.directories)); sd.addSetting(new MenuSettingMultiString(this,tr["Skin"],tr["Set the skin used by GMenu2X"],&confStr["skin"],&fl_sk.directories));
sd.addSetting(new MenuSettingRGBA(this,tr["Top Bar Color"],tr["Color of the top bar"],&skinConfColors["topBarBg"])); sd.addSetting(new MenuSettingRGBA(this,tr["Top Bar Color"],tr["Color of the top bar"],&skinConfColors[COLOR_TOP_BAR_BG]));
sd.addSetting(new MenuSettingRGBA(this,tr["Bottom Bar Color"],tr["Color of the bottom bar"],&skinConfColors["bottomBarBg"])); sd.addSetting(new MenuSettingRGBA(this,tr["Bottom Bar Color"],tr["Color of the bottom bar"],&skinConfColors[COLOR_BOTTOM_BAR_BG]));
sd.addSetting(new MenuSettingRGBA(this,tr["Selection Color"],tr["Color of the selection and other interface details"],&skinConfColors["selectionBg"])); sd.addSetting(new MenuSettingRGBA(this,tr["Selection Color"],tr["Color of the selection and other interface details"],&skinConfColors[COLOR_SELECTION_BG]));
sd.addSetting(new MenuSettingRGBA(this,tr["Message Box Color"],tr["Background color of the message box"],&skinConfColors["messageBoxBg"])); sd.addSetting(new MenuSettingRGBA(this,tr["Message Box Color"],tr["Background color of the message box"],&skinConfColors[COLOR_MESSAGE_BOX_BG]));
sd.addSetting(new MenuSettingRGBA(this,tr["Message Box Border Color"],tr["Border color of the message box"],&skinConfColors["messageBoxBorder"])); sd.addSetting(new MenuSettingRGBA(this,tr["Message Box Border Color"],tr["Border color of the message box"],&skinConfColors[COLOR_MESSAGE_BOX_BORDER]));
sd.addSetting(new MenuSettingRGBA(this,tr["Message Box Selection Color"],tr["Color of the selection of the message box"],&skinConfColors["messageBoxSelection"])); sd.addSetting(new MenuSettingRGBA(this,tr["Message Box Selection Color"],tr["Color of the selection of the message box"],&skinConfColors[COLOR_MESSAGE_BOX_SELECTION]));
if (sd.exec() && sd.edited()) { if (sd.exec() && sd.edited()) {
if (curSkin != confStr["skin"]) { if (curSkin != confStr["skin"]) {
@ -1113,6 +1117,42 @@ void GMenu2X::skinMenu() {
} }
} }
enum color GMenu2X::stringToColor(const string &name)
{
if (name == "topBarBg")
return COLOR_TOP_BAR_BG;
else if (name == "bottomBarBg")
return COLOR_BOTTOM_BAR_BG;
else if (name == "messageBoxBg")
return COLOR_MESSAGE_BOX_BG;
else if (name == "messageBoxBorder")
return COLOR_MESSAGE_BOX_BORDER;
else if (name == "messageBoxSelection")
return COLOR_MESSAGE_BOX_SELECTION;
else
return (enum color)-1;
}
const string &GMenu2X::colorToString(enum color c)
{
static const std::string colorNames[NUM_COLORS + 1] = {
"topBarBg",
"bottomBarBg",
"messageBoxBg",
"messageBoxBorder",
"messageBoxSelection",
"unkown",
};
if (c < NUM_COLORS)
return colorNames[c];
else
return colorNames[NUM_COLORS];
}
void GMenu2X::toggleTvOut() { void GMenu2X::toggleTvOut() {
#ifdef TARGET_GP2X #ifdef TARGET_GP2X
/* if (cx25874!=0) /* if (cx25874!=0)
@ -1126,7 +1166,6 @@ void GMenu2X::setSkin(const string &skin, bool setWallpaper) {
confStr["skin"] = skin; confStr["skin"] = skin;
//Clear previous skin settings //Clear previous skin settings
skinConfColors.clear();
skinConfStr.clear(); skinConfStr.clear();
skinConfInt.clear(); skinConfInt.clear();
@ -1135,12 +1174,12 @@ void GMenu2X::setSkin(const string &skin, bool setWallpaper) {
sc.setSkin(skin); sc.setSkin(skin);
//reset colors to the default values //reset colors to the default values
skinConfColors["topBarBg"] = (RGBAColor){255,255,255,130}; skinConfColors[COLOR_TOP_BAR_BG] = (RGBAColor){255,255,255,130};
skinConfColors["bottomBarBg"] = (RGBAColor){255,255,255,130}; skinConfColors[COLOR_BOTTOM_BAR_BG] = (RGBAColor){255,255,255,130};
skinConfColors["selectionBg"] = (RGBAColor){255,255,255,130}; skinConfColors[COLOR_SELECTION_BG] = (RGBAColor){255,255,255,130};
skinConfColors["messageBoxBg"] = (RGBAColor){255,255,255,255}; skinConfColors[COLOR_MESSAGE_BOX_BG] = (RGBAColor){255,255,255,255};
skinConfColors["messageBoxBorder"] = (RGBAColor){80,80,80,255}; skinConfColors[COLOR_MESSAGE_BOX_BORDER] = (RGBAColor){80,80,80,255};
skinConfColors["messageBoxSelection"] = (RGBAColor){160,160,160,255}; skinConfColors[COLOR_MESSAGE_BOX_SELECTION] = (RGBAColor){160,160,160,255};
//load skin settings //load skin settings
string skinconfname = "skins/"+skin+"/skin.conf"; string skinconfname = "skins/"+skin+"/skin.conf";
@ -1159,7 +1198,7 @@ void GMenu2X::setSkin(const string &skin, bool setWallpaper) {
if (value.length()>1 && value.at(0)=='"' && value.at(value.length()-1)=='"') if (value.length()>1 && value.at(0)=='"' && value.at(value.length()-1)=='"')
skinConfStr[name] = value.substr(1,value.length()-2); skinConfStr[name] = value.substr(1,value.length()-2);
else if (value.at(0) == '#') else if (value.at(0) == '#')
skinConfColors[name] = strtorgba( value.substr(1,value.length()) ); skinConfColors[stringToColor(name)] = strtorgba( value.substr(1,value.length()) );
else else
skinConfInt[name] = atoi(value.c_str()); skinConfInt[name] = atoi(value.c_str());
} }
@ -1290,12 +1329,12 @@ void GMenu2X::contextMenu() {
if (fadeAlpha<200) fadeAlpha = intTransition(0,200,tickStart,500,tickNow); if (fadeAlpha<200) fadeAlpha = intTransition(0,200,tickStart,500,tickNow);
s->box(0, 0, resX, resY, 0,0,0,fadeAlpha); s->box(0, 0, resX, resY, 0,0,0,fadeAlpha);
s->box(box.x, box.y, box.w, box.h, skinConfColors["messageBoxBg"]); s->box(box.x, box.y, box.w, box.h, skinConfColors[COLOR_MESSAGE_BOX_BG]);
s->rectangle( box.x+2, box.y+2, box.w-4, box.h-4, skinConfColors["messageBoxBorder"] ); s->rectangle( box.x+2, box.y+2, box.w-4, box.h-4, skinConfColors[COLOR_MESSAGE_BOX_BORDER] );
//draw selection rect //draw selection rect
s->box( selbox.x, selbox.y, selbox.w, selbox.h, skinConfColors["messageBoxSelection"] ); s->box( selbox.x, selbox.y, selbox.w, selbox.h, skinConfColors[COLOR_MESSAGE_BOX_SELECTION] );
for (i=0; i<voices.size(); i++) for (i=0; i<voices.size(); i++)
s->write( font, voices[i].text, box.x+12, box.y+h2+5+(h+2)*i, SFontHAlignLeft, SFontVAlignMiddle ); s->write( font, voices[i].text, box.x+12, box.y+h2+5+(h+2)*i, SFontHAlignLeft, SFontVAlignMiddle );
s->flip(); s->flip();
@ -1909,7 +1948,7 @@ int GMenu2X::drawButtonRight(Surface *s, const string &btn, const string &text,
void GMenu2X::drawScrollBar(uint pagesize, uint totalsize, uint pagepos, uint top, uint height) { void GMenu2X::drawScrollBar(uint pagesize, uint totalsize, uint pagepos, uint top, uint height) {
if (totalsize<=pagesize) return; if (totalsize<=pagesize) return;
s->rectangle(resX-8, top, 7, height, skinConfColors["selectionBg"]); s->rectangle(resX-8, top, 7, height, skinConfColors[COLOR_SELECTION_BG]);
//internal bar total height = height-2 //internal bar total height = height-2
//bar size //bar size
@ -1920,7 +1959,7 @@ void GMenu2X::drawScrollBar(uint pagesize, uint totalsize, uint pagepos, uint to
if (by+bs>top+height-2) by = top+height-2-bs; if (by+bs>top+height-2) by = top+height-2-bs;
s->box(resX-6, by, 3, bs, skinConfColors["selectionBg"]); s->box(resX-6, by, 3, bs, skinConfColors[COLOR_SELECTION_BG]);
} }
void GMenu2X::drawTitleIcon(const string &icon, bool skinRes, Surface *s) { void GMenu2X::drawTitleIcon(const string &icon, bool skinRes, Surface *s) {
@ -1957,7 +1996,8 @@ void GMenu2X::drawTopBar(Surface *s) {
if (bar != NULL) if (bar != NULL)
bar->blit(s, 0, 0); bar->blit(s, 0, 0);
else else
s->box(0, 0, resX, skinConfInt["topBarHeight"], skinConfColors["topBarBg"]); s->box(0, 0, resX, skinConfInt["topBarHeight"],
skinConfColors[COLOR_TOP_BAR_BG]);
} }
void GMenu2X::drawBottomBar(Surface *s) { void GMenu2X::drawBottomBar(Surface *s) {
@ -1967,5 +2007,5 @@ void GMenu2X::drawBottomBar(Surface *s) {
if (bar != NULL) if (bar != NULL)
bar->blit(s, 0, resY-bar->raw->h); bar->blit(s, 0, resY-bar->raw->h);
else else
s->box(0, resY-20, resX, 20, skinConfColors["bottomBarBg"]); s->box(0, resY-20, resX, 20, skinConfColors[COLOR_BOTTOM_BAR_BG]);
} }

View File

@ -47,6 +47,17 @@ const int LOOP_DELAY=30000;
extern void jz_cpuspeed(unsigned clockspeed); extern void jz_cpuspeed(unsigned clockspeed);
enum color {
COLOR_TOP_BAR_BG,
COLOR_BOTTOM_BAR_BG,
COLOR_SELECTION_BG,
COLOR_MESSAGE_BOX_BG,
COLOR_MESSAGE_BOX_BORDER,
COLOR_MESSAGE_BOX_SELECTION,
NUM_COLORS,
};
using std::string; using std::string;
using fastdelegate::FastDelegate0; using fastdelegate::FastDelegate0;
using google::dense_hash_map; using google::dense_hash_map;
@ -54,7 +65,6 @@ using google::dense_hash_map;
typedef FastDelegate0<> MenuAction; typedef FastDelegate0<> MenuAction;
typedef dense_hash_map<string, string, hash<string> > ConfStrHash; typedef dense_hash_map<string, string, hash<string> > ConfStrHash;
typedef dense_hash_map<string, int, hash<string> > ConfIntHash; typedef dense_hash_map<string, int, hash<string> > ConfIntHash;
typedef dense_hash_map<string, RGBAColor, hash<string> > ConfRGBAHash;
typedef struct { typedef struct {
unsigned short batt; unsigned short batt;
@ -129,6 +139,9 @@ private:
void gp2x_deinit(); void gp2x_deinit();
void toggleTvOut(); void toggleTvOut();
enum color stringToColor(const string &name);
const string &colorToString(enum color);
public: public:
GMenu2X(int argc, char *argv[]); GMenu2X(int argc, char *argv[]);
~GMenu2X(); ~GMenu2X();
@ -154,7 +167,7 @@ public:
//Configuration hashes //Configuration hashes
ConfStrHash confStr, skinConfStr; ConfStrHash confStr, skinConfStr;
ConfIntHash confInt, skinConfInt; ConfIntHash confInt, skinConfInt;
ConfRGBAHash skinConfColors; RGBAColor skinConfColors[NUM_COLORS];
//Configuration settings //Configuration settings
bool useSelectionPng; bool useSelectionPng;

View File

@ -141,8 +141,9 @@ bool InputDialog::exec() {
box.w = gmenu2x->font->getTextWidth(input)+18; box.w = gmenu2x->font->getTextWidth(input)+18;
box.x = 160-box.w/2; box.x = 160-box.w/2;
gmenu2x->s->box(box.x, box.y, box.w, box.h, gmenu2x->skinConfColors["selectionBg"]); gmenu2x->s->box(box.x, box.y, box.w, box.h,
gmenu2x->s->rectangle(box.x, box.y, box.w, box.h, gmenu2x->skinConfColors["selectionBg"]); gmenu2x->skinConfColors[COLOR_SELECTION_BG]);
gmenu2x->s->rectangle(box.x, box.y, box.w, box.h, gmenu2x->skinConfColors[COLOR_SELECTION_BG]);
gmenu2x->s->write(gmenu2x->font, input, box.x+5, box.y+box.h-2, SFontHAlignLeft, SFontVAlignBottom); gmenu2x->s->write(gmenu2x->font, input, box.x+5, box.y+box.h-2, SFontHAlignLeft, SFontVAlignBottom);
@ -152,7 +153,7 @@ bool InputDialog::exec() {
caretTick = curTick; caretTick = curTick;
} }
if (caretOn) gmenu2x->s->box(box.x+box.w-12, box.y+3, 8, box.h-6, gmenu2x->skinConfColors["selectionBg"]); if (caretOn) gmenu2x->s->box(box.x+box.w-12, box.y+3, 8, box.h-6, gmenu2x->skinConfColors[COLOR_SELECTION_BG]);
if (gmenu2x->f200) gmenu2x->ts.poll(); if (gmenu2x->f200) gmenu2x->ts.poll();
action = drawVirtualKeyboard(); action = drawVirtualKeyboard();
@ -235,7 +236,7 @@ int InputDialog::drawVirtualKeyboard() {
int action = ID_NO_ACTION; int action = ID_NO_ACTION;
//keyboard border //keyboard border
gmenu2x->s->rectangle(kbRect, gmenu2x->skinConfColors["selectionBg"]); gmenu2x->s->rectangle(kbRect, gmenu2x->skinConfColors[COLOR_SELECTION_BG]);
if (selCol<0) selCol = selRow==(int)kb->size() ? 1 : kbLength-1; if (selCol<0) selCol = selRow==(int)kb->size() ? 1 : kbLength-1;
if (selCol>=(int)kbLength) selCol = 0; if (selCol>=(int)kbLength) selCol = 0;
@ -244,11 +245,12 @@ int InputDialog::drawVirtualKeyboard() {
//selection //selection
if (selRow<(int)kb->size()) if (selRow<(int)kb->size())
gmenu2x->s->box(kbLeft+selCol*KEY_WIDTH-1, KB_TOP+selRow*KEY_HEIGHT, KEY_WIDTH-1, KEY_HEIGHT-2, gmenu2x->skinConfColors["selectionBg"]); gmenu2x->s->box(kbLeft+selCol*KEY_WIDTH-1, KB_TOP+selRow*KEY_HEIGHT, KEY_WIDTH-1, KEY_HEIGHT-2, gmenu2x->skinConfColors[COLOR_SELECTION_BG]);
else { else {
if (selCol>1) selCol = 0; if (selCol>1) selCol = 0;
if (selCol<0) selCol = 1; if (selCol<0) selCol = 1;
gmenu2x->s->box(kbLeft+selCol*kbLength*KEY_WIDTH/2-1, KB_TOP+kb->size()*KEY_HEIGHT, kbLength*KEY_WIDTH/2-1, KEY_HEIGHT-1, gmenu2x->skinConfColors["selectionBg"]); gmenu2x->s->box(kbLeft+selCol*kbLength*KEY_WIDTH/2-1,
KB_TOP+kb->size()*KEY_HEIGHT, kbLength*KEY_WIDTH/2-1, KEY_HEIGHT-1, gmenu2x->skinConfColors[COLOR_SELECTION_BG]);
} }
//keys //keys
@ -271,7 +273,7 @@ int InputDialog::drawVirtualKeyboard() {
selRow = l; selRow = l;
} }
gmenu2x->s->rectangle(re, gmenu2x->skinConfColors["selectionBg"]); gmenu2x->s->rectangle(re, gmenu2x->skinConfColors[COLOR_SELECTION_BG]);
gmenu2x->s->write(gmenu2x->font, charX, kbLeft+xc*KEY_WIDTH+KEY_WIDTH/2-1, KB_TOP+l*KEY_HEIGHT+KEY_HEIGHT/2, SFontHAlignCenter, SFontVAlignMiddle); gmenu2x->s->write(gmenu2x->font, charX, kbLeft+xc*KEY_WIDTH+KEY_WIDTH/2-1, KB_TOP+l*KEY_HEIGHT+KEY_HEIGHT/2, SFontHAlignCenter, SFontVAlignMiddle);
xc++; xc++;
} }
@ -279,7 +281,7 @@ int InputDialog::drawVirtualKeyboard() {
//Ok/Cancel //Ok/Cancel
SDL_Rect re = {kbLeft-1, KB_TOP+kb->size()*KEY_HEIGHT, kbLength*KEY_WIDTH/2-1, KEY_HEIGHT-1}; SDL_Rect re = {kbLeft-1, KB_TOP+kb->size()*KEY_HEIGHT, kbLength*KEY_WIDTH/2-1, KEY_HEIGHT-1};
gmenu2x->s->rectangle(re, gmenu2x->skinConfColors["selectionBg"]); gmenu2x->s->rectangle(re, gmenu2x->skinConfColors[COLOR_SELECTION_BG]);
if (gmenu2x->f200 && gmenu2x->ts.pressed() && gmenu2x->ts.inRect(re)) { if (gmenu2x->f200 && gmenu2x->ts.pressed() && gmenu2x->ts.inRect(re)) {
selCol = 0; selCol = 0;
selRow = kb->size(); selRow = kb->size();
@ -287,7 +289,7 @@ int InputDialog::drawVirtualKeyboard() {
gmenu2x->s->write(gmenu2x->font, gmenu2x->tr["Cancel"], (int)(160-kbLength*KEY_WIDTH/4), KB_TOP+kb->size()*KEY_HEIGHT+KEY_HEIGHT/2, SFontHAlignCenter, SFontVAlignMiddle); gmenu2x->s->write(gmenu2x->font, gmenu2x->tr["Cancel"], (int)(160-kbLength*KEY_WIDTH/4), KB_TOP+kb->size()*KEY_HEIGHT+KEY_HEIGHT/2, SFontHAlignCenter, SFontVAlignMiddle);
re.x = kbLeft+kbLength*KEY_WIDTH/2-1; re.x = kbLeft+kbLength*KEY_WIDTH/2-1;
gmenu2x->s->rectangle(re, gmenu2x->skinConfColors["selectionBg"]); gmenu2x->s->rectangle(re, gmenu2x->skinConfColors[COLOR_SELECTION_BG]);
if (gmenu2x->f200 && gmenu2x->ts.pressed() && gmenu2x->ts.inRect(re)) { if (gmenu2x->f200 && gmenu2x->ts.pressed() && gmenu2x->ts.inRect(re)) {
selCol = 1; selCol = 1;
selRow = kb->size(); selRow = kb->size();

View File

@ -48,7 +48,7 @@ bool Link::paintHover() {
if (gmenu2x->useSelectionPng) if (gmenu2x->useSelectionPng)
gmenu2x->sc["imgs/selection.png"]->blit(gmenu2x->s,rect,SFontHAlignCenter,SFontVAlignMiddle); gmenu2x->sc["imgs/selection.png"]->blit(gmenu2x->s,rect,SFontHAlignCenter,SFontVAlignMiddle);
else else
gmenu2x->s->box(rect.x, rect.y, rect.w, rect.h, gmenu2x->skinConfColors["selectionBg"]); gmenu2x->s->box(rect.x, rect.y, rect.w, rect.h, gmenu2x->skinConfColors[COLOR_SELECTION_BG]);
return true; return true;
} }

View File

@ -264,9 +264,9 @@ void LinkApp::drawRun() {
int halfBoxW = boxW/2; int halfBoxW = boxW/2;
//outer box //outer box
gmenu2x->s->box(gmenu2x->halfX-2-halfBoxW, gmenu2x->halfY-23, halfBoxW*2+5, 47, gmenu2x->skinConfColors["messageBoxBg"]); gmenu2x->s->box(gmenu2x->halfX-2-halfBoxW, gmenu2x->halfY-23, halfBoxW*2+5, 47, gmenu2x->skinConfColors[COLOR_MESSAGE_BOX_BG]);
//inner rectangle //inner rectangle
gmenu2x->s->rectangle(gmenu2x->halfX-halfBoxW, gmenu2x->halfY-21, boxW, 42, gmenu2x->skinConfColors["messageBoxBorder"]); gmenu2x->s->rectangle(gmenu2x->halfX-halfBoxW, gmenu2x->halfY-21, boxW, 42, gmenu2x->skinConfColors[COLOR_MESSAGE_BOX_BORDER]);
int x = gmenu2x->halfX+10-halfBoxW; int x = gmenu2x->halfX+10-halfBoxW;
/*if (getIcon()!="") /*if (getIcon()!="")

View File

@ -53,7 +53,7 @@ void ListView::paint() {
int iY = selectedItem-firstDisplayItem; int iY = selectedItem-firstDisplayItem;
iY = rect.y+(iY*16); iY = rect.y+(iY*16);
if (selectedItem<(int)items.size()) if (selectedItem<(int)items.size())
gmenu2x->s->box(1, iY, 309, 14, gmenu2x->skinConfColors["selectionBg"]); gmenu2x->s->box(1, iY, 309, 14, gmenu2x->skinConfColors[COLOR_SELECTION_BG]);
//Items //Items
iY = rect.y; iY = rect.y;

View File

@ -155,7 +155,7 @@ void MenuSettingRGBA::adjustInput() {
void MenuSettingRGBA::drawSelected(int y) { void MenuSettingRGBA::drawSelected(int y) {
int x = 166+selPart*36; int x = 166+selPart*36;
gmenu2x->s->box( x, y, 36, 14, gmenu2x->skinConfColors["selectionBg"] ); gmenu2x->s->box( x, y, 36, 14, gmenu2x->skinConfColors[COLOR_SELECTION_BG] );
gmenu2x->drawButton(btnDec, gmenu2x->drawButton(btnDec,
gmenu2x->drawButton(btnInc, gmenu2x->drawButton(btnInc,

View File

@ -73,9 +73,10 @@ int MessageBox::exec() {
box.y = gmenu2x->halfY - box.h/2 -2; box.y = gmenu2x->halfY - box.h/2 -2;
//outer box //outer box
bg.box(box, gmenu2x->skinConfColors["messageBoxBg"]); bg.box(box, gmenu2x->skinConfColors[COLOR_MESSAGE_BOX_BG]);
//draw inner rectangle //draw inner rectangle
bg.rectangle(box.x+2, box.y+2, box.w-4, box.h-gmenu2x->font->getHeight(), gmenu2x->skinConfColors["messageBoxBorder"]); bg.rectangle(box.x+2, box.y+2, box.w-4, box.h-gmenu2x->font->getHeight(),
gmenu2x->skinConfColors[COLOR_MESSAGE_BOX_BORDER]);
//icon+text //icon+text
if (gmenu2x->sc[icon] != NULL) if (gmenu2x->sc[icon] != NULL)
gmenu2x->sc[icon]->blitCenter( &bg, box.x+25, box.y+gmenu2x->font->getHeight()+3 ); gmenu2x->sc[icon]->blitCenter( &bg, box.x+25, box.y+gmenu2x->font->getHeight()+3 );

View File

@ -87,7 +87,7 @@ int Selector::exec(int startSelection) {
iY = selected-firstElement; iY = selected-firstElement;
iY = 42+(iY*16); iY = 42+(iY*16);
if (selected<fl.size()) if (selected<fl.size())
gmenu2x->s->box(1, iY, 309, 14, gmenu2x->skinConfColors["selectionBg"]); gmenu2x->s->box(1, iY, 309, 14, gmenu2x->skinConfColors[COLOR_SELECTION_BG]);
//Screenshot //Screenshot
if (selected-fl.dirCount()<screens.size() && screens[selected-fl.dirCount()]!="") { if (selected-fl.dirCount()<screens.size() && screens[selected-fl.dirCount()]!="") {

View File

@ -73,7 +73,7 @@ bool SettingsDialog::exec() {
iY = gmenu2x->skinConfInt["topBarHeight"]+2+(iY*rowHeight); iY = gmenu2x->skinConfInt["topBarHeight"]+2+(iY*rowHeight);
gmenu2x->s->setClipRect(clipRect); gmenu2x->s->setClipRect(clipRect);
if (sel<voices.size()) if (sel<voices.size())
gmenu2x->s->box(1, iY, 148, rowHeight-2, gmenu2x->skinConfColors["selectionBg"]); gmenu2x->s->box(1, iY, 148, rowHeight-2, gmenu2x->skinConfColors[COLOR_SELECTION_BG]);
gmenu2x->s->clearClipRect(); gmenu2x->s->clearClipRect();
//selected option //selected option

View File

@ -70,7 +70,7 @@ bool WallpaperDialog::exec() {
//Selection //Selection
iY = selected-firstElement; iY = selected-firstElement;
iY = 44+(iY*17); iY = 44+(iY*17);
gmenu2x->s->box(2, iY, 308, 16, gmenu2x->skinConfColors["selectionBg"]); gmenu2x->s->box(2, iY, 308, 16, gmenu2x->skinConfColors[COLOR_SELECTION_BG]);
//Files & Directories //Files & Directories
gmenu2x->s->setClipRect(0,41,311,179); gmenu2x->s->setClipRect(0,41,311,179);