From 4a58c727279279cbf08cc7455c8e069f8e4f81f7 Mon Sep 17 00:00:00 2001 From: Nicholas Date: Sat, 31 Dec 2022 04:11:12 -0500 Subject: [PATCH] added ui module --- .gitignore | 7 +- Makefile | 4 +- client/.gitignore | 2 + client/client | Bin 17360 -> 0 bytes client/include/ui.h | 11 +++ client/source/ui.c | 197 ++++++++++++++++++++++++++++++++++++++++++++ common/.gitignore | 1 + server/.gitignore | 2 + server/server | Bin 22240 -> 0 bytes testing/a.out | Bin 21392 -> 0 bytes testing/border.c | 77 ----------------- testing/iterator.c | 16 ---- testing/pantest.c | 157 ----------------------------------- testing/ui.c | 118 -------------------------- 14 files changed, 219 insertions(+), 373 deletions(-) create mode 100644 client/.gitignore delete mode 100644 client/client create mode 100644 client/include/ui.h create mode 100644 client/source/ui.c create mode 100644 common/.gitignore create mode 100644 server/.gitignore delete mode 100644 server/server delete mode 100644 testing/a.out delete mode 100644 testing/border.c delete mode 100644 testing/iterator.c delete mode 100644 testing/pantest.c delete mode 100644 testing/ui.c diff --git a/.gitignore b/.gitignore index a261b66..e6ba9db 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ -bin/ -build/ - +notes/ +testing/* +serverex +clientex diff --git a/Makefile b/Makefile index 404374e..e83844b 100644 --- a/Makefile +++ b/Makefile @@ -15,8 +15,8 @@ export _COMMONOBJ=util.o export _SERVERDEPS=blacklist.h export _SERVEROBJ=server.o blacklist.o -export _CLIENTDEPS= -export _CLIENTOBJ=client.o +export _CLIENTDEPS=ui.h +export _CLIENTOBJ=client.o ui.o #Rules #============================================================================== diff --git a/client/.gitignore b/client/.gitignore new file mode 100644 index 0000000..7f54dff --- /dev/null +++ b/client/.gitignore @@ -0,0 +1,2 @@ +build/ +client diff --git a/client/client b/client/client deleted file mode 100644 index cae6e4e04133d477fd080ef81449c1f3f14e6ab3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 17360 zcmeHP3vgW3c|I#!Sb%MG+v??I<@5O-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rXP)opnTEB!KYk610aPfbY|qaZnDX-lZr^|Wf2Qr% zYKQ#1f+;`WAbZN0-~LfxloR&vUU%s04}OjV6% z-_J8;J=Oa7Wf9{~`RoU^JyY*HUGl+pOzCShZ~PzFq@6VsQpB?XiVQ5WF7x?n$3rGAD)JcWM58wYX_0Mts_J85C-**K76sG%sL;G(- zcP9Sm9Hheg9C`n_KVIgUo`y|5{@9+MOBhY$ZG5~cZk%WPPa&YO%l7$DzkL^THTehJ-+C!C=@FdFXgeLBbFP>6Uubofa7+Rl +#include + +static WINDOW* tools_win; +static int tools_height, tools_width, tools_y, tools_x; + +static WINDOW* status_win; +static int status_height, status_width, status_y, status_x; + +static WINDOW* servers_win; +static int servers_height, servers_width, servers_y, servers_x; + +static WINDOW* messages_win; +static int messages_height, messages_width, messages_y, messages_x; + +static WINDOW* users_win; +static int users_height, users_width, users_y, users_x; + +static int divl, divr; +#define PROPL 0.2 +#define PROPR 0.2 + +//TODO: handle the resize +//NOTE: if getch is waiting for input, window resizing returns KEY_RESIZE +//you can use this if the SIGWINCH handler doesn't work as expected + +//calculates the dimensions for each window +//NOTE: must only be called after initscr(), as it depends on LINES and COLS +void ui_calculate(void) { + + //calculate the screen position of the division between windows + divl = (int) (COLS * PROPL); + divr = (int) ((COLS - 1) * (1 - PROPR)); + + //layout logic hinges on this being true + assert(divl < divr); + + //toolbar window dimensions + tools_y = 0; + tools_x = 0; + tools_height = 1; + tools_width = COLS; + + //status bar window dimensions + status_y = LINES - 1; + status_x = 0; + status_height = 1; + status_width = COLS; + + //servers window dimensions + servers_y = 2; + servers_x = 1; + servers_height = LINES - 4; + servers_width = divl - 1; + + //messages window dimensions + messages_y = 2; + messages_x = divl + 1; + messages_height = LINES - 4; + messages_width = (divr - divl) - 1; + + //users window dimensions + users_y = 2; + users_x = divr + 1; + users_height = LINES - 4; + users_width = COLS - divr - 2; +} + +//draws our layout between the windows +void ui_drawborders(void) { + + //outer lines + mvwhline(stdscr, 1, 1, ACS_HLINE, COLS - 2); + mvwhline(stdscr, LINES - 2, 1, ACS_HLINE, COLS - 2); + mvwvline(stdscr, 2, 0, ACS_VLINE, LINES - 4); + mvwvline(stdscr, 2, COLS - 1, ACS_VLINE, LINES - 4); + + //inner dividers + mvwvline(stdscr, 2, divl, ACS_VLINE, LINES - 4); + mvwvline(stdscr, 2, divr, ACS_VLINE, LINES - 4); + + //corners + mvwaddch(stdscr, 1, 0, ACS_ULCORNER); + mvwaddch(stdscr, 1, COLS - 1, ACS_URCORNER); + mvwaddch(stdscr, LINES - 2, 0, ACS_LLCORNER); + mvwaddch(stdscr, LINES - 2, COLS - 1, ACS_LRCORNER); + + //inner tees + mvwaddch(stdscr, 1, divl, ACS_TTEE); + mvwaddch(stdscr, 1, divr, ACS_TTEE); + mvwaddch(stdscr, LINES - 2, divl, ACS_BTEE); + mvwaddch(stdscr, LINES - 2, divr, ACS_BTEE); +} + +//refreshes all windows, including stdscr +void ui_refresh(void) { + + //NOTE: we do several calls to wnoutrefresh and then one call to doupdate, + //this is because wrefresh calls wnoutrefresh and doupdate, so we save cpu + //time by doing it this way. it is analogous to batching in openGL + //NOTE: don't forget to refresh stdscr too, that's where our decoration is + wnoutrefresh(stdscr); + wnoutrefresh(tools_win); + wnoutrefresh(status_win); + wnoutrefresh(servers_win); + wnoutrefresh(messages_win); + wnoutrefresh(users_win); + + doupdate(); +} + +void ui_initcolor(void) { + + start_color(); + init_pair(1, COLOR_RED, COLOR_BLACK); + init_pair(2, COLOR_GREEN, COLOR_BLACK); + init_pair(3, COLOR_BLUE, COLOR_BLACK); + init_pair(4, COLOR_CYAN, COLOR_BLACK); + init_pair(5, COLOR_BLACK, COLOR_WHITE); +} + +//initializes curses, inits our windows, and draws our layout +//NOTE: call only once at the start of the program +void ui_init(void) { + + initscr(); + raw(); //don't generate signals on ctrl+whatever + keypad(stdscr, 1); //enable f1-f12 + + ui_initcolor(); + ui_calculate(); + + tools_win = newwin(tools_height, tools_width, tools_y, tools_x); + status_win = newwin(status_height, status_width, status_y, status_x); + servers_win = newwin(servers_height, servers_width, servers_y, servers_x); + messages_win = newwin(messages_height, messages_width, messages_y, messages_x); + users_win = newwin(users_height, users_width, users_y, users_x); + + ui_drawborders(); + ui_refresh(); +} + +//frees our windows and exits curses mode +//NOTE: call only once at the end of the program +void ui_deinit(void) { + + delwin(tools_win); + delwin(status_win); + delwin(servers_win); + delwin(messages_win); + delwin(users_win); + + endwin(); +} + +void ui_toolbar_init(void) { + wmove(tools_win, 0, 0); + attron(COLOR_PAIR(2)); + waddstr(tools_win, "^X"); + attroff(COLOR_PAIR(2)); + waddstr(tools_win, " Exit"); + wrefresh(tools_win); +} + +//overwrites the text shown in the status bar +void ui_status_update(char* str) { + + mvwaddstr(status_win, 0, 0, str); + wclrtoeol(status_win); + wrefresh(status_win); +} + +//renamed to avoid conflict with the real main +int _main(int argc, char** argv) { + + ui_init(); + + mvwaddstr(tools_win, 0, 0, "Toolbar"); + mvwaddstr(status_win, 0, 0, "Status Bar"); + mvwaddstr(servers_win, 0, 0, "Servers"); + mvwaddstr(messages_win, 0, 0, "Message Log"); + mvwaddstr(users_win, 0, 0, "Active Users"); + + ui_refresh(); + + wgetch(messages_win); + + ui_toolbar_init(); + ui_status_update("Suckmepls"); + wgetch(users_win); + + ui_deinit(); +} diff --git a/common/.gitignore b/common/.gitignore new file mode 100644 index 0000000..567609b --- /dev/null +++ b/common/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/server/.gitignore b/server/.gitignore new file mode 100644 index 0000000..ddd41ef --- /dev/null +++ b/server/.gitignore @@ -0,0 +1,2 @@ +build/ +server diff --git a/server/server b/server/server deleted file mode 100644 index 5e0a6026c29651df9bc67741b668d223b665e9a1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 22240 zcmeHPe{@_`oxhVGHmz+lkyJwY(N`c^#12WDVp}MrKc>9yX-jAuz=JqUXI`3t$;>$O zrlermbkkzTH0Q(>T~=kS9+mFOx^Y!3ATZ@eQx)0ZR!&?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?Igc6n)VHub~6yZ z+lk9g-_fN^q`Eq_yGxlEM;hUmL;N9X8N>paJzaKqC#ankv{Tivvx}8Zu|OheTY+7P zY#^1!^T@QlM}u}|W7sAOlbg_5yKd7`nwGgb9u0T0Ky*(6O$chIg#=GmGkD%w#)KeC zTk$X%$XY6Hvj9!6EP!fYS5j6oR)htxr43k`r=gwXQ$xV&lrwWDc5-nz;X_Q(!a~*2 zRJbb!XTluAjs1*MP3@PKB1zhy3Zs~p{wddFT#iJ?I`<|(q7Rf zQqqe0UZ|kUQPJ()`@3DN6eY!Fy{yppX5C(WZ&%bP)28p7<>dyj_+?2_#joz4DXP|a z>i(HKep(mNy)$J$BKxoCxa28D%CoXp_qk%gNJZJJ`*n({`*Tp?g?#Ac6JY4xm$Fy) zyA<6al~w#oPtm&|r+aCNSNGEtZI$-!_$AExQK6hFdv$+LQFVV$weRl#KS=v^(xJLv zsHnQXNcNO7xBXXuQBIV9XI&@PcXIg+4N=_3|4V>%dqdhO+NwGx?bWhT(feKYx5!1L zqDoJiyTfCHF8h?US5$wtPd=1CMd_D9di;m$NsBq(U#?R(ng#6GOP1079Nk`h&sNlB z{;u=qX=(4IsY!a4l-`-pi#mP^`w1%4zEV^7WfVQ66eV>ZzhAiQk1P|4iqiLQy|~+d z4MN&ZL!PG2eKWNmqg!9`ik^mTt!A(8(+yq;5Jl+;Zi-hp-H)QNtJ+uhtJMCQf8-w?3#w@$XNhK&-`w~E@O3XoK})2ZtabIsOPVUUs?Js<3J^T%x9Dt2KZ f{tlXgZpZgLy{L8-R)@-T_LcHE$wHTbi)H@{i_9?` diff --git a/testing/a.out b/testing/a.out deleted file mode 100644 index 1aced065a5c2b50c09b206bce6e846c1d2cbbcb4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 21392 zcmeHP3ve7qneJI>)^btwPahyPU2+!%qsYWEnjStWW3rP?Jkyf#qO*n zKU39-s?p#%sn2sjW55-t?x4k$?Fz$OqUJng#!!rgJ_01h&Q!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GUeIr)zH|CTNb*fVqTt-#Vz7(7(bL=A#!a25&=9!_m-JMTB zGn!7|gsfTm76+H3-Q8JxKXY=frL_>jVi-F!y={W_NV9NUJhIyt(J@%)yfaybQs43eq{i?@)Sl`cJ`Y0X= z6eqT0?CU5LZ$HmpnDYA&tnZEAx3oR)e-YH0ny%C=6R-XEAfWo$p6829yVy`uul>Jy z?8kyik?CS`UX-~1Fmwh5Je81rn=pRQgTG(q)n}gRi?E@`qjYRg;`cyywJM(V6gSa- z8GjuD>bq>u^JxAaT|fs$A69Pv=lw{}F=-Rop5FuMUjh(mOc6KddYM+ixY%BVwQ8H9 zTn{^7JLc(~dBV8J2VQP;24U7YRdAxCkdwo+m`SKBLeBEL#I^!jBx z)}-%3c`=gh(}sK96N|F&>UNZ|{|;T)kT!Y@Jgit(#=cP>ICS5uIC)sHRoi>FbNMP| zMf36E#P&@0l(GLYy}p6O*FVKg#ER{S^0CW0L<9PJS}S$OeLFDPm)w8&{7?6DJxv6H g_ZikpB0lOl;JIEUrMdd#_CJp(4SKbtIC)s{KcrP9qyPW_ diff --git a/testing/border.c b/testing/border.c deleted file mode 100644 index c855328..0000000 --- a/testing/border.c +++ /dev/null @@ -1,77 +0,0 @@ - -#include - -WINDOW* create_newwin(int, int, int, int); -void destroy_win(WINDOW*); - -int main(int argc, char** argv) { - - initscr(); - cbreak(); - keypad(stdscr, TRUE); - - int height = 3; - int width = 10; - int starty = (LINES - height) / 2; - int startx = (COLS - width) / 2; - - printw("Press F1 to exit"); - refresh(); - - WINDOW* my_win = create_newwin(height, width, starty, startx); - - int ch; - while((ch = getch()) != KEY_F(1)) { - - switch(ch) { - - case KEY_LEFT: - destroy_win(my_win); - my_win = create_newwin(height, width, starty, --startx); - break; - case KEY_RIGHT: - destroy_win(my_win); - my_win = create_newwin(height, width, starty, ++startx); - break; - case KEY_UP: - destroy_win(my_win); - my_win = create_newwin(height, width, --starty, startx); - break; - case KEY_DOWN: - destroy_win(my_win); - my_win = create_newwin(height, width, ++starty, startx); - break; - } - } - - endwin(); - return 0; -} - -WINDOW* create_newwin(int height, int width, int starty, int startx) { - - WINDOW* win = newwin(height, width, starty, startx); - box(win, 0 , 0); //0,0 means use default chars for lines - wrefresh(win); - - return win; -} - -void destroy_win(WINDOW* local_win) { - - /* box(local_win, ' ', ' '); : This won't produce the desired - * result of erasing the window. It will leave it's four corners - * and so an ugly remnant of window. - */ - wborder(local_win, ' ', ' ', ' ',' ',' ',' ',' ',' '); - //ls: left side - //rs: right side - //ts: top side - //bs: bottom side - //tl: top left - //tr: top right - //bl: bottom left - //br: bottom right - wrefresh(local_win); - delwin(local_win); -} diff --git a/testing/iterator.c b/testing/iterator.c deleted file mode 100644 index 172a390..0000000 --- a/testing/iterator.c +++ /dev/null @@ -1,16 +0,0 @@ - - -#include -#include - -#define ITERATOR(v, start, end) (size_t (v) = (start); (v) < (end); (v)++) - -int main(int argc, char** argv) { - - for ITERATOR(i, 0, 1000) { - - printf("%zu\n", i); - } - - return EXIT_SUCCESS; -} diff --git a/testing/pantest.c b/testing/pantest.c deleted file mode 100644 index 5055c53..0000000 --- a/testing/pantest.c +++ /dev/null @@ -1,157 +0,0 @@ -#include -#include - -typedef struct _PANEL_DATA { - int hide; /* TRUE if panel is hidden */ -}PANEL_DATA; - -#define NLINES 10 -#define NCOLS 40 - -void init_wins(WINDOW **wins, int n); -void win_show(WINDOW *win, char *label, int label_color); -void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color); - -int main() -{ WINDOW *my_wins[3]; - PANEL *my_panels[3]; - PANEL_DATA panel_datas[3]; - PANEL_DATA *temp; - int ch; - - /* Initialize curses */ - initscr(); - start_color(); - cbreak(); - noecho(); - keypad(stdscr, TRUE); - - /* Initialize all the colors */ - init_pair(1, COLOR_RED, COLOR_BLACK); - init_pair(2, COLOR_GREEN, COLOR_BLACK); - init_pair(3, COLOR_BLUE, COLOR_BLACK); - init_pair(4, COLOR_CYAN, COLOR_BLACK); - - init_wins(my_wins, 3); - - /* Attach a panel to each window */ /* Order is bottom up */ - my_panels[0] = new_panel(my_wins[0]); /* Push 0, order: stdscr-0 */ - my_panels[1] = new_panel(my_wins[1]); /* Push 1, order: stdscr-0-1 */ - my_panels[2] = new_panel(my_wins[2]); /* Push 2, order: stdscr-0-1-2 */ - - /* Initialize panel datas saying that nothing is hidden */ - panel_datas[0].hide = FALSE; - panel_datas[1].hide = FALSE; - panel_datas[2].hide = FALSE; - - set_panel_userptr(my_panels[0], &panel_datas[0]); - set_panel_userptr(my_panels[1], &panel_datas[1]); - set_panel_userptr(my_panels[2], &panel_datas[2]); - - /* Update the stacking order. 2nd panel will be on top */ - update_panels(); - - /* Show it on the screen */ - attron(COLOR_PAIR(4)); - mvprintw(LINES - 3, 0, "Show or Hide a window with 'a'(first window) 'b'(Second Window) 'c'(Third Window)"); - mvprintw(LINES - 2, 0, "F1 to Exit"); - - attroff(COLOR_PAIR(4)); - doupdate(); - - while((ch = getch()) != KEY_F(1)) - { switch(ch) - { case 'a': - temp = (PANEL_DATA *)panel_userptr(my_panels[0]); - if(temp->hide == FALSE) - { hide_panel(my_panels[0]); - temp->hide = TRUE; - } - else - { show_panel(my_panels[0]); - temp->hide = FALSE; - } - break; - case 'b': - temp = (PANEL_DATA *)panel_userptr(my_panels[1]); - if(temp->hide == FALSE) - { hide_panel(my_panels[1]); - temp->hide = TRUE; - } - else - { show_panel(my_panels[1]); - temp->hide = FALSE; - } - break; - case 'c': - temp = (PANEL_DATA *)panel_userptr(my_panels[2]); - if(temp->hide == FALSE) - { hide_panel(my_panels[2]); - temp->hide = TRUE; - } - else - { show_panel(my_panels[2]); - temp->hide = FALSE; - } - break; - } - update_panels(); - doupdate(); - } - endwin(); - return 0; -} - -/* Put all the windows */ -void init_wins(WINDOW **wins, int n) -{ int x, y, i; - char label[80]; - - y = 2; - x = 10; - for(i = 0; i < n; ++i) - { wins[i] = newwin(NLINES, NCOLS, y, x); - sprintf(label, "Window Number %d", i + 1); - win_show(wins[i], label, i + 1); - y += 3; - x += 7; - } -} - -/* Show the window with a border and a label */ -void win_show(WINDOW *win, char *label, int label_color) -{ int startx, starty, height, width; - - getbegyx(win, starty, startx); - getmaxyx(win, height, width); - - box(win, 0, 0); - mvwaddch(win, 2, 0, ACS_LTEE); - mvwhline(win, 2, 1, ACS_HLINE, width - 2); - mvwaddch(win, 2, width - 1, ACS_RTEE); - - print_in_middle(win, 1, 0, width, label, COLOR_PAIR(label_color)); -} - -void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color) -{ int length, x, y; - float temp; - - if(win == NULL) - win = stdscr; - getyx(win, y, x); - if(startx != 0) - x = startx; - if(starty != 0) - y = starty; - if(width == 0) - width = 80; - - length = strlen(string); - temp = (width - length)/ 2; - x = startx + (int)temp; - wattron(win, color); - mvwprintw(win, y, x, "%s", string); - wattroff(win, color); - refresh(); -} \ No newline at end of file diff --git a/testing/ui.c b/testing/ui.c deleted file mode 100644 index 97b7381..0000000 --- a/testing/ui.c +++ /dev/null @@ -1,118 +0,0 @@ - - -#include - -static WINDOW* tools_win; -static int tools_height, tools_width, tools_y, tools_x; - -static WINDOW* status_win; -static int status_height, status_width, status_y, status_x; - -static WINDOW* servers_win; -static int servers_height, servers_width, servers_y, servers_x; - -static WINDOW* users_win; -static int users_height, users_width, users_y, users_x; - -static WINDOW* messages_win; -static int messages_height, messages_width, messages_y, messages_x; - -void ui_init(void) { - - initscr(); - raw(); //don't generate signals on ctrl+whatever - keypad(stdscr, 1); //enable f1-f12 - - tools_y = 0; - tools_x = 0; - tools_height = 1; - tools_width = COLS; - - status_y = LINES - 1; - status_x = 0; - status_height = 1; - status_width = COLS; - - servers_y = 1; - servers_x = 0; - servers_height = LINES - 2; - servers_width = COLS / 4; - - users_y = 1; - users_x = COLS * 3 / 4; - users_height = LINES - 2; - users_width = COLS / 4; - - messages_y = 1; - messages_x = COLS / 4; - messages_height = LINES - 2; - messages_width = COLS / 2; - - tools_win = newwin(tools_height, tools_width, tools_y, tools_x); - status_win = newwin(status_height, status_width, status_y, status_x); - - servers_win = newwin(servers_height, servers_width, servers_y, servers_x); - users_win = newwin(users_height, users_width, users_y, users_x); - - messages_win = newwin(messages_height, messages_width, messages_y, messages_x); -} - -void ui_deinit(void) { - - delwin(tools_win); - delwin(status_win); - - delwin(servers_win); - delwin(users_win); - - delwin(messages_win); - - endwin(); -} - -void ui_draw(void) { - - wrefresh(tools_win); - wrefresh(status_win); - - wborder(servers_win, 0, 0, 0, 0, 0, 0, 0, 0); - wrefresh(servers_win); - - wborder(users_win, 0, 0, 0, 0, 0, 0, 0, 0); - wrefresh(users_win); - - wborder(messages_win, 0, 0, 0, 0, 0, 0, 0, 0); - wrefresh(messages_win); -} - -void ui_refresh(void) { - - wrefresh(tools_win); - wrefresh(status_win); - - wrefresh(servers_win); - wrefresh(users_win); - - wrefresh(messages_win); -} - -int main(int argc, char** argv) { - - ui_init(); - - ui_draw(); - - mvwprintw(tools_win, 0, 0, "Toolbar"); - mvwprintw(status_win, 0, 0, "Status Bar"); - - mvwprintw(servers_win, 1, 1, "Servers"); - mvwprintw(users_win, 1, 1, "Active Users"); - - mvwprintw(messages_win, 1, 1, "Message Log"); - - ui_refresh(); - - wgetch(messages_win); - - ui_deinit(); -} \ No newline at end of file