remove unused GroupList and MusicList

This commit is contained in:
AJ Kelly
2010-12-22 12:49:23 -06:00
parent a6cb5fecc6
commit 250e450662
8 changed files with 2 additions and 584 deletions
-262
View File
@@ -1,262 +0,0 @@
#include "global.h"
#include "GroupList.h"
#include "ThemeManager.h"
#include "SongManager.h"
#include "RageLog.h"
#include "ThemeMetric.h"
#include "ActorUtil.h"
/* If this actor is used anywhere other than SelectGroup, we
* can add a setting that changes which metric group we pull
* settings out of, so it can be configured separately. */
static const ThemeMetric<float> START_X ("GroupList","StartX");
static const ThemeMetric<float> START_Y ("GroupList","StartY");
static const ThemeMetric<float> SPACING_X ("GroupList","SpacingX");
static const ThemeMetric<float> SPACING_Y ("GroupList","SpacingY");
const int MAX_GROUPS_ONSCREEN = 7;
GroupList::GroupList()
{
m_iSelection = m_iTop = 0;
}
GroupList::~GroupList()
{
for( unsigned i = 0; i < m_sprButtons.size(); ++i )
{
delete m_sprButtons[i];
delete m_textLabels[i];
delete m_ButtonFrames[i];
}
}
bool GroupList::ItemIsOnScreen( int n ) const
{
const int offset = n - m_iTop;
return offset >= 0 && offset < MAX_GROUPS_ONSCREEN;
}
void GroupList::Load( const vector<RString>& asGroupNames )
{
m_asLabels = asGroupNames;
m_Frame.SetName( "Frame" );
this->AddChild( &m_Frame );
ActorUtil::LoadAllCommands( m_Frame, "GroupList" );
for( unsigned i=0; i < m_asLabels.size(); i++ )
{
Sprite *button = new Sprite;
button->SetName( "Button" );
ActorUtil::LoadAllCommands( *button, "GroupList" );
BitmapText *label = new BitmapText;
label->SetName( "Label" );
ActorUtil::LoadAllCommands( *label, "GroupList" );
ActorFrame *frame = new ActorFrame;
frame->SetName( "ButtonFrame" );
ActorUtil::LoadAllCommands( *frame, "GroupList" );
m_sprButtons.push_back( button );
m_textLabels.push_back( label );
m_ButtonFrames.push_back( frame );
button->Load( THEME->GetPathG("GroupList","bar") );
label->LoadFromFont( THEME->GetPathF("GroupList","label") );
label->SetShadowLength( 2 );
label->SetText( SONGMAN->ShortenGroupName( asGroupNames[i] ) );
frame->AddChild( button );
frame->AddChild( label );
m_Frame.AddChild( frame );
button->SetXY( START_X + i*SPACING_X, START_Y + i*SPACING_Y );
label->SetXY( START_X + i*SPACING_X, START_Y + i*SPACING_Y );
if( i == 0 )
{
label->SetRainbowScroll( true );
}
else
{
label->SetRainbowScroll( false );
label->SetDiffuse( SONGMAN->GetSongGroupColor(asGroupNames[i]) );
}
m_bHidden.push_back( ItemIsOnScreen(i) );
ResetTextSize( i );
}
AfterChange();
}
void GroupList::ResetTextSize( int i )
{
BitmapText *label = m_textLabels[i];
const float fTextWidth = (float)label->GetUnzoomedWidth();
const float fButtonWidth = m_sprButtons[i]->GetZoomedWidth();
float fZoom = fButtonWidth/fTextWidth;
fZoom = min( fZoom, 0.8f );
label->SetZoomX( fZoom );
label->SetZoomY( 0.8f );
}
void GroupList::BeforeChange()
{
m_ButtonFrames[m_iSelection]->PlayCommand( "LoseFocus" );
}
void GroupList::AfterChange()
{
m_Frame.StopTweening();
m_Frame.PlayCommand( "ScrollTween" );
m_Frame.SetY( -m_iTop*SPACING_Y );
for( int i=0; i < (int) m_asLabels.size(); i++ )
{
const bool IsHidden = !ItemIsOnScreen(i);
const bool WasHidden = m_bHidden[i];
if( IsHidden && !WasHidden )
{
m_ButtonFrames[i]->PlayCommand( "HideItem" );
}
else if( !IsHidden && WasHidden )
{
m_ButtonFrames[i]->PlayCommand( "ShowItem" );
ResetTextSize( i );
}
m_bHidden[i] = IsHidden;
}
m_ButtonFrames[m_iSelection]->PlayCommand( "GainFocus" );
}
void GroupList::Up()
{
BeforeChange();
if( m_iSelection == 0 )
SetSelection(m_asLabels.size()-1);
else
SetSelection(m_iSelection-1);
AfterChange();
}
void GroupList::Down()
{
BeforeChange();
SetSelection((m_iSelection+1) % m_asLabels.size());
AfterChange();
}
void GroupList::SetSelection( unsigned sel )
{
BeforeChange();
m_iSelection=sel;
if( (int)m_asLabels.size() <= MAX_GROUPS_ONSCREEN ||
sel <= MAX_GROUPS_ONSCREEN/2 )
m_iTop = 0;
else if ( sel >= m_asLabels.size() - MAX_GROUPS_ONSCREEN/2 )
m_iTop = m_asLabels.size() - MAX_GROUPS_ONSCREEN;
else
m_iTop = sel - MAX_GROUPS_ONSCREEN/2;
/* The current selection must always be visible. */
ASSERT( m_iTop <= m_iSelection );
ASSERT( m_iTop+MAX_GROUPS_ONSCREEN > m_iSelection );
AfterChange();
}
void GroupList::TweenOnScreen()
{
for( int i=0; i < (int) m_asLabels.size(); i++ )
{
const int offset = max(0, i-m_iTop);
m_sprButtons[i]->SetX( 400 );
m_textLabels[i]->SetX( 400 );
m_sprButtons[i]->BeginTweening( 0.1f*offset, TWEEN_ACCELERATE );
m_textLabels[i]->BeginTweening( 0.1f*offset, TWEEN_ACCELERATE );
m_sprButtons[i]->BeginTweening( 0.2f, TWEEN_ACCELERATE );
m_textLabels[i]->BeginTweening( 0.2f, TWEEN_ACCELERATE );
m_sprButtons[i]->SetX( 0 );
m_textLabels[i]->SetX( 0 );
/* If this item isn't visible, hide it and skip tweens. */
if( !ItemIsOnScreen(i) )
{
m_ButtonFrames[i]->PlayCommand( "HideItem" );
m_sprButtons[i]->FinishTweening();
m_textLabels[i]->FinishTweening();
}
}
}
void GroupList::TweenOffScreen()
{
for( int i=m_iTop; i < min(m_iTop+MAX_GROUPS_ONSCREEN, (int) m_asLabels.size()); i++ )
{
const int offset = max(0, i-m_iTop);
if( i == m_iSelection )
{
m_sprButtons[i]->BeginTweening( 1.0f, TWEEN_DECELERATE );
m_textLabels[i]->BeginTweening( 1.0f, TWEEN_DECELERATE );
}
else
{
m_sprButtons[i]->BeginTweening( 0.1f*offset, TWEEN_DECELERATE );
m_textLabels[i]->BeginTweening( 0.1f*offset, TWEEN_DECELERATE );
}
m_sprButtons[i]->BeginTweening( 0.2f, TWEEN_DECELERATE );
m_textLabels[i]->BeginTweening( 0.2f, TWEEN_DECELERATE );
m_sprButtons[i]->SetX( 400 );
m_textLabels[i]->SetX( 400 );
}
}
/*
* (c) 2001-2003 Chris Danford, Glenn Maynard
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
-68
View File
@@ -1,68 +0,0 @@
/* GroupList - Displays a list of groups for SelectGroup. (An old holdover.) */
#ifndef GROUP_LIST_H
#define GROUP_LIST_H
#include "ActorFrame.h"
#include "Sprite.h"
#include "BitmapText.h"
class GroupList: public ActorFrame
{
ActorFrame m_Frame;
vector<Sprite *> m_sprButtons;
vector<BitmapText *> m_textLabels;
vector<ActorFrame *> m_ButtonFrames;
vector<RString> m_asLabels;
vector<bool> m_bHidden;
/* Currently selected label. */
int m_iSelection;
/* Label that's currently at the top of the screen. */
int m_iTop;
void BeforeChange();
void AfterChange();
bool ItemIsOnScreen( int n ) const;
void ResetTextSize( int item );
public:
GroupList();
~GroupList();
void SetSelection(unsigned sel);
int GetSelection() const { return m_iSelection; }
RString GetSelectionName() const { return m_asLabels[m_iSelection]; }
void Up();
void Down();
void Load( const vector<RString>& asGroupNames );
void TweenOffScreen();
void TweenOnScreen();
};
#endif
/*
* (c) 2001-2003 Chris Danford, Glenn Maynard
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
+2 -2
View File
@@ -320,11 +320,11 @@ DifficultyList.cpp DifficultyList.h \
DualScrollBar.cpp DualScrollBar.h \
EditMenu.cpp EditMenu.h FadingBanner.cpp FadingBanner.h \
GradeDisplay.cpp GradeDisplay.h GraphDisplay.cpp GraphDisplay.h \
GrooveRadar.cpp GrooveRadar.h GroupList.cpp GroupList.h HelpDisplay.cpp HelpDisplay.h \
GrooveRadar.cpp GrooveRadar.h HelpDisplay.cpp HelpDisplay.h \
MemoryCardDisplay.cpp MemoryCardDisplay.h \
MenuTimer.cpp MenuTimer.h \
ModIcon.cpp ModIcon.h ModIconRow.cpp ModIconRow.h \
MusicList.cpp MusicList.h MusicWheel.cpp MusicWheel.h \
MusicWheel.cpp MusicWheel.h \
MusicWheelItem.cpp MusicWheelItem.h \
OptionRow.cpp OptionRow.h OptionsCursor.cpp OptionsCursor.h \
PaneDisplay.cpp PaneDisplay.h ScrollBar.cpp ScrollBar.h \
-143
View File
@@ -1,143 +0,0 @@
#include "global.h"
#include "MusicList.h"
#include "ThemeManager.h"
#include "ThemeMetric.h"
#include "RageUtil.h"
#include "Song.h"
#include "ActorUtil.h"
/* If this actor is used anywhere other than SelectGroup, we can add a setting
* that changes which metric group we pull settings out of, so it can be
* configured separately. */
static const ThemeMetric<int> NUM_COLUMNS ("MusicList","NumColumns");
static const ThemeMetric<int> NUM_ROWS ("MusicList","NumRows");
static const ThemeMetric<float> START_X ("MusicList","StartX");
static const ThemeMetric<float> START_Y ("MusicList","StartY");
static const ThemeMetric<float> SPACING_X ("MusicList","SpacingX");
static const ThemeMetric<float> CROP_WIDTH ("MusicList","CropWidth");
MusicList::MusicList()
{
CurGroup = 0;
}
void MusicList::Load()
{
for( int i=0; i<NUM_COLUMNS; i++ )
{
m_textTitles[i].SetName( "Title" );
ActorUtil::LoadAllCommands( m_textTitles[i], "MusicList" );
m_textTitles[i].LoadFromFont( THEME->GetPathF("MusicList","titles") );
m_textTitles[i].SetXY( START_X + i*SPACING_X, START_Y );
m_textTitles[i].PlayCommand( "Init" );
this->AddChild( &m_textTitles[i] );
}
}
void MusicList::AddGroup()
{
m_ContentsText.push_back(group());
}
void MusicList::AddSongsToGroup(const vector<Song*> &Songs)
{
// Generate what text will show in the contents for each group
unsigned group = m_ContentsText.size()-1;
m_ContentsText[group].m_iNumSongsInGroup = Songs.size();
for( int c=0; c<NUM_COLUMNS; c++ ) // foreach col
{
RString sText;
for( int r=0; r<NUM_ROWS; r++ ) // foreach row
{
unsigned iIndex = c*NUM_ROWS + r;
if( iIndex >= Songs.size() )
continue;
if( c == NUM_COLUMNS-1 && r == NUM_ROWS-1 && Songs.size() != unsigned(NUM_COLUMNS*NUM_ROWS) )
{
sText += ssprintf( "%i more.....", int(Songs.size() - NUM_COLUMNS * NUM_ROWS + 1) );
continue;
}
RString sTitle = Songs[iIndex]->GetDisplayFullTitle();
// TODO: Move this crop threshold into a theme metric or make automatic based on column width
if( sTitle.size() > 40 )
sTitle = sTitle.Left( 37 ) + "...";
RString sTrTitle = Songs[iIndex]->GetTranslitFullTitle();
if( sTrTitle.size() > 40 )
sTrTitle = sTrTitle.Left( 37 ) + "...";
/* If the main title isn't complete for this font, and we have a translit,
* use it. */
if(m_textTitles[c].StringWillUseAlternate(sTitle, sTrTitle))
sText += sTrTitle;
else
sText += sTitle;
sText += "\n";
}
m_ContentsText[group].ContentsText[c] = sText;
}
}
/* TODO: tween? */
void MusicList::SetGroupNo(int group)
{
CurGroup = group;
for( int c=0; c<NUM_COLUMNS; c++ )
{
m_textTitles[c].SetText( m_ContentsText[CurGroup].ContentsText[c] );
m_textTitles[c].CropToWidth( int(CROP_WIDTH/m_textTitles[c].GetZoom()) );
}
}
void MusicList::TweenOnScreen()
{
for( int i=0; i<NUM_COLUMNS; i++ )
{
m_textTitles[i].SetDiffuse( RageColor(1,1,1,0) );
m_textTitles[i].BeginTweening( 0.5f );
m_textTitles[i].BeginTweening( 0.5f );
m_textTitles[i].SetDiffuse( RageColor(1,1,1,1) );
}
}
void MusicList::TweenOffScreen()
{
for( int i=0; i<NUM_COLUMNS; i++ )
{
m_textTitles[i].StopTweening();
m_textTitles[i].BeginTweening( 0.7f );
m_textTitles[i].BeginTweening( 0.5f );
m_textTitles[i].SetDiffuse( RageColor(1,1,1,0) );
}
}
/*
* (c) 2001-2003 Chris Danford
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
-69
View File
@@ -1,69 +0,0 @@
/* MusicList - Displays all the songs in a given group. (An artifact from SelectGroup.) */
#ifndef MUSIC_LIST_H
#define MUSIC_LIST_H
#include "ActorFrame.h"
#include "BitmapText.h"
const int MAX_MLIST_COLUMNS = 5;
class Song;
class MusicList : public ActorFrame
{
BitmapText m_textTitles[MAX_MLIST_COLUMNS];
struct group
{
RString ContentsText[MAX_MLIST_COLUMNS];
int m_iNumSongsInGroup;
};
vector<group> m_ContentsText;
int NumGroups, CurGroup;
public:
MusicList();
void Load();
/* Add a new group. */
void AddGroup();
/* Add songs to the group that was just added. */
void AddSongsToGroup(const vector<Song*> &songs);
/* Set the displayed group number. */
void SetGroupNo(int group);
void TweenOnScreen();
void TweenOffScreen();
int GetNumSongs() const { return m_ContentsText[CurGroup].m_iNumSongsInGroup; }
};
#endif
/*
* (c) 2001-2003 Chris Danford
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
-12
View File
@@ -1346,12 +1346,6 @@ cl /Zl /nologo /c verstub.cpp /Fo&quot;$(IntDir)&quot;\
<File
RelativePath="GrooveRadar.h">
</File>
<File
RelativePath="GroupList.cpp">
</File>
<File
RelativePath="GroupList.h">
</File>
<File
RelativePath="HelpDisplay.cpp">
</File>
@@ -1382,12 +1376,6 @@ cl /Zl /nologo /c verstub.cpp /Fo&quot;$(IntDir)&quot;\
<File
RelativePath=".\ModIconRow.h">
</File>
<File
RelativePath="MusicList.cpp">
</File>
<File
RelativePath="MusicList.h">
</File>
<File
RelativePath=".\MusicWheel.cpp">
</File>
-16
View File
@@ -2510,14 +2510,6 @@
RelativePath="GrooveRadar.h"
>
</File>
<File
RelativePath="GroupList.cpp"
>
</File>
<File
RelativePath="GroupList.h"
>
</File>
<File
RelativePath="HelpDisplay.cpp"
>
@@ -2558,14 +2550,6 @@
RelativePath=".\ModIconRow.h"
>
</File>
<File
RelativePath="MusicList.cpp"
>
</File>
<File
RelativePath="MusicList.h"
>
</File>
<File
RelativePath=".\MusicWheel.cpp"
>
-12
View File
@@ -1554,12 +1554,6 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
<File
RelativePath="GrooveRadar.h">
</File>
<File
RelativePath="GroupList.cpp">
</File>
<File
RelativePath="GroupList.h">
</File>
<File
RelativePath="HelpDisplay.cpp">
</File>
@@ -1590,12 +1584,6 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
<File
RelativePath=".\ModIconRow.h">
</File>
<File
RelativePath=".\MusicList.cpp">
</File>
<File
RelativePath=".\MusicList.h">
</File>
<File
RelativePath=".\MusicWheel.cpp">
</File>