Files
Vocaluxe/VocaluxeLib/Menu/COrderedDictionaryLite.cs
McSchneidarandFlorian Ostertag 6601f41aac Redesign option screens (#931)
* Redesign and improve option screens

- Open the options directly from the main menu with the focus on the navigation, all option screens share a navigation with all categories, song folders and credits
- Navigation and settings use rounded backgrounds like the party mode selection, the current category and setting are highlighted with the selection color of the skin
- Categories can be clicked or switched with Tab, Escape moves the focus to the navigation and leaves the options from there, choosing a category moves the focus to its first setting
- Place the action buttons (delay test, adjust screen, server address, add folder) and the webcam preview inside the settings background
- Center the restart and microphone warnings below the settings background
- Move song folder management to its own screen with a list of all folders, add and remove buttons, a scrollbar and a restart warning
- Add the tile caption option to the game options (only selectable when the song menu is set to tiles)
- Remove the old options selection screen (ScreenOptions)
- Fix configured song folders being ignored when the first entry of the config is empty
- Show the folder dialog in front of the game window
- Fix background music source being overwritten by the karaoke effect setting
- Keep the webcam configuration when no webcam is connected
- Warn when several players are assigned to the same record channel
- Show a warning when no microphone is found
- Remove cover sizes 32 and 64 and keep unknown cover sizes until changed
- Play warning sounds again each time an option screen is shown
- Ignore key pressed events in graphics and server options
- Keep the background music volume in sync in the sound options

* Fix SonarCloud issues

---------

Co-authored-by: Florian Ostertag <flokuep@users.noreply.github.com>
2026-10-21 09:12:04 +02:00

113 lines
3.0 KiB
C#

#region license
// This file is part of Vocaluxe.
//
// Vocaluxe is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Vocaluxe is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
#endregion
using System;
using System.Collections;
using System.Collections.Generic;
using VocaluxeLib.Log;
namespace VocaluxeLib.Menu
{
public class COrderedDictionaryLite<T> : IEnumerable<T>
{
private readonly List<T> _Items;
private readonly Dictionary<String, int> _HtIndex;
private readonly String _ParentName;
public COrderedDictionaryLite(object parent)
{
_Items = new List<T>();
_HtIndex = new Dictionary<String, int>();
_ParentName = parent.GetType().Name;
if (_ParentName[0] == 'C' && Char.IsUpper(_ParentName[1]))
{
_ParentName = _ParentName.Remove(0, 1);
}
}
public int Count
{
get { return _Items.Count; }
}
public T this[int index]
{
get { return _Items[index]; }
set { _Items[index] = value; }
}
public T this[string key]
{
get
{
try
{
return _Items[_HtIndex[key]];
}
catch (Exception)
{
CLog.Error("Can't find " + typeof(T).Name.Substring(1) + " Element \"" + key + "\" in " + _ParentName);
throw;
}
}
set
{
if (!_HtIndex.ContainsKey(key))
{
_HtIndex.Add(key, _Items.Count);
_Items.Add(value);
}
else
{
_Items[_HtIndex[key]] = value;
}
}
}
public int Add(T item, String key = null)
{
if (key != null)
{
_HtIndex.Add(key, _Items.Count);
}
_Items.Add(item);
return _Items.Count - 1;
}
public bool ContainsKey(String key)
{
return _HtIndex.ContainsKey(key);
}
public IEnumerator<T> GetEnumerator()
{
return _Items.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public void Clear()
{
_HtIndex.Clear();
_Items.Clear();
}
}
}