X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=lib%2Fscr.c;h=b0eeb0ca69164c7d8bc54911de5b0058c661b801;hb=refs%2Ftags%2Fupstream%2F1.5.pre1;hp=20a75ed790d06f881ee73885171cc1c94665ba2f;hpb=67fc54773e1504698e80c9cb83977bde32665350;p=ap-utils.git diff --git a/lib/scr.c b/lib/scr.c index 20a75ed..b0eeb0c 100644 --- a/lib/scr.c +++ b/lib/scr.c @@ -22,7 +22,6 @@ #include #include #include "ap-utils.h" -#include "ap-curses.h" #include extern WINDOW *main_sub, *win_for_help, *main_win; @@ -145,72 +144,74 @@ void print_helperr(char *mess) wattrset(win_for_help, COLOR_PAIR(1)); } -void print_title(char *mess) +void print_bold(WINDOW *wptr, char *mess) { - int i; - /* íÁÌÀÀ ÒÁÍËÕ */ - for (i = 0; i < COLS - MCOLS - 1; i++) - mvwaddch(main_win, 0, i, ACS_BSBS); - wattrset(main_win, A_BOLD); - mvwaddstr(main_win, 0, COLS - MCOLS - strlen(mess) - 2, mess); - wattrset(main_win, A_NORMAL); - wrefresh(main_win); -} - -void print_viewtype(char *mess) -{ - /* - * note: when used to update with different strlen(mess) than previous one, - * call print_title() before this one so that the top line gets updated ! - */ - wattrset(main_win, A_BOLD); - mvwaddstr(main_win, 0, 1, "View: "); - waddstr(main_win, mess); - wattrset(main_win, A_NORMAL); - wrefresh(main_win); -} - -void print_viewtype_rssi() -{ - switch (sts_viewtype) { - case dBm: - print_viewtype("RSSI in dBm"); - return; - case percentage: - print_viewtype("RSSI in percentage"); - return; - case rawval: - print_viewtype("RSSI in raw values"); - } + wattrset(wptr, A_BOLD); + waddstr(wptr, mess); + wattrset(wptr, A_NORMAL); + wrefresh(wptr); } void print_menusel(int y, int x, char *mess1, char *mess2) { mvwaddstr(main_sub, y, x, mess1); - wattrset(main_sub, A_BOLD); - waddstr(main_sub, mess2); - wattrset(main_sub, A_NORMAL); - wrefresh(main_sub); + print_bold(main_sub, mess2); } void print_bottom(char *mess) { int i; char message[100]; - extern short ap_type; - extern char *ap_types[]; + extern short ap_type, ap_vendorext; + extern char *ap_types[], *ap_vendorexts[][3]; - sprintf(message, _("Current AP: %s Type: %s"), mess, ap_types[ap_type]); + sprintf(message, _("Current AP: %s Type: %s Ext: %s"), + mess, ap_types[ap_type], ap_vendorexts[ap_type][ap_vendorext]); /* íÁÌÀÀ ÒÁÍËÕ */ for (i = 0; i < COLS - MCOLS - 1; i++) mvwaddch(main_win, LINES - 3, i, ACS_BSBS); + + wmove(main_win, LINES - 3, COLS - MCOLS - strlen(message) - 1); + print_bold(main_win, message); +} + +void print_top(char *title_left, char *title_right) +{ + int i = 0; + + wmove(main_win, 0, 0); + while (i++ < COLS - MCOLS - 1) + waddch(main_win, ACS_BSBS); + wattrset(main_win, A_BOLD); - mvwaddstr(main_win, LINES - 3, COLS - MCOLS - strlen(message) - 1, - message); + if (title_left) + mvwaddstr(main_win, 0, 2, title_left); + + if (title_right) + mvwaddstr(main_win, 0, COLS - MCOLS - strlen(title_right) - 2, + title_right); + wattrset(main_win, A_NORMAL); wrefresh(main_win); } +void print_top_rssi(char *message_r) +{ + char message_l[200]; + + sprintf(message_l, "%s", VIEW); + switch (sts_viewtype) { + case dBm: + strcat(message_l, "RSSI in dBm"); + break; + case percentage: + strcat(message_l, "RSSI in percentage"); + break; + case rawval: + strcat(message_l, "RSSI in raw values"); + } + print_top(message_l, message_r); +} void clear_main(int m) {