LCDproc development and user support list

Text archives Help


[Lcdproc] Title widget... {{ I want my blocks }}}


Chronological Thread 
  • From: reenoo AT gmx.de (Rene Wagner)
  • Subject: [Lcdproc] Title widget... {{ I want my blocks }}}
  • Date: Sun Dec 2 14:06:01 2001

> I've been poking around all day if the code and can't find where the title
> widget is accually put together. I want to change the character used in the
> title from a block to something else.

I wouldn't try to do that in the server code, but in the driver code.
Otherwise you would have a good result with your display, but all the
others wouldn't work properly any more ;) You might at least be interested in
the curses driver ;)

And the right place to change things in the driver code is _chr()

> Could ya lend a guy a hand.

Remember: To those of us who don't have a CFontz display
this is all just try and error! (But w/out testing in between ;)

So what about this:

void
CFontz_chr (int x, int y, char c)
{
y--;
x--;

if (c == -1)
c = 31;
else if (c < 32 && c >= 0)
c += 128;
CFontz->framebuf[(y * CFontz->wid) + x] = c;
}

or this:

void
CFontz_chr (int x, int y, char c)
{
y--;
x--;

if (c == -1)
c = '#';
else if (c < 32 && c >= 0)
c += 128;
CFontz->framebuf[(y * CFontz->wid) + x] = c;
}

or this:

void
CFontz_chr (int x, int y, char c)
{
y--;
x--;

if (c == -1) /*This definitely is the solid block! (-1 equals 255)*/
c = 31; /*or c = '#'; or whatever character you like ;)*/
CFontz->framebuf[(y * CFontz->wid) + x] = c;
}

The last suggestion would rip the original code out entirely!
I don't understand what it's good for anyway as I haven't read the
specs of the original version of the CFontz displays ;)

If you want to help yourself, (you're the one who's got a CFontz display;)
you should get an ASCII table to see what LCDd sends to the driver,
compare this to the new CFontz cgrom and modify the CFontz_chr() function
according to your needs ;)

BTW: If you've got more than a few chars to map a switch / case function is
probably more effective than multiple if s ;) In C that would be something
like: (taken from the curses driver)

switch (c) {
case 0:
c = icon_char;
break;
case -1: // translates to 255 (ouch!)
c = PAD;
break;
//default:
// normal character...
}

Happy coding!

Rene




Archive powered by MHonArc 2.6.18.

Top of page