Lines Matching +full:1 +full:d
9 * 1. Redistributions of source code must retain the above copyright
40 #define MINWCAL 36 /* 34 calendar, 1 + 1 margins */
121 *mm = 1;
122 *dd = (*day == 0) ? 1 : *day;
138 if (*mm == 1) {
139 *yy -= 1;
142 *mm -= 1;
152 *yy += 1;
153 *mm = 1;
155 *mm += 1;
160 if (*dd > 1)
161 *dd -= 1;
163 if (*mm == 1) {
164 *yy -= 1;
167 *mm -= 1;
173 *dd += 1;
176 *yy += 1;
177 *mm = 1;
179 *mm += 1;
180 *dd = 1;
184 if (*mm == 1) {
186 *yy -= 1;
188 *mm -= 1;
195 *mm = 1;
196 *yy += 1;
198 *mm += 1;
204 *yy -= 1;
210 *yy += 1;
219 *mm = 1;
220 *dd = 1;
241 mvwhline(win, h-1, w/2 - l/2, DARROW(conf), l);
248 mvwprintw(win, 1, 1, fmt, m[value - 1]);
250 mvwprintw(win, 1, 1, fmt, value);
269 mvwhline(win, h-1, 15, DARROW(conf), 4);
271 mvwvline(win, 3, w-1, RARROW(conf), 3);
275 mvwaddstr(win, 1, 5, "Sun Mon Tue Wed Thu Fri Sat");
278 wd = week_day(yy, mm, 1);
279 for (i = 1; i <= ndays; i++) {
282 mvwprintw(win, y, x, "%2d", i);
285 mvwprintw(win, y, x, "%2d", i);
299 calendar_redraw(struct dialog *d, WINDOW *yy_win, WINDOW *mm_win,
304 if (d->built) {
305 hide_dialog(d);
308 if (dialog_size_position(d, MINHCAL, MINWCAL, NULL) != 0)
310 if (draw_dialog(d) != 0)
312 if (d->built)
314 TEXTPAD(d, MINHCAL + HBUTTONS);
316 ycal = d->y + d->h - 15;
317 xcal = d->x + d->w/2 - 17;
318 mvwaddstr(d->widget, d->h - 16, d->w/2 - 17, "Month");
319 update_box(d->conf, mm_win, ycal, xcal, 3, 17, RAISED);
320 mvwaddstr(d->widget, d->h - 16, d->w/2, "Year");
321 update_box(d->conf, yy_win, ycal, xcal + 17, 3, 17, RAISED);
322 update_box(d->conf, dd_win, ycal + 3, xcal, 9, 34, RAISED);
323 wnoutrefresh(d->widget);
336 struct dialog d;
345 if (prepare_dialog(conf, text, rows, cols, &d) != 0)
347 set_buttons(&d, true, OK_LABEL, CANCEL_LABEL);
348 if ((yy_win = newwin(1, 1, 1, 1)) == NULL)
351 if ((mm_win = newwin(1, 1, 1, 1)) == NULL)
354 if ((dd_win = newwin(1, 1, 1, 1)) == NULL)
357 if (calendar_redraw(&d, yy_win, mm_win, dd_win) != 0)
360 sel = -1;
364 drawsquare(conf, yy_win, RAISED, "%15d", yy, sel == 1);
374 retval = BUTTONVALUE(d.bs);
386 d.bs.curr++;
387 if (d.bs.curr >= (int)d.bs.nbuttons) {
390 d.bs.curr = conf->button.always_active ?
391 0 : -1;
397 sel = -1;
398 d.bs.curr = 0;
401 DRAW_BUTTONS(d);
406 d.bs.curr++;
407 if (d.bs.curr >= (int)d.bs.nbuttons) {
410 d.bs.curr = conf->button.always_active ?
411 0 : -1;
418 DRAW_BUTTONS(d);
423 d.bs.curr--;
424 if (d.bs.curr < 0) {
427 d.bs.curr = conf->button.always_active ?
428 0 : -1;
432 } else if (sel == 1) {
436 sel = -1;
437 d.bs.curr = 0;
439 DRAW_BUTTONS(d);
445 d.bs.curr = conf->button.always_active ? 0 : -1;
446 DRAW_BUTTONS(d);
449 } else if (sel == 1) {
460 } else if (sel == 1) {
471 } else if (sel == 1) {
482 } else if (sel == 1) {
500 case KEY_F(1):
506 if (calendar_redraw(&d, yy_win, mm_win, dd_win) != 0)
511 if (calendar_redraw(&d, yy_win, mm_win, dd_win) != 0)
515 if (shortcut_buttons(input, &d.bs)) {
516 DRAW_BUTTONS(d);
518 retval = BUTTONVALUE(d.bs);
531 end_dialog(&d);
536 static int datebox_redraw(struct dialog *d, struct dateitem *di)
540 if (d->built) {
541 hide_dialog(d);
544 if (dialog_size_position(d, 3 /*windows*/, MINWDATE, NULL) != 0)
546 if (draw_dialog(d) != 0)
548 if (d->built)
550 TEXTPAD(d, 3 /*windows*/ + HBUTTONS);
552 y = d->y + d->h - 6;
553 x = (d->x + d->w / 2) - 11;
554 update_box(d->conf, di[0].win, y, x, 3, di[0].width, LOWERED);
555 mvwaddch(d->widget, d->h - 5, x - d->x + di[0].width, '/');
556 x += di[0].width + 1;
557 update_box(d->conf, di[1].win, y, x , 3, di[1].width, LOWERED);
558 mvwaddch(d->widget, d->h - 5, x - d->x + di[1].width, '/');
559 x += di[1].width + 1;
560 update_box(d->conf, di[2].win, y, x, 3, di[2].width, LOWERED);
561 wnoutrefresh(d->widget);
573 {UP_YEAR, DOWN_YEAR, NULL, 6, "%4d", yy},
575 {LEFT_DAY, RIGHT_DAY, NULL, 4, "%02d", dd},
579 if ((init[i].win = newwin(1, 1, 1, 1)) == NULL)
580 RETURN_FMTERROR("Cannot build WINDOW dateitem[%d]", i);
586 if (format == NULL || wcscmp(wformat, L"d/m/y") == 0) {
588 dt[1] = init[1];
590 } else if (wcscmp(wformat, L"m/d/y") == 0) {
591 dt[0] = init[1];
592 dt[1] = init[2];
594 } else if (wcscmp(wformat, L"y/m/d") == 0) {
596 dt[1] = init[1];
613 struct dialog d;
622 if (prepare_dialog(conf, text, rows, cols, &d) != 0)
624 set_buttons(&d, true, OK_LABEL, CANCEL_LABEL);
627 if (datebox_redraw(&d, di) != 0)
630 sel = -1;
644 retval = BUTTONVALUE(d.bs);
658 d.bs.curr++;
659 focusbuttons = d.bs.curr < (int)d.bs.nbuttons ?
663 d.bs.curr = conf->button.always_active ?
664 0 : -1;
670 d.bs.curr = 0;
673 DRAW_BUTTONS(d);
678 d.bs.curr--;
679 focusbuttons = d.bs.curr < 0 ? false : true;
682 d.bs.curr = conf->button.always_active ?
683 0 : -1;
689 d.bs.curr = (int)d.bs.nbuttons - 1;
691 DRAW_BUTTONS(d);
701 d.bs.curr = conf->button.always_active ? 0 : -1;
702 DRAW_BUTTONS(d);
713 case KEY_F(1):
719 if (datebox_redraw(&d, di) != 0)
724 if (datebox_redraw(&d, di) != 0)
728 if (shortcut_buttons(input, &d.bs)) {
729 DRAW_BUTTONS(d);
731 retval = BUTTONVALUE(d.bs);
743 end_dialog(&d);