diff options
author | Max Horn | 2003-04-30 11:37:10 +0000 |
---|---|---|
committer | Max Horn | 2003-04-30 11:37:10 +0000 |
commit | 42f156ddada4c6f51e1612e9b0f18ec7c9dd9cee (patch) | |
tree | a2b7ba14f7f919987239902e513c1a646ca2e9f8 /backends/PalmOS/Src/extend.cpp | |
parent | 79ebda7613b3280ae644d67af50712deef8819d7 (diff) | |
download | scummvm-rg350-42f156ddada4c6f51e1612e9b0f18ec7c9dd9cee.tar.gz scummvm-rg350-42f156ddada4c6f51e1612e9b0f18ec7c9dd9cee.tar.bz2 scummvm-rg350-42f156ddada4c6f51e1612e9b0f18ec7c9dd9cee.zip |
started to merge in Chrilith's PalmOS port
svn-id: r7219
Diffstat (limited to 'backends/PalmOS/Src/extend.cpp')
-rw-r--r-- | backends/PalmOS/Src/extend.cpp | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/backends/PalmOS/Src/extend.cpp b/backends/PalmOS/Src/extend.cpp new file mode 100644 index 0000000000..6270165acd --- /dev/null +++ b/backends/PalmOS/Src/extend.cpp @@ -0,0 +1,89 @@ +#include <PalmOS.h> +#include "extend.h" +#include "string.h" +#include "palm.h" +/* +//Sony clie PalmOS<5 +void BmpDrawDDBitmap(const FormType *formP, DmResID bitmapID) +{ + MemHandle hTemp; + BitmapType* bmTemp; + Coord x,y; + + hTemp = DmGetResource(bitmapRsc,bitmapID); + bmTemp = (BitmapType*)MemHandleLock(hTemp); + + FrmGetObjectPosition(formP, FrmGetObjectIndex(formP,bitmapID), &x, &y); + HRWinDrawBitmap(gHRrefNum,bmTemp, x*2, y*2); + + MemHandleUnlock(hTemp); + DmReleaseResource(hTemp); + // palmos 5 : need to set the object to usable +} +*/ +UInt16 StrReplace(Char *ioStr, UInt16 inMaxLen, const Char *inParamStr, const Char *fndParamStr) +{ + Char *found; + Boolean quit = false; + UInt16 occurences = 0; + UInt16 newLength; + UInt16 l1 = StrLen(fndParamStr); + UInt16 l2 = 0; + UInt16 l3 = StrLen(ioStr); + UInt16 next = 0; + + if (inParamStr) + l2 = StrLen(inParamStr); // can be null to know how many occur. + + while (((found = StrStr(ioStr+next, fndParamStr)) != NULL) && (!quit)) + { + occurences++; + newLength = (StrLen(ioStr) - l1 + l2); + + if ( newLength > inMaxLen ) + { + quit = true; + occurences--; + } + else if (inParamStr) + { + MemMove(found + l2, found + l1, inMaxLen-(found-ioStr+l2)); + MemMove(found, inParamStr, l2); + next = found - ioStr + l2; + } + else + next = found - ioStr + l1; + } + + if (inParamStr) + ioStr[l3 + l2*occurences - l1*occurences] = 0; + + return occurences; +} + +void WinDrawWarpChars(const Char *chars, Int16 len, Coord x, Coord y, Coord maxWidth) +{ + Char *part = (Char *)chars; + Coord x2 = x; + Int16 next; + + if (part[StrLen(part)-1] == '\n') + part[StrLen(part)-1] = 0; + + part = StrTok(part," "); + + while ( part ) + { + next = FntLineWidth (part, StrLen(part)) + FntLineWidth (" ",1); + if ((x2 + next - x) > maxWidth) + { + x2 = x; + y += FntLineHeight(); + } + //HRWinDrawTruncChars(gHRrefNum, part, StrLen(part), x2, y, maxWidth - (x2-x)); + WinDrawTruncChars(part, StrLen(part), x2, y, maxWidth - (x2-x)); + x2 += next; + + part = StrTok(NULL," "); + } +}
\ No newline at end of file |