Remember selected position for each folder/tab (#859)
* Remember Last Tab Position * Remember Last Tab Position * Remember Last Tab Position * Remember Last Tab Position * Remember Last Tab Position
This commit is contained in:
1 parent
80274d1a04
commit
6deb5acbc8
4 files changed
+64
-16
No files matched your search
@@ -125,6 +125,18 @@ namespace Vocaluxe.Screens
|
||||
return _PlayerSelect;
|
||||
}
|
||||
|
||||
private static int _StaticSelectedCategoryIndex = -1;
|
||||
|
||||
private static void SetStaticSelectedCategoryIndex(int categoryIndex)
|
||||
{
|
||||
_StaticSelectedCategoryIndex = categoryIndex;
|
||||
}
|
||||
|
||||
private static int GetStaticSelectedCategoryIndex()
|
||||
{
|
||||
return _StaticSelectedCategoryIndex;
|
||||
}
|
||||
|
||||
private static int _StaticSelectedSongID;
|
||||
|
||||
private static void setStaticSelectedSongID(int songID)
|
||||
@@ -769,6 +781,7 @@ namespace Vocaluxe.Screens
|
||||
else if (_Sso.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
_ToggleSongOptions(ESongOptionsView.None);
|
||||
_SelectedCategoryIndex = _SongMenu.GetSelectedCategory();
|
||||
_SongMenu.EnterSelectedCategory();
|
||||
}
|
||||
}
|
||||
@@ -790,9 +803,9 @@ namespace Vocaluxe.Screens
|
||||
_SongMenu.SetSelectedCategory(_SelectedCategoryIndex);
|
||||
_SongMenu.EnterSelectedCategory();
|
||||
}
|
||||
else
|
||||
else if (CBase.Songs.IsInCategory())
|
||||
{
|
||||
_SongMenu.LeaveSelectedCategory();
|
||||
CBase.Songs.SetCategory(-1);
|
||||
}
|
||||
}
|
||||
_SearchActive = _Sso.Sorting.SearchActive;
|
||||
@@ -801,6 +814,32 @@ namespace Vocaluxe.Screens
|
||||
CGame.Reset();
|
||||
_SongMenu.OnShow();
|
||||
|
||||
if (_Sso.Sorting.Tabs == EOffOn.TR_CONFIG_ON)
|
||||
{
|
||||
int lastCategoryIndex = GetStaticSelectedCategoryIndex();
|
||||
|
||||
if (CBase.Songs.IsInCategory())
|
||||
CBase.Songs.SetCategory(-1);
|
||||
|
||||
_SongMenu.OnShow();
|
||||
|
||||
if (lastCategoryIndex >= 0 && lastCategoryIndex < CSongs.Categories.Count)
|
||||
_SongMenu.SetSelectedCategory(lastCategoryIndex);
|
||||
}
|
||||
|
||||
int lastSongId = getSelectedSongID();
|
||||
if (CSongs.IsInCategory && lastSongId >= 0)
|
||||
{
|
||||
for (int i = 0; i < CSongs.VisibleSongs.Count; i++)
|
||||
{
|
||||
if (CSongs.VisibleSongs[i].ID == lastSongId)
|
||||
{
|
||||
_SongMenu.SetSelectedSong(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_Sso.Selection.PartyMode)
|
||||
{
|
||||
_ClosePlaylist();
|
||||
@@ -1049,6 +1088,9 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
if (CSongs.IsInCategory && (songNr >= 0))
|
||||
{
|
||||
SetStaticSelectedCategoryIndex(CBase.Songs.GetCurrentCategoryIndex());
|
||||
setStaticSelectedSongID(CSongs.VisibleSongs[songNr].ID);
|
||||
|
||||
EGameMode gm;
|
||||
if (_AvailableGameModes.Count >= _SelectSlides[_SelectSlideOptionsMode].Selection)
|
||||
gm = _AvailableGameModes[_SelectSlides[_SelectSlideOptionsMode].Selection];
|
||||
@@ -1077,7 +1119,10 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
if (CSongs.IsInCategory && songNr >= 0 && CSongs.NumSongsVisible > songNr)
|
||||
{
|
||||
EGameMode gm = CSongs.VisibleSongs[songNr].IsDuet ? EGameMode.TR_GAMEMODE_DUET : EGameMode.TR_GAMEMODE_NORMAL;
|
||||
SetStaticSelectedCategoryIndex(CBase.Songs.GetCurrentCategoryIndex());
|
||||
setStaticSelectedSongID(CSongs.VisibleSongs[songNr].ID);
|
||||
|
||||
EGameMode gm = CSongs.VisibleSongs[songNr].IsDuet ? EGameMode.TR_GAMEMODE_DUET : EGameMode.TR_GAMEMODE_NORMAL;
|
||||
|
||||
CGame.Reset();
|
||||
CGame.ClearSongs();
|
||||
|
||||
@@ -299,9 +299,16 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
public void LeaveSelectedCategory()
|
||||
{
|
||||
// Stefan1200: This was implemented with the pull request #359 and is the reason for the bug described in issue #390.
|
||||
// Currently disabled until we know if this is still needed or we find a better solution!
|
||||
// _LeaveCategory();
|
||||
if (!CBase.Songs.IsInCategory())
|
||||
return;
|
||||
|
||||
int oldCategory = CBase.Songs.GetCurrentCategoryIndex();
|
||||
_LeaveCategory();
|
||||
|
||||
if (oldCategory >= 0 && oldCategory < CBase.Songs.GetNumCategories())
|
||||
SetSelectedCategory(oldCategory);
|
||||
else if (CBase.Songs.GetNumCategories() > 0)
|
||||
SetSelectedCategory(0);
|
||||
}
|
||||
|
||||
public virtual void UnloadSkin() {}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#region license
|
||||
#region license
|
||||
// This file is part of Vocaluxe.
|
||||
//
|
||||
// Vocaluxe is free software: you can redistribute it and/or modify
|
||||
@@ -358,7 +358,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
case Keys.Back:
|
||||
if (CBase.Songs.IsInCategory() && catChangePossible)
|
||||
{
|
||||
_LeaveCategory();
|
||||
LeaveSelectedCategory();
|
||||
keyEvent.Handled = true;
|
||||
}
|
||||
break;
|
||||
@@ -510,7 +510,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
if (CBase.Songs.IsInCategory() && CBase.Songs.GetNumCategories() > 0 && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON &&
|
||||
songOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
_LeaveCategory();
|
||||
LeaveSelectedCategory();
|
||||
return true;
|
||||
}
|
||||
if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && !songOptions.Selection.PartyMode)
|
||||
@@ -611,8 +611,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
protected override void _LeaveCategory()
|
||||
{
|
||||
base._LeaveCategory();
|
||||
|
||||
SetSelectedCategory(0);
|
||||
_UpdateListIfRequired();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#region license
|
||||
#region license
|
||||
// This file is part of Vocaluxe.
|
||||
//
|
||||
// Vocaluxe is free software: you can redistribute it and/or modify
|
||||
@@ -349,7 +349,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
case Keys.Back:
|
||||
if (CBase.Songs.IsInCategory() && catChangePossible)
|
||||
{
|
||||
_LeaveCategory();
|
||||
LeaveSelectedCategory();
|
||||
keyEvent.Handled = true;
|
||||
}
|
||||
break;
|
||||
@@ -499,7 +499,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
if (CBase.Songs.IsInCategory() && CBase.Songs.GetNumCategories() > 0 && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON &&
|
||||
songOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
_LeaveCategory();
|
||||
LeaveSelectedCategory();
|
||||
return true;
|
||||
}
|
||||
if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && !songOptions.Selection.PartyMode)
|
||||
@@ -576,8 +576,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
protected override void _LeaveCategory()
|
||||
{
|
||||
base._LeaveCategory();
|
||||
|
||||
SetSelectedCategory(0);
|
||||
_UpdateListIfRequired();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user