void VWB_DrawPropString (const id0_char_t id0_far *string, const id0_char_t id0_far *optsend) { id0_int_t x,y; x = px+pansx; y = py+pansy; VW_DrawPropString (string,optsend); VW_MarkUpdateBlock(x,y,x+bufferwidth*8-1,y+bufferheight-1); }
void HandleWord() { signed char words[WORDLIMIT]; int wordindex; word wwidth, wheight, newpos; // // copy the next word into words[] // words[0] = *text++; wordindex = 1; while (*text>32) { words[wordindex] = *text++; if (++wordindex == WORDLIMIT) Quit ("PageLayout: Word limit exceeded"); } words[wordindex] = 0; // stick a null at end for C /* see if it fits on this line */ VW_MeasurePropString(words, &wwidth, &wheight); while (px+wwidth > rightmargin[rowon]) { NewLine (); if (layoutdone) return; // overflowed page } // // print it // newpos = px+wwidth; VW_DrawPropString(words); px = newpos; // // suck up any extra spaces // while (*text == ' ') { px += SPACEWIDTH; text++; } }
void VWB_DrawPropString( const char* string) { VW_DrawPropString(string); }
void PageLayout(boolean shownumber) { int i,oldfontcolor; signed char ch; oldfontcolor = fontcolor; fontcolor = 0; // // clear the screen // VW_Bar(0,0,320,200,BACKCOLOR); VWB_DrawPic(0,0,H_TOPWINDOWPIC); VWB_DrawPic(0,8,H_LEFTWINDOWPIC); VWB_DrawPic(312,8,H_RIGHTWINDOWPIC); VWB_DrawPic(8,176,H_BOTTOMINFOPIC); for (i=0;i<TEXTROWS;i++) { leftmargin[i] = LEFTMARGIN; rightmargin[i] = SCREENPIXWIDTH-RIGHTMARGIN; } px = LEFTMARGIN; py = TOPMARGIN; rowon = 0; layoutdone = false; // // make sure we are starting layout text (^P first command) // while (*text <= 32) text++; if (*text != '^' || toupper(*++text) != 'P') Quit ("PageLayout: Text not headed with ^P"); while (*text++ != '\n') ; // // process text stream // do { ch = *text; if (ch == '^') HandleCommand (); else if (ch == 9) { px = (px+8)&0xf8; text++; } else if (ch <= 32) HandleCtrls (); else HandleWord (); } while (!layoutdone); pagenum++; if (shownumber) { strcpy (str,"pg "); itoa (pagenum,str2,10); strcat (str,str2); strcat (str," of "); py = 183; px = 213; itoa (numpages,str2,10); strcat (str,str2); fontcolor = 0x4f; //12^BACKCOLOR; VW_DrawPropString (str); } fontcolor = oldfontcolor; }