projects
/
ncurses.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ncurses 5.9 - patch 20130209
[ncurses.git]
/
test
/
demo_forms.c
diff --git
a/test/demo_forms.c
b/test/demo_forms.c
index a649a5ceb101cbfb465778559c3a5a84ebe00b43..d20469460632ddeb2125ef6f73b6ca602f76fdc0 100644
(file)
--- a/
test/demo_forms.c
+++ b/
test/demo_forms.c
@@
-1,5
+1,5
@@
/****************************************************************************
/****************************************************************************
- * Copyright (c) 2003-20
09,2010
Free Software Foundation, Inc. *
+ * Copyright (c) 2003-20
11,2012
Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@
-26,7
+26,7
@@
* authorization. *
****************************************************************************/
/*
* authorization. *
****************************************************************************/
/*
- * $Id: demo_forms.c,v 1.
35 2010/05/01 21:56:10
tom Exp $
+ * $Id: demo_forms.c,v 1.
40 2012/11/18 01:22:44
tom Exp $
*
* Demonstrate a variety of functions from the form library.
* Thomas Dickey - 2003/4/26
*
* Demonstrate a variety of functions from the form library.
* Thomas Dickey - 2003/4/26
@@
-83,7
+83,7
@@
make_label(int frow, int fcol, NCURSES_CONST char *label)
if (f) {
set_field_buffer(f, 0, label);
if (f) {
set_field_buffer(f, 0, label);
- set_field_opts(f, (int) (field_opts(f) & ~O_ACTIVE));
+ set_field_opts(f, (int) (
(unsigned)
field_opts(f) & ~O_ACTIVE));
}
return (f);
}
}
return (f);
}
@@
-108,7
+108,7
@@
make_field(int frow, int fcol, int rows, int cols)
set_field_just(f, j_value);
if (d_option) {
if (has_colors()) {
set_field_just(f, j_value);
if (d_option) {
if (has_colors()) {
- set_field_fore(f, COLOR_PAIR(2));
+ set_field_fore(f,
(chtype)
COLOR_PAIR(2));
set_field_back(f, A_UNDERLINE | COLOR_PAIR(3));
} else {
set_field_fore(f, A_BOLD);
set_field_back(f, A_UNDERLINE | COLOR_PAIR(3));
} else {
set_field_fore(f, A_BOLD);
@@
-153,10
+153,10
@@
display_form(FORM * f)
set_form_sub(f, derwin(w, rows, cols, 1, 2));
box(w, 0, 0);
keypad(w, TRUE);
set_form_sub(f, derwin(w, rows, cols, 1, 2));
box(w, 0, 0);
keypad(w, TRUE);
- }
- if (post_form(f) != E_OK)
- wrefresh(w);
+ if (post_form(f) != E_OK)
+ wrefresh(w);
+ }
}
static void
}
static void
@@
-216,7
+216,7
@@
my_form_driver(FORM * form, int c)
case MY_EDT_MODE:
if ((field = current_field(form)) != 0) {
set_current_field(form, another_field(form, field));
case MY_EDT_MODE:
if ((field = current_field(form)) != 0) {
set_current_field(form, another_field(form, field));
- if (field_opts(field) & O_EDIT) {
+ if (
(unsigned)
field_opts(field) & O_EDIT) {
field_opts_off(field, O_EDIT);
set_field_status(field, 0);
} else {
field_opts_off(field, O_EDIT);
set_field_status(field, 0);
} else {
@@
-254,12
+254,14
@@
show_current_field(WINDOW *win, FORM * form)
char *buffer;
int nbuf;
int field_rows, field_cols, field_max;
char *buffer;
int nbuf;
int field_rows, field_cols, field_max;
+ int currow, curcol;
if (has_colors()) {
if (has_colors()) {
- wbkgd(win, COLOR_PAIR(1));
+ wbkgd(win,
(chtype)
COLOR_PAIR(1));
}
werase(win);
}
werase(win);
- wprintw(win, "Cursor: %d,%d", form->currow, form->curcol);
+ form_getyx(form, currow, curcol);
+ wprintw(win, "Cursor: %d,%d", currow, curcol);
if (data_ahead(form))
waddstr(win, " ahead");
if (data_behind(form))
if (data_ahead(form))
waddstr(win, " ahead");
if (data_behind(form))
@@
-292,7
+294,7
@@
show_current_field(WINDOW *win, FORM * form)
waddstr(win, "other");
}
waddstr(win, "other");
}
- if (field_opts(field) & O_EDIT)
+ if (
(unsigned)
field_opts(field) & O_EDIT)
waddstr(win, " editable");
else
waddstr(win, " readonly");
waddstr(win, " editable");
else
waddstr(win, " readonly");
@@
-307,15
+309,15
@@
show_current_field(WINDOW *win, FORM * form)
}
waddch(win, ' ');
}
waddch(win, ' ');
- (void) wattrset(win, field_fore(field));
+ (void) wattrset(win,
(int)
field_fore(field));
waddstr(win, "fore");
waddstr(win, "fore");
- wattroff(win, field_fore(field));
+ wattroff(win,
(int)
field_fore(field));
waddch(win, '/');
waddch(win, '/');
- (void) wattrset(win, field_back(field));
+ (void) wattrset(win,
(int)
field_back(field));
waddstr(win, "back");
waddstr(win, "back");
- wattroff(win, field_back(field));
+ wattroff(win,
(int)
field_back(field));
wprintw(win, ", pad '%c'",
field_pad(field));
wprintw(win, ", pad '%c'",
field_pad(field));
@@
-529,7
+531,7
@@
main(int argc, char *argv[])
init_pair(1, COLOR_WHITE, COLOR_BLUE);
init_pair(2, COLOR_GREEN, COLOR_BLACK);
init_pair(3, COLOR_CYAN, COLOR_BLACK);
init_pair(1, COLOR_WHITE, COLOR_BLUE);
init_pair(2, COLOR_GREEN, COLOR_BLACK);
init_pair(3, COLOR_CYAN, COLOR_BLACK);
- bkgd(COLOR_PAIR(1));
+ bkgd(
(chtype)
COLOR_PAIR(1));
refresh();
}
refresh();
}
@@
-538,6
+540,7
@@
main(int argc, char *argv[])
endwin();
ExitProgram(EXIT_SUCCESS);
}
endwin();
ExitProgram(EXIT_SUCCESS);
}
+
#else
int
main(void)
#else
int
main(void)