Initial Code Cleanup - 1st phase completed
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>EveOMock</RootNamespace>
|
<RootNamespace>EveOMock</RootNamespace>
|
||||||
<AssemblyName>exefile</AssemblyName>
|
<AssemblyName>ExeFile</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
@@ -51,8 +51,10 @@ namespace EveOPreview
|
|||||||
|
|
||||||
public const int WM_NCLBUTTONDOWN = 0xA1;
|
public const int WM_NCLBUTTONDOWN = 0xA1;
|
||||||
public const int HTCAPTION = 0x2;
|
public const int HTCAPTION = 0x2;
|
||||||
|
|
||||||
[DllImport("User32.dll")]
|
[DllImport("User32.dll")]
|
||||||
public static extern bool ReleaseCapture();
|
public static extern bool ReleaseCapture();
|
||||||
|
|
||||||
[DllImport("User32.dll")]
|
[DllImport("User32.dll")]
|
||||||
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
|
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
|
||||||
|
|
||||||
|
@@ -5,17 +5,17 @@ namespace EveOPreview
|
|||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
struct RECT
|
struct RECT
|
||||||
{
|
{
|
||||||
public int left;
|
public int Left;
|
||||||
public int top;
|
public int Top;
|
||||||
public int right;
|
public int Right;
|
||||||
public int bottom;
|
public int Bottom;
|
||||||
|
|
||||||
public RECT(int left, int top, int right, int bottom)
|
public RECT(int left, int top, int right, int bottom)
|
||||||
{
|
{
|
||||||
this.left = left;
|
this.Left = left;
|
||||||
this.top = top;
|
this.Top = top;
|
||||||
this.right = right;
|
this.Right = right;
|
||||||
this.bottom = bottom;
|
this.Bottom = bottom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -82,6 +82,13 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<NoWin32Manifest>true</NoWin32Manifest>
|
<NoWin32Manifest>true</NoWin32Manifest>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<SignAssembly>false</SignAssembly>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<AssemblyOriginatorKeyFile>
|
||||||
|
</AssemblyOriginatorKeyFile>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="PresentationCore" />
|
<Reference Include="PresentationCore" />
|
||||||
<Reference Include="PresentationFramework" />
|
<Reference Include="PresentationFramework" />
|
||||||
@@ -100,6 +107,9 @@
|
|||||||
<Compile Include="DwmAPI\DWM_THUMBNAIL_PROPERTIES.cs" />
|
<Compile Include="DwmAPI\DWM_THUMBNAIL_PROPERTIES.cs" />
|
||||||
<Compile Include="DwmAPI\MARGINS.cs" />
|
<Compile Include="DwmAPI\MARGINS.cs" />
|
||||||
<Compile Include="DwmAPI\RECT.cs" />
|
<Compile Include="DwmAPI\RECT.cs" />
|
||||||
|
<Compile Include="GUI\ClientLocation.cs" />
|
||||||
|
<Compile Include="GUI\GuiNativeMethods.cs" />
|
||||||
|
<Compile Include="GUI\ZoomAnchor.cs" />
|
||||||
<Compile Include="Hotkeys\Hotkey.cs" />
|
<Compile Include="Hotkeys\Hotkey.cs" />
|
||||||
<Compile Include="Hotkeys\HotkeyNativeMethods.cs" />
|
<Compile Include="Hotkeys\HotkeyNativeMethods.cs" />
|
||||||
<Compile Include="GUI\MainForm.cs">
|
<Compile Include="GUI\MainForm.cs">
|
||||||
@@ -140,7 +150,6 @@
|
|||||||
<None Include="app.config">
|
<None Include="app.config">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</None>
|
</None>
|
||||||
<None Include="preview toy_TemporaryKey.pfx" />
|
|
||||||
<None Include="Properties\DataSources\PreviewToyMain.datasource" />
|
<None Include="Properties\DataSources\PreviewToyMain.datasource" />
|
||||||
<None Include="Properties\Settings.settings">
|
<None Include="Properties\Settings.settings">
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
10
Eve-O-Preview/GUI/ClientLocation.cs
Normal file
10
Eve-O-Preview/GUI/ClientLocation.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
namespace EveOPreview
|
||||||
|
{
|
||||||
|
public struct ClientLocation
|
||||||
|
{
|
||||||
|
public int X;
|
||||||
|
public int Y;
|
||||||
|
public int Width;
|
||||||
|
public int Height;
|
||||||
|
}
|
||||||
|
}
|
22
Eve-O-Preview/GUI/GuiNativeMethods.cs
Normal file
22
Eve-O-Preview/GUI/GuiNativeMethods.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace EveOPreview
|
||||||
|
{
|
||||||
|
// TODO This is a really bad name for this class
|
||||||
|
static class GuiNativeMethods
|
||||||
|
{
|
||||||
|
public const int WM_SIZE = 5;
|
||||||
|
public const int SIZE_RESTORED = 0;
|
||||||
|
public const int SIZE_MINIMIZED = 1;
|
||||||
|
public const int SIZE_MAXIMIZED = 2;
|
||||||
|
public const int SIZE_MAXSHOW = 3;
|
||||||
|
public const int SIZE_MAXHIDE = 4;
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
public static extern int GetWindowRect(IntPtr hwnd, out RECT rect);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
public static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
|
||||||
|
}
|
||||||
|
}
|
@@ -2,8 +2,8 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@@ -12,13 +12,6 @@ namespace EveOPreview
|
|||||||
{
|
{
|
||||||
public partial class MainForm : Form
|
public partial class MainForm : Form
|
||||||
{
|
{
|
||||||
private const int WM_SIZE = 5;
|
|
||||||
private const int SIZE_RESTORED = 0;
|
|
||||||
private const int SIZE_MINIMIZED = 1;
|
|
||||||
private const int SIZE_MAXIMIZED = 2;
|
|
||||||
private const int SIZE_MAXSHOW = 3;
|
|
||||||
private const int SIZE_MAXHIDE = 4;
|
|
||||||
|
|
||||||
public event EventHandler Minimized;
|
public event EventHandler Minimized;
|
||||||
public event EventHandler Maximized;
|
public event EventHandler Maximized;
|
||||||
public event EventHandler Restored;
|
public event EventHandler Restored;
|
||||||
@@ -28,92 +21,57 @@ namespace EveOPreview
|
|||||||
private DispatcherTimer _dispatcherTimer;
|
private DispatcherTimer _dispatcherTimer;
|
||||||
|
|
||||||
private IntPtr _activeClientHandle;
|
private IntPtr _activeClientHandle;
|
||||||
private String _activeClientTitle;
|
private string _activeClientTitle;
|
||||||
|
|
||||||
private Dictionary<String, Dictionary<String, Point>> unique_layouts;
|
private readonly Dictionary<string, Dictionary<string, Point>> _uniqueLayouts;
|
||||||
private Dictionary<String, Point> flat_layout;
|
private readonly Dictionary<string, Point> _flatLayout;
|
||||||
private Dictionary<String, String> flat_layout_shortcuts;
|
private readonly Dictionary<string, string> _flatLayoutShortcuts;
|
||||||
private Dictionary<String, ClientLocation> client_layout;
|
private readonly Dictionary<string, ClientLocation> _clientLayout;
|
||||||
|
|
||||||
private bool is_initialized;
|
private readonly bool _isInitialized;
|
||||||
|
|
||||||
private Stopwatch ignoring_size_sync;
|
private readonly Stopwatch _ignoringSizeSync;
|
||||||
|
|
||||||
Dictionary<string, string> xml_bad_to_ok_chars;
|
private readonly Dictionary<string, string> _xmlBadToOkChars;
|
||||||
|
|
||||||
[DllImport("user32.dll")]
|
private Dictionary<ZoomAnchor, RadioButton> _zoomAnchorButtonMap;
|
||||||
private static extern int GetWindowRect(IntPtr hwnd, out Rect rect);
|
|
||||||
|
|
||||||
[DllImport("user32.dll")]
|
|
||||||
public static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
|
|
||||||
|
|
||||||
private struct Rect
|
|
||||||
{
|
|
||||||
public int Left;
|
|
||||||
public int Top;
|
|
||||||
public int Right;
|
|
||||||
public int Bottom;
|
|
||||||
}
|
|
||||||
|
|
||||||
private struct ClientLocation
|
|
||||||
{
|
|
||||||
public int X;
|
|
||||||
public int Y;
|
|
||||||
public int Width;
|
|
||||||
public int Height;
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum zoom_anchor_t
|
|
||||||
{
|
|
||||||
NW = 0,
|
|
||||||
N,
|
|
||||||
NE,
|
|
||||||
W,
|
|
||||||
C,
|
|
||||||
E,
|
|
||||||
SW,
|
|
||||||
S,
|
|
||||||
SE
|
|
||||||
};
|
|
||||||
|
|
||||||
private Dictionary<zoom_anchor_t, RadioButton> zoom_anchor_button_map;
|
|
||||||
|
|
||||||
public MainForm()
|
public MainForm()
|
||||||
{
|
{
|
||||||
is_initialized = false;
|
_isInitialized = false;
|
||||||
|
|
||||||
this._activeClientHandle = (IntPtr)0;
|
this._activeClientHandle = (IntPtr)0;
|
||||||
this._activeClientTitle = "";
|
this._activeClientTitle = "";
|
||||||
|
|
||||||
_previews = new Dictionary<IntPtr, Preview>();
|
_previews = new Dictionary<IntPtr, Preview>();
|
||||||
|
|
||||||
xml_bad_to_ok_chars = new Dictionary<string, string>();
|
_xmlBadToOkChars = new Dictionary<string, string>();
|
||||||
xml_bad_to_ok_chars["<"] = "---lt---";
|
_xmlBadToOkChars["<"] = "---lt---";
|
||||||
xml_bad_to_ok_chars["&"] = "---amp---";
|
_xmlBadToOkChars["&"] = "---amp---";
|
||||||
xml_bad_to_ok_chars[">"] = "---gt---";
|
_xmlBadToOkChars[">"] = "---gt---";
|
||||||
xml_bad_to_ok_chars["\""] = "---quot---";
|
_xmlBadToOkChars["\""] = "---quot---";
|
||||||
xml_bad_to_ok_chars["\'"] = "---apos---";
|
_xmlBadToOkChars["\'"] = "---apos---";
|
||||||
xml_bad_to_ok_chars[","] = "---comma---";
|
_xmlBadToOkChars[","] = "---comma---";
|
||||||
xml_bad_to_ok_chars["."] = "---dot---";
|
_xmlBadToOkChars["."] = "---dot---";
|
||||||
|
|
||||||
unique_layouts = new Dictionary<String, Dictionary<String, Point>>();
|
_uniqueLayouts = new Dictionary<string, Dictionary<string, Point>>();
|
||||||
flat_layout = new Dictionary<String, Point>();
|
_flatLayout = new Dictionary<string, Point>();
|
||||||
flat_layout_shortcuts = new Dictionary<String, String>();
|
_flatLayoutShortcuts = new Dictionary<string, string>();
|
||||||
client_layout = new Dictionary<String, ClientLocation>();
|
_clientLayout = new Dictionary<string, ClientLocation>();
|
||||||
|
|
||||||
ignoring_size_sync = new Stopwatch();
|
_ignoringSizeSync = new Stopwatch();
|
||||||
ignoring_size_sync.Start();
|
_ignoringSizeSync.Start();
|
||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
init_options();
|
init_options();
|
||||||
|
|
||||||
// DispatcherTimer setup
|
// DispatcherTimer setup
|
||||||
_dispatcherTimer = new DispatcherTimer();
|
_dispatcherTimer = new DispatcherTimer();
|
||||||
_dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
|
_dispatcherTimer.Tick += dispatcherTimer_Tick;
|
||||||
_dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
|
_dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
|
||||||
_dispatcherTimer.Start();
|
_dispatcherTimer.Start();
|
||||||
|
|
||||||
is_initialized = true;
|
_isInitialized = true;
|
||||||
|
|
||||||
previews_check_listbox.DisplayMember = "Text";
|
previews_check_listbox.DisplayMember = "Text";
|
||||||
|
|
||||||
@@ -127,21 +85,21 @@ namespace EveOPreview
|
|||||||
|
|
||||||
private void init_options()
|
private void init_options()
|
||||||
{
|
{
|
||||||
this.Minimized += new EventHandler(MainForm_Minimized);
|
this.Minimized += MainForm_Minimized;
|
||||||
|
|
||||||
option_zoom_on_hover.Checked = Properties.Settings.Default.zoom_on_hover;
|
option_zoom_on_hover.Checked = Properties.Settings.Default.zoom_on_hover;
|
||||||
zoom_anchor_button_map = new Dictionary<zoom_anchor_t, RadioButton>();
|
_zoomAnchorButtonMap = new Dictionary<ZoomAnchor, RadioButton>();
|
||||||
zoom_anchor_button_map[zoom_anchor_t.NW] = option_zoom_anchor_NW;
|
_zoomAnchorButtonMap[ZoomAnchor.NW] = option_zoom_anchor_NW;
|
||||||
zoom_anchor_button_map[zoom_anchor_t.N] = option_zoom_anchor_N;
|
_zoomAnchorButtonMap[ZoomAnchor.N] = option_zoom_anchor_N;
|
||||||
zoom_anchor_button_map[zoom_anchor_t.NE] = option_zoom_anchor_NE;
|
_zoomAnchorButtonMap[ZoomAnchor.NE] = option_zoom_anchor_NE;
|
||||||
zoom_anchor_button_map[zoom_anchor_t.W] = option_zoom_anchor_W;
|
_zoomAnchorButtonMap[ZoomAnchor.W] = option_zoom_anchor_W;
|
||||||
zoom_anchor_button_map[zoom_anchor_t.C] = option_zoom_anchor_C;
|
_zoomAnchorButtonMap[ZoomAnchor.C] = option_zoom_anchor_C;
|
||||||
zoom_anchor_button_map[zoom_anchor_t.E] = option_zoom_anchor_E;
|
_zoomAnchorButtonMap[ZoomAnchor.E] = option_zoom_anchor_E;
|
||||||
zoom_anchor_button_map[zoom_anchor_t.SW] = option_zoom_anchor_SW;
|
_zoomAnchorButtonMap[ZoomAnchor.SW] = option_zoom_anchor_SW;
|
||||||
zoom_anchor_button_map[zoom_anchor_t.S] = option_zoom_anchor_S;
|
_zoomAnchorButtonMap[ZoomAnchor.S] = option_zoom_anchor_S;
|
||||||
zoom_anchor_button_map[zoom_anchor_t.SE] = option_zoom_anchor_SE;
|
_zoomAnchorButtonMap[ZoomAnchor.SE] = option_zoom_anchor_SE;
|
||||||
zoom_anchor_button_map[(zoom_anchor_t)Properties.Settings.Default.zoom_anchor].Checked = true;
|
_zoomAnchorButtonMap[(ZoomAnchor)Properties.Settings.Default.zoom_anchor].Checked = true;
|
||||||
option_zoom_factor.Text = Properties.Settings.Default.zoom_amount.ToString();
|
option_zoom_factor.Text = Properties.Settings.Default.zoom_amount.ToString(CultureInfo.InvariantCulture);
|
||||||
|
|
||||||
option_always_on_top.Checked = Properties.Settings.Default.always_on_top;
|
option_always_on_top.Checked = Properties.Settings.Default.always_on_top;
|
||||||
option_hide_active.Checked = Properties.Settings.Default.hide_active;
|
option_hide_active.Checked = Properties.Settings.Default.hide_active;
|
||||||
@@ -163,7 +121,7 @@ namespace EveOPreview
|
|||||||
|
|
||||||
// disable/enable zoom suboptions
|
// disable/enable zoom suboptions
|
||||||
option_zoom_factor.Enabled = Properties.Settings.Default.zoom_on_hover;
|
option_zoom_factor.Enabled = Properties.Settings.Default.zoom_on_hover;
|
||||||
foreach (var kv in zoom_anchor_button_map)
|
foreach (var kv in _zoomAnchorButtonMap)
|
||||||
{
|
{
|
||||||
kv.Value.Enabled = Properties.Settings.Default.zoom_on_hover;
|
kv.Value.Enabled = Properties.Settings.Default.zoom_on_hover;
|
||||||
}
|
}
|
||||||
@@ -176,7 +134,7 @@ namespace EveOPreview
|
|||||||
|
|
||||||
private void spawn_and_kill_previews()
|
private void spawn_and_kill_previews()
|
||||||
{
|
{
|
||||||
if (!is_initialized) { return; }
|
if (!_isInitialized) { return; }
|
||||||
|
|
||||||
Process[] processes = Process.GetProcessesByName("ExeFile");
|
Process[] processes = Process.GetProcessesByName("ExeFile");
|
||||||
List<IntPtr> processHandles = new List<IntPtr>();
|
List<IntPtr> processHandles = new List<IntPtr>();
|
||||||
@@ -194,7 +152,7 @@ namespace EveOPreview
|
|||||||
if (!_previews.ContainsKey(process.MainWindowHandle) && process.MainWindowTitle != "")
|
if (!_previews.ContainsKey(process.MainWindowHandle) && process.MainWindowTitle != "")
|
||||||
{
|
{
|
||||||
_previews[process.MainWindowHandle] = new Preview(process.MainWindowHandle, "...", this, sync_size);
|
_previews[process.MainWindowHandle] = new Preview(process.MainWindowHandle, "...", this, sync_size);
|
||||||
_previews[process.MainWindowHandle].set_render_area_size(sync_size);
|
_previews[process.MainWindowHandle].set_render_area_size(sync_size);// TODO Remove
|
||||||
|
|
||||||
// apply more thumbnail specific options
|
// apply more thumbnail specific options
|
||||||
_previews[process.MainWindowHandle].MakeTopMost(Properties.Settings.Default.always_on_top);
|
_previews[process.MainWindowHandle].MakeTopMost(Properties.Settings.Default.always_on_top);
|
||||||
@@ -213,7 +171,7 @@ namespace EveOPreview
|
|||||||
_previews[process.MainWindowHandle].SetLabel(process.MainWindowTitle);
|
_previews[process.MainWindowHandle].SetLabel(process.MainWindowTitle);
|
||||||
string key = _previews[process.MainWindowHandle].Text;
|
string key = _previews[process.MainWindowHandle].Text;
|
||||||
string value;
|
string value;
|
||||||
if (flat_layout_shortcuts.TryGetValue(key, out value))
|
if (_flatLayoutShortcuts.TryGetValue(key, out value))
|
||||||
{
|
{
|
||||||
_previews[process.MainWindowHandle].registerShortcut(value);
|
_previews[process.MainWindowHandle].registerShortcut(value);
|
||||||
}
|
}
|
||||||
@@ -255,22 +213,18 @@ namespace EveOPreview
|
|||||||
|
|
||||||
private void refresh_client_window_locations(Process process)
|
private void refresh_client_window_locations(Process process)
|
||||||
{
|
{
|
||||||
if (Properties.Settings.Default.track_client_windows && client_layout.ContainsKey(process.MainWindowTitle))
|
if (Properties.Settings.Default.track_client_windows && _clientLayout.ContainsKey(process.MainWindowTitle))
|
||||||
{
|
{
|
||||||
MoveWindow(
|
GuiNativeMethods.MoveWindow(process.MainWindowHandle, _clientLayout[process.MainWindowTitle].X,
|
||||||
process.MainWindowHandle,
|
_clientLayout[process.MainWindowTitle].Y, _clientLayout[process.MainWindowTitle].Width,
|
||||||
client_layout[process.MainWindowTitle].X,
|
_clientLayout[process.MainWindowTitle].Height, true);
|
||||||
client_layout[process.MainWindowTitle].Y,
|
|
||||||
client_layout[process.MainWindowTitle].Width,
|
|
||||||
client_layout[process.MainWindowTitle].Height,
|
|
||||||
true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private string remove_nonconform_xml_characters(string entry)
|
private string remove_nonconform_xml_characters(string entry)
|
||||||
{
|
{
|
||||||
foreach (var kv in xml_bad_to_ok_chars)
|
foreach (var kv in _xmlBadToOkChars)
|
||||||
{
|
{
|
||||||
entry = entry.Replace(kv.Key, kv.Value);
|
entry = entry.Replace(kv.Key, kv.Value);
|
||||||
}
|
}
|
||||||
@@ -279,7 +233,7 @@ namespace EveOPreview
|
|||||||
|
|
||||||
private string restore_nonconform_xml_characters(string entry)
|
private string restore_nonconform_xml_characters(string entry)
|
||||||
{
|
{
|
||||||
foreach (var kv in xml_bad_to_ok_chars)
|
foreach (var kv in _xmlBadToOkChars)
|
||||||
{
|
{
|
||||||
entry = entry.Replace(kv.Value, kv.Key);
|
entry = entry.Replace(kv.Value, kv.Key);
|
||||||
}
|
}
|
||||||
@@ -304,12 +258,12 @@ namespace EveOPreview
|
|||||||
XElement rootElement = XElement.Load("layout.xml");
|
XElement rootElement = XElement.Load("layout.xml");
|
||||||
foreach (var el in rootElement.Elements())
|
foreach (var el in rootElement.Elements())
|
||||||
{
|
{
|
||||||
Dictionary<String, Point> inner = new Dictionary<String, Point>();
|
Dictionary<string, Point> inner = new Dictionary<string, Point>();
|
||||||
foreach (var inner_el in el.Elements())
|
foreach (var inner_el in el.Elements())
|
||||||
{
|
{
|
||||||
inner[ParseXElement(inner_el)] = new Point(Convert.ToInt32(inner_el.Element("x").Value), Convert.ToInt32(inner_el.Element("y").Value));
|
inner[ParseXElement(inner_el)] = new Point(Convert.ToInt32(inner_el.Element("x")?.Value), Convert.ToInt32(inner_el.Element("y")?.Value));
|
||||||
}
|
}
|
||||||
unique_layouts[ParseXElement(el)] = inner;
|
_uniqueLayouts[ParseXElement(el)] = inner;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,12 +272,12 @@ namespace EveOPreview
|
|||||||
XElement rootElement = XElement.Load("flat_layout.xml");
|
XElement rootElement = XElement.Load("flat_layout.xml");
|
||||||
foreach (var el in rootElement.Elements())
|
foreach (var el in rootElement.Elements())
|
||||||
{
|
{
|
||||||
flat_layout[ParseXElement(el)] = new Point(Convert.ToInt32(el.Element("x").Value), Convert.ToInt32(el.Element("y").Value));
|
_flatLayout[ParseXElement(el)] = new Point(Convert.ToInt32(el.Element("x").Value), Convert.ToInt32(el.Element("y").Value));
|
||||||
flat_layout_shortcuts[ParseXElement(el)] = "";
|
_flatLayoutShortcuts[ParseXElement(el)] = "";
|
||||||
|
|
||||||
if (el.Element("shortcut") != null)
|
if (el.Element("shortcut") != null)
|
||||||
{
|
{
|
||||||
flat_layout_shortcuts[ParseXElement(el)] = el.Element("shortcut").Value;
|
_flatLayoutShortcuts[ParseXElement(el)] = el.Element("shortcut").Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -339,7 +293,7 @@ namespace EveOPreview
|
|||||||
clientLocation.Width = Convert.ToInt32(el.Element("width").Value);
|
clientLocation.Width = Convert.ToInt32(el.Element("width").Value);
|
||||||
clientLocation.Height = Convert.ToInt32(el.Element("height").Value);
|
clientLocation.Height = Convert.ToInt32(el.Element("height").Value);
|
||||||
|
|
||||||
client_layout[ParseXElement(el)] = clientLocation;
|
_clientLayout[ParseXElement(el)] = clientLocation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -347,16 +301,16 @@ namespace EveOPreview
|
|||||||
private void store_layout()
|
private void store_layout()
|
||||||
{
|
{
|
||||||
XElement el = new XElement("layouts");
|
XElement el = new XElement("layouts");
|
||||||
foreach (var client in unique_layouts.Keys)
|
foreach (var client in _uniqueLayouts.Keys)
|
||||||
{
|
{
|
||||||
if (client == "")
|
if (client == "")
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
XElement layout = MakeXElement(client);
|
XElement layout = MakeXElement(client);
|
||||||
foreach (var thumbnail_ in unique_layouts[client])
|
foreach (var thumbnail_ in _uniqueLayouts[client])
|
||||||
{
|
{
|
||||||
String thumbnail = thumbnail_.Key;
|
string thumbnail = thumbnail_.Key;
|
||||||
if (thumbnail == "" || thumbnail == "...")
|
if (thumbnail == "" || thumbnail == "...")
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@@ -372,7 +326,7 @@ namespace EveOPreview
|
|||||||
el.Save("layout.xml");
|
el.Save("layout.xml");
|
||||||
|
|
||||||
XElement el2 = new XElement("flat_layout");
|
XElement el2 = new XElement("flat_layout");
|
||||||
foreach (var clientKV in flat_layout)
|
foreach (var clientKV in _flatLayout)
|
||||||
{
|
{
|
||||||
if (clientKV.Key == "" || clientKV.Key == "...")
|
if (clientKV.Key == "" || clientKV.Key == "...")
|
||||||
{
|
{
|
||||||
@@ -383,7 +337,7 @@ namespace EveOPreview
|
|||||||
layout.Add(new XElement("y", clientKV.Value.Y));
|
layout.Add(new XElement("y", clientKV.Value.Y));
|
||||||
|
|
||||||
string shortcut;
|
string shortcut;
|
||||||
if (flat_layout_shortcuts.TryGetValue(clientKV.Key, out shortcut))
|
if (_flatLayoutShortcuts.TryGetValue(clientKV.Key, out shortcut))
|
||||||
{
|
{
|
||||||
layout.Add(new XElement("shortcut", shortcut));
|
layout.Add(new XElement("shortcut", shortcut));
|
||||||
}
|
}
|
||||||
@@ -393,7 +347,7 @@ namespace EveOPreview
|
|||||||
el2.Save("flat_layout.xml");
|
el2.Save("flat_layout.xml");
|
||||||
|
|
||||||
XElement el3 = new XElement("client_layout");
|
XElement el3 = new XElement("client_layout");
|
||||||
foreach (var clientKV in client_layout)
|
foreach (var clientKV in _clientLayout)
|
||||||
{
|
{
|
||||||
if (clientKV.Key == "" || clientKV.Key == "...")
|
if (clientKV.Key == "" || clientKV.Key == "...")
|
||||||
{
|
{
|
||||||
@@ -410,10 +364,10 @@ namespace EveOPreview
|
|||||||
el3.Save("client_layout.xml");
|
el3.Save("client_layout.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handle_unique_layout(Preview preview, String last_known_active_window)
|
private void handle_unique_layout(Preview preview, string last_known_active_window)
|
||||||
{
|
{
|
||||||
Dictionary<String, Point> layout;
|
Dictionary<string, Point> layout;
|
||||||
if (unique_layouts.TryGetValue(last_known_active_window, out layout))
|
if (_uniqueLayouts.TryGetValue(last_known_active_window, out layout))
|
||||||
{
|
{
|
||||||
Point new_loc;
|
Point new_loc;
|
||||||
if (Properties.Settings.Default.unique_layout && layout.TryGetValue(preview.Text, out new_loc))
|
if (Properties.Settings.Default.unique_layout && layout.TryGetValue(preview.Text, out new_loc))
|
||||||
@@ -429,8 +383,8 @@ namespace EveOPreview
|
|||||||
else if (last_known_active_window != "")
|
else if (last_known_active_window != "")
|
||||||
{
|
{
|
||||||
// create outer dict
|
// create outer dict
|
||||||
unique_layouts[last_known_active_window] = new Dictionary<String, Point>();
|
_uniqueLayouts[last_known_active_window] = new Dictionary<string, Point>();
|
||||||
unique_layouts[last_known_active_window][preview.Text] = preview.Location;
|
_uniqueLayouts[last_known_active_window][preview.Text] = preview.Location;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -442,8 +396,8 @@ namespace EveOPreview
|
|||||||
|
|
||||||
foreach (Process process in processes)
|
foreach (Process process in processes)
|
||||||
{
|
{
|
||||||
Rect rect = new Rect();
|
RECT rect = new RECT();
|
||||||
GetWindowRect(process.MainWindowHandle, out rect);
|
GuiNativeMethods.GetWindowRect(process.MainWindowHandle, out rect);
|
||||||
|
|
||||||
int left = Math.Abs(rect.Left);
|
int left = Math.Abs(rect.Left);
|
||||||
int right = Math.Abs(rect.Right);
|
int right = Math.Abs(rect.Right);
|
||||||
@@ -460,7 +414,7 @@ namespace EveOPreview
|
|||||||
clientLocation.Height = client_height;
|
clientLocation.Height = client_height;
|
||||||
|
|
||||||
|
|
||||||
client_layout[process.MainWindowTitle] = clientLocation;
|
_clientLayout[process.MainWindowTitle] = clientLocation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -473,7 +427,7 @@ namespace EveOPreview
|
|||||||
{
|
{
|
||||||
entry.Value.MakeTopMost(Properties.Settings.Default.always_on_top);
|
entry.Value.MakeTopMost(Properties.Settings.Default.always_on_top);
|
||||||
//makes the PreviewOverlay topmost
|
//makes the PreviewOverlay topmost
|
||||||
entry.Value.overlay.makeTopMost();
|
entry.Value.overlay.MakeTopMost();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -481,13 +435,13 @@ namespace EveOPreview
|
|||||||
private void handle_flat_layout(Preview preview)
|
private void handle_flat_layout(Preview preview)
|
||||||
{
|
{
|
||||||
Point layout;
|
Point layout;
|
||||||
if (flat_layout.TryGetValue(preview.Text, out layout))
|
if (_flatLayout.TryGetValue(preview.Text, out layout))
|
||||||
{
|
{
|
||||||
preview.doMove(layout);
|
preview.doMove(layout);
|
||||||
}
|
}
|
||||||
else if (preview.Text != "")
|
else if (preview.Text != "")
|
||||||
{
|
{
|
||||||
flat_layout[preview.Text] = preview.Location;
|
_flatLayout[preview.Text] = preview.Location;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -536,7 +490,7 @@ namespace EveOPreview
|
|||||||
entry.Value.hover_zoom = Properties.Settings.Default.zoom_on_hover;
|
entry.Value.hover_zoom = Properties.Settings.Default.zoom_on_hover;
|
||||||
entry.Value.show_overlay = Properties.Settings.Default.show_overlay;
|
entry.Value.show_overlay = Properties.Settings.Default.show_overlay;
|
||||||
//makes the PreviewOverlay TopMost
|
//makes the PreviewOverlay TopMost
|
||||||
entry.Value.overlay.makeTopMost();
|
entry.Value.overlay.MakeTopMost();
|
||||||
if (!entry.Value.is_hovered_over)
|
if (!entry.Value.is_hovered_over)
|
||||||
{
|
{
|
||||||
entry.Value.Opacity = Properties.Settings.Default.opacity;
|
entry.Value.Opacity = Properties.Settings.Default.opacity;
|
||||||
@@ -549,13 +503,13 @@ namespace EveOPreview
|
|||||||
|
|
||||||
public void syncronize_preview_size(Size sync_size)
|
public void syncronize_preview_size(Size sync_size)
|
||||||
{
|
{
|
||||||
if (!is_initialized) { return; }
|
if (!_isInitialized) { return; }
|
||||||
|
|
||||||
if (Properties.Settings.Default.sync_resize &&
|
if (Properties.Settings.Default.sync_resize &&
|
||||||
Properties.Settings.Default.show_thumb_frames &&
|
Properties.Settings.Default.show_thumb_frames &&
|
||||||
ignoring_size_sync.ElapsedMilliseconds > 500)
|
_ignoringSizeSync.ElapsedMilliseconds > 500)
|
||||||
{
|
{
|
||||||
ignoring_size_sync.Stop();
|
_ignoringSizeSync.Stop();
|
||||||
|
|
||||||
option_sync_size_x.Text = sync_size.Width.ToString();
|
option_sync_size_x.Text = sync_size.Width.ToString();
|
||||||
option_sync_size_y.Text = sync_size.Height.ToString();
|
option_sync_size_y.Text = sync_size.Height.ToString();
|
||||||
@@ -573,25 +527,25 @@ namespace EveOPreview
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void register_preview_position(String preview_title, Point position)
|
public void register_preview_position(string preview_title, Point position)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (Properties.Settings.Default.unique_layout)
|
if (Properties.Settings.Default.unique_layout)
|
||||||
{
|
{
|
||||||
Dictionary<String, Point> layout;
|
Dictionary<string, Point> layout;
|
||||||
if (unique_layouts.TryGetValue(_activeClientTitle, out layout))
|
if (_uniqueLayouts.TryGetValue(_activeClientTitle, out layout))
|
||||||
{
|
{
|
||||||
layout[preview_title] = position;
|
layout[preview_title] = position;
|
||||||
}
|
}
|
||||||
else if (_activeClientTitle == "")
|
else if (_activeClientTitle == "")
|
||||||
{
|
{
|
||||||
unique_layouts[_activeClientTitle] = new Dictionary<String, Point>();
|
_uniqueLayouts[_activeClientTitle] = new Dictionary<string, Point>();
|
||||||
unique_layouts[_activeClientTitle][preview_title] = position;
|
_uniqueLayouts[_activeClientTitle][preview_title] = position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flat_layout[preview_title] = position;
|
_flatLayout[preview_title] = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -601,7 +555,7 @@ namespace EveOPreview
|
|||||||
{
|
{
|
||||||
spawn_and_kill_previews();
|
spawn_and_kill_previews();
|
||||||
refresh_thumbnails();
|
refresh_thumbnails();
|
||||||
if (ignoring_size_sync.ElapsedMilliseconds > 500) { ignoring_size_sync.Stop(); };
|
if (_ignoringSizeSync.ElapsedMilliseconds > 500) { _ignoringSizeSync.Stop(); };
|
||||||
|
|
||||||
if (DwmApiNativeMethods.DwmIsCompositionEnabled())
|
if (DwmApiNativeMethods.DwmIsCompositionEnabled())
|
||||||
{
|
{
|
||||||
@@ -717,9 +671,9 @@ namespace EveOPreview
|
|||||||
|
|
||||||
if (Properties.Settings.Default.show_thumb_frames)
|
if (Properties.Settings.Default.show_thumb_frames)
|
||||||
{
|
{
|
||||||
ignoring_size_sync.Stop();
|
_ignoringSizeSync.Stop();
|
||||||
ignoring_size_sync.Reset();
|
_ignoringSizeSync.Reset();
|
||||||
ignoring_size_sync.Start();
|
_ignoringSizeSync.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var thumbnail in _previews)
|
foreach (var thumbnail in _previews)
|
||||||
@@ -752,9 +706,9 @@ namespace EveOPreview
|
|||||||
Properties.Settings.Default.Save();
|
Properties.Settings.Default.Save();
|
||||||
refresh_thumbnails();
|
refresh_thumbnails();
|
||||||
option_zoom_factor.Enabled = Properties.Settings.Default.zoom_on_hover;
|
option_zoom_factor.Enabled = Properties.Settings.Default.zoom_on_hover;
|
||||||
if (is_initialized)
|
if (_isInitialized)
|
||||||
{
|
{
|
||||||
foreach (var kv in zoom_anchor_button_map)
|
foreach (var kv in _zoomAnchorButtonMap)
|
||||||
{
|
{
|
||||||
kv.Value.Enabled = Properties.Settings.Default.zoom_on_hover;
|
kv.Value.Enabled = Properties.Settings.Default.zoom_on_hover;
|
||||||
}
|
}
|
||||||
@@ -771,7 +725,7 @@ namespace EveOPreview
|
|||||||
|
|
||||||
private void handle_zoom_anchor_setting()
|
private void handle_zoom_anchor_setting()
|
||||||
{
|
{
|
||||||
foreach (var kv in zoom_anchor_button_map)
|
foreach (var kv in _zoomAnchorButtonMap)
|
||||||
{
|
{
|
||||||
if (kv.Value.Checked == true)
|
if (kv.Value.Checked == true)
|
||||||
Properties.Settings.Default.zoom_anchor = (byte)kv.Key;
|
Properties.Settings.Default.zoom_anchor = (byte)kv.Key;
|
||||||
@@ -863,33 +817,29 @@ namespace EveOPreview
|
|||||||
|
|
||||||
private void OnRestored(EventArgs e)
|
private void OnRestored(EventArgs e)
|
||||||
{
|
{
|
||||||
if (Restored != null)
|
Restored?.Invoke(this, e);
|
||||||
{
|
|
||||||
Restored(this, e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void WndProc(ref Message m)
|
protected override void WndProc(ref Message m)
|
||||||
{
|
{
|
||||||
switch (m.Msg)
|
switch (m.Msg)
|
||||||
{
|
{
|
||||||
case WM_SIZE:
|
case GuiNativeMethods.WM_SIZE:
|
||||||
switch (m.WParam.ToInt32())
|
switch (m.WParam.ToInt32())
|
||||||
{
|
{
|
||||||
case SIZE_RESTORED:
|
case GuiNativeMethods.SIZE_RESTORED:
|
||||||
OnRestored(EventArgs.Empty);
|
OnRestored(EventArgs.Empty);
|
||||||
break;
|
break;
|
||||||
case SIZE_MINIMIZED:
|
case GuiNativeMethods.SIZE_MINIMIZED:
|
||||||
OnMinimized(EventArgs.Empty);
|
OnMinimized(EventArgs.Empty);
|
||||||
break;
|
break;
|
||||||
case SIZE_MAXIMIZED:
|
case GuiNativeMethods.SIZE_MAXIMIZED:
|
||||||
OnMaximized(EventArgs.Empty);
|
OnMaximized(EventArgs.Empty);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
base.WndProc(ref m);
|
base.WndProc(ref m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
15
Eve-O-Preview/GUI/ZoomAnchor.cs
Normal file
15
Eve-O-Preview/GUI/ZoomAnchor.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
namespace EveOPreview
|
||||||
|
{
|
||||||
|
public enum ZoomAnchor
|
||||||
|
{
|
||||||
|
NW = 0,
|
||||||
|
N,
|
||||||
|
NE,
|
||||||
|
W,
|
||||||
|
C,
|
||||||
|
E,
|
||||||
|
SW,
|
||||||
|
S,
|
||||||
|
SE
|
||||||
|
}
|
||||||
|
}
|
36
Eve-O-Preview/Preview/Preview.Designer.cs
generated
36
Eve-O-Preview/Preview/Preview.Designer.cs
generated
@@ -14,24 +14,24 @@ namespace EveOPreview
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.render_area = new System.Windows.Forms.PictureBox();
|
this.RenderAreaPictureBox = new System.Windows.Forms.PictureBox();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.render_area)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.RenderAreaPictureBox)).BeginInit();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// render_area
|
// RenderAreaPictureBox
|
||||||
//
|
//
|
||||||
this.render_area.BackColor = System.Drawing.Color.Transparent;
|
this.RenderAreaPictureBox.BackColor = System.Drawing.Color.Transparent;
|
||||||
this.render_area.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
|
this.RenderAreaPictureBox.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
|
||||||
this.render_area.Cursor = System.Windows.Forms.Cursors.Hand;
|
this.RenderAreaPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
this.render_area.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.RenderAreaPictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.render_area.Location = new System.Drawing.Point(0, 0);
|
this.RenderAreaPictureBox.Location = new System.Drawing.Point(0, 0);
|
||||||
this.render_area.Margin = new System.Windows.Forms.Padding(0);
|
this.RenderAreaPictureBox.Margin = new System.Windows.Forms.Padding(0);
|
||||||
this.render_area.Name = "render_area";
|
this.RenderAreaPictureBox.Name = "RenderAreaPictureBox";
|
||||||
this.render_area.Size = new System.Drawing.Size(153, 89);
|
this.RenderAreaPictureBox.Size = new System.Drawing.Size(153, 89);
|
||||||
this.render_area.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
|
this.RenderAreaPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
|
||||||
this.render_area.TabIndex = 0;
|
this.RenderAreaPictureBox.TabIndex = 0;
|
||||||
this.render_area.TabStop = false;
|
this.RenderAreaPictureBox.TabStop = false;
|
||||||
this.render_area.MouseUp += new System.Windows.Forms.MouseEventHandler(this.render_area_Click);
|
this.RenderAreaPictureBox.MouseUp += new System.Windows.Forms.MouseEventHandler(this.render_area_Click);
|
||||||
//
|
//
|
||||||
// Preview
|
// Preview
|
||||||
//
|
//
|
||||||
@@ -40,7 +40,7 @@ namespace EveOPreview
|
|||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(153, 89);
|
this.ClientSize = new System.Drawing.Size(153, 89);
|
||||||
this.ControlBox = false;
|
this.ControlBox = false;
|
||||||
this.Controls.Add(this.render_area);
|
this.Controls.Add(this.RenderAreaPictureBox);
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
|
||||||
this.MaximizeBox = false;
|
this.MaximizeBox = false;
|
||||||
this.MinimizeBox = false;
|
this.MinimizeBox = false;
|
||||||
@@ -52,7 +52,7 @@ namespace EveOPreview
|
|||||||
this.Text = "Preview";
|
this.Text = "Preview";
|
||||||
this.TopMost = true;
|
this.TopMost = true;
|
||||||
this.Load += new System.EventHandler(this.Preview_Load);
|
this.Load += new System.EventHandler(this.Preview_Load);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.render_area)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.RenderAreaPictureBox)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ namespace EveOPreview
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private System.Windows.Forms.PictureBox render_area;
|
private System.Windows.Forms.PictureBox RenderAreaPictureBox;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -27,22 +27,6 @@ namespace EveOPreview
|
|||||||
|
|
||||||
public PreviewOverlay overlay;
|
public PreviewOverlay overlay;
|
||||||
|
|
||||||
public void MakeHidden(bool wha)
|
|
||||||
{
|
|
||||||
hide = wha;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return this.Text;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void MakeTopMost(bool topmost)
|
|
||||||
{
|
|
||||||
this.TopMost = topmost && !(this.hide);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Preview(IntPtr sourceWindow, String title, MainForm spawner, Size size)
|
public Preview(IntPtr sourceWindow, String title, MainForm spawner, Size size)
|
||||||
{
|
{
|
||||||
@@ -57,15 +41,28 @@ namespace EveOPreview
|
|||||||
|
|
||||||
this.overlay = new PreviewOverlay(this);
|
this.overlay = new PreviewOverlay(this);
|
||||||
|
|
||||||
this.render_area.MouseHover += new System.EventHandler(this.preview_MouseHover);
|
this.RenderAreaPictureBox.MouseHover += new System.EventHandler(this.preview_MouseHover);
|
||||||
this.render_area.MouseLeave += new System.EventHandler(this.preview_MouseLeave);
|
this.RenderAreaPictureBox.MouseLeave += new System.EventHandler(this.preview_MouseLeave);
|
||||||
|
|
||||||
this.old_size = this.Size;
|
this.old_size = this.Size;
|
||||||
this.old_position = this.Location;
|
this.old_position = this.Location;
|
||||||
|
|
||||||
has_been_set_up = true;
|
has_been_set_up = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void MakeHidden(bool wha)
|
||||||
|
{
|
||||||
|
hide = wha;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return this.Text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void MakeTopMost(bool topmost)
|
||||||
|
{
|
||||||
|
this.TopMost = topmost && !(this.hide);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void preview_MouseHover(object sender, System.EventArgs e)
|
public void preview_MouseHover(object sender, System.EventArgs e)
|
||||||
@@ -138,34 +135,34 @@ namespace EveOPreview
|
|||||||
|
|
||||||
Size = new Size((int)(hover_zoom_factor * (float)Size.Width), (int)(hover_zoom_factor * (float)Size.Height));
|
Size = new Size((int)(hover_zoom_factor * (float)Size.Width), (int)(hover_zoom_factor * (float)Size.Height));
|
||||||
|
|
||||||
switch ((MainForm.zoom_anchor_t)Properties.Settings.Default.zoom_anchor)
|
switch ((ZoomAnchor)Properties.Settings.Default.zoom_anchor)
|
||||||
{
|
{
|
||||||
case (MainForm.zoom_anchor_t.NW):
|
case (ZoomAnchor.NW):
|
||||||
break;
|
break;
|
||||||
case (MainForm.zoom_anchor_t.N):
|
case (ZoomAnchor.N):
|
||||||
Location = new Point(Location.X - Size.Width / 2 + old_size.Width / 2, Location.Y);
|
Location = new Point(Location.X - Size.Width / 2 + old_size.Width / 2, Location.Y);
|
||||||
break;
|
break;
|
||||||
case (MainForm.zoom_anchor_t.NE):
|
case (ZoomAnchor.NE):
|
||||||
Location = new Point(Location.X - Size.Width + old_size.Width, Location.Y);
|
Location = new Point(Location.X - Size.Width + old_size.Width, Location.Y);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (MainForm.zoom_anchor_t.W):
|
case (ZoomAnchor.W):
|
||||||
Location = new Point(Location.X, Location.Y - Size.Height / 2 + old_size.Height / 2);
|
Location = new Point(Location.X, Location.Y - Size.Height / 2 + old_size.Height / 2);
|
||||||
break;
|
break;
|
||||||
case (MainForm.zoom_anchor_t.C):
|
case (ZoomAnchor.C):
|
||||||
Location = new Point(Location.X - Size.Width / 2 + old_size.Width / 2, Location.Y - Size.Height / 2 + old_size.Height / 2);
|
Location = new Point(Location.X - Size.Width / 2 + old_size.Width / 2, Location.Y - Size.Height / 2 + old_size.Height / 2);
|
||||||
break;
|
break;
|
||||||
case (MainForm.zoom_anchor_t.E):
|
case (ZoomAnchor.E):
|
||||||
Location = new Point(Location.X - Size.Width + old_size.Width, Location.Y - Size.Height / 2 + old_size.Height / 2);
|
Location = new Point(Location.X - Size.Width + old_size.Width, Location.Y - Size.Height / 2 + old_size.Height / 2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (MainForm.zoom_anchor_t.SW):
|
case (ZoomAnchor.SW):
|
||||||
Location = new Point(Location.X, Location.Y - Size.Height + old_size.Height);
|
Location = new Point(Location.X, Location.Y - Size.Height + old_size.Height);
|
||||||
break;
|
break;
|
||||||
case (MainForm.zoom_anchor_t.S):
|
case (ZoomAnchor.S):
|
||||||
Location = new Point(Location.X - Size.Width / 2 + old_size.Width / 2, Location.Y - Size.Height + old_size.Height);
|
Location = new Point(Location.X - Size.Width / 2 + old_size.Width / 2, Location.Y - Size.Height + old_size.Height);
|
||||||
break;
|
break;
|
||||||
case (MainForm.zoom_anchor_t.SE):
|
case (ZoomAnchor.SE):
|
||||||
Location = new Point(Location.X - Size.Width + old_size.Width, Location.Y - Size.Height + old_size.Height);
|
Location = new Point(Location.X - Size.Width + old_size.Width, Location.Y - Size.Height + old_size.Height);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -224,7 +221,7 @@ namespace EveOPreview
|
|||||||
public void SetLabel(String label)
|
public void SetLabel(String label)
|
||||||
{
|
{
|
||||||
this.Text = label;
|
this.Text = label;
|
||||||
this.overlay.client_label.Text = label;
|
this.overlay.SetOverlayLabel(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RefreshPreview()
|
public void RefreshPreview()
|
||||||
@@ -245,13 +242,13 @@ namespace EveOPreview
|
|||||||
thumbnail_has_been_set_up = false;
|
thumbnail_has_been_set_up = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Size overlay_size = this.render_area.Size;
|
Size overlay_size = this.RenderAreaPictureBox.Size;
|
||||||
overlay_size.Width -= 2 * 5;
|
overlay_size.Width -= 2 * 5;
|
||||||
overlay_size.Height -= 2 * 5;
|
overlay_size.Height -= 2 * 5;
|
||||||
|
|
||||||
Point overlay_location = this.Location;
|
Point overlay_location = this.Location;
|
||||||
overlay_location.X += 5 + (this.Size.Width - this.render_area.Size.Width) / 2;
|
overlay_location.X += 5 + (this.Size.Width - this.RenderAreaPictureBox.Size.Width) / 2;
|
||||||
overlay_location.Y += 5 + (this.Size.Height - this.render_area.Size.Height) - (this.Size.Width - this.render_area.Size.Width) / 2;
|
overlay_location.Y += 5 + (this.Size.Height - this.RenderAreaPictureBox.Size.Height) - (this.Size.Width - this.RenderAreaPictureBox.Size.Width) / 2;
|
||||||
|
|
||||||
this.overlay.Size = overlay_size;
|
this.overlay.Size = overlay_size;
|
||||||
this.overlay.Location = overlay_location;
|
this.overlay.Location = overlay_location;
|
||||||
@@ -344,6 +341,5 @@ namespace EveOPreview
|
|||||||
{
|
{
|
||||||
this.Size = size;
|
this.Size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
61
Eve-O-Preview/Preview/PreviewOverlay.Designer.cs
generated
61
Eve-O-Preview/Preview/PreviewOverlay.Designer.cs
generated
@@ -28,36 +28,36 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.overlay_area = new System.Windows.Forms.PictureBox();
|
System.Windows.Forms.PictureBox OverlayAreaPictureBox;
|
||||||
this.client_label = new System.Windows.Forms.Label();
|
this.OverlayLabel = new System.Windows.Forms.Label();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.overlay_area)).BeginInit();
|
OverlayAreaPictureBox = new System.Windows.Forms.PictureBox();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(OverlayAreaPictureBox)).BeginInit();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// overlay_area
|
// OverlayAreaPictureBox
|
||||||
//
|
//
|
||||||
this.overlay_area.BackColor = System.Drawing.Color.Transparent;
|
OverlayAreaPictureBox.BackColor = System.Drawing.Color.Transparent;
|
||||||
this.overlay_area.Cursor = System.Windows.Forms.Cursors.Hand;
|
OverlayAreaPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
this.overlay_area.Dock = System.Windows.Forms.DockStyle.Fill;
|
OverlayAreaPictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.overlay_area.Location = new System.Drawing.Point(0, 0);
|
OverlayAreaPictureBox.Location = new System.Drawing.Point(0, 0);
|
||||||
this.overlay_area.Name = "overlay_area";
|
OverlayAreaPictureBox.Name = "OverlayAreaPictureBox";
|
||||||
this.overlay_area.Size = new System.Drawing.Size(284, 262);
|
OverlayAreaPictureBox.Size = new System.Drawing.Size(284, 262);
|
||||||
this.overlay_area.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
|
OverlayAreaPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
|
||||||
this.overlay_area.TabIndex = 0;
|
OverlayAreaPictureBox.TabIndex = 0;
|
||||||
this.overlay_area.TabStop = false;
|
OverlayAreaPictureBox.TabStop = false;
|
||||||
this.overlay_area.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_Click);
|
OverlayAreaPictureBox.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OverlayArea_Click);
|
||||||
//
|
//
|
||||||
// client_label
|
// OverlayLabel
|
||||||
//
|
//
|
||||||
this.client_label.AutoSize = true;
|
this.OverlayLabel.AutoSize = true;
|
||||||
this.client_label.Dock = System.Windows.Forms.DockStyle.Top;
|
this.OverlayLabel.Dock = System.Windows.Forms.DockStyle.Top;
|
||||||
this.client_label.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
this.OverlayLabel.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
this.client_label.ForeColor = System.Drawing.Color.DarkGray;
|
this.OverlayLabel.ForeColor = System.Drawing.Color.DarkGray;
|
||||||
this.client_label.Location = new System.Drawing.Point(0, 0);
|
this.OverlayLabel.Location = new System.Drawing.Point(0, 0);
|
||||||
this.client_label.Name = "client_label";
|
this.OverlayLabel.Name = "OverlayLabel";
|
||||||
this.client_label.Size = new System.Drawing.Size(25, 13);
|
this.OverlayLabel.Size = new System.Drawing.Size(25, 13);
|
||||||
this.client_label.TabIndex = 1;
|
this.OverlayLabel.TabIndex = 1;
|
||||||
this.client_label.Text = "...";
|
this.OverlayLabel.Text = "...";
|
||||||
this.client_label.Click += new System.EventHandler(this.client_label_Click);
|
|
||||||
//
|
//
|
||||||
// PreviewOverlay
|
// PreviewOverlay
|
||||||
//
|
//
|
||||||
@@ -66,8 +66,8 @@
|
|||||||
this.BackColor = System.Drawing.Color.Black;
|
this.BackColor = System.Drawing.Color.Black;
|
||||||
this.ClientSize = new System.Drawing.Size(284, 262);
|
this.ClientSize = new System.Drawing.Size(284, 262);
|
||||||
this.ControlBox = false;
|
this.ControlBox = false;
|
||||||
this.Controls.Add(this.client_label);
|
this.Controls.Add(this.OverlayLabel);
|
||||||
this.Controls.Add(this.overlay_area);
|
this.Controls.Add(OverlayAreaPictureBox);
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||||
this.MaximizeBox = false;
|
this.MaximizeBox = false;
|
||||||
this.MinimizeBox = false;
|
this.MinimizeBox = false;
|
||||||
@@ -77,8 +77,7 @@
|
|||||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||||
this.Text = "PreviewOverlay";
|
this.Text = "PreviewOverlay";
|
||||||
this.TransparencyKey = System.Drawing.Color.Black;
|
this.TransparencyKey = System.Drawing.Color.Black;
|
||||||
this.Load += new System.EventHandler(this.PreviewOverlay_Load);
|
((System.ComponentModel.ISupportInitialize)(OverlayAreaPictureBox)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.overlay_area)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|
||||||
@@ -86,8 +85,6 @@
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public System.Windows.Forms.PictureBox overlay_area;
|
private System.Windows.Forms.Label OverlayLabel;
|
||||||
public System.Windows.Forms.Label client_label;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,44 +1,30 @@
|
|||||||
using System;
|
using System.Windows.Forms;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace EveOPreview
|
namespace EveOPreview
|
||||||
{
|
{
|
||||||
public partial class PreviewOverlay : Form
|
public partial class PreviewOverlay : Form
|
||||||
{
|
{
|
||||||
private Preview parent;
|
private readonly Preview _parent;
|
||||||
private Color original_color;
|
|
||||||
public PreviewOverlay(Preview parent)
|
public PreviewOverlay(Preview parent)
|
||||||
{
|
{
|
||||||
this.parent = parent;
|
this._parent = parent;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
original_color = overlay_area.BackColor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PreviewOverlay_Load(object sender, EventArgs e)
|
private void OverlayArea_Click(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
|
this._parent.render_area_Click(sender, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void pictureBox1_Click(object sender, MouseEventArgs e)
|
public void MakeTopMost()
|
||||||
{
|
|
||||||
this.parent.render_area_Click(sender, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void makeTopMost()
|
|
||||||
{
|
{
|
||||||
this.TopMost = true;
|
this.TopMost = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void client_label_Click(object sender, EventArgs e)
|
public void SetOverlayLabel(string label)
|
||||||
{
|
{
|
||||||
|
this.OverlayLabel.Text = label;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override CreateParams CreateParams
|
protected override CreateParams CreateParams
|
||||||
@@ -50,6 +36,5 @@ namespace EveOPreview
|
|||||||
return Params;
|
return Params;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -117,4 +117,7 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
|
<metadata name="OverlayAreaPictureBox.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>False</value>
|
||||||
|
</metadata>
|
||||||
</root>
|
</root>
|
@@ -1,16 +1,18 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
[assembly: AssemblyTitle("PreviewToy")]
|
[assembly: AssemblyTitle("EVE-O Preview")]
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("?")]
|
[assembly: AssemblyCompany("")]
|
||||||
[assembly: AssemblyProduct("PreviewToy")]
|
[assembly: AssemblyProduct("EVE-O Preview")]
|
||||||
[assembly: AssemblyCopyright("")]
|
[assembly: AssemblyCopyright("")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
[assembly: Guid("04f08f8d-9e98-423b-acdb-4effb31c0d35")]
|
[assembly: Guid("04f08f8d-9e98-423b-acdb-4effb31c0d35")]
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
[assembly: AssemblyVersion("1.18.0.0")]
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
[assembly: AssemblyFileVersion("1.18.0.0")]
|
||||||
|
|
||||||
|
// Provide your own key name to build the app locally
|
||||||
|
[assembly: AssemblyKeyName("Phrynohyas")]
|
||||||
|
Binary file not shown.
Reference in New Issue
Block a user