Skip to content

Commit

Permalink
Added alternative icon theme
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelEllnebrand committed Mar 12, 2023
1 parent 832b82a commit 874559a
Show file tree
Hide file tree
Showing 12 changed files with 153 additions and 70 deletions.
3 changes: 3 additions & 0 deletions App.config
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
<setting name="ClampedToScreen" serializeAs="String">
<value>True</value>
</setting>
<setting name="AltIcon" serializeAs="String">
<value>True</value>
</setting>
</WindowTool.Properties.Settings>
</userSettings>
</configuration>
Binary file removed NotificationAreaIcon.ico
Binary file not shown.
20 changes: 20 additions & 0 deletions Properties/Resources.Designer.cs

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

6 changes: 6 additions & 0 deletions Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="AltClampFalse" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AltClampFalse.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="AltClampTrue" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AltClampTrue.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ClampFalse" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ClampFalse.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
Expand Down
12 changes: 12 additions & 0 deletions Properties/Settings.Designer.cs

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

3 changes: 3 additions & 0 deletions Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
<Setting Name="ClampedToScreen" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="AltIcon" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
</Settings>
</SettingsFile>
Binary file added Resources/AltClampFalse.ico
Binary file not shown.
Binary file added Resources/AltClampTrue.ico
Binary file not shown.
Binary file added WindowTool 128x128.ico
Binary file not shown.
14 changes: 11 additions & 3 deletions WindowTool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<ApplicationIcon>WindowTool 128x128.ico</ApplicationIcon>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand All @@ -14,6 +15,10 @@
<DebugType>none</DebugType>
</PropertyGroup>

<ItemGroup>
<Content Include="WindowTool 128x128.ico" />
</ItemGroup>

<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
Expand All @@ -35,13 +40,16 @@
</ItemGroup>

<ItemGroup>
<None Update="NotificationAreaIcon.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<None Update="Resources\AltClampFalse.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\AltClampTrue.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\ClampFalse.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
133 changes: 69 additions & 64 deletions mainForm.Designer.cs

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

32 changes: 29 additions & 3 deletions mainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ public partial class MainForm : Form
public MainForm()
{
InitializeComponent();

hotkeyHandler = new HotkeyHandler();
hotkeyHandler.Start();

Application.ApplicationExit += Application_ApplicationExit;

iconMenuItem.Checked = Properties.Settings.Default.AltIcon;
bool isClamped = Properties.Settings.Default.ClampedToScreen;
handleSetClampToScreen(isClamped);

Expand Down Expand Up @@ -79,22 +80,47 @@ private void clampMenuItem_Click(object sender, EventArgs e)
{
handleSetClampToScreen(clampMenuItem.Checked);
}
private void iconMenuItem_Click(object sender, EventArgs e)
{
updateIcon();
}

private void handleSetClampToScreen(bool isClamped)
{
Properties.Settings.Default.ClampedToScreen = isClamped;
Properties.Settings.Default.Save();
clampMenuItem.Checked = isClamped;
hotkeyHandler.SetClampToScreen(isClamped);
updateIcon();

/*
if (isClamped)
{
notifyIcon.Icon = WindowTool.Properties.Resources.ClampTrue;
notifyIcon.Icon = iconMenuItem.Checked ? Properties.Resources.ClampTrue : Properties.Resources.AltClampTrue;
//notifyIcon.Icon = WindowTool.Properties.Resources.AltClampTrue;
}
else
{
notifyIcon.Icon = iconMenuItem.Checked ? Properties.Resources.ClampFalse : Properties.Resources.AltClampFalse;
//notifyIcon.Icon = WindowTool.Properties.Resources.AltClampFalse;
}
*/
}

private void updateIcon()
{
Properties.Settings.Default.AltIcon = iconMenuItem.Checked;
Properties.Settings.Default.Save();

if (clampMenuItem.Checked)
{
notifyIcon.Icon = iconMenuItem.Checked ? Properties.Resources.AltClampTrue : Properties.Resources.ClampTrue;
}
else
{
notifyIcon.Icon = WindowTool.Properties.Resources.ClampFalse;
notifyIcon.Icon = iconMenuItem.Checked ? Properties.Resources.AltClampFalse : Properties.Resources.ClampFalse;
}
}

}
}

0 comments on commit 874559a

Please sign in to comment.