From 82ab2a3331096b87a13c6ccad54cfa69f73bc941 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sat, 23 Aug 2008 03:23:54 +0000 Subject: [PATCH] metrics to toggle each page of bookkeeping --- .../Graphics/ScreenEvaluation StageAward.lua | 2 +- stepmania/Themes/default/metrics.ini | 5 ++ stepmania/src/ScreenBookkeeping.cpp | 53 +++++++++++++------ stepmania/src/ScreenBookkeeping.h | 18 +++++-- 4 files changed, 57 insertions(+), 21 deletions(-) diff --git a/stepmania/Themes/default/Graphics/ScreenEvaluation StageAward.lua b/stepmania/Themes/default/Graphics/ScreenEvaluation StageAward.lua index 10d73c4b53..7c10d9fbcf 100644 --- a/stepmania/Themes/default/Graphics/ScreenEvaluation StageAward.lua +++ b/stepmania/Themes/default/Graphics/ScreenEvaluation StageAward.lua @@ -1,5 +1,5 @@ return LoadFont( "_venacti bold 15" ) .. { - InitCommand=cmd(strokecolor,color("#e6ffff");diffusetopedge,color("#007fa8");diffusebottomedge,color("#2fbbdc");shadowlength,0;maxwidth,140;glowshift;); + InitCommand=cmd(strokecolor,color("#e6ffff");diffusetopedge,color("#007fa8");diffusebottomedge,color("#2fbbdc");shadowlength,0;maxwidth,144;glowshift;); SetCommand=function(self,param) self:settext( StageAwardToLocalizedString(param.StageAward) ); end diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index ec33ba7f67..01d4232379 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -2410,6 +2410,11 @@ Fallback="ScreenOptionsServiceChild" NextScreen="ScreenOptionsService" PrevScreen="ScreenOptionsService" HelpText=ScreenString("HelpTextBookkeeping") +ShowSongPlays=true +ShowLastDays=true +ShowLastWeeks=true +ShowDayOfWeek=true +ShowHourOfDay=true AllTimeX=SCREEN_CENTER_X AllTimeY=110 AllTimeOnCommand=zoom,0.7;diffuseshift;effectcolor1,0.5,0.5,0.5,1 diff --git a/stepmania/src/ScreenBookkeeping.cpp b/stepmania/src/ScreenBookkeeping.cpp index 17f44b7fb4..d1c0343f97 100644 --- a/stepmania/src/ScreenBookkeeping.cpp +++ b/stepmania/src/ScreenBookkeeping.cpp @@ -14,6 +14,15 @@ #include "ProfileManager.h" #include "Profile.h" +static const char *BookkeepingViewNames[] = { + "SongPlays", + "LastDays", + "LastWeeks", + "DayOfWeek", + "HourOfDay", +}; +XToString( BookkeepingView ); + REGISTER_SCREEN_CLASS( ScreenBookkeeping ); @@ -41,12 +50,20 @@ void ScreenBookkeeping::Init() this->AddChild( &m_textData[i] ); } - ChangeView( (View)0 ); + FOREACH_ENUM( BookkeepingView, i ) + { + if( THEME->GetMetricB(m_sName,"Show"+BookkeepingViewToString(i)) ) + m_vBookkeepingViews.push_back( i ); + } + + m_iViewIndex = 0; + + UpdateView(); } void ScreenBookkeeping::Update( float fDelta ) { - ChangeView( m_View ); // refresh so that counts change in real-time + UpdateView(); // refresh so that counts change in real-time ScreenWithMenuElements::Update( fDelta ); } @@ -61,16 +78,18 @@ void ScreenBookkeeping::Input( const InputEventPlus &input ) void ScreenBookkeeping::MenuLeft( const InputEventPlus &input ) { - m_View = enum_add2( m_View, -1 ); - ENUM_CLAMP( m_View, View(0), View(NUM_VIEWS-1) ); - ChangeView( m_View ); + m_iViewIndex--; + CLAMP( m_iViewIndex, 0, m_vBookkeepingViews.size()-1 ); + + UpdateView(); } void ScreenBookkeeping::MenuRight( const InputEventPlus &input ) { - m_View = enum_add2( m_View, +1 ); - ENUM_CLAMP( m_View, View(0), View(NUM_VIEWS-1) ); - ChangeView( m_View ); + m_iViewIndex++; + CLAMP( m_iViewIndex, 0, m_vBookkeepingViews.size()-1 ); + + UpdateView(); } void ScreenBookkeeping::MenuStart( const InputEventPlus &input ) @@ -93,7 +112,7 @@ void ScreenBookkeeping::MenuBack( const InputEventPlus &input ) void ScreenBookkeeping::MenuCoin( const InputEventPlus &input ) { - ChangeView( m_View ); + UpdateView(); Screen::MenuCoin( input ); } @@ -104,9 +123,9 @@ static LocalizedString LAST_DAYS ( "ScreenBookkeeping", "Coin Data of Last %d Da static LocalizedString LAST_WEEKS ( "ScreenBookkeeping", "Coin Data of Last %d Weeks" ); static LocalizedString DAY_OF_WEEK ( "ScreenBookkeeping", "Coin Data by Day of Week, All-Time" ); static LocalizedString HOUR_OF_DAY ( "ScreenBookkeeping", "Coin Data by Hour of Day, All-Time" ); -void ScreenBookkeeping::ChangeView( View newView ) +void ScreenBookkeeping::UpdateView() { - m_View = newView; + BookkeepingView view = m_vBookkeepingViews[m_iViewIndex]; { @@ -116,9 +135,9 @@ void ScreenBookkeeping::ChangeView( View newView ) m_textAllTime.SetText( s ); } - switch( m_View ) + switch( view ) { - case View_SongsPlays: + case BookkeepingView_SongPlays: { Profile *pProfile = PROFILEMAN->GetMachineProfile(); @@ -159,7 +178,7 @@ void ScreenBookkeeping::ChangeView( View newView ) } } break; - case VIEW_LAST_DAYS: + case BookkeepingView_LastDays: { m_textTitle.SetText( ssprintf(LAST_DAYS.GetValue(), NUM_LAST_DAYS) ); @@ -186,7 +205,7 @@ void ScreenBookkeeping::ChangeView( View newView ) m_textData[3].SetText( sData ); } break; - case VIEW_LAST_WEEKS: + case BookkeepingView_LastWeeks: { m_textTitle.SetText( ssprintf(LAST_WEEKS.GetValue(), NUM_LAST_WEEKS) ); @@ -208,7 +227,7 @@ void ScreenBookkeeping::ChangeView( View newView ) } } break; - case VIEW_DAY_OF_WEEK: + case BookkeepingView_DayOfWeek: { m_textTitle.SetText( DAY_OF_WEEK ); @@ -230,7 +249,7 @@ void ScreenBookkeeping::ChangeView( View newView ) m_textData[3].SetText( sData ); } break; - case VIEW_HOUR_OF_DAY: + case BookkeepingView_HourOfDay: { m_textTitle.SetText( HOUR_OF_DAY ); diff --git a/stepmania/src/ScreenBookkeeping.h b/stepmania/src/ScreenBookkeeping.h index e6c0ffe7ea..4d05b21fdb 100644 --- a/stepmania/src/ScreenBookkeeping.h +++ b/stepmania/src/ScreenBookkeeping.h @@ -8,6 +8,17 @@ const int NUM_BOOKKEEPING_COLS = 4; +enum BookkeepingView +{ + BookkeepingView_SongPlays, + BookkeepingView_LastDays, + BookkeepingView_LastWeeks, + BookkeepingView_DayOfWeek, + BookkeepingView_HourOfDay, + NUM_BookkeepingView, + BookkeepingView_Invalid, +}; + class ScreenBookkeeping : public ScreenWithMenuElements { public: @@ -25,11 +36,12 @@ public: private: virtual bool GenericTweenOn() const { return true; } virtual bool GenericTweenOff() const { return true; } - enum View { View_SongsPlays, VIEW_LAST_DAYS, VIEW_LAST_WEEKS, VIEW_DAY_OF_WEEK, VIEW_HOUR_OF_DAY, NUM_VIEWS }; - void ChangeView( View newView ); + void UpdateView(); + + int m_iViewIndex; + vector m_vBookkeepingViews; - View m_View; BitmapText m_textAllTime; BitmapText m_textTitle; BitmapText m_textData[NUM_BOOKKEEPING_COLS];