summaryrefslogtreecommitdiffstats
path: root/src/tui.c
diff options
context:
space:
mode:
authorandmarti1424 <andmarti@gmail.com>2017-12-15 12:24:29 -0300
committerandmarti1424 <andmarti@gmail.com>2017-12-15 12:24:29 -0300
commit61a4ae63d3c9444af59755c58b56bc59bd7ef186 (patch)
treeb069a3f1ac80c20644d6b067034825369ce8c7c6 /src/tui.c
parent03c38aa0eeee765b7f237e49b187c3ae3266709f (diff)
renamed winch to sig_winch. current fg and bg colors are kept if they are not specified in :cellcolor. added comments in tui.c
Diffstat (limited to 'src/tui.c')
-rw-r--r--src/tui.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/tui.c b/src/tui.c
index 35f6c25..737eb40 100644
--- a/src/tui.c
+++ b/src/tui.c
@@ -105,7 +105,7 @@ SCREEN * sstdout;
srange * ranges;
/**
- * \brief Called to start UI
+ * \brief Called to start UI
*
* \return none
*/
@@ -328,7 +328,7 @@ void ui_do_welcome() {
* \details This function is used to refresh the screen content. If
* the header flag is set, the first column of the screen gets
* refreshed.
- *
+ *
* \param[in] header
*
* \return none
@@ -429,7 +429,7 @@ void ui_handle_cursor() {
* \details Internal function to print a string with alignment.
*
* JUSTIF: 0 left shift
- *
+ *
* JUSTIF: 1 right shift
*
* \param[in] win
@@ -1143,15 +1143,11 @@ void ui_show_text(char * val) {
/**
- * \brief TODO Document winchg()
- *
+ * \brief
+ * UI function thats called after SIGWINCH signal.
* \return none
*/
-
-// TODO Consider renaming this to sig_winchg for consistancy with
-// the other signal funcitons.
-
-void winchg() {
+void sig_winchg() {
endwin();
refresh();
clear();
@@ -1306,6 +1302,7 @@ char * ui_query(char * initial_msg) {
*/
void ui_set_ucolor(WINDOW * w, struct ucolor * uc) {
+ short color;
long attr = A_NORMAL;
if (uc->bold) attr |= A_BOLD;
if (uc->dim) attr |= A_DIM;
@@ -1313,7 +1310,14 @@ void ui_set_ucolor(WINDOW * w, struct ucolor * uc) {
if (uc->standout) attr |= A_STANDOUT;
if (uc->blink) attr |= A_BLINK;
if (uc->underline) attr |= A_UNDERLINE;
- wattrset (w, attr | COLOR_PAIR((uc->fg+1)*9 + uc->bg + 2));
+ if (uc->bg == NONE_COLOR || uc->fg == NONE_COLOR) {
+ // get current window color;
+ attr_t a;
+ wattr_get(w, &a, &color, NULL);
+ } else {
+ color = (uc->fg+1)*9 + uc->bg + 2;
+ }
+ wattrset (w, attr | COLOR_PAIR(color));
}
/**
@@ -1321,7 +1325,6 @@ void ui_set_ucolor(WINDOW * w, struct ucolor * uc) {
*
* \return none
*/
-
void ui_start_colors() {
if (! has_colors()) return;
int i, j;
@@ -1333,11 +1336,10 @@ void ui_start_colors() {
}
/**
- * \brief TODO Document ui_pause()
- *
+ * \brief
+ * UI function thats called after SIGTSTP signal.
* \return none
*/
-
void ui_pause() {
def_prog_mode();
set_term(sstderr);
@@ -1346,11 +1348,10 @@ void ui_pause() {
}
/**
- * \brief TODO Document ui_resume
- *
+ * \brief
+ * UI function thats called after SIGCONT signal.
* \return none
*/
-
void ui_resume() {
set_term(sstdout);
reset_prog_mode();