Add some initial widget functionality (prefs partly working)

This commit is contained in:
elasota
2020-01-01 20:24:46 -05:00
parent d9b5dd20d6
commit 5fe6218c28
85 changed files with 2131 additions and 1074 deletions

View File

@@ -275,17 +275,17 @@ void GetFirstWordOfString (StringPtr stringIn, StringPtr stringOut)
// font. If the text would exceed our width limit, characters<72>
// are dropped off the end of the string and "<22>" appended.
void CollapseStringToWidth (StringPtr theStr, short wide)
void CollapseStringToWidth (DrawSurface *surface, StringPtr theStr, short wide)
{
short dotsWide;
Boolean tooWide;
dotsWide = StringWidth(PSTR("<EFBFBD>"));
tooWide = StringWidth(theStr) > wide;
dotsWide = surface->MeasureString(PSTR("<EFBFBD>"));
tooWide = surface->MeasureString(theStr) > wide;
while (tooWide)
{
theStr[0]--;
tooWide = ((StringWidth(theStr) + dotsWide) > wide);
tooWide = ((surface->MeasureString(theStr) + dotsWide) > wide);
if (!tooWide)
PasStringConcat(theStr, PSTR("<EFBFBD>"));
}