mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-29 21:46:22 +00:00
UI tweaks
This commit is contained in:
7
main.c
7
main.c
@@ -4,13 +4,14 @@
|
|||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
int exit_status = LOGIN_FAIL;
|
int exit_status;
|
||||||
|
|
||||||
log_init();
|
log_init();
|
||||||
gui_init();
|
gui_init();
|
||||||
|
|
||||||
while (exit_status == LOGIN_FAIL) {
|
do {
|
||||||
exit_status = profanity_start();
|
exit_status = profanity_start();
|
||||||
}
|
} while (exit_status == LOGIN_FAIL);
|
||||||
|
|
||||||
gui_close();
|
gui_close();
|
||||||
log_close();
|
log_close();
|
||||||
|
|||||||
30
status_bar.c
30
status_bar.c
@@ -14,7 +14,9 @@ void create_status_bar(void)
|
|||||||
|
|
||||||
status_bar = newwin(1, cols, rows-2, 0);
|
status_bar = newwin(1, cols, rows-2, 0);
|
||||||
wbkgd(status_bar, COLOR_PAIR(3));
|
wbkgd(status_bar, COLOR_PAIR(3));
|
||||||
|
wattron(status_bar, COLOR_PAIR(4));
|
||||||
mvwprintw(status_bar, 0, cols - 29, _active);
|
mvwprintw(status_bar, 0, cols - 29, _active);
|
||||||
|
wattroff(status_bar, COLOR_PAIR(4));
|
||||||
wrefresh(status_bar);
|
wrefresh(status_bar);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,27 +30,27 @@ void status_bar_refresh(void)
|
|||||||
|
|
||||||
void status_bar_inactive(int win)
|
void status_bar_inactive(int win)
|
||||||
{
|
{
|
||||||
_active[1 + ((win - 1) * 3)] = ' ';
|
int active_pos = 1 + ((win -1) * 3);
|
||||||
if (win == 9)
|
|
||||||
_active[1 + ((win -1) * 3)] = ' ';
|
|
||||||
|
|
||||||
int rows, cols;
|
int rows, cols;
|
||||||
getmaxyx(stdscr, rows, cols);
|
getmaxyx(stdscr, rows, cols);
|
||||||
mvwprintw(status_bar, 0, cols - 29, _active);
|
|
||||||
|
mvwaddch(status_bar, 0, cols - 29 + active_pos, ' ');
|
||||||
|
if (win == 9)
|
||||||
|
mvwaddch(status_bar, 0, cols - 29 + active_pos + 1, ' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
void status_bar_active(int win)
|
void status_bar_active(int win)
|
||||||
{
|
{
|
||||||
if (win < 9) {
|
int active_pos = 1 + ((win -1) * 3);
|
||||||
_active[1 + ((win -1) * 3)] = (char)( ((int)'0') + (win + 1));
|
|
||||||
} else {
|
|
||||||
_active[25] = '1';
|
|
||||||
_active[26] = '0';
|
|
||||||
}
|
|
||||||
|
|
||||||
int rows, cols;
|
int rows, cols;
|
||||||
getmaxyx(stdscr, rows, cols);
|
getmaxyx(stdscr, rows, cols);
|
||||||
mvwprintw(status_bar, 0, cols - 29, _active);
|
|
||||||
|
if (win < 9)
|
||||||
|
mvwprintw(status_bar, 0, cols - 29 + active_pos, "%d", win+1);
|
||||||
|
else
|
||||||
|
mvwprintw(status_bar, 0, cols - 29 + active_pos, "10");
|
||||||
}
|
}
|
||||||
|
|
||||||
void status_bar_get_password(void)
|
void status_bar_get_password(void)
|
||||||
@@ -67,7 +69,9 @@ void status_bar_clear(void)
|
|||||||
|
|
||||||
int rows, cols;
|
int rows, cols;
|
||||||
getmaxyx(stdscr, rows, cols);
|
getmaxyx(stdscr, rows, cols);
|
||||||
|
wattron(status_bar, COLOR_PAIR(4));
|
||||||
mvwprintw(status_bar, 0, cols - 29, _active);
|
mvwprintw(status_bar, 0, cols - 29, _active);
|
||||||
|
wattroff(status_bar, COLOR_PAIR(4));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _status_bar_update_time(void)
|
static void _status_bar_update_time(void)
|
||||||
|
|||||||
27
title_bar.c
27
title_bar.c
@@ -19,8 +19,16 @@ void title_bar_connected(void)
|
|||||||
{
|
{
|
||||||
int rows, cols;
|
int rows, cols;
|
||||||
getmaxyx(stdscr, rows, cols);
|
getmaxyx(stdscr, rows, cols);
|
||||||
|
|
||||||
mvwprintw(title_bar, 0, cols - 14, "[ ...online ]");
|
wattron(title_bar, COLOR_PAIR(4));
|
||||||
|
mvwaddch(title_bar, 0, cols - 14, '[');
|
||||||
|
wattroff(title_bar, COLOR_PAIR(4));
|
||||||
|
|
||||||
|
mvwprintw(title_bar, 0, cols - 13, " ...online ");
|
||||||
|
|
||||||
|
wattron(title_bar, COLOR_PAIR(4));
|
||||||
|
mvwaddch(title_bar, 0, cols - 2, ']');
|
||||||
|
wattroff(title_bar, COLOR_PAIR(4));
|
||||||
}
|
}
|
||||||
|
|
||||||
void title_bar_disconnected(void)
|
void title_bar_disconnected(void)
|
||||||
@@ -28,7 +36,15 @@ void title_bar_disconnected(void)
|
|||||||
int rows, cols;
|
int rows, cols;
|
||||||
getmaxyx(stdscr, rows, cols);
|
getmaxyx(stdscr, rows, cols);
|
||||||
|
|
||||||
mvwprintw(title_bar, 0, cols - 14, "[ ..offline ]");
|
wattron(title_bar, COLOR_PAIR(4));
|
||||||
|
mvwaddch(title_bar, 0, cols - 14, '[');
|
||||||
|
wattroff(title_bar, COLOR_PAIR(4));
|
||||||
|
|
||||||
|
mvwprintw(title_bar, 0, cols - 13, " ..offline ");
|
||||||
|
|
||||||
|
wattron(title_bar, COLOR_PAIR(4));
|
||||||
|
mvwaddch(title_bar, 0, cols - 2, ']');
|
||||||
|
wattroff(title_bar, COLOR_PAIR(4));
|
||||||
}
|
}
|
||||||
|
|
||||||
void title_bar_refresh(void)
|
void title_bar_refresh(void)
|
||||||
@@ -40,7 +56,10 @@ void title_bar_refresh(void)
|
|||||||
|
|
||||||
void title_bar_show(char *title)
|
void title_bar_show(char *title)
|
||||||
{
|
{
|
||||||
wclear(title_bar);
|
wmove(title_bar, 0, 0);
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < 45; i++)
|
||||||
|
waddch(title_bar, ' ');
|
||||||
mvwprintw(title_bar, 0, 0, " %s", title);
|
mvwprintw(title_bar, 0, 0, " %s", title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
21
windows.c
21
windows.c
@@ -15,16 +15,15 @@ void gui_init(void)
|
|||||||
initscr();
|
initscr();
|
||||||
cbreak();
|
cbreak();
|
||||||
keypad(stdscr, TRUE);
|
keypad(stdscr, TRUE);
|
||||||
|
|
||||||
start_color();
|
|
||||||
init_color(COLOR_WHITE, 1000, 1000, 1000);
|
|
||||||
init_pair(1, COLOR_WHITE, COLOR_BLACK);
|
|
||||||
init_pair(2, COLOR_GREEN, COLOR_BLACK);
|
|
||||||
init_color(COLOR_BLUE, 0, 0, 250);
|
|
||||||
init_pair(3, COLOR_WHITE, COLOR_BLUE);
|
|
||||||
|
|
||||||
attron(A_BOLD);
|
if (has_colors()) {
|
||||||
attron(COLOR_PAIR(1));
|
start_color();
|
||||||
|
|
||||||
|
init_pair(1, COLOR_WHITE, COLOR_BLACK);
|
||||||
|
init_pair(2, COLOR_GREEN, COLOR_BLACK);
|
||||||
|
init_pair(3, COLOR_WHITE, COLOR_BLUE);
|
||||||
|
init_pair(4, COLOR_CYAN, COLOR_BLUE);
|
||||||
|
}
|
||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
@@ -60,7 +59,7 @@ void win_switch_to(int i)
|
|||||||
_curr_win = i;
|
_curr_win = i;
|
||||||
|
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
title_bar_show("Profanity. Type /help for help information");
|
title_bar_show("Profanity. Type /help for help information.");
|
||||||
} else {
|
} else {
|
||||||
title_bar_show(_wins[i].from);
|
title_bar_show(_wins[i].from);
|
||||||
}
|
}
|
||||||
@@ -77,7 +76,7 @@ void win_close_win(void)
|
|||||||
|
|
||||||
// go back to console window
|
// go back to console window
|
||||||
_curr_win = 0;
|
_curr_win = 0;
|
||||||
title_bar_show("Profanity. Type /help for help information");
|
title_bar_show("Profanity. Type /help for help information.");
|
||||||
}
|
}
|
||||||
|
|
||||||
int win_in_chat(void)
|
int win_in_chat(void)
|
||||||
|
|||||||
Reference in New Issue
Block a user