move Font load for item length testing inside of OptionsRow

This commit is contained in:
Chris Danford
2005-02-25 16:52:33 +00:00
parent d004d5cbfa
commit 03e3ba7609
3 changed files with 7 additions and 11 deletions
+7 -1
View File
@@ -5,6 +5,8 @@
#include "Font.h" #include "Font.h"
#include "Foreach.h" #include "Foreach.h"
#include "OptionRowHandler.h" #include "OptionRowHandler.h"
#include "FontManager.h"
#include "Font.h"
static const CString SelectTypeNames[NUM_SELECT_TYPES] = { static const CString SelectTypeNames[NUM_SELECT_TYPES] = {
"SelectOne", "SelectOne",
@@ -132,7 +134,6 @@ void OptionRow::LoadNormal( const OptionRowDefinition &def, OptionRowHandler *pH
} }
void OptionRow::AfterImportOptions( void OptionRow::AfterImportOptions(
Font* pFont,
const CString &sTitle, const CString &sTitle,
float fY float fY
) )
@@ -199,6 +200,8 @@ void OptionRow::AfterImportOptions(
// If the items will go off the edge of the screen, then re-init with the "long row" style. // If the items will go off the edge of the screen, then re-init with the "long row" style.
{ {
Font* pFont = FONT->LoadFont( THEME->GetPathF(m_sType,"item") );
float fX = ITEMS_START_X; float fX = ITEMS_START_X;
for( unsigned c=0; c<m_RowDef.choices.size(); c++ ) for( unsigned c=0; c<m_RowDef.choices.size(); c++ )
@@ -217,6 +220,9 @@ void OptionRow::AfterImportOptions(
break; break;
} }
} }
FONT->UnloadFont( pFont );
pFont = NULL;
} }
// //
-2
View File
@@ -9,7 +9,6 @@
#include "OptionIcon.h" #include "OptionIcon.h"
#include "ThemeMetric.h" #include "ThemeMetric.h"
class Font;
class OptionRowHandler; class OptionRowHandler;
enum SelectType enum SelectType
@@ -93,7 +92,6 @@ public:
int ExportOptions(); int ExportOptions();
void AfterImportOptions( void AfterImportOptions(
Font* pFont,
const CString &sTitle, const CString &sTitle,
float fY float fY
); );
-8
View File
@@ -15,8 +15,6 @@
#include "Style.h" #include "Style.h"
#include "ScreenDimensions.h" #include "ScreenDimensions.h"
#include "Command.h" #include "Command.h"
#include "FontManager.h"
#include "Font.h"
/* /*
@@ -144,8 +142,6 @@ void ScreenOptions::InitMenu( InputMode im, const vector<OptionRowDefinition> &v
m_bShowUnderlines = bShowUnderlines; m_bShowUnderlines = bShowUnderlines;
Font* pFont = FONT->LoadFont( THEME->GetPathF(m_sName,"item") );
for( unsigned r=0; r<vDefs.size(); r++ ) // foreach row for( unsigned r=0; r<vDefs.size(); r++ ) // foreach row
{ {
m_Rows.push_back( new OptionRow() ); m_Rows.push_back( new OptionRow() );
@@ -165,15 +161,11 @@ void ScreenOptions::InitMenu( InputMode im, const vector<OptionRowDefinition> &v
const float fY = ROW_Y.GetValue( pos ); const float fY = ROW_Y.GetValue( pos );
row.AfterImportOptions( row.AfterImportOptions(
pFont,
GetExplanationTitle( r ), GetExplanationTitle( r ),
fY fY
); );
} }
FONT->UnloadFont( pFont );
pFont = NULL;
m_sprPage.Load( THEME->GetPathG(m_sName,"page") ); m_sprPage.Load( THEME->GetPathG(m_sName,"page") );
m_sprPage->SetName( "Page" ); m_sprPage->SetName( "Page" );
SET_XY_AND_ON_COMMAND( m_sprPage ); SET_XY_AND_ON_COMMAND( m_sprPage );