SongMenu refactoring

New Shortcuts
Readme update
This commit is contained in:
Flamefire committed 2013-02-26 21:12:32 +01:00
1 parent 835af557d2
commit 30841c5758
4 files changed
+323 -446

No files matched your search

+19 -17
View File
@@ -109,39 +109,41 @@ Vocaluxe.exe -ConfigFile MyConfig.xml -ScoreFile C:\Vocaluxe\Highscores\MyHighsc
=================================
= 4. Controls =
=================================
[Mouse] to navigate through the screens: Left button: select/manipulate elements,
Right button: go to previous screen.
[Cursor] to navigate through the screens.
[Enter] to confirm
[Mouse] to navigate through the screens: Left button: select/manipulate elements,
Right button: go to previous screen.
[Cursor] to navigate through the screens.
[Enter] to confirm
[Escape] or [Back] to go to the previous screen.
[ALT] + [P] to take a ScreenShot. Screenshots are saved in the directory "Screenshots".
[ALT] + [P] to take a ScreenShot. Screenshots are saved in the directory "Screenshots".
[ALT] + [ENTER] to toggle full screen mode.
[SHIFT] + [F1] to toggle theme edit mode. The theme edit mode is experimental. It allows you
to change the size and position of the element on the screens. You can save
your changes with [S] before leaving the theme edit mode.
[TAB] to open the background music controls (not on all screens).
[TAB] to open the background music controls (not on all screens).
[SHIFT] + [+] to increase volume
[SHIFT] + [-] to decrease volume
Song screen
[F3] to open/close the song search menu
[SPACE] to open/close the song menu
[CTRL] + [R] to select a random song
[F3] to open/close the song search menu
[A] to sing all songs
[SHIFT] + [A] to sing all songs from a category
[SPACE] to open/close the song menu
[CTRL] + [A] to sing all songs
[CTRL] + [V] to sing all songs from a category
[NUM_1]..[NUM_6] to use a Joker for team 1..6
[A]..[Z] to jump to category/song title starting with that letter
Name selection screen
[1]..[6] to activate player selection.
[Cursor] to select a profile.
[Enter] to confirm a selection.
[1]..[6] to activate player selection.
[Cursor] to select a profile.
[Enter] to confirm a selection.
Sing screen
[P] to toggle pause.
[P] to toggle pause.
[CTRL] + [S] to skip a song if there is another one in the playlist.
[T] to change the time format of the timer.
[I] to change view of player information.
[W] to activate the configured webcam.
[T] to change the time format of the timer.
[I] to change view of player information.
[W] to activate the configured webcam.
=================================
+180 -183
View File
@@ -187,12 +187,11 @@ namespace Vocaluxe.Screens
{
if (_SearchActive)
ApplyNewSearchFilter(_SearchText + KeyEvent.Unicode);
/*
else if (!Char.IsControl(KeyEvent.Unicode))
else
{
JumpTo(KeyEvent.Unicode);
return true;
} */
}
}
else
{
@@ -254,7 +253,7 @@ namespace Vocaluxe.Screens
break;
case Keys.Back:
if (_SearchText.Length > 0)
if (_SearchActive && _SearchText.Length > 0)
{
ApplyNewSearchFilter(_SearchText.Remove(_SearchText.Length - 1));
}
@@ -266,11 +265,6 @@ namespace Vocaluxe.Screens
break;
case Keys.Space:
if (!_SearchActive && !_sso.Selection.PartyMode)
ToggleSongOptions(ESongOptionsView.General);
break;
case Keys.F3:
if (_SearchActive)
{
@@ -279,78 +273,60 @@ namespace Vocaluxe.Screens
ApplyNewSearchFilter(_SearchText);
}
else if (!_sso.Selection.PartyMode)
{
_SearchActive = true;
}
break;
}
if(!_SearchActive){
switch (KeyEvent.Key)
{
case Keys.Space:
if (!_sso.Selection.PartyMode)
ToggleSongOptions(ESongOptionsView.General);
break;
//TODO: Delete it! ??? Shouldn't we keep this as shortcut?
case Keys.A:
if (!_SearchActive && KeyEvent.Mod == EModifier.None && !_sso.Selection.PartyMode)
{
StartRandomAllSongs();
}
if (KeyEvent.Mod == EModifier.Ctrl && !_sso.Selection.PartyMode)
{
StartRandomVisibleSongs();
}
break;
case Keys.A:
if (KeyEvent.Mod == EModifier.Ctrl && !_sso.Selection.PartyMode)
StartRandomAllSongs();
break;
case Keys.V:
if (KeyEvent.Mod == EModifier.Ctrl && !_sso.Selection.PartyMode)
StartRandomVisibleSongs();
break;
//TODO: Delete that from here and from wiki!
case Keys.F:
if (KeyEvent.Mod == EModifier.Ctrl)
{
if (_SearchActive)
{
_SearchActive = false;
_SearchText = String.Empty;
ApplyNewSearchFilter(_SearchText);
}
else if (!_sso.Selection.PartyMode)
{
_SearchActive = true;
}
}
break;
case Keys.R:
if (KeyEvent.Mod == EModifier.Ctrl && !_sso.Selection.RandomOnly)
SelectNextRandom(-1);
break;
//TODO: We need another key for random!
case Keys.R:
if (KeyEvent.Mod == EModifier.Ctrl && !_sso.Selection.RandomOnly)
SelectNextRandom(-1);
break;
case Keys.S:
if (KeyEvent.Mod == EModifier.Ctrl && CSongs.NumVisibleSongs > 0 && !_sso.Selection.PartyMode)
StartMedleySong(SongMenus[htSongMenus(SongMenu)].GetSelectedSong());
break;
//TODO: Delete that!
case Keys.S:
if (!_SearchActive && CSongs.NumVisibleSongs > 0 && !_sso.Selection.PartyMode)
{
StartMedleySong(SongMenus[htSongMenus(SongMenu)].GetSelectedSong());
}
break;
case Keys.D1:
SelectNextRandom(0);
break;
case Keys.D1:
SelectNextRandom(0);
break;
case Keys.D2:
SelectNextRandom(1);
break;
case Keys.D2:
SelectNextRandom(1);
break;
case Keys.D3:
SelectNextRandom(2);
break;
case Keys.D3:
SelectNextRandom(2);
break;
case Keys.D4:
SelectNextRandom(3);
break;
case Keys.D4:
SelectNextRandom(3);
break;
case Keys.D5:
SelectNextRandom(4);
break;
case Keys.D6:
SelectNextRandom(5);
break;
case Keys.D5:
SelectNextRandom(4);
break;
case Keys.D6:
SelectNextRandom(5);
break;
}
}
}
}
@@ -377,16 +353,9 @@ namespace Vocaluxe.Screens
else if (Buttons[htButtons(ButtonOptionsRandom)].Selected)
{
if (CSongs.Category != -1)
{
SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong());
}
}
else if (Buttons[htButtons(ButtonOptionsRandom)].Selected)
{
if (CSongs.Category == -1)
{
else
SongMenus[htSongMenus(SongMenu)].SetSelectedCategory(CSongs.GetRandomCategory());
}
}
else if (Buttons[htButtons(ButtonOptionsSingAll)].Selected)
{
@@ -1075,19 +1044,39 @@ namespace Vocaluxe.Screens
private void JumpTo(char Letter)
{
int song = SongMenus[htSongMenus(SongMenu)].GetSelectedSong();
int id = -1;
if (song > -1 && song < CSongs.NumVisibleSongs)
int start = 0;
if (CSongs.Category < 0)
{
id = CSongs.VisibleSongs[song].ID;
int curSelected = SongMenus[htSongMenus(SongMenu)].GetSelectedCategory();
CCategory[] Categories = CSongs.Categories;
int ct = Categories.Length;
if (curSelected >= 0 && curSelected < ct - 1 && Categories[curSelected].Name.StartsWith(Letter.ToString(), StringComparison.OrdinalIgnoreCase))
start = curSelected + 1;
int visibleID = Array.FindIndex<CCategory>(Categories, start, ct - start, element => element.Name.StartsWith(Letter.ToString(), StringComparison.OrdinalIgnoreCase));
if (visibleID < 0 && start > 1)
visibleID = Array.FindIndex<CCategory>(Categories, 0, start - 1, element => element.Name.StartsWith(Letter.ToString(), StringComparison.OrdinalIgnoreCase));
if (visibleID > -1)
SongMenus[htSongMenus(SongMenu)].SetSelectedCategory(visibleID);
}
else
{
//TODO: Check and use sorting method
int curSelected = SongMenus[htSongMenus(SongMenu)].GetSelectedSong();
CSong[] Songs = CSongs.VisibleSongs;
int ct = Songs.Length;
if (curSelected >= 0 && curSelected < ct - 1)
{
CSong CurrentSong = CSongs.GetVisibleSongByIndex(curSelected);
if (CurrentSong != null && CurrentSong.Artist.StartsWith(Letter.ToString(), StringComparison.OrdinalIgnoreCase))
start = curSelected + 1;
}
int visibleID = Array.FindIndex<CSong>(Songs, start, ct - start, element => element.Artist.StartsWith(Letter.ToString(), StringComparison.OrdinalIgnoreCase));
if(visibleID < 0 && start > 1)
visibleID = Array.FindIndex<CSong>(Songs, 0, start - 1, element => element.Artist.StartsWith(Letter.ToString(), StringComparison.OrdinalIgnoreCase));
if (visibleID > -1)
SongMenus[htSongMenus(SongMenu)].SetSelectedSong(visibleID);
}
int visibleID = Array.FindIndex<CSong>(CSongs.VisibleSongs, element => element.Artist.StartsWith(Letter.ToString(), StringComparison.OrdinalIgnoreCase));
if (visibleID > -1)
{
id = visibleID;
SongMenus[htSongMenus(SongMenu)].SetSelectedSong(id);
}
}
private void ApplyNewSearchFilter(string NewFilterString)
@@ -1119,7 +1108,7 @@ namespace Vocaluxe.Screens
CSongs.Sort(_sso.Sorting.SongSorting, _sso.Sorting.Tabs, _sso.Sorting.IgnoreArticles, NewFilterString, _sso.Sorting.ShowDuetSongs);
if (SongID == -1 || CSongs.NumVisibleSongs == 0 || CSongs.NumVisibleSongs <= SongIndex || CSongs.VisibleSongs[SongIndex].ID != SongID)
if (SongID == -1 || CSongs.NumVisibleSongs == 0 || CSongs.NumVisibleSongs <= SongIndex || CSongs.GetVisibleSongByIndex(SongIndex).ID != SongID)
refresh = true;
if (refresh)
@@ -1130,8 +1119,6 @@ namespace Vocaluxe.Screens
private void ToggleSongOptions(ESongOptionsView view)
{
_SongOptionsActive = view != ESongOptionsView.None;
SelectSlides[htSelectSlides(SelectSlideOptionsMode)].Visible = false;
SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistAdd)].Visible = false;
SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistOpen)].Visible = false;
@@ -1150,107 +1137,117 @@ namespace Vocaluxe.Screens
Statics[htStatics(StaticOptionsBG)].Visible = false;
Buttons[htButtons(ButtonOpenOptions)].Visible = true;
_SongOptionsActive = view != ESongOptionsView.None;
if (_SongOptionsActive)
{
if (view == ESongOptionsView.Song)
{
EGameMode LastMode = EGameMode.TR_GAMEMODE_NORMAL;
if (_AvailableGameModes.Count > 0)
LastMode = _AvailableGameModes[SelectSlides[htSelectSlides(SelectSlideOptionsMode)].Selection];
SetInteractionToButton(Buttons[htButtons(ButtonOptionsSing)]);
_AvailableGameModes.Clear();
SelectSlides[htSelectSlides(SelectSlideOptionsMode)].Clear();
if (!CSongs.VisibleSongs[SongMenus[htSongMenus(SongMenu)].GetSelectedSong()].IsDuet)
{
SelectSlides[htSelectSlides(SelectSlideOptionsMode)].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_NORMAL));
_AvailableGameModes.Add(EGameMode.TR_GAMEMODE_NORMAL);
SelectSlides[htSelectSlides(SelectSlideOptionsMode)].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_SHORTSONG));
_AvailableGameModes.Add(EGameMode.TR_GAMEMODE_SHORTSONG);
}
if (CSongs.VisibleSongs[SongMenus[htSongMenus(SongMenu)].GetSelectedSong()].IsDuet)
{
SelectSlides[htSelectSlides(SelectSlideOptionsMode)].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_DUET));
_AvailableGameModes.Add(EGameMode.TR_GAMEMODE_DUET);
}
if (CSongs.VisibleSongs[SongMenus[htSongMenus(SongMenu)].GetSelectedSong()].Medley.Source != EMedleySource.None)
{
SelectSlides[htSelectSlides(SelectSlideOptionsMode)].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_MEDLEY));
_AvailableGameModes.Add(EGameMode.TR_GAMEMODE_MEDLEY);
}
//Set SelectSlide-Selection to last selected game-mode if possible
for (int i = 0; i < _AvailableGameModes.Count; i++)
{
if (_AvailableGameModes[i] == LastMode)
SelectSlides[htSelectSlides(SelectSlideOptionsMode)].SetSelectionByValueIndex(i);
}
SelectSlides[htSelectSlides(SelectSlideOptionsMode)].Visible = true;
SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistAdd)].Visible = true;
Buttons[htButtons(ButtonOptionsSing)].Visible = true;
Buttons[htButtons(ButtonOptionsPlaylist)].Visible = true;
SetInteractionToButton(Buttons[htButtons(ButtonOptionsSing)]);
}
else if (view == ESongOptionsView.General)
{
Buttons[htButtons(ButtonOptionsRandom)].Visible = CSongs.Category != -1;
Buttons[htButtons(ButtonOptionsRandomCategory)].Visible = CSongs.Category == -1;
Buttons[htButtons(ButtonOptionsSingAll)].Visible = true;
Buttons[htButtons(ButtonOptionsSingAllVisible)].Visible = CSongs.Category != -1;
if (SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistOpen)].NumValues > 0)
{
Buttons[htButtons(ButtonOptionsOpenPlaylist)].Visible = true;
SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistOpen)].Visible = true;
SetInteractionToButton(Buttons[htButtons(ButtonOptionsOpenPlaylist)]);
}
else
{
Buttons[htButtons(ButtonOptionsOpenPlaylist)].Visible = false;
SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistOpen)].Visible = false;
if (Buttons[htButtons(ButtonOptionsRandom)].Visible)
SetInteractionToButton(Buttons[htButtons(ButtonOptionsRandom)]);
else
SetInteractionToButton(Buttons[htButtons(ButtonOptionsSingAll)]);
}
Buttons[htButtons(ButtonOptionsRandomMedley)].Visible = true;
if(Buttons[htButtons(ButtonOptionsRandom)].Visible)
SetInteractionToButton(Buttons[htButtons(ButtonOptionsRandom)]);
else
SetInteractionToButton(Buttons[htButtons(ButtonOptionsRandomCategory)]);
}
else if (view == ESongOptionsView.Medley)
{
Buttons[htButtons(ButtonOptionsStartMedley)].Visible = true;
SelectSlides[htSelectSlides(SelectSlideOptionsNumMedleySongs)].Visible = true;
SelectSlides[htSelectSlides(SelectSlideOptionsNumMedleySongs)].Clear();
if (CSongs.Category != -1)
{
for (int i = 1; i <= CSongs.VisibleSongs.Length; i++)
{
SelectSlides[htSelectSlides(SelectSlideOptionsNumMedleySongs)].AddValue(i.ToString());
}
}
else
{
for (int i = 1; i <= CSongs.AllSongs.Length; i++)
{
SelectSlides[htSelectSlides(SelectSlideOptionsNumMedleySongs)].AddValue(i.ToString());
}
}
if (SelectSlides[htSelectSlides(SelectSlideOptionsNumMedleySongs)].NumValues >= 5)
SelectSlides[htSelectSlides(SelectSlideOptionsNumMedleySongs)].SetSelectionByValueIndex(4);
else
SelectSlides[htSelectSlides(SelectSlideOptionsNumMedleySongs)].SetSelectionByValueIndex(SelectSlides[htSelectSlides(SelectSlideOptionsNumMedleySongs)].NumValues - 1);
SetInteractionToButton(Buttons[htButtons(ButtonOptionsStartMedley)]);
}
Texts[htTexts(TextOptionsTitle)].Visible = true;
Buttons[htButtons(ButtonOptionsClose)].Visible = true;
Statics[htStatics(StaticOptionsBG)].Visible = true;
Buttons[htButtons(ButtonOpenOptions)].Visible = false;
if (view == ESongOptionsView.Song)
_ShowSongOptionsSong();
else if (view == ESongOptionsView.General)
_ShowSongOptionsGeneral();
else if (view == ESongOptionsView.Medley)
_ShowSongOptionsMedley();
}
}
private void _ShowSongOptionsSong()
{
EGameMode LastMode = EGameMode.TR_GAMEMODE_NORMAL;
if (_AvailableGameModes.Count > 0)
LastMode = _AvailableGameModes[SelectSlides[htSelectSlides(SelectSlideOptionsMode)].Selection];
SetInteractionToButton(Buttons[htButtons(ButtonOptionsSing)]);
_AvailableGameModes.Clear();
SelectSlides[htSelectSlides(SelectSlideOptionsMode)].Clear();
if (!CSongs.VisibleSongs[SongMenus[htSongMenus(SongMenu)].GetSelectedSong()].IsDuet)
{
SelectSlides[htSelectSlides(SelectSlideOptionsMode)].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_NORMAL));
_AvailableGameModes.Add(EGameMode.TR_GAMEMODE_NORMAL);
SelectSlides[htSelectSlides(SelectSlideOptionsMode)].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_SHORTSONG));
_AvailableGameModes.Add(EGameMode.TR_GAMEMODE_SHORTSONG);
}
if (CSongs.VisibleSongs[SongMenus[htSongMenus(SongMenu)].GetSelectedSong()].IsDuet)
{
SelectSlides[htSelectSlides(SelectSlideOptionsMode)].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_DUET));
_AvailableGameModes.Add(EGameMode.TR_GAMEMODE_DUET);
}
if (CSongs.VisibleSongs[SongMenus[htSongMenus(SongMenu)].GetSelectedSong()].Medley.Source != EMedleySource.None)
{
SelectSlides[htSelectSlides(SelectSlideOptionsMode)].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_MEDLEY));
_AvailableGameModes.Add(EGameMode.TR_GAMEMODE_MEDLEY);
}
//Set SelectSlide-Selection to last selected game-mode if possible
for (int i = 0; i < _AvailableGameModes.Count; i++)
{
if (_AvailableGameModes[i] == LastMode)
SelectSlides[htSelectSlides(SelectSlideOptionsMode)].SetSelectionByValueIndex(i);
}
SelectSlides[htSelectSlides(SelectSlideOptionsMode)].Visible = true;
SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistAdd)].Visible = true;
Buttons[htButtons(ButtonOptionsSing)].Visible = true;
Buttons[htButtons(ButtonOptionsPlaylist)].Visible = true;
SetInteractionToButton(Buttons[htButtons(ButtonOptionsSing)]);
}
private void _ShowSongOptionsGeneral()
{
Buttons[htButtons(ButtonOptionsRandom)].Visible = CSongs.Category != -1;
Buttons[htButtons(ButtonOptionsRandomCategory)].Visible = CSongs.Category == -1;
Buttons[htButtons(ButtonOptionsSingAll)].Visible = true;
Buttons[htButtons(ButtonOptionsSingAllVisible)].Visible = CSongs.Category != -1;
if (SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistOpen)].NumValues > 0)
{
Buttons[htButtons(ButtonOptionsOpenPlaylist)].Visible = true;
SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistOpen)].Visible = true;
SetInteractionToButton(Buttons[htButtons(ButtonOptionsOpenPlaylist)]);
}
else
{
Buttons[htButtons(ButtonOptionsOpenPlaylist)].Visible = false;
SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistOpen)].Visible = false;
if (Buttons[htButtons(ButtonOptionsRandom)].Visible)
SetInteractionToButton(Buttons[htButtons(ButtonOptionsRandom)]);
else
SetInteractionToButton(Buttons[htButtons(ButtonOptionsSingAll)]);
}
Buttons[htButtons(ButtonOptionsRandomMedley)].Visible = true;
if (Buttons[htButtons(ButtonOptionsRandom)].Visible)
SetInteractionToButton(Buttons[htButtons(ButtonOptionsRandom)]);
else
SetInteractionToButton(Buttons[htButtons(ButtonOptionsRandomCategory)]);
}
private void _ShowSongOptionsMedley()
{
Buttons[htButtons(ButtonOptionsStartMedley)].Visible = true;
SelectSlides[htSelectSlides(SelectSlideOptionsNumMedleySongs)].Visible = true;
SelectSlides[htSelectSlides(SelectSlideOptionsNumMedleySongs)].Clear();
if (CSongs.Category != -1)
{
for (int i = 1; i <= CSongs.VisibleSongs.Length; i++)
{
SelectSlides[htSelectSlides(SelectSlideOptionsNumMedleySongs)].AddValue(i.ToString());
}
}
else
{
for (int i = 1; i <= CSongs.AllSongs.Length; i++)
{
SelectSlides[htSelectSlides(SelectSlideOptionsNumMedleySongs)].AddValue(i.ToString());
}
}
if (SelectSlides[htSelectSlides(SelectSlideOptionsNumMedleySongs)].NumValues >= 5)
SelectSlides[htSelectSlides(SelectSlideOptionsNumMedleySongs)].SetSelectionByValueIndex(4);
else
SelectSlides[htSelectSlides(SelectSlideOptionsNumMedleySongs)].SetSelectionByValueIndex(SelectSlides[htSelectSlides(SelectSlideOptionsNumMedleySongs)].NumValues - 1);
SetInteractionToButton(Buttons[htButtons(ButtonOptionsStartMedley)]);
}
#region Playlist Actions
public void CheckPlaylist()
{
+8 -17
View File
@@ -324,10 +324,10 @@ namespace Vocaluxe.Menu
[Flags]
public enum EModifier
{
None,
Shift,
Alt,
Ctrl
None = 0,
Shift = 1,
Alt = 2,
Ctrl = 4
}
public enum ESender
@@ -361,23 +361,14 @@ namespace Vocaluxe.Menu
Key = key;
Handled = false;
EModifier mALT = EModifier.None;
EModifier mSHIFT = EModifier.None;
EModifier mCTRL = EModifier.None;
Mod = EModifier.None;
if (alt)
mALT = EModifier.Alt;
Mod |= EModifier.Alt;
if (shift)
mSHIFT = EModifier.Shift;
Mod |= EModifier.Shift;
if (ctrl)
mCTRL = EModifier.Ctrl;
if (!alt && !shift && !ctrl)
Mod = EModifier.None;
else
Mod = mALT | mSHIFT | mCTRL;
Mod |= EModifier.Ctrl;
}
}
+116 -229
View File
@@ -26,7 +26,7 @@ namespace Vocaluxe.Menu.SongMenu
private CText _Artist;
private CText _Title;
private CText _SongLength;
private int _NumW;
private int _NumH;
@@ -36,7 +36,7 @@ namespace Vocaluxe.Menu.SongMenu
private int _TileW;
private int _TileH;
private int _Offset = 0;
private int _Offset = -1;
private int _actualSelection = -1;
private bool _SmallView = false;
@@ -45,7 +45,7 @@ namespace Vocaluxe.Menu.SongMenu
: base(PartyModeID)
{
}
public override int GetActualSelection()
{
return _actualSelection;
@@ -56,7 +56,7 @@ namespace Vocaluxe.Menu.SongMenu
base.Init();
_Rect = _Theme.songMenuTileBoard.TileRect;
_NumW = _Theme.songMenuTileBoard.numW;
_NumH = _Theme.songMenuTileBoard.numH;
_SpaceW = _Theme.songMenuTileBoard.spaceW;
@@ -113,7 +113,7 @@ namespace Vocaluxe.Menu.SongMenu
}
}
}
public override void OnShow()
{
if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && CBase.Songs.GetNumCategories() > 0 && CBase.Songs.GetCurrentCategoryIndex() == -1)
@@ -123,7 +123,7 @@ namespace Vocaluxe.Menu.SongMenu
_actualSelection = -1;
_Locked = -1;
_PreviewSelected = -1;
UpdateList(0);
UpdateList(0, true);
//AfterCategoryChange();
SetSelectedSong(_ActSong);
AfterCategoryChange();
@@ -183,7 +183,7 @@ namespace Vocaluxe.Menu.SongMenu
break;
}
}
if ((_Locked == -1 || !sel) &&
(KeyEvent.Key != Keys.Escape && KeyEvent.Key != Keys.Back && KeyEvent.Key != Keys.PageUp && KeyEvent.Key != Keys.PageDown))
{
@@ -197,7 +197,7 @@ namespace Vocaluxe.Menu.SongMenu
_actualSelection = 0;
_PreviewSelected = 0;
SetSelectedNow();
UpdateList(0);
UpdateList(0, true);
}
}
else
@@ -247,9 +247,7 @@ namespace Vocaluxe.Menu.SongMenu
if (_Locked > 0 && (!SongOptions.Selection.RandomOnly || SongOptions.Selection.CategoryChangeAllowed && CBase.Songs.GetCurrentCategoryIndex() < 0))
{
_Locked--;
if (CBase.Songs.GetCurrentCategoryIndex() < 0 && _Locked < CBase.Songs.GetNumCategories() - _NumW ||
CBase.Songs.GetCurrentCategoryIndex() >= 0 && _Locked < CBase.Songs.GetNumVisibleSongs() - _NumW)
UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2)));
UpdateList();
}
break;
@@ -259,8 +257,7 @@ namespace Vocaluxe.Menu.SongMenu
if (_Locked < CBase.Songs.GetNumCategories() - 1)
{
_Locked++;
if (_Locked < CBase.Songs.GetNumCategories() - _NumW)
UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2)));
UpdateList();
}
}
@@ -269,8 +266,7 @@ namespace Vocaluxe.Menu.SongMenu
if (CBase.Songs.GetCurrentCategoryIndex() != -1 && _Locked < CBase.Songs.GetNumVisibleSongs() - 1 && !SongOptions.Selection.RandomOnly)
{
_Locked++;
if (_Locked < CBase.Songs.GetNumVisibleSongs() - _NumW)
UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2)));
UpdateList();
}
}
break;
@@ -285,7 +281,7 @@ namespace Vocaluxe.Menu.SongMenu
if (_Locked > _NumW - 1 && (!SongOptions.Selection.RandomOnly || SongOptions.Selection.CategoryChangeAllowed && CBase.Songs.GetCurrentCategoryIndex() < 0))
{
_Locked -= _NumW;
UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2)));
UpdateList();
}
break;
@@ -301,19 +297,14 @@ namespace Vocaluxe.Menu.SongMenu
if (_Locked < CBase.Songs.GetNumCategories() - _NumW)
{
_Locked += _NumW;
if (_Locked < CBase.Songs.GetNumCategories() - _NumW)
UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2)));
UpdateList();
}
}
else
else if (_Locked < CBase.Songs.GetNumVisibleSongs() - _NumW && !SongOptions.Selection.RandomOnly)
{
if (_Locked < CBase.Songs.GetNumVisibleSongs() - _NumW && !SongOptions.Selection.RandomOnly)
{
_Locked += _NumW;
if (_Locked < CBase.Songs.GetNumVisibleSongs() - _NumW)
UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2)));
}
_Locked += _NumW;
UpdateList();
}
break;
@@ -330,7 +321,7 @@ namespace Vocaluxe.Menu.SongMenu
_Tiles[i].Selected = _Locked == i + _Offset;
}
}
}
}
}
public override void HandleMouse(ref MouseEvent MouseEvent, ScreenSongOptions SongOptions)
@@ -407,30 +398,9 @@ namespace Vocaluxe.Menu.SongMenu
}
}
if (MouseEvent.Wheel > 0)
if (MouseEvent.Wheel != 0 && CHelper.IsInBounds(_ScrollRect, MouseEvent) && (!SongOptions.Selection.RandomOnly || CBase.Songs.GetCurrentCategoryIndex() < 0 && SongOptions.Selection.CategoryChangeAllowed))
{
if (CHelper.IsInBounds(_ScrollRect, MouseEvent) && (!SongOptions.Selection.RandomOnly || CBase.Songs.GetCurrentCategoryIndex() < 0 && SongOptions.Selection.CategoryChangeAllowed))
{
if (CBase.Songs.GetCurrentCategoryIndex() >= 0 && CBase.Songs.GetNumVisibleSongs() > _Offset + _NumW * MouseEvent.Wheel + _NumW * (_NumH - 1) ||
CBase.Songs.GetCurrentCategoryIndex() < 0 && CBase.Songs.GetNumCategories() > _Offset + _NumW * MouseEvent.Wheel + _NumW * (_NumH - 1))
{
_Offset += _NumW * MouseEvent.Wheel;
UpdateList(_Offset);
}
}
}
if (MouseEvent.Wheel < 0)
{
if (CHelper.IsInBounds(_ScrollRect, MouseEvent) && (!SongOptions.Selection.RandomOnly || CBase.Songs.GetCurrentCategoryIndex() < 0 && SongOptions.Selection.CategoryChangeAllowed))
{
_Offset += _NumW * MouseEvent.Wheel;
if (_Offset < 0)
{
_Offset = 0;
}
UpdateList(_Offset);
}
UpdateList(_Offset + _NumW * MouseEvent.Wheel);
}
}
@@ -511,11 +481,12 @@ namespace Vocaluxe.Menu.SongMenu
CBase.Drawing.DrawTexture(_vidtex, vidRect, _vidtex.color, vidRectBounds, false);
CBase.Drawing.DrawTextureReflection(_vidtex, vidRect, _vidtex.color, vidRectBounds, _CoverBig.ReflectionSpace, _CoverBig.ReflectionHeight);
}else
}
else
_CoverBig.Draw(1f, EAspect.Crop);
_Artist.Draw();
_Title.Draw();
_SongLength.Draw();
@@ -523,7 +494,7 @@ namespace Vocaluxe.Menu.SongMenu
_VideoIcon.Draw();
_MedleyCalcIcon.Draw();
_MedleyTagIcon.Draw();
}
public override int GetSelectedSong()
@@ -541,117 +512,66 @@ namespace Vocaluxe.Menu.SongMenu
return new CStatic(_PartyModeID);
}
protected void SetSelectedTile(int itemNr)
{
bool sel = false;
foreach (CStatic tile in _Tiles)
{
if (tile.Selected)
{
sel = true;
break;
}
}
if (_Locked == -1 || !sel)
{
if (_PreviewSelected > -1)
{
_Locked = _PreviewSelected;
}
else
{
_Locked = 0;
_actualSelection = 0;
_PreviewSelected = 0;
SetSelectedNow();
UpdateList(0, true);
}
}
foreach (CStatic tile in _Tiles)
{
tile.Selected = false;
}
_PreviewSelected = itemNr;
SetSelectedNow();
_Locked = itemNr;
UpdateList(true);
_PreviewSelected = _Locked;
_actualSelection = _Locked;
if (_Locked - _Offset >= 0)
_Tiles[_Locked - _Offset].Selected = true;
}
public override void SetSelectedSong(int VisibleSongNr)
{
base.SetSelectedSong(VisibleSongNr);
if (VisibleSongNr < 0)
return;
if (CBase.Songs.GetNumVisibleSongs() > VisibleSongNr)
{
bool sel = false;
foreach (CStatic tile in _Tiles)
{
if (tile.Selected)
{
sel = true;
break;
}
}
if (_Locked == -1 || !sel)
{
if (_PreviewSelected > -1)
{
_Locked = _PreviewSelected;
}
else
{
_Locked = 0;
_actualSelection = 0;
_PreviewSelected = 0;
SetSelectedNow();
UpdateList(0);
}
}
foreach (CStatic tile in _Tiles)
{
tile.Selected = false;
}
_PreviewSelected = VisibleSongNr;
SetSelectedNow();
_Locked = VisibleSongNr;
UpdateList((VisibleSongNr / _NumW) * _NumW - (_NumW * (_NumH - 2)));
_PreviewSelected = _Locked;
_actualSelection = _Locked;
for (int i = 0; i < _Tiles.Count; i++)
{
_Tiles[i].Selected = _Locked == i + _Offset;
}
}
if (VisibleSongNr >= 0 && VisibleSongNr < CBase.Songs.GetNumVisibleSongs())
SetSelectedTile(VisibleSongNr);
}
public override void SetSelectedCategory(int CategoryNr)
{
base.SetSelectedCategory(CategoryNr);
if (CategoryNr < 0)
return;
if (CBase.Songs.GetNumCategories() > CategoryNr)
{
bool sel = false;
foreach (CStatic tile in _Tiles)
{
if (tile.Selected)
{
sel = true;
break;
}
}
if (_Locked == -1 || !sel)
{
if (_PreviewSelected > -1)
{
_Locked = _PreviewSelected;
}
else
{
_Locked = 0;
_actualSelection = 0;
_PreviewSelected = 0;
SetSelectedNow();
UpdateList(0);
}
}
foreach (CStatic tile in _Tiles)
{
tile.Selected = false;
}
_PreviewSelected = CategoryNr;
SetSelectedNow();
_Locked = CategoryNr;
UpdateList((CategoryNr / _NumW) * _NumW - (_NumW * (_NumH - 2)));
_PreviewSelected = _Locked;
_actualSelection = _Locked;
for (int i = 0; i < _Tiles.Count; i++)
{
_Tiles[i].Selected = _Locked == i + _Offset;
}
}
if (CategoryNr >= 0 && CategoryNr < CBase.Songs.GetNumCategories())
SetSelectedTile(CategoryNr);
}
protected override void EnterCategory(int cat)
@@ -706,60 +626,49 @@ namespace Vocaluxe.Menu.SongMenu
if (_actualSelection >= 0 && _actualSelection < _Tiles.Count)
_Tiles[_actualSelection].Selected = true;
if ((_LastKnownNumSongs == CBase.Songs.GetNumVisibleSongs()) && (_LastKnownCategory == CBase.Songs.GetCurrentCategoryIndex()))
return;
_LastKnownCategory = CBase.Songs.GetCurrentCategoryIndex();
_LastKnownNumSongs = CBase.Songs.GetNumVisibleSongs();
UpdateList(0);
UpdateList(0, true);
CBase.Songs.UpdateRandomSongList();
}
private void UpdateList(int offset)
private void UpdateList(bool force = false)
{
if (CBase.Songs.GetCurrentCategoryIndex() > -1)
{
if (offset >= (CBase.Songs.GetNumVisibleSongs() / _NumW) * _NumW - (_NumW * (_NumH - 1)))
offset = (CBase.Songs.GetNumVisibleSongs() / _NumW) * _NumW - (_NumW * (_NumH - 1));
}
else
{
if (offset >= (CBase.Songs.GetNumCategories() / _NumW) * _NumW - (_NumW * (_NumH - 1)))
offset = (CBase.Songs.GetNumCategories() / _NumW) * _NumW - (_NumW * (_NumH - 1));
}
UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2)), force);
}
private void UpdateList(int offset, bool force = false)
{
bool isInCategory = CBase.Songs.GetCurrentCategoryIndex() >= 0;
int itemCount = (isInCategory) ? CBase.Songs.GetNumVisibleSongs() : CBase.Songs.GetNumCategories();
if (offset >= (itemCount / _NumW) * _NumW - (_NumW * (_NumH - 1)))
offset = (itemCount / _NumW) * _NumW - (_NumW * (_NumH - 1));
if (offset < 0)
offset = 0;
if (offset == _Offset && !force)
return;
for (int i = 0; i < _Tiles.Count; i++)
{
if (CBase.Songs.GetCurrentCategoryIndex() >= 0)
if (itemCount > i + offset)
{
if (CBase.Songs.GetNumVisibleSongs() > i + offset)
{
if (isInCategory)
_Tiles[i].Texture = CBase.Songs.GetVisibleSong(i + offset).CoverTextureSmall;
_Tiles[i].Color = new SColorF(1f, 1f, 1f, 1f);
}
else
{
_Tiles[i].Texture = _CoverTexture;
_Tiles[i].Color = _Color;
}
}
if (CBase.Songs.GetCurrentCategoryIndex() == -1)
{
if (CBase.Songs.GetNumCategories() > i + offset)
{
_Tiles[i].Texture = CBase.Songs.GetCategory(i + offset).CoverTextureSmall;
_Tiles[i].Color = new SColorF(1f, 1f, 1f, 1f);
}
else
{
_Tiles[i].Texture = _CoverTexture;
_Tiles[i].Color = _Color;
}
_Tiles[i].Color = new SColorF(1f, 1f, 1f, 1f);
}
else
{
_Tiles[i].Texture = _CoverTexture;
_Tiles[i].Color = _Color;
}
}
_Offset = offset;
@@ -775,56 +684,34 @@ namespace Vocaluxe.Menu.SongMenu
{
_NumH = _Theme.songMenuTileBoard.numHsmall;
_NumW = _Theme.songMenuTileBoard.numWsmall;
_TileW = (int)((_Theme.songMenuTileBoard.TileRectSmall.W - _SpaceW * (_NumW - 1)) / _NumW);
_TileH = (int)((_Theme.songMenuTileBoard.TileRectSmall.H - _SpaceH * (_NumH - 1)) / _NumH);
_CoverTexture = CBase.Theme.GetSkinTexture(_Theme.CoverBackgroundName, _PartyModeID);
_CoverBigTexture = CBase.Theme.GetSkinTexture(_Theme.CoverBigBackgroundName, _PartyModeID);
_Tiles = new List<CStatic>();
for (int i = 0; i < _NumH; i++)
{
for (int j = 0; j < _NumW; j++)
{
SRectF rect = new SRectF(_Theme.songMenuTileBoard.TileRectSmall.X + j * (_TileW + _SpaceW),
_Theme.songMenuTileBoard.TileRectSmall.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z);
CStatic tile = new CStatic(_PartyModeID, _CoverTexture, Color, rect);
_Tiles.Add(tile);
}
}
_Rect = _Theme.songMenuTileBoard.TileRectSmall;
_ScrollRect = new SRectF(0, 0, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), _Theme.songMenuTileBoard.TileRectSmall.Z);
}
else
{
_NumH = _Theme.songMenuTileBoard.numH;
_NumW = _Theme.songMenuTileBoard.numW;
_TileW = (int)((_Theme.songMenuTileBoard.TileRect.W - _SpaceW * (_NumW - 1)) / _NumW);
_TileH = (int)((_Theme.songMenuTileBoard.TileRect.H - _SpaceH * (_NumH - 1)) / _NumH);
_CoverTexture = CBase.Theme.GetSkinTexture(_Theme.CoverBackgroundName, _PartyModeID);
_CoverBigTexture = CBase.Theme.GetSkinTexture(_Theme.CoverBigBackgroundName, _PartyModeID);
_Tiles = new List<CStatic>();
for (int i = 0; i < _NumH; i++)
{
for (int j = 0; j < _NumW; j++)
{
SRectF rect = new SRectF(_Theme.songMenuTileBoard.TileRect.X + j * (_TileW + _SpaceW),
_Theme.songMenuTileBoard.TileRect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z);
CStatic tile = new CStatic(_PartyModeID, _CoverTexture, Color, rect);
_Tiles.Add(tile);
}
}
_Rect = _Theme.songMenuTileBoard.TileRect;
_ScrollRect = new SRectF(0, 0, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), _Theme.songMenuTileBoard.TileRect.Z);
}
UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2)));
_TileW = (int)((_Rect.W - _SpaceW * (_NumW - 1)) / _NumW);
_TileH = (int)((_Rect.H - _SpaceH * (_NumH - 1)) / _NumH);
_CoverTexture = CBase.Theme.GetSkinTexture(_Theme.CoverBackgroundName, _PartyModeID);
_CoverBigTexture = CBase.Theme.GetSkinTexture(_Theme.CoverBigBackgroundName, _PartyModeID);
_Tiles = new List<CStatic>();
for (int i = 0; i < _NumH; i++)
{
for (int j = 0; j < _NumW; j++)
{
SRectF rect = new SRectF(_Rect.X + j * (_TileW + _SpaceW), _Rect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z);
CStatic tile = new CStatic(_PartyModeID, _CoverTexture, Color, rect);
_Tiles.Add(tile);
}
}
_ScrollRect = new SRectF(0, 0, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), _Rect.Z);
UpdateList(true);
}
public override bool IsSmallView()