mirror of
https://github.com/joel16/VitaShell.git
synced 2024-11-26 21:30:45 +00:00
Fixed file list position correction and added ability to move and mark
This commit is contained in:
parent
078cf049e9
commit
aa81726051
6
file.c
6
file.c
@ -431,11 +431,17 @@ int copyPath(const char *src_path, const char *dst_path, FileProcessParam *param
|
||||
memset(&stat, 0, sizeof(SceIoStat));
|
||||
sceIoGetstatByFd(dfd, &stat);
|
||||
|
||||
stat.st_mode |= SCE_S_IWUSR;
|
||||
|
||||
int ret = sceIoMkdir(dst_path, stat.st_mode & 0xFFF);
|
||||
if (ret < 0 && ret != SCE_ERROR_ERRNO_EEXIST) {
|
||||
sceIoDclose(dfd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (ret == SCE_ERROR_ERRNO_EEXIST) {
|
||||
sceIoChstat(dst_path, &stat, 0x3B);
|
||||
}
|
||||
|
||||
if (param) {
|
||||
if (param->value)
|
||||
|
45
main.c
45
main.c
@ -221,25 +221,21 @@ int refreshFileList() {
|
||||
dirUp();
|
||||
}
|
||||
} while (res < 0);
|
||||
|
||||
// TODO: make better position correction
|
||||
|
||||
// Correct position after deleting the latest entry of the file list
|
||||
while ((base_pos + rel_pos) >= file_list.length) {
|
||||
if (base_pos > 0) {
|
||||
base_pos--;
|
||||
} else if (rel_pos > 0) {
|
||||
rel_pos--;
|
||||
|
||||
// Position correction
|
||||
if ((base_pos + rel_pos) >= file_list.length) {
|
||||
if (file_list.length >= MAX_POSITION) {
|
||||
base_pos = file_list.length - MAX_POSITION;
|
||||
rel_pos = MAX_POSITION - 1;
|
||||
} else {
|
||||
base_pos = 0;
|
||||
rel_pos = file_list.length - 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Correct position after deleting an entry while the scrollbar is on the bottom
|
||||
if (file_list.length >= MAX_POSITION) {
|
||||
while ((base_pos + MAX_POSITION - 1) >= file_list.length) {
|
||||
if (base_pos > 0) {
|
||||
base_pos--;
|
||||
rel_pos++;
|
||||
}
|
||||
|
||||
if ((base_pos + MAX_POSITION - 1) >= file_list.length) {
|
||||
if (file_list.length >= MAX_POSITION) {
|
||||
base_pos = file_list.length - MAX_POSITION;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1316,6 +1312,8 @@ static int fileBrowserMenuCtrl() {
|
||||
}
|
||||
|
||||
// Move
|
||||
int moved = 0;
|
||||
|
||||
if (hold_buttons & SCE_CTRL_UP || hold2_buttons & SCE_CTRL_LEFT_ANALOG_UP) {
|
||||
int old_pos = base_pos + rel_pos;
|
||||
|
||||
@ -1325,8 +1323,10 @@ static int fileBrowserMenuCtrl() {
|
||||
base_pos--;
|
||||
}
|
||||
|
||||
if (old_pos != base_pos + rel_pos)
|
||||
if (old_pos != base_pos + rel_pos) {
|
||||
moved = 1;
|
||||
scroll_count = 0;
|
||||
}
|
||||
} else if (hold_buttons & SCE_CTRL_DOWN || hold2_buttons & SCE_CTRL_LEFT_ANALOG_DOWN) {
|
||||
int old_pos = base_pos + rel_pos;
|
||||
|
||||
@ -1338,8 +1338,10 @@ static int fileBrowserMenuCtrl() {
|
||||
}
|
||||
}
|
||||
|
||||
if (old_pos != base_pos + rel_pos)
|
||||
if (old_pos != base_pos + rel_pos) {
|
||||
moved = 1;
|
||||
scroll_count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Context menu trigger
|
||||
@ -1359,8 +1361,9 @@ static int fileBrowserMenuCtrl() {
|
||||
|
||||
// Not at 'home'
|
||||
if (dir_level > 0) {
|
||||
// Mark entry
|
||||
if (pressed_buttons & SCE_CTRL_SQUARE) {
|
||||
// Mark entry
|
||||
if (pressed_buttons & SCE_CTRL_SQUARE ||
|
||||
(moved && (current_buttons & SCE_CTRL_SQUARE))) {
|
||||
FileListEntry *file_entry = fileListGetNthEntry(&file_list, base_pos + rel_pos);
|
||||
if (file_entry && strcmp(file_entry->name, DIR_UP) != 0) {
|
||||
if (!fileListFindEntry(&mark_list, file_entry->name)) {
|
||||
|
@ -307,9 +307,11 @@ int drawUncommonDialog() {
|
||||
float string_y = uncommon_dialog.y + SHELL_MARGIN_Y - 2.0f;
|
||||
|
||||
// Draw info
|
||||
if (uncommon_dialog.info[0] != '\0') {
|
||||
float x = ALIGN_RIGHT(uncommon_dialog.x+uncommon_dialog.width-SHELL_MARGIN_X, pgf_text_width(uncommon_dialog.info));
|
||||
pgf_draw_text(x, string_y, DIALOG_COLOR, uncommon_dialog.info);
|
||||
if (uncommon_dialog.mode == SCE_MSG_DIALOG_MODE_PROGRESS_BAR) {
|
||||
if (uncommon_dialog.info[0] != '\0') {
|
||||
float x = ALIGN_RIGHT(uncommon_dialog.x + uncommon_dialog.width - SHELL_MARGIN_X, pgf_text_width(uncommon_dialog.info));
|
||||
pgf_draw_text(x, string_y, DIALOG_COLOR, uncommon_dialog.info);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw message
|
||||
@ -343,12 +345,12 @@ int drawUncommonDialog() {
|
||||
|
||||
case SCE_MSG_DIALOG_BUTTON_TYPE_YESNO:
|
||||
sprintf(button_string, "%s %s %s %s", enter_button == SCE_SYSTEM_PARAM_ENTER_BUTTON_CIRCLE ? CIRCLE : CROSS, language_container[YES],
|
||||
enter_button == SCE_SYSTEM_PARAM_ENTER_BUTTON_CIRCLE ? CROSS : CIRCLE, language_container[NO]);
|
||||
enter_button == SCE_SYSTEM_PARAM_ENTER_BUTTON_CIRCLE ? CROSS : CIRCLE, language_container[NO]);
|
||||
break;
|
||||
|
||||
case SCE_MSG_DIALOG_BUTTON_TYPE_OK_CANCEL:
|
||||
sprintf(button_string, "%s %s %s %s", enter_button == SCE_SYSTEM_PARAM_ENTER_BUTTON_CIRCLE ? CIRCLE : CROSS, language_container[OK],
|
||||
enter_button == SCE_SYSTEM_PARAM_ENTER_BUTTON_CIRCLE ? CROSS : CIRCLE, language_container[CANCEL]);
|
||||
enter_button == SCE_SYSTEM_PARAM_ENTER_BUTTON_CIRCLE ? CROSS : CIRCLE, language_container[CANCEL]);
|
||||
break;
|
||||
|
||||
case SCE_MSG_DIALOG_BUTTON_TYPE_CANCEL:
|
||||
|
Loading…
Reference in New Issue
Block a user