From 4c22d1063d7612bcd8865f4bfd96540ecc58208b Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 28 Feb 2014 19:07:30 +0100 Subject: [PATCH] (360) Add HAVE_RMENU_XUI hooks to file_list.c --- file_list.c | 23 +++++++++++++++++++++++ frontend/menu/disp/rmenu_xui.cpp | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/file_list.c b/file_list.c index 7d02c549a6..8780bebbc9 100644 --- a/file_list.c +++ b/file_list.c @@ -19,6 +19,9 @@ #include "file_list.h" #include "compat/strcasestr.h" #include "msvc/msvc_compat.h" +#ifdef HAVE_RMENU_XUI +#include +#endif struct item_file { @@ -28,6 +31,10 @@ struct item_file size_t directory_ptr; }; +#ifdef HAVE_RMENU_XUI +extern HXUIOBJ m_menulist; +#endif + void file_list_push(file_list_t *list, const char *path, unsigned type, size_t directory_ptr) { @@ -41,17 +48,30 @@ void file_list_push(file_list_t *list, list->list = (struct item_file*)realloc(list->list, list->capacity * sizeof(struct item_file)); } +#ifdef HAVE_RMENU_XUI + wchar_t buf[PATH_MAX]; + XuiListInsertItems(m_menulist, list->size, 1); + mbstowcs(buf, path, sizeof(buf) / sizeof(wchar_t)); + XuiListSetText(m_menulist, list->size, buf); +#endif + list->list[list->size].path = strdup(path); list->list[list->size].alt = NULL; list->list[list->size].type = type; list->list[list->size].directory_ptr = directory_ptr; list->size++; + } void file_list_pop(file_list_t *list, size_t *directory_ptr) { if (!(list->size == 0)) + { +#ifdef HAVE_RMENU_XUI + XuiListDeleteItems(m_menulist, 0, list->size); +#endif free(list->list[--list->size].path); + } if (directory_ptr) *directory_ptr = list->list[list->size].directory_ptr; @@ -74,6 +94,9 @@ void file_list_clear(file_list_t *list) free(list->list[i].path); free(list->list[i].alt); } +#ifdef HAVE_RMENU_XUI + XuiListDeleteItems(m_menulist, 0, XuiListGetItemCount(m_menulist)); +#endif list->size = 0; } diff --git a/frontend/menu/disp/rmenu_xui.cpp b/frontend/menu/disp/rmenu_xui.cpp index 13d9acae54..274fc26437 100644 --- a/frontend/menu/disp/rmenu_xui.cpp +++ b/frontend/menu/disp/rmenu_xui.cpp @@ -1501,7 +1501,7 @@ static void rmenu_xui_render(void *data) && !rgui->msg_force) return; - size_t begin = rgui->selection_ptr >= 0; + size_t begin = rgui->selection_ptr; size_t end = rgui->selection_buf->size; rmenu_xui_render_background(rgui);