fix underscore bug in keyboard and mp3 list.

This commit is contained in:
giantpune 2009-05-13 18:14:45 +00:00
parent 0a11579c18
commit 9ee6729e7f
4 changed files with 25 additions and 8 deletions

View File

@ -16,12 +16,13 @@
#define GAMESELECTSIZE 30
static int scrollbaron = 0;
int coL2;
//int vol;
extern const int vol;
/**
* Constructor for the GuiCustomOptionBrowser class.
*/
GuiCustomOptionBrowser::GuiCustomOptionBrowser(int w, int h, customOptionList * l, const char *themePath, const char *custombg, const u8 *imagebg, int scrollon)
GuiCustomOptionBrowser::GuiCustomOptionBrowser(int w, int h, customOptionList * l, const char *themePath, const char *custombg, const u8 *imagebg, int scrollon,int col2)
{
width = w;
height = h;
@ -32,6 +33,7 @@ GuiCustomOptionBrowser::GuiCustomOptionBrowser(int w, int h, customOptionList *
listOffset = this->FindMenuItem(-1, 1);
selectedItem = 0;
focus = 1; // allow focus
coL2 = col2;
char imgPath[100];
trigA = new GuiTrigger;
@ -122,13 +124,13 @@ GuiCustomOptionBrowser::GuiCustomOptionBrowser(int w, int h, customOptionList *
optionTxt[i] = new GuiText(options->name[i], 20, (GXColor){0, 0, 0, 0xff});
optionTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
optionTxt[i]->SetPosition(24,0);
optionBg[i] = new GuiImage(bgOptionsEntry);
optionVal[i] = new GuiText(NULL, 20, (GXColor){0, 0, 0, 0xff});
optionVal[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
optionVal[i]->SetPosition(250,0);
optionBtn[i] = new GuiButton(width,GAMESELECTSIZE);//(width-28,GAMESELECTSIZE);
optionBtn[i]->SetParent(this);
optionBtn[i]->SetLabel(optionTxt[i], 0);
@ -339,6 +341,13 @@ void GuiCustomOptionBrowser::Update(GuiTrigger * t)
optionTxt[i]->SetText(options->name[next]);
optionVal[i]->SetText(options->value[next]);
char* pch;
pch=strrchr((options->value[next]),'_');
if (pch!=NULL){optionVal[i]->SetPosition(coL2, 15);}
else {optionVal[i]->SetPosition(coL2, 0);}
optionIndex[i] = next;
next = this->FindMenuItem(next, 1);
}

View File

@ -32,7 +32,7 @@ class customOptionList {
class GuiCustomOptionBrowser : public GuiElement
{
public:
GuiCustomOptionBrowser(int w, int h, customOptionList * l, const char * themePath, const char *custombg, const u8 *imagebg, int scrollbar);
GuiCustomOptionBrowser(int w, int h, customOptionList * l, const char * themePath, const char *custombg, const u8 *imagebg, int scrollbar, int col2);
~GuiCustomOptionBrowser();
void SetCol2Position(int x);
int FindMenuItem(int c, int d);

View File

@ -9,6 +9,8 @@
***************************************************************************/
#include "gui.h"
#include <stdio.h>
#include <string.h>
/**
* Constructor for the GuiKeyboard class.
*/
@ -338,7 +340,13 @@ void GuiKeyboard::Update(GuiTrigger * t)
}
}
}
char* pch;
pch=strrchr(kbtextstr,'_');
if (pch!=NULL){kbText->SetPosition(0, 68);}
else {kbText->SetPosition(0, 53);}
this->ToggleFocus(t);
if(focus) // only send actions to this window if it's in focus

View File

@ -3494,7 +3494,7 @@ static int MenuSettings()
btnLogo->SetUpdateCallback(WindowCredits);
customOptionList options2(9);
GuiCustomOptionBrowser optionBrowser2(396, 280, &options2, CFG.theme_path, "bg_options_settings", bg_options_settings_png, 0);
GuiCustomOptionBrowser optionBrowser2(396, 280, &options2, CFG.theme_path, "bg_options_settings", bg_options_settings_png, 0, 200);
optionBrowser2.SetPosition(0, 90);
optionBrowser2.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
optionBrowser2.SetCol2Position(200);
@ -4224,7 +4224,7 @@ int GameSettings(struct discHdr * header)
deleteBtn.SetTrigger(&trigA);
deleteBtn.SetEffectGrow();
GuiCustomOptionBrowser optionBrowser3(396, 280, &options3, CFG.theme_path, "bg_options_gamesettings", bg_options_settings_png, 0);
GuiCustomOptionBrowser optionBrowser3(396, 280, &options3, CFG.theme_path, "bg_options_gamesettings", bg_options_settings_png, 0, 150);
optionBrowser3.SetPosition(0, 90);
optionBrowser3.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
optionBrowser3.SetCol2Position(150);
@ -4536,7 +4536,7 @@ int MenuMp3()
} else {
scrollon = 1;
}
GuiCustomOptionBrowser optionBrowser4(396, 280, &options2, CFG.theme_path, "bg_options_settings", bg_options_settings_png, scrollon);
GuiCustomOptionBrowser optionBrowser4(396, 280, &options2, CFG.theme_path, "bg_options_settings", bg_options_settings_png, scrollon, 50);
optionBrowser4.SetPosition(0, 90);
optionBrowser4.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
optionBrowser4.SetCol2Position(65);