Experience Index Returns (Open-source)

Discussion in 'MDL Projects and Applications' started by K4onashi, Apr 7, 2016.

Thread Status:
Not open for further replies.
  1. K4onashi

    K4onashi MDL Debugger

    Mar 7, 2012
    1,815
    1,986
    60
    Okay, Region.ini it is :D
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. ItielMaN

    ItielMaN MDL Senior Member

    Apr 30, 2011
    367
    59
    10
    Can you release a last beta with Edit Scores enabled? So we'd be able to QA it first.
     
  3. K4onashi

    K4onashi MDL Debugger

    Mar 7, 2012
    1,815
    1,986
    60
    Yes, that module is currently being finished.

    I will let you know once more information is available.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. K4onashi

    K4onashi MDL Debugger

    Mar 7, 2012
    1,815
    1,986
    60
    #565 K4onashi, Feb 3, 2020
    Last edited: Feb 3, 2020
    (OP)
    Thanks @CHEF-KOCH. For NVReform the settings and language strings have been merged into one .ini file so the profile resolver can be unified. Now I have English, Spanish and French all checked by native speakers. It's going well.

    The language file here is not a language file, it's a compatibility file to check strings per culture. The application is years old, arse-backwards and made in VB. Translation is not on the table unless my friend decides to change that.

    Working on this:

    Code:
      class Configuration
        {
            internal static readonly string IniFile = Path.Combine(Paths.GetLocalPath(), "NVReform.ini");
    
            internal static string ReadIniValue(string Section, string Key, string Default = "")
            {
                StringBuilder Builder = new StringBuilder(500);
                if (NativeMethods.GetPrivateProfileString(Section, Key, Default, Builder, Builder.Capacity, IniFile) == true)
                {
                    return Builder.ToString();
                }
                return Default;
            }
    
            internal void WriteIniValue(string Section, string Key, string Data)
            {
               NativeMethods.WritePrivateProfileString(Section, Key, Data, IniFile);      
            }
    
            internal void DeleteIniSection(string Section)
            {
                WriteIniValue(null, null, Section);
            }
    
            internal void DeleteIniKey(string Key, string Section)
            {
                WriteIniValue(Key, null, Section);
            }
    
            internal bool IniKeyExists(string Key, string Section)
            {
                return ReadIniValue(Key, Section).Length != 0;
            }
    // - - - - >
    
    And the language resolver inherits the config:

    Code:
      class Language : Configuration
        {
    
            #region Functions
            internal static bool SettingsFileExists()
            {
                if (File.Exists(IniFile))
                {
                    try
                    {
                        if (ReadIniValue("Identifier", "Key", "") == "NVReform")
                        {
                            return true;
                        }
                    } catch (IOException) {
                        return false;
                        throw;
                    }
                }
                return false;
            }
    // - - - - >
    
    Regards.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. K4onashi

    K4onashi MDL Debugger

    Mar 7, 2012
    1,815
    1,986
    60
    This is still being worked on. I'm currently working on the language system for something else, first time and proving a little problematic.

    Regards.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. K4onashi

    K4onashi MDL Debugger

    Mar 7, 2012
    1,815
    1,986
    60
    #567 K4onashi, Feb 13, 2020
    Last edited: Feb 13, 2020
    (OP)
    I am working on UI aspects here. Some *framework* stuff needed work. The Checkbox has had it's size shrunk by a few pixels and RadioButton has received better rendering and QOL changes.

    Untitled.png

    New paint method example from GambolRadioButton, controls are now designed to handle disposing before objects are out of scope.
    Code:
            Protected Overrides Sub OnPaint(e As PaintEventArgs)
    
                Dim Diameter As Integer = ClientRectangle.Height - 1
                Dim OuterRectangle As New RectangleF(0, 0, Diameter, Diameter)
                Dim InnerRectangle As New RectangleF(1, 1, Diameter - 2, Diameter - 2)
    
                If e IsNot Nothing Then
    
                    Dim G As Graphics = e.Graphics
                    G.Clear(BackColor)
                    G.InterpolationMode = InterpolationMode.HighQualityBicubic
                    G.SmoothingMode = SmoothingMode.AntiAlias
                    G.CompositingQuality = CompositingQuality.HighQuality
    
                    Using SB As New SolidBrush(RadioBackColor)
                        G.FillEllipse(SB, InnerRectangle)
                    End Using
    
                    Using P As New Pen(InactiveBorderColor, 2.0F)
                        G.DrawEllipse(P, InnerRectangle)
                    End Using
    
                    OuterRectangle.Inflate(-1, -1)
    
                    If MouseHovered Then
                        Using P As New Pen(ActiveBorderColor, 2.0F)
                            G.DrawArc(P, OuterRectangle, 135, 180)
                            G.DrawArc(P, OuterRectangle, -45, 180)
                        End Using
    
                        InnerRectangle.Inflate(-1, -1)
    
                        Using SB As New SolidBrush(ActiveRadioBackColor)
                            G.FillEllipse(SB, InnerRectangle)
                        End Using
                    End If
    
                    If Checked Then
                        InnerRectangle = New RectangleF(1, 1, Diameter - 2, Diameter - 2)
                        InnerRectangle.Inflate(-5, -5)
                        Using SB As New SolidBrush(CheckedColor)
                            G.FillEllipse(SB, InnerRectangle)
                        End Using
                    End If
    
                    Dim TextArea As Rectangle = New Rectangle(Convert.ToInt32(OuterRectangle.Width + 5), 0, Convert.ToInt32(Width - OuterRectangle.Width - 6), Height - 1)
                    Dim BC As Color = CType(IIf(Enabled, ForeColor, Color.FromArgb(100, 100, 100)), Color)
    
                    Using SF As New StringFormat With {.LineAlignment = StringAlignment.Center}
                        Using SB As New SolidBrush(ForeColor)
                            G.DrawRectangle(Pens.Transparent, TextArea)
                            G.DrawString(Text, Font, SB, TextArea, SF)
                        End Using
                    End Using
    
                End If
    
            End Sub
    
    C# 1-1 translation by K4onashi, ready for porting to new software in development:
    Code:
          protected override void OnPaint(PaintEventArgs e)
            {
                int Diameter = ClientRectangle.Height - 1;
                RectangleF OuterRectangle = new RectangleF(0, 0, Diameter, Diameter);
                RectangleF InnerRectangle = new RectangleF(1, 1, Diameter - 2, Diameter - 2);
    
                if (e != null)
                {
                    Graphics g = e.Graphics;
                    g.Clear(BackColor);
                    g.InterpolationMode = InterpolationMode.HighQualityBicubic;
                    g.SmoothingMode = SmoothingMode.AntiAlias;
                    g.CompositingQuality = CompositingQuality.HighQuality;
    
                    using (SolidBrush SB = new SolidBrush(RadioBackColor))
                    {
                        g.FillEllipse(SB, InnerRectangle);
                    }
    
                    using (Pen P = new Pen(InactiveBorderColor, 2.0f))
                    {
                        g.DrawEllipse(P, InnerRectangle);
                    }
    
                    OuterRectangle.Inflate(-1, -1);
    
                    if (MouseHovered)
                    {
                        using (Pen P = new Pen(ActiveBorderColor, 2.0f))
                        {
                            g.DrawArc(P, OuterRectangle, 135, 180);
                            g.DrawArc(P, OuterRectangle, -45, 180);
                        }
    
                        InnerRectangle.Inflate(-1, -1);
    
                        using (SolidBrush SB = new SolidBrush(ActiveRadioBackColor))
                        {
                            g.FillEllipse(SB, InnerRectangle);
                        }
                    }
    
                    if (Checked)
                    {
                        InnerRectangle = new RectangleF(1, 1, Diameter - 2, Diameter - 2);
                        InnerRectangle.Inflate(-5, -5); // Control size of check
                        using (SolidBrush SB = new SolidBrush(CheckedColor))
                        {
                            g.FillEllipse(SB, InnerRectangle);
                        }
                    }
    
                    Rectangle TextArea = new Rectangle(Convert.ToInt32(OuterRectangle.Width + 5), 0, Convert.ToInt32(Width - OuterRectangle.Width - 6), Height - 1);
                    Color BC = Enabled ? ForeColor : Color.FromArgb(100, 100, 100);
    
                    using (StringFormat SF = new StringFormat() { LineAlignment = StringAlignment.Center })
                    using (SolidBrush SB = new SolidBrush(BC))
                    {
                        g.DrawRectangle(Pens.Transparent, TextArea);
                        g.DrawString(Text, Font, SB, TextArea, SF);
                    }
    
                }
            }
    
    TODO is add MeasureString and handle proper control resizing , then implementing animation into each control.

    Maybe in the future, translations will be on the table for this software.

    Regards.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. K4onashi

    K4onashi MDL Debugger

    Mar 7, 2012
    1,815
    1,986
    60
    Controls have been finished. See image.

    Untitled.png

    Framework UI changes:
    - Code brought up to a better standard
    - Added intermediate check state graphics
    - Better rendering for RadioButton
    - Unified colors
    - Unified sizing
    - Improved designers
    - Many other enhancements and fixes

    GambolRadioButtonDesigner:
    Code:
    using System.Collections;
    using System.Collections.Generic;
    using System.Windows.Forms.Design;
    
    namespace NVReform.UI.Controls.Design
    {
        public class GambolRadioButtonDesigner : ControlDesigner
        {
            protected override void PreFilterProperties(IDictionary Properties)
            {
    
                List<string> PropList = new List<string>
                {
                    "Appearance",
                    "BackgroundImage",
                    "BackgroundImageLayout",
                    "CheckAlign",
                    "FlatAppearance",
                    "FlatStyle",
                    "Image",
                    "ImageAlign",
                    "ImageIndex",
                    "ImageKey",
                    "ImageList",
                    "RightToLeft",
                    "TextAlign",
                    "TextImageRelation",
                    "UseVisualStyleBackColor",
                    "Padding",
                    "AutoEllipsis"
                };
    
                if (Properties != null)
                {
                    foreach (string Item in PropList)
                    {
                        Properties.Remove(Item);
                    }
                }
    
                base.PreFilterProperties(Properties);
            }
        }
    }
    
    GambolRadioButton:
    Code:
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Drawing.Drawing2D;
    using System.Windows.Forms;
    
    // Internal
    using NVReform.UI.Controls.Design;
    
    namespace NVReform.UI.Controls
    {
        [DefaultProperty("Checked")]
        [Designer(typeof(GambolRadioButtonDesigner))]
        public class GambolRadioButton : RadioButton
        {
    
            #region Fields
            private bool MouseHovered = false;
            private bool MousePressed = false;
            #endregion
    
            #region Constructor
            public GambolRadioButton()
            {
                SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true);
    
                MouseEnter += new EventHandler(ProcessMouse);
                MouseLeave += new EventHandler(ProcessMouse);
                BackColor = Color.Transparent;
                ForeColor = Colors.EnabledText;
            }
            #endregion
    
            #region Properties
            private Color BorderInactive_ = Colors.BorderInactive;
            [Description("Check area border color")]
            [Category("Appearance (Gambol)")]
            public Color BorderColor
            {
                get
                {
                    return BorderInactive_;
                }
                set
                {
                    BorderInactive_ = value;
                    Invalidate();
                }
            }
    
            private Color BorderActive_ = Colors.BorderActive;
            [Description("Check area mouseover border color")]
            [Category("Appearance (Gambol)")]
            public Color BorderColorActive
            {
                get
                {
                    return BorderActive_;
                }
                set
                {
                    BorderActive_ = value;
                    Invalidate();
                }
            }
    
            private Color ClientInactive_ = Colors.ClientInactive;
            [Description("Check area backcolor")]
            [Category("Appearance (Gambol)")]
            public Color ClientColor
            {
                get
                {
                    return ClientInactive_;
                }
                set
                {
                    ClientInactive_ = value;
                    Invalidate();
                }
            }
    
            private Color ClientActive_ = Colors.ClientActive;
            [Description("Check area mouseover color")]
            [Category("Appearance (Gambol)")]
            public Color ClientColorActive
            {
                get
                {
                    return ClientActive_;
                }
                set
                {
                    ClientActive_ = value;
                    Invalidate();
                }
            }
    
            private Color Checked_ = Colors.Checked;
            [Description("Control checked color")]
            [Category("Appearance (Gambol)")]
            public Color CheckedColor
            {
                get
                {
                    return Checked_;
                }
                set
                {
                    Checked_ = value;
                    Invalidate();
                }
            }
            #endregion
    
            #region Paint Methods
            protected override void OnPaint(PaintEventArgs e)
            {
                OnPaintBackground(e);
                OnPaintForegound(e);
            }
            protected override void OnPaintBackground(PaintEventArgs e)
            {
                if (e != null)
                {
                    Graphics g = e.Graphics;
    
                    if (BackColor.A == 255)
                    {
                        g.Clear(BackColor);
                        return;
                    }
                    base.OnPaintBackground(e);
                }
            }
            protected virtual void OnPaintForegound(PaintEventArgs e)
            {
                int Diameter = ClientRectangle.Height - 1;
                RectangleF OuterRectangle = new RectangleF(0, 0, Diameter, Diameter);
                RectangleF InnerRectangle = new RectangleF(1, 1, Diameter - 2, Diameter - 2);
                Color SwitchBorder, SwitchBack;
    
                if (e != null)
                {
                    Graphics g = e.Graphics;
    
                    g.InterpolationMode = InterpolationMode.HighQualityBicubic;
                    g.SmoothingMode = SmoothingMode.AntiAlias;
                    g.CompositingQuality = CompositingQuality.HighQuality;
    
                    OuterRectangle.Inflate(-1, -1);
    
                    if (Enabled)
                    {
                        if (MouseHovered && MousePressed)
                        { SwitchBorder = Color.FromArgb(Colors.A, CheckedColor.R, CheckedColor.G, CheckedColor.B); }
                        else if (MouseHovered)
                        { SwitchBorder = BorderColorActive; }
                        else
                        { SwitchBorder = BorderColor; }
                    }
                    else { SwitchBorder = Colors.DisabledControl; }
    
                    using (Pen P = new Pen(SwitchBorder, width: 2))
                    {
                        g.DrawArc(P, OuterRectangle, 135, 180);
                        g.DrawArc(P, OuterRectangle, -45, 180);
                    }
    
                    InnerRectangle.Inflate(-1, -1);
    
                    if (MouseHovered)
                    { SwitchBack = ClientColorActive; }
                    else { SwitchBack = ClientColor; }
    
                    using (SolidBrush SB = new SolidBrush(SwitchBack))
                    {
                        g.FillEllipse(SB, InnerRectangle);
                    }
    
                    if (Checked)
                    {
                        InnerRectangle = new RectangleF(1, 1, Diameter - 2, Diameter - 2);
                        InnerRectangle.Inflate(-5, -5); // Control size of check
                        using (SolidBrush SB = new SolidBrush(CheckedColor))
                        {
                            g.FillEllipse(SB, InnerRectangle);
                        }
                    }
    
                    Rectangle TextArea = new Rectangle(Convert.ToInt32(OuterRectangle.Width + 5), 0, Convert.ToInt32(Width - OuterRectangle.Width - 6), Height);
                    Color BC = Enabled ? ForeColor : Colors.DisabledText;
    
                    using (StringFormat SF = new StringFormat() { LineAlignment = StringAlignment.Center })
                    using (SolidBrush SB = new SolidBrush(BC))
                    {
                        g.InterpolationMode = InterpolationMode.Default;
                        g.SmoothingMode = SmoothingMode.None;
                        g.CompositingQuality = CompositingQuality.Default;
                        g.DrawRectangle(Pens.Transparent, TextArea);
                        g.DrawString(Text, Font, SB, TextArea, SF);
                    }
                }
            }
            #endregion
    
            #region Overriden Methods
            protected override void OnCheckedChanged(EventArgs e)
            {
                base.OnCheckedChanged(e);
                Invalidate();
            }
            protected override void OnMouseLeave(EventArgs eventargs)
            {
                base.OnMouseLeave(eventargs);
                MouseHovered = false;
            }
            protected override void OnMouseEnter(EventArgs eventargs)
            {
                base.OnMouseEnter(eventargs);
                MouseHovered = true;
            }
            protected override void OnTextChanged(EventArgs e)
            {
                GetPreferredSizeN();
                Invalidate();
            }
            protected override void OnMouseDown(MouseEventArgs e)
            {
                if (e != null)
                {
                    if (e.Button == MouseButtons.Left)
                    {
                        MousePressed = true;
                        Invalidate();
                    }
                }
                base.OnMouseDown(e);
            }
            protected override void OnMouseUp(MouseEventArgs e)
            {
                MousePressed = false;
                Invalidate();
                base.OnMouseUp(e);
            }
            #endregion
    
            #region Custom Methods
            private void ProcessMouse(object sender, EventArgs e)
            {
                if (ClientRectangle.Contains(PointToClient(MousePosition)))
                    if (!MouseHovered) { MouseHovered = true; Invalidate(); }
                    else { MouseHovered = false; Invalidate(); }
            }
            private Size GetPreferredSizeN()
            {
                return GetPreferredSize(new Size(0, 0));
            }
            #endregion
    
        }
    }
    
    Regards.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. K4onashi

    K4onashi MDL Debugger

    Mar 7, 2012
    1,815
    1,986
    60
    #569 K4onashi, May 28, 2020
    Last edited: May 31, 2020
    (OP)
    I am still working on this. Not too much left to go, but coming back the translation system has literally taken a s,hit for no reason; so I have to debug it.

    Once I find out that it's a missing semicolon after nine days of looking and we're chugging again, I'll release B3 for everyone.

    Peace.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. K4onashi

    K4onashi MDL Debugger

    Mar 7, 2012
    1,815
    1,986
    60
    #570 K4onashi, May 29, 2020
    Last edited: May 31, 2020
    (OP)
    Language system is fixed. I won't say what was wrong to keep my dignity. B3 on the way, maybe today or tomorrow.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. K4onashi

    K4onashi MDL Debugger

    Mar 7, 2012
    1,815
    1,986
    60
    #571 K4onashi, May 31, 2020
    Last edited: Jun 4, 2020
    (OP)
    Still working here. Windows 20H1 seems to break the updater due to the SSL/TLS of my site and it cannot fetch the versioning XML.

    Edit: Issue patched and resolved.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. K4onashi

    K4onashi MDL Debugger

    Mar 7, 2012
    1,815
    1,986
    60
    #572 K4onashi, May 31, 2020
    Last edited: May 31, 2020
    (OP)
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  12. K4onashi

    K4onashi MDL Debugger

    Mar 7, 2012
    1,815
    1,986
    60
    #573 K4onashi, Jun 4, 2020
    Last edited: Jun 4, 2020
    (OP)
    Notification badge scaling bug fixed. Just the score editor to finish and RC1 will follow.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  13. K4onashi

    K4onashi MDL Debugger

    Mar 7, 2012
    1,815
    1,986
    60
    Hi everyone,

    I feel this is owed, I'll come right out and say it, I can't continue with this project anymore. There is not enough interest and I've better things to get on with, I also have no time for VB.NET as it holds me back. Thanks everyone for helping make the application what it is. This is also a goodbye from me for MDL, I wish you all the best.

    Keep an eye on Github, v2.1.0 isn't a never, it's a whenever.

    Mods could you lock this?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  14. Skunk1966

    Skunk1966 MDL Member

    Jul 15, 2011
    100
    94
    10
    IMO it's apitty these projects are abandoned because I found them very useful.
    We'll stay in touch mate!