Ejemplo n.º 1
0
void menu_input_post_iterate(int *ret, unsigned action)
{
   size_t selection;
   menu_file_list_cbs_t *cbs = NULL;
   menu_entry_t entry        = {{0}};
   menu_input_t *menu_input  = menu_input_get_ptr();
   menu_list_t *menu_list    = menu_list_get_ptr();
   settings_t *settings      = config_get_ptr();

   if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
      return;

   cbs = menu_list_get_actiondata_at_offset
      (menu_list->selection_buf, selection);

   menu_entry_get(&entry, selection, NULL, false);

   if (settings->menu.mouse.enable)
      *ret  = menu_input_mouse_post_iterate  (&menu_input->mouse.state, cbs, action);

   *ret = menu_input_mouse_frame(cbs, &entry, menu_input->mouse.state);

   if (settings->menu.pointer.enable)
      *ret |= menu_input_pointer_post_iterate(cbs, &entry, action);
}
Ejemplo n.º 2
0
static int action_toggle_mainmenu(unsigned type, const char *label,
      unsigned action)
{
   menu_file_list_cbs_t *cbs = NULL;
   unsigned push_list = 0;
   menu_handle_t *menu = menu_driver_resolve();
   if (!menu)
      return -1;

   if (file_list_get_size(menu->menu_list->menu_stack) == 1)
   {
      if (!strcmp(driver.menu_ctx->ident, "xmb"))
      {
         menu->navigation.selection_ptr = 0;
         switch (action)
         {
            case MENU_ACTION_LEFT:
               if (menu->categories.selection_ptr == 0)
                  break;
               push_list = 1;
               break;
            case MENU_ACTION_RIGHT:
               if (menu->categories.selection_ptr == (menu->categories.size - 1))
                  break;
               push_list = 1;
               break;
         }
      }
   }
   else 
      push_list = 2;

   cbs = (menu_file_list_cbs_t*)
      menu_list_get_actiondata_at_offset(menu->menu_list->selection_buf,
            menu->navigation.selection_ptr);

   switch (push_list)
   {
      case 1:
         if (driver.menu_ctx->list_cache)
            driver.menu_ctx->list_cache(true, action);

         if (cbs && cbs->action_content_list_switch)
            return cbs->action_content_list_switch(
                  menu->menu_list->selection_buf,
                  menu->menu_list->menu_stack,
                  "",
                  "",
                  0);
         break;
      case 2:
         action_toggle_scroll(0, "", action);
         break;
      case 0:
      default:
         break;
   }

   return 0;
}
Ejemplo n.º 3
0
static int action_select_default(const char *path, const char *label, unsigned type,
      size_t idx)
{
   menu_entry_t entry;
   int ret                   = 0;
   enum menu_action action   = MENU_ACTION_NOOP;
   menu_file_list_cbs_t *cbs = NULL;
   menu_list_t    *menu_list = menu_list_get_ptr();

   menu_entry_get(&entry, idx, NULL, false);

   cbs = menu_list_get_actiondata_at_offset(menu_list->selection_buf, idx);
    
   if (cbs->setting)
   {
       switch (cbs->setting->type)
       {
           case ST_BOOL:
           case ST_INT:
           case ST_UINT:
           case ST_FLOAT:
               action = MENU_ACTION_RIGHT;
               break;
           case ST_PATH:
           case ST_DIR:
           case ST_ACTION:
           case ST_STRING:
           case ST_HEX:
           case ST_BIND:
               action = MENU_ACTION_OK;
               break;
           default:
               break;
       }
   }
    
   if (action == MENU_ACTION_NOOP)
   {
       if (cbs && cbs->action_ok)
           action = MENU_ACTION_OK;
       else
       {
           if (cbs && cbs->action_start)
               action = MENU_ACTION_START;
           if (cbs && cbs->action_right)
               action = MENU_ACTION_RIGHT;
       }
   }
    
   if (action != MENU_ACTION_NOOP)
       ret = menu_entry_action(&entry, idx, action);

   rarch_main_data_iterate();
    
   return ret;
}
Ejemplo n.º 4
0
static int action_left_mainmenu(unsigned type, const char *label,
      bool wraparound)
{
   menu_file_list_cbs_t *cbs = NULL;
   unsigned        push_list = 0;
   menu_list_t    *menu_list = menu_list_get_ptr();
   menu_handle_t       *menu = menu_driver_get_ptr();
   menu_navigation_t   *nav  = menu_navigation_get_ptr();
   unsigned           action = MENU_ACTION_LEFT;
   size_t          list_size = menu_driver_list_get_size(MENU_LIST_PLAIN);
   if (!menu)
      return -1;

   if (list_size == 1)
   {
      nav->selection_ptr = 0;
      if (menu_driver_list_get_selection() != 0)
         push_list = 1;
   }
   else
      push_list = 2;

   cbs = menu_list_get_actiondata_at_offset(menu_list->selection_buf,
         nav->selection_ptr);

   switch (push_list)
   {
      case 1:
         menu_driver_list_cache(MENU_LIST_HORIZONTAL, action);

         if (cbs && cbs->action_content_list_switch)
            return cbs->action_content_list_switch(
                  menu_list->selection_buf, menu_list->menu_stack,
                  "", "", 0);
         break;
      case 2:
         action_left_scroll(0, "", false);
         break;
      case 0:
      default:
         break;
   }

   return 0;
}
Ejemplo n.º 5
0
static int rmenu_entry_iterate(unsigned action)
{
   const char *label = NULL;
   menu_file_list_cbs_t *cbs = NULL;
   menu_handle_t *menu = menu_driver_get_ptr();

   if (!menu)
      return -1;
   
   cbs = (menu_file_list_cbs_t*)menu_list_get_actiondata_at_offset(
         menu->menu_list->selection_buf, menu->navigation.selection_ptr);

   menu_list_get_last_stack(menu->menu_list, NULL, &label, NULL);

   if (cbs && cbs->action_iterate)
      return cbs->action_iterate(label, action);
   
   return -1;
}
Ejemplo n.º 6
0
void menu_input_post_iterate(int *ret, unsigned action)
{
   menu_entry_t entry;
   menu_handle_t *menu       = menu_driver_get_ptr();
   menu_list_t *menu_list    = menu_list_get_ptr();
   settings_t *settings      = config_get_ptr();
   size_t selected           = menu_navigation_get_current_selection();
   menu_file_list_cbs_t *cbs = menu_list_get_actiondata_at_offset
      (menu_list->selection_buf, selected);

   menu_entry_get(&entry, selected, NULL, false);

   if (settings->menu.mouse.enable)
      *ret  = menu_input_mouse_post_iterate  (&menu->input.mouse, cbs, &entry, action);

   *ret = menu_input_mouse_frame(cbs, &entry, menu->input.mouse);

   if (settings->menu.pointer.enable)
      *ret |= menu_input_pointer_post_iterate(cbs, &entry, action);
}
Ejemplo n.º 7
0
void menu_entry_get(menu_entry_t *entry, size_t i,
      void *userdata, bool use_representation)
{
   const char *label         = NULL;
   const char *path          = NULL;
   const char *entry_label   = NULL;
   menu_file_list_cbs_t *cbs = NULL;
   file_list_t *list         = NULL;
   menu_list_t *menu_list    = menu_list_get_ptr();

   if (!menu_list)
      return;

   menu_list_get_last_stack(menu_list, NULL, &label, NULL, NULL);
   
   list = userdata ? (file_list_t*)userdata : menu_list->selection_buf;

   if (!list)
      return;

   menu_list_get_at_offset(list, i, &path, &entry_label, &entry->type,
         &entry->entry_idx);

   cbs = menu_list_get_actiondata_at_offset(list, i);

   if (cbs && cbs->action_get_value && use_representation)
      cbs->action_get_value(list,
            &entry->spacing, entry->type, i, label,
            entry->value,  sizeof(entry->value), 
            entry_label, path,
            entry->path, sizeof(entry->path));

   entry->idx         = i;

   if (path && !use_representation)
      strlcpy(entry->path,  path,        sizeof(entry->path));
   if (entry_label)
      strlcpy(entry->label, entry_label, sizeof(entry->label));
}
Ejemplo n.º 8
0
static int action_iterate_info(char *s, size_t len, const char *label)
{
   uint32_t label_hash              = 0;
   menu_file_list_cbs_t *cbs        = NULL;
   menu_list_t *menu_list           = menu_list_get_ptr();
   menu_navigation_t *nav           = menu_navigation_get_ptr();
   size_t i                         = menu_navigation_get_selection(nav);

   if (!menu_list)
      return 0;

   cbs = menu_list_get_actiondata_at_offset(menu_list->selection_buf, i);

   if (cbs->setting)
   {
      char needle[PATH_MAX_LENGTH];
      strlcpy(needle, cbs->setting->name, sizeof(needle));
      label_hash       = menu_hash_calculate(needle);
   }

   return menu_hash_get_help(label_hash, s, len);
}
Ejemplo n.º 9
0
// Performs whatever actions are associated with menu entry 'i'. This
// is the most important function because it does all the work
// associated with clicking on things in the UI. This includes loading
// cores and updating the currently displayed menu
int menu_entry_select(uint32_t i)
{
   int ret = 0;
   menu_entry_t entry;
   enum menu_action action   = MENU_ACTION_NOOP;
   menu_file_list_cbs_t *cbs = NULL;
   menu_navigation_t *nav    = menu_navigation_get_ptr();
   menu_list_t    *menu_list = menu_list_get_ptr();
   rarch_setting_t *setting  = menu_setting_find(
         menu_list->selection_buf->list[i].label);

   menu_entry_get(&entry, i, NULL, false);

   cbs = menu_list_get_actiondata_at_offset(menu_list->selection_buf, i);

   if (setting_is_of_path_type(setting))
      return 0;

   nav->selection_ptr = i;
   if ((cbs && cbs->action_ok) || setting_is_of_general_type(setting))
       action = MENU_ACTION_OK;
   else
   {
      if (cbs && cbs->action_start)
         action = MENU_ACTION_START;
      if (cbs && cbs->action_right)
         action = MENU_ACTION_RIGHT;
   }
    
   if (action != MENU_ACTION_NOOP)
       ret = menu_entry_action(&entry, i, action);

   rarch_main_data_iterate();
    
   return ret;
}
Ejemplo n.º 10
0
static void rmenu_render(void)
{
   size_t begin, end, i, j;
   struct font_params font_parms;
   char title[256], title_buf[256];
   char title_msg[64];
   const char *dir          = NULL;
   const char *label        = NULL;
   const char *core_name    = NULL;
   const char *core_version = NULL;
   unsigned menu_type       = 0;
   menu_handle_t *menu      = menu_driver_get_ptr();
   global_t    *global      = global_get_ptr();
   runloop_t *runloop       = rarch_main_get_ptr();

   if (!menu)
      return;

   if (!render_normal)
   {
      render_normal = true;
      return;
   }

   if (menu->need_refresh && runloop->is_menu
         && !menu->msg_force)
      return;

   runloop->frames.video.current.menu.animation.is_active = false;
   runloop->frames.video.current.menu.label.is_updated    = false;
   runloop->frames.video.current.menu.framebuf.dirty      = false;

   if (!menu->menu_list->selection_buf)
      return;

   begin = (menu->navigation.selection_ptr >= (ENTRIES_HEIGHT / 2)) ? 
      (menu->navigation.selection_ptr - (ENTRIES_HEIGHT / 2)) : 0;
   end   = ((menu->navigation.selection_ptr + ENTRIES_HEIGHT) <= 
         menu_list_get_size(menu->menu_list)) ?
      menu->navigation.selection_ptr + ENTRIES_HEIGHT :
      menu_list_get_size(menu->menu_list);

   if (menu_list_get_size(menu->menu_list) <= ENTRIES_HEIGHT)
      begin = 0;

   if (end - begin > ENTRIES_HEIGHT)
      end = begin + ENTRIES_HEIGHT;
   
   rmenu_render_background();

   menu_list_get_last_stack(menu->menu_list, &dir, &label, &menu_type);

   get_title(label, dir, menu_type, title, sizeof(title));

   menu_animation_ticker_line(title_buf, RMENU_TERM_WIDTH,
         runloop->frames.video.count / 15, title, true);

   font_parms.x = POSITION_EDGE_MIN + POSITION_OFFSET;
   font_parms.y = POSITION_EDGE_MIN + POSITION_RENDER_OFFSET
      - (POSITION_OFFSET*2);
   font_parms.scale = FONT_SIZE_NORMAL;
   font_parms.color = WHITE;

   video_driver_set_osd_msg(title_buf, &font_parms, NULL);

   core_name = global->menu.info.library_name;
   if (!core_name)
      core_name = global->system.info.library_name;
   if (!core_name)
      core_name = "No Core";

   core_version = global->menu.info.library_version;
   if (!core_version)
      core_version = global->system.info.library_version;
   if (!core_version)
      core_version = "";

   font_parms.x = POSITION_EDGE_MIN + POSITION_OFFSET;
   font_parms.y = POSITION_EDGE_MAX - (POSITION_OFFSET*2);
   font_parms.scale = FONT_SIZE_NORMAL;
   font_parms.color = WHITE;

   snprintf(title_msg, sizeof(title_msg), "%s - %s %s",
         PACKAGE_VERSION, core_name, core_version);

   video_driver_set_osd_msg(title_msg, &font_parms, NULL);

   j = 0;

   for (i = begin; i < end; i++, j++)
   {
      char message[PATH_MAX_LENGTH], type_str[PATH_MAX_LENGTH],
           entry_title_buf[PATH_MAX_LENGTH], type_str_buf[PATH_MAX_LENGTH],
           path_buf[PATH_MAX_LENGTH];
      const char *path = NULL, *entry_label = NULL;
      unsigned type = 0, w = 0;
      bool selected = false;
      menu_file_list_cbs_t *cbs = NULL;

      menu_list_get_at_offset(menu->menu_list->selection_buf, i,
            &path, &entry_label, &type);

      cbs = (menu_file_list_cbs_t*)
         menu_list_get_actiondata_at_offset(menu->menu_list->selection_buf,
               i);

      if (cbs && cbs->action_get_representation)
         cbs->action_get_representation(menu->menu_list->selection_buf,
               &w, type, i, label,
               type_str, sizeof(type_str), 
               entry_label, path,
               path_buf, sizeof(path_buf));

      selected = (i == menu->navigation.selection_ptr);

      menu_animation_ticker_line(entry_title_buf, RMENU_TERM_WIDTH - (w + 1 + 2),
            runloop->frames.video.count / 15, path, selected);
      menu_animation_ticker_line(type_str_buf, w, runloop->frames.video.count / 15,
            type_str, selected);

      snprintf(message, sizeof(message), "%c %s",
            selected ? '>' : ' ', entry_title_buf);

#if 0
      blit_line(x, y, message, selected);
#endif
      font_parms.x = POSITION_EDGE_MIN + POSITION_OFFSET;
      font_parms.y = POSITION_EDGE_MIN + POSITION_RENDER_OFFSET
         + (POSITION_OFFSET * j);
      font_parms.scale = FONT_SIZE_NORMAL;
      font_parms.color = WHITE;

      video_driver_set_osd_msg(message, &font_parms, NULL);

      font_parms.x = POSITION_EDGE_CENTER + POSITION_OFFSET;

      video_driver_set_osd_msg(type_str_buf, &font_parms, NULL);
   }
}
Ejemplo n.º 11
0
int menu_entry_action(menu_entry_t *entry, unsigned i, enum menu_action action)
{
   int ret                   = 0;
   menu_navigation_t *nav    = menu_navigation_get_ptr();
   menu_display_t *disp      = menu_display_get_ptr();
   menu_list_t *menu_list    = menu_list_get_ptr();
   menu_file_list_cbs_t *cbs = menu_list_get_actiondata_at_offset(menu_list->selection_buf, i);

   switch (action)
   {
      case MENU_ACTION_UP:
         if (cbs && cbs->action_up)
            ret = cbs->action_up(entry->type, entry->label);
         break;
      case MENU_ACTION_DOWN:
         if (cbs && cbs->action_down)
            ret = cbs->action_down(entry->type, entry->label);
         break;
      case MENU_ACTION_SCROLL_UP:
         menu_navigation_descend_alphabet(nav, &nav->selection_ptr);
         break;
      case MENU_ACTION_SCROLL_DOWN:
         menu_navigation_ascend_alphabet(nav, &nav->selection_ptr);
         break;

      case MENU_ACTION_CANCEL:
         if (cbs && cbs->action_cancel)
            ret = cbs->action_cancel(entry->path, entry->label, entry->type, i);
         break;

      case MENU_ACTION_OK:
         if (cbs && cbs->action_ok)
            ret = cbs->action_ok(entry->path, entry->label, entry->type, i, entry->entry_idx);
         break;
      case MENU_ACTION_START:
         if (cbs && cbs->action_start)
            ret = cbs->action_start(entry->type, entry->label);
         break;
      case MENU_ACTION_LEFT:
         if (cbs && cbs->action_left)
            ret = cbs->action_left(entry->type, entry->label, false);
         break;
      case MENU_ACTION_RIGHT:
         if (cbs && cbs->action_right)
            ret = cbs->action_right(entry->type, entry->label, false);
         break;
      case MENU_ACTION_INFO:
         if (cbs && cbs->action_info)
            ret = cbs->action_info(entry->type, entry->label);
         break;
      case MENU_ACTION_SELECT:
         if (cbs && cbs->action_select)
            ret = cbs->action_select(entry->path, entry->label, entry->type, i);
         break;

      case MENU_ACTION_REFRESH:
         if (cbs && cbs->action_refresh)
         {
            ret = cbs->action_refresh(menu_list->selection_buf, menu_list->menu_stack);
            menu_entries_unset_refresh();
         }
         break;

      case MENU_ACTION_MESSAGE:
         if (disp)
            disp->msg_force = true;
         break;

      case MENU_ACTION_SEARCH:
         menu_input_search_start();
         break;

      case MENU_ACTION_SCAN:
         if (cbs && cbs->action_scan)
            ret = cbs->action_scan(entry->path, entry->label, entry->type, i);
         break;

      default:
         break;
   }

   return ret;
}
static int action_iterate_main(const char *label, unsigned action)
{
   int ret                   = 0;
   unsigned type_offset      = 0;
   const char *label_offset  = NULL;
   const char *path_offset   = NULL;
   menu_file_list_cbs_t *cbs = NULL;
   menu_handle_t *menu       = menu_driver_get_ptr();
   global_t *global          = global_get_ptr();
   if (!menu)
      return 0;

   cbs = (menu_file_list_cbs_t*)
      menu_list_get_actiondata_at_offset(menu->menu_list->selection_buf,
            menu->navigation.selection_ptr);

   menu_list_get_at_offset(menu->menu_list->selection_buf,
         menu->navigation.selection_ptr, &path_offset, &label_offset, &type_offset);

   if (!strcmp(label, "help"))
      return action_iterate_help(label, action);
   else if (!strcmp(label, "info_screen"))
      return action_iterate_info(label, action);
   else if (!strcmp(label, "load_open_zip"))
      return action_iterate_load_open_zip(label, action);
   else if (!strcmp(label, "message"))
      return action_iterate_message(label, action);
   else if (
         !strcmp(label, "custom_viewport_1") ||
         !strcmp(label, "custom_viewport_2")
         )
      return action_iterate_menu_viewport(label, action);
   else if (
         !strcmp(label, "custom_bind") ||
         !strcmp(label, "custom_bind_all") ||
         !strcmp(label, "custom_bind_defaults")
         )
   {
      if (global->menu.bind_mode_keyboard)
         return action_iterate_custom_bind_keyboard(label, action);
      else
         return action_iterate_custom_bind(label, action);
   }

   if (menu->need_refresh && !menu->nonblocking_refresh && action != MENU_ACTION_MESSAGE)
      action = MENU_ACTION_REFRESH;

   switch (action)
   {
      case MENU_ACTION_UP:
      case MENU_ACTION_DOWN:
         if (cbs && cbs->action_up_or_down)
            ret = cbs->action_up_or_down(type_offset, label_offset, action);
         break;
      case MENU_ACTION_SCROLL_UP:
         menu_navigation_descend_alphabet(&menu->navigation, &menu->navigation.selection_ptr);
         break;
      case MENU_ACTION_SCROLL_DOWN:
         menu_navigation_ascend_alphabet(&menu->navigation, &menu->navigation.selection_ptr);
         break;

      case MENU_ACTION_CANCEL:
         if (cbs && cbs->action_cancel)
            return cbs->action_cancel(path_offset, label_offset, type_offset, menu->navigation.selection_ptr);
         break;

      case MENU_ACTION_OK:
         if (cbs && cbs->action_ok)
            return cbs->action_ok(path_offset, label_offset, type_offset, menu->navigation.selection_ptr);
         break;
      case MENU_ACTION_START:
         if (cbs && cbs->action_start)
            return cbs->action_start(type_offset, label_offset, action);
         break;
      case MENU_ACTION_LEFT:
      case MENU_ACTION_RIGHT:
         if (cbs && cbs->action_toggle)
            ret = cbs->action_toggle(type_offset, label_offset, action, false);
         break;
      case MENU_ACTION_SELECT:
         if (cbs && cbs->action_select)
            ret = cbs->action_select(type_offset, label_offset, action);
         break;

      case MENU_ACTION_REFRESH:
         if (cbs && cbs->action_refresh)
            ret = cbs->action_refresh(menu->menu_list->selection_buf,
                  menu->menu_list->menu_stack);
         break;

      case MENU_ACTION_MESSAGE:
         menu->msg_force = true;
         break;

      case MENU_ACTION_SEARCH:
         menu_input_search_start();
         break;

      case MENU_ACTION_TEST:
#if 0
         menu->rdl = database_info_write_rdl_init("/home/twinaphex/roms");

         if (!menu->rdl)
            return -1;
#endif
         break;

      default:
         break;
   }

   if (ret)
      return ret;

   ret  = mouse_post_iterate(cbs, path_offset, label_offset, type_offset, action);
   ret |= pointer_post_iterate(cbs, path_offset, label_offset, type_offset, action);

   menu_driver_render();

   /* Have to defer it so we let settings refresh. */
   if (menu->push_start_screen)
   {
      menu_list_push_stack(menu->menu_list, "", "help", 0, 0);
      menu->push_start_screen = false;
   }

   return ret;
}
Ejemplo n.º 13
0
static void rmenu_xui_render(void)
{
	size_t end, i;
	char title[PATH_MAX_LENGTH];
	const char *dir = NULL, *label = NULL;
	unsigned menu_type = 0;
   menu_handle_t *menu = menu_driver_resolve();

   if (!menu)
      return;
	if (menu->need_refresh && 
		g_runloop.is_menu && !menu->msg_force)
		return;

   g_runloop.frames.video.current.menu.animation.is_active = false;
   g_runloop.frames.video.current.menu.label.is_updated    = false;
   g_runloop.frames.video.current.menu.framebuf.dirty      = false;

	rmenu_xui_render_background();

	menu_list_get_last_stack(menu->menu_list, &dir, &label, &menu_type);

	if (XuiHandleIsValid(m_menutitle))
	{
		get_title(label, dir, menu_type, title, sizeof(title));
		mbstowcs(strw_buffer, title, sizeof(strw_buffer) / sizeof(wchar_t));
		XuiTextElementSetText(m_menutitle, strw_buffer);
		menu_animation_ticker_line(title, RXUI_TERM_WIDTH - 3, g_runloop.frames.video.count / 15, title, true);
	}

	if (XuiHandleIsValid(m_menutitle))
	{
      const char *core_version = NULL;
		const char *core_name    = g_extern.menu.info.library_name;
		if (!core_name)
			core_name = g_extern.system.info.library_name;
		if (!core_name)
			core_name = "No Core";

		core_version = g_extern.menu.info.library_version;
		if (!core_version)
			core_version = g_extern.system.info.library_version;
		if (!core_version)
			core_version = "";

		snprintf(title, sizeof(title), "%s - %s %s",
			PACKAGE_VERSION, core_name, core_version);

		mbstowcs(strw_buffer, title, sizeof(strw_buffer) / sizeof(wchar_t));
		XuiTextElementSetText(m_menutitlebottom, strw_buffer);
	}

	end = menu_list_get_size(menu->menu_list);
	for (i = 0; i < end; i++)
   {
      wchar_t msg_left[PATH_MAX_LENGTH], msg_right[PATH_MAX_LENGTH];
      char type_str[PATH_MAX_LENGTH], path_buf[PATH_MAX_LENGTH];
      const char *path = NULL, *entry_label = NULL;
      unsigned type = 0, w = 0;
      menu_file_list_cbs_t *cbs = NULL;

      menu_list_get_at_offset(menu->menu_list->selection_buf, i, &path,
            &entry_label, &type);

      cbs = (menu_file_list_cbs_t*)
         menu_list_get_actiondata_at_offset(menu->menu_list->selection_buf,
               i);

      if (cbs && cbs->action_get_representation)
         cbs->action_get_representation(menu->menu_list->selection_buf,
               &w, type, i, label,
               type_str, sizeof(type_str), 
               entry_label, path,
               path_buf, sizeof(path_buf));

      mbstowcs(msg_left, path_buf, sizeof(msg_left) / sizeof(wchar_t));
      mbstowcs(msg_right, type_str, sizeof(msg_right) / sizeof(wchar_t));
      rmenu_xui_set_list_text(i, msg_left, msg_right);
   }
	XuiListSetCurSelVisible(m_menulist, menu->navigation.selection_ptr);

	if (menu->keyboard.display)
	{
		char msg[1024];
		const char *str = *menu->keyboard.buffer;
		if (!str)
			str = "";
		snprintf(msg, sizeof(msg), "%s\n%s", menu->keyboard.label, str);
		rmenu_xui_render_messagebox(msg);			
	}
}
Ejemplo n.º 14
0
static int menu_common_iterate(unsigned action)
{
   int ret = 0;
   unsigned type = 0;
   unsigned type_offset = 0;
   const char *label = NULL;
   const char *label_offset = NULL;
   const char *path_offset = NULL;
   unsigned scroll_speed = 0;
   menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)
      menu_list_get_actiondata_at_offset(driver.menu->menu_list->selection_buf,
            driver.menu->selection_ptr);

   menu_list_get_last_stack(driver.menu->menu_list, NULL, &label, &type);

   mouse_iterate(action);

   if (driver.video_data && driver.menu_ctx && driver.menu_ctx->set_texture)
      driver.menu_ctx->set_texture(driver.menu);

   if (!strcmp(label, "help"))
      return menu_start_screen_iterate(action);
   else if (!strcmp(label, "message"))
      return menu_message_toggle(action);
   else if (!strcmp(label, "load_open_zip"))
   {
      switch (g_settings.archive.mode)
      {
         case 0:
            return menu_load_or_open_zip_iterate(action);
         case 1:
            return menu_archive_load();
         case 2:
            return menu_archive_open();
         default:
            break;
      }
   }
   else if (!strcmp(label, "info_screen"))
      return menu_info_screen_iterate(action);
   else if (
         type == MENU_SETTINGS_CUSTOM_VIEWPORT ||
         !strcmp(label, "custom_viewport_2")
         )
      return menu_viewport_iterate(action);
   else if (type == MENU_SETTINGS_CUSTOM_BIND)
   {
      if (menu_input_bind_iterate(driver.menu))
         menu_list_pop_stack(driver.menu->menu_list);
      return 0;
   }
   else if (type == MENU_SETTINGS_CUSTOM_BIND_KEYBOARD)
   {
      if (menu_input_bind_iterate_keyboard(driver.menu))
         menu_list_pop_stack(driver.menu->menu_list);
      return 0;
   }

   menu_list_get_at_offset(driver.menu->menu_list->selection_buf,
         driver.menu->selection_ptr, &path_offset, &label_offset, &type_offset);

   if (driver.menu->need_refresh && action != MENU_ACTION_MESSAGE)
      action = MENU_ACTION_REFRESH;

   scroll_speed = (max(driver.menu->scroll_accel, 2) - 2) / 4 + 1;

   switch (action)
   {
      case MENU_ACTION_UP:
         if (driver.menu->selection_ptr >= scroll_speed)
               menu_navigation_set(driver.menu,
                     driver.menu->selection_ptr - scroll_speed, true);
         else
            menu_navigation_set(driver.menu,
                  menu_list_get_size(driver.menu->menu_list) - 1, true);
         break;

      case MENU_ACTION_DOWN:
         if (driver.menu->selection_ptr + scroll_speed < (menu_list_get_size(driver.menu->menu_list)))
            menu_navigation_set(driver.menu,
                  driver.menu->selection_ptr + scroll_speed, true);
         else
            menu_navigation_clear(driver.menu, false);
         break;

      case MENU_ACTION_SCROLL_UP:
         menu_navigation_descend_alphabet(driver.menu, &driver.menu->selection_ptr);
         break;
      case MENU_ACTION_SCROLL_DOWN:
         menu_navigation_ascend_alphabet(driver.menu, &driver.menu->selection_ptr);
         break;

      case MENU_ACTION_CANCEL:
         apply_deferred_settings();
         menu_list_pop_stack(driver.menu->menu_list);
         break;

      case MENU_ACTION_OK:
         if (cbs && cbs->action_ok)
            return cbs->action_ok(path_offset, label_offset, type_offset, driver.menu->selection_ptr);
         break;
      case MENU_ACTION_START:
         if (cbs && cbs->action_start)
            return cbs->action_start(type_offset, label_offset, action);
         break;
      case MENU_ACTION_LEFT:
      case MENU_ACTION_RIGHT:
         if (cbs && cbs->action_toggle)
            ret = cbs->action_toggle(type_offset, label_offset, action);
         break;
      case MENU_ACTION_SELECT:
         menu_list_push_stack(driver.menu->menu_list, "", "info_screen",
               0, driver.menu->selection_ptr);
         break;

      case MENU_ACTION_REFRESH:
         menu_entries_deferred_push(driver.menu->menu_list->selection_buf,
               driver.menu->menu_list->menu_stack);

         driver.menu->need_refresh = false;
         break;

      case MENU_ACTION_MESSAGE:
         driver.menu->msg_force = true;
         break;

      default:
         break;
   }

   if (ret)
      return ret;

   ret = mouse_post_iterate(cbs, path_offset, label_offset, type_offset, action);

   if (driver.menu_ctx && driver.menu_ctx->iterate)
      driver.menu_ctx->iterate(driver.menu, action);

   if (driver.video_data && driver.menu_ctx && driver.menu_ctx->render)
      driver.menu_ctx->render();

   /* Have to defer it so we let settings refresh. */
   if (driver.menu->push_start_screen)
   {
      menu_list_push_stack(driver.menu->menu_list, "", "help", 0, 0);
      driver.menu->push_start_screen = false;
   }

   return ret;
}
Ejemplo n.º 15
0
int menu_entry_action(menu_entry_t *entry, unsigned i, enum menu_action action)
{
   int ret                   = 0;
   menu_navigation_t *nav    = menu_navigation_get_ptr();
   menu_handle_t *menu       = menu_driver_get_ptr();
   menu_list_t *menu_list    = menu_list_get_ptr();
   menu_file_list_cbs_t *cbs = menu_list_get_actiondata_at_offset(menu_list->selection_buf, i);

   switch (action)
   {
      case MENU_ACTION_UP:
         if (cbs && cbs->action_up)
            ret = cbs->action_up(entry->type, entry->label);
         break;
      case MENU_ACTION_DOWN:
         if (cbs && cbs->action_down)
            ret = cbs->action_down(entry->type, entry->label);
         break;
      case MENU_ACTION_SCROLL_UP:
         menu_navigation_descend_alphabet(nav, &nav->selection_ptr);
         break;
      case MENU_ACTION_SCROLL_DOWN:
         menu_navigation_ascend_alphabet(nav, &nav->selection_ptr);
         break;

      case MENU_ACTION_CANCEL:
         if (cbs && cbs->action_cancel)
            ret = cbs->action_cancel(entry->path, entry->label, entry->type, i);
         break;

      case MENU_ACTION_OK:
         if (cbs && cbs->action_ok)
            ret = cbs->action_ok(entry->path, entry->label, entry->type, i);
         break;
      case MENU_ACTION_START:
         if (cbs && cbs->action_start)
            ret = cbs->action_start(entry->type, entry->label);
         break;
      case MENU_ACTION_LEFT:
         if (cbs && cbs->action_left)
            ret = cbs->action_left(entry->type, entry->label, false);
         break;
      case MENU_ACTION_RIGHT:
         if (cbs && cbs->action_right)
            ret = cbs->action_right(entry->type, entry->label, false);
         break;
      case MENU_ACTION_SELECT:
         if (cbs && cbs->action_select)
            ret = cbs->action_select(entry->type, entry->label);
         break;

      case MENU_ACTION_REFRESH:
         if (cbs && cbs->action_refresh)
         {
            ret = cbs->action_refresh(menu_list->selection_buf, menu_list->menu_stack);
            menu_unset_refresh();
         }
         break;

      case MENU_ACTION_MESSAGE:
         menu->msg_force = true;
         break;

      case MENU_ACTION_SEARCH:
         menu_input_search_start();
         break;

      case MENU_ACTION_TEST:
#if 0
         menu->db = database_info_init("/home/squarepusher/roms", DATABASE_TYPE_RDL_WRITE);

         if (!menu->db)
            ret = -1;
#endif
         break;

      default:
         break;
   }

   return ret;
}