Simplify print_in_middle() in "utils.c".
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
parent
4b8558ed47
commit
0d12a788ad
21
src/utils.c
21
src/utils.c
@ -212,22 +212,17 @@ popup (int pop_row, int pop_col, int pop_y, int pop_x, char *title, char *msg,
|
|||||||
void
|
void
|
||||||
print_in_middle (WINDOW *win, int starty, int startx, int width, char *string)
|
print_in_middle (WINDOW *win, int starty, int startx, int width, char *string)
|
||||||
{
|
{
|
||||||
int length, x, y;
|
int len = strlen (string);
|
||||||
float temp;
|
int x, y;
|
||||||
|
|
||||||
if (win == NULL)
|
if (!win) win = stdscr;
|
||||||
win = stdscr;
|
|
||||||
getyx (win, y, x);
|
getyx (win, y, x);
|
||||||
if (startx != 0)
|
if (startx) x = startx;
|
||||||
x = startx;
|
if (starty) y = starty;
|
||||||
if (starty != 0)
|
if (!width) width = 80;
|
||||||
y = starty;
|
|
||||||
if (width == 0)
|
x += (width - len) / 2;
|
||||||
width = 80;
|
|
||||||
|
|
||||||
length = strlen (string);
|
|
||||||
temp = (width - length) / 2;
|
|
||||||
x = startx + (int) temp;
|
|
||||||
custom_apply_attr (win, ATTR_HIGHEST);
|
custom_apply_attr (win, ATTR_HIGHEST);
|
||||||
mvwprintw (win, y, x, "%s", string);
|
mvwprintw (win, y, x, "%s", string);
|
||||||
custom_remove_attr (win, ATTR_HIGHEST);
|
custom_remove_attr (win, ATTR_HIGHEST);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user