Browse Source

Nuke std::wstring from plDynamicTextMsg

Adam Johnson 10 years ago
parent
commit
f2dee21063
  1. 6
      Sources/Plasma/FeatureLib/pfPython/pyDynamicText.cpp
  2. 33
      Sources/Plasma/PubUtilLib/plMessage/plDynamicTextMsg.cpp
  3. 9
      Sources/Plasma/PubUtilLib/plMessage/plDynamicTextMsg.h

6
Sources/Plasma/FeatureLib/pfPython/pyDynamicText.cpp

@ -298,11 +298,11 @@ void pyDynamicText::DrawTextW( int16_t x, int16_t y, std::wstring text )
// 2) clip // 2) clip
// 3) just draw // 3) just draw
if ( fWrap ) if ( fWrap )
pMsg->DrawWrappedString(x,y,fWrapWidth,fWrapHeight,text.c_str()); pMsg->DrawWrappedString(x,y,fWrapWidth,fWrapHeight,plString::FromWchar(text.c_str()));
else if ( fClip ) else if ( fClip )
pMsg->DrawClippedString(x,y,fClipLeft,fClipTop,fClipRight,fClipBottom,text.c_str()); pMsg->DrawClippedString(x,y,fClipLeft,fClipTop,fClipRight,fClipBottom,plString::FromWchar(text.c_str()));
else else
pMsg->DrawString(x,y,text.c_str()); pMsg->DrawString(x,y,plString::FromWchar(text.c_str()));
plgDispatch::MsgSend( pMsg ); // whoosh... off it goes plgDispatch::MsgSend( pMsg ); // whoosh... off it goes
} }

33
Sources/Plasma/PubUtilLib/plMessage/plDynamicTextMsg.cpp

