mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
UI tweaks
This commit is contained in:
parent
d0f9998820
commit
7db2da6d11
7
main.c
7
main.c
@ -4,13 +4,14 @@
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int exit_status = LOGIN_FAIL;
|
||||
int exit_status;
|
||||
|
||||
log_init();
|
||||
gui_init();
|
||||
|
||||
while (exit_status == LOGIN_FAIL) {
|
||||
do {
|
||||
exit_status = profanity_start();
|
||||
}
|
||||
} while (exit_status == LOGIN_FAIL);
|
||||
|
||||
gui_close();
|
||||
log_close();
|
||||
|
26
status_bar.c
26
status_bar.c
@ -14,7 +14,9 @@ void create_status_bar(void)
|
||||
|
||||
status_bar = newwin(1, cols, rows-2, 0);
|
||||
wbkgd(status_bar, COLOR_PAIR(3));
|
||||
wattron(status_bar, COLOR_PAIR(4));
|
||||
mvwprintw(status_bar, 0, cols - 29, _active);
|
||||
wattroff(status_bar, COLOR_PAIR(4));
|
||||
wrefresh(status_bar);
|
||||
}
|
||||
|
||||
@ -28,27 +30,27 @@ void status_bar_refresh(void)
|
||||
|
||||
void status_bar_inactive(int win)
|
||||
{
|
||||
_active[1 + ((win - 1) * 3)] = ' ';
|
||||
if (win == 9)
|
||||
_active[1 + ((win -1) * 3)] = ' ';
|
||||
int active_pos = 1 + ((win -1) * 3);
|
||||
|
||||
int 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)
|
||||
{
|
||||
if (win < 9) {
|
||||
_active[1 + ((win -1) * 3)] = (char)( ((int)'0') + (win + 1));
|
||||
} else {
|
||||
_active[25] = '1';
|
||||
_active[26] = '0';
|
||||
}
|
||||
int active_pos = 1 + ((win -1) * 3);
|
||||
|
||||
int 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)
|
||||
@ -67,7 +69,9 @@ void status_bar_clear(void)
|
||||
|
||||
int rows, cols;
|
||||
getmaxyx(stdscr, rows, cols);
|
||||
wattron(status_bar, COLOR_PAIR(4));
|
||||
mvwprintw(status_bar, 0, cols - 29, _active);
|
||||
wattroff(status_bar, COLOR_PAIR(4));
|
||||
}
|
||||
|
||||
static void _status_bar_update_time(void)
|
||||
|
25
title_bar.c
25
title_bar.c
@ -20,7 +20,15 @@ void title_bar_connected(void)
|
||||
int 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)
|
||||
@ -28,7 +36,15 @@ void title_bar_disconnected(void)
|
||||
int 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)
|
||||
@ -40,7 +56,10 @@ void title_bar_refresh(void)
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
13
windows.c
13
windows.c
@ -16,15 +16,14 @@ void gui_init(void)
|
||||
cbreak();
|
||||
keypad(stdscr, TRUE);
|
||||
|
||||
if (has_colors()) {
|
||||
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);
|
||||
attron(COLOR_PAIR(1));
|
||||
init_pair(4, COLOR_CYAN, COLOR_BLUE);
|
||||
}
|
||||
|
||||
refresh();
|
||||
|
||||
@ -60,7 +59,7 @@ void win_switch_to(int i)
|
||||
_curr_win = i;
|
||||
|
||||
if (i == 0) {
|
||||
title_bar_show("Profanity. Type /help for help information");
|
||||
title_bar_show("Profanity. Type /help for help information.");
|
||||
} else {
|
||||
title_bar_show(_wins[i].from);
|
||||
}
|
||||
@ -77,7 +76,7 @@ void win_close_win(void)
|
||||
|
||||
// go back to console window
|
||||
_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)
|
||||
|
Loading…
Reference in New Issue
Block a user