add cell size functions, harmonize chardef stuff

This commit is contained in:
marschap
2006-04-25 18:23:31 +00:00
parent ffd0ecf48c
commit f121223845
2 changed files with 237 additions and 197 deletions
+235 -197
View File
@@ -45,26 +45,26 @@
#include "report.h" #include "report.h"
#include "lcd_lib.h" #include "lcd_lib.h"
#define b______ 0x00 #define b_______ 0x00
#define b____X_ 0x03 #define b_____X_ 0x03
#define b____XX 0x03 #define b_____XX 0x03
#define b___X__ 0x04 #define b____X__ 0x04
#define b___XX_ 0x06 #define b____XX_ 0x06
#define b__X___ 0x08 #define b___X___ 0x08
#define b__XX__ 0x09 #define b___XX__ 0x09
#define b__X_X_ 0x0A #define b___X_X_ 0x0A
#define b__XXX_ 0x0E #define b___XXX_ 0x0E
#define b__XXXX 0x0F #define b___XXXX 0x0F
#define b_X____ 0x10 #define b__X____ 0x10
#define b_X___X 0x11 #define b__X___X 0x11
#define b_X_X_X 0x15 #define b__X_X_X 0x15
#define b_X_XX_ 0x16 #define b__X_XX_ 0x16
#define b_XX___ 0x18 #define b__XX___ 0x18
#define b_XX_XX 0x1B #define b__XX_XX 0x1B
#define b_XXX__ 0x1C #define b__XXX__ 0x1C
#define b_XXX_X 0x1D #define b__XXX_X 0x1D
#define b_XXXX_ 0x1E #define b__XXXX_ 0x1E
#define b_XXXXX 0x1F #define b__XXXXX 0x1F
@@ -430,6 +430,7 @@ PrivateData *p;
return 0; return 0;
} }
/****************************************************** /******************************************************
* API: Clean-up * API: Clean-up
*/ */
@@ -466,6 +467,7 @@ PrivateData *p = drvthis->private_data;
debug(RPT_DEBUG, "%s: closed", drvthis->name); debug(RPT_DEBUG, "%s: closed", drvthis->name);
} }
/****************************************************** /******************************************************
* API: Returns the display's width * API: Returns the display's width
*/ */
@@ -479,6 +481,7 @@ PrivateData *p = drvthis->private_data;
return p->width; return p->width;
} }
/****************************************************** /******************************************************
* API: Returns the display's height * API: Returns the display's height
*/ */
@@ -493,6 +496,34 @@ PrivateData *p = drvthis->private_data;
} }
/******************************************************
* API: Returns the display's character cell width
*/
MODULE_EXPORT int
IOWarrior_cellwidth(Driver *drvthis)
{
PrivateData *p = drvthis->private_data;
debug(RPT_DEBUG, "%s: returning cellwidth", drvthis->name);
return p->cellwidth;
}
/******************************************************
* API: Returns the display's character cell height
*/
MODULE_EXPORT int
IOWarrior_cellheight(Driver *drvthis)
{
PrivateData *p = drvthis->private_data;
debug(RPT_DEBUG, "%s: returning cellheight", drvthis->name);
return p->cellheight;
}
/****************************************************** /******************************************************
* API: Send what we have to the hardware * API: Send what we have to the hardware
*/ */
@@ -647,7 +678,7 @@ IOWarrior_init_vbar(Driver *drvthis)
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
if (p->ccmode != vbar) { if (p->ccmode != vbar) {
unsigned char vBar[CELLHEIGHT]; unsigned char vBar[p->cellheight];
int i; int i;
if (p->ccmode != standard) { if (p->ccmode != standard) {
@@ -660,8 +691,9 @@ PrivateData *p = drvthis->private_data;
memset(vBar, 0x00, sizeof(vBar)); memset(vBar, 0x00, sizeof(vBar));
for (i = 1; i < 8; i++) { for (i = 1; i < p->cellheight; i++) {
vBar[8-i] = 0xFF; // add pixel line per pixel line ...
vBar[p->cellheight - i] = 0xFF;
IOWarrior_set_char(drvthis, i, vBar); IOWarrior_set_char(drvthis, i, vBar);
} }
} }
@@ -677,7 +709,7 @@ IOWarrior_init_hbar(Driver *drvthis)
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
if (p->ccmode != hbar) { if (p->ccmode != hbar) {
unsigned char hBar[CELLHEIGHT]; unsigned char hBar[p->cellheight];
int i; int i;
if (p->ccmode != standard) { if (p->ccmode != standard) {
@@ -689,8 +721,9 @@ PrivateData *p = drvthis->private_data;
p->ccmode = hbar; p->ccmode = hbar;
for (i = 1; i <= CELLWIDTH; i++) { for (i = 1; i <= p->cellwidth; i++) {
memset(hBar, 0xFF & ~((1 << (CELLWIDTH-i)) - 1), sizeof(hBar)); // fill pixel columns from left to right.
memset(hBar, 0xFF & ~((1 << (p->cellwidth - i)) - 1), sizeof(hBar));
IOWarrior_set_char(drvthis, i, hBar); IOWarrior_set_char(drvthis, i, hBar);
} }
} }
@@ -746,79 +779,80 @@ static void
IOWarrior_init_num(Driver *drvthis) IOWarrior_init_num(Driver *drvthis)
{ {
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
unsigned char bignum_ccs[8][CELLHEIGHT] = { unsigned char bignum_ccs[8][CELLHEIGHT] = {
[0] [0]
{ b_XX___, { b__XX___,
b_XX___, b__XX___,
b_XX___, b__XX___,
b_XX___, b__XX___,
b______, b_______,
b______, b_______,
b______, b_______,
b______ }, b_______ },
[1] [1]
{ b____XX, { b_____XX,
b____XX, b_____XX,
b____XX, b_____XX,
b____XX, b_____XX,
b_XX___, b__XX___,
b_XX___, b__XX___,
b_XX___, b__XX___,
b_XX___ }, b__XX___ },
[2] [2]
{ b_XX_XX, { b__XX_XX,
b_XX_XX, b__XX_XX,
b_XX_XX, b__XX_XX,
b_XX_XX, b__XX_XX,
b______, b_______,
b______, b_______,
b______, b_______,
b______ }, b_______ },
[3] [3]
{ b______, { b_______,
b______, b_______,
b______, b_______,
b______, b_______,
b_XX___, b__XX___,
b_XX___, b__XX___,
b_XX___, b__XX___,
b_XX___ }, b__XX___ },
[4] [4]
{ b_XX___, { b__XX___,
b_XX___, b__XX___,
b_XX___, b__XX___,
b_XX___, b__XX___,
b____XX, b_____XX,
b____XX, b_____XX,
b____XX, b_____XX,
b____XX }, b_____XX },
[5] [5]
{ b______, { b_______,
b______, b_______,
b______, b_______,
b______, b_______,
b_XX_XX, b__XX_XX,
b_XX_XX, b__XX_XX,
b_XX_XX, b__XX_XX,
b_XX_XX }, b__XX_XX },
[6] [6]
{ b_XX___, { b__XX___,
b_XX___, b__XX___,
b_XX___, b__XX___,
b_XX___, b__XX___,
b_XX___, b__XX___,
b_XX___, b__XX___,
b_XX___, b__XX___,
b_XX___ }, b__XX___ },
[7] [7]
{ b____XX, { b_____XX,
b____XX, b_____XX,
b____XX, b_____XX,
b____XX, b_____XX,
b______, b_______,
b______, b_______,
b______, b_______,
b______ } b_______ }
}; };
if (p->ccmode != bignum) { if (p->ccmode != bignum) {
@@ -986,7 +1020,7 @@ MODULE_EXPORT void
IOWarrior_set_char(Driver *drvthis, int n, unsigned char *dat) IOWarrior_set_char(Driver *drvthis, int n, unsigned char *dat)
{ {
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
unsigned char mask = (1 << p->cellwidth) - 1;
int row; int row;
if ((n < 0) || (n >= NUM_CCs)) if ((n < 0) || (n >= NUM_CCs))
@@ -998,7 +1032,7 @@ int row;
int letter = 0; int letter = 0;
if (p->lastline || (row < p->cellheight - 1)) if (p->lastline || (row < p->cellheight - 1))
letter = dat[row] & 0x1F; letter = dat[row] & mask;
if (p->cc[n].cache[row] != letter) if (p->cc[n].cache[row] != letter)
p->cc[n].clean = 0; /* only mark dirty if really different */ p->cc[n].clean = 0; /* only mark dirty if really different */
@@ -1013,123 +1047,127 @@ int row;
MODULE_EXPORT int MODULE_EXPORT int
IOWarrior_icon(Driver *drvthis, int x, int y, int icon) IOWarrior_icon(Driver *drvthis, int x, int y, int icon)
{ {
static unsigned char block_filled[] =
{ b_XXXXX,
b_XXXXX,
b_XXXXX,
b_XXXXX,
b_XXXXX,
b_XXXXX,
b_XXXXX,
b_XXXXX };
static unsigned char heart_open[] = static unsigned char heart_open[] =
{ b_XXXXX, { b__XXXXX,
b_X_X_X, b__X_X_X,
b______, b_______,
b______, b_______,
b______, b_______,
b_X___X, b__X___X,
b_XX_XX, b__XX_XX,
b_XXXXX }; b__XXXXX };
static unsigned char heart_filled[] = static unsigned char heart_filled[] =
{ b_XXXXX, { b__XXXXX,
b_X_X_X, b__X_X_X,
b__X_X_, b___X_X_,
b__XXX_, b___XXX_,
b__XXX_, b___XXX_,
b_X_X_X, b__X_X_X,
b_XX_XX, b__XX_XX,
b_XXXXX }; b__XXXXX };
static unsigned char arrow_up[] = static unsigned char arrow_up[] =
{ b___X__, { b____X__,
b__XXX_, b___XXX_,
b_X_X_X, b__X_X_X,
b___X__, b____X__,
b___X__, b____X__,
b___X__, b____X__,
b___X__, b____X__,
b______ }; b_______ };
static unsigned char arrow_down[] = static unsigned char arrow_down[] =
{ b___X__, { b____X__,
b___X__, b____X__,
b___X__, b____X__,
b___X__, b____X__,
b_X_X_X, b__X_X_X,
b__XXX_, b___XXX_,
b___X__, b____X__,
b______ }; b_______ };
/*
static unsigned char arrow_left[] = static unsigned char arrow_left[] =
{ b______, { b_______,
b___X__, b____X__,
b__X___, b___X___,
b_XXXXX, b__XXXXX,
b__X___, b___X___,
b___X__, b____X__,
b______, b_______,
b______ }; b_______ };
static unsigned char arrow_right[] = static unsigned char arrow_right[] =
{ b______, { b_______,
b___X__, b____X__,
b____X_, b_____X_,
b_XXXXX, b__XXXXX,
b____X_, b_____X_,
b___X__, b____X__,
b______, b_______,
b______ }; b_______ };
*/
static unsigned char checkbox_off[] = static unsigned char checkbox_off[] =
{ b______, { b_______,
b______, b_______,
b_XXXXX, b__XXXXX,
b_X___X, b__X___X,
b_X___X, b__X___X,
b_X___X, b__X___X,
b_XXXXX, b__XXXXX,
b______ }; b_______ };
static unsigned char checkbox_on[] = static unsigned char checkbox_on[] =
{ b___X__, { b____X__,
b___X__, b____X__,
b_XXX_X, b__XXX_X,
b_X_XX_, b__X_XX_,
b_X_X_X, b__X_X_X,
b_X___X, b__X___X,
b_XXXXX, b__XXXXX,
b______ }; b_______ };
static unsigned char checkbox_gray[] = static unsigned char checkbox_gray[] =
{ b______, { b_______,
b______, b_______,
b_XXXXX, b__XXXXX,
b_X_X_X, b__X_X_X,
b_XX_XX, b__XX_XX,
b_X_X_X, b__X_X_X,
b_XXXXX, b__XXXXX,
b______ }; b_______ };
/*
static unsigned char selector_left[] = static unsigned char selector_left[] =
{ b__X___, { b___X___,
b__XX__, b___XX__,
b__XXX_, b___XXX_,
b__XXXX, b___XXXX,
b__XXX_, b___XXX_,
b__XX__, b___XX__,
b__X___, b___X___,
b______ }; b_______ };
static unsigned char selector_right[] = static unsigned char selector_right[] =
{ b____X_, { b_____X_,
b___XX_, b____XX_,
b__XXX_, b___XXX_,
b_XXXX_, b__XXXX_,
b__XXX_, b___XXX_,
b___XX_, b____XX_,
b____X_, b_____X_,
b______ }; b_______ };
static unsigned char ellipsis[] = static unsigned char ellipsis[] =
{ b______, { b_______,
b______, b_______,
b______, b_______,
b______, b_______,
b______, b_______,
b______, b_______,
b_X_X_X, b__X_X_X,
b______ }; b_______ };
*/
static unsigned char block_filled[] =
{ b__XXXXX,
b__XXXXX,
b__XXXXX,
b__XXXXX,
b__XXXXX,
b__XXXXX,
b__XXXXX,
b__XXXXX };
/* Yes we know, this is a VERY BAD implementation */ /* Yes we know, this is a VERY BAD implementation */
switch (icon) { switch (icon) {
+2
View File
@@ -120,6 +120,8 @@ MODULE_EXPORT char *symbol_prefix = "IOWarrior_";
MODULE_EXPORT int IOWarrior_init(Driver *drvthis); MODULE_EXPORT int IOWarrior_init(Driver *drvthis);
MODULE_EXPORT void IOWarrior_close(Driver *drvthis); MODULE_EXPORT void IOWarrior_close(Driver *drvthis);
MODULE_EXPORT int IOWarrior_width(Driver *drvthis); MODULE_EXPORT int IOWarrior_width(Driver *drvthis);
MODULE_EXPORT int IOWarrior_cellheight(Driver *drvthis);
MODULE_EXPORT int IOWarrior_cellwidth(Driver *drvthis);
MODULE_EXPORT int IOWarrior_height(Driver *drvthis); MODULE_EXPORT int IOWarrior_height(Driver *drvthis);
MODULE_EXPORT void IOWarrior_clear(Driver *drvthis); MODULE_EXPORT void IOWarrior_clear(Driver *drvthis);
MODULE_EXPORT void IOWarrior_chr(Driver *drvthis, int x, int y, char c); MODULE_EXPORT void IOWarrior_chr(Driver *drvthis, int x, int y, char c);