Skip to content

Commit 804ba3e

Browse files
committed
wip: dark mode styling for controls
1 parent 7e8f54d commit 804ba3e

44 files changed

Lines changed: 1686 additions & 1209 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

UoFiddler.Controls/Classes/Options.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ public static class Options
3737
/// </summary>
3838
public static bool PolSoundIdOffset { get; set; }
3939

40+
/// <summary>
41+
/// Runtime flag set from AppSettings at startup. Not persisted in profiles.
42+
/// </summary>
43+
public static bool DarkMode { get; set; }
44+
4045
/// <summary>
4146
/// Defines the cmd to Send Client to Loc
4247
/// </summary>

UoFiddler.Controls/Forms/FontTextForm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public FontTextForm(int type, int font)
2929
TopMost = true;
3030
_type = type;
3131
_font = font;
32-
pictureBox1.BackColor = Color.White;
32+
pictureBox1.BackColor = Options.DarkMode ? Color.LightGray : Color.White;
3333
Text = _type == 1
3434
? $"Unicode Font: {font}"
3535
: $"ASCII Font: {font}";

UoFiddler.Controls/Forms/MultisHelpForm.cs

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
*
1010
***************************************************************************/
1111

12+
using System.Drawing;
1213
using System.Windows.Forms;
14+
using UoFiddler.Controls.Classes;
1315

