Mercurial > hg > nnchat
diff main.c @ 501:ca88945d8eda
Begin work on integrating the removal of ncurses "windowing" and transition
to internally managing the screen as whole.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 01 Jun 2012 12:00:11 +0300 |
parents | cbbf502e4a70 |
children | 52da406caf54 |
line wrap: on
line diff
--- a/main.c Fri Jun 01 06:11:11 2012 +0300 +++ b/main.c Fri Jun 01 12:00:11 2012 +0300 @@ -248,8 +248,8 @@ if (!optDaemon && (flags & LOG_WINDOW)) { nn_window_t *tmp = (win != NULL) ? win : nnwin_main_window(); - if (flags & LOG_STAMP) nnwin_print_buf(tmp, tmpStr); - nnwin_print_buf(tmp, buf); + if (flags & LOG_STAMP) nnwin_print(tmp, tmpStr); + nnwin_print(tmp, buf); } th_free(buf); @@ -1345,8 +1345,7 @@ BOOL argsOK, isError = FALSE, exitProg = FALSE, colorSet = FALSE, - insertMode = TRUE, - firstUpdate = TRUE; + insertMode = TRUE; time_t prevTime; char *tmpStr; nn_editbuf_t *editBuf = nn_editbuf_new(NN_TMPBUF_SIZE); @@ -1487,14 +1486,15 @@ goto err_exit; if (cursesInit) - nnwin_update_statusline(optUserName, optUserColor); + { + nnwin_update(TRUE, NULL, optUserName, optUserColor); + } // Check if we have username and password if (cursesInit && (optUserName == NULL || optPassword == NULL)) { - nnwin_print(editWin, "You can avoid this prompt by issuing '/save' after logging in.\n"); - optUserName = nnwin_prompt_requester(editWin, "NN username: ", FALSE); - optPassword = nnwin_prompt_requester(editWin, "NN password: ", TRUE); + optUserName = nnwin_prompt_requester("You can avoid this prompt by issuing '/save' after logging in.\nNN username: ", FALSE); + optPassword = nnwin_prompt_requester("NN password: ", TRUE); } if (optUserName == NULL || optPassword == NULL) @@ -1584,8 +1584,7 @@ nn_editbuf_clear(editBuf); // First update of screen - nnwin_update_editbuf(editBuf); - nnwin_update_statusline(optUserName, optUserColor); + nnwin_update(TRUE, editBuf, optUserName, optUserColor); printMsg(NULL, "%s v%s - %s\n", th_prog_name, th_prog_version, th_prog_fullname); printMsg(NULL, "%s\n", th_prog_author); @@ -1749,12 +1748,7 @@ resize_term(0, 0); erase(); timeout(SET_DELAY); - - if (!nnwin_init_windows()) - { - errorMsg("Error resizing curses chatWindows\n"); - isError = TRUE; - } + nnwin_reset(); update = updateMain = TRUE; break; #endif @@ -1954,16 +1948,7 @@ } while (c != ERR && !exitProg && ++cnt < 10); - nnwin_update_main(updateMain); - - if (update || firstUpdate) - { - // Update edit line - nnwin_update_statusline(optUserName, optUserColor); - nnwin_update_editbuf(editBuf); - firstUpdate = FALSE; // a nasty hack ... - } - + nnwin_update(FALSE, editBuf, optUserName, optUserColor); } // cursesInit if (++updateCount > 10) @@ -1983,8 +1968,7 @@ nn_conn_send_msg_v(conn, optUserNameEnc, "%%2FSetFontColor%%20%%2Dcolor%%20%06X", optUserColor); } - nnwin_update_statusline(optUserName, optUserColor); - nnwin_update_editbuf(editBuf); + nnwin_update(FALSE, editBuf, optUserName, optUserColor); updateCount = 0; }