Dash Lists and Dash Scales (COMPLETE!)

Sorry about the previous mail; it uncontrollably was sent. Damn those emacs (^x^s) keystrokes.

Hello,

I’ve noticed some strange things when using dash Lists and dash scales.


I typed in the example show in the PgSetStrokeDash() help page. It looked something like this inside
a window realized function:


typedef struct {
char *name;
int l;
char *p;
} DashListStruct;

/* NOTE: dash patterns are in octal */

DashListStruct DashList[] = {
“solid”, 0, NULL,
“dotted”, 1, “\1”,
“bigger dots”, 1, “\2”,
“dashed”, 2, “\10\4”,
“long dash”, 2, “\40\4”,
“dash dot dot”, 6, “\40\2\1\2\1\2”,
“long pattern”, 16, “\3\2\5\2\10\2\13\2\15\2\13\2\10\2\5\2”,
“complex”, 7, “\20\1\14\2\11\3\6”,
};
#define DashListNum (sizeof( DashList ) / sizeof( DashListStruct ))
#define DashListCHeight 20
#define DashListWinY (DashListNum*DashListCHeight)


int test( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
widget = widget, apinfo = apinfo, cbinfo = cbinfo;


DashListStruct *DLPtr = DashList;
PhPoint_t p;
int i, y;

PgSetFont( “helv14b” );
PgSetTextColor( Pg_WHITE );
PgSetStrokeColor( Pg_WHITE );
for (y=i=0; i<DashListNum; i++, y+=DashListCHeight, DLPtr++)
{
p.x = 2;
p.y = (short)(y+14);
PgDrawText(DLPtr->name, strlen( DLPtr->name ), &p, 0 );
PgSetStrokeDash((unsigned char *)(DLPtr->p), DLPtr->l, 0x10000 );
PgSetFillDither( Pg_WHITE, Pg_DBLUE, DLPtr->p );
PgDrawILine( 100, y+(DashListCHeight/2), 320, y+(DashListCHeight/2) );
}

return( Pt_CONTINUE );
}


Well, this works fine and dandy, but when you change the DashList[] structure to look like:

DashListStruct DashList[] = {
“solid”, 0, NULL,
“dotted”, 1, “\1”,
“bigger dots”, 1, “\5”,
};


the output of the 2nd and 3rd line are identical (they both have a dash list of “\1”. Any ideas why this happening?
Also, I can work around this by changing the code to:

DashListStruct DashList[] = {
“solid”, 0, NULL,
“dotted”, 1, “\1”,
“bigger dots”, 2, “\5\5”,
};

I have “non-technical” people editing a config file that defines these patterns and I don’t want little caveats here and there
to make things work.

(For example, the following doesn’t work:


DashListStruct DashList[] = {
“solid”, 0, NULL,
“dotted”, 2, “\1\1”,
“bigger dots”, 2, “\5\5”,
};


Any ideas what’s going here?


Thanks.

Tom