1416
namespace UoFiddler.Controls.Forms
1517
{
@@ -23,26 +25,35 @@ public MultisHelpForm()
2325

2426
private void PopulateShortcuts()
2527
{
26-
_listView.Groups.Add(new ListViewGroup("preview", "Preview"));
27-
_listView.Groups.Add(new ListViewGroup("zoom", "Zoom (100% mode only)"));
28-
_listView.Groups.Add(new ListViewGroup("pan", "Panning (100% mode only)"));
28+
AddHeader("Preview");
29+
Add("Fit preview to window", "Toggle button on toolbar — scales to fit or shows at 100% with scrollbars");
2930

30-
Add("Fit preview to window", "Toggle button on toolbar — scales to fit or shows at 100% with scrollbars", "preview");
31+
AddHeader("Zoom (100% mode only)");
32+
Add("Ctrl + Mouse Wheel", "Zoom In / Out");
33+
Add("Shift + = (Plus key)", "Zoom In");
34+
Add("- (Minus key)", "Zoom Out");
35+
Add("Numpad +", "Zoom In");
36+
Add("Numpad -", "Zoom Out");
37+
Add("Ctrl + 0", "Reset zoom to 100%");
3138

32-
Add("Ctrl + Mouse Wheel", "Zoom In / Out", "zoom");
33-
Add("Shift + = (Plus key)", "Zoom In", "zoom");
34-
Add("- (Minus key)", "Zoom Out", "zoom");
35-
Add("Numpad +", "Zoom In", "zoom");
36-
Add("Numpad -", "Zoom Out", "zoom");
37-
Add("Ctrl + 0", "Reset zoom to 100%", "zoom");
39+
AddHeader("Panning (100% mode only)");
40+
Add("Left-click drag", "Pan the view");
41+
}
3842

39-
Add("Left-click drag", "Pan the view", "pan");
43+
private void AddHeader(string text)
44+
{
45+
var item = new ListViewItem(text)
46+
{
47+
Font = new Font(_listView.Font, FontStyle.Bold),
48+
ForeColor = Options.DarkMode ? Color.OrangeRed : Color.MediumBlue,
49+
};
50+
item.SubItems.Add(string.Empty);
51+
_listView.Items.Add(item);
4052
}
4153

42-
private void Add(string key, string action, string groupKey)
54+
private void Add(string key, string action)
4355
{
44-
var group = _listView.Groups[groupKey];
45-
var item = new ListViewItem(key, group);
56+
var item = new ListViewItem(key);
4657
item.SubItems.Add(action);
4758
_listView.Items.Add(item);
4859
}

UoFiddler.Controls/Forms/TileDataHelpForm.cs

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
*
1010
***************************************************************************/
1111

12+
using System.Drawing;
1213
using System.Text;
1314
using System.Windows.Forms;
15+
using UoFiddler.Controls.Classes;
1416

1517
namespace UoFiddler.Controls.Forms
1618
{
@@ -24,10 +26,7 @@ public TileDataHelpForm()
2426

2527
private void PopulateFields()
2628
{
27-
_listView.Groups.Add(new ListViewGroup("items", "Items"));
28-
_listView.Groups.Add(new ListViewGroup("land", "Land Tiles"));
29-
_listView.Groups.Add(new ListViewGroup("flags", "Flags"));
30-
29+
AddHeader("Items");
3130
Add("Name", "This field is for the name of the item, which can be a maximum of 20 characters.", "items");
3231
Add("Animation", "This field is for the animation ID associated with the item.", "items");
3332
Add("Weight", "This field is for the weight of the item.", "items");
@@ -75,9 +74,11 @@ private void PopulateFields()
7574
Add("Height", "This field is for the height of the item.", "items");
7675
Add("Unknown 3", "This field is for the third unknown value.", "items");
7776

77+
AddHeader("Land Tiles");
7878
Add("Name", "This field is for the name of the land tile, which can be a maximum of 20 characters.", "land");
7979
Add("Texture ID", "This field is for the texture ID associated with the land tile.", "land");
8080

81+
AddHeader("Flags");
8182
Add("Background", "Not yet documented.", "flags");
8283
Add("Weapon", "Not yet documented.", "flags");
8384
Add("Transparent", "Not yet documented.", "flags");
@@ -143,13 +144,31 @@ private void PopulateFields()
143144
Add("Unused32", "Unused or unknown yet.", "flags");
144145

145146
if (_listView.Items.Count > 0)
146-
_listView.Items[0].Selected = true;
147+
{
148+
foreach (ListViewItem li in _listView.Items)
149+
{
150+
if (li.Tag is string)
151+
{
152+
li.Selected = true;
153+
break;
154+
}
155+
}
156+
}
157+
}
158+
159+
private void AddHeader(string text)
160+
{
161+
var item = new ListViewItem(text)
162+
{
163+
Font = new Font(_listView.Font, FontStyle.Bold),
164+
ForeColor = Options.DarkMode ? Color.OrangeRed : Color.MediumBlue,
165+
};
166+
_listView.Items.Add(item);
147167
}
148168

149169
private void Add(string field, string description, string groupKey)
150170
{
151-
var group = _listView.Groups[groupKey];
152-
var item = new ListViewItem(field, group) { Tag = description };
171+
var item = new ListViewItem(field) { Tag = description };
153172
_listView.Items.Add(item);
154173
}
155174

UoFiddler.Controls/UserControls/AnimDataControl.Designer.cs

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UoFiddler.Controls/UserControls/AnimDataControl.cs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,11 @@ private void OnLoad(object sender, EventArgs e)
193193

194194
if (!Art.IsValidStatic(id))
195195
{
196-
node.ForeColor = Color.Red;
196+
node.ForeColor = Options.DarkMode ? Color.OrangeRed : Color.Red;
197197
}
198198
else if ((TileData.ItemTable[id].Flags & TileFlag.Animation) == 0)
199199
{
200-
node.ForeColor = Color.Blue;
200+
node.ForeColor = Options.DarkMode ? Color.CornflowerBlue : Color.Blue;
201201
}
202202

203203
// TODO: find a better approach to this
@@ -441,11 +441,13 @@ private void OnTextChanged(object sender, EventArgs e)
441441

442442
if (canDone)
443443
{
444-
textBoxAddFrame.ForeColor = !Art.IsValidStatic(index) ? Color.Red : Color.Black;
444+
textBoxAddFrame.ForeColor = !Art.IsValidStatic(index)
445+
? (Options.DarkMode ? Color.OrangeRed : Color.Red)
446+
: (Options.DarkMode ? Color.White : Color.Black);
445447
}
446448
else
447449
{
448-
textBoxAddFrame.ForeColor = Color.Red;
450+
textBoxAddFrame.ForeColor = Options.DarkMode ? Color.OrangeRed : Color.Red;
449451
}
450452
}
451453

@@ -585,11 +587,13 @@ private void OnTextChangeAdd(object sender, EventArgs e)
585587
{
586588
if (Utils.ConvertStringToInt(AddTextBox.Text, out int index, 0, Art.GetMaxItemId()))
587589
{
588-
AddTextBox.ForeColor = Animdata.GetAnimData(index) != null ? Color.Red : Color.Black;
590+
AddTextBox.ForeColor = Animdata.GetAnimData(index) != null
591+
? (Options.DarkMode ? Color.OrangeRed : Color.Red)
592+
: (Options.DarkMode ? Color.White : Color.Black);
589593
}
590594
else
591595
{
592-
AddTextBox.ForeColor = Color.Red;
596+
AddTextBox.ForeColor = Options.DarkMode ? Color.OrangeRed : Color.Red;
593597
}
594598
}
595599

@@ -619,7 +623,7 @@ private void OnKeyDownAdd(object sender, KeyEventArgs e)
619623

620624
if ((TileData.ItemTable[index].Flags & TileFlag.Animation) == 0)
621625
{
622-
node.ForeColor = Color.Blue;
626+
node.ForeColor = Options.DarkMode ? Color.CornflowerBlue : Color.Blue;
623627
}
624628
treeView1.Nodes.Add(node);
625629

UoFiddler.Controls/UserControls/AnimationListControl.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,9 +710,9 @@ private void Frames_ListView_DrawItem(object sender, DrawListViewItemEventArgs e
710710
}
711711

712712
e.Graphics.DrawImage(bmp, e.Bounds.X, e.Bounds.Y, width, height);
713-
e.DrawText(TextFormatFlags.Bottom | TextFormatFlags.HorizontalCenter);
713+
TextRenderer.DrawText(e.Graphics, e.Item.Text, listView1.Font, e.Bounds, Color.Black, TextFormatFlags.Bottom | TextFormatFlags.HorizontalCenter);
714714

715-
using (var pen = new Pen(Color.Gray))
715+
using (var pen = new Pen(Color.Black))
716716
{
717717
e.Graphics.DrawRectangle(pen, e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height);
718718
}

0 commit comments

Comments
 (0)