From f7129a9bce45a22a8482f17f96e5de4e43e8edda Mon Sep 17 00:00:00 2001 From: voltavidTony Date: Wed, 28 Apr 2021 18:30:34 -0400 Subject: [PATCH] Minor update --- ASCII/ASCII.csproj | 49 +++++++++++++++- ASCII/Form1.Designer.cs | 5 +- ASCII/Form1.cs | 82 +++++++++------------------ ASCII/Program.cs | 13 ++--- ASCII/Properties/AssemblyInfo.cs | 8 +-- ASCII/Properties/Settings.Designer.cs | 30 ---------- ASCII/Properties/Settings.settings | 7 --- 7 files changed, 86 insertions(+), 108 deletions(-) delete mode 100644 ASCII/Properties/Settings.Designer.cs delete mode 100644 ASCII/Properties/Settings.settings diff --git a/ASCII/ASCII.csproj b/ASCII/ASCII.csproj index 137f306..b4dc279 100644 --- a/ASCII/ASCII.csproj +++ b/ASCII/ASCII.csproj @@ -11,12 +11,27 @@ v4.6.1 512 true + false + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.2.0.%2a + false + true AnyCPU true full - true + false bin\Debug\ DEBUG;TRACE prompt @@ -34,6 +49,25 @@ Icon.ico + + false + + + + + + + ASCII.Program + + + true + + + false + + + false + @@ -60,11 +94,24 @@ + True True Resources.resx + + + False + Microsoft .NET Framework 4.6.1 %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + \ No newline at end of file diff --git a/ASCII/Form1.Designer.cs b/ASCII/Form1.Designer.cs index f769166..fca5940 100644 --- a/ASCII/Form1.Designer.cs +++ b/ASCII/Form1.Designer.cs @@ -83,8 +83,8 @@ private void InitializeComponent() this.description.Padding = new System.Windows.Forms.Padding(4); this.description.Size = new System.Drawing.Size(176, 92); this.description.TabIndex = 5; - this.description.Text = "Created by voltavidTony\r\non March 6, 2018\r\nVersion 1.1\r\n\r\nWindows 1252\r\nDouble cl" + - "ick to insert"; + this.description.Text = "Created by voltavidTony\r\non April 28, 2021\r\nVersion 1.2\r\n\r\nWindows 1252\r\nDouble c" + + "lick to insert"; this.description.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.description.Paint += new System.Windows.Forms.PaintEventHandler(this.Border_Paint); // @@ -112,6 +112,7 @@ private void InitializeComponent() this.charPanel.Dock = System.Windows.Forms.DockStyle.Fill; this.charPanel.FullRowSelect = true; this.charPanel.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.charPanel.HideSelection = false; this.charPanel.LabelWrap = false; this.charPanel.Location = new System.Drawing.Point(1, 1); this.charPanel.Margin = new System.Windows.Forms.Padding(0); diff --git a/ASCII/Form1.cs b/ASCII/Form1.cs index 84dd3e5..46edf2f 100644 --- a/ASCII/Form1.cs +++ b/ASCII/Form1.cs @@ -22,14 +22,11 @@ You should have received a copy of the GNU General Public License using System.Runtime.InteropServices; using System.Windows.Forms; -namespace ASCII -{ - public partial class ASCIIWindow : Form - { +namespace ASCII { + public partial class ASCIIWindow : Form { [DllImport("dwmapi.dll", EntryPoint = "#127")] static extern void DwmGetColorizationParameters(out DWMCOLORIZATIONcolors colors); - public struct DWMCOLORIZATIONcolors - { + public struct DWMCOLORIZATIONcolors { public uint ColorizationColor, ColorizationAfterglow, ColorizationColorBalance, @@ -38,10 +35,8 @@ public struct DWMCOLORIZATIONcolors ColorizationGlassReflectionIntensity, ColorizationOpaqueBlend; } - Color AccentColor - { - get - { + Color AccentColor { + get { DwmGetColorizationParameters(out DWMCOLORIZATIONcolors colors); return Color.FromArgb((int)colors.ColorizationColor | ~0xFFFFFF); } @@ -80,20 +75,16 @@ Color AccentColor "Ö", "×", "Ø", "Ù", "Ú", "Û", "Ü", "Ý", "Þ", "ß", "à", "á", "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô", "õ", "ö", "÷", "ø", "ù", "ú", "û", "ü", "ý", "þ", "ÿ" }; - protected override CreateParams CreateParams - { - get - { + protected override CreateParams CreateParams { + get { CreateParams cp = base.CreateParams; cp.ExStyle |= 0x08000000; return cp; } } - protected override void WndProc(ref Message m) - { - if (m.Msg == 0x320) - { + protected override void WndProc(ref Message m) { + if (m.Msg == 0x320) { charPanelBorder.Invalidate(); tableOptions.Invalidate(); description.Invalidate(); @@ -101,8 +92,7 @@ protected override void WndProc(ref Message m) base.WndProc(ref m); } - public ASCIIWindow() - { + public ASCIIWindow() { InitializeComponent(); RefreshCharPanel(); Height = charPanel.Items[16].Bounds.Y + 2; @@ -111,8 +101,7 @@ public ASCIIWindow() private void CloseButton_Click(object sender, EventArgs e) => Application.Exit(); - private void PanelDrag_MouseDown(object sender, MouseEventArgs e) - { + private void PanelDrag_MouseDown(object sender, MouseEventArgs e) { ReleaseCapture(); SendMessage(Handle, 0xA1, 0x2, 0); int i = charPanel.TopItem.Index; @@ -121,66 +110,55 @@ private void PanelDrag_MouseDown(object sender, MouseEventArgs e) charPanel.TopItem = charPanel.Items[i]; } - private void Border_Paint(object sender, PaintEventArgs e) - { + private void Border_Paint(object sender, PaintEventArgs e) { if (sender is Control c) e.Graphics.DrawRectangle(new Pen(AccentColor, 1), new Rectangle(0, 0, c.Width - 1, c.Height - 1)); } - private void CharPanel_ColumnWidthChanging(object sender, ColumnWidthChangingEventArgs e) - { + private void CharPanel_ColumnWidthChanging(object sender, ColumnWidthChangingEventArgs e) { e.NewWidth = charPanel.Columns[e.ColumnIndex].Width; e.Cancel = true; } - private void CharPanel_DoubleClick(object sender, EventArgs e) - { + private void CharPanel_DoubleClick(object sender, EventArgs e) { string letter = names[int.Parse(charPanel.SelectedItems[0].SubItems[1].Text)]; - if (letter.Equals("Space")) - { + if (letter.Equals("Space")) { SendKeys.Send(" "); return; } - if (letter.Equals("NBSP")) - { + if (letter.Equals("NBSP")) { SendKeys.Send(" "); return; } - if (letter.Length > 1) - { + if (letter.Length > 1) { System.Media.SystemSounds.Asterisk.Play(); return; } SendKeys.Send("%()+[]^{}~".Contains($"{letter}") ? $"{{{letter}}}" : $"{letter}"); } - private void CheckBox_CheckStateChanged(object sender, EventArgs e) - { + private void CheckBox_CheckStateChanged(object sender, EventArgs e) { if (!sender.Equals(checkBox3)) RefreshCharPanel(); else if (!changing) trackOpaque.Value = checkBox3.Checked ? 70 : 100; } - private void TrackOpaque_ValueChanged(object sender, EventArgs e) - { + private void TrackOpaque_ValueChanged(object sender, EventArgs e) { changing = true; labelOpaque.Text = $"{trackOpaque.Value} %"; checkBox3.Checked = (Opacity = trackOpaque.Value / 100.0) != 1.0; changing = false; } - private void CloseButton_MouseEnter(object sender, EventArgs e) - { + private void CloseButton_MouseEnter(object sender, EventArgs e) { PenColor = Color.White; PenWidth = 0.3f; } - private void CloseButton_MouseLeave(object sender, EventArgs e) - { + private void CloseButton_MouseLeave(object sender, EventArgs e) { PenColor = Color.Black; PenWidth = 0.2f; } - private void CloseButton_Paint(object sender, PaintEventArgs e) - { + private void CloseButton_Paint(object sender, PaintEventArgs e) { Rectangle bounds = new Rectangle(closeButton.Width / 2 - 5, closeButton.Height / 2 - 5, 9, 9); GraphicsPath closeX = new GraphicsPath(); @@ -196,21 +174,15 @@ private void CloseButton_Paint(object sender, PaintEventArgs e) e.Graphics.DrawPath(new Pen(PenColor, 1), closeX); } - private void RefreshCharPanel() - { + private void RefreshCharPanel() { charPanel.Items.Clear(); - for (int i = 0; i < 256; i++) - { + for (int i = 0; i < 256; i++) { int id = checkBox2.Checked ? lexicoid[i] : i; if (!checkBox1.Checked && names[id].Length > 1 && id != 32 && id != 160) continue; - charPanel.Items.Add(new ListViewItem(new string[] { $"{id:X2}", $"{id}", names[id] }) { ForeColor = GetColor(id) }); + charPanel.Items.Add(new ListViewItem(new string[] { $"{id:X2}", $"{id}", names[id] }) { + ForeColor = names[id].Length == 1 || id == 32 || id == 160 ? Color.Black : Color.Crimson + }); } } - - private Color GetColor(int id) - { - if (names[id].Length == 0 || id == 32 || id == 160) return Color.Black; - return Color.Crimson; - } } } diff --git a/ASCII/Program.cs b/ASCII/Program.cs index c56a675..c2cb639 100644 --- a/ASCII/Program.cs +++ b/ASCII/Program.cs @@ -19,16 +19,11 @@ You should have received a copy of the GNU General Public License using System.Threading; using System.Windows.Forms; -namespace ASCII -{ - static class Program - { - private static Mutex mutex = null; - +namespace ASCII { + static class Program { [System.STAThread] - static void Main() - { - mutex = new Mutex(true, "AE0C75E0-47CE-4112-8FEA-E9DED9C748C0", out bool created); + static void Main() { + new Mutex(true, "AE0C75E0-47CE-4112-8FEA-E9DED9C748C0", out bool created); if (!created) return; Application.EnableVisualStyles(); diff --git a/ASCII/Properties/AssemblyInfo.cs b/ASCII/Properties/AssemblyInfo.cs index 103a17c..c558130 100644 --- a/ASCII/Properties/AssemblyInfo.cs +++ b/ASCII/Properties/AssemblyInfo.cs @@ -8,8 +8,8 @@ [assembly: AssemblyDescription("Character panel for Windows 1252 that allows you to insert into selected text")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ASCII")] -[assembly: AssemblyCopyright("Copyright © voltavidTony 2018")] +[assembly: AssemblyProduct("Windows 1252 Character Panel")] +[assembly: AssemblyCopyright("Copyright © voltavidTony 2021")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.2.*")] +[assembly: AssemblyFileVersion("1.2.0.0")] diff --git a/ASCII/Properties/Settings.Designer.cs b/ASCII/Properties/Settings.Designer.cs deleted file mode 100644 index 780ac98..0000000 --- a/ASCII/Properties/Settings.Designer.cs +++ /dev/null @@ -1,30 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace ASCII.Properties -{ - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { - return defaultInstance; - } - } - } -} diff --git a/ASCII/Properties/Settings.settings b/ASCII/Properties/Settings.settings deleted file mode 100644 index 3964565..0000000 --- a/ASCII/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - -