Lots of cleanup & fixes, ES language strings added

This commit is contained in:
hippydave 2019-07-09 01:33:18 +01:00
parent 8795b43db3
commit 04d7e24565
6 changed files with 25 additions and 30 deletions

View File

@ -334,11 +334,13 @@ const char* const g_strings[StrId_Max][16] =
[StrId_Actions_Star] =
{
STR_EN("Star"),
STR_ES("Agregar a favoritos"),
},
[StrId_Actions_Unstar] =
{
STR_EN("Unstar"),
STR_ES("Borrar de favoritos"),
},
[StrId_ThemeMenu] =

View File

@ -493,7 +493,8 @@ bool menuEntryLoad(menuEntry_s* me, const char* name, bool shortcut) {
//check for .filename.star in same path
strptr = getSlash(me->path);
if (strptr[0] == '/') strptr++;
snprintf(tempbuf, sizeof(tempbuf)-1, "%.*s.%.*s.star", (int)((strlen(me->path)) - (strlen(strptr))), me->path, (int)(strlen(strptr)), strptr);
int strptrLen = strlen(strptr);
snprintf(tempbuf, sizeof(tempbuf)-1, "%.*s.%.*s.star", (int)(strlen(me->path) - strptrLen), me->path, (int)strptrLen, strptr);
strcpy(me->starpath, tempbuf);
me->starred = fileExists(me->starpath);

View File

@ -105,11 +105,10 @@ static void menuSort(void) {
menuEntry_s* p = m->firstEntry;
for(i = 0; i < nEntries; ++i) {
if (p->starred) {
if (p->starred)
listStar[nEntriesStar++] = p;
} else {
else
list[nEntriesNoStar++] = p;
}
p = p->next;
}
@ -132,7 +131,7 @@ static void menuSort(void) {
free(listStar);
}
void menuReSort (void) {
void menuReorder (void) {
s_curMenu = !s_curMenu;
menuSort();
s_curMenu = !s_curMenu;

View File

@ -32,31 +32,27 @@ void launchMenuEntryTask(menuEntry_s* arg) {
void toggleStarState(menuEntry_s* arg) {
menuEntry_s* me = arg;
if (me->starred)
{
if (me->starred) {
if (fileExists(me->starpath))
remove(me->starpath);
} else {
if (!fileExists(me->starpath))
{
int fd = open(me->starpath,O_CREAT|O_WRONLY, ACCESSPERMS);
close(fd);
if (!fileExists(me->starpath)) {
FILE* f = fopen(me->starpath, "w");
fclose(f);
}
}
me->starred = fileExists(me->starpath);
//todo: error handling/message?
menuReSort();
menuReorder();
menu_s* menu = menuGetCurrent();
menuEntry_s* meSearch = menu->firstEntry;
menu->curEntry = -1;
int i = 0;
while (menu->curEntry == -1)
{
while (menu->curEntry < 0) {
if (me == meSearch)
{
menu->curEntry = i;
} else {
else {
meSearch = meSearch->next;
i++;
}
@ -110,8 +106,7 @@ void menuHandleAButton(void) {
void menuHandleXButton(void) {
menu_s* menu = menuGetCurrent();
if (menu->nEntries > 0 && hbmenu_state == HBMENU_DEFAULT)
{
if (menu->nEntries > 0 && hbmenu_state == HBMENU_DEFAULT) {
int i;
menuEntry_s* me;
for (i = 0, me = menu->firstEntry; i != menu->curEntry; i ++, me = me->next);
@ -334,12 +329,10 @@ static void drawEntry(menuEntry_s* me, int off_x, int is_active) {
}
if (me->starred)
{
DrawText(largestar, start_x - 68, 160, themeCurrent.textColor, themeCurrent.labelStarOnText);
} else {
if (smallimg != theme_icon_small)//if (me->type != ENTRY_TYPE_THEME) <- why this crash?
else
if (me->type != ENTRY_TYPE_THEME)
DrawText(largestar, start_x - 68, 160, themeCurrent.textColor, themeCurrent.labelStarOffText);
}
}
}
@ -540,8 +533,8 @@ void drawButtons(menu_s* menu, bool emptyDir, int *x_image_out) {
#endif
{
//drawImage(x_image, 720 - 48, 32, 32, themeCurrent.buttonBImage, IMAGE_MODE_RGBA32);
DrawText(fontscale7, x_image, 720 - 47 + 26, themeCurrent.textColor, themeCurrent.buttonBText);//Display the 'B' button from SharedFont.
DrawText(interuimedium20, x_text, 720 - 47 + 26, themeCurrent.textColor, textGetString(StrId_Actions_Back));
DrawText(fontscale7, x_image, 720 - 47 + 24, themeCurrent.textColor, themeCurrent.buttonBText);//Display the 'B' button from SharedFont.
DrawText(interuimedium20, x_text, 720 - 47 + 24, themeCurrent.textColor, textGetString(StrId_Actions_Back));
}
if(hbmenu_state == HBMENU_DEFAULT)
@ -724,12 +717,14 @@ void menuLoop(void) {
drawButtons(menu, false, &menupath_x_endpos);
if(active_entry != NULL && active_entry->type != ENTRY_TYPE_THEME) {
getX = GetTextXCoordinate(interuiregular18, menupath_x_endpos - 32, textGetString(StrId_Actions_Unstar), 'r');
DrawText(fontscale7, getX - 36, 720 - 47 + 24, themeCurrent.textColor, themeCurrent.buttonXText);
if (active_entry && active_entry->type != ENTRY_TYPE_THEME) {
if (active_entry->starred) {
getX = GetTextXCoordinate(interuiregular18, menupath_x_endpos + 8, textGetString(StrId_Actions_Unstar), 'r');
DrawText(fontscale7, getX - 36, 720 - 47 + 24, themeCurrent.textColor, themeCurrent.buttonXText);
DrawText(interuiregular18, getX, 720 - 47 + 24, themeCurrent.textColor, textGetString(StrId_Actions_Unstar));
} else {
getX = GetTextXCoordinate(interuiregular18, menupath_x_endpos + 8, textGetString(StrId_Actions_Star), 'r');
DrawText(fontscale7, getX - 36, 720 - 47 + 24, themeCurrent.textColor, themeCurrent.buttonXText);
DrawText(interuiregular18, getX, 720 - 47 + 24, themeCurrent.textColor, textGetString(StrId_Actions_Star));
}
menupath_x_endpos = getX - 36 - 40;

View File

@ -100,7 +100,7 @@ void menuDeleteEntry(menuEntry_s* me, bool skip_icongfx);
menu_s* menuGetCurrent(void);
menu_s* menuFileassocGetCurrent(void);
void menuReSort (void);
void menuReorder (void);
int menuScan(const char* target);
int themeMenuScan(const char* target);
int menuFileassocScan(const char* target);

View File

@ -84,13 +84,11 @@ extern "C" bool menuUpdate(void) {
if(!new_y_state && y_state)
{
launchMenuNetloaderTask();
}
if(!new_x_state && x_state)
{
menuHandleXButton();
}
if (!new_esc_state && esc_state)