Lines Matching +full:y +full:- +full:size

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
39 #define NULLWIN -1
71 static int crashes(long x, long y, long a, long b) in crashes() argument
73 return ((x <= a && a <= y) || (x <= b && b <= y)); in crashes()
76 static int fits(long x, long y, long a, long b) in fits() argument
78 return ((x <= a) && (b <= y)); in fits()
84 unsigned long x, y, size, old_start, old_end; in handlesliderctl() local
87 step = sliderctl->step; in handlesliderctl()
88 old_start = *(sliderctl->start); in handlesliderctl()
90 old_end = *(sliderctl->end); in handlesliderctl()
92 size = old_end - old_start + 1; in handlesliderctl()
94 switch (sliderctl->op) { in handlesliderctl()
99 for (i = 0; i < sliderctl->nspaces; i++) { in handlesliderctl()
100 x = (sliderctl->spaces)[i][0]; in handlesliderctl()
101 y = (sliderctl->spaces)[i][1]; in handlesliderctl()
103 if (crashes(x, y, new_start, new_end)) { in handlesliderctl()
104 new_start = y + 1; in handlesliderctl()
105 new_end = new_start + size - 1; in handlesliderctl()
111 new_start = old_start - step; in handlesliderctl()
112 new_end = old_end - step; in handlesliderctl()
114 for (i = sliderctl->nspaces - 1; i >= 0; i--) { in handlesliderctl()
115 x = (sliderctl->spaces)[i][0]; in handlesliderctl()
116 y = (sliderctl->spaces)[i][1]; in handlesliderctl()
118 if (crashes(x, y, new_start, new_end)) { in handlesliderctl()
119 new_end = x - 1; in handlesliderctl()
120 new_start = new_end - size + 1; in handlesliderctl()
129 new_start = old_start - step; in handlesliderctl()
130 for (i = 0; i < sliderctl->nspaces; i++) { in handlesliderctl()
131 x = (sliderctl->spaces)[i][0]; in handlesliderctl()
132 y = (sliderctl->spaces)[i][1]; in handlesliderctl()
134 if (crashes(x, y, new_start, new_end)) { in handlesliderctl()
142 for (i = 0; i < sliderctl->nspaces; i++) { in handlesliderctl()
143 x = (sliderctl->spaces)[i][0]; in handlesliderctl()
144 y = (sliderctl->spaces)[i][1]; in handlesliderctl()
146 if (crashes(x, y, new_start, new_end)) { in handlesliderctl()
153 new_end = old_end - step; in handlesliderctl()
157 new_end = size - 1; in handlesliderctl()
158 for (i = 0; i < sliderctl->nspaces; i++) { in handlesliderctl()
159 x = (sliderctl->spaces)[i][0]; in handlesliderctl()
160 y = (sliderctl->spaces)[i][1]; in handlesliderctl()
162 if (crashes(x, y, new_start, new_end)) { in handlesliderctl()
163 new_start = y + 1; in handlesliderctl()
164 new_end = new_start + size - 1; in handlesliderctl()
170 new_end = (sliderctl->length) - 1; in handlesliderctl()
171 new_start = new_end - size + 1; in handlesliderctl()
172 for (i = sliderctl->nspaces - 1; i >= 0; i--) { in handlesliderctl()
173 x = (sliderctl->spaces)[i][0]; in handlesliderctl()
174 y = (sliderctl->spaces)[i][1]; in handlesliderctl()
176 if (crashes(x, y, new_start, new_end)) { in handlesliderctl()
177 new_end = x - 1; in handlesliderctl()
178 new_start = new_end - size + 1; in handlesliderctl()
184 if (size < 10) { in handlesliderctl()
187 tmpstep = ((sliderctl->length) * 10) / 100; in handlesliderctl()
189 new_start = old_start - tmpstep; in handlesliderctl()
190 new_end = old_end - tmpstep; in handlesliderctl()
192 for (i = sliderctl->nspaces - 1; i >= 0; i--) { in handlesliderctl()
193 x = (sliderctl->spaces)[i][0]; in handlesliderctl()
194 y = (sliderctl->spaces)[i][1]; in handlesliderctl()
196 if (crashes(x, y, new_start, new_end)) { in handlesliderctl()
197 new_end = x - 1; in handlesliderctl()
198 new_start = new_end - size + 1; in handlesliderctl()
204 if (size < 10) { in handlesliderctl()
207 tmpstep = ((sliderctl->length) * 10) / 100; in handlesliderctl()
212 for (i = 0; i < sliderctl->nspaces; i++) { in handlesliderctl()
213 x = (sliderctl->spaces)[i][0]; in handlesliderctl()
214 y = (sliderctl->spaces)[i][1]; in handlesliderctl()
216 if (crashes(x, y, new_start, new_end)) { in handlesliderctl()
217 new_start = y + 1; in handlesliderctl()
218 new_end = new_start + size - 1; in handlesliderctl()
228 --step; in handlesliderctl()
233 if (fits(0, (sliderctl->length) - 1, new_start, new_end) != 1) { in handlesliderctl()
243 sliderctl->step = step; in handlesliderctl()
245 *(sliderctl->start) = new_start; in handlesliderctl()
246 *(sliderctl->end) = new_end; in handlesliderctl()
260 mvwhline(win, 0, w / 2 - l / 2, UARROW(conf), l); in drawsquare()
261 mvwhline(win, h - 1, w / 2 - l / 2, DARROW(conf), l); in drawsquare()
281 int i, y, x, l, height, width; in print_slider() local
292 mvwvline(win, 1, width - 1, RARROW(conf), 1); in print_slider()
296 y = height / 2; in print_slider()
297 width -= 1; in print_slider()
305 l = ((e - s) * width) / length; in print_slider()
307 if ((e - s) == 0) { in print_slider()
313 mvwhline(win, y, x + 1, ch, l); in print_slider()
318 l = (((*end) - (*start)) * width) / length; in print_slider()
319 if ((*end - *start) == 0) { in print_slider()
324 mvwhline(win, y, s + 1, ch, l); in print_slider()
348 yslider = d->y + d->h - 15; in slider_draw()
349 xslider = d->x + d->w / 2 - 17; in slider_draw()
351 mvwaddstr(d->widget, d->h - 16, d->w / 2 - 17, buf); in slider_draw()
353 update_box(d->conf, start_win, yslider, xslider, 3, 17, RAISED); in slider_draw()
355 mvwaddstr(d->widget, d->h - 16, d->w / 2, buf); in slider_draw()
357 update_box(d->conf, end_win, yslider, xslider + 17, 3, 17, RAISED); in slider_draw()
358 asprintf(&buf, "Size (%s)", unit); in slider_draw()
359 mvwaddstr(d->widget, d->h - 12, d->w / 2 - 17, buf); in slider_draw()
361 update_box(d->conf, size_win, yslider + 4, xslider, 3, 17, RAISED); in slider_draw()
363 mvwaddstr(d->widget, d->h - 12, d->w / 2, buf); in slider_draw()
365 update_box(d->conf, step_win, yslider + 4, xslider + 17, 3, 17, RAISED); in slider_draw()
367 update_box(d->conf, slider_win, yslider + 7, xslider, 3, 34, RAISED); in slider_draw()
368 wnoutrefresh(d->widget); in slider_draw()
384 unsigned long size; in bsddialog_slider() local
415 RETURN_ERROR("Cannot build WINDOW for size"); in bsddialog_slider()
429 size = *(ctl.end) - *(ctl.start) + 1; in bsddialog_slider()
432 drawsquare(conf, size_win, RAISED, 0, "%15lu", size); in bsddialog_slider()
443 if (focusbuttons || conf->button.always_active) { in bsddialog_slider()
449 if (conf->key.enable_esc) { in bsddialog_slider()
461 conf->button.always_active ? 0 : -1; in bsddialog_slider()
481 conf->button.always_active ? 0 : -1; in bsddialog_slider()
494 dialog.bs.curr--; in bsddialog_slider()
499 conf->button.always_active ? 0 : -1; in bsddialog_slider()
518 conf->button.always_active ? 0 : -1; in bsddialog_slider()
561 case '-': in bsddialog_slider()
638 if (conf->key.f1_file == NULL && in bsddialog_slider()
639 conf->key.f1_message == NULL) in bsddialog_slider()