|
|
@@ -9,6 +9,8 @@ It is distributed in the hope that it will be useful or harmful, it really depen |
|
|
|
#ifndef XURSES_SOURCE |
|
|
|
#define XURSES_SOURCE |
|
|
|
|
|
|
|
#include <xolatile/xtandard.c> |
|
|
|
|
|
|
|
#include <xolatile/xurses.h> |
|
|
|
|
|
|
|
#include <termios.h> |
|
|
@@ -24,10 +26,7 @@ It is distributed in the hope that it will be useful or harmful, it really depen |
|
|
|
|
|
|
|
/* Internal variable definitions. */ |
|
|
|
|
|
|
|
static int curses_signal = SIGNAL_NONE; |
|
|
|
static int curses_screen_width = 0; |
|
|
|
static int curses_screen_height = 0; |
|
|
|
static char * curses_screen = NULL; |
|
|
|
static char * curses_screen = NULL; |
|
|
|
|
|
|
|
static char curses_format [CURSES_FORMAT + 1] = "\033[-;3-m-\033[0m"; |
|
|
|
|
|
|
@@ -96,7 +95,13 @@ static void curses_idle (void) { |
|
|
|
|
|
|
|
/* External variable definitions. */ |
|
|
|
|
|
|
|
int curses_active = 1; |
|
|
|
int curses_realign_x = 0; |
|
|
|
int curses_realign_y = 0; |
|
|
|
int curses_tab_width = 8; |
|
|
|
int curses_signal = SIGNAL_NONE; |
|
|
|
int curses_screen_width = 0; |
|
|
|
int curses_screen_height = 0; |
|
|
|
int curses_active = 1; |
|
|
|
|
|
|
|
/* External function definitions. */ |
|
|
|
|
|
|
@@ -192,19 +197,43 @@ void curses_render_background (char character, int colour, int effect) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void curses_render_string_limit (char * string, int limit, int colour, int effect, int x, int y) { |
|
|
|
void curses_render_string_point (char * string, int limit, int colour, int effect, int * x, int * y) { |
|
|
|
int offset; |
|
|
|
|
|
|
|
for (offset = 0; offset != limit; ++offset) { |
|
|
|
if (x + offset < curses_screen_width) { |
|
|
|
curses_render_character (string [offset], colour, effect, x + offset, y); |
|
|
|
if (* x + offset < curses_screen_width) { |
|
|
|
if (string [offset] == '\n') { |
|
|
|
* x = curses_realign_x; |
|
|
|
* y += 1; |
|
|
|
} else if (string [offset] == '\t') { |
|
|
|
* x += curses_tab_width; |
|
|
|
} else { |
|
|
|
curses_render_character (string [offset], colour, effect, * x, * y); |
|
|
|
* x += 1; |
|
|
|
} |
|
|
|
} else { |
|
|
|
curses_render_character ('+', COLOUR_GREY, EFFECT_BOLD, x + offset, y); |
|
|
|
curses_render_character ('+', COLOUR_GREY, EFFECT_BOLD, * x, * y); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void curses_render_number_point (int number, int limit, int colour, int effect, int * x, int * y) { |
|
|
|
(void) number; |
|
|
|
(void) limit; |
|
|
|
(void) colour; |
|
|
|
(void) effect; |
|
|
|
(void) x; |
|
|
|
(void) y; |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
void curses_render_string_limit (char * string, int limit, int colour, int effect, int x, int y) { |
|
|
|
int xx = x, yy = y; |
|
|
|
|
|
|
|
curses_render_string_point (string, limit, colour, effect, & xx, & yy); |
|
|
|
} |
|
|
|
|
|
|
|
void curses_render_number_limit (int number, int limit, int colour, int effect, int x, int y) { |
|
|
|
(void) number; |
|
|
|
(void) limit; |
|
|
|