Lots of cleanup & fixes, ES language strings added
This commit is contained in:
parent
8795b43db3
commit
04d7e24565
@ -334,11 +334,13 @@ const char* const g_strings[StrId_Max][16] =
|
|||||||
[StrId_Actions_Star] =
|
[StrId_Actions_Star] =
|
||||||
{
|
{
|
||||||
STR_EN("Star"),
|
STR_EN("Star"),
|
||||||
|
STR_ES("Agregar a favoritos"),
|
||||||
},
|
},
|
||||||
|
|
||||||
[StrId_Actions_Unstar] =
|
[StrId_Actions_Unstar] =
|
||||||
{
|
{
|
||||||
STR_EN("Unstar"),
|
STR_EN("Unstar"),
|
||||||
|
STR_ES("Borrar de favoritos"),
|
||||||
},
|
},
|
||||||
|
|
||||||
[StrId_ThemeMenu] =
|
[StrId_ThemeMenu] =
|
||||||
|
@ -493,7 +493,8 @@ bool menuEntryLoad(menuEntry_s* me, const char* name, bool shortcut) {
|
|||||||
//check for .filename.star in same path
|
//check for .filename.star in same path
|
||||||
strptr = getSlash(me->path);
|
strptr = getSlash(me->path);
|
||||||
if (strptr[0] == '/') strptr++;
|
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);
|
strcpy(me->starpath, tempbuf);
|
||||||
me->starred = fileExists(me->starpath);
|
me->starred = fileExists(me->starpath);
|
||||||
|
|
||||||
|
@ -105,11 +105,10 @@ static void menuSort(void) {
|
|||||||
|
|
||||||
menuEntry_s* p = m->firstEntry;
|
menuEntry_s* p = m->firstEntry;
|
||||||
for(i = 0; i < nEntries; ++i) {
|
for(i = 0; i < nEntries; ++i) {
|
||||||
if (p->starred) {
|
if (p->starred)
|
||||||
listStar[nEntriesStar++] = p;
|
listStar[nEntriesStar++] = p;
|
||||||
} else {
|
else
|
||||||
list[nEntriesNoStar++] = p;
|
list[nEntriesNoStar++] = p;
|
||||||
}
|
|
||||||
p = p->next;
|
p = p->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,7 +131,7 @@ static void menuSort(void) {
|
|||||||
free(listStar);
|
free(listStar);
|
||||||
}
|
}
|
||||||
|
|
||||||
void menuReSort (void) {
|
void menuReorder (void) {
|
||||||
s_curMenu = !s_curMenu;
|
s_curMenu = !s_curMenu;
|
||||||
menuSort();
|
menuSort();
|
||||||
s_curMenu = !s_curMenu;
|
s_curMenu = !s_curMenu;
|
||||||
|
@ -32,31 +32,27 @@ void launchMenuEntryTask(menuEntry_s* arg) {
|
|||||||
|
|
||||||
void toggleStarState(menuEntry_s* arg) {
|
void toggleStarState(menuEntry_s* arg) {
|
||||||
menuEntry_s* me = arg;
|
menuEntry_s* me = arg;
|
||||||
if (me->starred)
|
if (me->starred) {
|
||||||
{
|
|
||||||
if (fileExists(me->starpath))
|
if (fileExists(me->starpath))
|
||||||
remove(me->starpath);
|
remove(me->starpath);
|
||||||
} else {
|
} else {
|
||||||
if (!fileExists(me->starpath))
|
if (!fileExists(me->starpath)) {
|
||||||
{
|
FILE* f = fopen(me->starpath, "w");
|
||||||
int fd = open(me->starpath,O_CREAT|O_WRONLY, ACCESSPERMS);
|
fclose(f);
|
||||||
close(fd);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
me->starred = fileExists(me->starpath);
|
me->starred = fileExists(me->starpath);
|
||||||
//todo: error handling/message?
|
//todo: error handling/message?
|
||||||
|
|
||||||
menuReSort();
|
menuReorder();
|
||||||
menu_s* menu = menuGetCurrent();
|
menu_s* menu = menuGetCurrent();
|
||||||
menuEntry_s* meSearch = menu->firstEntry;
|
menuEntry_s* meSearch = menu->firstEntry;
|
||||||
menu->curEntry = -1;
|
menu->curEntry = -1;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (menu->curEntry == -1)
|
while (menu->curEntry < 0) {
|
||||||
{
|
|
||||||
if (me == meSearch)
|
if (me == meSearch)
|
||||||
{
|
|
||||||
menu->curEntry = i;
|
menu->curEntry = i;
|
||||||
} else {
|
else {
|
||||||
meSearch = meSearch->next;
|
meSearch = meSearch->next;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@ -110,8 +106,7 @@ void menuHandleAButton(void) {
|
|||||||
void menuHandleXButton(void) {
|
void menuHandleXButton(void) {
|
||||||
menu_s* menu = menuGetCurrent();
|
menu_s* menu = menuGetCurrent();
|
||||||
|
|
||||||
if (menu->nEntries > 0 && hbmenu_state == HBMENU_DEFAULT)
|
if (menu->nEntries > 0 && hbmenu_state == HBMENU_DEFAULT) {
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
menuEntry_s* me;
|
menuEntry_s* me;
|
||||||
for (i = 0, me = menu->firstEntry; i != menu->curEntry; i ++, me = me->next);
|
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)
|
if (me->starred)
|
||||||
{
|
|
||||||
DrawText(largestar, start_x - 68, 160, themeCurrent.textColor, themeCurrent.labelStarOnText);
|
DrawText(largestar, start_x - 68, 160, themeCurrent.textColor, themeCurrent.labelStarOnText);
|
||||||
} else {
|
else
|
||||||
if (smallimg != theme_icon_small)//if (me->type != ENTRY_TYPE_THEME) <- why this crash?
|
if (me->type != ENTRY_TYPE_THEME)
|
||||||
DrawText(largestar, start_x - 68, 160, themeCurrent.textColor, themeCurrent.labelStarOffText);
|
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
|
#endif
|
||||||
{
|
{
|
||||||
//drawImage(x_image, 720 - 48, 32, 32, themeCurrent.buttonBImage, IMAGE_MODE_RGBA32);
|
//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(fontscale7, x_image, 720 - 47 + 24, themeCurrent.textColor, themeCurrent.buttonBText);//Display the 'B' button from SharedFont.
|
||||||
DrawText(interuimedium20, x_text, 720 - 47 + 26, themeCurrent.textColor, textGetString(StrId_Actions_Back));
|
DrawText(interuimedium20, x_text, 720 - 47 + 24, themeCurrent.textColor, textGetString(StrId_Actions_Back));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hbmenu_state == HBMENU_DEFAULT)
|
if(hbmenu_state == HBMENU_DEFAULT)
|
||||||
@ -724,12 +717,14 @@ void menuLoop(void) {
|
|||||||
|
|
||||||
drawButtons(menu, false, &menupath_x_endpos);
|
drawButtons(menu, false, &menupath_x_endpos);
|
||||||
|
|
||||||
if(active_entry != NULL && active_entry->type != ENTRY_TYPE_THEME) {
|
if (active_entry && 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->starred) {
|
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));
|
DrawText(interuiregular18, getX, 720 - 47 + 24, themeCurrent.textColor, textGetString(StrId_Actions_Unstar));
|
||||||
} else {
|
} 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));
|
DrawText(interuiregular18, getX, 720 - 47 + 24, themeCurrent.textColor, textGetString(StrId_Actions_Star));
|
||||||
}
|
}
|
||||||
menupath_x_endpos = getX - 36 - 40;
|
menupath_x_endpos = getX - 36 - 40;
|
||||||
|
@ -100,7 +100,7 @@ void menuDeleteEntry(menuEntry_s* me, bool skip_icongfx);
|
|||||||
|
|
||||||
menu_s* menuGetCurrent(void);
|
menu_s* menuGetCurrent(void);
|
||||||
menu_s* menuFileassocGetCurrent(void);
|
menu_s* menuFileassocGetCurrent(void);
|
||||||
void menuReSort (void);
|
void menuReorder (void);
|
||||||
int menuScan(const char* target);
|
int menuScan(const char* target);
|
||||||
int themeMenuScan(const char* target);
|
int themeMenuScan(const char* target);
|
||||||
int menuFileassocScan(const char* target);
|
int menuFileassocScan(const char* target);
|
||||||
|
@ -84,13 +84,11 @@ extern "C" bool menuUpdate(void) {
|
|||||||
if(!new_y_state && y_state)
|
if(!new_y_state && y_state)
|
||||||
{
|
{
|
||||||
launchMenuNetloaderTask();
|
launchMenuNetloaderTask();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!new_x_state && x_state)
|
if(!new_x_state && x_state)
|
||||||
{
|
{
|
||||||
menuHandleXButton();
|
menuHandleXButton();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!new_esc_state && esc_state)
|
if (!new_esc_state && esc_state)
|
||||||
|
Loading…
Reference in New Issue
Block a user