Merge remote-tracking branch 'refs/remotes/Vocaluxe/develop' into Multimonitor

Modify CProgressBar to transfer properties to code-generated progressbars that does not exist in the screen xml
This commit is contained in:
Jiiniasu committed 2017-09-23 15:28:25 +02:00
commit 53d22b1082
111 files changed
+3397 -10358

No files matched your search

+22 -48
View File
@@ -15,11 +15,9 @@
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
#endregion
using System;
using System.Diagnostics;
using System.Xml.Serialization;
using VocaluxeLib.Draw;
using VocaluxeLib.Xml;
namespace VocaluxeLib.Menu
{
@@ -73,6 +71,15 @@ namespace VocaluxeLib.Menu
public EAspect Aspect = EAspect.Stretch;
/// <summary>
/// Adjust this value if you want to draw only a part of your texture, width
/// </summary>
public float ModW = -1f;
/// <summary>
/// Adjust this value if you want to draw only a part of your texture, height
/// </summary>
public float ModH = -1f;
public CStatic(int partyModeID)
{
_PartyModeID = partyModeID;
@@ -118,52 +125,6 @@ namespace VocaluxeLib.Menu
ThemeLoaded = true;
}
public bool LoadTheme(string xmlPath, string elementName, CXmlReader xmlReader)
{
string item = xmlPath + "/" + elementName;
ThemeLoaded = true;
ThemeLoaded &= xmlReader.GetValue(item + "/Skin", out _Theme.Skin, String.Empty);
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref _Theme.Rect.X);
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref _Theme.Rect.Y);
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Z", ref _Theme.Rect.Z);
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref _Theme.Rect.W);
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref _Theme.Rect.H);
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
ThemeLoaded &= _Theme.Color.Get(_PartyModeID, out Color);
else
{
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R);
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/G", ref Color.G);
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/B", ref Color.B);
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A);
}
_Theme.Color.Color = Color;
if (xmlReader.ItemExists(item + "/Reflection"))
{
Reflection = true;
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Reflection/Space", ref ReflectionSpace);
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Reflection/Height", ref ReflectionHeight);
_Theme.Reflection = new SReflection(ReflectionHeight, ReflectionSpace);
}
else
{
Reflection = false;
_Theme.Reflection = null;
}
if (ThemeLoaded)
{
_Theme.Name = elementName;
LoadSkin();
}
return ThemeLoaded;
}
public void Draw()
{
Draw(Aspect);
@@ -173,8 +134,21 @@ namespace VocaluxeLib.Menu
{
CTextureRef texture = Texture;
SRectF bounds = Rect.Scale(scale);
//Change bounds if rect size should be modified without adjusting texture
if (ModH != -1)
bounds.H = ModH * scale;
if (ModW != -1)
bounds.W = ModW * scale;
bounds.Z += zModify;
SRectF rect = texture == null ? bounds : CHelper.FitInBounds(bounds, texture.OrigAspect, aspect);
//Use original rect
if (ModH != -1 || ModW != -1)
rect = Rect.Scale(scale);
var color = new SColorF(Color.R, Color.G, Color.B, Color.A * Alpha);
if (Visible || forceDraw || (CBase.Settings.GetProgramState() == EProgramState.EditTheme))
{