diff --git a/FreshTools/Properties/AssemblyInfo.cs b/FreshTools/Properties/AssemblyInfo.cs
index 82969ff..ae93157 100644
--- a/FreshTools/Properties/AssemblyInfo.cs
+++ b/FreshTools/Properties/AssemblyInfo.cs
@@ -32,5 +32,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("0.7.3.0")]
-[assembly: AssemblyFileVersion("0.7.3.0")]
+[assembly: AssemblyVersion("0.7.4.0")]
+[assembly: AssemblyFileVersion("0.7.4.0")]
diff --git a/FreshTools/code/FreshTools.cs b/FreshTools/code/FreshTools.cs
index e9ec377..5d68d33 100644
--- a/FreshTools/code/FreshTools.cs
+++ b/FreshTools/code/FreshTools.cs
@@ -130,8 +130,9 @@ static void Main(string[] args)
public void LoadConfig()
{
settingsFile = new VariablesFile(configFilePath, null, false);
+ UpdateConfigFile();
VariableLibrary vars = settingsFile.variables;
-
+
//load variables
WindowManager.LoadSnapSizes(settingsFile);
WindowManager.LoadHotKeys(settingsFile);
@@ -149,6 +150,18 @@ public void LoadConfig()
SaveConfig();
}
+ public void UpdateConfigFile()
+ {
+ //attempt to fix script file
+ //rename old variables to match
+ settingsFile = new VariablesFile(configFilePath, null, false);
+ settingsFile.RenameVariable("HotKey_DecreaseWindowTranspancy", "HotKey_DecreaseWindowTransparency");
+ settingsFile.RenameVariable("HotKey_IncreaseWindowTranspancy", "HotKey_IncreaseWindowTransparency");
+
+ //remove dead variables
+
+ }
+
///
/// Make sure config variables that can be changed are updated in config file
///
diff --git a/FreshTools/code/Scripting/VariableLibrary.cs b/FreshTools/code/Scripting/VariableLibrary.cs
index f82a76c..8bf091a 100644
--- a/FreshTools/code/Scripting/VariableLibrary.cs
+++ b/FreshTools/code/Scripting/VariableLibrary.cs
@@ -12,9 +12,11 @@ public class VariableLibrary : IEnumerable
private VariablesComparator variablesComparator;
private bool variableListSorted = true;
private Variable searchDummy;
+ public readonly bool CaseSensitive;
public VariableLibrary(bool caseSensitive)
{
+ this.CaseSensitive = caseSensitive;
variablesComparator = new VariablesComparator(caseSensitive);
variables = new List();
}
diff --git a/FreshTools/code/Scripting/VariablesFile.cs b/FreshTools/code/Scripting/VariablesFile.cs
index 5ec43a8..6345c1f 100644
--- a/FreshTools/code/Scripting/VariablesFile.cs
+++ b/FreshTools/code/Scripting/VariablesFile.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.IO;
namespace FreshTools
@@ -66,9 +67,46 @@ public void LoadFile(string fileName)
streamReader.Close();
}
Profiler.Stop();
- }
+ }
+ public void RenameVariable(string oldName, string newName)
+ {
+ for (int i = 0; i < lines.Count; i++)
+ {
+ try
+ {
+ string varName = lines[i].Content;
+ if (varName == null || varName.Trim().Length == 0 || varName.Substring(0, 2) == "//")
+ continue;
+ varName = varName.Replace("var ", "").Trim();
+ varName = varName.Substring(0, varName.IndexOf("=")).Trim();
+ StringComparison sc = StringComparison.CurrentCulture;
+ if (variables.CaseSensitive)
+ sc = StringComparison.CurrentCultureIgnoreCase;
+
+ if (varName.Equals(oldName, sc))
+ {
+ variables.RemoveVariable(oldName);
+
+ if (newName != null)
+ {
+ //TODO not sure this should properly recursively scan through other script files.
+ lines[i] = new ScriptLine("var " + newName + " = " + lines[i].Content.Substring(lines[i].Content.IndexOf("=")+1), this, parent);
+ variables.Add(lines[i].Variable);
+ }
+ else//remove variable
+ lines.RemoveAt(i--);
+ break;
+ }
+ }
+ catch (ArgumentOutOfRangeException) { }
+ }
+ }
+ public void RemoveVariable(string name)
+ {
+ RenameVariable(name, null);
+ }
//preserve comments and such by preserving all original text... not done
public string SaveString()
diff --git a/FreshTools/code/Systems/MouseListener.cs b/FreshTools/code/Systems/MouseListener.cs
index 50fc6b6..4c87df4 100644
--- a/FreshTools/code/Systems/MouseListener.cs
+++ b/FreshTools/code/Systems/MouseListener.cs
@@ -209,7 +209,8 @@ private static void ConsumeKeyAsync()
Thread.Sleep(3);
}
var item = queue.Dequeue();
- if (item is bool) break;
+ if (item is bool)
+ break;
if(item!=null)
MListener_MouseEvent(item as RawMouseEventArgs);
diff --git a/FreshTools/code/Systems/WindowManager.cs b/FreshTools/code/Systems/WindowManager.cs
index 252b053..e75fc12 100644
--- a/FreshTools/code/Systems/WindowManager.cs
+++ b/FreshTools/code/Systems/WindowManager.cs
@@ -53,8 +53,8 @@ public static class WindowManager
//alpha control variables
private static IntPtr lastWindowAlphaHandle = IntPtr.Zero;
private static byte lastWindowAlpha = 0;
- private const byte WindowAlphaIncrement = 32;
- private const byte MinWindowAlpha = 32;
+ private const byte WindowAlphaIncrement = 16;
+ private const byte MinWindowAlpha = 16;
#region Setup and teardown
static WindowManager()
@@ -254,7 +254,6 @@ public static void LoadHotKeys(VariablesFile settingsFile)
if (HotKey.TryParseHotKey(settingsFile.variables.GetVariable("HotKey_RestoreLayout3", "|^!D3").String, out hk))
snapHotKeys.Add(new HotKey(hk.Modifiers, hk.Key, RestoreLayout3));
//corner move hotkeys - with defaults
- //if (HotKey.TryParseHotKey(settingsFile.variables.GetVariable("HotKey_MoveActiveWindowToBottomLeft", "|^+G").String, out hk))
if (HotKey.TryParseHotKey(settingsFile.variables.GetVariable("HotKey_MoveActiveWindowToBottomLeft", "|^!End").String, out hk))
snapHotKeys.Add(new HotKey(hk.Modifiers, hk.Key, MoveActiveWindowToBottomLeft));
if (HotKey.TryParseHotKey(settingsFile.variables.GetVariable("HotKey_MoveActiveWindowToBottomRight", "|^!PageDown").String, out hk))
@@ -263,8 +262,8 @@ public static void LoadHotKeys(VariablesFile settingsFile)
snapHotKeys.Add(new HotKey(hk.Modifiers, hk.Key, MoveActiveWindowToTopLeft));
if (HotKey.TryParseHotKey(settingsFile.variables.GetVariable("HotKey_MoveActiveWindowToTopRight", "|^!PageUp").String, out hk))
snapHotKeys.Add(new HotKey(hk.Modifiers, hk.Key, MoveActiveWindowToTopRight));
- //if (HotKey.TryParseHotKey(settingsFile.variables.GetVariable("HotKey_MoveActiveWindowToCenter", "|^!+NumPad5").String, out hk)) //broken because of shift numpad
- // snapHotKeys.Add(new HotKey(hk.Modifiers, hk.Key, MoveActiveWindowToTopRight));
+ if (HotKey.TryParseHotKey(settingsFile.variables.GetVariable("HotKey_MoveActiveWindowToCenter", "|^!Multiply").String, out hk))
+ snapHotKeys.Add(new HotKey(hk.Modifiers, hk.Key, MoveActiveWindowToCenter));
//altsnap hotkeys - with defaults
if (HotKey.TryParseHotKey(settingsFile.variables.GetVariable("HotKey_Alt_SnapActiveWindowToBottomLeft", "|^!Oemcomma").String, out hk))
@@ -291,10 +290,10 @@ public static void LoadHotKeys(VariablesFile settingsFile)
miscHotKeys.Add(new HotKey(hk.Modifiers, hk.Key, MoveActiveWindowToLeftScreen));
if (HotKey.TryParseHotKey(settingsFile.variables.GetVariable("HotKey_MoveActiveWindowToRightScreen", "|^+S").String, out hk))
miscHotKeys.Add(new HotKey(hk.Modifiers, hk.Key, MoveActiveWindowToRightScreen));
- if (HotKey.TryParseHotKey(settingsFile.variables.GetVariable("HotKey_IncreaseWindowTranspancy", "^!Add").String, out hk))
- miscHotKeys.Add(new HotKey(hk.Modifiers, hk.Key, IncreaseWindowTranspancy));
- if (HotKey.TryParseHotKey(settingsFile.variables.GetVariable("HotKey_DecreaseWindowTranspancy", "^!Subtract").String, out hk))
- miscHotKeys.Add(new HotKey(hk.Modifiers, hk.Key, DecreaseWindowTranspancy));
+ if (HotKey.TryParseHotKey(settingsFile.variables.GetVariable("HotKey_IncreaseWindowTransparency", "^!Add").String, out hk))
+ miscHotKeys.Add(new HotKey(hk.Modifiers, hk.Key, IncreaseWindowTransparency));
+ if (HotKey.TryParseHotKey(settingsFile.variables.GetVariable("HotKey_DecreaseWindowTransparency", "^!Subtract").String, out hk))
+ miscHotKeys.Add(new HotKey(hk.Modifiers, hk.Key, DecreaseWindowTransparency));
if (HotKey.TryParseHotKey(settingsFile.variables.GetVariable("HotKey_SendActiveWindowToBack", "|^!W").String, out hk))
miscHotKeys.Add(new HotKey(hk.Modifiers, hk.Key, SendActiveWindowToBack));
@@ -595,7 +594,7 @@ private static void MoveActiveWindowTo(int x, int y, int newWidth, int newHeight
}
}
- private static void SetWindowTransparancy(int d)
+ private static void SetWindowTransparency(int d)
{
byte a;
IntPtr handle = GetForegroundWindow();
@@ -623,7 +622,7 @@ private static void SetWindowTransparancy(int d)
//Enable extended layered style on window if not enabled
SetWindowLong(handle, GWL_EXSTYLE, GetWindowLong(handle, GWL_EXSTYLE) | WS_EX_LAYERED);
- //set window transparency
+ //set window Transparency
SetLayeredWindowAttributes(handle, 0, a, LWA_ALPHA);
lastWindowAlpha = a;
@@ -729,7 +728,7 @@ private static void SnapActiveWindow(SnapDirection dir)
}
- private static void MoveActiveWindowToCorner(SnapDirection dir)
+ private static void MoveActiveWindowTo(SnapDirection dir)
{
//keep window size and move to a given corner or center
if (!(dir == SnapDirection.TopLeft || dir == SnapDirection.TopRight || dir == SnapDirection.BottomLeft || dir == SnapDirection.BottomRight || dir == SnapDirection.Center))
@@ -807,30 +806,30 @@ public static void SnapActiveWindowToBottomRight(object o, HotKeyEventArgs args)
}
#endregion
- #region Move active window to all 4 corners
+ #region Move active window to all 4 corners & center
public static void MoveActiveWindowToTopLeft(object o, HotKeyEventArgs args)
{
- MoveActiveWindowToCorner(SnapDirection.TopLeft);
+ MoveActiveWindowTo(SnapDirection.TopLeft);
}
public static void MoveActiveWindowToTopRight(object o, HotKeyEventArgs args)
{
- MoveActiveWindowToCorner(SnapDirection.TopRight);
+ MoveActiveWindowTo(SnapDirection.TopRight);
}
public static void MoveActiveWindowToBottomLeft(object o, HotKeyEventArgs args)
{
- MoveActiveWindowToCorner(SnapDirection.BottomLeft);
+ MoveActiveWindowTo(SnapDirection.BottomLeft);
}
public static void MoveActiveWindowToBottomRight(object o, HotKeyEventArgs args)
{
- MoveActiveWindowToCorner(SnapDirection.BottomRight);
+ MoveActiveWindowTo(SnapDirection.BottomRight);
}
public static void MoveActiveWindowToCenter(object o, HotKeyEventArgs args)
{
- MoveActiveWindowToCorner(SnapDirection.Center);
+ MoveActiveWindowTo(SnapDirection.Center);
}
#endregion
@@ -839,14 +838,14 @@ public static void SendActiveWindowToBack(object sender = null, HotKeyEventArgs
SendActiveWindowToBack();
}
- public static void IncreaseWindowTranspancy(object sender = null, HotKeyEventArgs e = null)
+ public static void IncreaseWindowTransparency(object sender = null, HotKeyEventArgs e = null)
{
- SetWindowTransparancy(1);
+ SetWindowTransparency(1);
}
- public static void DecreaseWindowTranspancy(object sender = null, HotKeyEventArgs e = null)
+ public static void DecreaseWindowTransparency(object sender = null, HotKeyEventArgs e = null)
{
- SetWindowTransparancy(-1);
+ SetWindowTransparency(-1);
}
public static void SaveLayout1(object sender = null, HotKeyEventArgs e = null)
diff --git a/readme.md b/readme.md
index e1c2743..ae0f7eb 100644
--- a/readme.md
+++ b/readme.md
@@ -1,6 +1,6 @@
## Fresh Tools
### Description
-v.0.7.3
+v.0.7.4
This is a collection of tools and code archives for doing usefull stuff that can be controlled via notification icon.
@@ -40,6 +40,7 @@ Snap | CTRL ALT Home | Move window to top left corner
Snap | CTRL ALT PageUp | Move window to top right corner
Snap | CTRL ALT End | Move window to bottom left corner
Snap | CTRL ALT PageDown | Move window to bottom right corner
+Snap | CTRL ALT Multiply | Move window to Center
Snap Alt | CTRL ALT comma | Snap window to bottom left corner
Snap Alt | CTRL ALT period | Snap window to bottom
Snap Alt | CTRL ALT slash | Snap window to bottom right corner