From 001bc1c760b6a8ee1bc09a6cfe980d31dfb4e2b0 Mon Sep 17 00:00:00 2001 From: AsY!um- <377468+AsYlum-@users.noreply.github.com> Date: Mon, 20 Apr 2026 00:14:32 +0200 Subject: [PATCH 1/8] Add better handling for invalid entries in animationlist.xml. --- .../UserControls/AnimationListControl.cs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/UoFiddler.Controls/UserControls/AnimationListControl.cs b/UoFiddler.Controls/UserControls/AnimationListControl.cs index 672ec2b2..3a676357 100644 --- a/UoFiddler.Controls/UserControls/AnimationListControl.cs +++ b/UoFiddler.Controls/UserControls/AnimationListControl.cs @@ -388,6 +388,8 @@ private bool LoadXml() return false; } + var skipped = new List(); + TreeViewMobs.BeginUpdate(); try { @@ -413,6 +415,12 @@ private bool LoadXml() string name = xMob.GetAttribute("name"); int value = int.Parse(xMob.GetAttribute("body")); int type = int.Parse(xMob.GetAttribute("type")); + if (type < 0 || type >= GetActionNames.Length) + { + skipped.Add($"Mob \"{name}\" (body=0x{value:X}) — invalid type {type}"); + continue; + } + node = new TreeNode($"{name} (0x{value:X})") { Tag = new[] { value, type }, @@ -447,6 +455,12 @@ private bool LoadXml() string name = xMob.GetAttribute("name"); int value = int.Parse(xMob.GetAttribute("body")); int type = int.Parse(xMob.GetAttribute("type")); + if (type < 0 || type >= GetActionNames.Length) + { + skipped.Add($"Equip \"{name}\" (body=0x{value:X}) — invalid type {type}"); + continue; + } + node = new TreeNode(name) { Tag = new[] { value, type }, @@ -476,6 +490,16 @@ private bool LoadXml() TreeViewMobs.EndUpdate(); } + if (skipped.Count > 0) + { + string list = string.Join(Environment.NewLine, skipped); + MessageBox.Show( + $"The following entries were skipped due to an invalid type value (valid range: 0–{GetActionNames.Length - 1}):{Environment.NewLine}{Environment.NewLine}{list}{Environment.NewLine}{Environment.NewLine}File: {fileName}", + "Animationlist.xml — Skipped Entries", + MessageBoxButtons.OK, + MessageBoxIcon.Warning); + } + return true; } From d75aa86e23b982d399fa1f224a95ada4f6495649 Mon Sep 17 00:00:00 2001 From: AsY!um- <377468+AsYlum-@users.noreply.github.com> Date: Tue, 21 Apr 2026 16:20:44 +0200 Subject: [PATCH 2/8] Make sure that Gumplist.xml is copied to build output directory. --- UoFiddler/UoFiddler.csproj | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/UoFiddler/UoFiddler.csproj b/UoFiddler/UoFiddler.csproj index 1cb8529a..1574c2b6 100644 --- a/UoFiddler/UoFiddler.csproj +++ b/UoFiddler/UoFiddler.csproj @@ -156,8 +156,11 @@ - - PreserveNewest - + + PreserveNewest + + + PreserveNewest + \ No newline at end of file From 060a6fd858eb970c1ec3e260377247031865f662 Mon Sep 17 00:00:00 2001 From: AsY!um- <377468+AsYlum-@users.noreply.github.com> Date: Tue, 21 Apr 2026 17:05:24 +0200 Subject: [PATCH 3/8] Add shortcut list to multi editor. --- .../Forms/ShortcutsHelpForm.Designer.cs | 99 +++++++++++++++ .../Forms/ShortcutsHelpForm.cs | 66 ++++++++++ .../Forms/ShortcutsHelpForm.resx | 120 ++++++++++++++++++ .../UoFiddler.Plugin.MultiEditor.csproj | 9 ++ .../MultiEditorControl.Designer.cs | 62 ++++++--- .../UserControls/MultiEditorControl.cs | 20 +++ .../UserControls/MultiEditorControl.resx | 17 ++- .../images/Help-Icon-16.png | Bin 0 -> 330 bytes 8 files changed, 371 insertions(+), 22 deletions(-) create mode 100644 UoFiddler.Plugin.MultiEditor/Forms/ShortcutsHelpForm.Designer.cs create mode 100644 UoFiddler.Plugin.MultiEditor/Forms/ShortcutsHelpForm.cs create mode 100644 UoFiddler.Plugin.MultiEditor/Forms/ShortcutsHelpForm.resx create mode 100644 UoFiddler.Plugin.MultiEditor/images/Help-Icon-16.png diff --git a/UoFiddler.Plugin.MultiEditor/Forms/ShortcutsHelpForm.Designer.cs b/UoFiddler.Plugin.MultiEditor/Forms/ShortcutsHelpForm.Designer.cs new file mode 100644 index 00000000..9ee89d6d --- /dev/null +++ b/UoFiddler.Plugin.MultiEditor/Forms/ShortcutsHelpForm.Designer.cs @@ -0,0 +1,99 @@ +namespace UoFiddler.Plugin.MultiEditor.Forms +{ + partial class ShortcutsHelpForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + _listView = new System.Windows.Forms.ListView(); + _columnKey = new System.Windows.Forms.ColumnHeader(); + _columnAction = new System.Windows.Forms.ColumnHeader(); + _btnClose = new System.Windows.Forms.Button(); + SuspendLayout(); + // + // _listView + // + _listView.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; + _listView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { _columnKey, _columnAction }); + _listView.FullRowSelect = true; + _listView.GridLines = true; + _listView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + _listView.Location = new System.Drawing.Point(8, 8); + _listView.MultiSelect = false; + _listView.Name = "_listView"; + _listView.Size = new System.Drawing.Size(388, 409); + _listView.TabIndex = 0; + _listView.UseCompatibleStateImageBehavior = false; + _listView.View = System.Windows.Forms.View.Details; + // + // _columnKey + // + _columnKey.Text = "Shortcut"; + _columnKey.Width = 130; + // + // _columnAction + // + _columnAction.Text = "Action"; + _columnAction.Width = 230; + // + // _btnClose + // + _btnClose.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right; + _btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel; + _btnClose.Location = new System.Drawing.Point(321, 425); + _btnClose.Name = "_btnClose"; + _btnClose.Size = new System.Drawing.Size(75, 27); + _btnClose.TabIndex = 1; + _btnClose.Text = "Close"; + _btnClose.UseVisualStyleBackColor = true; + // + // ShortcutsHelpForm + // + AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + CancelButton = _btnClose; + ClientSize = new System.Drawing.Size(404, 461); + Controls.Add(_listView); + Controls.Add(_btnClose); + FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + MaximizeBox = false; + MinimizeBox = false; + Name = "ShortcutsHelpForm"; + Padding = new System.Windows.Forms.Padding(8); + ShowInTaskbar = false; + StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + Text = "Keyboard Shortcuts"; + ResumeLayout(false); + } + + #endregion + + private System.Windows.Forms.ListView _listView; + private System.Windows.Forms.ColumnHeader _columnKey; + private System.Windows.Forms.ColumnHeader _columnAction; + private System.Windows.Forms.Button _btnClose; + } +} \ No newline at end of file diff --git a/UoFiddler.Plugin.MultiEditor/Forms/ShortcutsHelpForm.cs b/UoFiddler.Plugin.MultiEditor/Forms/ShortcutsHelpForm.cs new file mode 100644 index 00000000..9d75fe9e --- /dev/null +++ b/UoFiddler.Plugin.MultiEditor/Forms/ShortcutsHelpForm.cs @@ -0,0 +1,66 @@ +/*************************************************************************** + * + * $Author: MuadDib & Turley + * + * "THE BEER-WARE LICENSE" + * As long as you retain this notice you can do whatever you want with + * this stuff. If we meet some day, and you think this stuff is worth it, + * you can buy me a beer in return. + * + ***************************************************************************/ + +using System.Windows.Forms; + +namespace UoFiddler.Plugin.MultiEditor.Forms +{ + public partial class ShortcutsHelpForm : Form + { + public ShortcutsHelpForm() + { + InitializeComponent(); + PopulateShortcuts(); + } + + private void PopulateShortcuts() + { + _listView.Groups.Add(new ListViewGroup("tool-switches", "Tool Switches")); + _listView.Groups.Add(new ListViewGroup("editing", "Editing")); + _listView.Groups.Add(new ListViewGroup("navigation", "Navigation")); + _listView.Groups.Add(new ListViewGroup("zoom", "Zoom")); + + Add("S", "Select Tool", "tool-switches"); + Add("D", "Draw Tool", "tool-switches"); + Add("R", "Remove Tool", "tool-switches"); + Add("E", "Apply Z Level Tool", "tool-switches"); + Add("F", "Toggle Virtual Floor", "tool-switches"); + Add("P", "Pipette (Pick Tile)", "tool-switches"); + Add("T", "Switch Transparent", "tool-switches"); + Add("B", "Rectangle Fill Tool", "tool-switches"); + Add("L", "Line Draw Tool", "tool-switches"); + + Add("Ctrl+Z", "Undo", "editing"); + Add("Ctrl+Y / Ctrl+Shift+Z", "Redo", "editing"); + Add("Ctrl+C", "Copy Selection", "editing"); + Add("Ctrl+V", "Paste", "editing"); + Add("Escape", "Cancel Paste", "editing"); + Add("[", "Z Level -1", "editing"); + Add("]", "Z Level +1", "editing"); + + Add("Arrow Keys", "Pan View", "navigation"); + Add("Page Up", "Floor Z +5", "navigation"); + Add("Page Down", "Floor Z -5", "navigation"); + + Add("+ / Shift+=", "Zoom In", "zoom"); + Add("-", "Zoom Out", "zoom"); + Add("Ctrl+0", "Reset Zoom to 100%", "zoom"); + } + + private void Add(string key, string action, string groupKey) + { + var group = _listView.Groups[groupKey]; + var item = new ListViewItem(key, group); + item.SubItems.Add(action); + _listView.Items.Add(item); + } + } +} \ No newline at end of file diff --git a/UoFiddler.Plugin.MultiEditor/Forms/ShortcutsHelpForm.resx b/UoFiddler.Plugin.MultiEditor/Forms/ShortcutsHelpForm.resx new file mode 100644 index 00000000..4edf53f8 --- /dev/null +++ b/UoFiddler.Plugin.MultiEditor/Forms/ShortcutsHelpForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/UoFiddler.Plugin.MultiEditor/UoFiddler.Plugin.MultiEditor.csproj b/UoFiddler.Plugin.MultiEditor/UoFiddler.Plugin.MultiEditor.csproj index 7a830798..4cfa059e 100644 --- a/UoFiddler.Plugin.MultiEditor/UoFiddler.Plugin.MultiEditor.csproj +++ b/UoFiddler.Plugin.MultiEditor/UoFiddler.Plugin.MultiEditor.csproj @@ -25,6 +25,12 @@ Off + + Form + + + ShortcutsHelpForm.cs + UserControl @@ -48,6 +54,9 @@ + + ShortcutsHelpForm.cs + MultiEditorControl.cs diff --git a/UoFiddler.Plugin.MultiEditor/UserControls/MultiEditorControl.Designer.cs b/UoFiddler.Plugin.MultiEditor/UserControls/MultiEditorControl.Designer.cs index 801fc618..487334a9 100644 --- a/UoFiddler.Plugin.MultiEditor/UserControls/MultiEditorControl.Designer.cs +++ b/UoFiddler.Plugin.MultiEditor/UserControls/MultiEditorControl.Designer.cs @@ -70,6 +70,7 @@ private void InitializeComponent() BTN_Save = new System.Windows.Forms.Button(); splitContainer1 = new System.Windows.Forms.SplitContainer(); splitContainer3 = new System.Windows.Forms.SplitContainer(); + brushSizeLabel = new System.Windows.Forms.Label(); BTN_RectFill = new System.Windows.Forms.CheckBox(); imageListTools = new System.Windows.Forms.ImageList(components); BTN_LineDraw = new System.Windows.Forms.CheckBox(); @@ -111,9 +112,10 @@ private void InitializeComponent() SelectedTileLabel = new System.Windows.Forms.ToolStripLabel(); toolStripLabelCoord = new System.Windows.Forms.ToolStripLabel(); toolStripBtnZoom = new System.Windows.Forms.ToolStripButton(); + toolStripSeparatorHelp = new System.Windows.Forms.ToolStripSeparator(); + toolStripBtnHelp = new System.Windows.Forms.ToolStripButton(); toolTip1 = new System.Windows.Forms.ToolTip(components); FloatingPreviewPanel = new System.Windows.Forms.Panel(); - brushSizeLabel = new System.Windows.Forms.Label(); TC_MultiEditorToolbox.SuspendLayout(); tileTab.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)splitContainer4).BeginInit(); @@ -540,6 +542,15 @@ private void InitializeComponent() splitContainer3.SplitterWidth = 2; splitContainer3.TabIndex = 1; // + // brushSizeLabel + // + brushSizeLabel.AutoSize = true; + brushSizeLabel.Location = new System.Drawing.Point(68, 62); + brushSizeLabel.Name = "brushSizeLabel"; + brushSizeLabel.Size = new System.Drawing.Size(62, 15); + brushSizeLabel.TabIndex = 22; + brushSizeLabel.Text = "Brush size:"; + // // BTN_RectFill // BTN_RectFill.Appearance = System.Windows.Forms.Appearance.Button; @@ -551,7 +562,7 @@ private void InitializeComponent() BTN_RectFill.Name = "BTN_RectFill"; BTN_RectFill.Size = new System.Drawing.Size(24, 24); BTN_RectFill.TabIndex = 17; - toolTip1.SetToolTip(BTN_RectFill, "Rectangle Fill"); + toolTip1.SetToolTip(BTN_RectFill, "Rectangle Fill [B]"); BTN_RectFill.UseVisualStyleBackColor = true; BTN_RectFill.CheckStateChanged += BTN_Toolbox_CheckedChanged; BTN_RectFill.Click += BTN_RectFill_Click; @@ -591,7 +602,7 @@ private void InitializeComponent() BTN_LineDraw.Name = "BTN_LineDraw"; BTN_LineDraw.Size = new System.Drawing.Size(24, 24); BTN_LineDraw.TabIndex = 18; - toolTip1.SetToolTip(BTN_LineDraw, "Line Draw"); + toolTip1.SetToolTip(BTN_LineDraw, "Line Draw [L]"); BTN_LineDraw.UseVisualStyleBackColor = true; BTN_LineDraw.CheckStateChanged += BTN_Toolbox_CheckedChanged; BTN_LineDraw.Click += BTN_LineDraw_Click; @@ -651,7 +662,7 @@ private void InitializeComponent() BTN_Trans.Name = "BTN_Trans"; BTN_Trans.Size = new System.Drawing.Size(24, 24); BTN_Trans.TabIndex = 15; - toolTip1.SetToolTip(BTN_Trans, "Switch Transparent"); + toolTip1.SetToolTip(BTN_Trans, "Switch Transparent [T]"); BTN_Trans.UseVisualStyleBackColor = true; BTN_Trans.CheckStateChanged += BTN_Toolbox_CheckedChanged; BTN_Trans.Click += BTN_Trans_Clicked; @@ -667,7 +678,7 @@ private void InitializeComponent() BTN_Pipette.Name = "BTN_Pipette"; BTN_Pipette.Size = new System.Drawing.Size(24, 24); BTN_Pipette.TabIndex = 14; - toolTip1.SetToolTip(BTN_Pipette, "Pick A Tile"); + toolTip1.SetToolTip(BTN_Pipette, "Pick A Tile [P]"); BTN_Pipette.UseVisualStyleBackColor = true; BTN_Pipette.CheckStateChanged += BTN_Toolbox_CheckedChanged; BTN_Pipette.Click += BTN_Pipette_Click; @@ -683,7 +694,7 @@ private void InitializeComponent() BTN_Floor.Name = "BTN_Floor"; BTN_Floor.Size = new System.Drawing.Size(24, 24); BTN_Floor.TabIndex = 13; - toolTip1.SetToolTip(BTN_Floor, "Draw Virtual Floor"); + toolTip1.SetToolTip(BTN_Floor, "Draw Virtual Floor [F]"); BTN_Floor.UseVisualStyleBackColor = true; BTN_Floor.CheckStateChanged += BTN_Toolbox_CheckedChanged; BTN_Floor.Click += BTN_Floor_Clicked; @@ -699,7 +710,7 @@ private void InitializeComponent() BTN_Z.Name = "BTN_Z"; BTN_Z.Size = new System.Drawing.Size(24, 24); BTN_Z.TabIndex = 12; - toolTip1.SetToolTip(BTN_Z, "Apply Z Level"); + toolTip1.SetToolTip(BTN_Z, "Apply Z Level [E]"); BTN_Z.UseVisualStyleBackColor = true; BTN_Z.CheckStateChanged += BTN_Toolbox_CheckedChanged; BTN_Z.Click += BTN_Z_Click; @@ -715,7 +726,7 @@ private void InitializeComponent() BTN_Remove.Name = "BTN_Remove"; BTN_Remove.Size = new System.Drawing.Size(24, 24); BTN_Remove.TabIndex = 11; - toolTip1.SetToolTip(BTN_Remove, "Remove A Tile"); + toolTip1.SetToolTip(BTN_Remove, "Remove A Tile [R]"); BTN_Remove.UseVisualStyleBackColor = true; BTN_Remove.CheckStateChanged += BTN_Toolbox_CheckedChanged; BTN_Remove.Click += BTN_Remove_Click; @@ -731,7 +742,7 @@ private void InitializeComponent() BTN_Draw.Name = "BTN_Draw"; BTN_Draw.Size = new System.Drawing.Size(24, 24); BTN_Draw.TabIndex = 10; - toolTip1.SetToolTip(BTN_Draw, "Draw A Tile"); + toolTip1.SetToolTip(BTN_Draw, "Draw A Tile [D]"); BTN_Draw.UseVisualStyleBackColor = true; BTN_Draw.CheckStateChanged += BTN_Toolbox_CheckedChanged; BTN_Draw.Click += BTN_Draw_Click; @@ -749,7 +760,7 @@ private void InitializeComponent() BTN_Select.Name = "BTN_Select"; BTN_Select.Size = new System.Drawing.Size(24, 24); BTN_Select.TabIndex = 9; - toolTip1.SetToolTip(BTN_Select, "Select A Tile"); + toolTip1.SetToolTip(BTN_Select, "Select A Tile [S]"); BTN_Select.UseVisualStyleBackColor = true; BTN_Select.CheckStateChanged += BTN_Toolbox_CheckedChanged; BTN_Select.Click += BTN_Select_Click; @@ -910,7 +921,7 @@ private void InitializeComponent() pictureBoxMinimap.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right; pictureBoxMinimap.BackColor = System.Drawing.Color.DimGray; pictureBoxMinimap.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - pictureBoxMinimap.Location = new System.Drawing.Point(342, 280); + pictureBoxMinimap.Location = new System.Drawing.Point(342, 277); pictureBoxMinimap.Name = "pictureBoxMinimap"; pictureBoxMinimap.Size = new System.Drawing.Size(155, 100); pictureBoxMinimap.TabIndex = 10; @@ -957,7 +968,7 @@ private void InitializeComponent() // toolStrip1.Dock = System.Windows.Forms.DockStyle.Bottom; toolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; - toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { toolStripDropDownButton1, toolStripSeparator2, DrawTileLabel, toolStripSeparator1, SelectedTileLabel, toolStripLabelCoord, toolStripBtnZoom }); + toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { toolStripDropDownButton1, toolStripSeparator2, DrawTileLabel, toolStripSeparator1, SelectedTileLabel, toolStripLabelCoord, toolStripBtnZoom, toolStripSeparatorHelp, toolStripBtnHelp }); toolStrip1.Location = new System.Drawing.Point(0, 455); toolStrip1.Name = "toolStrip1"; toolStrip1.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; @@ -1046,6 +1057,22 @@ private void InitializeComponent() toolStripBtnZoom.ToolTipText = "Zoom — click or Ctrl+0 to reset to 100%"; toolStripBtnZoom.Click += ToolStripBtnZoom_Click; // + // toolStripSeparatorHelp + // + toolStripSeparatorHelp.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; + toolStripSeparatorHelp.Name = "toolStripSeparatorHelp"; + toolStripSeparatorHelp.Size = new System.Drawing.Size(6, 25); + // + // toolStripBtnHelp + // + toolStripBtnHelp.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; + toolStripBtnHelp.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + toolStripBtnHelp.Image = (System.Drawing.Image)resources.GetObject("toolStripBtnHelp.Image"); + toolStripBtnHelp.Name = "toolStripBtnHelp"; + toolStripBtnHelp.Size = new System.Drawing.Size(23, 22); + toolStripBtnHelp.ToolTipText = "Keyboard Shortcuts"; + toolStripBtnHelp.Click += ToolStripBtnHelp_Click; + // // FloatingPreviewPanel // FloatingPreviewPanel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; @@ -1056,15 +1083,6 @@ private void InitializeComponent() FloatingPreviewPanel.Size = new System.Drawing.Size(233, 115); FloatingPreviewPanel.TabIndex = 4; // - // brushSizeLabel - // - brushSizeLabel.AutoSize = true; - brushSizeLabel.Location = new System.Drawing.Point(68, 62); - brushSizeLabel.Name = "brushSizeLabel"; - brushSizeLabel.Size = new System.Drawing.Size(62, 15); - brushSizeLabel.TabIndex = 22; - brushSizeLabel.Text = "Brush size:"; - // // MultiEditorControl // AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); @@ -1200,5 +1218,7 @@ private void InitializeComponent() private System.Windows.Forms.Button BTN_Export_UOX3; private System.Windows.Forms.Button BTN_Export_XML; private System.Windows.Forms.Label brushSizeLabel; + private System.Windows.Forms.ToolStripSeparator toolStripSeparatorHelp; + private System.Windows.Forms.ToolStripButton toolStripBtnHelp; } } diff --git a/UoFiddler.Plugin.MultiEditor/UserControls/MultiEditorControl.cs b/UoFiddler.Plugin.MultiEditor/UserControls/MultiEditorControl.cs index 1fee56b2..d41f44a5 100644 --- a/UoFiddler.Plugin.MultiEditor/UserControls/MultiEditorControl.cs +++ b/UoFiddler.Plugin.MultiEditor/UserControls/MultiEditorControl.cs @@ -19,6 +19,7 @@ using Ultima; using UoFiddler.Controls.Classes; using UoFiddler.Plugin.MultiEditor.Classes; +using UoFiddler.Plugin.MultiEditor.Forms; namespace UoFiddler.Plugin.MultiEditor.UserControls { @@ -2196,6 +2197,19 @@ protected override bool ProcessCmdKey(ref Message msg, Keys keyData) SetZoom(1.0f); return true; } + + if (ActiveControl is not TextBox && ActiveControl is not NumericUpDown) + { + if (keyData == Keys.S) { BTN_Select_Click(null, EventArgs.Empty); return true; } + if (keyData == Keys.D) { BTN_Draw_Click(null, EventArgs.Empty); return true; } + if (keyData == Keys.R) { BTN_Remove_Click(null, EventArgs.Empty); return true; } + if (keyData == Keys.E) { BTN_Z_Click(null, EventArgs.Empty); return true; } + if (keyData == Keys.F) { BTN_Floor.Checked = !BTN_Floor.Checked; return true; } + if (keyData == Keys.P) { BTN_Pipette_Click(null, EventArgs.Empty); return true; } + if (keyData == Keys.T) { BTN_Trans_Clicked(null, EventArgs.Empty); return true; } + if (keyData == Keys.B) { BTN_RectFill_Click(null, EventArgs.Empty); return true; } + if (keyData == Keys.L) { BTN_LineDraw_Click(null, EventArgs.Empty); return true; } + } } return base.ProcessCmdKey(ref msg, keyData); @@ -2230,6 +2244,12 @@ private void ToolStripBtnZoom_Click(object sender, EventArgs e) SetZoom(1.0f); } + private void ToolStripBtnHelp_Click(object sender, EventArgs e) + { + using var form = new ShortcutsHelpForm(); + form.ShowDialog(this); + } + private void UpdateTrackBarAfterZChange() { MaxHeightTrackBar.Minimum = _compList.ZMin; diff --git a/UoFiddler.Plugin.MultiEditor/UserControls/MultiEditorControl.resx b/UoFiddler.Plugin.MultiEditor/UserControls/MultiEditorControl.resx index b8143ae0..3cb50133 100644 --- a/UoFiddler.Plugin.MultiEditor/UserControls/MultiEditorControl.resx +++ b/UoFiddler.Plugin.MultiEditor/UserControls/MultiEditorControl.resx @@ -131,7 +131,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAEZTeXN0ZW0uV2luZG93cy5Gb3JtcywgQ3VsdHVyZT1uZXV0cmFs LCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAmU3lzdGVtLldpbmRvd3MuRm9ybXMu SW1hZ2VMaXN0U3RyZWFtZXIBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAARKoAAAJNU0Z0AUkBTAIBARIB - AAEMAQEBDAEBARIBAAESAQAE/wEhAQAI/wFCAU0BNgcAATYDAAEoAwABSAMAAVoDAAEBAQABIAUAAUAB + AAEkAQEBJAEBARIBAAESAQAE/wEhAQAI/wFCAU0BNgcAATYDAAEoAwABSAMAAVoDAAEBAQABIAUAAUAB ZRIAAcgB0AHUAf8ByAHQAdQB/wHIAdAB1AH/AcgB0AHUAf8ByAHQAdQB/wHIAdAB1AH/AcgB0AHUAf8B yAHQAdQB/wHIAdAB1AH/AcgB0AHUAf8ByAHQAdQB/wHIAdAB1AH/AckB0AHUAf8BywHTAdYB/wHLAdMB 1gH/AcoB0gHWAf8BxwHPAdQB/wHIAdAB1AH/ATkBOwE8Af8BOQE7ATwB/wE5ATsBPAH/ATkBOwE8Af8B @@ -860,9 +860,24 @@ BBYAA///AP8A/wD/AD0ACw== + + 261, 17 + 162, 17 + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAEPSURBVDhPxZK7SgNBFEC3MNporOx8oHVKm6D5GlGxEvwU + EWJl56NOEYKNH2CRH9BEUL9ABK2Sc2YybLK7io3kwGHuLDuz97HZf9DCO3zHb3zDW9zDX1nANj7jIa5j + bbIe4QAv0Pcq8XAXl8OujM976CUlTPsJ0+FFvMJP7GMDZQWHWCrHmk07cYodXMUDfMTEMd7EMMeGWWti + F7djmK3hRwwDm2hjZ7Dbpl1kBx/wMuwiS/gVwxwz2IjhDC94htOd38LXGOY4Z0f1F07wOoY5++j87fI0 + o8maqKNZNcOugPN1zsVLEh6+x/Owq8A6vcQ5Oyp7YmPtumn7ZQ//+Ccm/Emcs41yOq7WXJn2vMmyMZYp + L1AlAbCnAAAAAElFTkSuQmCC + + 52 diff --git a/UoFiddler.Plugin.MultiEditor/images/Help-Icon-16.png b/UoFiddler.Plugin.MultiEditor/images/Help-Icon-16.png new file mode 100644 index 0000000000000000000000000000000000000000..6efed7ebbbfdd43640b58ca1128af6a9008e1f52 GIT binary patch literal 330 zcmV-Q0k!^#P)s40`e}HWaFvJM2=wtJz#twRTz%CXr zk?S5F(an2R^l*vkmh-4zB}rBGeWQ62r+CL5*0Mf>r`kA!ls(2FE-;53+&0ekab6M( zbJj7|v6A2Ocx#+3rLo^IO4%h=af6daZ3-VX1&bAeXB-vIFXN@W*w3hbg9DtE#jVUg zTyEmC*w3b_jT&<|b1q4m&DS_?lh#R+$T^}4Pr}%6J!Hq9qq+4ZjuDR}at@;+omgY$ cs_g&A7nUh6Q1-85+W-In07*qoM6N<$f^)%y>Hq)$ literal 0 HcmV?d00001 From f859626ef7df37a05fc527e10ff7d5fbe4233f41 Mon Sep 17 00:00:00 2001 From: AsY!um- <377468+AsYlum-@users.noreply.github.com> Date: Tue, 21 Apr 2026 17:38:40 +0200 Subject: [PATCH 4/8] Simple help form for tile data. --- .../Forms/TileDataHelpForm.Designer.cs | 135 ++++++++++++++ UoFiddler.Controls/Forms/TileDataHelpForm.cs | 164 ++++++++++++++++++ .../Forms/TileDataHelpForm.resx | 120 +++++++++++++ .../UserControls/TileDataControl.Designer.cs | 22 ++- .../UserControls/TileDataControl.cs | 6 + 5 files changed, 445 insertions(+), 2 deletions(-) create mode 100644 UoFiddler.Controls/Forms/TileDataHelpForm.Designer.cs create mode 100644 UoFiddler.Controls/Forms/TileDataHelpForm.cs create mode 100644 UoFiddler.Controls/Forms/TileDataHelpForm.resx diff --git a/UoFiddler.Controls/Forms/TileDataHelpForm.Designer.cs b/UoFiddler.Controls/Forms/TileDataHelpForm.Designer.cs new file mode 100644 index 00000000..0a1248cb --- /dev/null +++ b/UoFiddler.Controls/Forms/TileDataHelpForm.Designer.cs @@ -0,0 +1,135 @@ +namespace UoFiddler.Controls.Forms +{ + partial class TileDataHelpForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + _splitContainer = new System.Windows.Forms.SplitContainer(); + _listView = new System.Windows.Forms.ListView(); + _columnField = new System.Windows.Forms.ColumnHeader(); + _descriptionBox = new System.Windows.Forms.RichTextBox(); + _btnClose = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)_splitContainer).BeginInit(); + _splitContainer.Panel1.SuspendLayout(); + _splitContainer.Panel2.SuspendLayout(); + _splitContainer.SuspendLayout(); + SuspendLayout(); + // + // _splitContainer + // + _splitContainer.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; + _splitContainer.Location = new System.Drawing.Point(8, 8); + _splitContainer.Name = "_splitContainer"; + // + // _splitContainer.Panel1 + // + _splitContainer.Panel1.Controls.Add(_listView); + // + // _splitContainer.Panel2 + // + _splitContainer.Panel2.Controls.Add(_descriptionBox); + _splitContainer.Size = new System.Drawing.Size(544, 396); + _splitContainer.SplitterDistance = 185; + _splitContainer.TabIndex = 0; + // + // _listView + // + _listView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { _columnField }); + _listView.Dock = System.Windows.Forms.DockStyle.Fill; + _listView.FullRowSelect = true; + _listView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + _listView.Location = new System.Drawing.Point(0, 0); + _listView.MultiSelect = false; + _listView.Name = "_listView"; + _listView.Size = new System.Drawing.Size(185, 396); + _listView.TabIndex = 0; + _listView.UseCompatibleStateImageBehavior = false; + _listView.View = System.Windows.Forms.View.Details; + _listView.SelectedIndexChanged += OnSelectionChanged; + // + // _columnField + // + _columnField.Text = "Field"; + _columnField.Width = 162; + // + // _descriptionBox + // + _descriptionBox.BackColor = System.Drawing.SystemColors.Control; + _descriptionBox.BorderStyle = System.Windows.Forms.BorderStyle.None; + _descriptionBox.Dock = System.Windows.Forms.DockStyle.Fill; + _descriptionBox.Location = new System.Drawing.Point(0, 0); + _descriptionBox.Name = "_descriptionBox"; + _descriptionBox.ReadOnly = true; + _descriptionBox.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical; + _descriptionBox.Size = new System.Drawing.Size(355, 396); + _descriptionBox.TabIndex = 0; + _descriptionBox.TabStop = false; + _descriptionBox.Text = ""; + // + // _btnClose + // + _btnClose.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right; + _btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel; + _btnClose.Location = new System.Drawing.Point(477, 412); + _btnClose.Name = "_btnClose"; + _btnClose.Size = new System.Drawing.Size(75, 27); + _btnClose.TabIndex = 1; + _btnClose.Text = "Close"; + _btnClose.UseVisualStyleBackColor = true; + // + // TileDataHelpForm + // + AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + CancelButton = _btnClose; + ClientSize = new System.Drawing.Size(560, 448); + Controls.Add(_splitContainer); + Controls.Add(_btnClose); + FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + MaximizeBox = false; + MinimizeBox = false; + Name = "TileDataHelpForm"; + Padding = new System.Windows.Forms.Padding(8); + ShowInTaskbar = false; + StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + Text = "TileData Field Reference"; + _splitContainer.Panel1.ResumeLayout(false); + _splitContainer.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)_splitContainer).EndInit(); + _splitContainer.ResumeLayout(false); + ResumeLayout(false); + } + + #endregion + + private System.Windows.Forms.SplitContainer _splitContainer; + private System.Windows.Forms.ListView _listView; + private System.Windows.Forms.ColumnHeader _columnField; + private System.Windows.Forms.RichTextBox _descriptionBox; + private System.Windows.Forms.Button _btnClose; + } +} diff --git a/UoFiddler.Controls/Forms/TileDataHelpForm.cs b/UoFiddler.Controls/Forms/TileDataHelpForm.cs new file mode 100644 index 00000000..7683c4a6 --- /dev/null +++ b/UoFiddler.Controls/Forms/TileDataHelpForm.cs @@ -0,0 +1,164 @@ +/*************************************************************************** + * + * $Author: Turley + * + * "THE BEER-WARE LICENSE" + * As long as you retain this notice you can do whatever you want with + * this stuff. If we meet some day, and you think this stuff is worth it, + * you can buy me a beer in return. + * + ***************************************************************************/ + +using System.Text; +using System.Windows.Forms; + +namespace UoFiddler.Controls.Forms +{ + public partial class TileDataHelpForm : Form + { + public TileDataHelpForm() + { + InitializeComponent(); + PopulateFields(); + } + + private void PopulateFields() + { + _listView.Groups.Add(new ListViewGroup("items", "Items")); + _listView.Groups.Add(new ListViewGroup("land", "Land Tiles")); + _listView.Groups.Add(new ListViewGroup("flags", "Flags")); + + Add("Name", "This field is for the name of the item, which can be a maximum of 20 characters.", "items"); + Add("Animation", "This field is for the animation ID associated with the item.", "items"); + Add("Weight", "This field is for the weight of the item.", "items"); + Add("Layer", new StringBuilder() + .AppendLine("This field is for the layer of the item:") + .AppendLine("") + .AppendLine("1 One handed weapon") + .AppendLine("2 Two handed weapon, shield, or misc.") + .AppendLine("3 Shoes") + .AppendLine("4 Pants") + .AppendLine("5 Shirt") + .AppendLine("6 Helm / Line") + .AppendLine("7 Gloves") + .AppendLine("8 Ring") + .AppendLine("9 Talisman") + .AppendLine("10 Neck") + .AppendLine("11 Hair") + .AppendLine("12 Waist (half apron)") + .AppendLine("13 Torso (inner) (chest armor)") + .AppendLine("14 Bracelet") + .AppendLine("15 Unused (but backpackers for backpackers go to 21)") + .AppendLine("16 Facial Hair") + .AppendLine("17 Torso (middle) (surcoat, tunic, full apron, sash)") + .AppendLine("18 Earrings") + .AppendLine("19 Arms") + .AppendLine("20 Back (cloak)") + .AppendLine("21 Backpack") + .AppendLine("22 Torso (outer) (robe)") + .AppendLine("23 Legs (outer) (skirt / kilt)") + .AppendLine("24 Legs (inner) (leg armor)") + .AppendLine("25 Mount (horse, ostard, etc)") + .AppendLine("26 NPC Buy Restock container") + .AppendLine("27 NPC Buy no restock container") + .Append("28 NPC Sell container") + .ToString(), "items"); + Add("Quantity", "This field is for the quantity of the item.", "items"); + Add("Value", "This field is for the value of the item.", "items"); + Add("Stacking Offset", new StringBuilder() + .AppendLine("StackOff refers to the stacking offset in pixels when multiple items are stacked.") + .Append("A higher StackOff value means the items will appear further apart from each other within the stack.") + .ToString(), "items"); + Add("Hue", "This field is for the hue (color) of the item.", "items"); + Add("Unknown 2", "This field is for the second unknown value.", "items"); + Add("Misc Data", "Old UO Demo weapon template definition", "items"); + Add("Height", "This field is for the height of the item.", "items"); + Add("Unknown 3", "This field is for the third unknown value.", "items"); + + Add("Name", "This field is for the name of the land tile, which can be a maximum of 20 characters.", "land"); + Add("Texture ID", "This field is for the texture ID associated with the land tile.", "land"); + + Add("Background", "Not yet documented.", "flags"); + Add("Weapon", "Not yet documented.", "flags"); + Add("Transparent", "Not yet documented.", "flags"); + Add("Translucent", "The tile is rendered with partial alpha-transparency.", "flags"); + Add("Wall", "The tile is a wall.", "flags"); + Add("Damaging", "The tile can cause damage when moved over.", "flags"); + Add("Impassable", "The tile may not be moved over or through.", "flags"); + Add("Wet", "Not yet documented.", "flags"); + Add("Unknown1", "Unknown.", "flags"); + Add("Surface", "The tile is a surface. It may be moved over, but not through.", "flags"); + Add("Bridge", "The tile is a stair, ramp, or ladder.", "flags"); + Add("Generic", "The tile is stackable.", "flags"); + Add("Window", "The tile is a window. Like NoShoot, tiles with this flag block line of sight.", "flags"); + Add("NoShoot", "The tile blocks line of sight.", "flags"); + Add("ArticleA", "For single-amount tiles, the string \"a \" should be prepended to the tile name.", "flags"); + Add("ArticleAn", "For single-amount tiles, the string \"an \" should be prepended to the tile name.", "flags"); + Add("ArticleThe", "Probably article \"The\" prepended to the tile name.", "flags"); + Add("Foliage", "The tile becomes translucent when walked behind. Boat masts also have this flag.", "flags"); + Add("PartialHue", "Only gray pixels will be hued.", "flags"); + Add("NoHouse", "NoHouse or Unknown. Needs further research.", "flags"); + Add("Map", "The tile is a map in the cartography sense. Unknown usage.", "flags"); + Add("Container", "The tile is a container.", "flags"); + Add("Wearable", "The tile may be equipped.", "flags"); + Add("LightSource", "The tile gives off light.", "flags"); + Add("Animation", "The tile is animated.", "flags"); + Add("HoverOver", "Gargoyles can fly over, or NoDiagonal.", "flags"); + Add("NoDiagonal", "NoDiagonal (Unknown3).", "flags"); + Add("Armor", "Not yet documented.", "flags"); + Add("Roof", "The tile is a slanted roof.", "flags"); + Add("Door", "The tile is a door. Tiles with this flag can be moved through by ghosts and GMs.", "flags"); + Add("StairBack", "Not yet documented.", "flags"); + Add("StairRight", "Not yet documented.", "flags"); + Add("AlphaBlend", "Blend Alphas, tile blending.", "flags"); + Add("UseNewArt", "Uses new art style? Something related to the nodraw tile?", "flags"); + Add("ArtUsed", "Has art being used?", "flags"); + Add("Unused8", "Unused or unknown yet.", "flags"); + Add("NoShadow", "Disallow shadow on this tile, light source? lava?", "flags"); + Add("PixelBleed", "Let pixels bleed in to other tiles? Is this Disabling Texture Clamp?", "flags"); + Add("PlayAnimOnce", "Play tile animation once.", "flags"); + Add("MultiMovable", "Movable multi? Cool ships and vehicles etc? Something related to the masts.", "flags"); + Add("Unused10", "Unused or unknown yet.", "flags"); + Add("Unused11", "Unused or unknown yet.", "flags"); + Add("Unused12", "Unused or unknown yet.", "flags"); + Add("Unused13", "Unused or unknown yet.", "flags"); + Add("Unused14", "Unused or unknown yet.", "flags"); + Add("Unused15", "Unused or unknown yet.", "flags"); + Add("Unused16", "Unused or unknown yet.", "flags"); + Add("Unused17", "Unused or unknown yet.", "flags"); + Add("Unused18", "Unused or unknown yet.", "flags"); + Add("Unused19", "Unused or unknown yet.", "flags"); + Add("Unused20", "Unused or unknown yet.", "flags"); + Add("Unused21", "Unused or unknown yet.", "flags"); + Add("Unused22", "Unused or unknown yet.", "flags"); + Add("Unused23", "Unused or unknown yet.", "flags"); + Add("Unused24", "Unused or unknown yet.", "flags"); + Add("Unused25", "Unused or unknown yet.", "flags"); + Add("Unused26", "Unused or unknown yet.", "flags"); + Add("Unused27", "Unused or unknown yet.", "flags"); + Add("Unused28", "Unused or unknown yet.", "flags"); + Add("Unused29", "Unused or unknown yet.", "flags"); + Add("Unused30", "Unused or unknown yet.", "flags"); + Add("Unused31", "Unused or unknown yet.", "flags"); + Add("Unused32", "Unused or unknown yet.", "flags"); + + if (_listView.Items.Count > 0) + _listView.Items[0].Selected = true; + } + + private void Add(string field, string description, string groupKey) + { + var group = _listView.Groups[groupKey]; + var item = new ListViewItem(field, group) { Tag = description }; + _listView.Items.Add(item); + } + + private void OnSelectionChanged(object sender, System.EventArgs e) + { + if (_listView.SelectedItems.Count == 0) + return; + + _descriptionBox.Text = _listView.SelectedItems[0].Tag as string ?? string.Empty; + } + } +} diff --git a/UoFiddler.Controls/Forms/TileDataHelpForm.resx b/UoFiddler.Controls/Forms/TileDataHelpForm.resx new file mode 100644 index 00000000..4edf53f8 --- /dev/null +++ b/UoFiddler.Controls/Forms/TileDataHelpForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/UoFiddler.Controls/UserControls/TileDataControl.Designer.cs b/UoFiddler.Controls/UserControls/TileDataControl.Designer.cs index 6932293d..83fe7136 100644 --- a/UoFiddler.Controls/UserControls/TileDataControl.Designer.cs +++ b/UoFiddler.Controls/UserControls/TileDataControl.Designer.cs @@ -127,6 +127,8 @@ private void InitializeComponent() toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); toolStripButton4 = new System.Windows.Forms.ToolStripButton(); toolStripButton3 = new System.Windows.Forms.ToolStripButton(); + toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator(); + helpToolStripButton = new System.Windows.Forms.ToolStripButton(); toolTipComponent = new System.Windows.Forms.ToolTip(components); tabcontrol.SuspendLayout(); tabPageItems.SuspendLayout(); @@ -901,7 +903,7 @@ private void InitializeComponent() // MainToolStrip // MainToolStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; - MainToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { toolStripLabel1, searchByIdToolStripTextBox, toolStripLabel2, searchByNameToolStripTextBox, searchByNameToolStripButton, toolStripSeparator5, toolStripDropDownButton1, toolStripSeparator1, toolStripButton1, toolStripButton5, toolStripSeparator2, toolStripButton4, toolStripButton3 }); + MainToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { toolStripLabel1, searchByIdToolStripTextBox, toolStripLabel2, searchByNameToolStripTextBox, searchByNameToolStripButton, toolStripSeparator5, toolStripDropDownButton1, toolStripSeparator1, toolStripButton1, toolStripButton5, toolStripSeparator2, toolStripButton4, toolStripButton3, toolStripSeparator6, helpToolStripButton }); MainToolStrip.Location = new System.Drawing.Point(0, 0); MainToolStrip.Name = "MainToolStrip"; MainToolStrip.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; @@ -1044,7 +1046,21 @@ private void InitializeComponent() toolStripButton3.Size = new System.Drawing.Size(79, 22); toolStripButton3.Text = "Save Tiledata"; toolStripButton3.Click += OnClickSaveTiledata; - // + // + // toolStripSeparator6 + // + toolStripSeparator6.Name = "toolStripSeparator6"; + toolStripSeparator6.Size = new System.Drawing.Size(6, 25); + // + // helpToolStripButton + // + helpToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + helpToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; + helpToolStripButton.Name = "helpToolStripButton"; + helpToolStripButton.Size = new System.Drawing.Size(36, 22); + helpToolStripButton.Text = "Help"; + helpToolStripButton.Click += HelpToolStripButton_Click; + // // TileDataControl // AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); @@ -1185,5 +1201,7 @@ private void InitializeComponent() private System.Windows.Forms.Label miscDataLabel; private System.Windows.Forms.Label stackOffLabel; private System.Windows.Forms.Label layerLabel; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator6; + private System.Windows.Forms.ToolStripButton helpToolStripButton; } } diff --git a/UoFiddler.Controls/UserControls/TileDataControl.cs b/UoFiddler.Controls/UserControls/TileDataControl.cs index ba940d07..5981c7c2 100644 --- a/UoFiddler.Controls/UserControls/TileDataControl.cs +++ b/UoFiddler.Controls/UserControls/TileDataControl.cs @@ -1713,6 +1713,12 @@ private void SearchByNameToolStripButton_Click(object sender, EventArgs e) SearchName(searchByNameToolStripTextBox.Text, true, landTilesSelected); } + private void HelpToolStripButton_Click(object sender, EventArgs e) + { + using var form = new TileDataHelpForm(); + form.ShowDialog(this); + } + private void AssignToolTipsToLabels() { // Statics From 16c143ff1c5d2c2664464f53da937cc343c72948 Mon Sep 17 00:00:00 2001 From: AsY!um- <377468+AsYlum-@users.noreply.github.com> Date: Tue, 21 Apr 2026 18:08:54 +0200 Subject: [PATCH 5/8] Search next/previous F3/Shift-F3 for Cliloc, Dress, Items, Land tiles, Sounds, Speech and Tiledata tabs. --- .../UserControls/ClilocControl.cs | 62 +++++++++ .../UserControls/DressControl.cs | 59 +++++++++ .../UserControls/ItemsControl.cs | 74 +++++++++++ .../UserControls/LandTilesControl.cs | 74 +++++++++++ .../UserControls/SoundsControl.cs | 17 +++ .../UserControls/SpeechControl.cs | 99 ++++++++++++++ .../UserControls/TileDataControl.cs | 125 ++++++++++++++++++ 7 files changed, 510 insertions(+) diff --git a/UoFiddler.Controls/UserControls/ClilocControl.cs b/UoFiddler.Controls/UserControls/ClilocControl.cs index dbe19e4a..c248a972 100644 --- a/UoFiddler.Controls/UserControls/ClilocControl.cs +++ b/UoFiddler.Controls/UserControls/ClilocControl.cs @@ -254,6 +254,68 @@ private void FindEntryClick(object sender, EventArgs e) MessageBoxDefaultButton.Button1); } + protected override bool ProcessCmdKey(ref Message msg, Keys keyData) + { + if (keyData == Keys.F3) + { + FindEntryClick(null, EventArgs.Empty); + return true; + } + + if (keyData == (Keys.F3 | Keys.Shift)) + { + FindPreviousEntry(); + return true; + } + + return base.ProcessCmdKey(ref msg, keyData); + } + + private void FindPreviousEntry() + { + if (string.IsNullOrEmpty(FindEntry.Text) || FindEntry.Text == _searchTextPlaceholder) + { + MessageBox.Show("Please provide search text", "Find Entry", MessageBoxButtons.OK, MessageBoxIcon.Error, + MessageBoxDefaultButton.Button1); + + return; + } + + var searchMethod = SearchHelper.GetSearchMethod(RegexToolStripButton.Checked); + + bool hasErrors = false; + + int startRow = dataGridView1.Rows.GetFirstRow(DataGridViewElementStates.Selected) - 1; + if (startRow < 0) + { + startRow = dataGridView1.Rows.Count - 1; + } + + for (int i = startRow; i >= 0; --i) + { + var searchResult = searchMethod(FindEntry.Text, dataGridView1.Rows[i].Cells[1].Value.ToString()); + if (searchResult.HasErrors) + { + hasErrors = true; + break; + } + + if (!searchResult.EntryFound) + { + continue; + } + + dataGridView1.ClearSelection(); + dataGridView1.Rows[i].Selected = true; + dataGridView1.FirstDisplayedScrollingRowIndex = i; + return; + } + + MessageBox.Show(hasErrors ? "Invalid regular expression." : "Entry not found.", "Find Entry", + MessageBoxButtons.OK, MessageBoxIcon.Error, + MessageBoxDefaultButton.Button1); + } + private void OnClickSave(object sender, EventArgs e) { dataGridView1.CancelEdit(); diff --git a/UoFiddler.Controls/UserControls/DressControl.cs b/UoFiddler.Controls/UserControls/DressControl.cs index 3467ddaa..3ce885cb 100644 --- a/UoFiddler.Controls/UserControls/DressControl.cs +++ b/UoFiddler.Controls/UserControls/DressControl.cs @@ -1684,8 +1684,67 @@ private void SearchNodes(string searchText, TreeNode startNode) } } + protected override bool ProcessCmdKey(ref Message msg, Keys keyData) + { + if (keyData == Keys.F3) + { + SearchByName(); + return true; + } + + if (keyData == (Keys.F3 | Keys.Shift)) + { + SearchByNamePrevious(); + return true; + } + + return base.ProcessCmdKey(ref msg, keyData); + } + + private void SearchByNamePrevious() + { + var searchText = SearchItemTextBox.Text.Trim(); + + if (string.IsNullOrEmpty(searchText)) + { + return; + } + + if (_lastSearchText != searchText) + { + _searchResults.Clear(); + _lastSearchText = searchText; + _lastNodeIndex = 0; + SearchNodes(searchText, treeViewItems.Nodes[0]); + } + + if (_searchResults.Count == 0) + { + return; + } + + if (_lastNodeIndex >= _searchResults.Count) + { + _lastNodeIndex = 0; + } + + _lastNodeIndex -= 2; + if (_lastNodeIndex < 0) + { + _lastNodeIndex = _searchResults.Count + _lastNodeIndex; + } + + treeViewItems.SelectedNode = _searchResults[_lastNodeIndex]; + _lastNodeIndex++; + } + private void SearchItemTextBox_KeyUp(object sender, KeyEventArgs e) { + if (e.KeyCode == Keys.F3) + { + return; + } + SearchByName(); } diff --git a/UoFiddler.Controls/UserControls/ItemsControl.cs b/UoFiddler.Controls/UserControls/ItemsControl.cs index 60f64503..159a4b20 100644 --- a/UoFiddler.Controls/UserControls/ItemsControl.cs +++ b/UoFiddler.Controls/UserControls/ItemsControl.cs @@ -1215,8 +1215,82 @@ private void SearchByIdToolStripTextBox_KeyUp(object sender, KeyEventArgs e) SelectedGraphicId = indexValue; } + protected override bool ProcessCmdKey(ref Message msg, Keys keyData) + { + if (keyData == Keys.F3 || keyData == (Keys.F3 | Keys.Shift)) + { + if (searchByNameToolStripTextBox.TextBox.Focused) + { + return false; + } + + if (!string.IsNullOrEmpty(searchByNameToolStripTextBox.Text)) + { + if (keyData == Keys.F3) + { + SearchName(searchByNameToolStripTextBox.Text, true); + } + else + { + SearchNamePrevious(searchByNameToolStripTextBox.Text); + } + } + return true; + } + + return base.ProcessCmdKey(ref msg, keyData); + } + + public static bool SearchNamePrevious(string name) + { + var searchMethod = SearchHelper.GetSearchMethod(); + + int index = RefMarker._itemList.Count - 1; + if (RefMarker._selectedGraphicId >= 0) + { + index = RefMarker._itemList.IndexOf(RefMarker._selectedGraphicId) - 1; + if (index < 0) + { + index = RefMarker._itemList.Count - 1; + } + } + + for (int i = index; i >= 0; --i) + { + var searchResult = searchMethod(name, TileData.ItemTable[RefMarker._itemList[i]].Name); + if (searchResult.HasErrors) + { + break; + } + + if (!searchResult.EntryFound) + { + continue; + } + + RefMarker.ItemsTileView.FocusIndex = -1; + RefMarker.SelectedGraphicId = RefMarker._itemList[i]; + return true; + } + + return false; + } + private void SearchByNameToolStripTextBox_KeyUp(object sender, KeyEventArgs e) { + if (e.KeyCode == Keys.F3) + { + if (e.Shift) + { + SearchNamePrevious(searchByNameToolStripTextBox.Text); + } + else + { + SearchName(searchByNameToolStripTextBox.Text, true); + } + return; + } + SearchName(searchByNameToolStripTextBox.Text, false); } diff --git a/UoFiddler.Controls/UserControls/LandTilesControl.cs b/UoFiddler.Controls/UserControls/LandTilesControl.cs index 4c49278c..8ed6a411 100644 --- a/UoFiddler.Controls/UserControls/LandTilesControl.cs +++ b/UoFiddler.Controls/UserControls/LandTilesControl.cs @@ -898,8 +898,82 @@ private void SearchByIdToolStripTextBox_KeyUp(object sender, KeyEventArgs e) SelectedGraphicId = indexValue; } + protected override bool ProcessCmdKey(ref Message msg, Keys keyData) + { + if (keyData == Keys.F3 || keyData == (Keys.F3 | Keys.Shift)) + { + if (searchByNameToolStripTextBox.TextBox.Focused) + { + return false; + } + + if (!string.IsNullOrEmpty(searchByNameToolStripTextBox.Text)) + { + if (keyData == Keys.F3) + { + SearchName(searchByNameToolStripTextBox.Text, true); + } + else + { + SearchNamePrevious(searchByNameToolStripTextBox.Text); + } + } + return true; + } + + return base.ProcessCmdKey(ref msg, keyData); + } + + public static bool SearchNamePrevious(string name) + { + var searchMethod = SearchHelper.GetSearchMethod(); + + int index = _refMarker._tileList.Count - 1; + if (_refMarker._selectedGraphicId >= 0) + { + index = _refMarker._tileList.IndexOf(_refMarker._selectedGraphicId) - 1; + if (index < 0) + { + index = _refMarker._tileList.Count - 1; + } + } + + for (int i = index; i >= 0; --i) + { + var searchResult = searchMethod(name, TileData.LandTable[_refMarker._tileList[i]].Name); + if (searchResult.HasErrors) + { + break; + } + + if (!searchResult.EntryFound) + { + continue; + } + + _refMarker.LandTilesTileView.FocusIndex = -1; + _refMarker.SelectedGraphicId = _refMarker._tileList[i]; + return true; + } + + return false; + } + private void SearchByNameToolStripTextBox_KeyUp(object sender, KeyEventArgs e) { + if (e.KeyCode == Keys.F3) + { + if (e.Shift) + { + SearchNamePrevious(searchByNameToolStripTextBox.Text); + } + else + { + SearchName(searchByNameToolStripTextBox.Text, true); + } + return; + } + SearchName(searchByNameToolStripTextBox.Text, false); } diff --git a/UoFiddler.Controls/UserControls/SoundsControl.cs b/UoFiddler.Controls/UserControls/SoundsControl.cs index 1cbbde12..81dfafd5 100644 --- a/UoFiddler.Controls/UserControls/SoundsControl.cs +++ b/UoFiddler.Controls/UserControls/SoundsControl.cs @@ -751,6 +751,23 @@ private void SearchByIdButton_Click(object sender, EventArgs e) } } + protected override bool ProcessCmdKey(ref Message msg, Keys keyData) + { + if (keyData == Keys.F3) + { + GoNextResultButton_Click(null, EventArgs.Empty); + return true; + } + + if (keyData == (Keys.F3 | Keys.Shift)) + { + GoPrevResultButton_Click(null, EventArgs.Empty); + return true; + } + + return base.ProcessCmdKey(ref msg, keyData); + } + private void SearchByNameButton_Click(object sender, EventArgs e) { DoSearchName(SearchNameTextbox.Text, false, false); diff --git a/UoFiddler.Controls/UserControls/SpeechControl.cs b/UoFiddler.Controls/UserControls/SpeechControl.cs index 6e21efe2..07a2c58f 100644 --- a/UoFiddler.Controls/UserControls/SpeechControl.cs +++ b/UoFiddler.Controls/UserControls/SpeechControl.cs @@ -205,6 +205,105 @@ private void OnClickNextKeyWord(object sender, EventArgs e) } } + protected override bool ProcessCmdKey(ref Message msg, Keys keyData) + { + if (keyData == Keys.F3 || keyData == (Keys.F3 | Keys.Shift)) + { + bool isNext = keyData == Keys.F3; + + if (IDEntry.Focused) + { + if (isNext) + { + OnClickNextID(null, EventArgs.Empty); + } + else + { + FindIdPrevious(); + } + } + else + { + if (isNext) + { + OnClickNextKeyWord(null, EventArgs.Empty); + } + else + { + FindKeyWordPrevious(); + } + } + return true; + } + + return base.ProcessCmdKey(ref msg, keyData); + } + + private void FindIdPrevious() + { + if (!short.TryParse(IDEntry.Text, NumberStyles.Integer, null, out short nr)) + { + MessageBox.Show("ID not found.", "Goto", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); + return; + } + + int startRow = dataGridView1.SelectedRows.Count > 0 + ? dataGridView1.SelectedRows[0].Index - 1 + : dataGridView1.Rows.Count - 1; + + if (startRow < 0) + { + startRow = dataGridView1.Rows.Count - 1; + } + + for (int i = startRow; i >= 0; --i) + { + if ((short)dataGridView1.Rows[i].Cells[0].Value != nr) + { + continue; + } + + dataGridView1.Rows[i].Selected = true; + dataGridView1.FirstDisplayedScrollingRowIndex = i; + return; + } + + MessageBox.Show("ID not found.", "Goto", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); + } + + private void FindKeyWordPrevious() + { + if (string.IsNullOrEmpty(KeyWordEntry.Text) || KeyWordEntry.Text == _keywordEntryPlaceholder) + { + return; + } + + string toFind = KeyWordEntry.Text; + + int startRow = dataGridView1.SelectedRows.Count > 0 + ? dataGridView1.SelectedRows[0].Index - 1 + : dataGridView1.Rows.Count - 1; + + if (startRow < 0) + { + startRow = dataGridView1.Rows.Count - 1; + } + + for (int i = startRow; i >= 0; --i) + { + if (!dataGridView1.Rows[i].Cells[1].Value.ToString().Contains(toFind)) + { + continue; + } + + dataGridView1.Rows[i].Selected = true; + dataGridView1.FirstDisplayedScrollingRowIndex = i; + return; + } + + MessageBox.Show("KeyWord not found.", "Entry", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); + } + private void OnClickSave(object sender, EventArgs e) { dataGridView1.CancelEdit(); diff --git a/UoFiddler.Controls/UserControls/TileDataControl.cs b/UoFiddler.Controls/UserControls/TileDataControl.cs index 5981c7c2..0b7b5598 100644 --- a/UoFiddler.Controls/UserControls/TileDataControl.cs +++ b/UoFiddler.Controls/UserControls/TileDataControl.cs @@ -151,6 +151,32 @@ public static bool SearchGraphic(int graphic, bool land) return false; } + protected override bool ProcessCmdKey(ref Message msg, Keys keyData) + { + if (keyData == Keys.F3 || keyData == (Keys.F3 | Keys.Shift)) + { + if (searchByNameToolStripTextBox.TextBox.Focused) + { + return false; + } + + if (!string.IsNullOrEmpty(searchByNameToolStripTextBox.Text)) + { + if (keyData == Keys.F3) + { + SearchName(searchByNameToolStripTextBox.Text, true, tabcontrol.SelectedIndex != 0); + } + else + { + SearchNamePrevious(searchByNameToolStripTextBox.Text, tabcontrol.SelectedIndex != 0); + } + } + return true; + } + + return base.ProcessCmdKey(ref msg, keyData); + } + public static bool SearchName(string name, bool next, bool land) { int index = 0; @@ -238,6 +264,92 @@ public static bool SearchName(string name, bool next, bool land) return false; } + public static bool SearchNamePrevious(string name, bool land) + { + var searchMethod = SearchHelper.GetSearchMethod(); + + if (land) + { + int index = _refMarker.treeViewLand.Nodes.Count - 1; + if (_refMarker.treeViewLand.SelectedNode?.Index >= 0) + { + index = _refMarker.treeViewLand.SelectedNode.Index - 1; + if (index < 0) + { + index = _refMarker.treeViewLand.Nodes.Count - 1; + } + } + + for (int i = index; i >= 0; --i) + { + TreeNode node = _refMarker.treeViewLand.Nodes[i]; + if (node.Tag == null) + { + continue; + } + + var searchResult = searchMethod(name, TileData.LandTable[(int)node.Tag].Name); + if (!searchResult.EntryFound) + { + continue; + } + + _refMarker.tabcontrol.SelectTab(1); + _refMarker.treeViewLand.SelectedNode = node; + node.EnsureVisible(); + return true; + } + } + else + { + int parentIndex = _refMarker.treeViewItem.Nodes.Count - 1; + int sIndex = -1; + + if (_refMarker.treeViewItem.SelectedNode != null) + { + if (_refMarker.treeViewItem.SelectedNode.Parent != null) + { + parentIndex = _refMarker.treeViewItem.SelectedNode.Parent.Index; + sIndex = _refMarker.treeViewItem.SelectedNode.Index - 1; + } + else + { + parentIndex = _refMarker.treeViewItem.SelectedNode.Index; + } + } + + for (int i = parentIndex; i >= 0; --i) + { + var parentNode = _refMarker.treeViewItem.Nodes[i]; + int startChild = sIndex >= 0 ? sIndex : parentNode.Nodes.Count - 1; + + for (int j = startChild; j >= 0; --j) + { + TreeNode node = parentNode.Nodes[j]; + if (node.Tag == null) + { + continue; + } + + var searchResult = searchMethod(name, TileData.ItemTable[(int)node.Tag].Name); + if (!searchResult.EntryFound) + { + continue; + } + + _refMarker.tabcontrol.SelectTab(0); + _refMarker.treeViewItem.SelectedNode = node; + node.EnsureVisible(); + return true; + } + + sIndex = -1; + } + } + + return false; + } + public void ApplyFilterItem(ItemData item) { treeViewItem.BeginUpdate(); @@ -1703,6 +1815,19 @@ private void SearchByNameToolStripTextBox_KeyUp(object sender, KeyEventArgs e) { var landTilesSelected = tabcontrol.SelectedIndex != 0; + if (e.KeyCode == Keys.F3) + { + if (e.Shift) + { + SearchNamePrevious(searchByNameToolStripTextBox.Text, landTilesSelected); + } + else + { + SearchName(searchByNameToolStripTextBox.Text, true, landTilesSelected); + } + return; + } + SearchName(searchByNameToolStripTextBox.Text, false, landTilesSelected); } From 84b2072134e868e933a411242de7f17fc9419565 Mon Sep 17 00:00:00 2001 From: AsY!um- <377468+AsYlum-@users.noreply.github.com> Date: Tue, 21 Apr 2026 19:32:17 +0200 Subject: [PATCH 6/8] Consolidate change background color and make it persistable option. --- UoFiddler.Controls/Classes/ControlEvents.cs | 12 +++ UoFiddler.Controls/Classes/Options.cs | 2 +- .../UserControls/GumpControl.Designer.cs | 15 +++- .../UserControls/GumpControl.cs | 21 ++++- .../UserControls/ItemsControl.cs | 46 +++++----- .../UserControls/LandTilesControl.Designer.cs | 15 +++- .../UserControls/LandTilesControl.cs | 26 ++++++ .../UserControls/MultisControl.cs | 27 +++--- .../UserControls/MultisControl.resx | 4 +- UoFiddler/Classes/FiddlerOptions.cs | 20 ++--- UoFiddler/Forms/OptionsForm.Designer.cs | 86 +++++++++++-------- UoFiddler/Forms/OptionsForm.cs | 25 ++++-- UoFiddler/Forms/OptionsForm.resx | 3 + 13 files changed, 204 insertions(+), 98 deletions(-) diff --git a/UoFiddler.Controls/Classes/ControlEvents.cs b/UoFiddler.Controls/Classes/ControlEvents.cs index 875811e5..2c921530 100644 --- a/UoFiddler.Controls/Classes/ControlEvents.cs +++ b/UoFiddler.Controls/Classes/ControlEvents.cs @@ -39,6 +39,8 @@ public sealed class ControlEvents public delegate void ProgressChangeHandler(); + public delegate void PreviewBackgroundColorChangeHandler(); + /// /// Fired when map diff file usage is switched /// @@ -104,6 +106,11 @@ public sealed class ControlEvents /// public static event ProgressChangeHandler ProgressChangeEvent; + /// + /// Fired when preview background color changed + /// + public static event PreviewBackgroundColorChangeHandler PreviewBackgroundColorChangeEvent; + public static void FireMapDiffChangeEvent() { MapDiffChangeEvent?.Invoke(); @@ -168,5 +175,10 @@ public static void FireProgressChangeEvent() { ProgressChangeEvent?.Invoke(); } + + public static void FirePreviewBackgroundColorChangeEvent() + { + PreviewBackgroundColorChangeEvent?.Invoke(); + } } } \ No newline at end of file diff --git a/UoFiddler.Controls/Classes/Options.cs b/UoFiddler.Controls/Classes/Options.cs index dab5525f..057ae015 100644 --- a/UoFiddler.Controls/Classes/Options.cs +++ b/UoFiddler.Controls/Classes/Options.cs @@ -207,8 +207,8 @@ public static Icon GetFiddlerIcon() public static string ProfileName { get; set; } public static Color TileFocusColor { get; set; } = Color.DarkRed; public static Color TileSelectionColor { get; set; } = Color.DodgerBlue; - public static bool OverrideBackgroundColorFromTile { get; set; } public static bool RemoveTileBorder { get; set; } + public static Color PreviewBackgroundColor { get; set; } = Color.White; static Options() { diff --git a/UoFiddler.Controls/UserControls/GumpControl.Designer.cs b/UoFiddler.Controls/UserControls/GumpControl.Designer.cs index ee240e28..7e45fd4c 100644 --- a/UoFiddler.Controls/UserControls/GumpControl.Designer.cs +++ b/UoFiddler.Controls/UserControls/GumpControl.Designer.cs @@ -46,6 +46,7 @@ private void InitializeComponent() contextMenuStrip = new System.Windows.Forms.ContextMenuStrip(components); showFreeSlotsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); findNextFreeSlotToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + changeBackgroundColorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); extractImageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); asBmpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -83,6 +84,7 @@ private void InitializeComponent() saveToolStripButton = new System.Windows.Forms.ToolStripButton(); toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator(); pictureBox = new System.Windows.Forms.PictureBox(); + colorDialog = new System.Windows.Forms.ColorDialog(); bottomMenuToolStrip = new System.Windows.Forms.ToolStrip(); IDLabel = new System.Windows.Forms.ToolStripLabel(); SizeLabel = new System.Windows.Forms.ToolStripLabel(); @@ -143,7 +145,7 @@ private void InitializeComponent() // // contextMenuStrip // - contextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { showFreeSlotsToolStripMenuItem, findNextFreeSlotToolStripMenuItem, toolStripSeparator2, extractImageToolStripMenuItem, toolStripSeparator6, jumpToMaleFemale, toolStripSeparator5, replaceGumpToolStripMenuItem, insertToolStripMenuItem, toolStripMenuItem1, removeToolStripMenuItem, toolStripSeparator1, saveToolStripMenuItem }); + contextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { showFreeSlotsToolStripMenuItem, findNextFreeSlotToolStripMenuItem, changeBackgroundColorToolStripMenuItem, toolStripSeparator2, extractImageToolStripMenuItem, toolStripSeparator6, jumpToMaleFemale, toolStripSeparator5, replaceGumpToolStripMenuItem, insertToolStripMenuItem, toolStripMenuItem1, removeToolStripMenuItem, toolStripSeparator1, saveToolStripMenuItem }); contextMenuStrip.Name = "contextMenuStrip1"; contextMenuStrip.Size = new System.Drawing.Size(190, 226); // @@ -160,7 +162,14 @@ private void InitializeComponent() findNextFreeSlotToolStripMenuItem.Size = new System.Drawing.Size(189, 22); findNextFreeSlotToolStripMenuItem.Text = "Find Next Free Slot"; findNextFreeSlotToolStripMenuItem.Click += OnClickFindFree; - // + // + // changeBackgroundColorToolStripMenuItem + // + changeBackgroundColorToolStripMenuItem.Name = "changeBackgroundColorToolStripMenuItem"; + changeBackgroundColorToolStripMenuItem.Size = new System.Drawing.Size(189, 22); + changeBackgroundColorToolStripMenuItem.Text = "Change background color"; + changeBackgroundColorToolStripMenuItem.Click += ChangeBackgroundColorToolStripMenuItem_Click; + // // toolStripSeparator2 // toolStripSeparator2.Name = "toolStripSeparator2"; @@ -555,5 +564,7 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripSeparator toolStripSeparator8; private System.Windows.Forms.ToolStripSeparator toolStripSeparator9; private System.Windows.Forms.ToolStripDropDownButton tagFilterDropDownButton; + private System.Windows.Forms.ToolStripMenuItem changeBackgroundColorToolStripMenuItem; + private System.Windows.Forms.ColorDialog colorDialog; } } diff --git a/UoFiddler.Controls/UserControls/GumpControl.cs b/UoFiddler.Controls/UserControls/GumpControl.cs index 5faea353..22c1e4f5 100644 --- a/UoFiddler.Controls/UserControls/GumpControl.cs +++ b/UoFiddler.Controls/UserControls/GumpControl.cs @@ -40,6 +40,8 @@ public GumpControl() ProgressBar.Visible = false; _refMarker = this; + + pictureBox.BackColor = Options.PreviewBackgroundColor; } private sealed record GumpEntry(string Name, string[] Tags); @@ -118,6 +120,7 @@ protected override void OnLoad(EventArgs e) { ControlEvents.FilePathChangeEvent += OnFilePathChangeEvent; ControlEvents.GumpChangeEvent += OnGumpChangeEvent; + ControlEvents.PreviewBackgroundColorChangeEvent += OnPreviewBackgroundColorChanged; } _loaded = true; @@ -301,6 +304,11 @@ private void OnFilePathChangeEvent() Reload(); } + private void OnPreviewBackgroundColorChanged() + { + pictureBox.BackColor = Options.PreviewBackgroundColor; + } + private void OnGumpChangeEvent(object sender, int index) { if (!_loaded) @@ -355,6 +363,17 @@ private void OnGumpChangeEvent(object sender, int index) } } + private void ChangeBackgroundColorToolStripMenuItem_Click(object sender, EventArgs e) + { + if (colorDialog.ShowDialog() != DialogResult.OK) + { + return; + } + + Options.PreviewBackgroundColor = colorDialog.Color; + ControlEvents.FirePreviewBackgroundColorChangeEvent(); + } + private void ListBox_DrawItem(object sender, DrawItemEventArgs e) { if (e.Index < 0) @@ -385,7 +404,6 @@ private void ListBox_DrawItem(object sender, DrawItemEventArgs e) { e.Graphics.FillRectangle(Brushes.LightCoral, e.Bounds.X, e.Bounds.Y, 105, e.Bounds.Height); } - e.Graphics.DrawImage(bmp, new Rectangle(e.Bounds.X + 3, e.Bounds.Y + 3, width, height)); } else @@ -439,6 +457,7 @@ private void ListBox_SelectedIndexChanged(object sender, EventArgs e) } int i = int.Parse(listBox.Items[listBox.SelectedIndex].ToString()); + pictureBox.BackColor = Options.PreviewBackgroundColor; if (Gumps.IsValidIndex(i)) { Bitmap bmp = Gumps.GetGump(i); diff --git a/UoFiddler.Controls/UserControls/ItemsControl.cs b/UoFiddler.Controls/UserControls/ItemsControl.cs index 159a4b20..4abd0840 100644 --- a/UoFiddler.Controls/UserControls/ItemsControl.cs +++ b/UoFiddler.Controls/UserControls/ItemsControl.cs @@ -71,15 +71,13 @@ public void UpdateTileView() ? Color.Transparent : Color.Gray; - if (Options.OverrideBackgroundColorFromTile) - { - ItemsTileView.BackColor = _backgroundColorItem; - } + var sameBackColor = ItemsTileView.BackColor == Options.PreviewBackgroundColor; + ItemsTileView.BackColor = Options.PreviewBackgroundColor; var sameTileSize = ItemsTileView.TileSize == newSize; var sameFocusColor = ItemsTileView.TileFocusColor == Options.TileFocusColor; var sameSelectionColor = ItemsTileView.TileHighlightColor == Options.TileSelectionColor; - if (sameTileSize && sameFocusColor && sameSelectionColor) + if (sameTileSize && sameFocusColor && sameSelectionColor && sameBackColor) { return; } @@ -219,6 +217,7 @@ public void OnLoad(object sender, EventArgs e) ControlEvents.FilePathChangeEvent += OnFilePathChangeEvent; ControlEvents.ItemChangeEvent += OnItemChangeEvent; ControlEvents.TileDataChangeEvent += OnTileDataChangeEvent; + ControlEvents.PreviewBackgroundColorChangeEvent += OnPreviewBackgroundColorChanged; } IsLoaded = true; @@ -241,6 +240,16 @@ private void OnFilePathChangeEvent() Reload(); } + private void OnPreviewBackgroundColorChanged() + { + ItemsTileView.BackColor = Options.PreviewBackgroundColor; + ItemsTileView.Invalidate(); + if (_selectedGraphicId != -1) + { + UpdateDetail(_selectedGraphicId); + } + } + private void OnTileDataChangeEvent(object sender, int id) { if (!IsLoaded) @@ -321,8 +330,6 @@ private void OnItemChangeEvent(object sender, int index) ItemsTileView.Invalidate(); } - private Color _backgroundColorItem = Color.White; - private void ChangeBackgroundColorToolStripMenuItem_Click(object sender, EventArgs e) { if (colorDialog.ShowDialog() != DialogResult.OK) @@ -330,18 +337,10 @@ private void ChangeBackgroundColorToolStripMenuItem_Click(object sender, EventAr return; } - _backgroundColorItem = colorDialog.Color; - - if (Options.OverrideBackgroundColorFromTile) - { - ItemsTileView.BackColor = _backgroundColorItem; - } - - ItemsTileView.Invalidate(); + Options.PreviewBackgroundColor = colorDialog.Color; + ControlEvents.FirePreviewBackgroundColorChangeEvent(); } - private Color _backgroundDetailColor = Color.White; - private void UpdateDetail(int graphic) { if (IsAncestorSiteInDesignMode || FormsDesignerHelper.IsInDesignMode()) @@ -374,7 +373,7 @@ private void UpdateDetail(int graphic) Bitmap newBit = new Bitmap(DetailPictureBox.Size.Width, DetailPictureBox.Size.Height); using (Graphics newGraph = Graphics.FromImage(newBit)) { - newGraph.Clear(_backgroundDetailColor); + newGraph.Clear(Options.PreviewBackgroundColor); } DetailPictureBox.Image?.Dispose(); @@ -388,7 +387,7 @@ private void UpdateDetail(int graphic) Bitmap newBit = new Bitmap(DetailPictureBox.Size.Width, DetailPictureBox.Size.Height); using (Graphics newGraph = Graphics.FromImage(newBit)) { - newGraph.Clear(_backgroundDetailColor); + newGraph.Clear(Options.PreviewBackgroundColor); newGraph.DrawImage(bit, (DetailPictureBox.Size.Width - bit.Width) / 2, 5); } @@ -432,11 +431,8 @@ private void ChangeBackgroundColorToolStripMenuItemDetail_Click(object sender, E return; } - _backgroundDetailColor = colorDialog.Color; - if (_selectedGraphicId != -1) - { - UpdateDetail(_selectedGraphicId); - } + Options.PreviewBackgroundColor = colorDialog.Color; + ControlEvents.FirePreviewBackgroundColorChangeEvent(); } private bool _scrolling; @@ -894,7 +890,7 @@ private void ItemsTileView_DrawItem(object sender, TileViewControl.DrawTileListI var selected = ItemsTileView.SelectedIndices.Contains(e.Index); if (!selected) { - e.Graphics.Clear(_backgroundColorItem); + e.Graphics.Clear(Options.PreviewBackgroundColor); } var bitmap = Art.GetStatic(_itemList[e.Index], out bool patched); diff --git a/UoFiddler.Controls/UserControls/LandTilesControl.Designer.cs b/UoFiddler.Controls/UserControls/LandTilesControl.Designer.cs index 02e67e6c..67a01c4c 100644 --- a/UoFiddler.Controls/UserControls/LandTilesControl.Designer.cs +++ b/UoFiddler.Controls/UserControls/LandTilesControl.Designer.cs @@ -47,6 +47,7 @@ private void InitializeComponent() LandTilesContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(components); showFreeSlotsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); findNextFreeSlotToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + changeBackgroundColorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator(); exportImageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); asBmpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -87,6 +88,7 @@ private void InitializeComponent() FlagsLabel = new System.Windows.Forms.ToolStripStatusLabel(); panel = new System.Windows.Forms.Panel(); LandTilesTileView = new TileViewControl(); + colorDialog = new System.Windows.Forms.ColorDialog(); LandTilesContextMenuStrip.SuspendLayout(); LandTilesToolStrip.SuspendLayout(); StatusStrip.SuspendLayout(); @@ -95,7 +97,7 @@ private void InitializeComponent() // // LandTilesContextMenuStrip // - LandTilesContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { showFreeSlotsToolStripMenuItem, findNextFreeSlotToolStripMenuItem, toolStripSeparator6, exportImageToolStripMenuItem, toolStripSeparator3, selectInTileDataTabToolStripMenuItem, selectInRadarColorTabToolStripMenuItem, selectInTexturesTabToolStripMenuItem, toolStripSeparator2, replaceToolStripMenuItem, replaceStartingFromToolStripMenuItem, insertAtToolStripMenuItem, removeToolStripMenuItem, toolStripSeparator1, saveToolStripMenuItem }); + LandTilesContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { showFreeSlotsToolStripMenuItem, findNextFreeSlotToolStripMenuItem, changeBackgroundColorToolStripMenuItem, toolStripSeparator6, exportImageToolStripMenuItem, toolStripSeparator3, selectInTileDataTabToolStripMenuItem, selectInRadarColorTabToolStripMenuItem, selectInTexturesTabToolStripMenuItem, toolStripSeparator2, replaceToolStripMenuItem, replaceStartingFromToolStripMenuItem, insertAtToolStripMenuItem, removeToolStripMenuItem, toolStripSeparator1, saveToolStripMenuItem }); LandTilesContextMenuStrip.Name = "contextMenuStrip1"; LandTilesContextMenuStrip.Size = new System.Drawing.Size(201, 270); LandTilesContextMenuStrip.Opening += LandTilesContextMenuStrip_Opening; @@ -114,7 +116,14 @@ private void InitializeComponent() findNextFreeSlotToolStripMenuItem.Size = new System.Drawing.Size(200, 22); findNextFreeSlotToolStripMenuItem.Text = "Find Next Free Slot"; findNextFreeSlotToolStripMenuItem.Click += OnClickFindFree; - // + // + // changeBackgroundColorToolStripMenuItem + // + changeBackgroundColorToolStripMenuItem.Name = "changeBackgroundColorToolStripMenuItem"; + changeBackgroundColorToolStripMenuItem.Size = new System.Drawing.Size(200, 22); + changeBackgroundColorToolStripMenuItem.Text = "Change background color"; + changeBackgroundColorToolStripMenuItem.Click += ChangeBackgroundColorToolStripMenuItem_Click; + // // toolStripSeparator6 // toolStripSeparator6.Name = "toolStripSeparator6"; @@ -483,5 +492,7 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripSeparator toolStripSeparator5; private System.Windows.Forms.Panel panel; private TileViewControl LandTilesTileView; + private System.Windows.Forms.ToolStripMenuItem changeBackgroundColorToolStripMenuItem; + private System.Windows.Forms.ColorDialog colorDialog; } } diff --git a/UoFiddler.Controls/UserControls/LandTilesControl.cs b/UoFiddler.Controls/UserControls/LandTilesControl.cs index 8ed6a411..9616c60d 100644 --- a/UoFiddler.Controls/UserControls/LandTilesControl.cs +++ b/UoFiddler.Controls/UserControls/LandTilesControl.cs @@ -170,6 +170,7 @@ private void OnLoad(object sender, EventArgs e) ControlEvents.FilePathChangeEvent += OnFilePathChangeEvent; ControlEvents.LandTileChangeEvent += OnLandTileChangeEvent; ControlEvents.TileDataChangeEvent += OnTileDataChangeEvent; + ControlEvents.PreviewBackgroundColorChangeEvent += OnPreviewBackgroundColorChanged; } IsLoaded = true; @@ -181,6 +182,12 @@ private void OnFilePathChangeEvent() Reload(); } + private void OnPreviewBackgroundColorChanged() + { + LandTilesTileView.BackColor = Options.PreviewBackgroundColor; + LandTilesTileView.Invalidate(); + } + private void UpdateToolStripLabels(int graphic) { if (!IsLoaded) @@ -659,6 +666,17 @@ private void ExportAllLandTiles(ImageFormat imageFormat) } } + private void ChangeBackgroundColorToolStripMenuItem_Click(object sender, EventArgs e) + { + if (colorDialog.ShowDialog() != DialogResult.OK) + { + return; + } + + Options.PreviewBackgroundColor = colorDialog.Color; + ControlEvents.FirePreviewBackgroundColorChangeEvent(); + } + private void LandTilesTileView_DrawItem(object sender, TileView.TileViewControl.DrawTileListItemEventArgs e) { if (IsAncestorSiteInDesignMode || FormsDesignerHelper.IsInDesignMode()) @@ -675,6 +693,12 @@ private void LandTilesTileView_DrawItem(object sender, TileView.TileViewControl. e.Graphics.Clip = new Region(itemRec); + var selected = LandTilesTileView.SelectedIndices.Contains(e.Index); + if (!selected) + { + e.Graphics.Clear(Options.PreviewBackgroundColor); + } + Bitmap bitmap = Art.GetLand(_tileList[e.Index], out bool patched); if (bitmap == null) @@ -824,6 +848,8 @@ public void UpdateTileView() ? Color.Transparent : Color.Gray; + LandTilesTileView.BackColor = Options.PreviewBackgroundColor; + var sameFocusColor = LandTilesTileView.TileFocusColor == Options.TileFocusColor; var sameSelectionColor = LandTilesTileView.TileHighlightColor == Options.TileSelectionColor; if (sameFocusColor && sameSelectionColor) diff --git a/UoFiddler.Controls/UserControls/MultisControl.cs b/UoFiddler.Controls/UserControls/MultisControl.cs index 875dafc1..fbe14c98 100644 --- a/UoFiddler.Controls/UserControls/MultisControl.cs +++ b/UoFiddler.Controls/UserControls/MultisControl.cs @@ -48,7 +48,6 @@ public MultisControl() private bool _loaded; private bool _showFreeSlots; private readonly MultisControl _refMarker; - private Color _backgroundImageColor = Color.White; private bool _useTransparencyForPng = true; /// @@ -138,6 +137,7 @@ private void OnLoad(object sender, EventArgs e) { ControlEvents.FilePathChangeEvent += OnFilePathChangeEvent; ControlEvents.MultiChangeEvent += OnMultiChangeEvent; + ControlEvents.PreviewBackgroundColorChangeEvent += OnPreviewBackgroundColorChanged; } _loaded = true; @@ -149,6 +149,11 @@ private void OnFilePathChangeEvent() Reload(); } + private void OnPreviewBackgroundColorChanged() + { + MultiPictureBox.BackColor = Options.PreviewBackgroundColor; + } + private void OnMultiChangeEvent(object sender, int id) { if (!_loaded) @@ -346,22 +351,22 @@ private void ChangeComponentList(MultiComponentList multi) private void Extract_Image_ClickBmp(object sender, EventArgs e) { - ExtractMultiImage(ImageFormat.Bmp, _backgroundImageColor); + ExtractMultiImage(ImageFormat.Bmp, Options.PreviewBackgroundColor); } private void Extract_Image_ClickTiff(object sender, EventArgs e) { - ExtractMultiImage(ImageFormat.Tiff, _backgroundImageColor); + ExtractMultiImage(ImageFormat.Tiff, Options.PreviewBackgroundColor); } private void Extract_Image_ClickJpg(object sender, EventArgs e) { - ExtractMultiImage(ImageFormat.Jpeg, _backgroundImageColor); + ExtractMultiImage(ImageFormat.Jpeg, Options.PreviewBackgroundColor); } private void Extract_Image_ClickPng(object sender, EventArgs e) { - ExtractMultiImage(ImageFormat.Png, _useTransparencyForPng ? Color.Transparent : _backgroundImageColor); + ExtractMultiImage(ImageFormat.Png, _useTransparencyForPng ? Color.Transparent : Options.PreviewBackgroundColor); } private void ExtractMultiImage(ImageFormat imageFormat, Color backgroundColor) @@ -593,22 +598,22 @@ private void OnClickImport(object sender, EventArgs e) private void OnClick_SaveAllBmp(object sender, EventArgs e) { - ExportAllMultis(ImageFormat.Bmp, _backgroundImageColor); + ExportAllMultis(ImageFormat.Bmp, Options.PreviewBackgroundColor); } private void OnClick_SaveAllTiff(object sender, EventArgs e) { - ExportAllMultis(ImageFormat.Tiff, _backgroundImageColor); + ExportAllMultis(ImageFormat.Tiff, Options.PreviewBackgroundColor); } private void OnClick_SaveAllJpg(object sender, EventArgs e) { - ExportAllMultis(ImageFormat.Jpeg, _backgroundImageColor); + ExportAllMultis(ImageFormat.Jpeg, Options.PreviewBackgroundColor); } private void OnClick_SaveAllPng(object sender, EventArgs e) { - ExportAllMultis(ImageFormat.Png, _useTransparencyForPng ? Color.Transparent : _backgroundImageColor); + ExportAllMultis(ImageFormat.Png, _useTransparencyForPng ? Color.Transparent : Options.PreviewBackgroundColor); } private void ExportAllMultis(ImageFormat imageFormat, Color backgroundColor) @@ -865,8 +870,8 @@ private void ChangeBackgroundColorToolStripMenuItem_Click(object sender, EventAr return; } - _backgroundImageColor = colorDialog.Color; - MultiPictureBox.BackColor = _backgroundImageColor; + Options.PreviewBackgroundColor = colorDialog.Color; + ControlEvents.FirePreviewBackgroundColorChangeEvent(); } private void UseTransparencyForPNGToolStripMenuItem_CheckedChanged(object sender, EventArgs e) diff --git a/UoFiddler.Controls/UserControls/MultisControl.resx b/UoFiddler.Controls/UserControls/MultisControl.resx index 32ae0158..49fba347 100644 --- a/UoFiddler.Controls/UserControls/MultisControl.resx +++ b/UoFiddler.Controls/UserControls/MultisControl.resx @@ -1,7 +1,7 @@