Skip to content

Commit

Permalink
Minor update
Browse files Browse the repository at this point in the history
  • Loading branch information
voltavidTony committed Apr 28, 2021
1 parent 245e85e commit f7129a9
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 108 deletions.
49 changes: 48 additions & 1 deletion ASCII/ASCII.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,27 @@
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.2.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
Expand All @@ -34,6 +49,25 @@
<PropertyGroup>
<ApplicationIcon>Icon.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup>
<StartupObject>ASCII.Program</StartupObject>
</PropertyGroup>
<PropertyGroup>
<NoWin32Manifest>true</NoWin32Manifest>
</PropertyGroup>
<PropertyGroup>
<DelaySign>false</DelaySign>
</PropertyGroup>
<PropertyGroup>
<SignManifests>false</SignManifests>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -60,11 +94,24 @@
</EmbeddedResource>
<Content Include="Cross.png" />
<Content Include="Icon.ico" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.6.1 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
5 changes: 3 additions & 2 deletions ASCII/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

82 changes: 27 additions & 55 deletions ASCII/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
}
Expand Down Expand Up @@ -80,29 +75,24 @@ 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();
}
base.WndProc(ref m);
}

public ASCIIWindow()
{
public ASCIIWindow() {
InitializeComponent();
RefreshCharPanel();
Height = charPanel.Items[16].Bounds.Y + 2;
Expand All @@ -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;
Expand All @@ -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();

Expand All @@ -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;
}
}
}
13 changes: 4 additions & 9 deletions ASCII/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions ASCII/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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("")]

Expand All @@ -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")]
30 changes: 0 additions & 30 deletions ASCII/Properties/Settings.Designer.cs

This file was deleted.

7 changes: 0 additions & 7 deletions ASCII/Properties/Settings.settings

This file was deleted.

0 comments on commit f7129a9

Please sign in to comment.