Lines Matching +full:slider +full:- +full:0

4  *  rangebox.c -- implements the rangebox dialog
6 * Copyright 2012-2019,2020 Thomas E. Dickey
33 /* window in which the value and slider are drawn */
41 /* position and width of the slider field */
47 /* value to add to make slider move by one cell */
62 int col = data->value_col; in digit_of()
65 while (++col < data->value_len) { in digit_of()
77 char *next = 0; in set_digit()
79 sprintf(buffer, "%*d", data->value_len, data->current); in set_digit()
80 buffer[data->value_col] = (char) chr; in set_digit()
82 if (next == 0 || *next == '\0') { in set_digit()
83 if ((check <= (long) data->max_value) && in set_digit()
84 (check >= (long) data->min_value)) { in set_digit()
86 data->current = (int) check; in set_digit()
100 if (value != data->current) { in draw_value()
101 WINDOW *win = data->window; in draw_value()
104 int ranges = (data->max_value + 1 - data->min_value); in draw_value()
105 int offset = (value - data->min_value); in draw_value()
110 if (ranges > data->slide_len) { in draw_value()
111 scaled = (offset + data->slide_inc) / data->slide_inc; in draw_value()
112 } else if (ranges < data->slide_len) { in draw_value()
113 scaled = (offset + 1) * data->slide_inc; in draw_value()
119 wmove(win, data->slide_y, data->slide_x); in draw_value()
120 for (n = 0; n < data->slide_len; ++n) { in draw_value()
123 wmove(win, data->slide_y, data->value_x); in draw_value()
124 wprintw(win, "%*d", data->value_len, value); in draw_value()
125 if ((gauge_attr & A_REVERSE) != 0) { in draw_value()
130 wmove(win, data->slide_y, data->slide_x); in draw_value()
131 for (n = 0; n < scaled; ++n) { in draw_value()
141 data->current = value; in draw_value()
147 data->slide_len, in draw_value()
148 data->slide_inc)); in draw_value()
155 * Allow the user to select from a range of values, e.g., using a slider.
166 /* *INDENT-OFF* */ in dialog_rangebox()
184 DLG_KEYS_DATA( DLGK_ITEM_PREV, '-' ), in dialog_rangebox()
192 /* *INDENT-ON* */ in dialog_rangebox()
250 usable = (width - 2 - 4 * MARGIN); in dialog_rangebox()
251 ranges = max_value - min_value + 1; in dialog_rangebox()
259 data.value_x = (usable - data.value_len) / 2 + MARGIN; in dialog_rangebox()
260 data.value_col = data.value_len - 1; in dialog_rangebox()
263 * The slider is scaled, to try to use the width of the dialog. in dialog_rangebox()
266 data.slide_inc = (ranges + usable - 1) / usable; in dialog_rangebox()
275 data.slide_x = (usable - data.slide_len) / 2 + MARGIN + 2; in dialog_rangebox()
276 data.slide_y = height - 5; in dialog_rangebox()
278 data.current = cur_value - 1; in dialog_rangebox()
283 dlg_draw_box2(dialog, 0, 0, height, width, dialog_attr, border_attr, border2_attr); in dialog_rangebox()
285 dlg_mouse_mkregion(data.slide_y - 1, data.slide_x - 1, 3, usable + 2, 'i'); in dialog_rangebox()
287 height - 6, data.slide_x - MARGIN, in dialog_rangebox()
305 button = (state < 0) ? 0 : state; in dialog_rangebox()
306 dlg_draw_buttons(dialog, height - 2, 0, buttons, button, FALSE, width); in dialog_rangebox()
307 if (state < 0) { in dialog_rangebox()
318 if ((key2 = dlg_char_to_button(key, buttons)) >= 0) { in dialog_rangebox()
321 /* handle function-keys */ in dialog_rangebox()
332 if (state < 0 && state > -data.value_len) { in dialog_rangebox()
333 --state; in dialog_rangebox()
335 state = dlg_prev_ok_buttonindex(state, -data.value_len); in dialog_rangebox()
339 if (state < 0) { in dialog_rangebox()
342 state = dlg_next_ok_buttonindex(state, -data.value_len); in dialog_rangebox()
352 if (state < 0) { in dialog_rangebox()
353 cur_value -= digit_of(&data); in dialog_rangebox()
355 cur_value -= 1; in dialog_rangebox()
361 if (state < 0) { in dialog_rangebox()
370 cur_value -= data.slide_inc; in dialog_rangebox()
391 state = -data.value_len; in dialog_rangebox()
395 result = dlg_ok_buttoncode(key - M_EVENT); in dialog_rangebox()
396 if (result < 0) in dialog_rangebox()
401 } else if (isdigit(key) && state < 0) { in dialog_rangebox()
404 data.current--; in dialog_rangebox()