Browse Source

pfGUIControlMod's font face => plString

Michael Hansen 11 years ago
parent
commit
262cc65f57
  1. 20
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlMod.cpp
  2. 17
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlMod.h
  3. 12
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.cpp
  4. 8
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.h

20
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlMod.cpp

@ -85,7 +85,7 @@ void pfGUIColorScheme::IReset( void )
fSelForeColor.Set( 1, 1, 1, 1 );
fSelBackColor.Set( 0, 0, 1, 1 );
fTransparent = false;
fFontFace = hsStrcpy( "Times New Roman" );
fFontFace = "Times New Roman";
fFontSize = 10;
fFontFlags = 0;
}
@ -95,11 +95,6 @@ pfGUIColorScheme::pfGUIColorScheme()
IReset();
}
pfGUIColorScheme::~pfGUIColorScheme()
{
delete [] fFontFace;
}
pfGUIColorScheme::pfGUIColorScheme( hsColorRGBA &foreColor, hsColorRGBA &backColor )
{
IReset();
@ -107,20 +102,14 @@ pfGUIColorScheme::pfGUIColorScheme( hsColorRGBA &foreColor, hsColorRGBA &backCol
fBackColor = backColor;
}
pfGUIColorScheme::pfGUIColorScheme( const char *face, uint8_t size, uint8_t fontFlags )
pfGUIColorScheme::pfGUIColorScheme( const plString &face, uint8_t size, uint8_t fontFlags )
{
IReset();
fFontFace = hsStrcpy( face );
fFontFace = face;
fFontSize = size;
fFontFlags = fontFlags;
}
void pfGUIColorScheme::SetFontFace( const char *face )
{
delete [] fFontFace;
fFontFace = hsStrcpy( face );
}
void pfGUIColorScheme::Read( hsStream *s )
{
fForeColor.Read( s );
@ -129,8 +118,7 @@ void pfGUIColorScheme::Read( hsStream *s )
fSelBackColor.Read( s );
fTransparent = s->ReadBOOL();
delete [] fFontFace;
fFontFace = s->ReadSafeString();
fFontFace = s->ReadSafeString_TEMP();
s->ReadLE( &fFontSize );
s->ReadLE( &fFontFlags );
}

17
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlMod.h

@ -74,9 +74,9 @@ class pfGUIColorScheme : public hsRefCnt
hsColorRGBA fSelForeColor, fSelBackColor;
bool fTransparent;
char *fFontFace;
uint8_t fFontSize;
uint8_t fFontFlags;
plString fFontFace;
uint8_t fFontSize;
uint8_t fFontFlags;
enum FontFlags
{
@ -86,18 +86,17 @@ class pfGUIColorScheme : public hsRefCnt
};
pfGUIColorScheme();
~pfGUIColorScheme();
pfGUIColorScheme( hsColorRGBA &foreColor, hsColorRGBA &backColor );
pfGUIColorScheme( const char *face, uint8_t size, uint8_t fontFlags );
pfGUIColorScheme( const plString &face, uint8_t size, uint8_t fontFlags );
void SetFontFace( const char *face );
void SetFontFace(const plString &face) { fFontFace = face; }
void Read( hsStream *s );
void Write( hsStream *s );
bool IsBold( void ) { return ( fFontFlags & kFontBold ) ? true : false; }
bool IsItalic( void ) { return ( fFontFlags & kFontItalic ) ? true : false; }
bool IsShadowed( void ) { return ( fFontFlags & kFontShadowed ) ? true : false; }
bool IsBold() const { return ( fFontFlags & kFontBold ) ? true : false; }
bool IsItalic() const { return ( fFontFlags & kFontItalic ) ? true : false; }
bool IsShadowed() const { return ( fFontFlags & kFontShadowed ) ? true : false; }
protected:

12
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.cpp

@ -349,7 +349,7 @@ void pfGUIMultiLineEditCtrl::IPostSetUpDynTextMap( void )
fFontFlagsSet |= kFontStyleSet;
}
fDynTextMap->SetFont( fFontFace.c_str(), fFontSize, fFontStyle,
fDynTextMap->SetFont( fFontFace, fFontSize, fFontStyle,
HasFlag( kXparentBgnd ) ? false : true );
// Calculate a height for each line
@ -572,7 +572,7 @@ uint32_t pfGUIMultiLineEditCtrl::IRenderLine( uint16_t x, uint16_t y, int32_t s
IFindLastStyleCode( start, currStyle );
fDynTextMap->SetTextColor( currColor, HasFlag( kXparentBgnd ) ? true : false );
fDynTextMap->SetFont( fFontFace.c_str(), fFontSize, GetColorScheme()->fFontFlags | currStyle,
fDynTextMap->SetFont( fFontFace, fFontSize, GetColorScheme()->fFontFlags | currStyle,
HasFlag( kXparentBgnd ) ? false : true );
// Now, start from our start and go to the end and keep eating up as many chunks
@ -609,7 +609,7 @@ uint32_t pfGUIMultiLineEditCtrl::IRenderLine( uint16_t x, uint16_t y, int32_t s
// Read style and switch to that one
IReadStyleCode( pos, currStyle );
if( !dontRender )
fDynTextMap->SetFont( fFontFace.c_str(), fFontSize , GetColorScheme()->fFontFlags | currStyle,
fDynTextMap->SetFont( fFontFace, fFontSize , GetColorScheme()->fFontFlags | currStyle,
HasFlag( kXparentBgnd ) ? false : true );
}
else if( buffer[ pos ] == L'\n' )
@ -1836,11 +1836,11 @@ void pfGUIMultiLineEditCtrl::IHitBeginningOfControlList(int32_t cursorPos)
}
}
void pfGUIMultiLineEditCtrl::SetFontFace(std::string fontFace)
void pfGUIMultiLineEditCtrl::SetFontFace(const plString &fontFace)
{
fFontFace = fontFace;
fFontFlagsSet |= kFontFaceSet;
fDynTextMap->SetFont( fFontFace.c_str(), fFontSize, fFontStyle,
fDynTextMap->SetFont( fFontFace, fFontSize, fFontStyle,
HasFlag( kXparentBgnd ) ? false : true );
fDynTextMap->CalcStringWidth( "The quick brown fox jumped over the lazy dog.", &fLineHeight );
}
@ -1850,7 +1850,7 @@ void pfGUIMultiLineEditCtrl::SetFontSize(uint8_t fontSize)
fFontSize = fontSize;
fFontFlagsSet |= kFontSizeSet;
fCalcedFontSize = fontSize;
fDynTextMap->SetFont( fFontFace.c_str(), fFontSize, fFontStyle,
fDynTextMap->SetFont( fFontFace, fFontSize, fFontStyle,
HasFlag( kXparentBgnd ) ? false : true );
fDynTextMap->CalcStringWidth( "The quick brown fox jumped over the lazy dog.", &fLineHeight );
}

8
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.h

@ -129,10 +129,10 @@ class pfGUIMultiLineEditCtrl : public pfGUIControlMod
pfGUIMultiLineEditProc *fEventProc; // where we send events to
std::string fFontFace;
plString fFontFace;
hsColorRGBA fFontColor;
uint8_t fFontSize;
uint8_t fFontStyle;
uint8_t fFontSize;
uint8_t fFontStyle;
enum flagsSet
{
kFontFaceSet = 1,
@ -271,7 +271,7 @@ class pfGUIMultiLineEditCtrl : public pfGUIControlMod
uint8_t GetFontSize() {return fFontSize;} // because we're too cool to use the color scheme crap
void SetFontFace(std::string fontFace);
void SetFontFace(const plString &fontFace);
void SetFontColor(hsColorRGBA fontColor) {fFontColor = fontColor; fFontFlagsSet |= kFontColorSet;}
void SetFontSize(uint8_t fontSize);
void SetFontStyle(uint8_t fontStyle) {fFontStyle = fontStyle; fFontFlagsSet |= kFontStyleSet;}

Loading…
Cancel
Save