GWIN_CONSOLE_NEED_HISTORY -> GWIN_CONSOLE_USE_HISTORY
This commit is contained in:
parent
ae6c2965ad
commit
ffed62c5ba
4 changed files with 13 additions and 13 deletions
|
@ -124,7 +124,7 @@
|
||||||
#define GWIN_NEED_WINDOWMANAGER FALSE
|
#define GWIN_NEED_WINDOWMANAGER FALSE
|
||||||
|
|
||||||
#define GWIN_NEED_CONSOLE FALSE
|
#define GWIN_NEED_CONSOLE FALSE
|
||||||
#define GWIN_CONSOLE_NEED_HISTORY TRUE
|
#define GWIN_CONSOLE_USE_HISTORY TRUE
|
||||||
#define GWIN_CONSOLE_USE_BASESTREAM FALSE
|
#define GWIN_CONSOLE_USE_BASESTREAM FALSE
|
||||||
#define GWIN_CONSOLE_USE_FLOAT FALSE
|
#define GWIN_CONSOLE_USE_FLOAT FALSE
|
||||||
#define GWIN_NEED_GRAPH FALSE
|
#define GWIN_NEED_GRAPH FALSE
|
||||||
|
|
|
@ -31,7 +31,7 @@ typedef struct GConsoleObject {
|
||||||
GWindowObject g;
|
GWindowObject g;
|
||||||
coord_t cx, cy; // Cursor position
|
coord_t cx, cy; // Cursor position
|
||||||
|
|
||||||
#if GWIN_CONSOLE_NEED_HISTORY
|
#if GWIN_CONSOLE_USE_HISTORY
|
||||||
char* buffer; // buffer to store console content
|
char* buffer; // buffer to store console content
|
||||||
uint16_t last_char; // the last rendered character
|
uint16_t last_char; // the last rendered character
|
||||||
size_t size; // size of buffer
|
size_t size; // size of buffer
|
||||||
|
@ -89,10 +89,10 @@ GHandle gwinGConsoleCreate(GDisplay *g, GConsoleObject *gc, const GWindowInit *p
|
||||||
BaseSequentialStream *gwinConsoleGetStream(GHandle gh);
|
BaseSequentialStream *gwinConsoleGetStream(GHandle gh);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if GWIN_CONSOLE_NEED_HISTORY
|
#if GWIN_CONSOLE_USE_HISTORY
|
||||||
/**
|
/**
|
||||||
* @brief Assing a buffer to keep track of the content while the widget is invisible.
|
* @brief Assing a buffer to keep track of the content while the widget is invisible.
|
||||||
* @pre GWIN_CONSOLE_NEED_HISTORY must be set to TRUE in your gfxconf.h
|
* @pre GWIN_CONSOLE_USE_HISTORY must be set to TRUE in your gfxconf.h
|
||||||
*
|
*
|
||||||
* @param[in] gh The window handle (must be a console window)
|
* @param[in] gh The window handle (must be a console window)
|
||||||
* @param[in] buffer The pointer of the buffer that shall be used. Buffer will be
|
* @param[in] buffer The pointer of the buffer that shall be used. Buffer will be
|
||||||
|
|
|
@ -113,8 +113,8 @@
|
||||||
* content will be restored too.
|
* content will be restored too.
|
||||||
* @details Defaults to FALSE
|
* @details Defaults to FALSE
|
||||||
*/
|
*/
|
||||||
#ifndef GWIN_CONSOLE_NEED_HISTORY
|
#ifndef GWIN_CONSOLE_USE_HISTORY
|
||||||
#define GWIN_CONSOLE_NEED_HISTORY FALSE
|
#define GWIN_CONSOLE_USE_HISTORY FALSE
|
||||||
#endif
|
#endif
|
||||||
/**
|
/**
|
||||||
* @brief Console Windows need floating point support in @p gwinPrintf
|
* @brief Console Windows need floating point support in @p gwinPrintf
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#define GWIN_CONSOLE_USE_FILLED_CHARS FALSE
|
#define GWIN_CONSOLE_USE_FILLED_CHARS FALSE
|
||||||
|
|
||||||
// some temporary warning
|
// some temporary warning
|
||||||
#if GWIN_CONSOLE_NEED_HISTORY
|
#if GWIN_CONSOLE_USE_HISTORY
|
||||||
#warning "This feature is work in progress and does currently contain a lot of bugs."
|
#warning "This feature is work in progress and does currently contain a lot of bugs."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if GWIN_CONSOLE_NEED_HISTORY
|
#if GWIN_CONSOLE_USE_HISTORY
|
||||||
static void CustomRedraw(GWindowObject *gh) {
|
static void CustomRedraw(GWindowObject *gh) {
|
||||||
#define gcw ((GConsoleObject *)gh)
|
#define gcw ((GConsoleObject *)gh)
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ static void AfterClear(GWindowObject *gh) {
|
||||||
gcw->cx = 0;
|
gcw->cx = 0;
|
||||||
gcw->cy = 0;
|
gcw->cy = 0;
|
||||||
|
|
||||||
#if GWIN_CONSOLE_NEED_HISTORY
|
#if GWIN_CONSOLE_USE_HISTORY
|
||||||
// issue an overflow, this is some kind
|
// issue an overflow, this is some kind
|
||||||
// of emptying the buffer
|
// of emptying the buffer
|
||||||
gcw->last_char = gcw->size;
|
gcw->last_char = gcw->size;
|
||||||
|
@ -93,7 +93,7 @@ static const gwinVMT consoleVMT = {
|
||||||
"Console", // The classname
|
"Console", // The classname
|
||||||
sizeof(GConsoleObject), // The object size
|
sizeof(GConsoleObject), // The object size
|
||||||
0, // The destroy routine
|
0, // The destroy routine
|
||||||
#if GWIN_CONSOLE_NEED_HISTORY
|
#if GWIN_CONSOLE_USE_HISTORY
|
||||||
CustomRedraw, // The redraw routine (custom)
|
CustomRedraw, // The redraw routine (custom)
|
||||||
#else
|
#else
|
||||||
0, // The redraw routine (default)
|
0, // The redraw routine (default)
|
||||||
|
@ -109,7 +109,7 @@ GHandle gwinGConsoleCreate(GDisplay *g, GConsoleObject *gc, const GWindowInit *p
|
||||||
gc->stream.vmt = &GWindowConsoleVMT;
|
gc->stream.vmt = &GWindowConsoleVMT;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if GWIN_CONSOLE_NEED_HISTORY
|
#if GWIN_CONSOLE_USE_HISTORY
|
||||||
gc->buffer = 0;
|
gc->buffer = 0;
|
||||||
gc->size = 0;
|
gc->size = 0;
|
||||||
gc->last_char = 0;
|
gc->last_char = 0;
|
||||||
|
@ -132,7 +132,7 @@ GHandle gwinGConsoleCreate(GDisplay *g, GConsoleObject *gc, const GWindowInit *p
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if GWIN_CONSOLE_NEED_HISTORY
|
#if GWIN_CONSOLE_USE_HISTORY
|
||||||
bool_t gwinConsoleSetBuffer(GHandle gh, void* buffer, size_t size) {
|
bool_t gwinConsoleSetBuffer(GHandle gh, void* buffer, size_t size) {
|
||||||
#define gcw ((GConsoleObject *)gh)
|
#define gcw ((GConsoleObject *)gh)
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ void gwinPutChar(GHandle gh, char c) {
|
||||||
if (gh->vmt != &consoleVMT || !gh->font)
|
if (gh->vmt != &consoleVMT || !gh->font)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if GWIN_CONSOLE_NEED_HISTORY
|
#if GWIN_CONSOLE_USE_HISTORY
|
||||||
// buffer overflow check
|
// buffer overflow check
|
||||||
if (gcw->last_char >= gcw->size)
|
if (gcw->last_char >= gcw->size)
|
||||||
gcw->last_char = 0;
|
gcw->last_char = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue