mirror of
https://github.com/claunia/libexeinfo.git
synced 2025-12-16 19:14:24 +00:00
Add full support for Gem color icons.
This commit is contained in:
88
exeinfogui/GEM/PanelGemColorIcon.xeto.cs
Normal file
88
exeinfogui/GEM/PanelGemColorIcon.xeto.cs
Normal file
@@ -0,0 +1,88 @@
|
||||
using System;
|
||||
using Eto.Forms;
|
||||
using Eto.Serialization.Xaml;
|
||||
|
||||
namespace exeinfogui.GEM
|
||||
{
|
||||
public class PanelGemColorIcon : Panel
|
||||
{
|
||||
int iconHeight;
|
||||
|
||||
int iconWidth;
|
||||
ImageView imgColorIcon;
|
||||
ImageView imgIcon;
|
||||
ImageView imgSelectedIcon;
|
||||
GridView treePlanes;
|
||||
TextBox txtBgColor;
|
||||
TextBox txtCharater;
|
||||
TextBox txtCharCoordinates;
|
||||
TextBox txtCoordinates;
|
||||
TextBox txtFgColor;
|
||||
TextBox txtFlags;
|
||||
TextBox txtSize;
|
||||
TextBox txtState;
|
||||
TextBox txtText;
|
||||
TextBox txtTextBoxSize;
|
||||
TextBox txtTextCoordinates;
|
||||
|
||||
public PanelGemColorIcon()
|
||||
{
|
||||
XamlReader.Load(this);
|
||||
|
||||
treePlanes.Columns.Add(new GridColumn
|
||||
{
|
||||
DataCell = new TextBoxCell
|
||||
{
|
||||
Binding = Binding.Property<libexeinfo.GEM.ColorIconPlane, string>(i => $"{i.Planes}")
|
||||
},
|
||||
HeaderText = "Planes"
|
||||
});
|
||||
treePlanes.AllowMultipleSelection = false;
|
||||
treePlanes.SelectedItemsChanged += TreePlanesOnSelectedItemsChanged;
|
||||
}
|
||||
|
||||
void TreePlanesOnSelectedItemsChanged(object sender, EventArgs eventArgs)
|
||||
{
|
||||
if(!(treePlanes.SelectedItem is libexeinfo.GEM.ColorIconPlane cicon))
|
||||
{
|
||||
imgColorIcon.Image = null;
|
||||
imgSelectedIcon.Image = null;
|
||||
return;
|
||||
}
|
||||
|
||||
imgColorIcon.Image = GemColorIcon.GemColorIconToEto(cicon, iconWidth, iconHeight, false);
|
||||
imgSelectedIcon.Image = GemColorIcon.GemColorIconToEto(cicon, iconWidth, iconHeight, true);
|
||||
}
|
||||
|
||||
public void Update(libexeinfo.GEM.TreeObjectNode node, libexeinfo.GEM.ColorIcon colorIcon)
|
||||
{
|
||||
txtFlags.Text = node.flags == 0 ? "None" : node.flags.ToString();
|
||||
txtState.Text = node.state == 0 ? "Normal" : node.state.ToString();
|
||||
txtCoordinates.Text = $"{colorIcon.Monochrome.X},{colorIcon.Monochrome.Y}";
|
||||
txtSize.Text = $"{colorIcon.Monochrome.Width}x{colorIcon.Monochrome.Height} pixels";
|
||||
txtCharater.Text = $"{colorIcon.Monochrome.Character}";
|
||||
txtCharCoordinates.Text = $"{colorIcon.Monochrome.CharX},{colorIcon.Monochrome.CharY}";
|
||||
txtFgColor.Text = $"{colorIcon.Monochrome.ForegroundColor}";
|
||||
txtBgColor.Text = $"{colorIcon.Monochrome.BackgroundColor}";
|
||||
txtTextCoordinates.Text = $"{colorIcon.Monochrome.TextX},{colorIcon.Monochrome.TextY}";
|
||||
txtTextBoxSize.Text = $"{colorIcon.Monochrome.TextWidth}x{colorIcon.Monochrome.TextHeight} pixels";
|
||||
txtText.Text = colorIcon.Monochrome.Text;
|
||||
imgIcon.Image = GemIcon.GemIconToEto(colorIcon.Monochrome);
|
||||
treePlanes.DataStore = colorIcon.Color;
|
||||
iconWidth = colorIcon.Monochrome.Width;
|
||||
iconHeight = colorIcon.Monochrome.Height;
|
||||
treePlanes.SelectRow(0);
|
||||
if(colorIcon.Color != null && colorIcon.Color.Length >= 1 && colorIcon.Color[0] != null)
|
||||
{
|
||||
imgColorIcon.Image =
|
||||
GemColorIcon.GemColorIconToEto(colorIcon.Color[0], iconWidth, iconHeight, false);
|
||||
imgSelectedIcon.Image = GemColorIcon.GemColorIconToEto(colorIcon.Color[0], iconWidth, iconHeight, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
imgColorIcon.Image = null;
|
||||
imgSelectedIcon.Image = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user