Merge pull request #1402 from lakkatv/xmb

(XMB) Display bug fix and code refactoring
This commit is contained in:
Twinaphex 2015-02-09 23:56:31 +01:00
commit 0c5f10389b
1 changed files with 28 additions and 31 deletions

View File

@ -142,6 +142,31 @@ static const GLfloat rmb_tex_coord[] = {
1, 0, 1, 0,
}; };
static float xmb_item_y(int i, size_t current)
{
float iy;
xmb_handle_t *xmb;
xmb = (xmb_handle_t*)driver.menu->userdata;
if (!xmb)
return 0;
iy = xmb->vspacing;
if (i < current)
if (xmb->depth > 1)
iy *= (i - (int)current + xmb->above_subitem_offset);
else
iy *= (i - (int)current + xmb->above_item_offset);
else
iy *= (i - (int)current + xmb->under_item_offset);
if (i == current)
iy = xmb->vspacing * xmb->active_item_factor;
return iy;
}
static int xmb_entry_iterate(unsigned action) static int xmb_entry_iterate(unsigned action)
{ {
const char *label = NULL; const char *label = NULL;
@ -461,21 +486,12 @@ static void xmb_selection_pointer_changed(void)
if (!node) if (!node)
continue; continue;
iy = xmb->vspacing; iy = xmb_item_y(i, current);
if (i < current)
if (xmb->depth > 1)
iy *= (i - (int)current + xmb->above_subitem_offset);
else
iy *= (i - (int)current + xmb->above_item_offset);
else
iy *= (i - (int)current + xmb->under_item_offset);
if (i == current) if (i == current)
{ {
ia = xmb->i_active_alpha; ia = xmb->i_active_alpha;
iz = xmb->i_active_zoom; iz = xmb->i_active_zoom;
iy = xmb->vspacing * xmb->active_item_factor;
} }
add_tween(XMB_DELAY, ia, &node->alpha, &inOutQuad, NULL); add_tween(XMB_DELAY, ia, &node->alpha, &inOutQuad, NULL);
@ -536,19 +552,7 @@ static void xmb_list_open_new(file_list_t *list, int dir, size_t current)
node->x = xmb->icon_size*dir*2; node->x = xmb->icon_size*dir*2;
iy = xmb->vspacing; node->y = xmb_item_y(i, current);
if (i < current)
if (xmb->depth > 1)
iy *= (i - (int)current + xmb->above_subitem_offset);
else
iy *= (i - (int)current + xmb->above_item_offset);
else
iy *= (i - (int)current + xmb->under_item_offset);
if (i == current)
iy = xmb->vspacing * xmb->active_item_factor;
node->y = iy;
if (i == current) if (i == current)
node->zoom = 1; node->zoom = 1;
@ -1533,17 +1537,10 @@ static void xmb_list_insert(void *data,
current = driver.menu->selection_ptr; current = driver.menu->selection_ptr;
iy = (i < current) ? xmb->vspacing *
(i - current + xmb->above_item_offset) :
xmb->vspacing * (i - current + xmb->under_item_offset);
if (i == current)
iy = xmb->vspacing * xmb->active_item_factor;
node->alpha = xmb->i_passive_alpha; node->alpha = xmb->i_passive_alpha;
node->zoom = xmb->i_passive_zoom; node->zoom = xmb->i_passive_zoom;
node->label_alpha = node->alpha; node->label_alpha = node->alpha;
node->y = iy; node->y = xmb_item_y(i, current);
node->x = 0; node->x = 0;
if (i == current) if (i == current)