@ -112,38 +112,24 @@ void plDynamicTextMsg::FrameRect( uint16_t left, uint16_t top, uint16_t right
fColor = c; fColor = c;
} }
void plDynamicTextMsg::DrawString( int16_t x, int16_t y, const char *text ) void plDynamicTextMsg::DrawString( int16_t x, int16_t y, const plString& text )
{
wchar_t *wString = hsStringToWString(text);
DrawString(x,y,wString);
delete [] wString;
}
void plDynamicTextMsg::DrawString( int16_t x, int16_t y, const wchar_t *text )
{ {
hsAssert( ( fCmd & ( kStringCmds | kPosCmds ) ) == 0, "Attempting to issue conflicting drawText commands" ); hsAssert( ( fCmd & ( kStringCmds | kPosCmds ) ) == 0, "Attempting to issue conflicting drawText commands" );
fCmd &= ~( kStringCmds | kPosCmds ); fCmd &= ~( kStringCmds | kPosCmds );
fCmd |= kDrawString; fCmd |= kDrawString;
fString = plString::FromWchar(text); fString = text;
fX = x; fX = x;
fY = y; fY = y;
} }
void plDynamicTextMsg::DrawClippedString( int16_t x, int16_t y, uint16_t clipLeft, uint16_t clipTop, uint16_t clipRight, uint16_t clipBottom, const char *text ) void plDynamicTextMsg::DrawClippedString( int16_t x, int16_t y, uint16_t clipLeft, uint16_t clipTop, uint16_t clipRight, uint16_t clipBottom, const plString& text )
{
wchar_t *wString = hsStringToWString(text);
DrawClippedString(x,y,clipLeft,clipTop,clipRight,clipBottom,wString);
delete [] wString;
}
void plDynamicTextMsg::DrawClippedString( int16_t x, int16_t y, uint16_t clipLeft, uint16_t clipTop, uint16_t clipRight, uint16_t clipBottom, const wchar_t *text )
{ {
hsAssert( ( fCmd & ( kStringCmds | kPosCmds | kRectCmds ) ) == 0, "Attempting to issue conflicting drawText commands" ); hsAssert( ( fCmd & ( kStringCmds | kPosCmds | kRectCmds ) ) == 0, "Attempting to issue conflicting drawText commands" );
fCmd &= ~( kStringCmds | kPosCmds | kRectCmds ); fCmd &= ~( kStringCmds | kPosCmds | kRectCmds );
fCmd |= kDrawClippedString; fCmd |= kDrawClippedString;
fString = plString::FromWchar(text); fString = text;
fX = x; fX = x;
fY = y; fY = y;
@ -153,20 +139,13 @@ void plDynamicTextMsg::DrawClippedString( int16_t x, int16_t y, uint16_t clip
fBottom = clipBottom; fBottom = clipBottom;
} }
void plDynamicTextMsg::DrawWrappedString( int16_t x, int16_t y, uint16_t wrapWidth, uint16_t wrapHeight, const char *text ) void plDynamicTextMsg::DrawWrappedString( int16_t x, int16_t y, uint16_t wrapWidth, uint16_t wrapHeight, const plString& text )
{
wchar_t *wString = hsStringToWString(text);
DrawWrappedString(x,y,wrapWidth,wrapHeight,wString);
delete [] wString;
}
void plDynamicTextMsg::DrawWrappedString( int16_t x, int16_t y, uint16_t wrapWidth, uint16_t wrapHeight, const wchar_t *text )
{ {
hsAssert( ( fCmd & ( kStringCmds | kPosCmds | kRectCmds ) ) == 0, "Attempting to issue conflicting drawText commands" ); hsAssert( ( fCmd & ( kStringCmds | kPosCmds | kRectCmds ) ) == 0, "Attempting to issue conflicting drawText commands" );
fCmd &= ~( kStringCmds | kPosCmds | kRectCmds ); fCmd &= ~( kStringCmds | kPosCmds | kRectCmds );
fCmd |= kDrawWrappedString; fCmd |= kDrawWrappedString;
fString = plString::FromWchar(text); fString = text;
fX = x; fX = x;
fY = y; fY = y;

9
Sources/Plasma/PubUtilLib/plMessage/plDynamicTextMsg.h

@ -128,12 +128,9 @@ public:
void SetLineSpacing( int16_t spacing ); void SetLineSpacing( int16_t spacing );
void FillRect( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, hsColorRGBA &c ); void FillRect( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, hsColorRGBA &c );
void FrameRect( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, hsColorRGBA &c ); void FrameRect( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, hsColorRGBA &c );
void DrawString( int16_t x, int16_t y, const char *text ); void DrawString( int16_t x, int16_t y, const plString& text );
void DrawString( int16_t x, int16_t y, const wchar_t *text ); void DrawClippedString( int16_t x, int16_t y, uint16_t clipLeft, uint16_t clipTop, uint16_t clipRight, uint16_t clipBottom, const plString& text );
void DrawClippedString( int16_t x, int16_t y, uint16_t clipLeft, uint16_t clipTop, uint16_t clipRight, uint16_t clipBottom, const char *text ); void DrawWrappedString( int16_t x, int16_t y, uint16_t wrapWidth, uint16_t wrapHeight, const plString& text );
void DrawClippedString( int16_t x, int16_t y, uint16_t clipLeft, uint16_t clipTop, uint16_t clipRight, uint16_t clipBottom, const wchar_t *text );
void DrawWrappedString( int16_t x, int16_t y, uint16_t wrapWidth, uint16_t wrapHeight, const char *text );
void DrawWrappedString( int16_t x, int16_t y, uint16_t wrapWidth, uint16_t wrapHeight, const wchar_t *text );
void DrawImage( int16_t x, int16_t y, plKey &image, bool respectAlpha = false ); void DrawImage( int16_t x, int16_t y, plKey &image, bool respectAlpha = false );
void DrawClippedImage( int16_t x, int16_t y, plKey &image, uint16_t clipX, uint16_t clipY, uint16_t clipWidth, uint16_t clipHeight, bool respectAlpha = false ); void DrawClippedImage( int16_t x, int16_t y, plKey &image, uint16_t clipX, uint16_t clipY, uint16_t clipWidth, uint16_t clipHeight, bool respectAlpha = false );
void SetJustify( uint8_t justifyFlags ); void SetJustify( uint8_t justifyFlags );

Loading…
Cancel
Save