Added a limited 'base_drv'-like implementation of the extended
driver functions. Removed some of this functionality from the curses and text driver.
This commit is contained in:
+172
-1
@@ -18,11 +18,14 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/errno.h>
|
#include <sys/errno.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "screenlist.h" /* for timer */
|
||||||
|
|
||||||
#include "shared/report.h"
|
#include "shared/report.h"
|
||||||
#include "configfile.h"
|
#include "configfile.h"
|
||||||
|
|
||||||
@@ -295,7 +298,6 @@ request_display_width()
|
|||||||
return display_props->width;
|
return display_props->width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
request_display_height()
|
request_display_height()
|
||||||
{
|
{
|
||||||
@@ -303,3 +305,172 @@ request_display_height()
|
|||||||
return 0;
|
return 0;
|
||||||
return display_props->height;
|
return display_props->height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
driver_alt_vbar( Driver * drv, int x, int y, int len, int promille, int pattern )
|
||||||
|
{
|
||||||
|
int pos;
|
||||||
|
|
||||||
|
if (!drv->chr)
|
||||||
|
return;
|
||||||
|
for ( pos=0; pos<len; pos++ ) {
|
||||||
|
if( 2 * pos < ((long) promille * len / 500 + 1) ) {
|
||||||
|
drv->chr (drv, x, y-pos, '|');
|
||||||
|
} else {
|
||||||
|
; /* print nothing */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
driver_alt_hbar( Driver * drv, int x, int y, int len, int promille, int pattern )
|
||||||
|
{
|
||||||
|
int pos;
|
||||||
|
|
||||||
|
if (!drv->chr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for ( pos=0; pos<len; pos++ ) {
|
||||||
|
if( 2 * pos < ((long) promille * len / 500 + 1) ) {
|
||||||
|
drv->chr (drv, x+pos, y, '-');
|
||||||
|
} else {
|
||||||
|
; /* print nothing */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
driver_alt_num( Driver * drv, int x, int num )
|
||||||
|
{
|
||||||
|
/* Ugly code extracted by David GLAUDE from lcdm001.c ;)*/
|
||||||
|
/* Moved to driver.c by Joris Robijn */
|
||||||
|
static char num_map [10][4][3] = {
|
||||||
|
{
|
||||||
|
{' ','_',' '}, /*0*/
|
||||||
|
{'|',' ','|'},
|
||||||
|
{'|','_','|'},
|
||||||
|
{' ',' ',' '}},
|
||||||
|
{
|
||||||
|
{' ',' ',' '},/*1*/
|
||||||
|
{' ',' ','|'},
|
||||||
|
{' ',' ','|'},
|
||||||
|
{' ',' ',' '}},
|
||||||
|
{
|
||||||
|
{' ','_',' '},/*2*/
|
||||||
|
{' ','_','|'},
|
||||||
|
{'|','_',' '},
|
||||||
|
{' ',' ',' '}},
|
||||||
|
{
|
||||||
|
{' ','_',' '},/*3*/
|
||||||
|
{' ','_','|'},
|
||||||
|
{' ','_','|'},
|
||||||
|
{' ',' ',' '}},
|
||||||
|
{
|
||||||
|
{' ',' ',' '},/*4*/
|
||||||
|
{'|','_','|'},
|
||||||
|
{' ',' ','|'},
|
||||||
|
{' ',' ',' '}},
|
||||||
|
{
|
||||||
|
{' ','_',' '},/*5*/
|
||||||
|
{'|','_',' '},
|
||||||
|
{' ','_','|'},
|
||||||
|
{' ',' ',' '}},
|
||||||
|
{
|
||||||
|
{' ','_',' '},/*6*/
|
||||||
|
{'|','_',' '},
|
||||||
|
{'|','_','|'},
|
||||||
|
{' ',' ',' '}},
|
||||||
|
{
|
||||||
|
{' ','_',' '},/*7*/
|
||||||
|
{' ',' ','|'},
|
||||||
|
{' ',' ','|'},
|
||||||
|
{' ',' ',' '}},
|
||||||
|
{
|
||||||
|
{' ','_',' '},/*8*/
|
||||||
|
{'|','_','|'},
|
||||||
|
{'|','_','|'},
|
||||||
|
{' ',' ',' '}},
|
||||||
|
{
|
||||||
|
{' ','_',' '},/*9*/
|
||||||
|
{'|','_','|'},
|
||||||
|
{' ','_','|'},
|
||||||
|
{' ',' ',' '}}
|
||||||
|
};
|
||||||
|
/* End of ugly code ;) by Rene Wagner */
|
||||||
|
/* I like this code ! Joris */
|
||||||
|
|
||||||
|
int y, dx;
|
||||||
|
|
||||||
|
if (!drv->chr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (y = 1; y < 5; y++)
|
||||||
|
for (dx = 0; dx < 3; dx++)
|
||||||
|
drv->chr (drv, x + dx, y, num_map[num][y-1][dx]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
driver_alt_heartbeat( Driver * drv, int state )
|
||||||
|
{
|
||||||
|
int icon;
|
||||||
|
|
||||||
|
|
||||||
|
if (state == HEARTBEAT_OFF)
|
||||||
|
return;
|
||||||
|
/* Don't display anything */
|
||||||
|
|
||||||
|
if (!drv->width)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* Hmm, is this a good method ?
|
||||||
|
* Or should we use clock() ? Or ftime ? Or gettimeofday ?
|
||||||
|
*/
|
||||||
|
icon = (timer & 5) ? ICON_HEART_FILLED : ICON_HEART_OPEN;
|
||||||
|
|
||||||
|
if (drv->icon)
|
||||||
|
drv->icon( drv, drv->width(drv), 1, icon);
|
||||||
|
else
|
||||||
|
driver_alt_icon( drv, drv->width(drv), 1, icon);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
driver_alt_icon( Driver * drv, int x, int y, int icon )
|
||||||
|
{
|
||||||
|
char ch;
|
||||||
|
|
||||||
|
if (!drv->chr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch (icon) {
|
||||||
|
case ICON_HEART_OPEN:
|
||||||
|
ch = '-';
|
||||||
|
break;
|
||||||
|
case ICON_HEART_FILLED:
|
||||||
|
ch = '#';
|
||||||
|
break;
|
||||||
|
case ICON_BLOCK_FILLED:
|
||||||
|
ch = '#';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ch = '?';
|
||||||
|
}
|
||||||
|
drv->chr( drv, x, y, ch);
|
||||||
|
}
|
||||||
|
|
||||||
|
void driver_alt_cursor( Driver * drv, int x, int y, int state )
|
||||||
|
{
|
||||||
|
/* Same question about timer in this function... */
|
||||||
|
|
||||||
|
switch( state ) {
|
||||||
|
case CURSOR_BLOCK:
|
||||||
|
case CURSOR_DEFAULT_ON:
|
||||||
|
if (timer & 2)
|
||||||
|
driver_alt_icon( drv, x, y, ICON_BLOCK_FILLED );
|
||||||
|
break;
|
||||||
|
case CURSOR_UNDER:
|
||||||
|
if (timer & 2 && drv->chr)
|
||||||
|
drv->chr( drv, x, y, '_');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -41,4 +41,19 @@ driver_support_multiple( Driver * driver );
|
|||||||
bool
|
bool
|
||||||
driver_stay_in_foreground( Driver * driver );
|
driver_stay_in_foreground( Driver * driver );
|
||||||
|
|
||||||
|
|
||||||
|
/* Alternative functions for all extended functions */
|
||||||
|
|
||||||
|
void driver_alt_vbar( Driver * drv, int x, int y, int len, int promille, int pattern );
|
||||||
|
|
||||||
|
void driver_alt_hbar( Driver * drv, int x, int y, int len, int promille, int pattern );
|
||||||
|
|
||||||
|
void driver_alt_num( Driver * drv, int x, int num );
|
||||||
|
|
||||||
|
void driver_alt_heartbeat( Driver * drv, int state );
|
||||||
|
|
||||||
|
void driver_alt_icon( Driver * drv, int x, int y, int icon );
|
||||||
|
|
||||||
|
void driver_alt_cursor( Driver * drv, int x, int y, int state );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+18
-44
@@ -233,9 +233,10 @@ drivers_vbar( int x, int y, int len, int promille, int pattern )
|
|||||||
|
|
||||||
|
|
||||||
ForAllDrivers(drv) {
|
ForAllDrivers(drv) {
|
||||||
if( drv->vbar ) {
|
if( drv->vbar )
|
||||||
drv->vbar( drv, x, y, len, promille, pattern );
|
drv->vbar( drv, x, y, len, promille, pattern );
|
||||||
}
|
else
|
||||||
|
driver_alt_vbar( drv, x, y, len, promille, pattern );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,9 +249,10 @@ drivers_hbar( int x, int y, int len, int promille, int pattern )
|
|||||||
report( RPT_INFO, "drivers_hbar( x=%d, y=%d, len=%d, promille=%d, pattern=%d )", x, y, len, promille, pattern );
|
report( RPT_INFO, "drivers_hbar( x=%d, y=%d, len=%d, promille=%d, pattern=%d )", x, y, len, promille, pattern );
|
||||||
|
|
||||||
ForAllDrivers(drv) {
|
ForAllDrivers(drv) {
|
||||||
if( drv->hbar ) {
|
if( drv->hbar )
|
||||||
drv->hbar( drv, x, y, len, promille, pattern );
|
drv->hbar( drv, x, y, len, promille, pattern );
|
||||||
}
|
else
|
||||||
|
driver_alt_hbar( drv, x, y, len, promille, pattern );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,6 +267,8 @@ drivers_num( int x, int num )
|
|||||||
ForAllDrivers(drv) {
|
ForAllDrivers(drv) {
|
||||||
if( drv->num )
|
if( drv->num )
|
||||||
drv->num( drv, x, num );
|
drv->num( drv, x, num );
|
||||||
|
else
|
||||||
|
driver_alt_num( drv, x, num );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -279,6 +283,8 @@ drivers_heartbeat( int state )
|
|||||||
ForAllDrivers(drv) {
|
ForAllDrivers(drv) {
|
||||||
if( drv->heartbeat )
|
if( drv->heartbeat )
|
||||||
drv->heartbeat( drv, state );
|
drv->heartbeat( drv, state );
|
||||||
|
else
|
||||||
|
driver_alt_heartbeat( drv, state );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -293,58 +299,26 @@ drivers_icon( int x, int y, int icon )
|
|||||||
ForAllDrivers(drv) {
|
ForAllDrivers(drv) {
|
||||||
if( drv->icon )
|
if( drv->icon )
|
||||||
drv->icon( drv, x, y, icon );
|
drv->icon( drv, x, y, icon );
|
||||||
|
else
|
||||||
|
driver_alt_icon( drv, x, y, icon );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
drivers_set_char( char ch, char *dat )
|
drivers_cursor( int x, int y, int state )
|
||||||
{
|
{
|
||||||
Driver *drv;
|
Driver *drv;
|
||||||
|
|
||||||
report( RPT_INFO, "drivers_set_char( ch=%d, dat=%p )", ch, dat );
|
report( RPT_INFO, "drivers_cursor( x=%d, y=%d, state=%d )", x, y, state );
|
||||||
|
|
||||||
ForAllDrivers(drv) {
|
ForAllDrivers(drv) {
|
||||||
if( drv->set_char )
|
if( drv->cursor )
|
||||||
drv->set_char( drv, ch, dat );
|
drv->cursor( drv, x, y, state );
|
||||||
|
else
|
||||||
|
driver_alt_cursor( drv, x, y, state );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
drivers_get_contrast()
|
|
||||||
{
|
|
||||||
Driver *drv;
|
|
||||||
int res;
|
|
||||||
|
|
||||||
report( RPT_INFO, "drivers_get_contrast()" );
|
|
||||||
|
|
||||||
ForAllDrivers(drv) {
|
|
||||||
if( drv->get_contrast ) {
|
|
||||||
res = drv->get_contrast( drv );
|
|
||||||
report( RPT_INFO, "Driver [%.40s] gave contrast value %d", drv->name, res );
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
report( RPT_INFO, "Did not get any contrast value" );
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
drivers_set_contrast( int promille )
|
|
||||||
{
|
|
||||||
Driver *drv;
|
|
||||||
|
|
||||||
report( RPT_INFO, "drivers_contrast( contrast=%d )", promille );
|
|
||||||
|
|
||||||
ForAllDrivers(drv) {
|
|
||||||
if( drv->set_contrast )
|
|
||||||
drv->set_contrast( drv, promille );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
drivers_backlight( int brightness )
|
drivers_backlight( int brightness )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -112,49 +112,6 @@ void curses_drv_restore_screen (Driver *drvthis);
|
|||||||
static char icon_char = '@';
|
static char icon_char = '@';
|
||||||
static WINDOW *lcd_win;
|
static WINDOW *lcd_win;
|
||||||
|
|
||||||
/*this is really ugly ;) but works ;)*/
|
|
||||||
static char num_icon [10][4][3] = {{{' ','_',' '}, /*0*/
|
|
||||||
{'|',' ','|'},
|
|
||||||
{'|','_','|'},
|
|
||||||
{' ',' ',' '}},
|
|
||||||
{{' ',' ',' '},/*1*/
|
|
||||||
{' ',' ','|'},
|
|
||||||
{' ',' ','|'},
|
|
||||||
{' ',' ',' '}},
|
|
||||||
{{' ','_',' '},/*2*/
|
|
||||||
{' ','_','|'},
|
|
||||||
{'|','_',' '},
|
|
||||||
{' ',' ',' '}},
|
|
||||||
{{' ','_',' '},/*3*/
|
|
||||||
{' ','_','|'},
|
|
||||||
{' ','_','|'},
|
|
||||||
{' ',' ',' '}},
|
|
||||||
{{' ',' ',' '},/*4*/
|
|
||||||
{'|','_','|'},
|
|
||||||
{' ',' ','|'},
|
|
||||||
{' ',' ',' '}},
|
|
||||||
{{' ','_',' '},/*5*/
|
|
||||||
{'|','_',' '},
|
|
||||||
{' ','_','|'},
|
|
||||||
{' ',' ',' '}},
|
|
||||||
{{' ','_',' '},/*6*/
|
|
||||||
{'|','_',' '},
|
|
||||||
{'|','_','|'},
|
|
||||||
{' ',' ',' '}},
|
|
||||||
{{' ','_',' '},/*7*/
|
|
||||||
{' ',' ','|'},
|
|
||||||
{' ',' ','|'},
|
|
||||||
{' ',' ',' '}},
|
|
||||||
{{' ','_',' '},/*8*/
|
|
||||||
{'|','_','|'},
|
|
||||||
{'|','_','|'},
|
|
||||||
{' ',' ',' '}},
|
|
||||||
{{' ','_',' '},/*9*/
|
|
||||||
{'|','_','|'},
|
|
||||||
{' ','_','|'},
|
|
||||||
{' ',' ',' '}}};
|
|
||||||
/*end of ugly code ;) Rene Wagner*/
|
|
||||||
|
|
||||||
chtype get_color (char *colorstr) {
|
chtype get_color (char *colorstr) {
|
||||||
if (strcasecmp(colorstr, "red") == 0)
|
if (strcasecmp(colorstr, "red") == 0)
|
||||||
return COLOR_RED;
|
return COLOR_RED;
|
||||||
@@ -499,29 +456,6 @@ curses_drv_chr (Driver *drvthis, int x, int y, char c)
|
|||||||
mvwaddch (lcd_win, y, x, c);
|
mvwaddch (lcd_win, y, x, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
// Sets up for big numbers.
|
|
||||||
//
|
|
||||||
MODULE_EXPORT void
|
|
||||||
curses_drv_init_num (Driver *drvthis)
|
|
||||||
{
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
// Writes a big number.
|
|
||||||
//
|
|
||||||
MODULE_EXPORT void
|
|
||||||
curses_drv_num (Driver *drvthis, int x, int num)
|
|
||||||
{
|
|
||||||
int y, dx;
|
|
||||||
|
|
||||||
for (y = 1; y < 5; y++)
|
|
||||||
for (dx = 0; dx < 3; dx++)
|
|
||||||
curses_drv_chr (drvthis, x + dx, y, num_icon[num][y-1][dx]);
|
|
||||||
// printf("%1d",num);
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// Draws a vertical bar; erases entire column onscreen.
|
// Draws a vertical bar; erases entire column onscreen.
|
||||||
//
|
//
|
||||||
@@ -625,35 +559,6 @@ curses_drv_icon (Driver *drvthis, int x, int y, int icon)
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////
|
|
||||||
// Does the heartbeat...
|
|
||||||
//
|
|
||||||
MODULE_EXPORT void
|
|
||||||
curses_drv_heartbeat (Driver *drvthis, int type)
|
|
||||||
{
|
|
||||||
static int timer = 0;
|
|
||||||
int whichIcon;
|
|
||||||
static int saved_type = HEARTBEAT_ON;
|
|
||||||
|
|
||||||
if (type)
|
|
||||||
saved_type = type;
|
|
||||||
|
|
||||||
if (type == HEARTBEAT_ON) {
|
|
||||||
// Set this to pulsate like a real heart beat...
|
|
||||||
if ( (timer + 4) & 5 ) {
|
|
||||||
whichIcon = ICON_HEART_OPEN;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
whichIcon = ICON_HEART_FILLED;
|
|
||||||
}
|
|
||||||
// Place the icon on screen
|
|
||||||
curses_drv_icon (drvthis, width, 1, whichIcon);
|
|
||||||
}
|
|
||||||
|
|
||||||
timer++;
|
|
||||||
timer &= 0x0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
// Flushes all output to the lcd...
|
// Flushes all output to the lcd...
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -23,48 +23,6 @@
|
|||||||
#include "text.h"
|
#include "text.h"
|
||||||
//#include "drv_base.h"
|
//#include "drv_base.h"
|
||||||
|
|
||||||
/* Ugly code extracted by David GLAUDE from lcdm001.c ;)*/
|
|
||||||
static char num_icon [10][4][3] = {{{' ','_',' '}, /*0*/
|
|
||||||
{'|',' ','|'},
|
|
||||||
{'|','_','|'},
|
|
||||||
{' ',' ',' '}},
|
|
||||||
{{' ',' ',' '},/*1*/
|
|
||||||
{' ',' ','|'},
|
|
||||||
{' ',' ','|'},
|
|
||||||
{' ',' ',' '}},
|
|
||||||
{{' ','_',' '},/*2*/
|
|
||||||
{' ','_','|'},
|
|
||||||
{'|','_',' '},
|
|
||||||
{' ',' ',' '}},
|
|
||||||
{{' ','_',' '},/*3*/
|
|
||||||
{' ','_','|'},
|
|
||||||
{' ','_','|'},
|
|
||||||
{' ',' ',' '}},
|
|
||||||
{{' ',' ',' '},/*4*/
|
|
||||||
{'|','_','|'},
|
|
||||||
{' ',' ','|'},
|
|
||||||
{' ',' ',' '}},
|
|
||||||
{{' ','_',' '},/*5*/
|
|
||||||
{'|','_',' '},
|
|
||||||
{' ','_','|'},
|
|
||||||
{' ',' ',' '}},
|
|
||||||
{{' ','_',' '},/*6*/
|
|
||||||
{'|','_',' '},
|
|
||||||
{'|','_','|'},
|
|
||||||
{' ',' ',' '}},
|
|
||||||
{{' ','_',' '},/*7*/
|
|
||||||
{' ',' ','|'},
|
|
||||||
{' ',' ','|'},
|
|
||||||
{' ',' ',' '}},
|
|
||||||
{{' ','_',' '},/*8*/
|
|
||||||
{'|','_','|'},
|
|
||||||
{'|','_','|'},
|
|
||||||
{' ',' ',' '}},
|
|
||||||
{{' ','_',' '},/*9*/
|
|
||||||
{'|','_','|'},
|
|
||||||
{' ','_','|'},
|
|
||||||
{' ',' ',' '}}};
|
|
||||||
/* End of ugly code ;) by Rene Wagner */
|
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
int width;
|
int width;
|
||||||
@@ -235,59 +193,3 @@ text_backlight (Driver *drvthis, int on)
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
// Writes a big number. (by Rene Wagner from lcdm001.c)
|
|
||||||
//
|
|
||||||
MODULE_EXPORT void
|
|
||||||
text_num (Driver *drvthis, int x, int num)
|
|
||||||
{
|
|
||||||
//PrivateData * p = (PrivateData*) drvthis->private_data;
|
|
||||||
|
|
||||||
int y, dx;
|
|
||||||
|
|
||||||
// printf("BigNum(%i, %i)\n", x, num);
|
|
||||||
for (y = 1; y < 5; y++)
|
|
||||||
for (dx = 0; dx < 3; dx++)
|
|
||||||
text_chr (drvthis, x + dx, y, num_icon[num][y-1][dx]);
|
|
||||||
}
|
|
||||||
|
|
||||||
//void
|
|
||||||
//text_set_char (int n, char *dat)
|
|
||||||
//{
|
|
||||||
//// printf("Set Character %i\n", n);
|
|
||||||
//}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
// Draws a vertical bar; erases entire column onscreen.
|
|
||||||
//
|
|
||||||
MODULE_EXPORT void
|
|
||||||
text_vbar (Driver *drvthis, int x, int y, int len, int promille, int options)
|
|
||||||
{
|
|
||||||
int pos;
|
|
||||||
|
|
||||||
for ( pos=0; pos<len; pos++ ) {
|
|
||||||
if( 2 * pos < ((long) promille * len / 500 + 1) ) {
|
|
||||||
text_chr (drvthis, x, y-pos, '|');
|
|
||||||
} else {
|
|
||||||
; /* print nothing */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
// Draws a horizontal bar to the right.
|
|
||||||
//
|
|
||||||
MODULE_EXPORT void
|
|
||||||
text_hbar (Driver *drvthis, int x, int y, int len, int promille, int options)
|
|
||||||
{
|
|
||||||
int pos;
|
|
||||||
|
|
||||||
for ( pos=0; pos<len; pos++ ) {
|
|
||||||
if( 2 * pos < ((long) promille * len / 500 + 1) ) {
|
|
||||||
text_chr (drvthis, x+pos, y, '-');
|
|
||||||
} else {
|
|
||||||
; /* print nothing */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user