"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/xitk/xine-toolkit/button_list.c" between
xine-ui-0.99.13.tar.bz2 and xine-ui-0.99.14.tar.bz2

About: xine is a free video player which plays mpeg-2 and mpeg-1 video, DVDs (unlocked/unencrypted only), video CDs, SVCDs, and AVI files (using Win32 codecs) with synchronized audio and video, and optionally fullscreen using the Xv extensions in Xfree86 4.x (user interface).

button_list.c  (xine-ui-0.99.13.tar.bz2):button_list.c  (xine-ui-0.99.14.tar.bz2)
/* /*
* Copyright (C) 2019-2021 the xine project * Copyright (C) 2019-2022 the xine project
* *
* This file is part of xine, a free video player. * This file is part of xine, a free video player.
* *
* xine is free software; you can redistribute it and/or modify * xine is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* xine is distributed in the hope that it will be useful, * xine is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
skipping to change at line 202 skipping to change at line 202
max = bl->num; max = bl->num;
} }
bl->visible = max; bl->visible = max;
max = (bl->num + bl->visible - 1) / bl->visible * bl->visible; max = (bl->num + bl->visible - 1) / bl->visible * bl->visible;
if (max > (int)(sizeof (bl->widgets) / sizeof (bl->widgets[0]))) if (max > (int)(sizeof (bl->widgets) / sizeof (bl->widgets[0])))
max = sizeof (bl->widgets) / sizeof (bl->widgets[0]); max = sizeof (bl->widgets) / sizeof (bl->widgets[0]);
if (max > bl->last) { if (max > bl->last) {
/* more " " */ /* more " " */
xitk_labelbutton_widget_t lb; xitk_labelbutton_widget_t lb;
XITK_WIDGET_INIT (&lb); _xitk_new_widget_init (&lb.nw, bl);
lb.skin_element_name = bl->skin_element_name; lb.nw.skin_element_name = bl->skin_element_name;
lb.button_type = CLICK_BUTTON; lb.button_type = CLICK_BUTTON;
lb.align = ALIGN_DEFAULT; lb.align = ALIGN_DEFAULT;
lb.callback = NULL; lb.callback = NULL;
lb.userdata = NULL; lb.state_callback = NULL;
lb.state_callback = NULL; lb.label = "";
lb.label = "";
for (i = bl->last; i < max; i++) { for (i = bl->last; i < max; i++) {
bl->widgets[i] = xitk_labelbutton_create (bl->widget_list, skin_config, &l b); bl->widgets[i] = xitk_labelbutton_create (&lb, skin_config);
if (!bl->widgets[i]) if (!bl->widgets[i])
break; break;
bl->widgets[i]->type |= bl->widget_type_flags; bl->widgets[i]->type |= bl->widget_type_flags;
xitk_widget_set_parent (bl->widgets[i], &bl->w); xitk_widget_set_parent (bl->widgets[i], &bl->w);
xitk_dnode_insert_after (&bl->add_here->node, &bl->widgets[i]->node); xitk_dnode_insert_after (&bl->add_here->node, &bl->widgets[i]->node);
xitk_widgets_state (bl->widgets + i, 1, XITK_WIDGET_STATE_ENABLE | XITK_WI DGET_STATE_VISIBLE, 0); xitk_widgets_state (bl->widgets + i, 1, XITK_WIDGET_STATE_ENABLE | XITK_WI DGET_STATE_VISIBLE, 0);
xitk_dnode_remove (&bl->widgets[i]->node); xitk_dnode_remove (&bl->widgets[i]->node);
} }
bl->last = i; bl->last = i;
} else if (max < bl->last) { } else if (max < bl->last) {
skipping to change at line 273 skipping to change at line 272
bl->flags ^= 1; bl->flags ^= 1;
m = m ? ~0u : 0; m = m ? ~0u : 0;
e = bl->first + bl->visible; e = bl->first + bl->visible;
if (e > bl->num) if (e > bl->num)
e = bl->num; e = bl->num;
xitk_widgets_state (bl->widgets + bl->first, e - bl->first, XITK_WIDGET_STATE_ ENABLE, m); xitk_widgets_state (bl->widgets + bl->first, e - bl->first, XITK_WIDGET_STATE_ ENABLE, m);
if (bl->num > bl->visible) if (bl->num > bl->visible)
xitk_widgets_state (&bl->swap, 1, XITK_WIDGET_STATE_ENABLE, m); xitk_widgets_state (&bl->swap, 1, XITK_WIDGET_STATE_ENABLE, m);
} }
static void xitk_button_list_tips_timeout (xitk_button_list_t *bl, int tips_time
out) {
xitk_set_widget_tips_and_timeout (bl->swap, bl->w.tips_string, tips_timeout);
}
static int xitk_button_list_event (xitk_widget_t *w, const widget_event_t *event ) { static int xitk_button_list_event (xitk_widget_t *w, const widget_event_t *event ) {
xitk_button_list_t *bl = (xitk_button_list_t *)w; xitk_button_list_t *bl = (xitk_button_list_t *)w;
if (event && bl && ((bl->w.type & WIDGET_TYPE_MASK) == WIDGET_TYPE_BUTTON_LIST )) { if (event && bl && ((bl->w.type & WIDGET_TYPE_MASK) == WIDGET_TYPE_BUTTON_LIST )) {
switch (event->type) { switch (event->type) {
case WIDGET_EVENT_CHANGE_SKIN: case WIDGET_EVENT_CHANGE_SKIN:
xitk_button_list_new_skin (bl, event->skonfig); xitk_button_list_new_skin (bl, event->skonfig);
return 0; return 0;
case WIDGET_EVENT_DESTROY: case WIDGET_EVENT_DESTROY:
xitk_button_list_delete (bl); xitk_button_list_delete (bl);
return 0; return 0;
case WIDGET_EVENT_ENABLE: case WIDGET_EVENT_ENABLE:
xitk_button_list_able (bl); xitk_button_list_able (bl);
break; break;
case WIDGET_EVENT_TIPS_TIMEOUT:
xitk_button_list_tips_timeout (bl, event->tips_timeout);
break;
default: ; default: ;
} }
} }
return 0; return 0;
} }
xitk_widget_t *xitk_button_list_new ( xitk_widget_t *xitk_button_list_new (
xitk_widget_list_t *widget_list, xitk_widget_list_t *widget_list,
xitk_skin_config_t *skin_config, const char *skin_element_name, xitk_skin_config_t *skin_config, const char *skin_element_name,
xitk_state_callback_t callback, void *callback_data, xitk_state_callback_t callback, void *callback_data,
skipping to change at line 348 skipping to change at line 354
bl->first = 0; bl->first = 0;
bl->w.x = bl->x = info ? info->x : 0; bl->w.x = bl->x = info ? info->x : 0;
bl->w.y = bl->y = info ? info->y : 0; bl->w.y = bl->y = info ? info->y : 0;
bl->w.type = WIDGET_GROUP | WIDGET_TYPE_BUTTON_LIST; bl->w.type = WIDGET_GROUP | WIDGET_TYPE_BUTTON_LIST;
xitk_widget_state_from_info (&bl->w, info); xitk_widget_state_from_info (&bl->w, info);
bl->w.event = xitk_button_list_event; bl->w.event = xitk_button_list_event;
bl->add_here = (xitk_widget_t *)widget_list->list.tail.prev; bl->add_here = (xitk_widget_t *)widget_list->list.tail.prev;
XITK_WIDGET_INIT (&lb); _xitk_new_widget_init (&lb.nw, bl);
lb.skin_element_name = bl->skin_element_name; lb.nw.skin_element_name = bl->skin_element_name;
lb.button_type = CLICK_BUTTON; lb.nw.userdata = callback_data;
lb.align = ALIGN_DEFAULT; lb.button_type = CLICK_BUTTON;
lb.callback = callback; lb.align = ALIGN_DEFAULT;
lb.userdata = callback_data; lb.callback = callback;
lb.state_callback = NULL; lb.state_callback = NULL;
/* "101" */ /* "101" */
lb.label = names[0]; lb.label = names[0];
bl->widgets[0] = xitk_labelbutton_create (widget_list, skin_config, &lb); bl->widgets[0] = xitk_labelbutton_create (&lb, skin_config);
if (!bl->widgets[0]) { if (!bl->widgets[0]) {
free (bl); free (bl);
return NULL; return NULL;
} }
bl->widgets[0]->type |= bl->widget_type_flags; bl->widgets[0]->type |= bl->widget_type_flags;
xitk_widget_set_parent (bl->widgets[0], &bl->w); xitk_widget_set_parent (bl->widgets[0], &bl->w);
xitk_dnode_insert_after (&bl->add_here->node, &bl->widgets[0]->node); xitk_dnode_insert_after (&bl->add_here->node, &bl->widgets[0]->node);
if (tips[0]) if (tips[0])
xitk_set_widget_tips_and_timeout (bl->widgets[0], tips[0], tips_timeout); xitk_set_widget_tips_and_timeout (bl->widgets[0], tips[0], tips_timeout);
xitk_widgets_state (bl->widgets, 1, XITK_WIDGET_STATE_ENABLE | XITK_WIDGET_STA TE_VISIBLE, 0); xitk_widgets_state (bl->widgets, 1, XITK_WIDGET_STATE_ENABLE | XITK_WIDGET_STA TE_VISIBLE, 0);
skipping to change at line 395 skipping to change at line 401
break; break;
case DIRECTION_RIGHT: case DIRECTION_RIGHT:
bl->dx = xitk_get_widget_width (bl->widgets[0]) + 1; bl->dx = xitk_get_widget_width (bl->widgets[0]) + 1;
bl->dy = 0; bl->dy = 0;
break; break;
} }
/* "102" */ /* "102" */
for (i = 1; i < bl->num; i++) { for (i = 1; i < bl->num; i++) {
lb.label = names[i]; lb.label = names[i];
bl->widgets[i] = xitk_labelbutton_create (widget_list, skin_config, &lb); bl->widgets[i] = xitk_labelbutton_create (&lb, skin_config);
if (!bl->widgets[i]) if (!bl->widgets[i])
break; break;
bl->widgets[i]->type |= bl->widget_type_flags; bl->widgets[i]->type |= bl->widget_type_flags;
xitk_widget_set_parent (bl->widgets[i], &bl->w); xitk_widget_set_parent (bl->widgets[i], &bl->w);
xitk_dnode_insert_after (&bl->add_here->node, &bl->widgets[i]->node); xitk_dnode_insert_after (&bl->add_here->node, &bl->widgets[i]->node);
if (tips[i]) if (tips[i])
xitk_set_widget_tips_and_timeout (bl->widgets[i], tips[i], tips_timeout); xitk_set_widget_tips_and_timeout (bl->widgets[i], tips[i], tips_timeout);
xitk_widgets_state (bl->widgets + i, 1, XITK_WIDGET_STATE_ENABLE | XITK_WIDG ET_STATE_VISIBLE, 0); xitk_widgets_state (bl->widgets + i, 1, XITK_WIDGET_STATE_ENABLE | XITK_WIDG ET_STATE_VISIBLE, 0);
xitk_dnode_remove (&bl->widgets[i]->node); xitk_dnode_remove (&bl->widgets[i]->node);
} }
bl->num = i; bl->num = i;
/* " " */ /* " " */
lb.nw.userdata = NULL;
lb.label = ""; lb.label = "";
lb.callback = NULL; lb.callback = NULL;
lb.userdata = NULL;
for (; i < bl->last; i++) { for (; i < bl->last; i++) {
bl->widgets[i] = xitk_labelbutton_create (widget_list, skin_config, &lb); bl->widgets[i] = xitk_labelbutton_create (&lb, skin_config);
if (!bl->widgets[i]) if (!bl->widgets[i])
break; break;
bl->widgets[i]->type |= bl->widget_type_flags; bl->widgets[i]->type |= bl->widget_type_flags;
xitk_widget_set_parent (bl->widgets[i], &bl->w); xitk_widget_set_parent (bl->widgets[i], &bl->w);
xitk_dnode_insert_after (&bl->add_here->node, &bl->widgets[i]->node); xitk_dnode_insert_after (&bl->add_here->node, &bl->widgets[i]->node);
xitk_widgets_state (bl->widgets + i, 1, XITK_WIDGET_STATE_ENABLE | XITK_WIDG ET_STATE_VISIBLE, 0); xitk_widgets_state (bl->widgets + i, 1, XITK_WIDGET_STATE_ENABLE | XITK_WIDG ET_STATE_VISIBLE, 0);
xitk_dnode_remove (&bl->widgets[i]->node); xitk_dnode_remove (&bl->widgets[i]->node);
} }
bl->last = i; bl->last = i;
/* "..." */ /* "..." */
lb.nw.userdata = bl;
lb.callback = xitk_button_list_swap; lb.callback = xitk_button_list_swap;
lb.label = _("..."); lb.label = _("...");
lb.userdata = bl; bl->swap = xitk_labelbutton_create (&lb, skin_config);
bl->swap = xitk_labelbutton_create (widget_list, skin_config, &lb);
if (bl->swap) { if (bl->swap) {
bl->swap->type |= bl->widget_type_flags; bl->swap->type |= bl->widget_type_flags;
xitk_widget_set_parent (bl->swap, &bl->w); xitk_widget_set_parent (bl->swap, &bl->w);
xitk_dnode_insert_after (&bl->add_here->node, &bl->swap->node); xitk_dnode_insert_after (&bl->add_here->node, &bl->swap->node);
xitk_set_widget_tips_and_timeout (bl->swap, _("More sources..."), tips_timeo ut);
xitk_widgets_state (&bl->swap, 1, XITK_WIDGET_STATE_ENABLE | XITK_WIDGET_STA TE_VISIBLE, 0); xitk_widgets_state (&bl->swap, 1, XITK_WIDGET_STATE_ENABLE | XITK_WIDGET_STA TE_VISIBLE, 0);
xitk_dnode_remove (&bl->swap->node); xitk_dnode_remove (&bl->swap->node);
} }
bl->first = 0; bl->first = 0;
xitk_button_list_add (bl); xitk_button_list_add (bl);
xitk_button_list_hull (bl); xitk_button_list_hull (bl);
return &bl->w; return &bl->w;
 End of changes. 14 change blocks. 
24 lines changed or deleted 30 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)