"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/xitk/setup.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).

setup.c  (xine-ui-0.99.13.tar.bz2):setup.c  (xine-ui-0.99.14.tar.bz2)
/* /*
* Copyright (C) 2000-2021 the xine project * Copyright (C) 2000-2022 the xine project
* *
* This file is part of xine, a unix video player. * This file is part of xine, a unix 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 62 skipping to change at line 62
#define MAX_DISPLAY_WIDGETS 8 #define MAX_DISPLAY_WIDGETS 8
#define NORMAL_CURS 0 #define NORMAL_CURS 0
#define WAIT_CURS 1 #define WAIT_CURS 1
typedef struct { typedef struct {
char *name; char *name;
int nlen; int nlen;
int num_entries; int num_entries;
int first_shown;
} _setup_section_t; } _setup_section_t;
typedef enum { typedef enum {
_T_frame = 0, _T_frame = 0,
_T_label, _T_label,
_T_widget, _T_widget,
_T_LAST _T_LAST
} _T_t; } _T_t;
typedef struct { typedef struct {
xitk_widget_t *w[_T_LAST]; xitk_widget_t *w[_T_LAST];
int changed; int changed;
/* cfg.unknown_value is only used by cfg.type == XINE_CONFIG_TYPE_UNKNOWN,
* which we skip. misuse it for instance ptr in our copy. */
xine_cfg_entry_t cfg; xine_cfg_entry_t cfg;
} _widget_triplet_t; } _widget_triplet_t;
struct xui_setup_st { struct xui_setup_st {
gGui_t *gui; gGui_t *gui;
xitk_window_t *xwin; xitk_window_t *xwin;
xitk_image_t *bg;
xitk_widget_list_t *widget_list; xitk_widget_list_t *widget_list;
int visible; int visible;
xitk_widget_t *tabs; xitk_widget_t *tabs, *apply, *ok;
xitk_widget_t *ok;
#define SETUP_MAX_SECTIONS 20 #define SETUP_MAX_SECTIONS 20
_setup_section_t sections[SETUP_MAX_SECTIONS + 1]; _setup_section_t sections[SETUP_MAX_SECTIONS + 1];
char *section_names[SETUP_MAX_SECTIONS]; char *section_names[SETUP_MAX_SECTIONS];
int num_sections; int num_sections;
int shown_section;
xitk_widget_t *slider_wg; xitk_widget_t *slider_wg;
_widget_triplet_t *wg; _widget_triplet_t *wg;
int num_wg; int num_wg;
int max_wg; int max_wg;
int first_displayed; int first_displayed;
xitk_register_key_t kreg; xitk_register_key_t kreg;
xitk_register_key_t dialog; xitk_register_key_t dialog;
int th; /* Tabs height */ int th; /* Tabs height */
int fh; /* Font height */ int fh; /* Font height */
struct {
int x, y, w, h;
} main;
char namebuf[1024]; char namebuf[1024];
}; };
static void setup_change_section (xitk_widget_t *, void *, int); static void setup_change_section (xitk_widget_t *, void *, int);
/* /*
* Leaving setup panel, release memory. * Leaving setup panel, release memory.
*/ */
static void setup_exit (xitk_widget_t *w, void *data, int state) { static void setup_exit (xitk_widget_t *w, void *data, int state) {
xui_setup_t *setup = data; xui_setup_t *setup = data;
skipping to change at line 173 skipping to change at line 181
/* /*
* Hide/show the setup panel * Hide/show the setup panel
*/ */
void setup_toggle_visibility (xui_setup_t *setup) { void setup_toggle_visibility (xui_setup_t *setup) {
if (setup) if (setup)
toggle_window (setup->gui, setup->xwin, setup->widget_list, &setup->visible, 1); toggle_window (setup->gui, setup->xwin, setup->widget_list, &setup->visible, 1);
} }
static void setup_apply (xitk_widget_t *w, void *data, int state) { static void setup_apply (xitk_widget_t *w, void *data, int state) {
xui_setup_t *setup = data; xui_setup_t *setup = data;
int need_restart = 0;
(void)w; (void)w;
(void)state; (void)state;
if (setup->num_wg > 0) { if (setup->num_wg > 0) {
int i; int need_restart = 0, i;
for (i = 0; i < setup->num_wg; i++) { for (i = 0; i < setup->num_wg; i++) {
if (!setup->wg[i].changed)
if (setup->wg[i].w[_T_widget]) { continue;
int type = xitk_get_widget_type (setup->wg[i].w[_T_widget]); setup->wg[i].changed = 0;
if (!setup->wg[i].w[_T_widget])
if (setup->wg[i].changed || continue;
((type & WIDGET_TYPE_MASK) == WIDGET_TYPE_INPUTTEXT) || (type & WIDGET if (!need_restart && !setup->wg[i].cfg.callback_data && !setup->wg[i].cfg.
_GROUP_INTBOX)) { callback)
xitk_widget_t *w = setup->wg[i].w[_T_widget]; need_restart = 1;
int numval = 0; switch (setup->wg[i].cfg.type) {
const char *strval = NULL; case XINE_CONFIG_TYPE_STRING:
config_update_string (setup->gui->xine,
if(!need_restart) { (char *)setup->wg[i].cfg.key, xitk_inputtext_get_text (setup->wg[i].
if (setup->wg[i].changed && (!setup->wg[i].cfg.callback_data && !set w[_T_widget]));
up->wg[i].cfg.callback)) break;
need_restart = 1; case XINE_CONFIG_TYPE_ENUM:
} case XINE_CONFIG_TYPE_NUM:
case XINE_CONFIG_TYPE_BOOL:
setup->wg[i].changed = 0; case XINE_CONFIG_TYPE_RANGE:
config_update_num (setup->gui->xine, (char *)setup->wg[i].cfg.key, set
switch(type & WIDGET_TYPE_MASK) { up->wg[i].cfg.num_value);
case WIDGET_TYPE_SLIDER: break;
numval = xitk_slider_get_pos(w); default: ;
break;
case WIDGET_TYPE_CHECKBOX:
numval = xitk_button_get_state (w);
break;
case WIDGET_TYPE_INPUTTEXT:
strval = xitk_inputtext_get_text(w);
if(!strcmp(strval, setup->wg[i].cfg.str_value))
continue;
break;
case WIDGET_TYPE_COMBO:
numval = xitk_combo_get_current_selected (w);
break;
case WIDGET_TYPE_INTBOX:
numval = xitk_intbox_get_value (w);
break;
default: ;
}
switch (setup->wg[i].cfg.type) {
case XINE_CONFIG_TYPE_STRING:
config_update_string (setup->gui->xine, (char *)setup->wg[i].cfg.key
, strval);
break;
case XINE_CONFIG_TYPE_ENUM:
case XINE_CONFIG_TYPE_NUM:
case XINE_CONFIG_TYPE_BOOL:
case XINE_CONFIG_TYPE_RANGE:
config_update_num (setup->gui->xine, (char *)setup->wg[i].cfg.key, n
umval);
break;
case XINE_CONFIG_TYPE_UNKNOWN:
break;
}
}
} }
} }
xine_config_save (setup->gui->xine, setup->gui->cfg_file); xine_config_save (setup->gui->xine, setup->gui->cfg_file);
if(w != setup->ok) { if(w != setup->ok) {
int section = xitk_tabs_get_current_selected (setup->tabs); int section = xitk_tabs_get_current_selected (setup->tabs);
if (section >= 0) { if (section >= 0) {
setup_change_section (setup->tabs, setup, section); setup_change_section (setup->tabs, setup, section);
} }
} }
skipping to change at line 275 skipping to change at line 245
static void setup_ok (xitk_widget_t *w, void *data, int state) { static void setup_ok (xitk_widget_t *w, void *data, int state) {
setup_apply (w, data, state); setup_apply (w, data, state);
setup_exit (w, data, state); setup_exit (w, data, state);
} }
/* /*
* *
*/ */
static void setup_clear_tab (xui_setup_t *setup) { static void setup_clear_tab (xui_setup_t *setup) {
xitk_image_t *im; xitk_image_draw_image (setup->widget_list, setup->bg,
int width = (WINDOW_WIDTH - 30); setup->main.x, setup->main.y, setup->main.w, setup->main.h, setup->main.x, s
int height = (MAX_DISPLAY_WIDGETS * (FRAME_HEIGHT + 3) - 3 + 3 + 30); etup->main.y, 0);
im = xitk_image_new (setup->gui->xitk, NULL, 0, width, height);
xitk_image_draw_outter (im, width, height);
xitk_image_draw_image (setup->widget_list, im, 0, 0, width, height, 15, (24 +
setup->th), 0);
xitk_image_free_image (&im);
} }
static void setup_triplets_enable_and_show (xui_setup_t *setup, int start, int s top) { static void setup_triplets_enable_and_show (xui_setup_t *setup, int start, int s top) {
int i; int i;
for (i = start; i < stop; i++) { for (i = start; i < stop; i++) {
_widget_triplet_t *t = setup->wg + i; _widget_triplet_t *t = setup->wg + i;
xitk_widgets_state (t->w, _T_LAST, XITK_WIDGET_STATE_ENABLE | XITK_WIDGET_ST ATE_VISIBLE, ~0u); xitk_widgets_state (t->w, _T_LAST, XITK_WIDGET_STATE_ENABLE | XITK_WIDGET_ST ATE_VISIBLE, ~0u);
} }
skipping to change at line 426 skipping to change at line 389
} }
default: ; default: ;
} }
if (step && xitk_is_widget_enabled (setup->slider_wg) && (!(e->qual & (MODIFIE R_SHIFT | MODIFIER_CTRL)))) { if (step && xitk_is_widget_enabled (setup->slider_wg) && (!(e->qual & (MODIFIE R_SHIFT | MODIFIER_CTRL)))) {
setup_list_step (setup, step); setup_list_step (setup, step);
return 1; return 1;
} }
return gui_handle_be_event (setup->gui, e); return gui_handle_be_event (setup->gui, e);
} }
/* static void any_update (_widget_triplet_t *wt) {
* xui_setup_t *setup = (xui_setup_t *)wt->cfg.unknown_value;
*/ xitk_widgets_state (&setup->apply, 1, XITK_WIDGET_STATE_ENABLE, ~0u);
}
static void numtype_update(xitk_widget_t *w, void *data, int value) { static void numtype_update(xitk_widget_t *w, void *data, int value) {
_widget_triplet_t *triplet = (_widget_triplet_t *) data; _widget_triplet_t *triplet = (_widget_triplet_t *) data;
(void)w; (void)w;
(void)value; /* intentionally always mark as changed, and allow the user
* to trigger update with same value. */
triplet->changed = 1; triplet->changed = 1;
triplet->cfg.num_value = value;
any_update (triplet);
} }
/*
*
*/
static void stringtype_update(xitk_widget_t *w, void *data, const char *str) { static void stringtype_update(xitk_widget_t *w, void *data, const char *str) {
_widget_triplet_t *triplet = (_widget_triplet_t *) data; _widget_triplet_t *triplet = (_widget_triplet_t *) data;
(void)w; (void)w;
(void)str; (void)str;
triplet->changed = 1; triplet->changed = 1;
any_update (triplet);
} }
static void setup_add_nothing_available (xui_setup_t *setup, const char *title, int x, int y) { static void setup_add_nothing_available (xui_setup_t *setup, const char *title, int x, int y) {
_widget_triplet_t *wt = setup->wg; _widget_triplet_t *wt = setup->wg;
xitk_widget_t *frame = NULL; xitk_widget_t *frame = NULL;
xitk_image_t *image; xitk_image_t *image;
xitk_image_widget_t im; xitk_image_widget_t im;
image = xitk_image_create_image_from_string (setup->gui->xitk, tabsfontname, image = xitk_image_create_image_from_string (setup->gui->xitk, tabsfontname,
FRAME_WIDTH, ALIGN_CENTER, (char *)title); FRAME_WIDTH, ALIGN_CENTER, (char *)title);
XITK_WIDGET_INIT (&im); im.nw.wl = setup->widget_list;
im.skin_element_name = NULL; im.nw.skin_element_name = NULL;
wt->w[_T_frame] = xitk_noskin_image_create (setup->widget_list, &im, image, x im.nw.userdata = NULL;
, y); wt->w[_T_frame] = xitk_noskin_image_create (&im, image, x, y);
xitk_add_widget (setup->widget_list, frame, XITK_WIDGET_STATE_KEEP); xitk_add_widget (setup->widget_list, frame, XITK_WIDGET_STATE_KEEP);
wt->w[_T_label] = NULL; wt->w[_T_label] = NULL;
wt->w[_T_widget] = NULL; wt->w[_T_widget] = NULL;
wt->changed = 0; wt->changed = 0;
setup->num_wg = 1; setup->num_wg = 1;
} }
/* /*
skipping to change at line 487 skipping to change at line 454
unsigned int known_types; unsigned int known_types;
xine_cfg_entry_t entry; xine_cfg_entry_t entry;
known_types = (1 << XINE_CONFIG_TYPE_RANGE) known_types = (1 << XINE_CONFIG_TYPE_RANGE)
| (1 << XINE_CONFIG_TYPE_STRING) | (1 << XINE_CONFIG_TYPE_STRING)
| (1 << XINE_CONFIG_TYPE_ENUM) | (1 << XINE_CONFIG_TYPE_ENUM)
| (1 << XINE_CONFIG_TYPE_NUM) | (1 << XINE_CONFIG_TYPE_NUM)
| (1 << XINE_CONFIG_TYPE_BOOL); | (1 << XINE_CONFIG_TYPE_BOOL);
xitk_widgets_state (&setup->slider_wg, 1, XITK_WIDGET_STATE_ENABLE | XITK_WIDG ET_STATE_VISIBLE, 0); xitk_widgets_state (&setup->slider_wg, 1, XITK_WIDGET_STATE_ENABLE | XITK_WIDG ET_STATE_VISIBLE, 0);
xitk_widgets_state (&setup->apply, 1, XITK_WIDGET_STATE_ENABLE, 0);
setup->shown_section = s;
section = setup->sections + s; section = setup->sections + s;
memset (&entry, 0, sizeof (entry)); memset (&entry, 0, sizeof (entry));
cfg_err_result = setup->wg ? xine_config_get_first_entry (setup->gui->xine, &e ntry) : 0; cfg_err_result = setup->wg ? xine_config_get_first_entry (setup->gui->xine, &e ntry) : 0;
while (cfg_err_result) { while (cfg_err_result) {
if ((entry.exp_level <= setup->gui->experience_level) if ((entry.exp_level <= setup->gui->experience_level)
&& !strncmp (entry.key, section->name, section->nlen) && !strncmp (entry.key, section->name, section->nlen)
&& entry.description && entry.description
skipping to change at line 516 skipping to change at line 485
wt = realloc (setup->wg, (setup->max_wg + 8) * sizeof (*setup->wg)); wt = realloc (setup->wg, (setup->max_wg + 8) * sizeof (*setup->wg));
if (!wt) if (!wt)
break; break;
setup->max_wg += 8; setup->max_wg += 8;
setup->wg = wt; setup->wg = wt;
wt += setup->num_wg; wt += setup->num_wg;
} }
setup->num_wg += 1; setup->num_wg += 1;
wt->cfg = entry; wt->cfg = entry;
wt->cfg.unknown_value = (char *)setup;
wt->changed = 0; wt->changed = 0;
{ {
xitk_image_widget_t im; xitk_image_widget_t im;
xitk_image_t *image = xitk_image_new (setup->gui->xitk, NULL, 0, FRAME_WIDTH + 1, FRAME_HEIGHT + 1); xitk_image_t *image = xitk_image_new (setup->gui->xitk, NULL, 0, FRAME_WIDTH + 1, FRAME_HEIGHT + 1);
if (image) { if (image) {
xitk_image_fill_rectangle (image, 0, 0, FRAME_WIDTH + 1, FRAME_HEIGHT + 1, xitk_image_fill_rectangle (image, 0, 0, FRAME_WIDTH + 1, FRAME_HEIGHT + 1,
xitk_get_cfg_num (setup->gui->xitk, XITK_BG_COLOR)); xitk_get_cfg_num (setup->gui->xitk, XITK_BG_COLOR));
xitk_image_draw_inner_frame (image, (char *)entry.description, xitk_image_draw_inner_frame (image, (char *)entry.description,
boldfontname, 0, 0, FRAME_WIDTH, FRAME_HEIGHT); boldfontname, 0, 0, FRAME_WIDTH, FRAME_HEIGHT);
} }
XITK_WIDGET_INIT (&im); im.nw.wl = setup->widget_list;
im.skin_element_name = NULL; im.nw.userdata = NULL;
wt->w[_T_frame] = xitk_noskin_image_create (setup->widget_list, &im, ima im.nw.skin_element_name = NULL;
ge, x, y); wt->w[_T_frame] = xitk_noskin_image_create (&im, image, x, y);
xitk_add_widget (setup->widget_list, wt->w[_T_frame], 0); xitk_add_widget (setup->widget_list, wt->w[_T_frame], 0);
} }
x += 10; x += 10;
y += FRAME_HEIGHT >> 1; y += FRAME_HEIGHT >> 1;
XITK_WIDGET_INIT (&lb); lb.nw.wl = setup->widget_list;
lb.skin_element_name = NULL; lb.nw.skin_element_name = NULL;
lb.label = NULL; lb.nw.userdata = NULL;
lb.callback = NULL; lb.label = NULL;
lb.userdata = NULL; lb.callback = NULL;
switch (entry.type) { switch (entry.type) {
case XINE_CONFIG_TYPE_RANGE: /* slider */ case XINE_CONFIG_TYPE_RANGE: /* slider */
{ {
xitk_intbox_widget_t ib; xitk_intbox_widget_t ib;
int ib_width; int ib_width;
XITK_WIDGET_INIT (&ib); ib.nw.wl = setup->widget_list;
ib.nw.skin_element_name = NULL;
ib.nw.userdata = wt;
/* HACK for stuff like the xv color key. */ /* HACK for stuff like the xv color key. */
if ((entry.range_min == 0) && (entry.range_max > 0x7fffffff / 260)) { if ((entry.range_min == 0) && (entry.range_max > 0x7fffffff / 260)) {
ib.fmt = INTBOX_FMT_HASH; ib.fmt = INTBOX_FMT_HASH;
ib_width = 100; ib_width = 100;
} else { } else {
ib.fmt = INTBOX_FMT_DECIMAL; ib.fmt = INTBOX_FMT_DECIMAL;
ib_width = 260; ib_width = 260;
} }
ib.skin_element_name = NULL; ib.min = entry.range_min;
ib.min = entry.range_min; ib.max = entry.range_max;
ib.max = entry.range_max; ib.value = entry.num_value;
ib.value = entry.num_value; ib.step = 1;
ib.step = 1; ib.callback = numtype_update;
ib.callback = numtype_update; wt->w[_T_widget] = xitk_noskin_intbox_create (&ib, x, y, ib_width, 2
ib.userdata = wt; 0);
wt->w[_T_widget] = xitk_noskin_intbox_create (setup->widget_list, &i
b, x, y, ib_width, 20);
xitk_add_widget (setup->widget_list, wt->w[_T_widget], 0); xitk_add_widget (setup->widget_list, wt->w[_T_widget], 0);
}; };
break; break;
case XINE_CONFIG_TYPE_STRING: case XINE_CONFIG_TYPE_STRING:
{ {
xitk_inputtext_widget_t inp; xitk_inputtext_widget_t inp;
XITK_WIDGET_INIT (&inp); inp.nw.wl = setup->widget_list;
inp.skin_element_name = NULL; inp.nw.skin_element_name = NULL;
inp.text = entry.str_value; inp.nw.userdata = wt;
inp.max_length = 256; inp.text = entry.str_value;
inp.callback = stringtype_update; inp.max_length = 256;
inp.userdata = wt; inp.callback = stringtype_update;
wt->w[_T_widget] = xitk_noskin_inputtext_create (setup->widget_list, wt->w[_T_widget] = xitk_noskin_inputtext_create (&inp,
&inp,
x, y, 260, 20, XITK_NOSKIN_TEXT_NORM, XITK_NOSKIN_TEXT_NORM, fontn ame); x, y, 260, 20, XITK_NOSKIN_TEXT_NORM, XITK_NOSKIN_TEXT_NORM, fontn ame);
xitk_add_widget (setup->widget_list, wt->w[_T_widget], 0); xitk_add_widget (setup->widget_list, wt->w[_T_widget], 0);
} }
break; break;
case XINE_CONFIG_TYPE_ENUM: case XINE_CONFIG_TYPE_ENUM:
{ {
xitk_combo_widget_t cmb; xitk_combo_widget_t cmb;
XITK_WIDGET_INIT (&cmb); cmb.nw.wl = setup->widget_list;
cmb.skin_element_name = NULL; cmb.nw.skin_element_name = NULL;
cmb.layer_above = is_layer_above (setup->gui); cmb.nw.userdata = wt;
cmb.entries = (const char **)entry.enum_values; cmb.layer_above = is_layer_above (setup->gui);
cmb.parent_wkey = &setup->kreg; cmb.entries = (const char **)entry.enum_values;
cmb.callback = numtype_update; cmb.parent_wkey = &setup->kreg;
cmb.userdata = wt; cmb.callback = numtype_update;
wt->w[_T_widget] = xitk_noskin_combo_create (setup->widget_list, &cm wt->w[_T_widget] = xitk_noskin_combo_create (&cmb, x, y, 260);
b, x, y, 260);
xitk_add_widget (setup->widget_list, wt->w[_T_widget], 0); xitk_add_widget (setup->widget_list, wt->w[_T_widget], 0);
xitk_combo_set_select (wt->w[_T_widget], entry.num_value); xitk_combo_set_select (wt->w[_T_widget], entry.num_value);
} }
break; break;
case XINE_CONFIG_TYPE_NUM: case XINE_CONFIG_TYPE_NUM:
{ {
xitk_intbox_widget_t ib; xitk_intbox_widget_t ib;
XITK_WIDGET_INIT (&ib); ib.nw.wl = setup->widget_list;
ib.skin_element_name = NULL; ib.nw.skin_element_name = NULL;
ib.fmt = INTBOX_FMT_DECIMAL; ib.nw.userdata = wt;
ib.min = 0; ib.fmt = INTBOX_FMT_DECIMAL;
ib.max = 0; ib.min = 0;
ib.value = entry.num_value; ib.max = 0;
ib.step = 1; ib.value = entry.num_value;
ib.callback = numtype_update; ib.step = 1;
ib.userdata = wt; ib.callback = numtype_update;
wt->w[_T_widget] = xitk_noskin_intbox_create (setup->widget_list, &i wt->w[_T_widget] = xitk_noskin_intbox_create (&ib, x, y, 60, 20);
b, x, y, 60, 20);
xitk_add_widget (setup->widget_list, wt->w[_T_widget], 0); xitk_add_widget (setup->widget_list, wt->w[_T_widget], 0);
} }
break; break;
case XINE_CONFIG_TYPE_BOOL: case XINE_CONFIG_TYPE_BOOL:
{ {
xitk_button_widget_t b; xitk_button_widget_t b;
XITK_WIDGET_INIT (&b); b.nw.wl = setup->widget_list;
b.skin_element_name = "XITK_NOSKIN_CHECK"; b.nw.skin_element_name = "XITK_NOSKIN_CHECK";
b.callback = NULL; b.nw.userdata = wt;
b.state_callback = numtype_update; b.callback = NULL;
b.userdata = wt; b.state_callback = numtype_update;
wt->w[_T_widget] = xitk_noskin_button_create (setup->widget_list, &b wt->w[_T_widget] = xitk_noskin_button_create (&b, x, y, 13, 13);
, x, y, 13, 13);
xitk_add_widget (setup->widget_list, wt->w[_T_widget], 0); xitk_add_widget (setup->widget_list, wt->w[_T_widget], 0);
xitk_button_set_state (wt->w[_T_widget], entry.num_value); xitk_button_set_state (wt->w[_T_widget], entry.num_value);
} }
break; break;
} }
{ {
int lx; int lx;
char b[200], *p = b, *e = b + sizeof (b); char b[200], *p = b, *e = b + sizeof (b);
if (!entry.callback_data && !entry.callback) { if (!entry.callback_data && !entry.callback) {
p += strlcpy (p, labelkey, e - p); p += strlcpy (p, labelkey, e - p);
if (p < e) if (p < e)
strlcpy (p, " (*)", e - p); strlcpy (p, " (*)", e - p);
lb.label = b; lb.label = b;
} else { } else {
lb.label = labelkey; lb.label = labelkey;
} }
lx = x + 20 + xitk_get_widget_width (wt->w[_T_widget]); lx = x + 20 + xitk_get_widget_width (wt->w[_T_widget]);
wt->w[_T_label] = xitk_noskin_label_create (setup->widget_list, &lb, lx, y, FRAME_WIDTH - lx - 15, setup->fh, fontname); wt->w[_T_label] = xitk_noskin_label_create (&lb, lx, y, FRAME_WIDTH - lx - 15, setup->fh, fontname);
xitk_widget_set_focus_redirect (wt->w[_T_label], wt->w[_T_widget]); xitk_widget_set_focus_redirect (wt->w[_T_label], wt->w[_T_widget]);
xitk_add_widget (setup->widget_list, wt->w[_T_label], 0); xitk_add_widget (setup->widget_list, wt->w[_T_label], 0);
} }
{ {
const char *help = entry.help ? entry.help : (const char *)_("No help av ailable"); const char *help = entry.help ? entry.help : (const char *)_("No help av ailable");
xitk_set_widget_tips (wt->w[_T_label], help); xitk_set_widget_tips (wt->w[_T_label], help);
xitk_set_widget_tips (wt->w[_T_widget], help); xitk_set_widget_tips (wt->w[_T_widget], help);
} }
} }
skipping to change at line 693 skipping to change at line 664
si.v.max = setup->num_wg; si.v.max = setup->num_wg;
xitk_slider_hv_sync (setup->slider_wg, &si, XITK_SLIDER_SYNC_SET); xitk_slider_hv_sync (setup->slider_wg, &si, XITK_SLIDER_SYNC_SET);
} }
} }
/* /*
* *
*/ */
static void setup_change_section(xitk_widget_t *wx, void *data, int section) { static void setup_change_section(xitk_widget_t *wx, void *data, int section) {
xui_setup_t *setup = data; xui_setup_t *setup = data;
int max;
(void)wx; (void)wx;
setup_set_cursor (setup, WAIT_CURS); setup_set_cursor (setup, WAIT_CURS);
setup->sections[setup->shown_section].first_shown = setup->first_displayed;
/* remove old widgets */ /* remove old widgets */
{ {
_widget_triplet_t *wt; _widget_triplet_t *wt;
for (wt = setup->wg + setup->num_wg - 1; wt >= setup->wg; wt--) for (wt = setup->wg + setup->num_wg - 1; wt >= setup->wg; wt--)
xitk_widgets_delete (wt->w, _T_LAST); xitk_widgets_delete (wt->w, _T_LAST);
} }
setup->num_wg = 0; setup->num_wg = 0;
setup->first_displayed = 0;
setup_section_widgets (setup, section); setup_section_widgets (setup, section);
max = setup->num_wg - MAX_DISPLAY_WIDGETS;
if (max < 0)
max = 0;
setup_clear_tab (setup); setup_clear_tab (setup);
setup_paint_widgets (setup, 0); setup_paint_widgets (setup, setup->sections[section].first_shown);
xitk_slider_set_pos (setup->slider_wg, max - setup->first_displayed);
} }
/* /*
* collect config categories, setup tab widget * collect config categories, setup tab widget
*/ */
#ifdef XINE_SARRAY_MODE_UNIQUE #ifdef XINE_SARRAY_MODE_UNIQUE
static int _section_cmp (void *a, void *b) { static int _section_cmp (void *a, void *b) {
_setup_section_t *d = (_setup_section_t *)a; _setup_section_t *d = (_setup_section_t *)a;
_setup_section_t *e = (_setup_section_t *)b; _setup_section_t *e = (_setup_section_t *)b;
const uint8_t *n1 = (const uint8_t *)d->name; const uint8_t *n1 = (const uint8_t *)d->name;
skipping to change at line 736 skipping to change at line 713
if (*n1 > *n2) if (*n1 > *n2)
return 1; return 1;
n1++; n1++;
n2++; n2++;
} }
return 0; return 0;
} }
#endif #endif
static void setup_sections (xui_setup_t *setup) { static void setup_sections (xui_setup_t *setup) {
xitk_image_t *bg;
xine_cfg_entry_t entry; xine_cfg_entry_t entry;
int cfg_err_result; int cfg_err_result;
xitk_tabs_widget_t tab; xitk_tabs_widget_t tab;
char *q, *e; char *q, *e;
#ifdef XINE_SARRAY_MODE_UNIQUE #ifdef XINE_SARRAY_MODE_UNIQUE
xine_sarray_t *a = xine_sarray_new (20, _section_cmp); xine_sarray_t *a = xine_sarray_new (20, _section_cmp);
xine_sarray_set_mode (a, XINE_SARRAY_MODE_UNIQUE); xine_sarray_set_mode (a, XINE_SARRAY_MODE_UNIQUE);
#endif #endif
skipping to change at line 805 skipping to change at line 781
} }
#ifdef XINE_SARRAY_MODE_UNIQUE #ifdef XINE_SARRAY_MODE_UNIQUE
xine_sarray_delete (a); xine_sarray_delete (a);
#endif #endif
{ {
int max = 1, i; int max = 1, i;
for (i = 0; i < setup->num_sections; i++) { for (i = 0; i < setup->num_sections; i++) {
setup->sections[i].first_shown = 0;
if (max < setup->sections[i].num_entries) if (max < setup->sections[i].num_entries)
max = setup->sections[i].num_entries; max = setup->sections[i].num_entries;
} }
setup->max_wg = (max + 7) & ~7; setup->max_wg = (max + 7) & ~7;
free (setup->wg); free (setup->wg);
setup->wg = malloc (setup->max_wg * sizeof (*setup->wg)); setup->wg = malloc (setup->max_wg * sizeof (*setup->wg));
} }
XITK_WIDGET_INIT (&tab); tab.nw.wl = setup->widget_list;
tab.nw.skin_element_name = NULL;
tab.skin_element_name = NULL; tab.nw.userdata = setup;
tab.num_entries = setup->num_sections; tab.num_entries = setup->num_sections;
tab.entries = (const char * const *)setup->section_names; tab.entries = (const char * const *)setup->section_names;
tab.callback = setup_change_section; tab.callback = setup_change_section;
tab.userdata = setup; setup->tabs = xitk_noskin_tabs_create (&tab, 15, 24, WINDOW_WIDTH - 30, tabsfo
setup->tabs = xitk_noskin_tabs_create (setup->widget_list, &tab, 15, 24, WINDO ntname);
W_WIDTH - 30, tabsfontname);
xitk_add_widget (setup->widget_list, setup->tabs, XITK_WIDGET_STATE_ENABLE | X ITK_WIDGET_STATE_VISIBLE); xitk_add_widget (setup->widget_list, setup->tabs, XITK_WIDGET_STATE_ENABLE | X ITK_WIDGET_STATE_VISIBLE);
setup->th = xitk_get_widget_height (setup->tabs) - 1; setup->th = xitk_get_widget_height (setup->tabs) - 1;
bg = xitk_window_get_background_image (setup->xwin);
xitk_image_draw_rectangular_box (bg, 15, (24 + setup->th),
WINDOW_WIDTH - 30, MAX_DISPLAY_WIDGETS * (FRAME_HEIGHT + 3) - 3 + 3 + 30, DR
AW_OUTTER);
xitk_window_set_background_image (setup->xwin, bg);
setup->num_wg = 0; setup->num_wg = 0;
setup->first_displayed = 0; setup->first_displayed = 0;
} }
/* /*
* *
*/ */
void setup_end (xui_setup_t *setup) { void setup_end (xui_setup_t *setup) {
setup_exit (NULL, setup, 0); setup_exit (NULL, setup, 0);
} }
skipping to change at line 887 skipping to change at line 858
set_window_states_start (setup->gui, setup->xwin); set_window_states_start (setup->gui, setup->xwin);
setup->widget_list = xitk_window_widget_list(setup->xwin); setup->widget_list = xitk_window_widget_list(setup->xwin);
fs = xitk_font_load_font (setup->gui->xitk, fontname); fs = xitk_font_load_font (setup->gui->xitk, fontname);
setup->fh = xitk_font_get_string_height (fs, " "); setup->fh = xitk_font_get_string_height (fs, " ");
} }
setup_sections (setup); setup_sections (setup);
setup->main.x = 15;
setup->main.y = 24 + setup->th;
setup->main.w = WINDOW_WIDTH - 30;
setup->main.h = MAX_DISPLAY_WIDGETS * (FRAME_HEIGHT + 3) - 3 + 3 + 30;
setup->bg = xitk_window_get_background_image (setup->xwin);
xitk_image_draw_rectangular_box (setup->bg,
setup->main.x, setup->main.y, setup->main.w, setup->main.h, DRAW_OUTTER);
xitk_window_set_background_image (setup->xwin, setup->bg);
{ {
xitk_slider_widget_t sl; xitk_slider_widget_t sl;
XITK_WIDGET_INIT (&sl); sl.nw.wl = setup->widget_list;
sl.min = 0; sl.nw.skin_element_name = NULL;
sl.max = 1; sl.nw.userdata = setup;
sl.step = 1; sl.min = 0;
sl.skin_element_name = NULL; sl.max = 1;
sl.callback = NULL; sl.step = 1;
sl.userdata = NULL; sl.callback = NULL;
sl.motion_callback = setup_nextprev_wg; sl.motion_callback = setup_nextprev_wg;
sl.motion_userdata = setup; setup->slider_wg = xitk_noskin_slider_create (&sl,
setup->slider_wg = xitk_noskin_slider_create (setup->widget_list, &sl,
(WINDOW_WIDTH - 15 - 16 - 4 - 1), (24 + setup->th + 15), (WINDOW_WIDTH - 15 - 16 - 4 - 1), (24 + setup->th + 15),
16, (MAX_DISPLAY_WIDGETS * (FRAME_HEIGHT + 3) - 3 + 3), XITK_HVSLIDER); 16, (MAX_DISPLAY_WIDGETS * (FRAME_HEIGHT + 3) - 3 + 3), XITK_HVSLIDER);
} }
xitk_add_widget (setup->widget_list, setup->slider_wg, XITK_WIDGET_STATE_KEEP) ; xitk_add_widget (setup->widget_list, setup->slider_wg, XITK_WIDGET_STATE_KEEP) ;
setup_section_widgets (setup, 0); setup_section_widgets (setup, 0);
setup_paint_widgets (setup, 0); setup_paint_widgets (setup, 0);
{ {
xitk_label_widget_t lbl; xitk_label_widget_t lbl;
char *label = _("(*) you need to restart xine for this setting to take effe ct"); char *label = _("(*) you need to restart xine for this setting to take effe ct");
int len; int len;
len = xitk_font_get_string_length (fs, label); len = xitk_font_get_string_length (fs, label);
XITK_WIDGET_INIT(&lbl); lbl.nw.wl = setup->widget_list;
lbl.skin_element_name = NULL; lbl.nw.skin_element_name = NULL;
lbl.label = label; lbl.nw.userdata = setup;
lbl.callback = NULL; lbl.label = label;
lbl.userdata = setup; lbl.callback = NULL;
w = xitk_noskin_label_create (setup->widget_list, &lbl, w = xitk_noskin_label_create (&lbl,
(WINDOW_WIDTH - len) >> 1, (24 + setup->th + MAX_DISPLAY_WIDGETS * (FRAME_ HEIGHT + 3) - 3 + 3 + 30), len + 3, 18, fontname); (WINDOW_WIDTH - len) >> 1, (24 + setup->th + MAX_DISPLAY_WIDGETS * (FRAME_ HEIGHT + 3) - 3 + 3 + 30), len + 3, 18, fontname);
} }
xitk_add_widget (setup->widget_list, w, XITK_WIDGET_STATE_ENABLE | XITK_WIDGET _STATE_VISIBLE); xitk_add_widget (setup->widget_list, w, XITK_WIDGET_STATE_ENABLE | XITK_WIDGET _STATE_VISIBLE);
xitk_font_unload_font(fs); xitk_font_unload_font(fs);
{ {
xitk_labelbutton_widget_t lb; xitk_labelbutton_widget_t lb;
XITK_WIDGET_INIT (&lb); lb.nw.wl = setup->widget_list;
lb.button_type = CLICK_BUTTON; lb.nw.skin_element_name = NULL;
lb.align = ALIGN_CENTER; lb.nw.userdata = setup;
lb.state_callback = NULL; lb.button_type = CLICK_BUTTON;
lb.skin_element_name = NULL; lb.align = ALIGN_CENTER;
lb.userdata = setup; lb.state_callback = NULL;
lb.label = _("OK"); lb.label = _("OK");
lb.callback = setup_ok; lb.callback = setup_ok;
setup->ok = xitk_noskin_labelbutton_create (setup->widget_list, &lb, setup->ok = xitk_noskin_labelbutton_create (&lb,
15, WINDOW_HEIGHT - (23 + 15), 100, 23, 15, WINDOW_HEIGHT - (23 + 15), 100, 23,
XITK_NOSKIN_TEXT_NORM, XITK_NOSKIN_TEXT_NORM, XITK_NOSKIN_TEXT_INV, tabsfo ntname); XITK_NOSKIN_TEXT_NORM, XITK_NOSKIN_TEXT_NORM, XITK_NOSKIN_TEXT_INV, tabsfo ntname);
xitk_add_widget (setup->widget_list, setup->ok, XITK_WIDGET_STATE_ENABLE | X ITK_WIDGET_STATE_VISIBLE); xitk_add_widget (setup->widget_list, setup->ok, XITK_WIDGET_STATE_ENABLE | X ITK_WIDGET_STATE_VISIBLE);
lb.label = _("Apply"); lb.label = _("Apply");
lb.callback = setup_apply; lb.callback = setup_apply;
w = xitk_noskin_labelbutton_create (setup->widget_list, &lb, setup->apply = w = xitk_noskin_labelbutton_create (&lb,
(WINDOW_WIDTH - 100) >> 1, WINDOW_HEIGHT - (23 + 15), 100, 23, (WINDOW_WIDTH - 100) >> 1, WINDOW_HEIGHT - (23 + 15), 100, 23,
XITK_NOSKIN_TEXT_NORM, XITK_NOSKIN_TEXT_NORM, XITK_NOSKIN_TEXT_INV, tabsfo ntname); XITK_NOSKIN_TEXT_NORM, XITK_NOSKIN_TEXT_NORM, XITK_NOSKIN_TEXT_INV, tabsfo ntname);
xitk_add_widget (setup->widget_list, w, XITK_WIDGET_STATE_ENABLE | XITK_WIDG ET_STATE_VISIBLE); xitk_add_widget (setup->widget_list, w, /* XITK_WIDGET_STATE_ENABLE | */ XIT K_WIDGET_STATE_VISIBLE);
lb.label = _("Close"); lb.label = _("Close");
lb.callback = setup_exit; lb.callback = setup_exit;
w = xitk_noskin_labelbutton_create (setup->widget_list, &lb, w = xitk_noskin_labelbutton_create (&lb,
WINDOW_WIDTH - (100 + 15), WINDOW_HEIGHT - (23 + 15), 100, 23, WINDOW_WIDTH - (100 + 15), WINDOW_HEIGHT - (23 + 15), 100, 23,
XITK_NOSKIN_TEXT_NORM, XITK_NOSKIN_TEXT_NORM, XITK_NOSKIN_TEXT_INV, tabsfo ntname); XITK_NOSKIN_TEXT_NORM, XITK_NOSKIN_TEXT_NORM, XITK_NOSKIN_TEXT_INV, tabsfo ntname);
xitk_add_widget (setup->widget_list, w, XITK_WIDGET_STATE_ENABLE | XITK_WIDG ET_STATE_VISIBLE); xitk_add_widget (setup->widget_list, w, XITK_WIDGET_STATE_ENABLE | XITK_WIDG ET_STATE_VISIBLE);
} }
setup->kreg = xitk_be_register_event_handler ("setup", setup->xwin, setup_even t, setup, NULL, NULL); setup->kreg = xitk_be_register_event_handler ("setup", setup->xwin, setup_even t, setup, NULL, NULL);
setup->visible = 1; setup->visible = 1;
setup_raise_window (setup); setup_raise_window (setup);
xitk_window_set_input_focus (setup->xwin); xitk_window_set_input_focus (setup->xwin);
 End of changes. 45 change blocks. 
192 lines changed or deleted 163 lines changed or added

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