Lines Matching refs:f

36 #define	Scrollable(f)		((f)->drows > (f)->rows || \  argument
37 (f)->dcols > (f)->cols)
38 #define Connected(f) ((f) -> form != (FORM *) 0) argument
39 #define OnPage(f) ((f) -> page == P((f) -> form)) argument
40 #define Posted(f) (Status((f) -> form, POSTED)) argument
41 #define Visible(f) (Opt(f, O_VISIBLE) && OnPage(f)) argument
42 #define isCurrent(f) ((f) == C((f) -> form)) argument
43 #define Justified(f) (Just(f) != NO_JUSTIFICATION && \ argument
44 OneRow(f) && Opt(f, O_STATIC) && \
45 f->dcols == f->cols)
91 _adjust_cursor(FORM *f, char *v) in _adjust_cursor() argument
93 int pos = (int) (v - Buf(C(f))); in _adjust_cursor()
95 Y(f) = pos / Xmax(f); in _adjust_cursor()
96 X(f) = pos - Y(f) * Xmax(f); in _adjust_cursor()
98 if (Y(f) >= Ymax(f)) in _adjust_cursor()
99 Y(f) = 0; in _adjust_cursor()
107 _buf_to_win(FIELD *f, WINDOW *w) in _buf_to_win() argument
109 char * v = Buf(f); in _buf_to_win()
125 _win_to_buf(WINDOW *w, FIELD *f) in _win_to_buf() argument
128 int size = BufSize(f); in _win_to_buf()
129 int pad = Pad(f); in _win_to_buf()
130 char * v = Buf(f); in _win_to_buf()
143 _pos_form_cursor(FORM *f) in _pos_form_cursor() argument
145 WINDOW * w = W(f); in _pos_form_cursor()
146 FIELD * c = C(f); in _pos_form_cursor()
151 (void) wmove(w, Y(f), X(f)); in _pos_form_cursor()
159 col = c->fcol + X(f) - B(f); in _pos_form_cursor()
161 row = c -> frow + Y(f) - T(f); in _pos_form_cursor()
162 col = c -> fcol + X(f); in _pos_form_cursor()
165 (void) wmove(Sub(f), row, col); in _pos_form_cursor()
166 wcursyncup(Sub(f)); in _pos_form_cursor()
170 (void) wmove(Sub(f), c -> frow, c -> fcol); in _pos_form_cursor()
171 wcursyncup(Sub(f)); in _pos_form_cursor()
178 _update_current(FORM *f) in _update_current() argument
180 WINDOW * w = W(f); in _update_current()
181 FIELD * c = C(f); in _update_current()
189 int xmax = B(f) + c->cols; in _update_current()
191 if (X(f) < B(f)) in _update_current()
192 B(f) = X(f); in _update_current()
193 else if (X(f) >= xmax) in _update_current()
194 B(f) = X(f) - c->cols + 1; in _update_current()
196 (void) copywin(w, Sub(f), 0, B(f), c->frow, in _update_current()
201 int ymax = T(f) + c -> rows; in _update_current()
204 if (Y(f) < T(f)) { in _update_current()
205 T(f) = Y(f); in _update_current()
208 if (Y(f) >= ymax) { in _update_current()
209 T(f) = Y(f) - c -> rows + 1; in _update_current()
213 ys = T(f); in _update_current()
218 for (ys = T(f); ys < ymax; ++ys) in _update_current()
227 (void) copywin(w, Sub(f), ys, 0, in _update_current()
228 c -> frow + ys - T(f), c -> fcol, in _update_current()
229 c -> frow + ye - T(f) - 1, in _update_current()
233 wsyncup(Sub(f)); in _update_current()
238 return (_pos_form_cursor(f)); in _update_current()
243 justify(FIELD *f, WINDOW *w) in justify() argument
245 char * v = _data_beg(Buf(f), BufSize(f)); in justify()
246 char * vend = _data_end(Buf(f), BufSize(f)); in justify()
251 switch (Just(f)) { in justify()
255 x = (f -> cols - n) / 2; in justify()
258 x = f -> cols - n; in justify()
268 unjustify(FIELD *f, WINDOW *w) in unjustify() argument
270 char * v = _data_beg(Buf(f), BufSize(f)); in unjustify()
271 char * vend = _data_end(Buf(f), BufSize(f)); in unjustify()
282 _sync_buffer(FORM *f) in _sync_buffer() argument
284 if (Status(f, WIN_CHG)) { in _sync_buffer()
285 Clr(f, WIN_CHG); in _sync_buffer()
286 Set(f, BUF_CHG); in _sync_buffer()
287 _win_to_buf(W(f), C(f)); in _sync_buffer()
288 (void) wmove(W(f), Y(f), X(f)); in _sync_buffer()
294 _sync_linked(FIELD *f) in _sync_linked() argument
296 FIELD * p = f -> link; in _sync_linked()
299 while (p != f) { in _sync_linked()
309 display_field(FIELD *f) in display_field() argument
311 WINDOW * w = derwin(Sub(f -> form), f -> rows, f -> cols, in display_field()
312 f -> frow, f -> fcol); in display_field()
317 wbkgdset(w, Pad(f) | Back(f)); in display_field()
318 (void) wattrset(w, Fore(f)); in display_field()
321 if (Opt(f, O_PUBLIC)) { in display_field()
322 if (Justified(f)) in display_field()
323 justify(f, w); in display_field()
325 _buf_to_win(f, w); in display_field()
329 Clr(f, TOP_CHG); in display_field()
335 erase_field(FIELD *f) in erase_field() argument
337 WINDOW * w = derwin(Sub(f -> form), f -> rows, f -> cols, in erase_field()
338 f -> frow, f -> fcol); in erase_field()
351 _sync_field(FIELD *f) in _sync_field() argument
355 if (Connected(f) && Posted(f) && Visible(f)) { in _sync_field()
356 if (isCurrent(f)) { in _sync_field()
357 FORM * p = f -> form; in _sync_field()
368 if (Opt(f, O_PUBLIC) && Justified(f)) in _sync_field()
369 unjustify(f, w); in _sync_field()
371 _buf_to_win(f, w); in _sync_field()
373 Set(f, TOP_CHG); in _sync_field()
376 v = display_field(f); in _sync_field()
378 Set(f, USR_CHG); in _sync_field()
385 _sync_attrs(FIELD *f) in _sync_attrs() argument
389 if (Connected(f) && Posted(f) && Visible(f)) { in _sync_attrs()
390 if (isCurrent(f)) { in _sync_attrs()
391 FORM * p = f -> form; in _sync_attrs()
396 wbkgdset(w, Pad(f) | Back(f)); in _sync_attrs()
397 (void) wattrset(w, Fore(f)); in _sync_attrs()
400 if (Opt(f, O_PUBLIC)) { in _sync_attrs()
401 if (Justified(f)) in _sync_attrs()
402 unjustify(f, w); in _sync_attrs()
404 _buf_to_win(f, w); in _sync_attrs()
406 (void) copywin(w, Sub(p), 0, 0, f -> frow, in _sync_attrs()
407 f -> fcol, f -> rows - 1, f -> cols - 1, in _sync_attrs()
410 _buf_to_win(f, w); in _sync_attrs()
412 Set(f, TOP_CHG); in _sync_attrs()
415 v = display_field(f); in _sync_attrs()
421 _sync_opts(FIELD *f, OPTIONS opts) in _sync_opts() argument
424 OPTIONS oldopts = f -> opts; in _sync_opts()
427 f -> opts = opts; in _sync_opts()
429 if (Connected(f)) { in _sync_opts()
430 if (isCurrent(f)) { in _sync_opts()
431 f -> opts = oldopts; in _sync_opts()
434 if (Posted(f) && OnPage(f)) { in _sync_opts()
436 if (Opt(f, O_VISIBLE)) in _sync_opts()
437 v = display_field(f); in _sync_opts()
439 v = erase_field(f); in _sync_opts()
441 if (Opt(f, O_VISIBLE)) in _sync_opts()
442 v = display_field(f); in _sync_opts()
448 BOOLEAN onerow = OneRow(f); in _sync_opts()
449 int max = f->maxgrow; in _sync_opts()
451 if (Opt(f, O_STATIC)) { /* growth being turned off */ in _sync_opts()
452 Clr(f, GROWABLE); in _sync_opts()
454 if (onerow && f->cols == f->dcols && in _sync_opts()
455 Just(f) != NO_JUSTIFICATION && Posted(f) && in _sync_opts()
456 OnPage(f) && Opt(f, O_VISIBLE)) { in _sync_opts()
457 (void) display_field(f); in _sync_opts()
459 } else if (!max || (onerow && f->dcols < max) || in _sync_opts()
460 (!onerow && f->drows < max)) { in _sync_opts()
461 Set(f, GROWABLE); in _sync_opts()
463 if (onerow && Just(f) != NO_JUSTIFICATION && in _sync_opts()
464 Posted(f) && OnPage(f) && Opt(f, O_VISIBLE)) { in _sync_opts()
465 (void) display_field(f); in _sync_opts()
475 _validate(FORM *f) in _validate() argument
477 FIELD * c = C(f); in _validate()
479 _sync_buffer(f); in _validate()
481 if (Status(f, BUF_CHG) || !Opt(c, O_PASSOK)) { in _validate()
483 Clr(f, BUF_CHG); in _validate()
497 _set_current_field(FORM *f, FIELD *field) in _set_current_field() argument
499 WINDOW * w = W(f); in _set_current_field()
500 FIELD * c = C(f); in _set_current_field()
502 if (c != field || ! Status(f, POSTED)) { in _set_current_field()
505 (void) _update_current(f); in _set_current_field()
509 if (T(f) == 0) in _set_current_field()
527 w = derwin(Sub(f), c -> rows, c -> cols, c -> frow, in _set_current_field()
533 C(f) = c; in _set_current_field()
534 W(f) = w; in _set_current_field()
547 Clr(f, WIN_CHG | BUF_CHG); in _set_current_field()
549 Y(f) = 0; in _set_current_field()
550 X(f) = 0; in _set_current_field()
551 T(f) = 0; in _set_current_field()
552 B(f) = 0; in _set_current_field()
562 _set_form_page(FORM *f, int page, FIELD *c) in _set_form_page() argument
564 if (P(f) != page || ! Status(f, POSTED)) { in _set_form_page()
565 FIELD * x = f -> field [Smin(f, page)]; in _set_form_page()
568 (void) werase(Sub(f)); in _set_form_page()
569 P(f) = page; in _set_form_page()
579 return (c ? _set_current_field(f, c) : _first_field(f)); in _set_form_page()