Rename PreviewSelected to more meaningful PreviewId

This commit is contained in:
Flamefire committed 2013-10-18 23:50:47 +02:00
1 parent 3a8acecd5c
commit 60bd2c4da4
2 files changed
+51 -51

No files matched your search

+21 -21
View File
@@ -114,26 +114,25 @@ namespace VocaluxeLib.Menu.SongMenu
protected SRectF _Rect;
protected SColorF _Color;
private int _SelectedInternal = -1;
private int _SelectedPending = -1;
private int _PreviewIdInternal = -1;
private int _PreviewIdPending = -1;
protected long _PendingTime = 500L;
private int _LockedInternal = -1;
protected bool _Active;
protected float _MaxVolume = 100f;
protected int _PreviewSelected
protected int _PreviewId
{
//for preview only
get
{
if ((_SelectedInternal != _SelectedPending) && (_Timer.ElapsedMilliseconds >= _PendingTime))
if ((_PreviewIdInternal != _PreviewIdPending) && (_Timer.ElapsedMilliseconds >= _PendingTime))
{
_Timer.Reset();
_SelectedInternal = _SelectedPending;
_PreviewIdInternal = _PreviewIdPending;
}
return _SelectedInternal;
return _PreviewIdInternal;
}
set
{
@@ -141,27 +140,27 @@ namespace VocaluxeLib.Menu.SongMenu
{
_Timer.Reset();
_SelectedInternal = -1;
_SelectedPending = -1;
_PreviewIdInternal = -1;
_PreviewIdPending = -1;
return;
}
if (value == _SelectedPending)
if (value == _PreviewIdPending)
{
if (_Timer.ElapsedMilliseconds >= _PendingTime || _SelectedInternal == -1)
if (_Timer.ElapsedMilliseconds >= _PendingTime || _PreviewIdInternal == -1)
{
_Timer.Reset();
_SelectedInternal = _SelectedPending;
_PreviewIdInternal = _PreviewIdPending;
}
}
else
{
if (value != _SelectedInternal)
if (value != _PreviewIdInternal)
{
_Timer.Reset();
_Timer.Start();
}
_SelectedPending = value;
_PreviewIdPending = value;
}
}
}
@@ -169,9 +168,10 @@ namespace VocaluxeLib.Menu.SongMenu
protected void _SetSelectedNow()
{
_Timer.Reset();
_SelectedInternal = _SelectedPending;
_PreviewIdInternal = _PreviewIdPending;
}
private int _LockedInternal = -1;
protected int _Locked
{
//the real selected song for singing
@@ -436,8 +436,8 @@ namespace VocaluxeLib.Menu.SongMenu
if (!_Initialized)
return;
if (_Actsong != _PreviewSelected)
_SelectSong(_PreviewSelected);
if (_Actsong != _PreviewId)
_SelectSong(_PreviewId);
if (_Streams.Count <= 0 || _Video == -1)
return;
@@ -484,7 +484,7 @@ namespace VocaluxeLib.Menu.SongMenu
_Timer.Stop();
_Timer.Reset();
_SelectedInternal = _SelectedPending;
_PreviewIdInternal = _PreviewIdPending;
}
public virtual void HandleInput(ref SKeyEvent keyEvent, SScreenSongOptions songOptions) {}
@@ -569,9 +569,9 @@ namespace VocaluxeLib.Menu.SongMenu
{
if (!_Initialized)
return false;
if (CBase.Songs.IsInCategory() || _PreviewSelected < 0 || _PreviewSelected >= CBase.Songs.GetNumCategories())
if (CBase.Songs.IsInCategory() || _PreviewId < 0 || _PreviewId >= CBase.Songs.GetNumCategories())
return false;
_EnterCategory(_PreviewSelected);
_EnterCategory(_PreviewId);
return true;
}
@@ -665,7 +665,7 @@ namespace VocaluxeLib.Menu.SongMenu
_Timer.Stop();
_Timer.Reset();
_SelectedInternal = _SelectedPending;
_PreviewIdInternal = _PreviewIdPending;
}
#region ThemeEdit
+30 -30
View File
@@ -101,7 +101,7 @@ namespace VocaluxeLib.Menu.SongMenu
_ScrollRect = new SRectF(0, 0, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), _Theme.SongMenuTileBoard.TileRect.Z);
_PreviewSelected = -1;
_PreviewId = -1;
_Offset = 0;
_CoverBig = _Theme.SongMenuTileBoard.StaticCoverBig;
@@ -122,8 +122,8 @@ namespace VocaluxeLib.Menu.SongMenu
if (songOptions.Selection.RandomOnly)
{
_Locked = _PreviewSelected;
_ActualSelection = _PreviewSelected;
_Locked = _PreviewId;
_ActualSelection = _PreviewId;
for (int i = 0; i < _Tiles.Count; i++)
_Tiles[i].Selected = _Locked == i + _Offset;
}
@@ -142,12 +142,12 @@ namespace VocaluxeLib.Menu.SongMenu
_MedleyTagIcon.Visible = false;
//Check if nothing is selected (for preview)
if (_PreviewSelected < 0)
if (_PreviewId < 0)
return;
if (CBase.Songs.IsInCategory())
{
CSong song = CBase.Songs.GetVisibleSong(_PreviewSelected);
CSong song = CBase.Songs.GetVisibleSong(_PreviewId);
//Check if we have a valid song (song still visible, index >=0 etc is checked by framework)
if (song == null)
{
@@ -179,7 +179,7 @@ namespace VocaluxeLib.Menu.SongMenu
}
else
{
CCategory category = CBase.Songs.GetCategory(_PreviewSelected);
CCategory category = CBase.Songs.GetCategory(_PreviewId);
//Check if we have a valid category
if (category == null)
return;
@@ -202,21 +202,21 @@ namespace VocaluxeLib.Menu.SongMenu
_EnterCategory(0);
_ActualSelection = -1;
_Locked = -1;
_PreviewSelected = -1;
_PreviewId = -1;
_UpdateList(0, true);
//AfterCategoryChange();
SetSelectedSong(_ActSong);
_AfterCategoryChange();
if (_PreviewSelected < 0)
if (_PreviewId < 0)
{
_PreviewSelected = 0;
_PreviewId = 0;
_Locked = 0;
}
if (CBase.Songs.GetNumSongsVisible() == 0 && CBase.Songs.GetSearchFilter() != "")
{
_PreviewSelected = -1;
_PreviewId = -1;
_Locked = -1;
}
}
@@ -237,13 +237,13 @@ namespace VocaluxeLib.Menu.SongMenu
if ((_Locked == -1 || !sel) &&
(keyEvent.Key != Keys.Escape && keyEvent.Key != Keys.Back && keyEvent.Key != Keys.PageUp && keyEvent.Key != Keys.PageDown))
{
if (_PreviewSelected > -1)
_Locked = _PreviewSelected;
if (_PreviewId > -1)
_Locked = _PreviewId;
else
{
_Locked = 0;
_ActualSelection = 0;
_PreviewSelected = 0;
_PreviewId = 0;
_SetSelectedNow();
_UpdateList(0, true);
}
@@ -255,10 +255,10 @@ namespace VocaluxeLib.Menu.SongMenu
case Keys.Enter:
if (!CBase.Songs.IsInCategory())
{
_EnterCategory(_PreviewSelected);
_EnterCategory(_PreviewId);
keyEvent.Handled = true;
}
else if (_ActualSelection > -1 && _PreviewSelected >= 0)
else if (_ActualSelection > -1 && _PreviewId >= 0)
_Locked = _ActualSelection;
break;
@@ -353,7 +353,7 @@ namespace VocaluxeLib.Menu.SongMenu
if (!keyEvent.Handled)
{
_PreviewSelected = _Locked;
_PreviewId = _Locked;
_ActualSelection = _Locked;
for (int i = 0; i < _Tiles.Count; i++)
@@ -378,11 +378,11 @@ namespace VocaluxeLib.Menu.SongMenu
{
if (mouseEvent.LB || !CBase.Songs.IsInCategory())
{
if (_PreviewSelected == i + _Offset)
_Locked = _PreviewSelected;
if (_PreviewId == i + _Offset)
_Locked = _PreviewId;
else
{
_PreviewSelected = i + _Offset;
_PreviewId = i + _Offset;
_Locked = -1;
}
}
@@ -413,10 +413,10 @@ namespace VocaluxeLib.Menu.SongMenu
}
if (mouseEvent.RB && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && !songOptions.Selection.PartyMode)
CBase.Graphics.FadeTo(EScreens.ScreenMain);
else if (_PreviewSelected != -1 && mouseEvent.LB && CBase.Songs.GetCurrentCategoryIndex() != -1 && !songOptions.Selection.PartyMode)
else if (_PreviewId != -1 && mouseEvent.LB && CBase.Songs.GetCurrentCategoryIndex() != -1 && !songOptions.Selection.PartyMode)
{
if (CHelper.IsInBounds(_CoverBig.Rect, mouseEvent) || CHelper.IsInBounds(_TextBG.Rect, mouseEvent))
_Locked = _PreviewSelected;
_Locked = _PreviewId;
}
else if (mouseEvent.LB && (!CBase.Songs.IsInCategory()))
{
@@ -424,7 +424,7 @@ namespace VocaluxeLib.Menu.SongMenu
{
if (tile.Texture != _CoverTexture && CHelper.IsInBounds(tile.Rect, mouseEvent))
{
_EnterCategory(_PreviewSelected);
_EnterCategory(_PreviewId);
mouseEvent.Handled = true;
return;
}
@@ -509,13 +509,13 @@ namespace VocaluxeLib.Menu.SongMenu
if (_Locked == -1 || !sel)
{
if (_PreviewSelected > -1)
_Locked = _PreviewSelected;
if (_PreviewId > -1)
_Locked = _PreviewId;
else
{
_Locked = 0;
_ActualSelection = 0;
_PreviewSelected = 0;
_PreviewId = 0;
_SetSelectedNow();
_UpdateList(0, true);
}
@@ -524,13 +524,13 @@ namespace VocaluxeLib.Menu.SongMenu
foreach (CStatic tile in _Tiles)
tile.Selected = false;
_PreviewSelected = itemNr;
_PreviewId = itemNr;
_SetSelectedNow();
_Locked = itemNr;
_UpdateList(true);
_PreviewSelected = _Locked;
_PreviewId = _Locked;
_ActualSelection = _Locked;
if (_Locked - _Offset >= 0)
@@ -557,7 +557,7 @@ namespace VocaluxeLib.Menu.SongMenu
{
base._EnterCategory(cat);
_PreviewSelected = 0;
_PreviewId = 0;
_Locked = -1;
_ActualSelection = 0;
_AfterCategoryChange();
@@ -568,7 +568,7 @@ namespace VocaluxeLib.Menu.SongMenu
{
base._ShowCategories();
_PreviewSelected = 0;
_PreviewId = 0;
_Locked = -1;
_ActualSelection = 0;
_AfterCategoryChange();
@@ -596,7 +596,7 @@ namespace VocaluxeLib.Menu.SongMenu
private void _AfterCategoryChange()
{
_SetSelectedNow();
_SelectSong(_PreviewSelected);
_SelectSong(_PreviewId);
foreach (CStatic tile in _Tiles)
tile.Selected = false;