Changeset 9866c3a for owl.h


Ignore:
Timestamp:
Dec 27, 2007, 11:01:03 AM (16 years ago)
Author:
Alejandro R. Sedeño <asedeno@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
925e122
Parents:
dd24b6a
Message:
Reworked the fmtext format to use in-line formatting.  Characters used
for formatting are part of Unicode Supplemental Private Area-B, or
Plane 16.

fmtext no longer need 5x the text space to store formatting
information, though they are harder to change at arbitrary
points. This was something we hardly ever did anyhow, and we can still
do everything we need to do.

fmtext keeps a pair of colors and a char for default attributes to be
applied when necessary.

Searching is now done inline at owl_fmtext_waddstr() rather than
specifying a section of the string to be reversed.

This probably still needs some cleanup and more comments, but it
works.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • owl.h

    rdd24b6a r9866c3a  
    101101#define OWL_FMTEXT_ATTR_UNDERLINE 4
    102102
     103#define OWL_FMTEXT_UC_BASE 0x100000 /* Unicode Plane 16 - Supplementary Private Use Area-B*/
     104#define OWL_FMTEXT_UC_ATTR ( OWL_FMTEXT_UC_BASE | 0x800 )
     105#define OWL_FMTEXT_UC_ATTR_MASK 0x7
     106#define OWL_FMTEXT_UC_COLOR_BASE ( OWL_FMTEXT_UC_BASE | 0x400 )
     107#define OWL_FMTEXT_UC_FGCOLOR OWL_FMTEXT_UC_COLOR_BASE
     108#define OWL_FMTEXT_UC_BGCOLOR ( OWL_FMTEXT_UC_COLOR_BASE | 0x200 )
     109#define OWL_FMTEXT_UC_DEFAULT_COLOR 0x100
     110#define OWL_FMTEXT_UC_FGDEFAULT ( OWL_FMTEXT_UC_FGCOLOR | OWL_FMTEXT_UC_DEFAULT_COLOR )
     111#define OWL_FMTEXT_UC_BGDEFAULT ( OWL_FMTEXT_UC_BGCOLOR | OWL_FMTEXT_UC_DEFAULT_COLOR )
     112#define OWL_FMTEXT_UC_COLOR_MASK 0xFF
     113#define OWL_FMTEXT_UC_ALLCOLOR_MASK ( OWL_FMTEXT_UC_COLOR_MASK | OWL_FMTEXT_UC_DEFAULT_COLOR | 0x200)
     114#define OWL_FMTEXT_UC_STARTBYTE_UTF8 '\xf4'
     115
     116#define OWL_FMTEXT_UTF8_ATTR_NONE "\xf4\x80\xa0\x80"
     117#define OWL_FMTEXT_UTF8_FGDEFAULT "\xf4\x80\x94\x80"
     118#define OWL_FMTEXT_UTF8_BGDEFAULT "\xf4\x80\x96\x80"
     119
     120
     121
     122
    103123#define OWL_COLOR_BLACK     0
    104124#define OWL_COLOR_RED       1
     
    256276  int bufflen;
    257277  char *textbuff;
    258   char *fmbuff;
    259   short *fgcolorbuff;
    260   short *bgcolorbuff;
     278  char default_attrs;
     279  short default_fgcolor;
     280  short default_bgcolor;
    261281} owl_fmtext;
    262282
Note: See TracChangeset for help on using the changeset viewer.