song menu converted

This commit is contained in:
Alexander Eckart committed 2012-12-14 16:46:36 +01:00
1 parent 0c636929a2
commit b1f0106b9a
8 files changed
+175 -104

No files matched your search

+1 -1
View File
@@ -231,7 +231,7 @@ namespace Vocaluxe.Base
_Draw.DrawTexture(Texture, rect, color, bounds); _Draw.DrawTexture(Texture, rect, color, bounds);
} }
public static void DrawTexture(STexture Texture, SRectF rect, SColorF color,bool mirrored) public static void DrawTexture(STexture Texture, SRectF rect, SColorF color, bool mirrored)
{ {
_Draw.DrawTexture(Texture, rect, color, mirrored); _Draw.DrawTexture(Texture, rect, color, mirrored);
} }
+53 -1
View File
@@ -28,10 +28,11 @@ namespace Vocaluxe.Base
public static ISound Sound = new BSound(); public static ISound Sound = new BSound();
public static ICover Cover = new BCover(); public static ICover Cover = new BCover();
public static IDataBase DataBase = new BDataBase(); public static IDataBase DataBase = new BDataBase();
public static IInputs Input = new BInputs();
public static Menu.Base Base = new Menu.Base( public static Menu.Base Base = new Menu.Base(
Config, Settings, Theme, Helper, Log, BackgroundMusic, Draw, Graphics, Fonts, Language, Game, Profiles, Record, Songs, Video, Sound, Cover, DataBase); Config, Settings, Theme, Helper, Log, BackgroundMusic, Draw, Graphics, Fonts, Language, Game, Profiles, Record, Songs, Video, Sound, Cover, DataBase, Input);
} }
class BConfig : IConfig class BConfig : IConfig
@@ -322,6 +323,11 @@ namespace Vocaluxe.Base
CDraw.DrawTexture(Texture, Rect, Color, Bounds); CDraw.DrawTexture(Texture, Rect, Color, Bounds);
} }
public void DrawTexture(STexture Texture, SRectF Rect, SColorF Color, SRectF Bounds, bool Mirrored)
{
CDraw.DrawTexture(Texture, Rect, Color, Bounds, Mirrored);
}
public void DrawTextureReflection(STexture Texture, SRectF Rect, SColorF Color, SRectF Bounds, float ReflectionSpace, float ReflectionHeight) public void DrawTextureReflection(STexture Texture, SRectF Rect, SColorF Color, SRectF Bounds, float ReflectionSpace, float ReflectionHeight)
{ {
CDraw.DrawTextureReflection(Texture, Rect, Color, Bounds, ReflectionSpace, ReflectionHeight); CDraw.DrawTextureReflection(Texture, Rect, Color, Bounds, ReflectionSpace, ReflectionHeight);
@@ -471,16 +477,36 @@ namespace Vocaluxe.Base
return CSongs.NumCategories; return CSongs.NumCategories;
} }
public int NumSongsInCategory(int CategoryIndex)
{
return CSongs.NumSongsInCategory(CategoryIndex);
}
public int GetCurrentCategoryIndex() public int GetCurrentCategoryIndex()
{ {
return CSongs.Category; return CSongs.Category;
} }
public EOffOn GetTabs()
{
return CSongs.Tabs;
}
public string GetSearchFilter()
{
return CSongs.SearchFilter;
}
public void SetCategory(int CategoryIndex) public void SetCategory(int CategoryIndex)
{ {
CSongs.Category = CategoryIndex; CSongs.Category = CategoryIndex;
} }
public void UpdateRandomSongList()
{
CSongs.UpdateRandomSongList();
}
public CSong GetVisibleSong(int VisibleIndex) public CSong GetVisibleSong(int VisibleIndex)
{ {
if (VisibleIndex >= CSongs.NumVisibleSongs) if (VisibleIndex >= CSongs.NumVisibleSongs)
@@ -492,6 +518,24 @@ namespace Vocaluxe.Base
return new CSong(song); return new CSong(song);
} }
public CCategory GetCategory(int Index)
{
if (Index >= CSongs.NumCategories)
return null;
return new CCategory(CSongs.Categories[Index]);
}
public void NextCategory()
{
CSongs.NextCategory();
}
public void PrevCategory()
{
CSongs.PrevCategory();
}
} }
class BVideo : IVideo class BVideo : IVideo
@@ -591,4 +635,12 @@ namespace Vocaluxe.Base
return CDataBase.GetCover(FileName, ref Texture, CoverSize); return CDataBase.GetCover(FileName, ref Texture, CoverSize);
} }
} }
class BInputs : IInputs
{
public void SetRumble(float Duration)
{
CInput.SetRumble(Duration);
}
}
} }
-14
View File
@@ -31,20 +31,6 @@ namespace Vocaluxe.Base
} }
} }
public class CCategory
{
public string Name = String.Empty;
public STexture CoverTextureSmall = new STexture();
public STexture CoverTextureBig = new STexture();
public CCategory(string name, STexture CoverSmall, STexture CoverBig)
{
Name = name;
CoverTextureSmall = CoverSmall;
CoverTextureBig = CoverBig;
}
}
static class CSongs static class CSongs
{ {
private static List<CSong> _Songs = new List<CSong>(); private static List<CSong> _Songs = new List<CSong>();
+3 -3
View File
@@ -8,8 +8,6 @@ using System.Windows.Forms;
using System.Xml; using System.Xml;
using System.Xml.XPath; using System.Xml.XPath;
//using Vocaluxe.Base;
using Vocaluxe.Lib.Draw;
using Vocaluxe.Menu; using Vocaluxe.Menu;
using Vocaluxe.Menu.SingNotes; using Vocaluxe.Menu.SingNotes;
using Vocaluxe.Menu.SongMenu; using Vocaluxe.Menu.SongMenu;
@@ -2342,10 +2340,11 @@ namespace Vocaluxe.Menu
public ISound Sound; public ISound Sound;
public ICover Cover; public ICover Cover;
public IDataBase DataBase; public IDataBase DataBase;
public IInputs Input;
public Base(IConfig Config, ISettings Settings, ITheme Theme, IHelper Helper, ILog Log, IBackgroundMusic BackgroundMusic, public Base(IConfig Config, ISettings Settings, ITheme Theme, IHelper Helper, ILog Log, IBackgroundMusic BackgroundMusic,
IDrawing Draw, IGraphics Graphics, IFonts Fonts, ILanguage Language, IGame Game, IProfiles Profiles, IRecording Record, IDrawing Draw, IGraphics Graphics, IFonts Fonts, ILanguage Language, IGame Game, IProfiles Profiles, IRecording Record,
ISongs Songs, IVideo Video, ISound Sound, ICover Cover, IDataBase DataBase) ISongs Songs, IVideo Video, ISound Sound, ICover Cover, IDataBase DataBase, IInputs Input)
{ {
this.Config = Config; this.Config = Config;
this.Settings = Settings; this.Settings = Settings;
@@ -2365,6 +2364,7 @@ namespace Vocaluxe.Menu
this.Sound = Sound; this.Sound = Sound;
this.Cover = Cover; this.Cover = Cover;
this.DataBase = DataBase; this.DataBase = DataBase;
this.Input = Input;
} }
} }
} }
-1
View File
@@ -7,7 +7,6 @@ using System.Xml.XPath;
using System.Windows.Forms; using System.Windows.Forms;
using Vocaluxe.Base; using Vocaluxe.Base;
using Vocaluxe.Lib.Draw;
using Vocaluxe.Menu.SongMenu; using Vocaluxe.Menu.SongMenu;
using Vocaluxe.GameModes; using Vocaluxe.GameModes;
+15
View File
@@ -135,6 +135,7 @@ namespace Vocaluxe.Menu
void DrawTexture(STexture Texture, SRectF Rect); void DrawTexture(STexture Texture, SRectF Rect);
void DrawTexture(STexture Texture, SRectF Rect, SColorF Color); void DrawTexture(STexture Texture, SRectF Rect, SColorF Color);
void DrawTexture(STexture Texture, SRectF Rect, SColorF Color, SRectF Bounds); void DrawTexture(STexture Texture, SRectF Rect, SColorF Color, SRectF Bounds);
void DrawTexture(STexture Texture, SRectF Rect, SColorF Color, SRectF Bounds, bool Mirrored);
void DrawTextureReflection(STexture Texture, SRectF Rect, SColorF Color, SRectF Bounds, float ReflectionSpace, float ReflectionHeight); void DrawTextureReflection(STexture Texture, SRectF Rect, SColorF Color, SRectF Bounds, float ReflectionSpace, float ReflectionHeight);
void RemoveTexture(ref STexture Texture); void RemoveTexture(ref STexture Texture);
@@ -198,11 +199,20 @@ namespace Vocaluxe.Menu
{ {
int GetNumVisibleSongs(); int GetNumVisibleSongs();
int GetNumCategories(); int GetNumCategories();
int NumSongsInCategory(int CategoryIndex);
int GetCurrentCategoryIndex(); int GetCurrentCategoryIndex();
EOffOn GetTabs();
string GetSearchFilter();
void SetCategory(int CategoryIndex); void SetCategory(int CategoryIndex);
void UpdateRandomSongList();
CSong GetVisibleSong(int VisibleIndex); CSong GetVisibleSong(int VisibleIndex);
CCategory GetCategory(int Index);
void NextCategory();
void PrevCategory();
} }
public interface IVideo public interface IVideo
@@ -240,6 +250,11 @@ namespace Vocaluxe.Menu
bool GetCover(string FileName, ref STexture Texture, int CoverSize); bool GetCover(string FileName, ref STexture Texture, int CoverSize);
} }
public interface IInputs
{
void SetRumble(float Duration);
}
[Flags] [Flags]
public enum EModifier public enum EModifier
{ {
+21
View File
@@ -29,6 +29,27 @@ namespace Vocaluxe.Menu.SongMenu
Tag Tag
} }
public class CCategory
{
public string Name = String.Empty;
public STexture CoverTextureSmall = new STexture();
public STexture CoverTextureBig = new STexture();
public CCategory(string name, STexture CoverSmall, STexture CoverBig)
{
Name = name;
CoverTextureSmall = CoverSmall;
CoverTextureBig = CoverBig;
}
public CCategory(CCategory cat)
{
Name = cat.Name;
CoverTextureSmall = cat.CoverTextureSmall;
CoverTextureBig = cat.CoverTextureBig;
}
}
public struct SMedley public struct SMedley
{ {
public EMedleySource Source; public EMedleySource Source;
+82 -84
View File
@@ -4,8 +4,6 @@ using System.Drawing;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using Vocaluxe.Base;
using Vocaluxe.Lib.Draw;
using Vocaluxe.Menu.SongMenu; using Vocaluxe.Menu.SongMenu;
using Vocaluxe.PartyModes; using Vocaluxe.PartyModes;
@@ -71,8 +69,8 @@ namespace Vocaluxe.Menu.SongMenu
_TileW = (int)((_Theme.songMenuTileBoard.TileRect.W - _SpaceW * (_NumW - 1)) / _NumW); _TileW = (int)((_Theme.songMenuTileBoard.TileRect.W - _SpaceW * (_NumW - 1)) / _NumW);
_TileH = (int)((_Theme.songMenuTileBoard.TileRect.H - _SpaceH * (_NumH - 1)) / _NumH); _TileH = (int)((_Theme.songMenuTileBoard.TileRect.H - _SpaceH * (_NumH - 1)) / _NumH);
_CoverTexture = CTheme.GetSkinTexture(_Theme.CoverBackgroundName); _CoverTexture = _Base.Theme.GetSkinTexture(_Theme.CoverBackgroundName);
_CoverBigTexture = CTheme.GetSkinTexture(_Theme.CoverBigBackgroundName); _CoverBigTexture = _Base.Theme.GetSkinTexture(_Theme.CoverBigBackgroundName);
_Tiles = new List<CStatic>(); _Tiles = new List<CStatic>();
for (int i = 0; i < _NumH; i++) for (int i = 0; i < _NumH; i++)
@@ -86,7 +84,7 @@ namespace Vocaluxe.Menu.SongMenu
} }
} }
_ScrollRect = new SRectF(0, 0, CSettings.iRenderW, CSettings.iRenderH, _Theme.songMenuTileBoard.TileRect.Z); _ScrollRect = new SRectF(0, 0, _Base.Settings.GetRenderW(), _Base.Settings.GetRenderH(), _Theme.songMenuTileBoard.TileRect.Z);
_PreviewSelected = -1; _PreviewSelected = -1;
_Offset = 0; _Offset = 0;
@@ -105,7 +103,7 @@ namespace Vocaluxe.Menu.SongMenu
public override void OnShow() public override void OnShow()
{ {
if (CSongs.Tabs == EOffOn.TR_CONFIG_OFF && CSongs.NumCategories > 0 && CSongs.Category == -1) if (_Base.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && _Base.Songs.GetNumCategories() > 0 && _Base.Songs.GetCurrentCategoryIndex() == -1)
{ {
EnterCategory(0); EnterCategory(0);
} }
@@ -116,13 +114,13 @@ namespace Vocaluxe.Menu.SongMenu
//AfterCategoryChange(); //AfterCategoryChange();
SetSelectedSong(_ActSong); SetSelectedSong(_ActSong);
AfterCategoryChange(); AfterCategoryChange();
CSongs.UpdateRandomSongList(); _Base.Songs.UpdateRandomSongList();
int actcat = _PreviewSelected; int actcat = _PreviewSelected;
if ((CSongs.NumCategories > 0) && (actcat < 0)) if ((_Base.Songs.GetNumCategories() > 0) && (actcat < 0))
{ {
_CoverBig.Texture = CSongs.Categories[0].CoverTextureSmall; _CoverBig.Texture = _Base.Songs.GetCategory(0).CoverTextureSmall;
_Artist.Text = CSongs.Categories[0].Name; _Artist.Text = _Base.Songs.GetCategory(0).Name;
_Title.Text = String.Empty; _Title.Text = String.Empty;
_SongLength.Text = String.Empty; _SongLength.Text = String.Empty;
_PreviewSelected = 0; _PreviewSelected = 0;
@@ -133,7 +131,7 @@ namespace Vocaluxe.Menu.SongMenu
_MedleyTagIcon.Visible = false; _MedleyTagIcon.Visible = false;
} }
if (CSongs.NumVisibleSongs == 0 && CSongs.SearchFilter != String.Empty) if (_Base.Songs.GetNumVisibleSongs() == 0 && _Base.Songs.GetSearchFilter() != String.Empty)
{ {
_CoverBig.Texture = _CoverBigTexture; _CoverBig.Texture = _CoverBigTexture;
_Artist.Text = String.Empty; _Artist.Text = String.Empty;
@@ -194,7 +192,7 @@ namespace Vocaluxe.Menu.SongMenu
switch (KeyEvent.Key) switch (KeyEvent.Key)
{ {
case Keys.Enter: case Keys.Enter:
if (CSongs.Category < 0) if (_Base.Songs.GetCurrentCategoryIndex() < 0)
{ {
EnterCategory(_PreviewSelected); EnterCategory(_PreviewSelected);
KeyEvent.Handled = true; KeyEvent.Handled = true;
@@ -207,71 +205,71 @@ namespace Vocaluxe.Menu.SongMenu
case Keys.Escape: case Keys.Escape:
case Keys.Back: case Keys.Back:
if (CSongs.Category > -1 && CSongs.Tabs == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed) if (_Base.Songs.GetCurrentCategoryIndex() > -1 && _Base.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed)
{ {
ShowCategories(); ShowCategories();
KeyEvent.Handled = true; KeyEvent.Handled = true;
} }
//else if (CSongs.Tabs == EOffOn.TR_CONFIG_OFF) //else if (_Base.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF)
//{ //{
// CGraphics.FadeTo(EScreens.ScreenMain); // CGraphics.FadeTo(EScreens.ScreenMain);
//} //}
break; break;
case Keys.PageUp: case Keys.PageUp:
if (CSongs.Tabs == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed) if (_Base.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed)
{ {
PrevCategory(); PrevCategory();
} }
break; break;
case Keys.PageDown: case Keys.PageDown:
if (CSongs.Tabs == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed) if (_Base.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed)
{ {
NextCategory(); NextCategory();
} }
break; break;
case Keys.Left: case Keys.Left:
if (_Locked > 0 && (!SongOptions.Selection.RandomOnly || SongOptions.Selection.CategoryChangeAllowed && CSongs.Category < 0)) if (_Locked > 0 && (!SongOptions.Selection.RandomOnly || SongOptions.Selection.CategoryChangeAllowed && _Base.Songs.GetCurrentCategoryIndex() < 0))
{ {
_Locked--; _Locked--;
if (CSongs.Category < 0 && _Locked < CSongs.NumCategories - _NumW || if (_Base.Songs.GetCurrentCategoryIndex() < 0 && _Locked < _Base.Songs.GetNumCategories() - _NumW ||
CSongs.Category >= 0 && _Locked < CSongs.NumVisibleSongs - _NumW) _Base.Songs.GetCurrentCategoryIndex() >= 0 && _Locked < _Base.Songs.GetNumVisibleSongs() - _NumW)
UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2))); UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2)));
} }
break; break;
case Keys.Right: case Keys.Right:
if (CSongs.Category < 0 && SongOptions.Selection.CategoryChangeAllowed) if (_Base.Songs.GetCurrentCategoryIndex() < 0 && SongOptions.Selection.CategoryChangeAllowed)
{ {
if (_Locked < CSongs.NumCategories - 1) if (_Locked < _Base.Songs.GetNumCategories() - 1)
{ {
_Locked++; _Locked++;
if (_Locked < CSongs.NumCategories - _NumW) if (_Locked < _Base.Songs.GetNumCategories() - _NumW)
UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2))); UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2)));
} }
} }
else else
{ {
if (CSongs.Category != -1 && _Locked < CSongs.NumVisibleSongs - 1 && !SongOptions.Selection.RandomOnly) if (_Base.Songs.GetCurrentCategoryIndex() != -1 && _Locked < _Base.Songs.GetNumVisibleSongs() - 1 && !SongOptions.Selection.RandomOnly)
{ {
_Locked++; _Locked++;
if (_Locked < CSongs.NumVisibleSongs - _NumW) if (_Locked < _Base.Songs.GetNumVisibleSongs() - _NumW)
UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2))); UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2)));
} }
} }
break; break;
case Keys.Up: case Keys.Up:
if (KeyEvent.ModSHIFT && CSongs.Tabs == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed) if (KeyEvent.ModSHIFT && _Base.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed)
{ {
PrevCategory(); PrevCategory();
break; break;
} }
if (_Locked > _NumW - 1 && (!SongOptions.Selection.RandomOnly || SongOptions.Selection.CategoryChangeAllowed && CSongs.Category < 0)) if (_Locked > _NumW - 1 && (!SongOptions.Selection.RandomOnly || SongOptions.Selection.CategoryChangeAllowed && _Base.Songs.GetCurrentCategoryIndex() < 0))
{ {
_Locked -= _NumW; _Locked -= _NumW;
UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2))); UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2)));
@@ -279,28 +277,28 @@ namespace Vocaluxe.Menu.SongMenu
break; break;
case Keys.Down: case Keys.Down:
if (KeyEvent.ModSHIFT && CSongs.Tabs == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed) if (KeyEvent.ModSHIFT && _Base.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed)
{ {
NextCategory(); NextCategory();
break; break;
} }
if (CSongs.Category < 0 && SongOptions.Selection.CategoryChangeAllowed) if (_Base.Songs.GetCurrentCategoryIndex() < 0 && SongOptions.Selection.CategoryChangeAllowed)
{ {
if (_Locked < CSongs.NumCategories - _NumW) if (_Locked < _Base.Songs.GetNumCategories() - _NumW)
{ {
_Locked += _NumW; _Locked += _NumW;
if (_Locked < CSongs.NumCategories - _NumW) if (_Locked < _Base.Songs.GetNumCategories() - _NumW)
UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2))); UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2)));
} }
} }
else else
{ {
if (_Locked < CSongs.NumVisibleSongs - _NumW && !SongOptions.Selection.RandomOnly) if (_Locked < _Base.Songs.GetNumVisibleSongs() - _NumW && !SongOptions.Selection.RandomOnly)
{ {
_Locked += _NumW; _Locked += _NumW;
if (_Locked < CSongs.NumVisibleSongs - _NumW) if (_Locked < _Base.Songs.GetNumVisibleSongs() - _NumW)
UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2))); UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2)));
} }
} }
@@ -330,13 +328,13 @@ namespace Vocaluxe.Menu.SongMenu
bool sel = false; bool sel = false;
int lastselection = _actualSelection; int lastselection = _actualSelection;
if (!SongOptions.Selection.RandomOnly || CSongs.Category < 0 && SongOptions.Selection.CategoryChangeAllowed) if (!SongOptions.Selection.RandomOnly || _Base.Songs.GetCurrentCategoryIndex() < 0 && SongOptions.Selection.CategoryChangeAllowed)
{ {
foreach (CStatic tile in _Tiles) foreach (CStatic tile in _Tiles)
{ {
if ((tile.Texture.index != _CoverTexture.index) && CHelper.IsInBounds(tile.Rect, MouseEvent) && !sel) if ((tile.Texture.index != _CoverTexture.index) && CHelper.IsInBounds(tile.Rect, MouseEvent) && !sel)
{ {
if (MouseEvent.LB || CSongs.Category == -1) if (MouseEvent.LB || _Base.Songs.GetCurrentCategoryIndex() == -1)
{ {
if (_PreviewSelected == i + _Offset) if (_PreviewSelected == i + _Offset)
_Locked = _PreviewSelected; _Locked = _PreviewSelected;
@@ -361,28 +359,28 @@ namespace Vocaluxe.Menu.SongMenu
sel = true; sel = true;
if (MouseEvent.Sender == ESender.WiiMote && _actualSelection != lastselection && _actualSelection != -1) if (MouseEvent.Sender == ESender.WiiMote && _actualSelection != lastselection && _actualSelection != -1)
CInput.SetRumble(0.050f); _Base.Input.SetRumble(0.050f);
if (!sel) if (!sel)
_actualSelection = -1; _actualSelection = -1;
if ((MouseEvent.RB) && (CSongs.NumCategories > 0) && CSongs.Category >= 0 && CSongs.Tabs == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed) if ((MouseEvent.RB) && (_Base.Songs.GetNumCategories() > 0) && _Base.Songs.GetCurrentCategoryIndex() >= 0 && _Base.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed)
{ {
ShowCategories(); ShowCategories();
return; return;
} }
else if (MouseEvent.RB && CSongs.Tabs == EOffOn.TR_CONFIG_OFF && !SongOptions.Selection.PartyMode) else if (MouseEvent.RB && _Base.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && !SongOptions.Selection.PartyMode)
{ {
CGraphics.FadeTo(EScreens.ScreenMain); CGraphics.FadeTo(EScreens.ScreenMain);
} }
else if (_PreviewSelected != -1 && MouseEvent.LB && CSongs.Category != -1 && !SongOptions.Selection.PartyMode) else if (_PreviewSelected != -1 && MouseEvent.LB && _Base.Songs.GetCurrentCategoryIndex() != -1 && !SongOptions.Selection.PartyMode)
{ {
if (CHelper.IsInBounds(_CoverBig.Rect, MouseEvent) || CHelper.IsInBounds(_TextBG.Rect, MouseEvent)) if (CHelper.IsInBounds(_CoverBig.Rect, MouseEvent) || CHelper.IsInBounds(_TextBG.Rect, MouseEvent))
{ {
_Locked = _PreviewSelected; _Locked = _PreviewSelected;
} }
} }
else if ((MouseEvent.LB) && (CSongs.Category == -1)) else if ((MouseEvent.LB) && (_Base.Songs.GetCurrentCategoryIndex() == -1))
{ {
foreach (CStatic tile in _Tiles) foreach (CStatic tile in _Tiles)
{ {
@@ -396,10 +394,10 @@ namespace Vocaluxe.Menu.SongMenu
if (MouseEvent.Wheel > 0) if (MouseEvent.Wheel > 0)
{ {
if (CHelper.IsInBounds(_ScrollRect, MouseEvent) && (!SongOptions.Selection.RandomOnly || CSongs.Category < 0 && SongOptions.Selection.CategoryChangeAllowed)) if (CHelper.IsInBounds(_ScrollRect, MouseEvent) && (!SongOptions.Selection.RandomOnly || _Base.Songs.GetCurrentCategoryIndex() < 0 && SongOptions.Selection.CategoryChangeAllowed))
{ {
if (CSongs.Category >= 0 && CSongs.NumVisibleSongs > _Offset + _NumW * MouseEvent.Wheel + _NumW * (_NumH - 1) || if (_Base.Songs.GetCurrentCategoryIndex() >= 0 && _Base.Songs.GetNumVisibleSongs() > _Offset + _NumW * MouseEvent.Wheel + _NumW * (_NumH - 1) ||
CSongs.Category < 0 && CSongs.NumCategories > _Offset + _NumW * MouseEvent.Wheel + _NumW * (_NumH - 1)) _Base.Songs.GetCurrentCategoryIndex() < 0 && _Base.Songs.GetNumCategories() > _Offset + _NumW * MouseEvent.Wheel + _NumW * (_NumH - 1))
{ {
_Offset += _NumW * MouseEvent.Wheel; _Offset += _NumW * MouseEvent.Wheel;
UpdateList(_Offset); UpdateList(_Offset);
@@ -409,7 +407,7 @@ namespace Vocaluxe.Menu.SongMenu
if (MouseEvent.Wheel < 0) if (MouseEvent.Wheel < 0)
{ {
if (CHelper.IsInBounds(_ScrollRect, MouseEvent) && (!SongOptions.Selection.RandomOnly || CSongs.Category < 0 && SongOptions.Selection.CategoryChangeAllowed)) if (CHelper.IsInBounds(_ScrollRect, MouseEvent) && (!SongOptions.Selection.RandomOnly || _Base.Songs.GetCurrentCategoryIndex() < 0 && SongOptions.Selection.CategoryChangeAllowed))
{ {
_Offset += _NumW * MouseEvent.Wheel; _Offset += _NumW * MouseEvent.Wheel;
if (_Offset < 0) if (_Offset < 0)
@@ -436,12 +434,12 @@ namespace Vocaluxe.Menu.SongMenu
} }
} }
if (CSongs.Category >= 0) if (_Base.Songs.GetCurrentCategoryIndex() >= 0)
{ {
int actsong = _PreviewSelected; int actsong = _PreviewSelected;
if ((CSongs.NumVisibleSongs > actsong) && (actsong >= 0)) if ((_Base.Songs.GetNumVisibleSongs() > actsong) && (actsong >= 0))
{ {
CSong song = CSongs.VisibleSongs[actsong]; CSong song = _Base.Songs.GetVisibleSong(actsong);
_CoverBig.Texture = song.CoverTextureSmall; _CoverBig.Texture = song.CoverTextureSmall;
_Artist.Text = song.Artist; _Artist.Text = song.Artist;
@@ -451,7 +449,7 @@ namespace Vocaluxe.Menu.SongMenu
_MedleyCalcIcon.Visible = song.Medley.Source == EMedleySource.Calculated; _MedleyCalcIcon.Visible = song.Medley.Source == EMedleySource.Calculated;
_MedleyTagIcon.Visible = song.Medley.Source == EMedleySource.Tag; _MedleyTagIcon.Visible = song.Medley.Source == EMedleySource.Tag;
float Time = CSound.GetLength(_SongStream); float Time = _Base.Sound.GetLength(_SongStream);
if (song.Finish != 0) if (song.Finish != 0)
Time = song.Finish; Time = song.Finish;
@@ -464,16 +462,16 @@ namespace Vocaluxe.Menu.SongMenu
else else
{ {
int actcat = _PreviewSelected; int actcat = _PreviewSelected;
if ((CSongs.NumCategories > actcat) && (actcat >= 0)) if ((_Base.Songs.GetNumCategories() > actcat) && (actcat >= 0))
{ {
_CoverBig.Texture = CSongs.Categories[actcat].CoverTextureSmall; _CoverBig.Texture = _Base.Songs.GetCategory(actcat).CoverTextureSmall;
_Artist.Text = CSongs.Categories[actcat].Name; _Artist.Text = _Base.Songs.GetCategory(actcat).Name;
int num = CSongs.NumSongsInCategory(actcat); int num = _Base.Songs.NumSongsInCategory(actcat);
if (num != 1) if (num != 1)
_Title.Text = CLanguage.Translate("TR_SCREENSONG_NUMSONGS").Replace("%v", num.ToString()); _Title.Text = _Base.Language.Translate("TR_SCREENSONG_NUMSONGS").Replace("%v", num.ToString());
else else
_Title.Text = CLanguage.Translate("TR_SCREENSONG_NUMSONG").Replace("%v", num.ToString()); _Title.Text = _Base.Language.Translate("TR_SCREENSONG_NUMSONG").Replace("%v", num.ToString());
_SongLength.Text = String.Empty; _SongLength.Text = String.Empty;
_DuetIcon.Visible = false; _DuetIcon.Visible = false;
@@ -495,9 +493,9 @@ namespace Vocaluxe.Menu.SongMenu
RectangleF rect = new RectangleF(0f, 0f, _vidtex.width, _vidtex.height); RectangleF rect = new RectangleF(0f, 0f, _vidtex.width, _vidtex.height);
CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop); CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop);
CDraw.DrawTexture(_vidtex, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z), _Base.Drawing.DrawTexture(_vidtex, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z),
_vidtex.color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false); _vidtex.color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false);
CDraw.DrawTextureReflection(_vidtex, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z), _Base.Drawing.DrawTextureReflection(_vidtex, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z),
_vidtex.color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), _CoverBig.ReflectionSpace, _CoverBig.ReflectionHeight); _vidtex.color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), _CoverBig.ReflectionSpace, _CoverBig.ReflectionHeight);
} }
@@ -535,7 +533,7 @@ namespace Vocaluxe.Menu.SongMenu
if (VisibleSongNr < 0) if (VisibleSongNr < 0)
return; return;
if (CSongs.NumVisibleSongs > VisibleSongNr) if (_Base.Songs.GetNumVisibleSongs() > VisibleSongNr)
{ {
bool sel = false; bool sel = false;
foreach (CStatic tile in _Tiles) foreach (CStatic tile in _Tiles)
@@ -592,7 +590,7 @@ namespace Vocaluxe.Menu.SongMenu
if (CategoryNr < 0) if (CategoryNr < 0)
return; return;
if (CSongs.Categories.Length > CategoryNr) if (_Base.Songs.GetNumCategories() > CategoryNr)
{ {
bool sel = false; bool sel = false;
foreach (CStatic tile in _Tiles) foreach (CStatic tile in _Tiles)
@@ -663,22 +661,22 @@ namespace Vocaluxe.Menu.SongMenu
private void NextCategory() private void NextCategory()
{ {
if (CSongs.Category > -1) if (_Base.Songs.GetCurrentCategoryIndex() > -1)
{ {
Reset(); Reset();
CSongs.NextCategory(); _Base.Songs.NextCategory();
EnterCategory(CSongs.Category); EnterCategory(_Base.Songs.GetCurrentCategoryIndex());
_Locked = 0; _Locked = 0;
} }
} }
private void PrevCategory() private void PrevCategory()
{ {
if (CSongs.Category > -1) if (_Base.Songs.GetCurrentCategoryIndex() > -1)
{ {
Reset(); Reset();
CSongs.PrevCategory(); _Base.Songs.PrevCategory();
EnterCategory(CSongs.Category); EnterCategory(_Base.Songs.GetCurrentCategoryIndex());
_Locked = 0; _Locked = 0;
} }
} }
@@ -696,26 +694,26 @@ namespace Vocaluxe.Menu.SongMenu
if (_actualSelection >= 0 && _actualSelection < _Tiles.Count) if (_actualSelection >= 0 && _actualSelection < _Tiles.Count)
_Tiles[_actualSelection].Selected = true; _Tiles[_actualSelection].Selected = true;
if ((_LastKnownNumSongs == CSongs.NumVisibleSongs) && (_LastKnownCategory == CSongs.Category)) if ((_LastKnownNumSongs == _Base.Songs.GetNumVisibleSongs()) && (_LastKnownCategory == _Base.Songs.GetCurrentCategoryIndex()))
return; return;
_LastKnownCategory = CSongs.Category; _LastKnownCategory = _Base.Songs.GetCurrentCategoryIndex();
_LastKnownNumSongs = CSongs.NumVisibleSongs; _LastKnownNumSongs = _Base.Songs.GetNumVisibleSongs();
UpdateList(0); UpdateList(0);
CSongs.UpdateRandomSongList(); _Base.Songs.UpdateRandomSongList();
} }
private void UpdateList(int offset) private void UpdateList(int offset)
{ {
if (CSongs.Category > -1) if (_Base.Songs.GetCurrentCategoryIndex() > -1)
{ {
if (offset >= (CSongs.NumVisibleSongs / _NumW) * _NumW - (_NumW * (_NumH - 1))) if (offset >= (_Base.Songs.GetNumVisibleSongs() / _NumW) * _NumW - (_NumW * (_NumH - 1)))
offset = (CSongs.NumVisibleSongs / _NumW) * _NumW - (_NumW * (_NumH - 1)); offset = (_Base.Songs.GetNumVisibleSongs() / _NumW) * _NumW - (_NumW * (_NumH - 1));
} }
else else
{ {
if (offset >= (CSongs.NumCategories / _NumW) * _NumW - (_NumW * (_NumH - 1))) if (offset >= (_Base.Songs.GetNumCategories() / _NumW) * _NumW - (_NumW * (_NumH - 1)))
offset = (CSongs.NumCategories / _NumW) * _NumW - (_NumW * (_NumH - 1)); offset = (_Base.Songs.GetNumCategories() / _NumW) * _NumW - (_NumW * (_NumH - 1));
} }
if (offset < 0) if (offset < 0)
@@ -723,11 +721,11 @@ namespace Vocaluxe.Menu.SongMenu
for (int i = 0; i < _Tiles.Count; i++) for (int i = 0; i < _Tiles.Count; i++)
{ {
if (CSongs.Category >= 0) if (_Base.Songs.GetCurrentCategoryIndex() >= 0)
{ {
if (CSongs.NumVisibleSongs > i + offset) if (_Base.Songs.GetNumVisibleSongs() > i + offset)
{ {
_Tiles[i].Texture = CSongs.VisibleSongs[i + offset].CoverTextureSmall; _Tiles[i].Texture = _Base.Songs.GetVisibleSong(i + offset).CoverTextureSmall;
_Tiles[i].Color = new SColorF(1f, 1f, 1f, 1f); _Tiles[i].Color = new SColorF(1f, 1f, 1f, 1f);
} }
else else
@@ -737,11 +735,11 @@ namespace Vocaluxe.Menu.SongMenu
} }
} }
if (CSongs.Category == -1) if (_Base.Songs.GetCurrentCategoryIndex() == -1)
{ {
if (CSongs.NumCategories > i + offset) if (_Base.Songs.GetNumCategories() > i + offset)
{ {
_Tiles[i].Texture = CSongs.Categories[i + offset].CoverTextureSmall; _Tiles[i].Texture = _Base.Songs.GetCategory(i + offset).CoverTextureSmall;
_Tiles[i].Color = new SColorF(1f, 1f, 1f, 1f); _Tiles[i].Color = new SColorF(1f, 1f, 1f, 1f);
} }
else else
@@ -768,8 +766,8 @@ namespace Vocaluxe.Menu.SongMenu
_TileW = (int)((_Theme.songMenuTileBoard.TileRectSmall.W - _SpaceW * (_NumW - 1)) / _NumW); _TileW = (int)((_Theme.songMenuTileBoard.TileRectSmall.W - _SpaceW * (_NumW - 1)) / _NumW);
_TileH = (int)((_Theme.songMenuTileBoard.TileRectSmall.H - _SpaceH * (_NumH - 1)) / _NumH); _TileH = (int)((_Theme.songMenuTileBoard.TileRectSmall.H - _SpaceH * (_NumH - 1)) / _NumH);
_CoverTexture = CTheme.GetSkinTexture(_Theme.CoverBackgroundName); _CoverTexture = _Base.Theme.GetSkinTexture(_Theme.CoverBackgroundName);
_CoverBigTexture = CTheme.GetSkinTexture(_Theme.CoverBigBackgroundName); _CoverBigTexture = _Base.Theme.GetSkinTexture(_Theme.CoverBigBackgroundName);
_Tiles = new List<CStatic>(); _Tiles = new List<CStatic>();
for (int i = 0; i < _NumH; i++) for (int i = 0; i < _NumH; i++)
@@ -784,7 +782,7 @@ namespace Vocaluxe.Menu.SongMenu
} }
_Rect = _Theme.songMenuTileBoard.TileRectSmall; _Rect = _Theme.songMenuTileBoard.TileRectSmall;
_ScrollRect = new SRectF(0, 0, CSettings.iRenderW, CSettings.iRenderH, _Theme.songMenuTileBoard.TileRectSmall.Z); _ScrollRect = new SRectF(0, 0, _Base.Settings.GetRenderW(), _Base.Settings.GetRenderH(), _Theme.songMenuTileBoard.TileRectSmall.Z);
} }
else else
{ {
@@ -794,8 +792,8 @@ namespace Vocaluxe.Menu.SongMenu
_TileW = (int)((_Theme.songMenuTileBoard.TileRect.W - _SpaceW * (_NumW - 1)) / _NumW); _TileW = (int)((_Theme.songMenuTileBoard.TileRect.W - _SpaceW * (_NumW - 1)) / _NumW);
_TileH = (int)((_Theme.songMenuTileBoard.TileRect.H - _SpaceH * (_NumH - 1)) / _NumH); _TileH = (int)((_Theme.songMenuTileBoard.TileRect.H - _SpaceH * (_NumH - 1)) / _NumH);
_CoverTexture = CTheme.GetSkinTexture(_Theme.CoverBackgroundName); _CoverTexture = _Base.Theme.GetSkinTexture(_Theme.CoverBackgroundName);
_CoverBigTexture = CTheme.GetSkinTexture(_Theme.CoverBigBackgroundName); _CoverBigTexture = _Base.Theme.GetSkinTexture(_Theme.CoverBigBackgroundName);
_Tiles = new List<CStatic>(); _Tiles = new List<CStatic>();
for (int i = 0; i < _NumH; i++) for (int i = 0; i < _NumH; i++)
@@ -810,7 +808,7 @@ namespace Vocaluxe.Menu.SongMenu
} }
_Rect = _Theme.songMenuTileBoard.TileRect; _Rect = _Theme.songMenuTileBoard.TileRect;
_ScrollRect = new SRectF(0, 0, CSettings.iRenderW, CSettings.iRenderH, _Theme.songMenuTileBoard.TileRect.Z); _ScrollRect = new SRectF(0, 0, _Base.Settings.GetRenderW(), _Base.Settings.GetRenderH(), _Theme.songMenuTileBoard.TileRect.Z);
} }
UpdateList(_Offset); UpdateList(_Offset);