mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-26 11:02:47 +02:00
Allow exiting the selector with B when not in explorer mode
This commit is contained in:
parent
5eb8fb7fd7
commit
20339c8849
@ -75,7 +75,8 @@ int Selector::exec(int startSelection) {
|
|||||||
gmenu2x->drawButton(&bg, "left", "", 5)-10)));
|
gmenu2x->drawButton(&bg, "left", "", 5)-10)));
|
||||||
} else {
|
} else {
|
||||||
gmenu2x->drawButton(&bg, "start", gmenu2x->tr["Exit"],
|
gmenu2x->drawButton(&bg, "start", gmenu2x->tr["Exit"],
|
||||||
gmenu2x->drawButton(&bg, "accept", gmenu2x->tr["Select a file"], 5));
|
gmenu2x->drawButton(&bg, "cancel", "",
|
||||||
|
gmenu2x->drawButton(&bg, "accept", gmenu2x->tr["Select a file"], 5)) - 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
bg.convertToDisplayFormat();
|
bg.convertToDisplayFormat();
|
||||||
@ -133,27 +134,38 @@ int Selector::exec(int startSelection) {
|
|||||||
close = true;
|
close = true;
|
||||||
result = false;
|
result = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case InputManager::UP:
|
case InputManager::UP:
|
||||||
if (selected == 0) selected = fl.size() -1;
|
if (selected == 0) selected = fl.size() -1;
|
||||||
else selected -= 1;
|
else selected -= 1;
|
||||||
selTick = SDL_GetTicks();
|
selTick = SDL_GetTicks();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case InputManager::ALTLEFT:
|
case InputManager::ALTLEFT:
|
||||||
if ((int)(selected-SELECTOR_ELEMENTS+1)<0) selected = 0;
|
if ((int)(selected-SELECTOR_ELEMENTS+1)<0) selected = 0;
|
||||||
else selected -= SELECTOR_ELEMENTS-1;
|
else selected -= SELECTOR_ELEMENTS-1;
|
||||||
selTick = SDL_GetTicks();
|
selTick = SDL_GetTicks();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case InputManager::DOWN:
|
case InputManager::DOWN:
|
||||||
if (selected+1>=fl.size()) selected = 0;
|
if (selected+1>=fl.size()) selected = 0;
|
||||||
else selected += 1;
|
else selected += 1;
|
||||||
selTick = SDL_GetTicks();
|
selTick = SDL_GetTicks();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case InputManager::ALTRIGHT:
|
case InputManager::ALTRIGHT:
|
||||||
if (selected+SELECTOR_ELEMENTS-1>=fl.size()) selected = fl.size()-1;
|
if (selected+SELECTOR_ELEMENTS-1>=fl.size()) selected = fl.size()-1;
|
||||||
else selected += SELECTOR_ELEMENTS-1;
|
else selected += SELECTOR_ELEMENTS-1;
|
||||||
selTick = SDL_GetTicks();
|
selTick = SDL_GetTicks();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case InputManager::CANCEL:
|
case InputManager::CANCEL:
|
||||||
|
if (!link->getSelectorBrowser()) {
|
||||||
|
close = true;
|
||||||
|
result = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case InputManager::LEFT:
|
case InputManager::LEFT:
|
||||||
if (link->getSelectorBrowser()) {
|
if (link->getSelectorBrowser()) {
|
||||||
string::size_type p = dir.rfind("/", dir.size()-2);
|
string::size_type p = dir.rfind("/", dir.size()-2);
|
||||||
@ -162,13 +174,13 @@ int Selector::exec(int startSelection) {
|
|||||||
result = false;
|
result = false;
|
||||||
} else {
|
} else {
|
||||||
dir = dir.substr(0,p+1);
|
dir = dir.substr(0,p+1);
|
||||||
INFO("%s\n", dir.c_str());
|
|
||||||
selected = 0;
|
selected = 0;
|
||||||
firstElement = 0;
|
firstElement = 0;
|
||||||
prepare(&fl,&screens,&titles);
|
prepare(&fl,&screens,&titles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case InputManager::ACCEPT:
|
case InputManager::ACCEPT:
|
||||||
if (fl.isFile(selected)) {
|
if (fl.isFile(selected)) {
|
||||||
file = fl[selected];
|
file = fl[selected];
|
||||||
@ -180,76 +192,12 @@ int Selector::exec(int startSelection) {
|
|||||||
prepare(&fl,&screens,&titles);
|
prepare(&fl,&screens,&titles);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
gmenu2x->input.update();
|
|
||||||
if ( gmenu2x->input[ACTION_START] ) { close = true; result = false; }
|
|
||||||
if ( gmenu2x->input[ACTION_UP] ) {
|
|
||||||
if (selected==0) {
|
|
||||||
selected = fl.size()-1;
|
|
||||||
} else {
|
|
||||||
selected -= 1;
|
|
||||||
}
|
|
||||||
selTick = SDL_GetTicks();
|
|
||||||
}
|
|
||||||
if ( gmenu2x->input[ACTION_L] ) {
|
|
||||||
if ((int)(selected-SELECTOR_ELEMENTS+1)<0) {
|
|
||||||
selected = 0;
|
|
||||||
} else {
|
|
||||||
selected -= SELECTOR_ELEMENTS-1;
|
|
||||||
}
|
|
||||||
selTick = SDL_GetTicks();
|
|
||||||
}
|
|
||||||
if ( gmenu2x->input[ACTION_DOWN] ) {
|
|
||||||
if (selected+1>=fl.size()) {
|
|
||||||
selected = 0;
|
|
||||||
} else {
|
|
||||||
selected += 1;
|
|
||||||
}
|
|
||||||
selTick = SDL_GetTicks();
|
|
||||||
}
|
|
||||||
if ( gmenu2x->input[ACTION_R] ) {
|
|
||||||
if (selected+SELECTOR_ELEMENTS-1>=fl.size()) {
|
|
||||||
selected = fl.size()-1;
|
|
||||||
} else {
|
|
||||||
selected += SELECTOR_ELEMENTS-1;
|
|
||||||
}
|
|
||||||
selTick = SDL_GetTicks();
|
|
||||||
}
|
|
||||||
if ( gmenu2x->input[ACTION_X] ) {
|
|
||||||
if (link->getSelectorBrowser()) {
|
|
||||||
string::size_type p = dir.rfind("/", dir.size()-2);
|
|
||||||
if (p==string::npos || dir.compare(0, 1, "/") != 0 || dir.length() < 2) {
|
|
||||||
close = true;
|
|
||||||
result = false;
|
|
||||||
} else {
|
|
||||||
dir = dir.substr(0,p+1);
|
|
||||||
INFO("%s\n", dir.c_str());
|
|
||||||
selected = 0;
|
|
||||||
firstElement = 0;
|
|
||||||
prepare(&fl,&screens,&titles);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
close = true;
|
|
||||||
result = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( gmenu2x->input[ACTION_B] ) {
|
|
||||||
if (fl.isFile(selected)) {
|
|
||||||
file = fl[selected];
|
|
||||||
close = true;
|
|
||||||
} else {
|
|
||||||
dir = dir+fl[selected]+"/";
|
|
||||||
selected = 0;
|
|
||||||
firstElement = 0;
|
|
||||||
prepare(&fl,&screens,&titles);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
gmenu2x->sc.defaultAlpha = true;
|
gmenu2x->sc.defaultAlpha = true;
|
||||||
freeScreenshots(&screens);
|
freeScreenshots(&screens);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user